/* Paleta y tipografías tomadas del sistema original (styles.css) para que
   el look & feel sea reconocible desde el día uno. Se puede reemplazar
   más adelante sin tocar el resto de la app: todo pasa por estas
   variables. */
:root {
  --ink: #0C1A35;
  --ink-mid: #1E3A5F;
  --cobalt: #1B4FD8;
  --cobalt-hover: #153DB5;
  --cobalt-subtle: #EBF0FD;
  --gold: #B8872A;
  --gold-subtle: #FDF6E7;
  --surface: #F5F3EE;
  --canvas: #FFFFFF;
  --border: #E2DDD6;
  --border-strong: #C5BFB5;
  --muted: #697586;
  --subtle: #F0EDE8;
  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --success: #16A34A;
  --success-hover: #15803D;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
}

h1, h2, h3, .font-display {
  font-family: 'Quicksand', 'Nunito', system-ui, sans-serif;
  font-weight: 700;
}

code, .mono { font-family: 'JetBrains Mono', 'Courier New', monospace; }

a { color: var(--cobalt); }

/* ── Layout ─────────────────────────────────────────────── */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar .brand { font-family: 'Quicksand', sans-serif; font-weight: 700; font-size: 1.3rem; }
.topbar nav a {
  color: #cfd8ea;
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.9rem;
}
.topbar nav a:hover, .topbar nav a.active { color: #fff; }

.container {
  max-width: 1700px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

body.auth-area .container {
  max-width: none;
  margin: 0;
  padding: 0;
}
body.auth-area .container .alert {
  margin: 16px 16px 0;
}

.card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 26px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.stat-tile {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.stat-tile .value { font-size: 1.8rem; font-weight: 800; color: var(--ink); }
.stat-tile .label { font-size: 0.8rem; color: var(--muted); }

/* ── Formularios ────────────────────────────────────────── */
.field {
  font-family: 'Nunito', sans-serif;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--canvas);
  color: var(--ink);
}
.field::placeholder { color: #A09890; }
label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 4px; }

/* ── Botones ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--cobalt-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--subtle); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Badges de estado (mismos colores que el original) ──── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; border: 1px solid; }
.badge-acepto      { color: #15803D; background: #F0FDF4; border-color: #BBF7D0; }
.badge-pendiente   { color: #92400E; background: #FFFBEB; border-color: #FDE68A; }
.badge-sincontacto { color: #B91C1C; background: #FEF2F2; border-color: #FECACA; }
.badge-conabogado  { color: #9A3412; background: #FFF7ED; border-color: #FDBA74; }
.badge-nointeresado{ color: #4B5563; background: #F9FAFB; border-color: #D1D5DB; }
.badge-interesado  { color: #92400E; background: #FFFBEB; border-color: #FDE68A; }
.badge-nocontesto  { color: #B91C1C; background: #FEF2F2; border-color: #FECACA; }

/* ── Dashboard del llamador ────────────────────────────────
   Paleta ampliada solo para acentos de este panel: no reemplaza
   la base (--ink/--cobalt/--gold), suma variantes para diferenciar
   estados y darle más color al conjunto sin salirse del sistema. */
:root {
  --teal: #0E7C7B;
  --teal-subtle: #E6F5F4;
  --violet: #6D4AA6;
  --violet-subtle: #F1ECFA;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.dash-sub { color: var(--muted); margin: 6px 0 0; font-size: 0.95rem; }
.dash-total {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-mid) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 16px 26px;
  text-align: right;
  min-width: 170px;
}
.dash-total-value { display: block; font-family: 'Quicksand', sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1; }
.dash-total-label { display: block; font-size: 0.75rem; color: #cfd8ea; margin-top: 4px; }

.dashboard-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 1000px) {
  .dashboard-layout { grid-template-columns: 1fr; }
}

.side-panel { position: sticky; top: 28px; display: flex; flex-direction: column; gap: 22px; }
.side-section {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.side-section-muted { background: var(--subtle); }
.side-section h4 {
  margin: 0 0 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.side-count {
  background: var(--cobalt-subtle);
  color: var(--cobalt);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: normal;
}
.side-empty { color: var(--muted); font-size: 0.85rem; margin: 0; }

.side-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  margin-bottom: 4px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.88rem;
  transition: background 0.15s ease;
}
.side-stat:last-child { margin-bottom: 0; }
.side-stat:hover, .side-stat.is-active { background: var(--subtle); }
.side-stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  background: var(--subtle);
}
.side-stat-icon.icon-current      { background: var(--cobalt-subtle); }
.side-stat-icon.icon-pendiente    { background: var(--gold-subtle); }
.side-stat-icon.icon-acepto       { background: var(--teal-subtle); }
.side-stat-icon.icon-sincontacto  { background: #FEF2F2; }
.side-stat-icon.icon-conabogado   { background: var(--violet-subtle); }
.side-stat-icon.icon-nointeresado { background: var(--subtle); }
.side-stat-label { flex: 1; }
.side-stat-value { font-weight: 700; color: var(--ink); }

.reminder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.reminder-item { display: flex; align-items: center; gap: 10px; }
.reminder-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); flex-shrink: 0; }
.reminder-item.is-overdue .reminder-dot { background: var(--danger); }
.reminder-body { flex: 1; display: flex; flex-direction: column; }
.reminder-name { font-weight: 600; font-size: 0.85rem; }
.reminder-meta { font-size: 0.75rem; color: var(--muted); }
.reminder-flag { font-size: 0.68rem; font-weight: 700; color: var(--danger); text-transform: uppercase; }
.side-link { display: inline-block; margin-top: 12px; font-size: 0.82rem; font-weight: 600; }

.dash-main { min-width: 0; }

.eyebrow { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cobalt); font-weight: 700; margin-bottom: 2px; }
.case-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.case-card-head h3 { margin: 0; }
.case-sub { color: var(--muted); margin: 4px 0 0; font-size: 0.88rem; }
.case-card-tags { display: flex; gap: 8px; }
.pill-ghost { background: var(--subtle); color: var(--ink-mid); }

.case-detail { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.case-detail-main { font-weight: 600; margin: 2px 0; }
.case-detail-sub { color: var(--muted); font-size: 0.85rem; margin: 2px 0; }

/* ── Ficha del caso: formulario de lectura ─────────────────
   Reemplaza las tarjetas sueltas por campos estilo formulario
   (etiqueta arriba, valor abajo, subrayado) agrupados en grilla. */
.case-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 4px 32px;
  margin-top: 20px;
}
.form-field {
  padding: 12px 2px 10px;
  border-bottom: 2px solid var(--border);
  transition: border-color 0.15s ease;
}
.form-field:hover { border-color: var(--cobalt); }
.form-field-wide { grid-column: 1 / -1; }
.form-field-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 5px;
}
.form-field-value {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  min-height: 1.3em;
}
.form-field-note { font-weight: 400; color: var(--muted); font-size: 0.88rem; }

/* ── "Más datos del caso": tarjetas horizontales ───────────── */
.extra-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.extra-row {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--subtle);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 13px 18px;
  flex-wrap: wrap;
}
.extra-row-label {
  flex: 0 0 220px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 700;
}
.extra-row-value { flex: 1; min-width: 160px; font-size: 0.92rem; font-weight: 600; color: var(--ink); word-break: break-word; }

.case-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.certero-result { margin-top: 14px; font-size: 0.85rem; color: var(--muted); }

.empty-state { text-align: center; padding: 60px 24px; }
.empty-state-icon { font-size: 2.4rem; margin-bottom: 10px; }

.filter-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--ink-mid);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}
.chip:hover { background: var(--subtle); }
.chip.is-active { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }

/* ── Alertas ────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; }
.alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #15803D; }

/* ── Tabla cola ─────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }

.row-clickable { cursor: pointer; transition: background 0.12s ease; }
.row-clickable:hover { background: var(--cobalt-subtle); }
.row-chevron { color: var(--border-strong); font-size: 1.1rem; text-align: right; width: 24px; }
.row-clickable:hover .row-chevron { color: var(--cobalt); }

/* ── Historial (ficha del caso) ────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.timeline-item { display: flex; gap: 14px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cobalt); margin-top: 6px; flex-shrink: 0; }
.timeline-dot-gold { background: var(--gold); }
.timeline-title { font-weight: 700; }
.timeline-meta { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.timeline-note { margin: 6px 0 0; font-size: 0.88rem; color: var(--ink-mid); }

.pill { background: var(--gold-subtle); color: var(--gold); border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; }

/* ── Login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-mid) 100%);
}
.login-card {
  background: var(--canvas);
  border-radius: 16px;
  padding: 36px 32px;
  width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 { margin: 0 0 4px; font-size: 1.6rem; }
.login-card p.subtitle { color: var(--muted); margin: 0 0 22px; font-size: 0.9rem; }
