/* REEMS · Sistema de Diseño e Identidad de Marca ("High-Tech Industrial & Futurista").
   Tokens centralizados de color, tipografía y componentes para taller, mostrador y campo.
   Paleta tomada del logotipo oficial REEM'S (docs/marca-reems.md):
   Azul Marino #1b2a8a (contorno del logo) como primario y Verde REEM'S #56b00a como color de marca.
   El verde para texto o botones es el tono 700 (#2e7d0a), que cumple contraste WCAG AA sobre blanco.
   Sin dependencias externas ni fuentes bloqueantes: opera 100 % fuera de línea en PWA. */

:root {
  /* =========================================================
     1. ESCALAS DE MARCA REEMS (50 - 900)
     ========================================================= */
  /* Escala Primaria (Azul Marino del logo REEM'S) */
  --reems-primary-50: #eef0fa;
  --reems-primary-100: #d8dcf2;
  --reems-primary-200: #b1b9e5;
  --reems-primary-300: #8590d3;
  --reems-primary-400: #5563bd;
  --reems-primary-500: #1b2a8a; /* Base inmutable: contorno del logo */
  --reems-primary-600: #17237a;
  --reems-primary-700: #131d66;
  --reems-primary-800: #0f1752;
  --reems-primary-900: #0b113d;
  --reems-primary-950: #080d1a;

  /* Escala Secundaria (Verde REEM'S) */
  --reems-secondary-50: #f0f9e8;
  --reems-secondary-100: #dcf0c9;
  --reems-secondary-200: #bce39a;
  --reems-secondary-300: #94d061;
  --reems-secondary-400: #6fbd2a;
  --reems-secondary-500: #56b00a; /* Base inmutable: verde vivo del logo (fondos y acentos) */
  --reems-secondary-600: #3d9a0c;
  --reems-secondary-700: #2e7d0a; /* Verde para texto y botones (AA sobre blanco) */
  --reems-secondary-800: #24610b;
  --reems-secondary-900: #1b4a0a;

  /* Acentos Tecnológicos y Neón */
  --accent-neon: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-glow: 0 0 16px rgba(56, 189, 248, 0.35);
  --green-glow: 0 0 16px rgba(86, 176, 10, 0.4);
  --primary-glow: 0 0 20px rgba(27, 42, 138, 0.45);

  /* Franja verde de marca bajo la barra superior */
  --marca: var(--reems-secondary-500);

  /* Tipografías Oficiales (con fallback robusto offline) */
  --display: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Cascadia Code', ui-monospace, monospace;

  /* Dimensiones Táctiles (Escala ergonómica) */
  --toque: 52px;
  --toque-lg: 64px;
  --fila: 76px;

  /* Espaciado escala 4px */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Radios */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 9999px;

  /* =========================================================
     2. MODO OSCURO (PREDETERMINADO / PROTAGONISTA)
     ========================================================= */
  --background: #080d1a;
  --bg: var(--background);
  --surface: rgba(14, 23, 42, 0.82);
  --surface-2: rgba(22, 36, 68, 0.62);
  --surface-elevated: #162444;
  --border: rgba(65, 84, 150, 0.38);
  --line: var(--border);
  --text: #f8fafc;
  --fg: var(--text);
  --muted: #94a3b8;

  --primary: #2539ba;
  --primary-hover: #3448d6;
  --primary-fg: #ffffff;
  --primary-sombra: rgba(27, 42, 138, 0.45);

  --secondary: var(--reems-secondary-500);
  --secondary-hover: var(--reems-secondary-400);
  --secondary-fg: #ffffff;

  --accent: var(--accent-neon);
  --accent-fg: #080d1a;
  --accent-soft: rgba(56, 189, 248, 0.12);

  --success: var(--reems-secondary-500);
  --ok: var(--success);
  --ok-soft: rgba(86, 176, 10, 0.16);

  --warning: #f59e0b;
  --warn: var(--warning);
  --warn-soft: rgba(245, 158, 11, 0.16);

  --danger: #ef4444;
  --bad: var(--danger);
  --bad-soft: rgba(239, 68, 68, 0.18);

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.42);
  --shadow-glow: 0 4px 20px rgba(27, 42, 138, 0.35);

  color-scheme: dark;
}

/* =========================================================
   3. MODO CLARO (TECNOLÓGICO Y LIMPIO)
   ========================================================= */
:root[data-theme='light'] {
  --background: #f4f7fb;
  --bg: var(--background);
  --surface: #ffffff;
  --surface-2: #edf2f9;
  --surface-elevated: #ffffff;
  --border: #cbd5e1;
  --line: var(--border);
  --text: #0f172a;
  --fg: var(--text);
  --muted: #64748b;

  --primary: var(--reems-primary-500);
  --primary-hover: var(--reems-primary-700);
  --primary-fg: #ffffff;
  --primary-sombra: rgba(27, 42, 138, 0.25);

  --secondary: var(--reems-secondary-700);
  --secondary-hover: var(--reems-secondary-800);
  --secondary-fg: #ffffff;

  --accent: var(--primary);
  --accent-fg: var(--primary-fg);
  --accent-soft: var(--reems-primary-50);

  --success: var(--reems-secondary-700);
  --ok: var(--success);
  --ok-soft: var(--reems-secondary-50);

  --warning: #d97706;
  --warn: var(--warning);
  --warn-soft: #fef3c7;

  --danger: #dc2626;
  --bad: var(--danger);
  --bad-soft: #fee2e2;

  --shadow-card: 0 10px 25px rgba(27, 42, 138, 0.06);
  --shadow-glow: 0 4px 14px rgba(27, 42, 138, 0.15);

  color-scheme: light;
}

/* =========================================================
   4. ALTO CONTRASTE PARA CAMPO / SOL INTENSO
   ========================================================= */
:root[data-contraste='alto'] {
  --background: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #000000;
  --line: #000000;
  --text: #000000;
  --fg: #000000;
  --muted: #1e293b;
  --primary: var(--reems-primary-900);
  --primary-fg: #ffffff;
  --accent: var(--reems-primary-900);
  --accent-fg: #ffffff;
  --ok: var(--reems-secondary-800);
  --warn: #b45309;
  --bad: #b91c1c;
}
:root[data-contraste='alto'] * { border-width: 2px !important; }

/* =========================================================
   5. REGLAS BASE Y RETÍCULA TECNOLÓGICA
   ========================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(27, 42, 138, 0.25) 0%, transparent 65%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.5 var(--body);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme='light'] body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(27, 42, 138, 0.06) 0%, transparent 65%),
    linear-gradient(to right, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-neon); outline-offset: 2px; }
[hidden] { display: none !important; }

/* =========================================================
   6. LOGO Y MARCA REUTILIZABLE
   ========================================================= */
.reems-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  user-select: none;
}
.reems-logo-img {
  height: 38px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: #ffffff;
  border-radius: var(--r-sm);
  padding: 3px 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.reems-logo:hover .reems-logo-img {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.login-header-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.login-header-logo .reems-logo-img {
  height: auto;
  width: min(100%, 280px);
  padding: 12px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-bottom: 4px solid var(--marca);
  border-radius: var(--r-lg);
  box-shadow: 0 6px 24px rgba(27, 42, 138, 0.35);
}

/* =========================================================
   7. ESTRUCTURA Y NAVEGACIÓN FUTURISTA
   ========================================================= */
.barra {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 3px solid var(--marca);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.barra .espacio { flex: 1; }
.barra .quien { font-weight: 700; letter-spacing: 0.3px; }
.barra .rol { color: var(--muted); font-size: 13px; font-weight: 500; }

.pastilla {
  font: 600 12px var(--body);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(86, 176, 10, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}
.pastilla::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.pastilla.sin-red {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.3);
}
.pastilla.sin-red::before {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
}

.boton-barra {
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.boton-barra:hover {
  background: var(--surface-elevated);
  border-color: var(--accent-neon);
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
}

.contenido {
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.contenido.angosto { max-width: 460px; }

/* Login Container Elevado */
form.contenido.angosto {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
  margin-top: 6vh !important;
  position: relative;
  overflow: hidden;
}
form.contenido.angosto::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.titulo {
  font: 800 1.85rem var(--display);
  margin: 0;
  color: var(--fg);
  letter-spacing: -0.5px;
}
.subtitulo { color: var(--muted); margin: 0; font-size: 0.95rem; }
.etiqueta {
  font: 700 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-neon);
}

.menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}
:root[data-theme='light'] .menu {
  background: #e2e8f0;
}
.menu button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.menu button:hover {
  background: var(--surface-2);
  color: var(--fg);
  border-color: var(--border);
}
.menu button[aria-current='page'] {
  background: linear-gradient(135deg, #1b2a8a 0%, #2539ba 100%);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 14px rgba(27, 42, 138, 0.45);
}

/* =========================================================
   8. TARJETAS Y BOTONES FUTURISTAS
   ========================================================= */
.tarjeta {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.tarjeta:hover {
  border-color: rgba(56, 189, 248, 0.35);
}
.tarjeta.suave {
  background: var(--surface-2);
  border-color: rgba(65, 84, 150, 0.25);
}

.folio {
  font: 700 15px var(--mono);
  color: var(--accent-neon);
  letter-spacing: -0.3px;
  background: rgba(56, 189, 248, 0.1);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  display: inline-block;
  width: fit-content;
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.equipo {
  font: 700 1.55rem/1.2 var(--display);
  margin: 0;
  color: var(--fg);
  letter-spacing: -0.4px;
}
.falla { color: var(--muted); margin: 0; font-size: 0.95rem; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: 600 12px var(--body);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.chip.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(86, 176, 10, 0.4);
  box-shadow: 0 0 10px rgba(86, 176, 10, 0.15);
}
.chip.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.4);
}
.chip.bad {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.4);
}

.principal {
  width: 100%;
  min-height: 64px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #1b2a8a 0%, #2539ba 60%, #1e3a8a 100%);
  color: #ffffff;
  font: 700 1.25rem var(--display);
  letter-spacing: .04em;
  text-transform: uppercase;
  box-shadow: 0 4px 20px rgba(27, 42, 138, 0.45);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.principal:hover:not(:disabled) {
  border-color: var(--accent-neon);
  box-shadow: 0 6px 24px rgba(56, 189, 248, 0.45);
  transform: translateY(-2px);
}
.principal:active:not(:disabled) {
  transform: translateY(0);
}
.principal.ok {
  background: linear-gradient(135deg, #2e7d0a 0%, #56b00a 100%);
  border-color: rgba(86, 176, 10, 0.5);
  box-shadow: var(--green-glow);
}
.principal.ok:hover:not(:disabled) {
  box-shadow: 0 6px 26px rgba(86, 176, 10, 0.6);
}
.principal:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
  border-color: transparent;
}

.secundario {
  min-height: var(--toque);
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.secundario:hover {
  background: var(--surface-elevated);
  border-color: var(--accent-neon);
  transform: translateY(-1px);
}
.secundario.peligro {
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.4);
  background: var(--bad-soft);
}
.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* =========================================================
   9. CRONÓMETRO, PASOS Y LEDS
   ========================================================= */
.anillo {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}
.anillo .tiempo {
  font: 700 2.2rem var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent-neon);
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}
.anillo .objetivo { color: var(--muted); font-size: 13px; font-weight: 500; }

.pasos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pasos li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  min-height: var(--fila);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-weight: 600;
  transition: all 0.2s ease;
}
.pasos li:hover {
  border-color: rgba(56, 189, 248, 0.3);
}
.pasos li .caja {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  color: #ffffff;
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s ease;
}
.pasos li.hecho .caja {
  background: #56b00a;
  border-color: #56b00a;
  box-shadow: 0 0 10px rgba(86, 176, 10, 0.4);
}
.pasos li.hecho span { color: var(--muted); text-decoration: line-through rgba(148, 163, 184, 0.4); }
.pasos li.falta .caja {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.opciones { display: flex; flex-direction: column; gap: 8px; }
.opcion {
  text-align: left;
  min-height: var(--toque);
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.opcion:hover {
  background: var(--surface-2);
  border-color: var(--accent-neon);
}
.opcion[aria-pressed='true'] {
  border-color: var(--accent-neon);
  background: var(--accent-soft);
  box-shadow: var(--accent-glow);
}

.aviso {
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-weight: 600;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}
.aviso.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(86, 176, 10, 0.3);
}
.aviso.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.3);
}
.aviso.bad {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.3);
}

/* =========================================================
   10. FORMULARIOS, INPUTS Y FOTOS
   ========================================================= */
.campo { display: flex; flex-direction: column; gap: 8px; }
.campo label { font-weight: 600; font-size: 0.9rem; color: var(--fg); }

input:not([type='file']):not([type='checkbox']), select, textarea {
  min-height: 50px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  width: 100%;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
input:not([type='file']):not([type='checkbox']):focus, select:focus, textarea:focus {
  border-color: var(--accent-neon);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
.mono { font-family: var(--mono); }
.ayuda { color: var(--muted); font-size: 13px; line-height: 1.5; }

.rejilla { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.fotos { display: flex; gap: 10px; flex-wrap: wrap; }
.fotos img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.miniatura { position: relative; }
.miniatura .quitar {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--bad);
  background: var(--surface);
  color: var(--bad);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* =========================================================
   11. TABLAS, TABLERO TALLER Y KPIS FUTURISTAS
   ========================================================= */
.tabla { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}
th, td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--border); white-space: nowrap; }
th {
  font: 700 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border-top: 0;
  background: var(--surface-2);
}
tr.clic { cursor: pointer; transition: background-color 0.15s ease; }
tr.clic:hover td { background: var(--surface-2); }

.tablero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.columna { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.columna h3 {
  font: 700 1.25rem var(--display);
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.columna h3 span { font-family: var(--mono); color: var(--accent-neon); font-size: 1.1rem; }

.ficha {
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}
.ficha:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
}
.ficha.ok { border-left-color: var(--ok); }
.ficha.warn { border-left-color: var(--warn); }
.ficha.bad { border-left-color: var(--bad); }
.ficha.acc { border-left-color: var(--accent-neon); }
.ficha .l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.ficha .l1 .tm { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--accent-neon); }
.ficha .l2 { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Tarjetas KPI de Torre de Control */
.indicadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.indicador {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.indicador:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.indicador .n {
  font: 800 2.5rem/1 var(--display);
  color: var(--accent-neon);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.indicador .t {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.excepcion {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  transition: background-color 0.15s ease;
}
.excepcion:first-of-type { border-top: 0; }
.punto {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 auto;
}
.punto.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.punto.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.punto.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

.notificacion {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 500;
  max-width: min(92vw, 540px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.etiqueta-termica {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  padding: 14px;
  background: var(--surface);
  border: 2px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}
.qr-contenedor {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
  padding: 4px;
  background: #ffffff;
  border-radius: 6px;
}
.qr-contenedor svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* =========================================================
   12. COLA DE TRABAJOS DE TÉCNICO (MODO ENFOQUE RESUELTO)
   ========================================================= */
.queue-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--surface-2);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.queue-card:hover {
  background: var(--surface-elevated);
  border-color: var(--accent-neon);
  transform: translateX(3px);
}
.queue-card.authorized {
  border-left: 4px solid var(--ok);
  background: rgba(86, 176, 10, 0.1);
  box-shadow: 0 0 12px rgba(86, 176, 10, 0.15);
}

/* =========================================================
   13. CHAT INTERNO FUTURISTA
   ========================================================= */
.boton-chat { position: relative; }
.insignia {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 10px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 10px var(--bad);
}
.insignia[hidden] { display: none; }
.chat-cuerpo { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .chat-cuerpo { grid-template-columns: 290px 1fr; } }
.chat-lista { display: flex; flex-direction: column; gap: 6px; }
.chat-lista .opcion.activa {
  border-color: var(--accent-neon);
  background: var(--accent-soft);
  box-shadow: var(--accent-glow);
}
.chat-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-mensajes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 6px;
}
.burbuja {
  align-self: flex-start;
  max-width: 85%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.burbuja.mia {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.15);
}
.burbuja.oculta { opacity: .6; }
.burbuja p { margin: 4px 0; white-space: pre-wrap; font-size: 0.95rem; }
.burbuja small { color: var(--muted); font-size: 11px; }
.burbuja img { max-width: 220px; max-height: 220px; border-radius: var(--r-md); display: block; margin-top: 6px; }
.chat-pie { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.enlace { background: none; border: 0; color: var(--accent-neon); text-decoration: underline; min-height: 44px; padding: 0 4px; }
.chat-escribir { display: grid; gap: 10px; margin-bottom: 96px; }
.chat-cabecera-conv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-weight: 700;
  min-height: 44px;
}
.modal-chat {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* =========================================================
   14. IMPRESIÓN RIGUROSA Y RESPONSIVO
   ========================================================= */
@media print {
  @page { margin: 0; size: auto; }
  body {
    margin: 0;
    padding: 0;
    background: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
  }
  body > #app > div > :not(main), .menu, .barra, button, .aviso, nav, .no-print { display: none !important; }
  .tarjeta {
    border: 1px solid #000000;
    box-shadow: none !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
  }
  .ticket-logo { max-height: 52px; width: auto; object-fit: contain; margin-bottom: 12px; display: block; }

  .etiqueta-termica {
    width: 60mm;
    max-width: 72mm;
    margin: 2mm auto;
    padding: 3mm 4mm;
    border: 1px dashed #000000 !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid;
    box-shadow: none !important;
  }
  .etiqueta-termica * { color: #000000 !important; }
  .etiqueta-termica .qr-contenedor { background: #ffffff !important; padding: 0; margin: 2mm 0; }
  .etiqueta-termica .qr-contenedor svg { max-width: 32mm; max-height: 32mm; margin: 0 auto; }
  /* Póliza de Garantía Formal y Ticket Térmico 80mm */
  .contenedor-poliza.formato-carta .ticket-garantia-80mm {
    display: none !important;
  }
  .contenedor-poliza.formato-carta .tarjeta-poliza-carta {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    border: 1.5px solid #0f172a !important;
    padding: 12mm 16mm !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .contenedor-poliza.formato-ticket .tarjeta-poliza-carta {
    display: none !important;
  }
  .contenedor-poliza.formato-ticket .ticket-garantia-80mm {
    display: block !important;
    width: 76mm !important;
    max-width: 80mm !important;
    margin: 0 auto !important;
    padding: 2mm !important;
    border: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .contenedor-poliza.formato-ticket .ticket-garantia-80mm * {
    color: #000000 !important;
  }
}


@media (max-width: 900px) { .tablero { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tablero { grid-template-columns: minmax(0, 1fr); } .fila2 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 600px) {
  .barra { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .barra .espacio { flex-basis: 0; }
  .barra .rol { display: none; }
}
