/* =========================================================================
   Master Series · Inventario TI
   Diseño: limpio y corporativo · barra superior · modo claro/oscuro
   ========================================================================= */

/* ---------- Paleta: modo claro ---------- */
:root {
  --bg:            #f4f6f1;
  --surface:       #ffffff;
  --surface-2:     #fafbf7;
  --surface-3:     #f0f3ea;
  --border:        #e4e8dd;
  --border-soft:   #eef1e8;
  --text:          #1f2418;
  --text-2:        #6b7363;
  --text-3:        #9aa38d;

  --brand:         #6f7d55;
  --brand-hover:   #5c6845;
  --brand-soft:    #eef2e6;
  --brand-ring:    rgba(111,125,85,.22);

  --nav-bg:    #242c1c;
  --nav-bg-2:  #1c2216;
  --nav-text:  #aab59a;
  --nav-hover: rgba(255,255,255,.07);
  --nav-act:   rgba(255,255,255,.12);

  --ok:            #17924b;   --ok-bg:   #e5f6ec;
  --warn:          #c07d17;   --warn-bg: #fdf4e3;
  --danger:        #cc3d3d;   --danger-bg:#fbeaea;
  --info:          #2563eb;   --info-bg: #e8effd;

  /* Colores por categoría en los gráficos (el de cómputo es --brand) */
  --cat-gen:       #4d7ea8;
  --cat-gen-2:     #3d6688;
  --cat-tie:       #c08a2e;
  --cat-tie-2:     #a4741f;

  /* ---- Paleta de gráficos ----------------------------------------------
     Separada de la paleta de la interfaz a propósito. Los colores del tema
     están desaturados para que la pantalla descanse, pero esa misma falta de
     color hace que en un gráfico las series se confundan entre sí y con el
     gris. Estos cuatro pasos se verificaron con el validador: luminosidad
     dentro de banda, croma suficiente, separación para daltonismo y contraste
     sobre el fondo blanco. El orden es fijo: una serie no cambia de color
     porque se filtre otra.                                                 */
  --dv-1: #5c7d33;   /* equipos de cómputo · verde de la marca, más vivo */
  --dv-2: #2c6ca6;   /* inventario general */
  --dv-3: #bf7a05;   /* inventario de tiendas */
  --dv-4: #96509b;   /* sin ubicar / en stock */
  --dv-rejilla: #eceee7;   /* un paso respecto al panel, nunca punteada */

  /* Sombras mínimas: la separación la dan los bordes, no el desenfoque.
     Solo lo que flota de verdad (menús, modales) lleva sombra notoria. */
  --sh-1: none;
  --sh-2: 0 1px 2px rgba(24,30,16,.07);
  --sh-3: 0 4px 14px rgba(24,30,16,.10), 0 1px 3px rgba(24,30,16,.06);
  --sh-4: 0 12px 34px rgba(24,30,16,.16);

  /* Esquinas discretas, como en un panel de administración */
  --r-sm: 4px;  --r: 6px;  --r-lg: 8px;  --r-full: 999px;
  --tn-h: 52px;      /* alto de la barra superior */
  --content-w: 1680px;  /* ancho máximo del contenido y de la barra */
  --ease: .12s cubic-bezier(.4,0,.2,1);
}

/* ---------- Paleta: modo oscuro ---------- */
[data-theme="dark"] {
  --bg:            #14170f;
  --surface:       #1c2016;
  --surface-2:     #21261a;
  --surface-3:     #272d1e;
  --border:        #2f3626;
  --border-soft:   #262c1e;
  --text:          #e7ebdf;
  --text-2:        #9ba591;
  --text-3:        #78826d;

  --brand:         #8f9d73;
  --brand-hover:   #a3b085;
  --brand-soft:    #262e1c;
  --brand-ring:    rgba(143,157,115,.28);

  --nav-bg:    #10130b;
  --nav-bg-2:  #0c0f08;
  --nav-text:  #94a082;

  --ok-bg:   #16301f;   --warn-bg: #33270f;
  --danger-bg:#341a1a;  --info-bg: #16224a;

  --cat-gen:       #6b9dc4;
  --cat-gen-2:     #86b3d6;
  --cat-tie:       #d3a95e;
  --cat-tie-2:     #e0bd77;

  /* Pasos propios para fondo oscuro: no es el modo claro aclarado, se
     eligieron y validaron contra la superficie #1c2016. */
  --dv-1: #73994a;
  --dv-2: #4288c0;
  --dv-3: #c08618;
  --dv-4: #a06cb0;
  --dv-rejilla: #2b3222;

  --sh-1: none;
  --sh-2: 0 1px 2px rgba(0,0,0,.3);
  --sh-3: 0 4px 14px rgba(0,0,0,.4);
  --sh-4: 0 12px 34px rgba(0,0,0,.5);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--ease), color var(--ease);
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--brand-ring); }

/* ---------- Shell: barra superior + contenido ---------- */
#app-shell { display: block; min-height: 100vh; }

/* Barra de navegación superior (banda corporativa fija) */
#topnav {
  position: sticky; top: 0; z-index: 60;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--sh-2);
}
.tn-inner {
  max-width: var(--content-w); margin: 0 auto;
  display: flex; align-items: center; gap: 26px;
  padding: 0 24px; height: var(--tn-h);
}

/* Marca */
.tn-brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.tn-logo { color: var(--brand); font-size: 23px; line-height: 1; display: flex; }
.tn-logo img { height: 32px; width: auto; background: #fff; border-radius: var(--r-sm); padding: 3px 6px; display: block; }
.tn-brand-text strong { display: block; color: #fff; font-size: 12.5px; letter-spacing: 1.5px; font-weight: 700; line-height: 1.25; }
.tn-brand-text small { color: var(--nav-text); font-size: 10.5px; letter-spacing: .3px; }
.tn-brand::after {
  content: ''; width: 1px; height: 28px; background: rgba(255,255,255,.12); margin-left: 22px;
}

/* Pestañas */
.tn-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.tn-nav button {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; color: var(--nav-text);
  padding: 8px 13px; border-radius: var(--r-sm);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: var(--ease);
  position: relative;
}
.tn-nav button svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .8; }
.tn-nav button:hover { background: var(--nav-hover); color: #fff; }
.tn-nav button.active { background: var(--nav-act); color: #fff; font-weight: 650; }
.tn-nav button.active svg { opacity: 1; color: var(--brand); }
.tn-nav button.active::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: -11px;
  height: 2px; background: var(--brand); border-radius: 2px 2px 0 0;
}

/* Acciones de la derecha */
.tn-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-marks { display: flex; align-items: center; gap: 7px; }
.brand-mark { display: inline-flex; background: #fff; border-radius: 5px; padding: 3px 6px; }
.brand-mark img { height: 16px; width: auto; display: block; }

.user-area { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  color: #dde3d1; font-size: 12.5px; font-weight: 500;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-left: 12px; border-left: 1px solid rgba(255,255,255,.12);
}
.user-chip .ico { width: 16px; height: 16px; color: var(--nav-text); flex: 0 0 16px; }
.user-chip .user-nombre { overflow: hidden; text-overflow: ellipsis; }
.user-area .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; }
.user-area .btn-ghost:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); color: #fff; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid transparent; color: var(--text-2);
  cursor: pointer; transition: var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
/* Variante sobre la banda oscura */
.tn-icon { color: var(--nav-text); }
.tn-icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.only-mobile { display: none; }

.sb-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,20,10,.5); z-index: 55; }
.sb-backdrop.on { display: block; }

/* ---------- Layout de contenido ---------- */
main { max-width: var(--content-w); width: 100%; margin: 0 auto; padding: 18px 20px 36px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
.view-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 7px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--ease); font-family: inherit;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: var(--sh-2); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Paneles / tarjetas ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-1);
  padding: 16px 18px; margin-bottom: 14px;
}
.panel h2 {
  font-size: 15px; margin: 0 0 16px; font-weight: 650; color: var(--text);
  display: flex; align-items: center; gap: 9px; letter-spacing: -.1px;
}
.panel h2::before { content: ''; width: 3px; height: 15px; background: var(--brand); border-radius: 2px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- KPIs ---------- */
.kpi-seccion {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-3); margin: 4px 0 12px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px,1fr)); gap: 10px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 13px 15px;
  box-shadow: var(--sh-1); transition: var(--ease);
}
.kpi:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: var(--brand); }
/* KPI que lleva a otra vista */
.kpi-link { cursor: pointer; }
.kpi-link:hover { box-shadow: var(--sh-3); transform: translateY(-4px); }
.kpi-link:active { transform: translateY(-1px); }
.kpi-flecha {
  margin-left: auto; color: var(--brand); font-size: 15px; font-weight: 700;
  opacity: 0; transform: translateX(-5px); transition: var(--ease);
}
.kpi-link:hover .kpi-flecha { opacity: 1; transform: translateX(0); }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--brand); margin-bottom: 10px; }
.kpi-top svg { width: 17px; height: 17px; flex: 0 0 17px; }
.kpi-lbl { color: var(--text-2); font-size: 12px; font-weight: 650; letter-spacing: .2px; }
.kpi .num { font-size: 27px; font-weight: 750; color: var(--text); line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--text-2); font-size: 12px; margin-top: 6px; font-weight: 600; letter-spacing: .2px; }
.kpi-nota { color: var(--text-3); font-size: 11.5px; margin-top: 7px; }

/* Iconos dentro de títulos y botones */
.ico { width: 17px; height: 17px; flex: 0 0 17px; vertical-align: -3px; }
h1.con-ico, h2.con-ico { display: flex; align-items: center; gap: 9px; }
h1.con-ico .ico { width: 21px; height: 21px; flex: 0 0 21px; color: var(--brand); }
h2.con-ico .ico { color: var(--brand); }
.segmented button .ico { vertical-align: -4px; margin-right: 3px; }

/* ---------- Barras del dashboard ---------- */
.bar-row { display: grid; grid-template-columns: 160px 1fr 72px; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.bar-row .name { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.bar-track { background: var(--surface-3); border-radius: var(--r-full); height: 9px; overflow: hidden; }
.bar-fill { background: var(--brand); height: 100%; border-radius: var(--r-full); min-width: 4px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar-row .val { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
/* Barra dividida en dos categorías: cómputo (verde) e inventario general (azul) */
.bar-track { display: flex; }
.bar-fill.cat-computo { background: var(--brand); border-radius: 0; }
.bar-fill.cat-general { background: var(--cat-gen); border-radius: 0; }
.bar-fill.cat-tienda  { background: var(--cat-tie); border-radius: 0; }
.bar-track > :first-child { border-radius: var(--r-full) 0 0 var(--r-full); }
.bar-track > :last-child  { border-radius: 0 var(--r-full) var(--r-full) 0; }
.bar-track > :only-child  { border-radius: var(--r-full); }
.bar-row .val small { color: var(--text-3); font-weight: 600; font-size: 11px; margin-left: 5px; }

/* Leyenda de categorías */
.leyenda { display: flex; align-items: center; gap: 16px; margin: -6px 0 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.leyenda .lg-computo { background: var(--brand); }
.leyenda .lg-general { background: var(--cat-gen); }
.leyenda .lg-tienda  { background: var(--cat-tie); }

/* ---------- Inventario de tiendas: foto, cantidad y origen ---------- */
.col-foto { width: 58px; text-align: center; }
.foto-mini {
  width: 42px; height: 42px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: zoom-in; display: block; margin: 0 auto;
  transition: var(--ease);
}
.foto-mini:hover { border-color: var(--brand); transform: scale(1.06); }
.foto-vacia { color: var(--text-3); }
.foto-grande { text-align: center; }
.foto-grande img { max-width: 100%; max-height: 62vh; border-radius: var(--r); border: 1px solid var(--border); }

/* Campo de foto dentro del formulario */
.foto-campo { display: flex; gap: 14px; align-items: flex-start; }
.foto-slot {
  width: 122px; height: 122px; flex: 0 0 122px;
  border: 2px dashed var(--border); border-radius: var(--r); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden; text-align: center;
}
.foto-slot img { width: 100%; height: 100%; object-fit: cover; }
.foto-acciones { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* =========================================================================
   Logo con volumen 3D
   El contenedor da la perspectiva; la imagen se inclina dentro de ella.
   ========================================================================= */
.logo3d { perspective: 620px; display: inline-flex; }
.logo3d img {
  transform-style: preserve-3d;
  transition: transform .35s cubic-bezier(.22,.61,.36,1), filter .35s ease;
  will-change: transform;
}

/* Logo de la barra superior: se levanta apenas al pasar el mouse */
.tn-logo.logo3d img {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.28));
}
.tn-logo.logo3d:hover img {
  transform: rotateX(12deg) rotateY(-16deg) translateZ(14px) scale(1.04);
  filter: drop-shadow(-5px 7px 9px rgba(0,0,0,.42));
}

/* Logo del ingreso: se inclina siguiendo el mouse (lo mueve el JS) */
.login-logo.logo3d { perspective: 900px; }
.login-logo.logo3d img {
  filter: drop-shadow(0 6px 14px rgba(24,30,16,.18));
  transition: transform .12s ease-out, filter .3s ease;
}
.login-logo.logo3d.quieto img {
  transition: transform .6s cubic-bezier(.22,.61,.36,1), filter .3s ease;
}
/* Respiración lenta mientras nadie lo toca */
.login-logo.logo3d.quieto img { animation: flotar 6s ease-in-out infinite; }
.login-logo.logo3d:hover img { animation: none; }
@keyframes flotar {
  0%, 100% { transform: translateY(0) rotateX(0) rotateY(0); }
  50%      { transform: translateY(-7px) rotateX(4deg) rotateY(-4deg); }
}

/* El rombo de respaldo (cuando no hay logo cargado) también toma volumen */
.login-diamond.logo3d { perspective: 700px; display: block; }
.login-diamond.logo3d span {
  display: inline-block;
  transition: transform .12s ease-out;
  text-shadow: 0 6px 16px rgba(24,30,16,.28);
}

/* Quien pida menos movimiento, no lo tiene */
@media (prefers-reduced-motion: reduce) {
  .logo3d img, .logo3d span { animation: none !important; transition: none !important; transform: none !important; }
  .kpi, .bar-fill, .tie-fila, .foto-mini { transition: none !important; }
}

/* =========================================================================
   Presentación de marca al iniciar sesión
   El logo se arma girando en 3D sobre un piso con reflejo.
   ========================================================================= */
.intro {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: radial-gradient(900px 520px at 50% 38%, var(--surface), var(--bg) 70%);
  cursor: pointer;
  animation: introEntra .3s ease;
}
.intro.saliendo { animation: introSale .38s cubic-bezier(.4,0,1,1) forwards; }
@keyframes introEntra { from { opacity: 0; } }
@keyframes introSale  { to { opacity: 0; transform: scale(1.06); } }

/* Escena con perspectiva: el logo gira dentro de ella */
.intro-escena { perspective: 1000px; perspective-origin: 50% 45%; position: relative; }
.intro-logo {
  transform-style: preserve-3d; position: relative;
  /* Gira y aterriza (2.2s), y después queda respirando muy despacio. */
  animation: introGiro 2.2s cubic-bezier(.18,.75,.3,1) both,
             introRespira 3.4s 2.2s ease-in-out infinite;
}
.intro-logo img {
  display: block; max-height: 150px; max-width: 300px; width: auto;
  filter: drop-shadow(0 18px 30px rgba(24,30,16,.3));
}
@keyframes introGiro {
  0%   { transform: rotateY(-105deg) translateZ(-160px) scale(.66); opacity: 0; }
  45%  { opacity: 1; }
  72%  { transform: rotateY(16deg) translateZ(30px) scale(1.07); }
  88%  { transform: rotateY(-5deg) translateZ(8px) scale(.99); }
  100% { transform: rotateY(0) translateZ(0) scale(1); opacity: 1; }
}
@keyframes introRespira {
  0%, 100% { transform: translateY(0) rotateY(0); }
  50%      { transform: translateY(-8px) rotateY(3deg); }
}

/* Destello que barre el logo una vez aterrizado */
.intro-logo::after {
  content: ''; position: absolute; inset: -6% -18%;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.72) 50%, transparent 62%);
  transform: translateX(-130%);
  animation: introBrillo 1.1s 2.35s ease-out 1 both;
  pointer-events: none; mix-blend-mode: overlay;
}
@keyframes introBrillo {
  from { transform: translateX(-130%); }
  to   { transform: translateX(130%); }
}

/* Piso: sombra elíptica que se abre cuando el logo "aterriza" */
.intro-piso {
  width: 190px; height: 16px; margin: 22px auto 0;
  background: radial-gradient(ellipse at center, rgba(24,30,16,.26), transparent 72%);
  border-radius: 50%;
  animation: introPiso 2.2s cubic-bezier(.18,.75,.3,1) both,
             introPisoRespira 3.4s 2.2s ease-in-out infinite;
}
[data-theme="dark"] .intro-piso { background: radial-gradient(ellipse at center, rgba(0,0,0,.6), transparent 72%); }
@keyframes introPiso {
  0%   { transform: scaleX(.22); opacity: 0; }
  72%  { transform: scaleX(1.14); opacity: .85; }
  100% { transform: scaleX(1); opacity: 1; }
}
/* Al elevarse el logo, la sombra se encoge: refuerza la sensación de altura */
@keyframes introPisoRespira {
  0%, 100% { transform: scaleX(1);   opacity: 1; }
  50%      { transform: scaleX(.86); opacity: .7; }
}

.intro-texto { text-align: center; animation: introTexto .8s 1.35s ease both; }
.intro-texto strong {
  display: block; font-size: 19px; color: var(--text); font-weight: 700;
  letter-spacing: 5px; animation: introLetras 1.4s 1.35s cubic-bezier(.22,.61,.36,1) both;
}
.intro-texto small { display: block; color: var(--text-2); font-size: 12.5px; letter-spacing: 1.4px; margin-top: 5px; }
@keyframes introTexto { from { opacity: 0; transform: translateY(12px); } }
/* Las letras del nombre se van juntando hasta su posición final */
@keyframes introLetras { from { letter-spacing: 15px; opacity: .25; } }

.intro-saltar {
  position: absolute; bottom: 34px; left: 0; right: 0; text-align: center;
  color: var(--text-3); font-size: 11.5px; letter-spacing: .6px;
  animation: introTexto .6s 2.6s ease both;
}

@media (max-width: 620px) {
  .intro-logo img { max-height: 110px; max-width: 220px; }
  .intro-texto strong { font-size: 16px; letter-spacing: 3.5px; }
}

/* =========================================================================
   1) Transición al cambiar de vista
   ========================================================================= */
#view.entrando { animation: vistaEntra .3s cubic-bezier(.22,.61,.36,1) both; }
@keyframes vistaEntra { from { opacity: 0; transform: translateY(10px); } }

/* =========================================================================
   2) Esqueletos de carga
   ========================================================================= */
.sk {
  display: block; border-radius: 7px;
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%);
  background-size: 300% 100%;
  animation: skBrillo 1.25s ease-in-out infinite;
}
@keyframes skBrillo { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.sk-wrap { animation: vistaEntra .25s both; }
.sk-head { margin-bottom: 24px; }
.sk-titulo { width: 240px; height: 26px; margin-bottom: 10px; }
.sk-sub    { width: 340px; height: 14px; }
.sk-kpi { display: block; }
.sk-lbl { width: 62%; height: 12px; margin-bottom: 14px; }
.sk-num { width: 46%; height: 30px; }
.sk-tabla { padding: 10px 16px; }
.sk-fila {
  display: grid; grid-template-columns: 1.1fr 1fr 2fr .8fr; gap: 16px;
  padding: 13px 0; border-bottom: 1px solid var(--border-soft);
  animation: skFila .4s both;
}
.sk-fila:last-child { border-bottom: none; }
@keyframes skFila { from { opacity: 0; transform: translateY(6px); } }
.sk-fila .sk { height: 13px; }
.sk-c2 { width: 78%; } .sk-c3 { width: 62%; } .sk-c4 { width: 52%; }

/* Esqueleto del anillo y de las barras del dashboard */
/* Piezas del esqueleto del dashboard: imitan la forma de lo que va a llegar */
.sk-cifra { height: 52px; width: 58%; margin: 6px 0; border-radius: var(--r-sm); }
.sk-grafico { height: 190px; margin-top: 14px; border-radius: var(--r-sm); }
.sk-barra-ap { height: 30px; margin: 16px 0 14px; border-radius: var(--r-sm); }
.sk-fila-at { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.sk-cuadro { width: 34px; height: 30px; flex: 0 0 34px; border-radius: var(--r-sm); }
.sk-fila-at .sk-linea { flex: 1; }
.sk-lineas { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.sk-linea { height: 13px; width: 84%; }
.sk-lineas .sk-linea:nth-child(2) { width: 68%; }
.sk-lineas .sk-linea:nth-child(3) { width: 54%; }
.sk-barra { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; margin: 13px 0; animation: skFila .4s both; }
.sk-b1 { height: 12px; } .sk-b2 { height: 9px; border-radius: var(--r-full); }
/* Esqueleto de la lista de tiendas */
.sk-fila-tienda { display: grid; grid-template-columns: 1fr 26px; gap: 10px; align-items: center; padding: 9px 10px; animation: skFila .4s both; }
.sk-t1 { height: 12px; } .sk-t2 { height: 14px; border-radius: var(--r-full); }

/* =========================================================================
   3) Tablas: encabezado fijo, filas alternadas e íconos de tipo
   ========================================================================= */
.table-wrap { max-height: calc(100vh - 300px); overflow: auto; }
.tabla-datos thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--border);
}
.tabla-datos tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-3) 42%, transparent); }
.tabla-datos tbody tr:hover { background: var(--brand-soft); }
.celda-tipo { white-space: nowrap; }
.celda-tipo .tipo-ico {
  display: inline-flex; vertical-align: -4px; margin-right: 7px; color: var(--text-3);
}
.celda-tipo .tipo-ico svg { width: 15px; height: 15px; }
.celda-tipo .trunc { display: inline; }
tbody tr:hover .tipo-ico { color: var(--brand); }

/* =========================================================================
   4) Estados vacíos ilustrados
   ========================================================================= */
.vacio-art { width: 168px; height: 126px; display: block; margin: 0 auto 6px; overflow: visible; }
.vacio-art .v-sombra { fill: var(--border); opacity: .55; }
.vacio-art .v-cuerpo { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2.4; }
.vacio-art .v-tapa   { fill: var(--surface); stroke: var(--brand); stroke-width: 2.4; }
.vacio-art .v-cinta  { fill: var(--brand); opacity: .22; }
.vacio-art .v-mango  { stroke: var(--brand); stroke-width: 6; stroke-linecap: round; fill: none; }
.vacio-art .v-chispas { stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round; opacity: .5; fill: none; }
.empty-txt { color: var(--text-2); font-size: 14px; margin-top: 8px; }

/* =========================================================================
   5) (libre) — el gráfico de anillo se retiró del dashboard.
   El reparto ahora va en una barra apilada (ver .apilada): ocupa menos y
   compara mejor los valores cercanos.
   ========================================================================= */

/* =========================================================================
   7) Onda al presionar
   ========================================================================= */
.onda {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .28; transform: scale(0);
  animation: ondaExpande .6s cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes ondaExpande { to { transform: scale(1); opacity: 0; } }

/* =========================================================================
   8) Densidad compacta
   ========================================================================= */
[data-densidad="compacta"] .tabla-datos td,
[data-densidad="compacta"] .tabla-datos th { padding-top: 5px; padding-bottom: 5px; font-size: 12.5px; }
[data-densidad="compacta"] .foto-mini { width: 30px; height: 30px; }
/* Nota: aquí no se toca el 'padding' de .kpi — es la única propiedad que no
   responde al cambio de densidad. Se compacta con el resto de medidas. */
[data-densidad="compacta"] .kpi-grid { gap: 11px; margin-bottom: 18px; }
[data-densidad="compacta"] .kpi .num { font-size: 25px; }
[data-densidad="compacta"] .kpi-top { margin-bottom: 6px; }
[data-densidad="compacta"] .kpi-nota { margin-top: 4px; }
[data-densidad="compacta"] .panel { padding: 16px; margin-bottom: 14px; }
[data-densidad="compacta"] main { padding-top: 18px; }
[data-densidad="compacta"] .bar-row { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  #view.entrando, .sk, .sk-wrap, .sk-fila, .onda { animation: none !important; }
}

/* =========================================================================
   Selector de módulo (Inventario / Calendario)
   ========================================================================= */
.modulo { position: relative; }
.modulo-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16);
  color: #fff; border-radius: var(--r-sm); padding: 7px 12px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: var(--ease); white-space: nowrap;
}
.modulo-btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); }
.modulo-caret { color: var(--nav-text); font-size: 11px; }
.modulo-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 120;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: 7px; min-width: 268px;
}
.modulo-menu[hidden] { display: none; }
.modulo-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 10px 12px;
  border-radius: var(--r-sm); font-family: inherit; color: var(--text); transition: var(--ease);
}
.modulo-menu button:hover { background: var(--brand-soft); }
.modulo-menu button svg { width: 19px; height: 19px; flex: 0 0 19px; color: var(--brand); }
.modulo-menu button strong { display: block; font-size: 13.5px; font-weight: 650; }
.modulo-menu button small { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }

/* =========================================================================
   Calendario
   ========================================================================= */
.cal-panel { padding-bottom: 14px; }
.cal-barra { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-titulo { margin: 0 0 0 10px; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.cal-titulo::before { content: none; }
.cal-titulo span { color: var(--text-3); font-weight: 500; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow {
  text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-3); padding: 6px 0 10px;
}
.cal-dow.finde { color: var(--brand); }
.cal-dia {
  min-height: 92px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); padding: 7px 9px; cursor: pointer;
  transition: var(--ease); position: relative; overflow: hidden;
}
.cal-dia:hover { border-color: var(--brand); background: var(--brand-soft); }
.cal-dia:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-dia.finde { background: var(--surface-2); }
.cal-dia.fuera { background: transparent; border-color: transparent; cursor: default; }
.cal-dia.fuera .cal-num { color: var(--text-3); opacity: .45; }
.cal-dia.fuera:hover { background: transparent; border-color: transparent; }
.cal-num { font-size: 13.5px; font-weight: 650; color: var(--text-2); }
.cal-dia.hoy { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-dia.hoy .cal-num {
  background: var(--brand); color: #fff; border-radius: 50%;
  width: 25px; height: 25px; display: inline-flex; align-items: center; justify-content: center;
}
.cal-dia.sel { background: var(--brand-soft); border-color: var(--brand); }
.cal-dia.sel .cal-num { color: var(--brand); }
.cal-eventos { margin-top: 5px; display: flex; flex-direction: column; gap: 3px; }

@media (max-width: 860px) {
  .cal-dia { min-height: 62px; padding: 5px 6px; }
  .cal-grid { gap: 4px; }
  .cal-num { font-size: 12px; }
  .modulo-menu { min-width: 232px; }
}
@media (max-width: 620px) {
  .modulo-btn span:not(.modulo-caret) { display: none; }
  .modulo-btn { padding: 7px 9px; }
}

/* =========================================================================
   Semáforo de las notas
   verde = con tiempo · naranja = 1 a 3 días · rojo = hoy · vino = vencida
   ========================================================================= */
:root {
  --u-lejos:   #17924b;  --u-lejos-bg:   #e5f6ec;
  --u-pronto:  #e08a1e;  --u-pronto-bg:  #fdf1de;
  --u-hoy:     #d93a3a;  --u-hoy-bg:     #fbe9e9;
  --u-vencida: #8e2020;  --u-vencida-bg: #f3dede;
  --u-lista:   #8b9481;  --u-lista-bg:   #eef0ea;
}
[data-theme="dark"] {
  --u-lejos:   #3fbd72;  --u-lejos-bg:   #14301f;
  --u-pronto:  #e8a542;  --u-pronto-bg:  #33260f;
  --u-hoy:     #f06a6a;  --u-hoy-bg:     #351a1a;
  --u-vencida: #d95555;  --u-vencida-bg: #3d1717;
  --u-lista:   #7c8573;  --u-lista-bg:   #23281d;
}
.u-lejos   { --u: var(--u-lejos);   --u-bg: var(--u-lejos-bg); }
.u-pronto  { --u: var(--u-pronto);  --u-bg: var(--u-pronto-bg); }
.u-hoy     { --u: var(--u-hoy);     --u-bg: var(--u-hoy-bg); }
.u-vencida { --u: var(--u-vencida); --u-bg: var(--u-vencida-bg); }
.u-lista   { --u: var(--u-lista);   --u-bg: var(--u-lista-bg); }

.plazo-punto {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--u, var(--text-3)); margin-right: 6px; vertical-align: 0;
}

/* ---------- Notas dentro de las celdas del calendario ---------- */
.cal-dia.con-notas { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.cal-add {
  position: absolute; top: 5px; right: 5px; width: 21px; height: 21px;
  border: none; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transform: scale(.6); transition: var(--ease);
}
.cal-dia:hover .cal-add, .cal-dia:focus-within .cal-add { opacity: 1; transform: scale(1); }
.cal-add:hover { background: var(--brand-hover); transform: scale(1.14); }
.cal-chip {
  display: block; font-size: 10.5px; font-weight: 600; line-height: 1.3;
  padding: 3px 6px; border-radius: 5px;
  background: var(--u-bg); color: var(--u);
  border-left: 3px solid var(--u);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: chipEntra .35s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes chipEntra { from { opacity: 0; transform: translateX(-6px); } }
.cal-chip.hecha { opacity: .55; text-decoration: line-through; }
.chip-glob {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; margin-right: 4px; vertical-align: 1px;
}
.cal-mas { display: block; font-size: 10px; color: var(--text-3); margin-top: 2px; padding-left: 3px; }
/* Las de hoy y las vencidas laten para que se noten */
.cal-dia .cal-chip.u-hoy, .cal-dia .cal-chip.u-vencida { animation: chipEntra .35s both, latir 2.4s 1s ease-in-out infinite; }
@keyframes latir { 0%,100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--u) 22%, transparent); } }

/* ---------- Panel del día: tarjetas de nota ---------- */
.cal-detalle-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.nota-lista { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.nota {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-1);
  transition: var(--ease);
  animation: notaEntra .4s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes notaEntra { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.nota:hover { box-shadow: var(--sh-2); transform: translateX(3px); border-color: var(--u); }
.nota-borde { width: 5px; flex: 0 0 5px; background: var(--u); }
.nota-cuerpo { flex: 1; min-width: 0; padding: 13px 16px; }
.nota-top { display: flex; align-items: center; gap: 10px; }
.nota-top h3 { margin: 0; font-size: 14.5px; font-weight: 650; flex: 1; min-width: 0; }
.nota-check input { width: 17px; height: 17px; accent-color: var(--u); cursor: pointer; }
.nota-plazo {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-full);
  background: var(--u-bg); color: var(--u); white-space: nowrap;
}
.nota.hecha .nota-top h3 { text-decoration: line-through; color: var(--text-3); }
.nota.hecha { opacity: .72; }
.nota-detalle { margin: 8px 0 0; color: var(--text-2); font-size: 13px; white-space: pre-wrap; }
.nota-pie { display: flex; align-items: center; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.nota-modo { font-size: 11px; font-weight: 650; padding: 2px 9px; border-radius: var(--r-full); }
.nota-modo.compartida { background: var(--info-bg); color: var(--info); }
.nota-modo.privada { background: var(--surface-3); color: var(--text-2); }
.nota-autor { font-size: 11.5px; color: var(--text-3); }
.nota-acciones { margin-left: auto; display: flex; gap: 6px; opacity: .35; transition: var(--ease); }
.nota:hover .nota-acciones, .nota:focus-within .nota-acciones { opacity: 1; }

/* ---------- Responsable, foto y fecha en la tarjeta ---------- */
.nota-medio { display: flex; gap: 13px; align-items: flex-start; }
.nota-medio:empty { display: none; }
.nota-foto {
  width: 74px; height: 74px; object-fit: cover; border-radius: var(--r-sm);
  border: 1px solid var(--border); cursor: zoom-in; flex: 0 0 74px;
  margin-top: 8px; transition: var(--ease);
}
.nota-foto:hover { border-color: var(--u); transform: scale(1.05); }
.nota-medio .nota-detalle { flex: 1; min-width: 0; }
.nota-fecha { font-size: 11.5px; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.nota-resp {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 650; padding: 2px 9px 2px 3px;
  border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2);
}
.nota-resp i {
  width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; font-style: normal;
}
.nota-resp.para-mi { background: var(--brand-soft); color: var(--brand); }
.nota-resp.sin { padding: 2px 9px; color: var(--text-3); background: transparent; border: 1px dashed var(--border); }

/* ---------- Vista de agenda ---------- */
.ag-barra { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.ag-barra select { min-width: 170px; }
.ag-titulo {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-3); margin: 22px 0 10px;
}
.ag-titulo.u-vencida { color: var(--u); }
.ag-dia {
  border-left: 3px solid var(--u); padding-left: 15px; margin-bottom: 20px;
  animation: notaEntra .35s both;
}
.ag-cabecera { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ag-cabecera strong { font-size: 14px; }
.ag-plazo {
  font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: var(--r-full);
  background: var(--u-bg); color: var(--u);
}
.ag-cabecera .btn { margin-left: auto; opacity: .4; transition: var(--ease); }
.ag-dia:hover .ag-cabecera .btn { opacity: 1; }

@media (max-width: 620px) {
  .nota-medio { flex-direction: column; }
  .nota-foto { width: 100%; height: 130px; flex: none; }
}

/* ---------- Elegir quién ve la nota ---------- */
.modo-notas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modo-op {
  border: 2px solid var(--border); border-radius: var(--r); padding: 12px 14px;
  cursor: pointer; transition: var(--ease); background: var(--surface);
}
.modo-op:hover { border-color: var(--brand); }
.modo-op.on { border-color: var(--brand); background: var(--brand-soft); }
.modo-op input { position: absolute; opacity: 0; pointer-events: none; }
.modo-op strong { display: block; font-size: 13px; }
.modo-op.on strong { color: var(--brand); }
.modo-op small { display: block; color: var(--text-3); font-size: 11px; margin-top: 3px; line-height: 1.35; }
.rea-rapidos { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 620px) { .modo-notas { grid-template-columns: 1fr; } }

/* ---------- Campana de notificaciones ---------- */
.notif { position: relative; }
.notif-badge {
  position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: var(--r-full);
  background: var(--u-pronto); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--nav-bg-2);
  animation: badgePop .3s cubic-bezier(.34,1.56,.64,1) both;
}
.notif-badge.roja { background: var(--u-hoy); }
@keyframes badgePop { from { transform: scale(0); } }
#notif-btn.suena svg { animation: campana 2.6s ease-in-out infinite; transform-origin: 50% 3px; }
@keyframes campana {
  0%, 82%, 100% { transform: rotate(0); }
  86% { transform: rotate(13deg); } 90% { transform: rotate(-11deg); }
  94% { transform: rotate(7deg); }  97% { transform: rotate(-4deg); }
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 130;
  width: 336px; max-height: min(70vh, 480px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-3); padding: 7px;
  animation: pop .2s cubic-bezier(.4,0,.2,1);
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 10px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 5px; }
.notif-grupo {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--u); padding: 11px 10px 5px;
}
.notif-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-left: 3px solid var(--u); border-radius: 0 7px 7px 0;
  padding: 8px 11px; margin-bottom: 3px; cursor: pointer;
  font-family: inherit; transition: var(--ease);
  animation: chipEntra .3s both;
}
.notif-item:hover { background: var(--u-bg); }
.notif-t { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.notif-m { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }

@media (max-width: 620px) {
  .notif-panel { width: calc(100vw - 24px); right: -70px; }
}
@media (prefers-reduced-motion: reduce) {
  .cal-chip, .nota, .notif-item, .notif-badge, #notif-btn.suena svg { animation: none !important; }
}

/* =========================================================================
   Dashboard organizado por preguntas
   ========================================================================= */
.dash-bloque { margin: 24px 0 12px; }
.dash-bloque:first-child { margin-top: 4px; }
.dash-preg {
  font-size: 16px; font-weight: 700; color: var(--text); margin: 0;
  letter-spacing: -.3px; display: flex; align-items: center; gap: 10px;
}
.dash-preg::before {
  content: ''; width: 4px; height: 20px; background: var(--brand);
  border-radius: 2px; flex: 0 0 4px;
}
.dash-acl { margin: 7px 0 0 14px; color: var(--text-2); font-size: 13px; line-height: 1.5; }

/* ---------- Encabezado: una cifra principal y el reparto al lado ----------
   El color va en el borde superior de cada ficha y en su barra de proporción,
   no en fondos tintados: tiñe lo justo para que el bloque tenga peso sin que
   la pantalla se vuelva un semáforo.                                        */
.dash-cabeza {
  display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 12px;
  align-items: stretch; margin-bottom: 12px;
}
.cifra {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  border-left: 3px solid var(--brand);
  padding: 16px 18px; display: flex; flex-direction: column; justify-content: center;
}
.cifra-lbl { font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: .2px; }
/* Cifras proporcionales, no tabulares: a este tamaño, tabular-nums deja huecos. */
.cifra-num {
  display: block; font-size: 54px; line-height: 1; font-weight: 700;
  color: var(--text); letter-spacing: -2.4px; margin: 2px 0 5px;
}
.cifra-pie { font-size: 11px; color: var(--text-3); line-height: 1.45; }
.cifra-extra {
  display: flex; flex-direction: column; gap: 3px; margin-top: 12px;
  padding-top: 11px; border-top: 1px solid var(--border-soft);
  font-size: 11px; color: var(--text-3); line-height: 1.4;
}
.cifra-extra b { color: var(--text-2); font-weight: 700; font-variant-numeric: tabular-nums; }

.cifra-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 10px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  border-top: 3px solid var(--border);
  padding: 12px 14px 13px; display: flex; flex-direction: column; gap: 3px;
  transition: var(--ease);
}
.tile.cat-computo { border-top-color: var(--dv-1); }
.tile.cat-general { border-top-color: var(--dv-2); }
.tile.cat-tienda  { border-top-color: var(--dv-3); }
.tile.cat-stock   { border-top-color: var(--dv-4); }
.tile-link { cursor: pointer; }
.tile-link:hover { border-color: var(--text-3); background: var(--surface-2); }
.tile-link:hover.cat-computo { border-top-color: var(--dv-1); }
.tile-link:hover.cat-general { border-top-color: var(--dv-2); }
.tile-link:hover.cat-tienda  { border-top-color: var(--dv-3); }
.tile-link:hover.cat-stock   { border-top-color: var(--dv-4); }
.tile-lbl { font-size: 11px; font-weight: 600; color: var(--text-2); line-height: 1.3; }
.tile-fila { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.tile-num { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -1px; line-height: 1.1; }
.tile-pct { font-size: 11.5px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* Barra de proporción: el mismo color de la serie, en su versión de relleno */
.tile-barra { display: block; height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin: 3px 0 1px; }
.tile-barra i { display: block; height: 100%; border-radius: 2px; background: var(--text-3); }
.tile.cat-computo .tile-barra i { background: var(--dv-1); }
.tile.cat-general .tile-barra i { background: var(--dv-2); }
.tile.cat-tienda  .tile-barra i { background: var(--dv-3); }
.tile.cat-stock   .tile-barra i { background: var(--dv-4); }
.tile-nota { font-size: 10px; color: var(--text-3); line-height: 1.4; }

/* Punto de color de cada serie: mismo orden fijo en todo el dashboard */
i.cat-computo, .ap-tramo.cat-computo { background: var(--dv-1); }
i.cat-general, .ap-tramo.cat-general { background: var(--dv-2); }
i.cat-tienda,  .ap-tramo.cat-tienda  { background: var(--dv-3); }
i.cat-stock,   .ap-tramo.cat-stock   { background: var(--dv-4); }

.dash-dos { display: grid; grid-template-columns: 1fr 1.25fr; gap: 14px; margin-bottom: 14px; align-items: start; }
.dash-dos-inv { grid-template-columns: 1fr 1fr; }
.panel-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.panel-cab h2 { margin: 0; }
.panel-cab .hint { margin: 3px 0 0; }
.panel-dato { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.panel-dato strong { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -.6px; line-height: 1.1; }
.panel-dato small { font-size: 10.5px; color: var(--text-3); }
.delta-sube { font-size: 11.5px; font-weight: 700; color: var(--ok); }
.delta-baja { font-size: 11.5px; font-weight: 700; color: var(--warn); }
.delta-igual { font-size: 11.5px; font-weight: 600; color: var(--text-3); }

/* ---------- Gráfico de actividad ---------- */
.g-area { position: relative; margin-top: 12px; }
/* height:auto y sin preserveAspectRatio: el SVG escala en proporción. Si se
   estira solo a lo ancho, los puntos del trazo salen como óvalos. */
.g-area svg { width: 100%; height: auto; display: block; overflow: visible; }
/* La hoja trae una regla global `svg { stroke: currentColor; stroke-width: 1.8 }`
   para los iconos del menú. Dentro de un gráfico eso dibuja el contorno de cada
   figura: hay que apagarla y que cada marca declare el suyo. */
.g-area svg * { stroke: none; fill: none; }
.g-area .g-rejilla { stroke: var(--dv-rejilla); stroke-width: 1; vector-effect: non-scaling-stroke; }
.g-area .g-tick { fill: var(--text-3); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.g-area .g-tick-act { fill: var(--text-2); font-weight: 700; }
/* Columnas: el periodo en curso y el pico llevan el color pleno; el resto, un
   paso más suave, para que el ojo vaya primero a lo que importa. */
.g-area .g-col { fill: var(--dv-1); opacity: .42; transition: opacity var(--ease); }
.g-area .g-col-act { opacity: 1; }
.g-area .g-col-max { opacity: .75; }
.g-area .g-col-cero { fill: var(--border); opacity: 1; }
.g-area .g-valor { fill: var(--text); font-size: 12.5px; font-weight: 700; }
.g-area .g-valor-max { fill: var(--text-2); font-size: 11.5px; }
.g-area .g-zona { fill: transparent; cursor: pointer; outline: none; }
.g-area .g-zona-on { fill: var(--text); opacity: .045; }
.g-globo {
  position: absolute; transform: translate(-50%, -138%); pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  box-shadow: var(--sh-3); padding: 7px 11px; font-size: 12px; color: var(--text-2);
  white-space: nowrap; line-height: 1.45;
}
.g-globo[hidden] { display: none; }
.g-globo strong { color: var(--text); font-size: 14px; }
.g-globo span { display: block; color: var(--text-3); font-size: 10.5px; text-transform: capitalize; }

/* ---------- Barra apilada: el reparto sobre el total ---------- */
.apilada { margin-top: 14px; }
/* La separación entre tramos la da un hueco del color del fondo, no un borde */
.ap-barra { display: flex; gap: 2px; height: 30px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-3); }
.ap-tramo { min-width: 3px; transition: var(--ease); }
.ap-tramo:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.ap-tramo:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.ap-leyenda { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.ap-leyenda li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; font-size: 13px; border-bottom: 1px solid var(--border-soft); }
.ap-leyenda li:last-child { border-bottom: none; }
.ap-leyenda i { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 10px; }
.ap-nom { flex: 1; color: var(--text-2); }
.ap-leyenda b { color: var(--text); font-variant-numeric: tabular-nums; }
.ap-leyenda small { color: var(--text-3); font-size: 11px; width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Requiere atención ---------- */
.panel-atencion .atencion { list-style: none; margin: 12px 0 0; padding: 0; }
.atencion li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border-soft); }
.atencion li:last-child { border-bottom: none; }
.at-num {
  flex: 0 0 34px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text); border-radius: var(--r-sm);
  font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
}
.at-grave .at-num { background: var(--danger-bg); color: var(--danger); }
.at-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.at-txt strong { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.at-txt small { font-size: 11px; color: var(--text-3); }
.at-ok { margin: 12px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.panel-limpio { border-left: 3px solid var(--ok); }

/* ---------- Últimos movimientos ----------
   Dos líneas por fila, no tres: con ocho filas la diferencia es media pantalla. */
.feed { list-style: none; margin: 12px 0 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--border-soft); }
.feed li:last-child { border-bottom: none; }
.feed-ico { flex: 0 0 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); border-radius: var(--r-sm); }
.feed-ico svg { width: 12px; height: 12px; stroke: var(--text-2); fill: none; stroke-width: 2; }
.feed-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.feed-l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.feed-l1 strong { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.feed-eq { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-txt small { font-size: 10.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed time { flex: 0 0 auto; font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

@media (max-width: 1100px) {
  .dash-cabeza, .dash-dos, .dash-dos-inv { grid-template-columns: 1fr; }
}

/* El filtro de categoría. A propósito NO se parece a las pestañas de arriba:
   fondo tenue, sin iconos, con etiqueta delante que dice qué hace. */
.dash-filtro {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 11px 15px; margin-bottom: 18px;
  transition: var(--ease);
}
.dash-filtro.activo { border-color: var(--brand); background: var(--brand-soft); }
.dash-filtro-lbl { font-size: 12.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.filtro-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro-ops button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  border-radius: var(--r-full); padding: 5px 14px;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: var(--ease);
}
.filtro-ops button:hover { border-color: var(--brand); color: var(--brand); }
.filtro-ops button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.dash-filtro-aviso {
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-left: auto; font-size: 12.5px; color: var(--brand);
  animation: notaEntra .3s both;
}

@media (max-width: 760px) {
  .dash-filtro-aviso { margin-left: 0; width: 100%; }
  .dash-preg { font-size: 17px; }
}

/* ---------- Campo que el sistema llena solo (consecutivo) ---------- */
.campo-auto {
  background: var(--surface-3) !important; color: var(--text-2) !important;
  font-family: 'Cascadia Mono', Consolas, monospace; letter-spacing: .5px; cursor: default;
}

/* ---------- Identificador repetido ---------- */
.campo-duplicado {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 18%, transparent) !important;
}
.dup-aviso {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--danger-bg); border: 1px solid var(--danger);
  border-radius: var(--r); padding: 11px 14px; margin-bottom: 16px;
  animation: notaEntra .25s both;
}
.dup-aviso strong { color: var(--danger); font-size: 13px; }
.dup-aviso span { color: var(--text-2); font-size: 12.5px; flex: 1; min-width: 180px; }

/* =========================================================================
   Avisos por Telegram
   ========================================================================= */
.tg-pasos { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-sm); padding: 13px 16px; margin: 12px 0 16px; }
.tg-pasos p { margin: 0 0 8px; font-size: 13px; color: var(--text-2); }
.tg-pasos ol { margin: 0; padding-left: 20px; }
.tg-pasos li { font-size: 13px; color: var(--text-2); margin: 5px 0; }
.tg-pasos code, .tg-ok code {
  background: var(--surface-3); padding: 1px 6px; border-radius: 5px;
  font-family: Consolas, monospace; font-size: 12px;
}
.tg-ok { color: var(--ok); font-size: 13px; font-weight: 600; margin: -6px 0 4px; }
.tg-ok-caja {
  background: var(--ok-bg); color: var(--ok); border-radius: var(--r-sm);
  padding: 11px 14px; margin-top: 13px; font-size: 13px; font-weight: 600;
  animation: notaEntra .3s both;
}
.tg-err-caja {
  background: var(--danger-bg); color: var(--danger); border-radius: var(--r-sm);
  padding: 11px 14px; margin-top: 13px; font-size: 13px; line-height: 1.45;
  animation: notaEntra .3s both;
}
.tg-vinculado { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.tg-check {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: var(--ok); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 17px; font-weight: 700;
}
.tg-vinculado strong { display: block; font-size: 13.5px; }
.tg-vinculado small { color: var(--text-3); font-size: 12px; }
.tg-guia { margin-top: 16px; }
.tg-guia p { margin: 0 0 8px; font-size: 13px; }
.tg-codigo {
  display: inline-block; font-family: Consolas, monospace; font-size: 23px;
  font-weight: 700; letter-spacing: 3px; color: var(--brand);
  background: var(--brand-soft); border: 2px dashed var(--brand);
  border-radius: var(--r); padding: 11px 22px; cursor: copy;
  transition: var(--ease);
}
.tg-codigo:hover { background: var(--surface); transform: scale(1.02); }
.tg-horario { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.tg-horario .chk-linea { margin-bottom: 9px; }

/* Varias alarmas al día */
.horas-lista { display: flex; flex-wrap: wrap; gap: 10px; }
.hora-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-soft); border: 1px solid var(--brand-ring);
  border-radius: var(--r-sm); padding: 4px 4px 4px 10px;
  animation: notaEntra .25s both;
}
.hora-chip input[type=time] {
  border: none; background: transparent; color: var(--brand);
  font-weight: 700; font-size: 14px; padding: 2px 0; width: 88px;
  font-variant-numeric: tabular-nums;
}
.hora-chip input[type=time]:focus { outline: none; }
.hora-quitar {
  border: none; background: transparent; color: var(--text-3);
  cursor: pointer; font-size: 13px; line-height: 1;
  width: 22px; height: 22px; border-radius: 50%; transition: var(--ease);
}
.hora-quitar:hover { background: var(--danger); color: #fff; }

@media (max-width: 620px) { .tg-horario { align-items: stretch; } }

/* Categoría fija al crear: se muestra, no se elige */
.cat-fija {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid var(--brand-ring); border-radius: var(--r-sm);
  padding: 9px 14px; font-size: 13.5px;
}
.cat-fija .ico { color: var(--brand); }

/* Vista por tienda: panel lateral con todas las tiendas + detalle */
.tie-layout { display: grid; grid-template-columns: 268px 1fr; gap: 18px; align-items: start; }
.tie-side {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--sh-1); overflow: hidden; position: sticky; top: calc(var(--tn-h) + 16px);
}
.tie-side-head { padding: 13px 14px 11px; border-bottom: 1px solid var(--border-soft); }
.tie-side-head strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-3); margin-bottom: 9px; }
.tie-side-head input { width: 100%; padding: 7px 10px; font-size: 13px; }
.tie-lista { max-height: calc(100vh - var(--tn-h) - 150px); overflow-y: auto; padding: 7px; }
.tie-fila {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 8px 10px; border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; color: var(--text);
  transition: var(--ease);
}
.tie-fila:hover { background: var(--surface-3); }
.tie-fila.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.tie-fila.es-sub { padding-left: 20px; font-size: 12.5px; }
.tie-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tie-num {
  flex: 0 0 auto; min-width: 24px; text-align: center;
  background: var(--surface-3); color: var(--text-2);
  border-radius: var(--r-full); padding: 1px 7px; font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tie-fila.on .tie-num { background: var(--brand); color: #fff; }
.tie-num.cero { opacity: .45; }
.tie-todas { font-weight: 650; border-bottom: 1px solid var(--border-soft); border-radius: var(--r-sm) var(--r-sm) 0 0; margin-bottom: 5px; }
.tie-main { min-width: 0; }

@media (max-width: 900px) {
  .tie-layout { grid-template-columns: 1fr; }
  .tie-side { position: static; }
  .tie-lista { max-height: 232px; }
}

.col-cant { width: 62px; text-align: center; }
.cant-badge {
  display: inline-block; min-width: 26px; padding: 2px 8px; border-radius: var(--r-full);
  background: var(--cat-tie); color: #fff; font-weight: 700; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.cant-uno { color: var(--text-3); font-variant-numeric: tabular-nums; }

.cat-badge {
  display: inline-block; padding: 2px 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 650; white-space: nowrap;
}
.cat-b-computo { background: var(--brand-soft); color: var(--brand); }
.cat-b-general { background: var(--info-bg);    color: var(--cat-gen); }
.cat-b-tienda  { background: var(--warn-bg);    color: var(--cat-tie-2); }
[data-theme="dark"] .cat-b-tienda { color: var(--cat-tie); }

@media (max-width: 860px) {
  .foto-campo { flex-direction: column; }
}

/* ---------- Control segmentado ---------- */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 4px; gap: 3px; margin-bottom: 18px; }
.segmented button {
  border: none; background: transparent; padding: 8px 18px; border-radius: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--surface); color: var(--brand); box-shadow: var(--sh-1); }

/* ---------- Campos e inputs ---------- */
.toolbar { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar select,
.field input, .field select, .field textarea, .ms-btn,
.inv-picker input[type=search] {
  font-family: inherit; font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); transition: var(--ease);
}
.toolbar input[type=search] { min-width: 220px; }
.toolbar input:hover, .toolbar select:hover, .field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text-3); }
.toolbar input:focus, .toolbar select:focus,
.field input:focus, .field select:focus, .field textarea:focus, .ms-btn:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.field input::placeholder, .toolbar input::placeholder, textarea::placeholder { color: var(--text-3); }
.spacer { flex: 1; }

/* ---------- Tablas ---------- */
.table-wrap {
  background: var(--surface); border-radius: var(--r);
  border: 1px solid var(--border); box-shadow: var(--sh-1); overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface-2); text-align: left; padding: 8px 12px;
  font-weight: 650; color: var(--text-2); font-size: 11.5px;
  letter-spacing: .5px; text-transform: uppercase;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; color: var(--text-2); }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell .btn { margin-left: 4px; }
.actions-cell .btn .ico { width: 14px; height: 14px; }

/* ---------- Tabla de datos: densa, ordenable y con acciones fijas ---------- */
.tabla-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; color: var(--text-2); font-size: 13px;
}
.tabla-meta strong { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

.tabla-datos tbody td { padding: 7px 11px; }          /* filas más compactas */
.tabla-datos thead th { padding: 7px 11px; }
.tabla-datos .trunc {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tabla-datos .trunc.mono { max-width: 150px; }

/* Encabezados ordenables */
th.sortable { cursor: pointer; user-select: none; transition: var(--ease); }
th.sortable:hover { color: var(--brand); background: var(--brand-soft); }
th.sortable.sorted { color: var(--brand); }
.sort-ico { display: inline-block; width: 12px; margin-left: 4px; font-size: 11px; opacity: .9; }
th.sortable:not(.sorted):hover .sort-ico::after { content: '↕'; opacity: .5; }

/* Columna de acciones siempre visible */
.tabla-datos .col-acciones {
  position: sticky; right: 0; z-index: 1;
  background: var(--surface);
  box-shadow: -6px 0 8px -6px rgba(24,30,16,.18);
}
.tabla-datos thead .col-acciones { background: var(--surface-2); z-index: 3; }
.tabla-datos tbody tr:hover .col-acciones { background: var(--surface-2); }
[data-theme="dark"] .tabla-datos .col-acciones { box-shadow: -6px 0 8px -6px rgba(0,0,0,.5); }

.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty .big { font-size: 44px; opacity: .35; margin-bottom: 10px; }

/* ---------- Jerarquía de áreas (sub-áreas) ---------- */
.sub-area { padding-left: 30px !important; color: var(--text-2); }
.sub-guia { color: var(--text-3); margin-right: 7px; font-size: 12px; }
.ms-item.es-sub { padding-left: 26px; }
.ms-item.es-sub::before { content: '└'; color: var(--text-3); margin-right: 2px; font-size: 11px; }

/* ---------- Badges de estado ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 650; letter-spacing: .2px; }
.badge-activo   { background: var(--ok-bg);     color: var(--ok); }
.badge-inactivo { background: var(--surface-3); color: var(--text-2); }
.badge-mant     { background: var(--warn-bg);   color: var(--warn); }
.badge-baja     { background: var(--danger-bg); color: var(--danger); }
.badge-asignado { background: var(--info-bg);   color: var(--info); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(18,24,12,.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 42px 16px; overflow-y: auto;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 620px;
  box-shadow: var(--sh-4); border: 1px solid var(--border);
  animation: pop .18s cubic-bezier(.4,0,.2,1);
}
.modal.wide { max-width: 940px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(-10px) scale(.99); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 650; }
.modal-head .x { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-3); line-height: 1; padding: 0 4px; border-radius: 6px; transition: var(--ease); }
.modal-head .x:hover { color: var(--danger); background: var(--danger-bg); }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; }
.field textarea { resize: vertical; min-height: 70px; }
.field .hint, .hint { font-size: 11.5px; color: var(--text-3); line-height: 1.45; }
.section-label {
  grid-column: 1/-1; font-size: 11.5px; font-weight: 700; color: var(--brand);
  text-transform: uppercase; letter-spacing: .8px; margin-top: 8px;
  padding-top: 14px; border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 26px; right: 26px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast-item {
  background: var(--text); color: var(--bg); padding: 13px 20px; border-radius: var(--r-sm);
  box-shadow: var(--sh-3); font-size: 13.5px; font-weight: 500;
  animation: slideIn .22s cubic-bezier(.4,0,.2,1);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }
.toast-item.ok { border-left: 3px solid var(--ok); }
.toast-item.err { border-left: 3px solid var(--danger); }

/* ---------- Sub-tablas (mantenimiento, items de acta) ---------- */
.subtable-wrap { overflow-x: auto; border-radius: var(--r-sm); }
.subtable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.subtable th, .subtable td { padding: 8px 10px; border: 1px solid var(--border); }
.subtable th { background: var(--surface-2); text-align: left; font-weight: 650; color: var(--text-2); }
.subtable input { width: 100%; border: none; background: transparent; font-family: inherit; font-size: 12.5px; padding: 3px; color: var(--text); }
.subtable input:focus { outline: 2px solid var(--brand); border-radius: 4px; }

/* ---------- Multi-selector de áreas ---------- */
.ms { position: relative; }
.ms-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 10px; min-width: 210px; justify-content: space-between; }
.ms-btn:hover { border-color: var(--text-3); }
.ms-caret { color: var(--text-3); font-size: 11px; }
.ms-panel {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0;
  min-width: 262px; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--sh-3); padding: 7px;
}
.ms-panel[hidden] { display: none; }
.ms-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--brand); padding: 10px 9px 5px; }
.ms-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 7px; font-size: 13px; cursor: pointer; transition: var(--ease); }
.ms-item:hover { background: var(--brand-soft); }
.ms-item input { margin: 0; width: 15px; height: 15px; accent-color: var(--brand); }
.ms-all { font-weight: 650; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 5px; padding-bottom: 9px; }
/* Filtro de tipos: buscador, conteo por tipo y marca de filtro activo */
.ms-buscar { width: 100%; margin-bottom: 6px; font-size: 12.5px; }
.ms-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-num { font-size: 11px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ms-item.ms-cero .ms-nom { color: var(--text-3); }
.ms-vacio { padding: 12px 9px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.ms.ms-activo .ms-btn { border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* ---------- Selección múltiple en la tabla de equipos ---------- */
.col-sel { width: 34px; text-align: center; padding-left: 10px !important; padding-right: 0 !important; }
.col-sel input { margin: 0; width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }
.tabla-datos tbody tr.fila-marcada { background: var(--brand-soft); }
.sel-barra {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--brand-soft); border: 1px solid var(--brand);
  border-radius: var(--r); padding: 9px 13px; margin-bottom: 9px;
}
.sel-cuenta { font-size: 13px; color: var(--text-1); }
.sel-cuenta strong { color: var(--brand); font-size: 14.5px; }
.sel-cuenta em { font-style: normal; color: var(--text-3); font-size: 12px; }
.sel-acciones { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------- Elegir cómo exportar un lote ---------- */
.exp-opciones { display: grid; gap: 11px; }
.exp-opcion {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 16px; transition: var(--ease); font: inherit; color: inherit;
}
.exp-opcion:hover { border-color: var(--brand); background: var(--brand-soft); }
.exp-opcion strong { display: block; font-size: 14px; color: var(--text-1); margin-bottom: 4px; }
.exp-opcion span { display: block; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }

/* ---------- Tipos de equipo: siempre en mayúsculas ---------- */
.en-mayusculas { text-transform: uppercase; letter-spacing: .3px; }
.en-mayusculas::placeholder { letter-spacing: 0; }
.fila-choque { background: var(--danger-bg) !important; box-shadow: inset 3px 0 0 var(--danger); transition: background .4s; }

/* ---------- Políticas de tratamiento de datos ---------- */
.politica-check {
  display: flex; align-items: flex-start; gap: 11px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; font-size: 12.8px; line-height: 1.55;
}
.politica-check input { margin: 2px 0 0; width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--brand); }
.politica-sello { display: block; margin-top: 5px; font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--brand); }
.pol-doc { font-size: 13px; line-height: 1.65; color: var(--text-2); }
.pol-resumen {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  border-radius: var(--r-sm); padding: 11px 14px; color: var(--text-1); font-weight: 600;
}
.pol-doc h3 { margin: 18px 0 7px; font-size: 14px; color: var(--text-1); }
.pol-doc p { margin: 0 0 9px; text-align: justify; }
.pol-link { font-size: 12.5px; margin-top: 10px; }
.pol-link a { color: var(--brand); font-weight: 600; word-break: break-all; }
.pol-link-falta { color: var(--text-3); }
.pol-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 9px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.pol-meta > div { display: flex; flex-direction: column; gap: 1px; }
.pol-meta span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); font-weight: 700; }
.pol-meta strong { font-size: 12.5px; color: var(--text-1); font-weight: 600; }
/* Bloque desplegable de las políticas dentro del formulario del acta */
.politica-doc { margin-top: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.politica-doc[hidden] { display: none; }
.politica-doc-pie { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border); }

/* ---------- Selector de inventario en actas ---------- */
.inv-picker { border: 1px solid var(--border); border-radius: var(--r); padding: 13px; margin-top: 10px; background: var(--surface-2); }
.inv-picker input[type=search] { width: 100%; }
.inv-list { max-height: 250px; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.inv-item { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; cursor: pointer; transition: var(--ease); background: var(--surface); }
.inv-item:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateX(2px); }
.inv-item .inv-meta { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.inv-empty { color: var(--text-3); font-size: 13px; padding: 16px; text-align: center; }

/* ---------- Tabla de Check List ---------- */
.chk-tbl { font-size: 12px; }
.chk-tbl th { text-align: center; font-size: 11px; }
.chk-tbl th:nth-child(2) { text-align: left; }
.chk-no { text-align: center; font-weight: 650; color: var(--text-2); width: 42px; }
.chk-con { font-size: 12px; }
.chk-c { text-align: center; width: 54px; }
.chk-c input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--brand); }
.chk-x { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 11px; opacity: .4; padding: 0 3px; transition: var(--ease); }
.chk-x:hover { opacity: 1; }

/* ---------- Firma dibujable ---------- */
.sign-box { position: relative; margin-top: 8px; }
.sign-pad { width: 100%; height: 148px; border: 1px dashed var(--border); border-radius: var(--r-sm); background: var(--surface); cursor: crosshair; touch-action: none; display: block; transition: var(--ease); }
.sign-pad:hover { border-color: var(--brand); }
/* Línea guía para firmar derecho. Es CSS, no se dibuja en el lienzo, así que
   nunca aparece en el PDF ni en la firma guardada. */
.sign-guia { position: absolute; left: 7%; right: 7%; top: 74%; height: 1px; background: var(--border); pointer-events: none; }
.sign-guia::before, .sign-guia::after {
  content: ''; position: absolute; top: -4px; width: 1px; height: 9px; background: var(--border);
}
.sign-guia::before { left: 0; }
.sign-guia::after { right: 0; }
.sign-hint { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); text-align: center; color: var(--text-3); font-size: 12px; pointer-events: none; }
.sign-tools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.sign-grosor { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.sign-grosor button {
  border: none; background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 11.5px; padding: 4px 9px; cursor: pointer; transition: var(--ease);
}
.sign-grosor button + button { border-left: 1px solid var(--border); }
.sign-grosor button:hover { background: var(--brand-soft); }
.sign-grosor button.on { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------- Croquis de novedades ---------- */
.croquis { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; cursor: crosshair; background: var(--surface-2); }
.croquis img { display: block; max-width: 100%; height: auto; }
.pin {
  position: absolute; transform: translate(-50%,-50%);
  width: 27px; height: 27px; background: var(--danger); color: #fff;
  border: 2px solid #fff; border-radius: 50%; font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 7px rgba(0,0,0,.4); cursor: default; z-index: 2;
}
.pin-num { display: inline-block; width: 25px; height: 25px; line-height: 25px; background: var(--danger); color: #fff; border-radius: 50%; font-size: 12px; font-weight: 700; text-align: center; }

/* ---------- Ajustes: slots de logo ---------- */
.logo-slot {
  border: 2px dashed var(--border); border-radius: var(--r); background: var(--surface-2);
  min-height: 152px; display: flex; align-items: center; justify-content: center; padding: 16px;
  transition: var(--ease);
}
.logo-slot:hover { border-color: var(--brand); }
.logo-slot img, .logo-slot svg { max-width: 100%; max-height: 150px; width: auto; height: auto; }

/* ---------- Campo secreto (licencia borrosa) ---------- */
.secret-field { display: flex; gap: 8px; align-items: center; }
.secret-field input { flex: 1; }
.secret { transition: filter .12s; font-family: 'Cascadia Mono', Consolas, monospace; letter-spacing: .5px; }
.secret.blurred { filter: blur(5px); }
/* Casilla con etiqueta en la misma línea (ej. "Contraseña") */
.chk-linea { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.chk-linea input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.chk-linea span { font-size: 12.5px; font-weight: 650; color: var(--text-2); }

/* ---------- Timeline de trazabilidad ---------- */
.timeline { list-style: none; margin: 6px 0 0; padding: 0; }
.timeline li { display: flex; gap: 13px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.timeline li:last-child { border-bottom: none; }
.tl-dot { font-size: 15px; width: 26px; text-align: center; flex-shrink: 0; }
.tl-fecha { color: var(--text-3); font-size: 11.5px; margin-top: 3px; }

/* ---------- Menú de engranaje ---------- */
.gear { position: relative; display: inline-flex; }
.gear-menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--sh-3); padding: 7px; min-width: 190px; z-index: 100;
}
.gear-menu[hidden] { display: none; }
.gear-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none;
  padding: 9px 12px; border-radius: 7px; font-family: inherit; font-size: 13.5px;
  color: var(--text); cursor: pointer; transition: var(--ease);
}
.gear-menu button .ico { color: var(--text-3); transition: var(--ease); }
.gear-menu button:hover { background: var(--brand-soft); color: var(--brand); }
.gear-menu button:hover .ico { color: var(--brand); }
.gear-group {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-3); padding: 11px 12px 5px;
}
.gear-group:first-child { padding-top: 5px; }

/* ---------- Login ---------- */
/* Fondo con dos halos de marca que se desplazan muy despacio */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg);
  position: relative; overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(70px); opacity: .55;
}
.login-wrap::before {
  width: 620px; height: 620px; top: -220px; left: -160px;
  background: radial-gradient(circle, var(--brand) 0%, transparent 68%);
  animation: halo1 22s ease-in-out infinite;
}
.login-wrap::after {
  width: 520px; height: 520px; bottom: -200px; right: -140px;
  background: radial-gradient(circle, var(--cat-gen) 0%, transparent 68%);
  opacity: .32;
  animation: halo2 27s ease-in-out infinite;
}
@keyframes halo1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(90px, 70px) scale(1.15); }
}
@keyframes halo2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-80px, -60px) scale(1.12); }
}

/* Tarjeta de vidrio esmerilado sobre los halos */
.login-card {
  position: relative; z-index: 1;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 22px;
  box-shadow: var(--sh-4), inset 0 1px 0 rgba(255,255,255,.5);
  padding: 42px 38px; width: 100%; max-width: 400px; text-align: center;
  animation: pop .3s cubic-bezier(.4,0,.2,1);
}
[data-theme="dark"] .login-card { box-shadow: var(--sh-4), inset 0 1px 0 rgba(255,255,255,.07); }

@media (prefers-reduced-motion: reduce) {
  .login-wrap::before, .login-wrap::after { animation: none; }
}
.login-diamond { color: var(--brand); font-size: 44px; line-height: 1; }
.login-logo { display: flex; justify-content: center; margin-bottom: 6px; }
.login-logo img { max-height: 78px; max-width: 220px; width: auto; height: auto; }
.login-card h2 { margin: 12px 0 3px; font-size: 21px; letter-spacing: 2px; color: var(--text); font-weight: 700; }
.login-sub { color: var(--text-2); margin: 0 0 26px; font-size: 13px; }
.login-card .field { text-align: left; margin-bottom: 15px; }
.login-card input { width: 100%; padding: 11px 13px; }
.login-err { color: var(--danger); font-size: 12.5px; margin-top: 13px; min-height: 16px; }
.login-marks { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.login-marks .brand-mark { background: transparent; padding: 0; }
.login-marks .brand-mark img { height: 28px; }

/* =========================================================================
   Responsive
   ========================================================================= */
/* Pantallas medianas: la barra se aprieta y se ocultan los sellos de marca */
@media (max-width: 1180px) {
  .tn-inner { gap: 16px; padding: 0 16px; }
  .tn-brand::after { margin-left: 14px; }
  .brand-marks { display: none; }
  .tn-nav button { padding: 8px 10px; }
  .user-chip { max-width: 120px; }
}
@media (max-width: 1000px) {
  .tn-brand-text { display: none; }
  .user-chip .user-nombre { display: none; }
  .user-chip { padding-left: 10px; }
}

/* Móvil / tablet: las pestañas pasan a un panel desplegable */
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .tn-brand-text { display: block; }
  .tn-brand::after { display: none; }
  .tn-nav {
    position: absolute; left: 0; right: 0; top: var(--tn-h); z-index: 60;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px;
    background: var(--nav-bg-2); border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: var(--sh-4);
    display: none;
  }
  .tn-nav.open { display: flex; }
  .tn-nav button { width: 100%; justify-content: flex-start; padding: 11px 13px; font-size: 14px; }
  .tn-nav button.active::after { display: none; }
  .tn-actions { margin-left: auto; }
  main { padding: 20px 14px 40px; }
  .gear-menu { max-height: calc(100vh - var(--tn-h) - 24px); overflow-y: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 20px; }
  .kpi .num { font-size: 26px; }
  .toolbar input[type=search], .toolbar select, .ms, .ms-btn { min-width: 0; width: 100%; flex: 1 1 100%; }
  .bar-row { grid-template-columns: 104px 1fr 64px; }
  .modal-overlay { padding: 12px 8px; }
  .modal-body { padding: 18px; }
  .modal-head, .modal-foot { padding: 15px 18px; }
  .subtable { min-width: 560px; }
  #toast { left: 14px; right: 14px; bottom: 14px; }
}

/* Celular: solo quedan los iconos, sin textos que desborden la barra */
@media (max-width: 620px) {
  .tn-inner { padding: 0 12px; gap: 10px; }
  .tn-actions { gap: 4px; }
  .user-chip { display: none; }
  #logout-btn {
    padding: 0; width: 34px; height: 34px; border-radius: var(--r-sm);
    background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16);
  }
  #logout-btn span { display: none; }
  #logout-btn .ico { margin: 0; }
  .tn-brand-text strong { font-size: 11.5px; letter-spacing: 1px; }
  .tn-brand-text small { display: none; }
}

/* ---------- Impresión ---------- */
@media print {
  #topnav, .toolbar, .view-head .btn, #toast, .no-print { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .panel, .table-wrap { box-shadow: none; border: 1px solid #ccc; }
}
