@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;800&family=Space+Grotesk:wght@300;400;500;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --negro: #000000;
  --grafito: #111112;
  --linea: #232325;
  --gris: #8A8A90;
  --gris-claro: #B8B8BD;
  --blanco: #F5F5F6;
  --burdeos: #8C1C3A;
  --vino: #D9536F;
  --brand: #8C1C3A;
  --brand-deep: #8C1C3A;
  --brand-tint: #111112;
  --brand-ink: #D9536F;
  --agua: #8A8A90;
  --jade: #8A8A90;
  --jade-tint: #111112;
  --jade-ink: #B8B8BD;
  --amber: #D9536F;
  --amber-tint: #111112;
  --amber-ink: #D9536F;
  --red: #8C1C3A;
  --red-tint: #111112;
  --red-ink: #D9536F;
  --ink: #F5F5F6;
  --ink-soft: #B8B8BD;
  --ink-faint: #8A8A90;
  --line: #232325;
  --line-soft: #232325;
  --paper: #000000;
  --tile: #111112;
  --pill: #111112;
  --canvas: #000000;
  --card: #111112;
  --sidebar-w: 228px;
  --radius-card: 14px;
  --radius-control: 10px;
  --fuente: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--canvas); color: var(--ink); font-family: var(--fuente); font-weight: 400; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
table { border-collapse: collapse; width: 100%; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ===== Logotype ===== */
.logo { display: inline-flex; flex-direction: column; align-items: flex-end; gap: .14em; font-size: 28px; line-height: 1; }
.logo-word { display: flex; align-items: baseline; font: 800 1em/1 Unbounded, sans-serif; letter-spacing: -.04em; color: #F5F5F6; }
.logo-brace { font-weight: 400; color: #D9536F; letter-spacing: 0; }
.logo-word .logo-brace:first-of-type { margin-left: .05em; }
.logo-dot { display: block; width: .52em; height: .52em; border-radius: 50%; background: #F5F5F6; margin: 0 .03em; }
.logo-dev { font: 700 .22em 'JetBrains Mono', monospace; letter-spacing: .42em; margin-right: -.42em; color: #F5F5F6; }
.logo-sm { font-size: 22px; }
.logo-light .logo-word, .logo-light .logo-dev { color: #000; }
.logo-light .logo-dot { background: #000; }
.logo-light .logo-brace { color: #8C1C3A; }

/* ===== Portada ===== */
#portada { min-height: 100dvh; display: flex; flex-direction: column; background: #000; color: #F5F5F6; position: relative; overflow: hidden; }
#portada[hidden] { display: none; }
.portada-sphere { position: absolute; right: -12%; top: 8%; width: min(58vw, 720px); pointer-events: none; user-select: none; opacity: .95; z-index: 0; }
.portada-bar, .portada-hero { position: relative; z-index: 1; }
.portada-bar { display: flex; align-items: center; justify-content: space-between; padding: 28px 40px; }
.portada-brand { display: flex; align-items: center; gap: 18px; }
.portada-client { font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: #8A8A90; }
.portada-meta { color: #8A8A90; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.portada-hero { flex: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center;
  padding: 24px 64px 64px; max-width: 1240px; margin: 0 auto; width: 100%; }
.portada-kicker { font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #8A8A90; margin-bottom: 18px; }
.portada-kicker .n { color: #D9536F; }
.portada-hero h1 { font-size: clamp(40px, 5.2vw, 68px); font-weight: 300; letter-spacing: -0.055em; line-height: 0.92; color: #F5F5F6; }
.portada-hero .lede { margin-top: 22px; font-size: 16px; line-height: 1.58; color: #B8B8BD; max-width: 34em; }
.portada-tagline { margin-top: 18px; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #F5F5F6; }
.portada-sub { margin-top: 6px; font-size: 13px; color: #8A8A90; }
.portada-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.portada-note { margin-top: 18px; font-size: 13px; color: #8A8A90; max-width: 36em; line-height: 1.5; }
.area-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.area-card { background: #111112; border: 1px solid #232325; border-radius: 14px; padding: 18px 18px 16px; text-align: left; color: inherit; }
.area-card:hover { border-color: #8A8A90; }
.area-card small { display: block; color: #8A8A90; font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 8px; }
.area-card small .n { color: #D9536F; }
.area-card strong { display: block; font-size: 18px; font-weight: 300; letter-spacing: -0.04em; color: #F5F5F6; }
.area-card p { margin-top: 6px; font-size: 13.5px; color: #B8B8BD; line-height: 1.45; }

/* ===== Shell ===== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; background: #000; }
.shell[hidden] { display: none; }
.sidebar { background: #000; border-right: 1px solid #232325; padding: 18px 12px 18px; display: flex; flex-direction: column; gap: 8px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 8px 14px; }
.brand-client { font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: #F5F5F6; }
.demo-pill { margin: 0 8px 6px; padding: 8px 10px; border-radius: 10px; background: #111112; border: 1px solid #232325; color: #8A8A90; font-size: 11.5px; line-height: 1.35; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { padding: 14px 10px 4px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #8A8A90; font-family: var(--mono); font-weight: 700; }
.nav-link { display: block; padding: 7px 10px; border-radius: 10px; text-decoration: none; font-size: 13.5px; color: #B8B8BD; }
.nav-link:hover { background: #111112; color: #F5F5F6; }
.nav-link.active { background: #111112; color: #F5F5F6; border: 1px solid #232325; }
.sidebar-footer { margin-top: auto; padding: 10px 8px 0; font-size: 12px; color: #8A8A90; }
.content { min-width: 0; display: flex; flex-direction: column; background: #000; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid #232325; background: #000; }
.topbar-miga { font-size: 13px; color: #8A8A90; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.topbar-miga b { color: #F5F5F6; font-weight: 700; }
.topbar-acciones { display: flex; gap: 8px; align-items: center; }
.content-inner { width: 100%; max-width: 1152px; margin: 0 auto; padding: 28px 40px 72px; }

/* ===== UI bits ===== */
.btn { border: 1px solid #232325; background: #111112; color: #F5F5F6; border-radius: 10px;
  padding: 8px 14px; min-height: 36px; font-size: 13.5px; }
.btn:hover { border-color: #8A8A90; }
.btn-primary { background: #8C1C3A; color: #F5F5F6; border-color: #8C1C3A; }
.btn-primary:hover { background: #8C1C3A; border-color: #D9536F; }
.btn-ghost { border-color: transparent; background: transparent; color: #B8B8BD; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; background: #111112; color: #8A8A90; border: 1px solid #232325; white-space: nowrap; }
.badge-ok { background: #111112; color: #B8B8BD; border-color: #232325; }
.badge-warn { background: #111112; color: #D9536F; border-color: #232325; }
.badge-risk { background: #8C1C3A; color: #F5F5F6; border-color: #8C1C3A; }
.badge-soon { background: transparent; color: #D9536F; border-color: #232325; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.page-head h1 { font-size: 36px; font-weight: 300; letter-spacing: -0.055em; line-height: 0.94; color: #F5F5F6; }
.page-head p { margin-top: 10px; color: #B8B8BD; font-size: 14.5px; max-width: 40em; line-height: 1.55; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: #111112; border: 1px solid #232325; border-radius: 14px; padding: 18px 18px 16px; }
.stat-label { font-size: 11px; color: #8A8A90; font-family: var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.stat-value { margin-top: 14px; font-size: 28px; font-weight: 300; letter-spacing: -0.04em; color: #F5F5F6; }
.stat-sub { margin-top: 4px; font-size: 12.5px; color: #8A8A90; }
.card { background: #111112; border: 1px solid #232325; border-radius: 14px; padding: 20px 22px; }
.card h2 { font-size: 16px; font-weight: 400; letter-spacing: -0.02em; color: #F5F5F6; }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.muted { color: #8A8A90; }
.screen[hidden] { display: none; }

table.data td, table.data th { padding: 10px 8px; border-bottom: 1px solid #232325; text-align: left; font-size: 13.5px; }
table.data th { color: #8A8A90; font-weight: 700; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-family: var(--mono); }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #111112; }
table.data td.num, table.data th.num { text-align: right; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* tanks */
.tanques { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tanque { background: #111112; border: 1px solid #232325; border-radius: 14px; padding: 18px; display: flex; gap: 16px; align-items: stretch; }
.vaso { width: 72px; height: 120px; border-radius: 8px; background: #000; position: relative; overflow: hidden; border: 1px solid #232325; }
.vaso .agua { position: absolute; left: 0; right: 0; bottom: 0; }
.tanque-cruda { --agua-tanque: #8A8A90; }
.tanque-clorada { --agua-tanque: #B8B8BD; }
.tanque-purificada { --agua-tanque: #F5F5F6; }
.tanque h3 { font-size: 15px; color: #F5F5F6; font-weight: 400; }
.tanque .pct { font-size: 26px; font-weight: 300; letter-spacing: -0.03em; margin-top: 8px; }
.tanque .sub { font-family: var(--mono); font-size: 12px; color: #8A8A90; margin-top: 4px; }

/* charts */
.barras { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; height: 160px; align-items: end; }
.barra { background: #232325; border-radius: 3px 3px 0 0; width: 100%; }
.barra.hoy { background: #8C1C3A; }
.barra-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.barra-col span { font-size: 11px; color: #8A8A90; font-family: var(--mono); }

/* tope / semáforo — palette only */
.tope { display: flex; align-items: center; gap: 8px; }
.tope-track { flex: 1; height: 8px; background: #232325; border-radius: 99px; overflow: hidden; }
.tope-fill { height: 100%; background: #8A8A90; }
.tope-fill.riesgo { background: #D9536F; }
.tope-fill.lleno { background: #8C1C3A; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: #8A8A90; }
.dot-warn { background: #D9536F; }
.dot-risk { background: #8C1C3A; }

/* tabs */
.tabs { display: flex; gap: 2px; background: #111112; border: 1px solid #232325; padding: 3px; border-radius: 10px; width: fit-content; margin-bottom: 16px; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 7px; color: #B8B8BD; font-size: 13.5px; }
.tab.active { background: #000; color: #F5F5F6; font-weight: 400; }
.panel[hidden] { display: none; }

/* map / route */
.mapa { position: relative; height: 280px; border-radius: 14px; overflow: hidden; background: #111112; border: 1px solid #232325; }
.ruta-line { fill: none; stroke: #D9536F; stroke-width: 3; stroke-linecap: round; }
.truck { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #8C1C3A; color: #F5F5F6; font-size: 10px; display: grid; place-items: center; font-weight: 700; }
.stop { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #B8B8BD; border: 2px solid #000; }

/* flow modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 40; padding: 24px; }
.overlay[hidden] { display: none; }
.modal { width: min(640px, 100%); background: #111112; border-radius: 14px; padding: 28px; border: 1px solid #232325; }
.steps { display: flex; gap: 8px; margin: 18px 0 22px; }
.step-dot { flex: 1; height: 4px; border-radius: 99px; background: #232325; }
.step-dot.on { background: #8C1C3A; }
.modal h2 { font-size: 28px; font-weight: 300; letter-spacing: -0.055em; line-height: 1; color: #F5F5F6; }
.modal p { margin-top: 10px; color: #B8B8BD; line-height: 1.55; }
.modal-nav { display: flex; justify-content: space-between; margin-top: 24px; }

/* reconcile */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mov { border: 1px solid #232325; border-radius: 14px; padding: 12px 14px; text-align: left; background: #111112; width: 100%; color: inherit; }
.mov:hover, .mov.elegido { border-color: #D9536F; background: #111112; }
.mov .imp { font-weight: 700; letter-spacing: -0.02em; }
.toast { position: fixed; bottom: 24px; right: 24px; background: #8C1C3A; color: #F5F5F6; padding: 12px 16px; border-radius: 10px; font-size: 13.5px; z-index: 50; }
.toast[hidden] { display: none; }

.atencion { display: flex; flex-direction: column; gap: 10px; }
.atencion-fila { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 8px 0; border-bottom: 1px solid #232325; }
.leyenda { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }


/* ===== Mesa de conciliación (espejo de Contú, paleta Cumplo Dev) ===== */
.stats-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mesa { background: #111112; border: 1px solid #232325; border-radius: 14px; overflow: hidden; }
.mesa-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid #232325; }
.mesa-head h2 { font-size: 14px; font-weight: 400; }
.mesa-grid { display: grid; grid-template-columns: 1fr 1fr; }
.mesa-grid > section { min-width: 0; }
.mesa-grid > section + section { border-left: 1px solid #232325; }
.mesa-col-h { padding: 10px 20px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8A8A90; border-bottom: 1px solid #232325; }
.mesa-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 20px; border-bottom: 1px solid #232325; }
.filtro { border: 0; background: #000; color: #8A8A90; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 500; }
.filtro .n { font-variant-numeric: tabular-nums; opacity: .7; }
.filtro.on { background: #8C1C3A; color: #F5F5F6; }
.mesa-buscar { margin-left: auto; min-width: 160px; flex: 1; background: #000; border: 1px solid #232325; border-radius: 10px; color: #F5F5F6; padding: 5px 10px; font-size: 12.5px; }
.mesa-lista { max-height: 520px; overflow-y: auto; }
.mov-row { display: flex; width: 100%; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 20px; border: 0; border-bottom: 1px solid #232325; background: transparent; color: inherit; text-align: left; border-radius: 0; }
.mov-row:hover { background: #000; }
.mov-row.activo { background: #000; box-shadow: inset 3px 0 0 #8C1C3A; }
.mov-row .nom { display: block; font-size: 13px; font-weight: 400; color: #F5F5F6; }
.mov-row .meta { display: block; font-family: var(--mono); font-size: 11px; color: #8A8A90; margin-top: 2px; }
.mov-row .imp { font-size: 13px; font-weight: 400; letter-spacing: -.02em; white-space: nowrap; }
.mov-row .imp.egreso { color: #D9536F; }
.mov-row .restan { display: block; font-family: var(--mono); font-size: 10.5px; color: #D9536F; margin-top: 2px; text-align: right; }
.barra-aplica { display: block; height: 2px; width: 96px; margin-top: 6px; margin-left: auto; background: #232325; border-radius: 99px; overflow: hidden; }
.barra-aplica > i { display: block; height: 100%; background: #8A8A90; }
.barra-aplica.parcial > i { background: #D9536F; }
.chip-est { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 999px; font-family: var(--fuente); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border: 1px solid #232325; color: #8A8A90; }
.chip-est.parcial { color: #D9536F; border-color: #232325; }
.chip-est.completo { color: #B8B8BD; }
.chip-est.categorizado { color: #8A8A90; }
.chip-conf { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1px solid #232325; color: #B8B8BD; }
.chip-conf.alta { color: #F5F5F6; border-color: #8A8A90; }
.chip-conf.media { color: #D9536F; }
.chip-conf.baja { color: #8A8A90; }
.folio-tag { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 4px; font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: #B8B8BD; background: #000; }
.cuenta-chip { display: inline-flex; align-items: center; border: 1px solid #8C1C3A; background: #8C1C3A; color: #F5F5F6; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.cuenta-ctx { font-family: var(--mono); font-size: 11px; color: #8A8A90; margin: -6px 0 14px; }
.resolver { padding: 0 20px 16px; }
.resolver-vacio { display: flex; min-height: 220px; align-items: center; justify-content: center; padding: 32px; text-align: center; color: #8A8A90; font-size: 13.5px; }
.cand { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #000; border-radius: 10px; padding: 10px 12px; }
.cand + .cand { margin-top: 8px; }
.charola { margin-top: 14px; border: 1px solid #8C1C3A; border-radius: 10px; padding: 12px; }
.charola h3 { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.charola-linea { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.charola-linea .mono { font-family: var(--mono); }
.charola-tot { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #232325; }
.sugerencia { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #000; border: 1px solid #232325; border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 13px; }
.mesa-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 14px -20px -16px; padding: 12px 20px; background: #8C1C3A; color: #F5F5F6; font-size: 13px; }
.buscar-otra { margin-top: 14px; border: 1px solid #232325; border-radius: 10px; overflow: hidden; }
.buscar-otra summary { list-style: none; padding: 10px 12px; font-size: 13px; color: #8A8A90; cursor: pointer; }
.buscar-otra summary::-webkit-details-marker { display: none; }
.ppd { margin-left: 6px; color: #D9536F; font-size: 12px; }
@media (max-width: 900px) {
  .stats-3, .mesa-grid { grid-template-columns: 1fr; }
  .mesa-grid > section + section { border-left: 0; border-top: 1px solid #232325; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .portada-hero, .grid-2, .grid-3, .stats, .stats-3, .tanques, .split, .mesa-grid, .area-grid { grid-template-columns: 1fr; }
  .portada-hero { padding: 16px 20px 40px; }
  .content-inner { padding: 20px 16px 80px; }
  .portada-sphere { width: 80vw; right: -20%; top: 20%; opacity: .45; }
}
