/* ============================================================
   LP HQ — Design System
   Calm blue / white. Light default, dark selected (not flipped).
   ============================================================ */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg:            #F1F5FA;
  --bg-accent:     #E4EDF9;
  --surface:       #FFFFFF;
  --surface-2:     #F7FAFD;
  --surface-3:     #EDF3FA;
  --surface-inset: #F2F6FB;

  /* Ink */
  --text:   #0E1B2E;
  --text-2: #53627A;
  --text-3: #8493AA;

  /* Lines */
  --border:        #E1EAF4;
  --border-strong: #C9D8EA;

  /* Marca — rampa secuencial naranja (#FE7200), clara → oscura.
     Escalones monótonos en luminosidad OKLCH (0.97 → 0.47), que es lo que hace
     que sirva también como rampa de magnitud y no sólo de identidad.
     `--brand-ink` es el tono que se escribe sobre fondo claro (4.95:1 con
     blanco) y `--on-brand` el que se escribe ENCIMA del naranja: blanco sobre
     #FE7200 da 2.76:1 y no pasa ni de lejos, así que ahí va tinta oscura. */
  --brand-050: #FFF6EF;
  --brand-100: #FFE3CC;
  --brand-200: #FFC490;
  --brand-300: #FFA152;
  --brand-400: #FF8420;
  --brand-500: #FE7200;
  --brand-600: #DC6300;
  --brand-700: #8F4000;
  --brand:     #FE7200;
  --brand-ink: #B85200;
  --brand-soft:#FFF1E4;
  --on-brand:  #2B1200;

  /* Categorical (validated order) */
  --series-1: #fe7200;
  --series-2: #2f7ae0;
  --series-3: #1baf7a;
  --series-4: #a05ce0;
  --series-5: #c8306a;
  --series-6: #008300;
  --series-7: #00a6b8;
  --series-8: #e34948;

  /* Status (fixed, never themed) */
  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --good-soft:     #E7F6E7;
  --warning-soft:  #FDF3DC;
  --serious-soft:  #FBECE4;
  --critical-soft: #FAE6E6;

  /* Shape & motion */
  --r-xs: 6px; --r-sm: 9px; --r-md: 14px; --r-lg: 18px; --r-xl: 26px;
  --sh-1: 0 1px 2px rgba(15,27,46,.05), 0 1px 3px rgba(15,27,46,.04);
  --sh-2: 0 2px 6px rgba(15,27,46,.06), 0 8px 22px rgba(15,27,46,.06);
  --sh-3: 0 10px 34px rgba(20,50,95,.13);
  --ring: 0 0 0 3px rgba(254,114,0,.28);
  --ease: cubic-bezier(.22,.72,.28,1);

  --nav-w: 244px;
  --top-h: 62px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #080F1C;
  --bg-accent:     #0C1729;
  --surface:       #0F1A2C;
  --surface-2:     #142238;
  --surface-3:     #1A2B45;
  --surface-inset: #0C1626;

  --text:   #E9F1FB;
  --text-2: #9DAFC8;
  --text-3: #6C7F99;

  --border:        #1D2C45;
  --border-strong: #2A3D5C;

  /* En oscuro la rampa se invierte: el escalón "700" es el MÁS claro, porque
     sobre fondo oscuro lo que destaca es lo claro. No es un volteo automático
     del modo claro; son pasos elegidos y validados contra este fondo. */
  --brand-050: #2A1608;
  --brand-100: #3D2009;
  --brand-200: #8F4000;
  --brand-300: #B85200;
  --brand-400: #DC6300;
  --brand-500: #FE7200;
  --brand-600: #FF8C2E;
  --brand-700: #FFB273;
  --brand:     #FF8324;
  --brand-ink: #FFB273;
  --brand-soft:rgba(254,114,0,.16);
  --on-brand:  #241000;

  --series-1: #e07213;
  --series-2: #5091e5;
  --series-3: #17a072;
  --series-4: #a066da;
  --series-5: #d2447c;
  --series-6: #179117;
  --series-7: #0f96a8;
  --series-8: #dd5857;

  --good-soft:     rgba(12,163,12,.16);
  --warning-soft:  rgba(250,178,25,.16);
  --serious-soft:  rgba(236,131,90,.16);
  --critical-soft: rgba(208,59,59,.18);

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 2px 8px rgba(0,0,0,.35), 0 10px 26px rgba(0,0,0,.3);
  --sh-3: 0 14px 40px rgba(0,0,0,.5);
  --ring: 0 0 0 3px rgba(255,131,36,.34);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 480px at 12% -8%, var(--bg-accent), transparent 62%),
    radial-gradient(760px 420px at 96% 4%, var(--brand-soft), transparent 60%);
  opacity: .85;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }

h1,h2,h3,h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0 0 10px; }
[hidden] { display: none !important; }

/* ---------- utility ---------- */
.eyebrow {
  font-size: 10.5px; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--text-3);
}
.muted   { color: var(--text-2); }
.dim     { color: var(--text-3); }
.num     { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono    { font-family: var(--mono); }
.row     { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1 1 auto; min-width: 0; }
.stack   { display: flex; flex-direction: column; gap: 6px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.grid    { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.split { display: grid; grid-template-columns: minmax(0,1.62fr) minmax(0,1fr); gap: 18px; align-items: start; }

/* ============================================================
   APP SHELL
   ============================================================ */
#app { position: relative; z-index: 1; min-height: 100%; }

.shell {
  display: grid; grid-template-columns: var(--nav-w) minmax(0,1fr); min-height: 100vh;
  transition: grid-template-columns .26s var(--ease);
}

/* ---------- sidebar ---------- */
/* El velo del cajón móvil no existe en escritorio (si no, ocuparía una columna del grid). */
.nav-scrim { display: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px 12px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(150deg, #C25A00, #7A3600);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; letter-spacing: .04em;
  box-shadow: 0 6px 16px rgba(254,114,0,.35);
}
.brand-name { font-size: 15.5px; font-weight: 800; letter-spacing: -.02em; }
.brand-sub  { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--text-3); text-transform: uppercase; }

.nav { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; }
.nav-group { margin: 14px 0 4px; padding: 0 10px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8.5px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 600; font-size: 13.4px;
  position: relative; transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.nav-link .ic { width: 18px; text-align: center; font-size: 14px; opacity: .85; flex: none; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-link .pill {
  margin-left: auto; font-size: 10.5px; font-weight: 800; padding: 1px 7px;
  border-radius: 99px; background: var(--critical); color: #fff;
}
.nav-foot { border-top: 1px solid var(--border); padding-top: 10px; }

.userchip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: box-shadow .18s var(--ease);
}
.userchip:hover { box-shadow: var(--sh-1); }
.userchip .meta { min-width: 0; text-align: left; display: block; }
.userchip .nm { display: block; font-size: 12.8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip .rl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff;
  /* Las iniciales van en blanco, así que el círculo se queda en el naranja
     oscuro en los dos temas: es un fondo de texto, no una superficie de marca. */
  background: linear-gradient(145deg, #C25A00, #7A3600);
  object-fit: cover;   /* cuando es <img> con foto real de Discord, no <span> de iniciales */
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .18s var(--ease);
}
.menu-btn:hover { color: var(--brand-ink); border-color: var(--brand-200); }
.menu-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.search {
  position: relative; flex: 1 1 auto; max-width: 460px;
}
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; font-size: 13px; transition: border-color .16s, box-shadow .16s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--brand-300); box-shadow: var(--ring); }
.search .si { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.search-pop {
  position: absolute; top: 42px; left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-3); padding: 6px; max-height: 340px; overflow: auto;
}
.search-pop a { display: block; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; }
.search-pop a:hover, .search-pop a.hl { background: var(--surface-3); }
.search-pop .k { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; padding: 8px 10px 4px; font-weight: 800; }

/* Hora y fecha son dos datos, no un bloque: necesitan un respiro entre líneas
   y una separación clara del resto de controles de la barra. */
.clock {
  display: flex; flex-direction: column; gap: 3px;
  text-align: right; line-height: 1; flex: none;
  padding-left: 16px; margin-left: 2px;
  border-left: 1px solid var(--border);
}
.clock .t {
  font-size: 16.5px; font-weight: 800; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}
.clock .d {
  font-size: 10.6px; color: var(--text-3); font-weight: 600;
  letter-spacing: .04em; text-transform: capitalize; white-space: nowrap;
}

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: 99px; border: 1px solid var(--border);
}
.seg button {
  padding: 4.5px 11px; border-radius: 99px; font-size: 12px; font-weight: 700;
  color: var(--text-2); transition: all .16s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--brand-ink); box-shadow: var(--sh-1); }

/* segmented control on the coloured hero */
.seg.on-hero { background: rgba(255,255,255,.20); border-color: rgba(255,255,255,.30); }
.seg.on-hero button { color: rgba(255,255,255,.82); }
.seg.on-hero button:hover { color: #fff; }
.seg.on-hero button.on { background: #fff; color: var(--brand-600); box-shadow: 0 2px 8px rgba(0,0,0,.16); }
:root[data-theme="dark"] .seg.on-hero button.on { color: #3D2009; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: all .18s var(--ease);
}
.icon-btn:hover { color: var(--brand-ink); border-color: var(--brand-200); transform: translateY(-1px); }

/* ---------- main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.view { padding: 24px 26px 64px; max-width: 1520px; width: 100%; animation: rise .34s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; letter-spacing: -.032em; }
.page-head .lede { color: var(--text-2); font-size: 13.6px; margin-top: 5px; max-width: 62ch; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 800; }

/* ============================================================
   COMPONENTS
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  transition: box-shadow .22s var(--ease), transform .22s var(--ease), border-color .22s var(--ease);
}
.card.pad { padding: 18px; }
.card.tight { padding: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 16px 18px; }
.card-foot { padding: 11px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 12.2px; color: var(--text-3); }

a.card, button.card { display: block; text-align: left; width: 100%; }
a.card:hover, button.card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--brand-200); }

/* Hero / stat */
.hero {
  position: relative; overflow: hidden;
  /* Colores fijos, no tokens: encima va texto BLANCO, y en oscuro los escalones
     de la marca se invierten (el 700 es el MÁS claro). Con tokens, el héroe
     acababa siendo naranja brillante con letras blancas encima — 2.7:1, ilegible.
     Este degradado se queda en el extremo oscuro en los dos temas. */
  background: linear-gradient(135deg, #7A3600, #B85200 55%, #DC6300);
  color: #fff; border-radius: var(--r-xl); padding: 22px 24px;
  box-shadow: 0 16px 40px rgba(143,64,0,.30);
}
.hero::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 300px; height: 300px;
  border-radius: 50%; background: rgba(255,255,255,.12);
}
.hero::before {
  content: ""; position: absolute; right: 40px; bottom: -130px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255,255,255,.08);
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: rgba(255,255,255,.78); }
.hero-value { font-size: 46px; font-weight: 800; letter-spacing: -.045em; line-height: 1; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 12.8px; color: rgba(255,255,255,.85); }
.hero-bar { height: 7px; border-radius: 99px; background: rgba(255,255,255,.24); overflow: hidden; margin-top: 14px; }
.hero-bar > i { display: block; height: 100%; border-radius: 99px; background: #fff; transition: width .9s var(--ease); }

.tile { padding: 15px 16px; }
.tile .lbl { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.tile .val { font-size: 27px; font-weight: 800; letter-spacing: -.035em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.tile .spark { margin-top: 10px; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: 99px; }
.delta.up   { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--critical); background: var(--critical-soft); }
.delta.flat { color: var(--text-3); background: var(--surface-3); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 99px; border: 1px solid transparent; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge .dot.live { position: relative; animation: dotLivePulse 1.6s ease-in-out infinite; }
.badge .dot.live::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: currentColor; opacity: .55;
  animation: dotLiveRing 1.6s ease-out infinite;
}
@keyframes dotLivePulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes dotLiveRing { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2.6); opacity: 0; } }
.badge.good     { color: var(--good);     background: var(--good-soft); }
.badge.warning  { color: #8a6100;         background: var(--warning-soft); }
.badge.serious  { color: #a34a1e;         background: var(--serious-soft); }
.badge.critical { color: var(--critical); background: var(--critical-soft); }
.badge.brand    { color: var(--brand-ink);background: var(--brand-soft); }
.badge.neutral  { color: var(--text-2);   background: var(--surface-3); border-color: var(--border); }
:root[data-theme="dark"] .badge.warning { color: #fac54f; }
:root[data-theme="dark"] .badge.serious { color: #f0a483; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  font-size: 13.2px; font-weight: 700; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: all .18s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--sh-1); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 4px 14px rgba(254,114,0,.30); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.2px; border-radius: 8px; }
.btn.block { width: 100%; }
/* Un botón que no lleva a ninguna parte tiene que PARECER que no lleva a
   ninguna parte: sin borde, en gris, y sin cursor de mano. Si no, se hace clic
   dos o tres veces antes de entender que no va a pasar nada. */
.btn[aria-disabled="true"] {
  color: var(--text-3); border-color: transparent; background: transparent;
  cursor: default; font-weight: 600;
}
.btn[aria-disabled="true"]:hover { transform: none; box-shadow: none; background: transparent; color: var(--text-3); }
.btn.discord { background: #5865F2; border-color: #5865F2; color: #fff; height: 46px; font-size: 14.5px; box-shadow: 0 8px 22px rgba(88,101,242,.35); }
.btn.discord:hover { background: #4752C4; border-color: #4752C4; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Quick-action cards */
.qa { display: flex; align-items: center; gap: 13px; padding: 15px 16px; }
.qa .qi {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 17px;
}
.qa .qt { display: block; font-size: 14px; font-weight: 700; }
.qa .qs { display: block; font-size: 12.2px; color: var(--text-2); margin-top: 1px; }
.qa .qx { margin-left: auto; flex: none; color: var(--text-3); transition: transform .2s var(--ease); }
a.card.qa, button.card.qa, label.card.qa { display: flex; }
a.card:hover .qx { transform: translateX(3px); color: var(--brand); }

/* Tables */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.tbl th {
  text-align: left; font-size: 10.6px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3); padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
  position: sticky; top: 0; z-index: 2;
}
table.tbl th.r, table.tbl td.r { text-align: right; }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .14s var(--ease); }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .rank { font-weight: 800; color: var(--text-3); width: 34px; font-variant-numeric: tabular-nums; }
table.tbl tr.group td {
  background: var(--surface-3); font-size: 10.6px; font-weight: 800; letter-spacing: .11em;
  text-transform: uppercase; color: var(--text-2); padding: 7px 12px;
}
table.tbl td.name { font-weight: 650; }

/* Meters / bars */
.meter { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .8s var(--ease); }
.meter.good > i { background: var(--good); }
.meter.warning > i { background: var(--warning); }
.meter.critical > i { background: var(--critical); }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 128px minmax(0,1fr) 44px; align-items: center; gap: 10px; font-size: 12.8px; }
.bar-row .bl { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bv { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-track > i { display: block; height: 100%; border-radius: 0 4px 4px 0; transition: width .8s var(--ease); }

/* Sparkline / chart */
.spark { overflow: hidden; border-radius: 5px; }
.spark svg { display: block; width: 100%; height: auto; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.2px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-tip {
  position: fixed; z-index: 200; pointer-events: none; opacity: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--sh-3); padding: 8px 11px; font-size: 12.4px; transition: opacity .12s;
  min-width: 120px;
}
.chart-tip .tt { font-weight: 800; margin-bottom: 3px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.chart-tip .tv { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Rings */
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .rc { position: absolute; inset: 16%; display: grid; place-items: center; text-align: center; line-height: 1.15; }
.ring .rv { font-size: 20px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring .rl { font-size: 8.6px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }

/* Lists */
.lst { display: flex; flex-direction: column; }
.lst-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.lst-item:last-child { border-bottom: none; }
.lst-item .t { display: block; font-size: 13.4px; font-weight: 650; }
.lst-item .s { display: block; font-size: 12px; color: var(--text-2); margin-top: 1px; }

/* Timeline / call cards */
.callcard {
  display: grid; grid-template-columns: 100px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); border-left: 3px solid var(--border-strong);
  transition: all .2s var(--ease);
}
.callcard:hover { box-shadow: var(--sh-2); transform: translateX(2px); }
.callcard.ok    { border-left-color: var(--good); }
.callcard.warn  { border-left-color: var(--warning); }
.callcard.risk  { border-left-color: var(--critical); }
.callcard .tm { font-weight: 800; font-size: 13.4px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; white-space: nowrap; }
.callcard .tz { font-size: 10.6px; color: var(--text-3); }

/* Accordion */
.acc { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.acc + .acc { margin-top: 9px; }
.acc > summary {
  list-style: none; cursor: pointer; padding: 13px 15px;
  display: flex; align-items: center; gap: 12px; font-weight: 650;
  transition: background .15s var(--ease);
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover { background: var(--surface-2); }
.acc > summary .chev { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); }
.acc[open] > summary .chev { transform: rotate(90deg); }
.acc[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.acc .acc-body { padding: 15px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 11.4px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  font-size: 13.4px; transition: border-color .16s, box-shadow .16s;
}
.input:focus { border-color: var(--brand-300); box-shadow: var(--ring); outline: none; }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.6; }
/* EOD del setter: se llena al final del turno, muchas veces desde el teléfono.
   Los controles son grandes a propósito — el reporte que cuesta llenar es el que
   no se llena. */
.eod-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
/* minmax(0,…) y no `1fr` a secas: `1fr` es minmax(auto,1fr) y el ancho mínimo
   lo dictaba el <input> del contador (23px de letra × 20 caracteres ≈ 360px),
   así que en el teléfono cada tarjeta medía 470px y la página entera se abría
   de lado. */
@media (max-width: 720px) { .eod-grid { grid-template-columns: minmax(0,1fr); } }
.eod-q   { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; }
.eod-lbl { font-size: 11.6px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.eod-sub { font-size: 11.4px; color: var(--text-3); margin-top: 3px; }
.eod-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.eod-btn { width: 46px; height: 46px; flex: none; border-radius: 12px; border: 1px solid var(--border-strong);
           background: var(--surface); color: var(--text); font-size: 21px; font-weight: 700;
           line-height: 1; cursor: pointer; }
.eod-btn:hover { border-color: var(--brand-200); color: var(--brand-ink); }
.eod-num { flex: 1 1 0; width: 0; min-width: 0; height: 46px; text-align: center; font-size: 23px; font-weight: 850;
           letter-spacing: -.03em; font-variant-numeric: tabular-nums; border: 1px solid var(--border);
           border-radius: 12px; background: var(--surface); color: var(--text); }
.eod-num:focus { border-color: var(--brand-300); box-shadow: var(--ring); outline: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); font-size: 12.4px; font-weight: 650; color: var(--text-2);
  transition: all .16s var(--ease);
}
.chip:hover { border-color: var(--brand-200); color: var(--text); }
.chip.on { background: var(--brand-soft); border-color: var(--brand-200); color: var(--brand-ink); font-weight: 750; }
.chip .c { opacity: .65; font-variant-numeric: tabular-nums; }

.copybox {
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 15px; font-size: 13.2px; line-height: 1.75; white-space: pre-wrap;
  max-height: 320px; overflow: auto;
}
.copybox a { color: var(--brand-ink); font-weight: 650; word-break: break-all; }

/* ---- frame de recursos ----
   El contenido de un SOP o un script lo escribe un manager en HTML, así que
   aquí se le da a ese HTML el mismo aire que a un documento: jerarquía de
   títulos, listas legibles y tablas que no se salen del ancho. */
.res-frame { border-color: var(--brand-200); }
.res-html {
  font-size: 13.6px; line-height: 1.72; color: var(--text);
  max-height: 62vh; overflow: auto; overflow-wrap: anywhere;
}
.res-html > *:first-child { margin-top: 0; }
.res-html > *:last-child { margin-bottom: 0; }
.res-html p { margin: 0 0 11px; }
.res-html h1, .res-html h2, .res-html h3, .res-html h4, .res-html h5, .res-html h6 {
  margin: 20px 0 8px; line-height: 1.28; letter-spacing: -.02em; font-weight: 800;
}
.res-html h1 { font-size: 20px; }
.res-html h2 { font-size: 17.5px; }
.res-html h3 { font-size: 15.5px; }
.res-html h4, .res-html h5, .res-html h6 { font-size: 14px; }
.res-html ul, .res-html ol { margin: 0 0 12px; padding-left: 22px; }
.res-html li { margin: 4px 0; }
.res-html a { color: var(--brand-ink); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.res-html strong, .res-html b { font-weight: 750; }
.res-html blockquote {
  margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--brand-200);
  background: var(--surface-inset); border-radius: 0 var(--r-sm, 8px) var(--r-sm, 8px) 0; color: var(--text-2);
}
.res-html code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.4px;
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px;
}
.res-html pre {
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; overflow-x: auto; margin: 0 0 12px;
}
.res-html pre code { background: none; border: 0; padding: 0; }
.res-html hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.res-html img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.res-html table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 12.8px; }
.res-html th, .res-html td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.res-html th { background: var(--surface-inset); font-weight: 700; }

/* Editor: el textarea de HTML se lee como código, no como prosa. */
.res-edit-row textarea.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.4px; line-height: 1.6;
}
.res-edit-group .section-head { flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  padding: 9px 14px; font-size: 13.2px; font-weight: 650; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap; transition: all .16s var(--ease);
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 750; }

/* Tier columns */
.tiers { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.tier { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px; }
.tier-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.tier-h .n { font-size: 11.4px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.tier-h .c { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tier .hint { font-size: 11.4px; color: var(--text-3); margin-bottom: 10px; }
.tier-card {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px;
  transition: all .18s var(--ease);
}
.tier-card:hover { transform: translateY(-1px); box-shadow: var(--sh-1); }
.tier.starters { border-top: 3px solid var(--good); }
.tier.rotation { border-top: 3px solid var(--series-1); }
.tier.development { border-top: 3px solid var(--warning); }
.tier.bubble { border-top: 3px solid var(--critical); }

/* Avisos de estado (parcial / viejo / error) */
.notice {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: var(--r-md); margin-bottom: 16px;
  border: 1px solid var(--border); font-size: 13px; line-height: 1.45;
  animation: rise .25s var(--ease) both;
}
.notice .ni {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff;
}
.notice.warning  { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 34%, transparent); }
.notice.warning .ni  { background: var(--warning); color: #3d2c00; }
.notice.critical { background: var(--critical-soft); border-color: color-mix(in srgb, var(--critical) 34%, transparent); }
.notice.critical .ni { background: var(--critical); }
.notice.brand    { background: var(--brand-soft); border-color: var(--brand-200); }
.notice.brand .ni    { background: var(--brand); }
.notice b { font-weight: 750; }

/* Chip de verificación: acompaña a un número que no cuadra */
.vchip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 750; padding: 2px 7px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
/* Rojo, no ámbar: un descuadre entre lo que el rep declaró y lo que entró de
   verdad es dinero sin explicar, y en ámbar se leía como un detalle menor. */
.vchip.gap { background: var(--critical-soft); color: var(--critical); }
.vchip.ok  { background: var(--good-soft); color: var(--good); }

/* Empty / loading */
.empty { text-align: center; padding: 42px 20px; color: var(--text-3); }
.empty .ei { font-size: 30px; margin-bottom: 8px; opacity: .6; }
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 99px;
  font-size: 13.2px; font-weight: 650; box-shadow: var(--sh-3); z-index: 300;
  opacity: 0; transition: all .28s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side {
  background: linear-gradient(150deg, #5E2900, #8F4000 45%, #C25A00);
  color: #fff; padding: 46px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::after { content:""; position:absolute; right:-120px; bottom:-120px; width:420px; height:420px; border-radius:50%; background:rgba(255,255,255,.10); }
.login-side::before { content:""; position:absolute; left:-90px; top:20%; width:260px; height:260px; border-radius:50%; background:rgba(255,255,255,.07); }
.login-side > * { position: relative; z-index: 1; }
.login-main { display: grid; place-items: center; padding: 40px 26px; }
.login-card { width: 100%; max-width: 380px; }
.login-feat { display: flex; gap: 12px; margin-top: 16px; }
.login-feat .fi { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.rolegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 12px; }
.rolebtn { padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); text-align: left; transition: all .16s var(--ease); }
.rolebtn:hover { border-color: var(--brand-300); transform: translateY(-1px); box-shadow: var(--sh-1); }
.rolebtn.on { border-color: var(--brand); background: var(--brand-soft); }
.rolebtn .rn { font-size: 13px; font-weight: 750; }
.rolebtn .rd { font-size: 11px; color: var(--text-3); }

/* Responsive */
/* Plegar la barra: sólo tiene sentido donde ocupa una columna del layout.
   Por debajo de 980px la barra ya es un cajón que se abre encima, y ese caso
   lo maneja .nav-open — mezclar los dos deja la barra invisible y sin forma
   de recuperarla. */
@media (min-width: 981px) {
  body.nav-collapsed .shell { grid-template-columns: 0 minmax(0,1fr); }
  body.nav-collapsed .sidebar {
    width: 0; padding-left: 0; padding-right: 0;
    border-right-color: transparent; overflow: hidden;
    transition: width .26s var(--ease), padding .26s var(--ease);
  }
}

@media (max-width: 1600px) { .g6 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (max-width: 1420px) { .g5, .g6 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1180px) { .split { grid-template-columns: 1fr; } .g4, .g5, .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); } .tiers { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px; height: 100vh;
    transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--sh-3);
  }
  body.nav-open .sidebar { transform: none; }
  /* Velo detrás del cajón (z 35 < sidebar 40, mismo contexto: #app). */
  .nav-scrim { display: none; position: fixed; inset: 0; background: rgba(8,16,30,.42); z-index: 35; }
  body.nav-open .nav-scrim { display: block; }
  body.nav-open { overflow: hidden; }
  .view { padding: 18px 16px 56px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
}
@media (max-width: 620px) {
  .g4, .g5, .g6 { grid-template-columns: 1fr; }
  .tiers { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 23px; }
  .hero-value { font-size: 36px; }
  .clock { display: none; }
  /* Barra superior en teléfono: menú · buscador (lo que sobre) · ⟳ · ES/EN · ◐.
     El "Actualizado hace Xs" se quita: no cabía y aplastaba los botones. */
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .search { flex: 1 1 auto; min-width: 0; }
  .topbar .search input { width: 100%; min-width: 0; }
  .topbar .grow { display: none; }
  #freshness { display: none; }
  .seg button { padding: 4px 8px; font-size: 11.5px; }
  .icon-btn, .menu-btn { width: 34px; height: 34px; flex: none; }
  .bar-row { grid-template-columns: 96px minmax(0,1fr) 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media print { .sidebar, .topbar { display: none; } .shell { grid-template-columns: 1fr; } }


/* ============================================================
   Ver como… — sólo lo ve Ops.
   Aviso pegajoso y bien visible a propósito: mirar con los ojos
   de otro no puede ser un estado en el que se te olvide que estás.
   ============================================================ */
.viewas { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.viewas > .k {
  font-size: 10.4px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
}
.viewas select {
  width: 100%; font: inherit; font-size: 12.8px;
  padding: 6px 9px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color .18s var(--ease);
}
.viewas select:hover { border-color: var(--brand-200); }
.viewas select:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--brand); }

.viewbar {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 9px 22px;
  background: var(--warning-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 34%, transparent);
  font-size: 13px; color: var(--text);
}
.viewbar .ni {
  flex: none; width: 19px; height: 19px; border-radius: 50%;
  background: var(--warning); color: #3d2c00;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.viewbar .sub { color: var(--text-2); font-size: 12.2px; }
.viewbar select {
  margin-left: auto; font: inherit; font-size: 12.4px;
  padding: 4px 9px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.viewbar select:focus-visible { outline: none; box-shadow: var(--ring); }
.viewbar select + button { margin-left: 0; }
.viewbar button {
  margin-left: auto; font: inherit; font-size: 12.4px; font-weight: 600;
  padding: 4px 12px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: all .18s var(--ease);
}
.viewbar button:hover { border-color: var(--brand-200); color: var(--brand-ink); }
.viewbar button:focus-visible { outline: none; box-shadow: var(--ring); }
@media (max-width: 700px) { .viewbar { padding: 9px 16px; } .viewbar .sub { display: none; } }

/* ---------------------------------------------------------------------------
   Aviso de cobros — el modal que sale al entrar cuando hay pagos venciendo.
   Se pinta encima de todo a propósito: si esto se puede ignorar de reojo, no
   sirve para lo único que existe, que es que nadie se entere tarde.
   --------------------------------------------------------------------------- */
.alert-back {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(12, 20, 34, .52);
  backdrop-filter: saturate(140%) blur(3px);
  -webkit-backdrop-filter: saturate(140%) blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: alertFade .18s var(--ease);
}
@keyframes alertFade { from { opacity: 0; } to { opacity: 1; } }
.alert-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(12, 20, 34, .28);
  width: 100%; max-width: 560px; max-height: 82vh; display: flex; flex-direction: column;
  animation: alertRise .2s var(--ease);
}
@keyframes alertRise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert-box .ab-head {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--border);
}
.alert-box .ab-icon {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 18px; font-weight: 800;
  background: var(--critical-soft); color: var(--critical);
}
.alert-box h3 { font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; }
.alert-box .ab-sub { font-size: 12.8px; color: var(--text-2); margin-top: 3px; }
.alert-box .ab-list { overflow: auto; padding: 6px 10px; }
.alert-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-sm);
}
.alert-row + .alert-row { border-top: 1px solid var(--border); }
.alert-row .ar-when {
  /* Ancho fijo, no mínimo: con "venció hace 3d" y "vence hoy" en la misma lista,
     un chip elástico deja los nombres en zigzag y la columna deja de leerse. */
  flex: none; width: 74px; text-align: center; white-space: nowrap;
  font-size: 11.5px; font-weight: 750; padding: 5px 6px; border-radius: 999px;
}
.alert-row .ar-when.late { background: var(--critical-soft); color: var(--critical); }
.alert-row .ar-when.soon { background: var(--warning-soft); color: #8a6100; }
:root[data-theme="dark"] .alert-row .ar-when.soon { color: var(--warning); }
.alert-row .ar-who { flex: 1; min-width: 0; }
.alert-row .ar-who .t { display: block; font-weight: 650; font-size: 13.4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row .ar-who .s { display: block; font-size: 11.6px; color: var(--text-3); }
.alert-row .ar-amt { flex: none; font-weight: 800; font-size: 14.5px; }
.alert-box .ab-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
@media (max-width: 560px) {
  .alert-row { flex-wrap: wrap; }
  .alert-row .ar-when { width: auto; padding: 5px 10px; }
}

/* ---------- selector de personas con foto ---------- */
.picker { position: relative; display: inline-block; }
.picker-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 11px 6px 7px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font: inherit; color: var(--text); cursor: pointer;
  box-shadow: var(--sh-1); transition: border-color .12s, box-shadow .12s;
}
.picker-btn:hover:not(:disabled) { border-color: var(--border-strong); box-shadow: var(--sh-2); }
.picker-btn:disabled { cursor: default; box-shadow: none; }
.picker-name { font-weight: 700; font-size: 13.4px; letter-spacing: -.01em; }
.picker-caret { color: var(--text-3); font-size: 11px; margin-left: 1px; }
.picker-menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  min-width: 246px; max-height: 320px; overflow: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-2);
}
.picker-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border: 0; border-radius: var(--r-sm);
  background: transparent; font: inherit; color: var(--text);
  cursor: pointer; text-align: left;
}
.picker-opt:hover { background: var(--surface-3); }
.picker-opt.on { background: var(--brand-soft, var(--surface-3)); }
.picker-opt .po-n { display: block; font-weight: 650; font-size: 13.4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-opt .po-s { display: block; font-size: 11.4px; color: var(--text-3); }

/* ---------- proyección contra meta ---------- */
.pace svg { display: block; width: 100%; height: auto; overflow: visible; }
.pace-bars { margin-top: 2px; }
.pace .cd rect { transition: fill-opacity .12s; }
.pace .cd:hover rect:first-child { fill-opacity: 1; }
/* La leyenda de la segunda gráfica no es decoración: sin ella, las dos escalas
   apiladas se leen como un solo eje, que es justo lo que no son. */
.pace-cap {
  margin: 14px 0 2px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 10.5px; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
}
.pace .pb { transition: fill-opacity .12s; }
.pace-head {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 26px;
  margin-bottom: 14px;
}
.pace-stat .k {
  display: block; font-size: 10.5px; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 3px;
}
.pace-stat .v { display: block; font-size: 21px; font-weight: 820; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.pace-stat .v.sm { font-size: 16.5px; }
/* El estado no viaja solo en el color: verde y rojo se separan mal en daltonismo
   rojo-verde, así que aquí van además la flecha y la palabra. */
.pace-verdict {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12.6px; font-weight: 780;
}
.pace-verdict.ok   { background: var(--good-soft);     color: var(--good); }
.pace-verdict.behind { background: var(--critical-soft); color: var(--critical); }
.pace-legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px;
  font-size: 11.8px; color: var(--text-2);
}
.pace-legend span { display: inline-flex; align-items: center; gap: 7px; }
.pace-legend i { width: 16px; height: 0; border-top-width: 2px; border-top-style: solid; display: inline-block; }
.pace-legend i.sq { width: 10px; height: 10px; border: 0; border-radius: 3px; }
/* La muestra de la leyenda tiene la forma de lo que representa: una vela, no un
   cuadrito. Y la rayada lleva la MISMA trama de 45° que el gráfico, porque ahí
   es donde se aprende a leerla sin depender del color. */
.pace-legend i.cnd { width: 7px; height: 16px; border: 0; border-radius: 2px; }
.pace-legend i.cnd.hatch {
  background-image: repeating-linear-gradient(45deg,
    var(--surface) 0 2px, transparent 2px 6px);
}
@media (max-width: 620px) {
  .pace-head { gap: 10px 18px; }
  .pace-stat .v { font-size: 18px; }
}

/* ============================== MARCADOR ==============================
   Una tarjeta grande manda en la pantalla y todo lo demás es contexto: la
   disciplina del marcador es que haya UN lead delante, no ocho mil donde
   elegir. Mismos tokens que el resto del HQ — sirve igual en claro y en
   oscuro, y sin un solo color escrito a mano. */
.dl-card { border-left: 3px solid var(--border-strong); }
.dl-card.hot { border-left-color: var(--good); }
.dl-name { font-size: 25px; font-weight: 820; letter-spacing: -.035em; line-height: 1.1; }

.dl-when { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.dl-clock {
  font-family: var(--mono); font-size: 17px; font-weight: 700;
  color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}

.dl-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; margin: 16px 0;
}
.dl-fact {
  display: flex; align-items: center; gap: 9px; padding: 11px 13px;
  background: var(--surface-2); min-width: 0;
}
.dl-fact .i { color: var(--text-3); font-size: 13px; flex: none; }
.dl-fact .v { font-size: 13.2px; font-weight: 620; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-fact.copy { cursor: pointer; }
.dl-fact.copy:hover { background: var(--surface-3); }
.dl-fact.copy .v { color: var(--brand-ink); }

.dl-call { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.dl-go { font-size: 15px; font-weight: 800; padding: 13px 26px; border-radius: var(--r-md); }
.dl-go-i { margin-right: 9px; font-size: 15px; }
.dl-hint { flex: 1; min-width: 220px; font-size: 11.4px; line-height: 1.45; }

.dl-out { border-top: 1px solid var(--border); padding-top: 14px; }
.dl-out.locked { opacity: .5; }
.dl-out-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.dl-ob {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 12px 8px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: center;
  transition: transform .12s var(--ease), border-color .12s, background .12s;
}
.dl-ob:hover { transform: translateY(-1px); box-shadow: var(--sh-1); }
.dl-ob .ob-i { font-size: 16px; line-height: 1; }
.dl-ob .ob-t { font-size: 12.6px; font-weight: 750; color: var(--text); letter-spacing: -.01em; }
.dl-ob .ob-s { font-size: 10.6px; color: var(--text-3); line-height: 1.35; }
.dl-ob.good:hover  { border-color: var(--good);     background: var(--good-soft); }
.dl-ob.brand:hover { border-color: var(--brand);    background: var(--brand-soft); }
.dl-ob.warn:hover  { border-color: var(--warning);  background: var(--warning-soft); }
.dl-ob.risk:hover  { border-color: var(--serious);  background: var(--serious-soft); }
.dl-ob.dim:hover   { border-color: var(--border-strong); background: var(--surface-3); }
.dl-ob.good .ob-i  { color: var(--good); }
.dl-ob.brand .ob-i { color: var(--brand); }
.dl-ob.warn .ob-i  { color: var(--warning); }
.dl-ob.risk .ob-i  { color: var(--serious); }

.dl-dq { display: none; margin-top: 12px; padding: 12px; background: var(--surface-inset); border-radius: var(--r-md); }
.dl-dq.open { display: block; }
.dl-dq-h {
  font-size: 11.2px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 9px;
}

.dl-next { display: flex; flex-direction: column; max-height: 340px; overflow: auto; }
.dl-next-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto 16px; align-items: center;
  gap: 10px; padding: 10px 15px; background: none; border: 0; border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left; width: 100%;
}
.dl-next-row:hover { background: var(--surface-2); }
.dl-next-row:last-child { border-bottom: none; }
.dl-next-row.off { opacity: .55; }
.dl-next-row .n { font-size: 13.2px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-next-row .s { font-size: 11.4px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-next-row .b { font-size: 11px; color: var(--text-3); text-align: right; }

.dl-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.6px; font-weight: 620; color: var(--text-2); cursor: pointer; }
.dl-toggle input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

.dl-offline { text-align: center; padding: 64px 24px; }
.dl-offline h2 { font-size: 24px; font-weight: 820; letter-spacing: -.03em; margin: 16px 0 6px; }
.dl-offline p { max-width: 42ch; margin: 0 auto 14px; }
.dl-off-dot {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto;
  background: var(--surface-3); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.dl-off-dot::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); }

@media (max-width: 900px) {
  .dl-out-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-when { text-align: left; align-items: flex-start; }
  .dl-name { font-size: 21px; }
}

/* Aviso de datos nuevos en la barra superior. Es un ofrecimiento, no una alarma:
   aparece sólo cuando el refresco automático se contuvo para no interrumpir. */
.freshbtn {
  background: var(--brand-soft); border: 1px solid var(--brand-200); color: var(--brand-ink);
  font-size: 11.2px; font-weight: 750; padding: 4px 10px; border-radius: 999px;
  cursor: pointer; font-family: var(--font); letter-spacing: -.01em;
}
.freshbtn:hover { background: var(--brand-100); }
.freshbtn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ===================== ACTIVIDAD EN VIVO =====================
   Dos piezas propias: el pulso del día (una columna por hora) y el feed de
   desenlaces. Todo lo demás reutiliza tarjetas y tablas del resto del HQ. */
.pulse { display: flex; align-items: flex-end; gap: 4px; height: 132px; padding-top: 6px; }
.pulse .ph { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.pulse .pb {
  width: 100%; max-width: 26px; border-radius: 4px 4px 2px 2px;
  background: var(--surface-3); border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  transition: background .12s;
}
.pulse .ph:hover .pb { background: var(--brand-soft); border-color: var(--brand-200); }
/* La porción verde es lo que conectó: se lee de un vistazo qué hora rinde. */
.pulse .pb > i { display: block; width: 100%; background: var(--good); }
.pulse .pn { font-size: 10.4px; font-weight: 800; color: var(--text-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pulse .pl { font-size: 9.6px; color: var(--text-3); font-weight: 700; letter-spacing: .02em; }

.feed { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.feed-row {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 9px 15px; border-bottom: 1px solid var(--border);
}
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: var(--surface-2); }
.feed-row .fw { font-size: 10.8px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.feed-row .fb { min-width: 0; font-size: 13px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .fs { display: block; font-size: 11.2px; font-weight: 500; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 700px) {
  .pulse { height: 104px; }
  .pulse .pn { display: none; }
  .feed-row { grid-template-columns: 62px minmax(0, 1fr) auto; }
}

/* Punto del Marcador mientras arma la cola por primera vez: late, para que se
   entienda que está trabajando y no colgado. */
.dl-off-dot.building::after { background: var(--brand); animation: dlPulse 1.1s ease-in-out infinite; }
@keyframes dlPulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* Recurso sin enlace todavía. Sólo lo recibe manager u Ops: es su pendiente,
   así que se ve apagado y no se comporta como algo en lo que se pueda hacer clic. */
.res-pending { opacity: .62; cursor: default; }
.res-pending:hover { transform: none; box-shadow: var(--sh-1); border-color: var(--border); }
.res-pending .qi { background: var(--surface-3); color: var(--text-3); }

/* El número dentro del botón de llamar: se marca viendo a quién. */
.dl-go .dl-num { font-family: var(--mono); font-size: 13.5px; font-weight: 700; opacity: .9; margin-left: 8px; }
.dl-go[aria-disabled="true"] { pointer-events: none; }

/* ---------- Registro del día ----------
   Una ficha por persona que se abre en su día completo. La cabecera es un
   botón entero (no un enlace con un icono al lado) para que abrir a alguien no
   dependa de acertarle a una flecha de doce píxeles. */
.dlg-p { overflow: hidden; }
.dlg-p.quiet { opacity: .66; }
.dlg-head {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 12px 15px; background: none; border: 0; cursor: pointer; text-align: left;
}
.dlg-head:hover { background: var(--surface-2); }
.dlg-head:focus-visible { outline: none; box-shadow: var(--ring); }
.dlg-head .dlg-id { display: flex; flex-direction: column; min-width: 148px; }
.dlg-head .dlg-id .nm { font-weight: 700; font-size: 13.8px; letter-spacing: -.01em; }
.dlg-head .chev { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease); }
.dlg-p [aria-expanded="true"] .chev { transform: rotate(90deg); }
.dlg-nums { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.dlg-k { display: flex; flex-direction: column; gap: 1px; min-width: 56px; }
.dlg-k .v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dlg-body { border-top: 1px solid var(--border); }
.dlg-meta {
  display: flex; flex-wrap: wrap; gap: 16px 26px; padding: 13px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.dlg-sec { padding: 12px 16px; border-bottom: 1px solid var(--border); }

@media (max-width: 900px) {
  /* En pantalla estrecha la fila de cifras se va debajo del nombre en vez de
     empujar el nombre fuera de la tarjeta. */
  .dlg-head { flex-wrap: wrap; }
  .dlg-nums { margin-left: 0; width: 100%; gap: 14px; }
  .dlg-head .chev { display: none; }
}

/* ---------- la marca ----------
   El hexágono va como imagen con fondo transparente, así que se ve igual en
   claro y en oscuro sin tener que servir dos archivos. Nada de caja de color
   detrás: el logo YA es una figura cerrada y meterlo en un cuadrado naranja lo
   convertía en un sello dentro de otro sello. */
.brand-logo { width: 40px; height: auto; flex: none; display: block; }
/* El hexágono dorado aguanta mejor el tamaño pequeño que el anterior (menos
   bandas concéntricas), así que 40 px sobran para que se lea. */
/* El login usa el mismo hexágono, un poco más grande. El lockup completo con
   el texto dorado quedó guardado fuera de assets (_to_delete/logo-lockup-sin-usar):
   sobre el naranja del panel el dorado no se lee. */
.login-side .brand-logo { width: 46px; }
