:root {
  --navy: #062A49;
  --navy-800: #0f1f2b;
  --teal: #2A9FA6;
  --teal-light: #e3f7f5;
  --mist: #D9E1E5;
  --ink: #33424a;
  --paper: #ffffff;
  --success: #1f8f63;
  --warning: #8a5c16;
  --warning-bg: #faf1de;
  --danger: #c1443f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: #f3f6f7;
  color: var(--ink);
}
.shell { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: 230px; flex: none; background: var(--navy); color: #eaf1f4;
  padding: 24px 16px; display: flex; flex-direction: column; gap: 22px;
}
.sidebar .brand { font-family: Georgia, serif; font-size: 1.3rem; font-weight: 700; color: #fff; }
.sidebar .brand small { display: block; font-family: Arial, sans-serif; font-size: 0.68rem; color: var(--teal); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: rgba(234,241,244,.85); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 0.92rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: var(--teal); color: #fff; font-weight: 600; }
.sidebar .foot { margin-top: auto; font-size: 0.72rem; color: rgba(234,241,244,.5); }

/* --- Content --- */
.content { flex: 1; padding: 32px 40px; max-width: 1400px; }
h1 { font-size: 1.5rem; color: var(--navy); margin: 0 0 6px; }
h2 { font-size: 1.1rem; color: var(--navy); margin: 0 0 14px; }
.subtitle { color: #5b6d77; margin-bottom: 28px; }

.card { background: var(--paper); border: 1px solid var(--mist); border-radius: 10px; padding: 22px 24px; margin-bottom: 24px; box-shadow: 0 1px 2px rgba(6,26,45,.04); }
.btn-toggle-seccion { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--navy); padding: 2px 6px; line-height: 1; border-radius: 4px; }
.btn-toggle-seccion:hover { background: var(--mist); }
.seccion-titulo-fila { display: flex; align-items: center; gap: 8px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi { background: var(--paper); border: 1px solid var(--mist); border-radius: 10px; padding: 18px; }
.kpi span { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em; color: #8a99a1; margin-bottom: 6px; }
.kpi strong { font-size: 1.7rem; color: var(--navy); font-family: Georgia, serif; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.zebra tbody tr:nth-child(even) { background: #f3f8f9; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: #8a99a1; padding: 8px 10px; border-bottom: 2px solid var(--mist); }
td { padding: 10px 10px; border-bottom: 1px solid #eef2f3; vertical-align: top; }
tr:hover td { background: #fafcfc; }

.btn {
  display: inline-block; background: var(--navy); color: #fff; border: none; padding: 10px 18px;
  border-radius: 8px; font-size: 0.88rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #0a3a61; }
.btn.secondary { background: #fff; color: var(--navy); border: 1.5px solid var(--mist); }
.btn.secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn.accent { background: var(--teal); }

form label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--navy); margin-bottom: 5px; margin-top: 14px; }
form input, form select, form textarea {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--mist); border-radius: 7px; font-size: 0.9rem; font-family: inherit;
}
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: var(--teal); }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.chip.exacto { background: #e3f7ef; color: var(--success); }
.chip.sugerido { background: var(--warning-bg); color: var(--warning); }
.chip.sin-coincidencia { background: #fbe9e8; color: var(--danger); }
.chip.ambiguo { background: #fdf0d8; color: #a06a10; }
.badge-mensajes {
  display: inline-flex; align-items: center; gap: 3px;
  background: #c1443f; color: #fff; border-radius: 999px;
  padding: 1px 8px; font-size: 0.72rem; font-weight: 700; margin-left: 6px;
}
.chip.info { background: var(--teal-light); color: #1b6b70; }

/* --- Centro de control (dashboard) --- */
.dash-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #0a3a61 100%);
  border-radius: 14px; padding: 26px 30px; margin-bottom: 22px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  color: #fff;
}
.dash-hero h1 { color: #fff; margin: 0; font-size: 1.55rem; }
.dash-hero .dash-hero-sub { color: rgba(255,255,255,.68); margin-top: 4px; font-size: 0.92rem; }
.dash-hero-stat { text-align: right; }
.dash-hero-stat strong { display: block; font-family: Georgia, serif; font-size: 2.3rem; line-height: 1; color: #fff; }
.dash-hero-stat span { font-size: 0.76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--teal); font-weight: 700; }

.dash-layout { display: flex; gap: 22px; align-items: flex-start; }
.dash-layout > div:first-child { flex: 1.6; min-width: 0; }
.dash-layout > div:last-child { flex: 1; min-width: 0; }
@media (max-width: 980px) { .dash-layout { flex-direction: column; } }

.attention-list { display: flex; flex-direction: column; gap: 0; }
.attention-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 6px; border-bottom: 1px solid #eef2f3;
  text-decoration: none; color: inherit;
}
.attention-item:last-child { border-bottom: none; }
.attention-item:hover { background: #fafcfc; }
.attention-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.attention-dot.alta { background: var(--danger); }
.attention-dot.media { background: #d99a3d; }
.attention-item .attention-main { flex: 1; min-width: 0; }
.attention-item .attention-title { font-weight: 700; color: var(--navy); font-size: 0.92rem; }
.attention-item .attention-motivo { color: #5b6d77; font-size: 0.82rem; margin-top: 1px; }
.attention-item .attention-arrow { color: var(--teal); font-size: 1.1rem; flex: none; }
.attention-empty { padding: 18px 6px; color: #5b6d77; font-size: 0.9rem; }
.attention-empty strong { color: var(--success); }

.stage-strip { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 10px 0 14px; background: #eef2f3; }
.stage-strip span { height: 100%; }
.stage-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; }
.stage-legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; }
.stage-legend-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stage-legend-item .n { margin-left: auto; font-weight: 700; color: var(--navy); }

.side-stats { display: flex; flex-direction: column; gap: 10px; }
.side-stat { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: #fafcfc; border-radius: 8px; }
.side-stat span { color: #5b6d77; font-size: 0.85rem; }
.side-stat strong { font-family: Georgia, serif; font-size: 1.25rem; color: var(--navy); }

.recent-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid #eef2f3; text-decoration: none; color: inherit; }
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: #fafcfc; }
.recent-item .recent-id { font-family: Georgia, serif; color: var(--teal); font-weight: 700; font-size: 0.9rem; width: 42px; flex: none; }
.recent-item .recent-title { flex: 1; min-width: 0; font-size: 0.88rem; color: var(--navy); font-weight: 600; }
.recent-item .recent-cliente { font-size: 0.78rem; color: #8a99a1; }


.helper { font-size: 0.82rem; color: #6b7d85; margin: 6px 0 16px; line-height: 1.5; }
.flash { background: var(--teal-light); border: 1px solid var(--teal); color: #12595d; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 0.88rem; }
.flash-error { background: #fbe9e7; border-color: var(--danger); color: #8c2e2a; font-weight: 600; }
.empty { color: #8a99a1; font-style: italic; padding: 20px 0; }

.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.rank-card { border: 1px solid var(--mist); border-radius: 10px; padding: 14px 16px; background: #fafcfc; }
.rank-card .n { display:inline-flex; width:22px; height:22px; border-radius:50%; background:var(--navy); color:#fff; align-items:center; justify-content:center; font-size:.75rem; font-weight:700; margin-right:8px;}
.progress-bar { height: 8px; border-radius: 6px; background: var(--mist); overflow: hidden; margin-top: 8px; }
.progress-bar span { display: block; height: 100%; background: var(--teal); }
