/* ============================================================================
   JUSPER — Sistema de diseño v3 (herramienta profesional)
   Identidad: logo + azul de marca + lema. UI limpia y coherente en todos los
   módulos: tipografía Inter para la interfaz, Anton solo para la marca.
   Tokens centralizados → todo usa lo mismo y es fácil de mantener.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Marca */
  --azul:      #1f3df0;   /* azul JUSPER (acción / acento) */
  --azul-600:  #1733c9;   /* hover */
  --azul-700:  #11258f;
  --azul-soft: #eef1fe;   /* fondo suave de acento */
  --navy:      #0b1437;   /* texto/marca profundo */

  /* Neutros (escala de grises azulada) */
  --bg:        #f5f7fb;   /* fondo de la app */
  --panel:     #ffffff;   /* superficie de tarjetas */
  --panel-2:   #fafbfe;   /* superficie sutil (headers de tabla, hovers) */
  --linea:     #e7ebf3;   /* bordes/divisores */
  --linea-2:   #eff2f8;   /* divisor suave */
  --tinta:     #1a2233;   /* texto principal */
  --tinta-2:   #46506a;   /* texto secundario */
  --muted:     #6b7488;   /* texto atenuado */

  /* Estados */
  --ok:    #0f9d58;  --ok-bg:   #e7f6ee;  --ok-bd:   #b9e3cc;
  --mal:   #d83a3a;  --mal-bg:  #fdebeb;  --mal-bd:  #f4c4c4;
  --warn:  #c77700;  --warn-bg: #fdf3e2;  --warn-bd: #f3dcae;
  --info:  #1f3df0;  --info-bg: #eef1fe;  --info-bd: #cdd6fb;

  /* Forma */
  --r-sm: 8px;  --r: 12px;  --r-lg: 16px;  --r-pill: 999px;
  --sombra-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
  --sombra:    0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
  --sombra-lg: 0 12px 32px rgba(16,24,40,.12);
  --grad:      linear-gradient(120deg, #1f3df0 0%, #3a2ee0 100%);

  /* Espaciado */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  /* Tipografía */
  --marca: "Anton", "Inter", sans-serif;                /* SOLO marca/logo */
  --texto: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:  "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--texto); background: var(--bg); color: var(--tinta);
  -webkit-font-smoothing: antialiased; line-height: 1.5; font-size: 14px; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--azul-soft); }

h1, h2, h3, h4 { color: var(--tinta); margin: 0 0 .5rem; font-weight: 700;
  letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; font-weight: 650; }
h4 { font-size: .9rem; }
.titulo { /* compat: antes era Anton-mayúscula; ahora encabezado limpio profesional */
  font-family: var(--texto); text-transform: none; letter-spacing: -.01em;
  font-weight: 750; color: var(--tinta); }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--azul); margin: 0 0 .25rem; }
.muted { color: var(--muted); }
small, .small { font-size: .8rem; }

/* ── Marca / logo ────────────────────────────────────────────────────────── */
.logo-word, .logo-xl, .logo-img { font-family: var(--marca); }
.logo-img { display: block; width: auto; }
.logo-xl { font-family: var(--marca); text-transform: uppercase; color: #fff;
  font-size: clamp(3rem, 8vw, 5.4rem); letter-spacing: 2px; line-height: .9; }
.hero .logo-img { height: clamp(74px, 12vw, 120px); filter: drop-shadow(0 10px 24px rgba(0,0,0,.4)); }
.side .brand .logo-img { height: 38px; }

/* ── Hero / login ────────────────────────────────────────────────────────── */
.hero { position: relative; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem; overflow: hidden;
  background: radial-gradient(1200px 600px at 50% -10%, #25347a 0%, #0b1437 55%, #070d28 100%); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: 0; opacity: .5;
  background-image:
    radial-gradient(600px 300px at 15% 20%, rgba(58,46,224,.45), transparent 60%),
    radial-gradient(700px 360px at 85% 80%, rgba(31,61,240,.40), transparent 60%); }
.hero > * { position: relative; z-index: 2; }
.hero .tagline { color: #c7d0f3; font-size: 1rem; letter-spacing: .3px; margin-top: .6rem;
  font-style: italic; }
.auth-card { width: 360px; background: rgba(255,255,255,.98); border-radius: var(--r-lg);
  box-shadow: var(--sombra-lg); padding: 1.8rem 1.7rem; margin-top: 1.8rem; }
.auth-card .barra { height: 4px; border-radius: var(--r-pill); background: var(--grad); margin-bottom: 1.3rem; }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
  font-family: var(--texto); font-weight: 600; font-size: .88rem; line-height: 1;
  padding: .62rem 1.1rem; border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer; background: var(--azul); color: #fff; box-shadow: var(--sombra-sm);
  transition: background .14s, box-shadow .14s, border-color .14s, transform .02s; white-space: nowrap; }
.btn:hover { background: var(--azul-600); text-decoration: none; box-shadow: var(--sombra); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.blanco { background: #fff; color: var(--azul); border-color: var(--linea); font-weight: 700; }
.btn.blanco:hover { background: var(--panel-2); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); box-shadow: none; }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.gris { background: #eef1f7; color: var(--tinta); border-color: var(--linea); box-shadow: none; }
.btn.gris:hover { background: #e6eaf2; }
.btn.peligro { background: var(--mal); box-shadow: none; }
.btn.peligro:hover { background: #c22e2e; }
.btn.ok { background: var(--ok); box-shadow: none; }
.btn.sm { padding: .42rem .8rem; font-size: .8rem; border-radius: var(--r-sm); }
.btn.lg { padding: .8rem 1.4rem; font-size: .95rem; }

/* ── Shell / sidebar ─────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side { width: 236px; background: var(--panel); border-right: 1px solid var(--linea);
  display: flex; flex-direction: column; padding: 1.1rem .75rem; gap: .1rem;
  position: sticky; top: 0; height: 100vh; }
.side .brand { padding: .2rem .5rem 1.1rem; display: flex; flex-direction: column; gap: .25rem; }
.side .brand .tag { font-size: .68rem; color: var(--muted); letter-spacing: .2px; font-style: italic; }
.side nav { display: flex; flex-direction: column; gap: .1rem; }
.side a.item { display: flex; align-items: center; gap: .6rem; padding: .56rem .65rem;
  border-radius: var(--r); color: var(--tinta-2); font-size: .9rem; font-weight: 550;
  transition: background .12s, color .12s; }
.side a.item .ic { width: 1.4rem; display: inline-flex; align-items: center; justify-content: center; }
.side a.item .ic-svg { display: block; opacity: .7; }
.side a.item:hover { background: var(--panel-2); color: var(--tinta); text-decoration: none; }
.side a.item:hover .ic-svg { opacity: .9; }
.side a.item.activo { background: var(--azul-soft); color: var(--azul-700); font-weight: 650; }
.side a.item.activo .ic-svg { opacity: 1; color: var(--azul); }
.side a.item .ext { margin-left: auto; font-size: .8rem; opacity: .6; }
.modcard-ic svg { width: 30px; height: 30px; }

/* ── NAV1 · menú canal-first (00-NAV-spec §10) ───────────────────────────── */
.side .nav-group { font-size: .68rem; font-weight: 700; letter-spacing: .4px;
  color: var(--muted); text-transform: uppercase; padding: .7rem .65rem .25rem; }
.side .canal-chip { width: 1.25rem; height: 1.25rem; border-radius: 6px; font-size: .62rem;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.side .canal-ico { width: 1.25rem; height: 1.25rem; border-radius: 6px; object-fit: cover; flex: 0 0 auto; display: block; }
.side .canal-estado { margin-left: auto; font-size: .64rem; }
.side .canal-estado.ok { color: var(--ok); }
.side .canal-estado.prox { color: var(--muted); }
.side .canal-head { display: flex; align-items: center; gap: .5rem; padding: .2rem .5rem .6rem; font-weight: 700; }

/* Logos oficiales de canal en tile blanco (los SVG son wordmarks horizontales; el tile los hace
   legibles en cualquier fondo y les da tamaño parejo). */
.canal-logo { display: inline-flex; align-items: center; justify-content: center; background: #fff;
  border: 1px solid var(--linea); border-radius: 9px; padding: .3rem .48rem; flex: 0 0 auto; }
.canal-logo img { display: block; width: auto; height: 1.2rem; max-width: 6rem; }
.canal-logo.sm { border-radius: 7px; padding: .2rem .34rem; }
.canal-logo.sm img { height: .9rem; max-width: 5rem; }
.canal-logo.lg { border-radius: 12px; padding: .45rem .6rem; }
.canal-logo.lg img { height: 1.6rem; max-width: 8.5rem; }
/* En el menú lateral (acordeón "Canales" + header del canal) los logos van más grandes/legibles. */
.side .canal-logo { padding: .32rem .5rem; }
.side .canal-logo img { height: 1.3rem; max-width: 6.8rem; }

/* Acordeón "Canales": un ítem-botón que despliega los canales. */
.side .nav-acc-toggle { display: flex; align-items: center; gap: .6rem; padding: .56rem .65rem;
  border-radius: var(--r); color: var(--tinta-2); font-size: .9rem; font-weight: 550; width: 100%;
  border: 0; background: none; cursor: pointer; font-family: inherit; text-align: left;
  transition: background .12s, color .12s; }
.side .nav-acc-toggle .ic { width: 1.4rem; display: inline-flex; align-items: center; justify-content: center; }
.side .nav-acc-toggle .ic-svg { display: block; opacity: .7; }
.side .nav-acc-toggle:hover { background: var(--panel-2); color: var(--tinta); }
.side .nav-acc-toggle .acc-caret { margin-left: auto; opacity: .55; transition: transform .15s; flex: 0 0 auto; }
.side .nav-acc-toggle[aria-expanded="true"] { color: var(--tinta); }
.side .nav-acc-toggle[aria-expanded="true"] .acc-caret { transform: rotate(90deg); }
.side .nav-acc-body[hidden] { display: none; }
.side .nav-acc-body a.item.sub { padding-left: 1.6rem; }
.side .canal-head .canal-ico, .side .canal-head .canal-chip { width: 1.5rem; height: 1.5rem; }
.side .volver { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted);
  padding: .3rem .5rem; text-decoration: none; }
.side .volver:hover { color: var(--azul-700); }
.side .sep { border-top: 1px solid var(--linea); margin: .55rem .3rem; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: .05rem; padding-top: .5rem; }
.side .foot a { color: var(--muted); font-size: .85rem; padding: .42rem .65rem; border-radius: var(--r-sm); }
.side .foot a:hover { background: var(--panel-2); color: var(--tinta); text-decoration: none; }
.side .user { font-size: .8rem; color: var(--muted); padding: .2rem .65rem .5rem; }
.side .user b { color: var(--tinta); }
.badge-admin { display: inline-block; font-size: .6rem; font-weight: 800; letter-spacing: .5px;
  color: var(--azul-700); background: var(--azul-soft); padding: .1rem .38rem; border-radius: 5px; margin-left: .3rem;
  vertical-align: middle; }

.main { flex: 1; --main-pt: 1.8rem; --main-px: 2.2rem; padding: var(--main-pt) var(--main-px);
  max-width: 1160px; width: 100%; }
.main > h2, .main > .titulo { font-size: 1.5rem; margin-bottom: 1.1rem; }

/* ── Topbar de la cáscara (design-system §8): breadcrumb + buscador + campana + avatar ── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  min-height: 3rem; background: var(--panel); border-bottom: 1px solid var(--linea);
  margin: calc(-1 * var(--main-pt)) calc(-1 * var(--main-px)) 1.4rem;
  padding: .5rem var(--main-px); }
.topbar .tb-title { font-size: .95rem; font-weight: 650; color: var(--tinta); }
.topbar .tb-actions { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.tb-search { display: flex; align-items: center; gap: .45rem; width: 260px;
  background: var(--panel-2); border: 1px solid var(--linea); border-radius: var(--r); padding: .35rem .6rem; }
.tb-search:focus-within { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-soft); }
.tb-search .tb-search-ic { color: var(--muted); display: flex; flex: 0 0 auto; }
.tb-search input { border: 0; background: transparent; outline: none; width: 100%; font-size: .85rem;
  color: var(--tinta); padding: 0; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border: 1px solid var(--linea); border-radius: var(--r-sm); background: var(--panel); color: var(--tinta-2); cursor: pointer; }
.tb-btn:hover { background: var(--panel-2); color: var(--tinta); }
.tb-avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border-radius: 50%; background: var(--azul-soft); color: var(--azul-700); font-weight: 700; font-size: .82rem; flex: 0 0 auto; }
@media (max-width: 820px) {
  .topbar { gap: .5rem; }
  .topbar .tb-title { display: none; }          /* en celular el breadcrumb se oculta */
  .topbar .tb-actions { margin-left: 0; flex: 1 1 auto; }
  .tb-search { width: auto; flex: 1 1 auto; }    /* el buscador ocupa lo disponible */
}
.page-head { margin-bottom: 1.2rem; }
.page-head p { color: var(--muted); margin: .1rem 0 0; }

/* ── Tarjetas ────────────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--r-lg);
  padding: 1.2rem 1.3rem; margin-bottom: 1rem; box-shadow: var(--sombra-sm); }
.card > h3:first-child, .card > .titulo:first-child { margin-top: 0; }
.card.plano { box-shadow: none; }
.card.acento { border-left: 3px solid var(--azul); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  margin-bottom: .8rem; }
.card-head h3 { margin: 0; }

/* ── Stat cards (KPIs / vistazo) ─────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.stat { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--r-lg);
  padding: .95rem 1.05rem; box-shadow: var(--sombra-sm); display: block; color: inherit;
  transition: box-shadow .14s, border-color .14s, transform .06s; }
a.stat:hover { box-shadow: var(--sombra); border-color: #d7deec; text-decoration: none; transform: translateY(-1px); }
.stat .label { font-size: .76rem; color: var(--muted); font-weight: 600; display: flex;
  align-items: center; gap: .35rem; margin-bottom: .35rem; }
.stat .value { font-size: 1.7rem; font-weight: 750; color: var(--tinta); line-height: 1.1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .74rem; color: var(--muted); margin-top: .15rem; }
.stat.v-ok .value { color: var(--ok); }
.stat.v-mal .value { color: var(--mal); }
.stat.v-warn .value { color: var(--warn); }
.stat.borde-mal { border-color: var(--mal-bd); }
/* Entregas: KPIs clickeables con drill-down de órdenes */
button.stat { width: 100%; text-align: left; font-family: inherit; cursor: pointer; }
.stat.ent-kpi:hover { box-shadow: var(--sombra); border-color: #d7deec; transform: translateY(-1px); }
.stat.ent-kpi[aria-expanded="true"] { border-color: var(--azul); box-shadow: var(--sombra); }
.stat .ent-desglose { display: flex; flex-wrap: wrap; gap: .15rem .55rem; margin-top: .35rem; }
.stat .ent-desglose .ent-cta { font-size: .7rem; color: var(--tinta-2); }
.stat .ent-desglose .ent-cta b { font-weight: 700; color: var(--tinta); }
.ent-drill-head { display: flex; align-items: center; justify-content: space-between; margin: .2rem 0 .5rem; }

/* Panel de reputación (cuenta × país) */
.reputa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.reputa-card { padding: .85rem .95rem; }
/* Canal conectado pero SIN acceso al puntaje por API (Falabella/Walmart): tarjeta atenuada/grisada. */
.reputa-card.reputa-sinacceso { opacity: .58; }
.reputa-card.reputa-sinacceso:hover { opacity: .82; }
.reputa-card.reputa-sinacceso .canal-logo img { filter: grayscale(1); }
.reputa-cta { font-weight: 700; margin-bottom: .5rem; display: flex; align-items: center; gap: .45rem; }
.reputa-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.reputa-pill { display: inline-flex; align-items: baseline; gap: .28rem; padding: .3rem .62rem;
  border-radius: 999px; font-size: .82rem; font-weight: 650; line-height: 1.15; white-space: nowrap; }
.reputa-pill .ml { font-size: .72rem; font-weight: 600; opacity: .9; }
.reputa-pill.verde { background: #1f9d57; color: #fff; }
.reputa-pill.amarillo { background: #f2c200; color: #4a3900; }
.reputa-pill.naranja { background: #e07800; color: #fff; }
.reputa-pill.rojo { background: var(--mal); color: #fff; }
.reputa-pill.gris { background: var(--linea); color: var(--muted); }

/* ── Dashboard de inicio (FASE D) ──────────────────────────────────────────── */
.kpi-delta { font-size: .74rem; font-weight: 700; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--mal); }
.canal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }
.canal-card { display: block; border: 1px solid var(--linea); border-radius: 16px; padding: 1.2rem;
  background: var(--panel); box-shadow: var(--sombra); color: inherit;
  transition: box-shadow .14s, border-color .14s, transform .06s; }
.canal-card:hover { box-shadow: var(--sombra); border-color: #d7deec; text-decoration: none; transform: translateY(-1px); }
.canal-monto { font-size: 1.5rem; font-weight: 750; color: var(--tinta); letter-spacing: -.5px; margin: .1rem 0 .35rem; }
.canal-bar { height: 6px; border-radius: var(--r-pill); background: var(--panel-2); overflow: hidden; margin-bottom: .45rem; }
.canal-bar span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--azul); }
.act-row { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-bottom: 1px solid var(--linea); }
.act-row:last-child { border-bottom: 0; }
.act-ic { display: inline-flex; flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%;
  align-items: center; justify-content: center; background: var(--panel-2); }
.act-ic.ok { color: var(--ok); } .act-ic.dev { color: var(--mal); }
.act-txt { min-width: 0; } .act-txt > div:first-child { font-size: .88rem; }
.act-hace { margin-left: auto; font-size: .74rem; white-space: nowrap; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); border: 1px dashed var(--linea);
  border-radius: 14px; background: var(--panel-2); }
.empty-state .empty-ic { color: var(--linea); display: inline-flex; }
.empty-state .empty-titulo { font-weight: 650; color: var(--tinta-2); margin: .5rem 0 .15rem; }
@media (max-width: 820px) {
  .canal-grid { grid-template-columns: 1fr; }   /* tarjetas de canal apiladas */
}

/* ── Formularios ─────────────────────────────────────────────────────────── */
label.lbl, .lbl { display: block; font-size: .8rem; color: var(--tinta-2); margin: 0 0 .3rem; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search], input[type=date], select, textarea {
  width: 100%; padding: .58rem .7rem; border-radius: var(--r); border: 1px solid var(--linea);
  background: #fff; color: var(--tinta); font-family: var(--texto); font-size: .9rem; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(31,61,240,.12); }

/* ── Foco visible por teclado (accesibilidad AA) ──────────────────────────── */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible,
.btn:focus-visible, .side a.item:focus-visible, .canal-card:focus-visible, .stat:focus-visible {
  outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(31,61,240,.18); }

/* ── Tabla → tarjetas en móvil (opt-in con .cards-mobile; patrón data-label de MB2) ── */
@media (max-width: 820px) {
  table.cards-mobile, table.cards-mobile tbody, table.cards-mobile tr, table.cards-mobile td { display: block; width: auto; }
  table.cards-mobile thead { display: none; }
  table.cards-mobile tr { border: 1px solid var(--linea); border-radius: 12px; background: var(--panel);
    padding: .5rem .85rem; margin: 0 0 .7rem; box-shadow: var(--sombra-sm); }
  table.cards-mobile td { border: 0; padding: .45rem 0; text-align: left !important; }
  table.cards-mobile td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem;
    text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; margin-bottom: .15rem; }
}
input::placeholder, textarea::placeholder { color: #aab2c4; }
.field { margin-bottom: .9rem; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-eye { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; font-size: 1rem; color: var(--muted); padding: .2rem; }
.pw-eye:hover { color: var(--azul); }

/* ── Tablas (.tabla y .piv comparten estilo coherente) ───────────────────── */
table.tabla, table.piv { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.tabla th, table.tabla td,
table.piv th, table.piv td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--linea-2);
  vertical-align: middle; }
table.tabla th, table.piv th { color: var(--muted); font-weight: 650; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .03em; background: var(--panel-2);
  position: sticky; top: 0; white-space: nowrap; }
table.tabla tbody tr:hover td, table.piv tbody tr:hover td { background: var(--panel-2); }
table.tabla tr:last-child td, table.piv tr:last-child td { border-bottom: 0; }
/* celdas tipadas usadas por los módulos */
.dim { color: var(--tinta-2); }
.num, .val, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums;
  font-family: var(--mono); font-feature-settings: "tnum"; white-space: nowrap; }
.val { font-weight: 650; color: var(--tinta); }
.tabla-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--linea); }
.tabla-wrap table.tabla th { border-top: 0; }

/* ── Badges / pills / estados ────────────────────────────────────────────── */
.pill, .badge { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .55rem;
  border-radius: var(--r-pill); font-size: .74rem; font-weight: 650; line-height: 1.4;
  border: 1px solid transparent; white-space: nowrap; }
.pill.ok,  .badge.ok,  .badge.verde  { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-bd); }
.pill.mal, .badge.mal, .badge.rojo,
.badge.no { background: var(--mal-bg);  color: var(--mal);  border-color: var(--mal-bd); }
.pill.warn, .badge.warn, .badge.ambar { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.pill.info, .badge.info, .badge.azul  { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.badge.gris { background: #eef1f7; color: var(--tinta-2); border-color: var(--linea); }
.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.mal { background: var(--mal); }
.dot.warn { background: var(--warn); } .dot.info { background: var(--azul); }
/* colores de texto utilitarios coherentes */
.t-ok { color: var(--ok); } .t-mal, .rojo { color: var(--mal); }
.t-warn { color: var(--warn); } .t-azul { color: var(--azul); }

/* ── Tabs (pestañas) ─────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--linea); margin-bottom: 1.1rem; flex-wrap: wrap; }
.tab { appearance: none; background: none; border: 0; cursor: pointer; font-family: var(--texto);
  font-size: .9rem; font-weight: 600; color: var(--muted); padding: .6rem .85rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: .4rem; }
.tab:hover { color: var(--tinta); }
.tab.activo, .tab.activa, .tab[aria-selected=true] { color: var(--azul); border-bottom-color: var(--azul); }
.tab .cuenta { background: var(--azul-soft); color: var(--azul-700); border-radius: var(--r-pill);
  font-size: .7rem; font-weight: 700; padding: .04rem .4rem; }

/* ── Alertas / avisos ────────────────────────────────────────────────────── */
.alert, .aviso { padding: .7rem .9rem; border-radius: var(--r); font-size: .86rem; margin-bottom: 1rem;
  border: 1px solid var(--linea); background: var(--panel-2); word-break: break-word; }
.alert.ok,  .aviso.ok  { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-bd); }
.alert.mal, .aviso.mal, .aviso.rojo { background: var(--mal-bg);  color: var(--mal);  border-color: var(--mal-bd); }
.alert.warn, .aviso.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.alert.info, .aviso.info { background: var(--info-bg); color: var(--azul-700); border-color: var(--info-bd); }

/* ── Estados vacío / carga ───────────────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .9rem; }
.empty .ic { font-size: 1.6rem; opacity: .5; display: block; margin-bottom: .4rem; }
.loading { color: var(--muted); font-size: .88rem; display: inline-flex; align-items: center; gap: .5rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--linea); border-top-color: var(--azul);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.skel { background: linear-gradient(90deg, #eef1f7 25%, #f6f8fc 50%, #eef1f7 75%);
  background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: 6px; color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skel { to { background-position: -200% 0; } }

/* ── Utilidades de layout ────────────────────────────────────────────────── */
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .8rem; }
.sep-h { border: 0; border-top: 1px solid var(--linea); margin: 1rem 0; }
.chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--panel);
  border: 1px solid var(--linea); border-radius: var(--r-pill); padding: .3rem .7rem; font-size: .8rem;
  color: var(--tinta-2); cursor: pointer; transition: border-color .12s, background .12s; }
.chip:hover { border-color: #d7deec; }
.chip.activo { background: var(--azul-soft); border-color: var(--azul); color: var(--azul-700); font-weight: 600; }

/* Botón hamburguesa: oculto en desktop, visible en móvil (ver media query). */
.nav-toggle { display: none; align-items: center; gap: .4rem; background: var(--panel-2);
  color: var(--tinta); border: 1px solid var(--linea); border-radius: var(--r);
  padding: .4rem .7rem; font: inherit; font-weight: 600; cursor: pointer; }
.nav-toggle svg { display: block; }

/* ── Responsive / móvil (respeta lo ya hecho) ────────────────────────────── */
@media (max-width: 820px) {
  body { font-size: 14px; }
  .shell { flex-direction: column; min-height: 0; }
  .side { width: auto; height: auto; position: static; border-right: none;
    border-bottom: 1px solid var(--linea); display: flex; flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: space-between; gap: .35rem; padding: .55rem .8rem; }
  .side .brand { padding: 0; flex-direction: row; align-items: center; gap: .5rem; }
  .side .brand .logo-img { height: 24px; }
  .side .brand .tag { display: none; }
  .nav-toggle { display: inline-flex; }
  /* Menú colapsado por defecto; se abre con la hamburguesa (.side.open). */
  .side nav { display: none; flex-direction: column; flex-wrap: nowrap; gap: .15rem; flex: 1 1 100%; margin-top: .5rem; }
  .side.open nav { display: flex; }
  .side a.item { padding: .55rem .6rem; font-size: .9rem; }
  .side a.item .ic { width: 1.4rem; }
  .side .sep { display: none; }
  .side .foot { display: none; margin: .4rem 0 0; flex-direction: row; flex-wrap: wrap;
    gap: .35rem; width: 100%; padding-top: .5rem; border-top: 1px solid var(--linea); }
  .side.open .foot { display: flex; }
  .side .user { padding: .2rem .4rem; }
  .main { --main-pt: 1rem; --main-px: .85rem; max-width: 100%; }
  .main > h2, .main > .titulo, .titulo { font-size: 1.25rem; }
  .card { padding: .9rem 1rem; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .stat .value { font-size: 1.4rem; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .charts { grid-template-columns: 1fr !important; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)) !important; }
  .btn { padding: .55rem 1rem; }
  .auth-card { width: 92vw; max-width: 360px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
}
