* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #171a23;
  --border: #262a36;
  --text: #e6e8ee;
  --muted: #8a91a3;
  --accent: #6366f1;
  --ok: #22c55e;
  --warn: #f59e0b;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.view { min-height: 100vh; }
.hidden { display: none !important; }

/* Login */
#login-view {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}
.login-card h1 { margin-bottom: .25rem; }
.login-card p { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.login-card input {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  margin-bottom: .75rem;
}
.login-card button {
  width: 100%;
  padding: .75rem;
  background: var(--accent);
  border: none;
  color: white;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { opacity: .9; }
.error { color: #f87171; font-size: .85rem; margin-top: .5rem; }

/* Header */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header h1 { font-size: 1.1rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 1rem; }

/* Main */
main { padding: 2rem; max-width: 1200px; margin: 0 auto; }
section h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 1rem; }

/* Grid cuentas */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 1.05rem; }
.badge {
  font-size: .7rem; padding: .2rem .55rem; border-radius: 999px;
  background: rgba(34,197,94,.15); color: var(--ok);
  text-transform: uppercase; letter-spacing: .03em; font-weight: 600;
}
.badge.paused { background: rgba(245,158,11,.15); color: var(--warn); }
.link-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font-size: .75rem;
  padding: .3rem .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; }

/* Botones */
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .45rem .8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
}
button.ghost:hover { border-color: var(--accent); }
button.small { font-size: .75rem; padding: .3rem .6rem; }

/* Tareas */
.tasks { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.tasks li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
}
.tasks label { display: flex; gap: .75rem; align-items: center; cursor: pointer; }
.tasks input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--accent); }

/* Texto */
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.dot { color: var(--accent); }

/* Detalle cuenta */
#account-view header { gap: 1rem; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.detail-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.detail-block h3 { font-size: .9rem; margin-bottom: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.links-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.links-list a {
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  padding: .4rem .6rem;
  border-radius: 6px;
  display: block;
}
.links-list a:hover { background: var(--bg); color: var(--accent); }

@media (max-width: 640px) {
  header { padding: 1rem; }
  main { padding: 1rem; }
}

/* ===== Sección header con botón ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.section-header h2 { margin-bottom: 0; }

/* ===== Acciones en detalle ===== */
.detail-actions {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

/* ===== Modales ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.modal-card h3 { margin-bottom: .25rem; font-size: 1rem; }
.modal-card input,
.modal-card select {
  padding: .65rem .9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 100%;
  font-family: inherit;
  font-size: .9rem;
}
.modal-card input[type=color] {
  padding: .15rem;
  height: 42px;
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: .5rem;
}
.modal-actions button:last-child {
  background: var(--accent);
  color: white;
  border: none;
  padding: .5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
}
.modal-actions button:last-child:hover { opacity: .9; }