/* ==========================================================================
   SOPORTE TIC · PROIMCA C.A — Hoja de estilos principal (v2.0)
   --------------------------------------------------------------------------
   Sistema de diseño propio, sin dependencias externas.
   Para cambiar los colores de la marca, edite las variables de :root.
   ========================================================================== */

/* ---------- Tipografías (incluidas en /public/fonts, licencia OFL) ---------- */
@font-face { font-family: "Inter"; src: url("../fonts/inter-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-Bold.woff") format("woff"); font-weight: 700 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/montserrat-var.woff") format("woff"); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ---------- Variables ---------- */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Montserrat", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Azul del logotipo TIC */
  --brand-50: #eef3fe; --brand-100: #dce6fd; --brand-200: #bdd0fb; --brand-300: #8fb0f8;
  --brand-400: #5d8bf3; --brand-500: #4a7cee; --brand-600: #326ae5; --brand-700: #2655c4;
  --brand-800: #23479c; --brand-900: #213d7c; --brand-950: #142450;

  /* Verde y magenta del logotipo PROIMCA */
  --green-50: #e9f8f0; --green-100: #c9eedb; --green-500: #00a650; --green-600: #009146; --green-700: #007a3b; --green-800: #0b5e32;
  --magenta-50: #fdeef6; --magenta-100: #fbd5e8; --magenta-500: #e5318f; --magenta-600: #db147f; --magenta-700: #b40f68;

  --amber-50: #fffbeb; --amber-100: #fef3c7; --amber-200: #fde68a; --amber-500: #f59e0b; --amber-600: #d97706; --amber-700: #b45309; --amber-800: #92400e;
  --orange-50: #fff7ed; --orange-100: #ffedd5; --orange-600: #ea580c; --orange-700: #c2410c;
  --red-50: #fef2f2; --red-100: #fee2e2; --red-200: #fecaca; --red-500: #ef4444; --red-600: #dc2626; --red-700: #b91c1c;
  --sky-50: #f0f9ff; --sky-100: #e0f2fe; --sky-700: #0369a1;
  --violet-50: #f5f3ff; --violet-100: #ede9fe; --violet-700: #6d28d9;

  /* Superficies (tema claro) */
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e3e8f1;
  --border-strong: #cdd5e2;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8492a8;
  --ring: rgba(50, 106, 229, .35);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px -8px rgba(15, 23, 42, .10);
  --shadow-lg: 0 12px 40px -12px rgba(15, 23, 42, .28);
  --overlay: rgba(15, 23, 42, .55);

  --sidebar-bg: #0e1a3a;
  --sidebar-bg-2: #12224a;
  --sidebar-text: #b8c4dc;
  --sidebar-muted: #6f7fa3;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --sidebar-w: 268px;
  --topbar-h: 64px;

  color-scheme: light;
}

html.dark {
  --bg: #0a1020;
  --surface: #111a2d;
  --surface-2: #0e1627;
  --surface-3: #18233a;
  --border: #1f2b44;
  --border-strong: #2c3a57;
  --text: #e8edf7;
  --text-2: #a9b5cc;
  --text-3: #6c7b98;
  --ring: rgba(93, 139, 243, .45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 20px -10px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 50px -12px rgba(0, 0, 0, .7);
  --overlay: rgba(2, 6, 18, .7);
  --sidebar-bg: #070d1c;
  --sidebar-bg-2: #0c1530;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
.badge svg, .chip svg { width: 13px; height: 13px; }
.ico-lg { width: 28px; height: 28px; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
:where(html.dark) a { color: var(--brand-400); }
html.dark .btn-primary, html.dark .btn-success, html.dark .btn-danger, html.dark .btn-accent { --b-fg: #fff; }
html.dark .hero .btn-outline { --b-fg: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; color: var(--text); }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--brand-200); color: var(--brand-950); }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden], .hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ==========================================================================
   ESTRUCTURA
   ========================================================================== */
.app { min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); transition: grid-template-columns .3s cubic-bezier(.22,.61,.36,1); }
  html.sb-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
  html.sb-collapsed .sidebar { transform: translateX(-100%); visibility: hidden; }
  .sidebar { transition: transform .3s cubic-bezier(.22,.61,.36,1), visibility .3s; }
}
html.no-anim *, html.no-anim *::before, html.no-anim *::after { transition: none !important; }

/* ---------- Barra lateral ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.22,.61,.36,1);
  box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: none; }
@media (min-width: 1024px) {
  .sidebar { position: sticky; top: 0; height: 100vh; box-shadow: none; }
  html:not(.sb-collapsed) .sidebar { transform: none; }
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06); text-decoration: none !important; }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; box-shadow: 0 6px 18px -6px rgba(50,106,229,.8); }
.sidebar-brand strong { display: block; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand span { display: block; color: var(--sidebar-muted); font-size: 12px; }
.sidebar-close { margin-left: auto; color: var(--sidebar-muted); }
@media (min-width: 1024px) { .sidebar .sidebar-close { display: none; } }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section { margin: 16px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sidebar-muted); }
.nav-section:first-child { margin-top: 2px; }
.nav-group + .nav-group { margin-top: 6px; }
.nav-toggle {
  display: flex; align-items: center; justify-content: space-between; width: calc(100% - 8px); margin: 4px 4px 2px; padding: 8px 8px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; transition: background .15s, color .15s;
}
.nav-toggle:hover { background: rgba(255,255,255,.05); color: #c9d4ec; }
.nav-toggle:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 0; }
.nav-toggle svg { width: 15px; height: 15px; transition: transform .3s cubic-bezier(.22,.61,.36,1); }
.nav-group.collapsed .nav-toggle svg { transform: rotate(-90deg); }
.nav-toggle .nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--magenta-500); margin-left: auto; margin-right: 8px; opacity: 0; transition: opacity .2s; }
.nav-group.collapsed .nav-toggle .nav-dot.on { opacity: 1; }
.nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .32s cubic-bezier(.22,.61,.36,1); }
.nav-group.collapsed .nav-items { grid-template-rows: 0fr; }
.nav-items-inner { overflow: hidden; min-height: 0; }
.nav-items-inner .nav-link { transition: background .15s, color .15s, opacity .28s, transform .28s; }
.nav-group.collapsed .nav-items-inner .nav-link { opacity: 0; transform: translateX(-8px); }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13.5px;
  text-decoration: none !important; transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--brand-600); color: #fff; box-shadow: 0 8px 20px -10px rgba(50,106,229,.9); }
.nav-link.active svg { opacity: 1; }
.nav-link .nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--magenta-600); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.04); }
.user-card .who { min-width: 0; flex: 1; }
.user-card .who strong { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .who span { display: block; color: var(--sidebar-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .btn-icon { color: var(--sidebar-muted); }
.user-card .btn-icon:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-login { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 12px; color: var(--sidebar-muted); }

.backdrop { position: fixed; inset: 0; z-index: 55; background: var(--overlay); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.backdrop.show { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) { .backdrop { display: none; } }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .topbar { padding: 0 28px; } }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: inline-flex; }

.content { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 22px 16px 40px; }
@media (min-width: 640px) { .content { padding: 28px 28px 48px; } }
.content.narrow { max-width: 880px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.page-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--text-2); margin-top: 4px; }

/* ---------- Pie de página ---------- */
.footer { border-top: 1px solid var(--border); padding: 16px 28px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.footer b { color: var(--text-2); font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--brand-600); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
html.dark .link-btn { color: var(--brand-400); }

/* ==========================================================================
   COMPONENTES
   ========================================================================== */

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (min-width: 640px) { .card-body { padding: 24px; } }

/* ---------- Botones ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--border-strong); --b-hover: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; text-decoration: none !important; user-select: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, opacity .15s;
}
.btn:hover { background: var(--b-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { --b-bg: var(--brand-600); --b-fg: #fff; --b-bd: var(--brand-600); --b-hover: var(--brand-700); box-shadow: 0 6px 16px -8px rgba(50,106,229,.7); }
.btn-success { --b-bg: var(--green-600); --b-fg: #fff; --b-bd: var(--green-600); --b-hover: var(--green-700); box-shadow: 0 6px 16px -8px rgba(0,145,70,.6); }
.btn-danger  { --b-bg: var(--red-600); --b-fg: #fff; --b-bd: var(--red-600); --b-hover: var(--red-700); }
.btn-warning { --b-bg: var(--amber-500); --b-fg: #1f1300; --b-bd: var(--amber-500); --b-hover: var(--amber-600); }
.btn-accent  { --b-bg: var(--magenta-600); --b-fg: #fff; --b-bd: var(--magenta-600); --b-hover: var(--magenta-700); }
.btn-ghost   { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--text-2); --b-hover: var(--surface-3); }
.btn-soft-danger { --b-fg: var(--red-600); --b-hover: var(--red-50); }
html.dark .btn-soft-danger { --b-fg: #f87171; --b-hover: rgba(239,68,68,.12); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; --b-bg: transparent; --b-bd: transparent; --b-fg: var(--text-2); --b-hover: var(--surface-3); }
.btn-icon.btn-sm { width: 32px; }
.btn .spinner { width: 15px; height: 15px; border-width: 2px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.form-grid { display: grid; gap: 18px; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text); }
.label .req { color: var(--red-600); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--red-600); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238492a8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--ring); }
.input[readonly] { background: var(--surface-2); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red-500); }
.input-sm, .select-sm { height: 34px; font-size: 13px; border-radius: 9px; }
html.dark .select option { background: var(--surface); color: var(--text); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; height: auto; }
.counter { font-size: 11.5px; color: var(--text-3); text-align: right; }

/* Opciones tipo tarjeta (radio) */
.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .choice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .choice-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; justify-content: center; text-align: center; gap: 6px;
  min-height: 46px; height: 100%; padding: 8px 10px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--text-2); line-height: 1.3;
  transition: all .15s;
}
.choice:hover span { border-color: var(--brand-400); color: var(--brand-700); }
html.dark .choice:hover span { color: var(--brand-300); }
.choice input:checked + span { border-color: var(--brand-600); background: var(--brand-600); color: #fff; box-shadow: 0 6px 16px -8px rgba(50,106,229,.8); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.choice-prio input:checked + span[data-p="Alta"] { background: var(--orange-600); border-color: var(--orange-600); }
.choice-prio input:checked + span[data-p="Critica"], .choice-prio input:checked + span[data-p="Crítica"] { background: var(--red-600); border-color: var(--red-600); }
.choice-prio input:checked + span[data-p="Baja"] { background: #64748b; border-color: #64748b; }

/* Interruptor */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--green-600); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Insignias ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  height: 23px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-blue   { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge-green  { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.badge-amber  { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }
.badge-orange { background: var(--orange-50); color: var(--orange-700); border-color: var(--orange-100); }
.badge-red    { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.badge-violet { background: var(--violet-50); color: var(--violet-700); border-color: var(--violet-100); }
.badge-sky    { background: var(--sky-50); color: var(--sky-700); border-color: var(--sky-100); }
.badge-magenta{ background: var(--magenta-50); color: var(--magenta-700); border-color: var(--magenta-100); }
html.dark .badge-blue   { background: rgba(74,124,238,.14); color: #9ab7fa; border-color: rgba(74,124,238,.25); }
html.dark .badge-green  { background: rgba(0,166,80,.14); color: #5fd79a; border-color: rgba(0,166,80,.25); }
html.dark .badge-amber  { background: rgba(245,158,11,.14); color: #fbbf24; border-color: rgba(245,158,11,.25); }
html.dark .badge-orange { background: rgba(234,88,12,.15); color: #fb923c; border-color: rgba(234,88,12,.25); }
html.dark .badge-red    { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.25); }
html.dark .badge-violet { background: rgba(139,92,246,.15); color: #c4b5fd; border-color: rgba(139,92,246,.25); }
html.dark .badge-sky    { background: rgba(14,165,233,.14); color: #7dd3fc; border-color: rgba(14,165,233,.25); }
html.dark .badge-magenta{ background: rgba(219,20,127,.15); color: #f472b6; border-color: rgba(219,20,127,.25); }
.badge.pulse .dot { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 4px transparent; } }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; border: 1px solid; font-size: 13.5px; }
.alert svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 1px; }
.alert strong { display: block; margin-bottom: 2px; }
.alert-info    { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }
.alert-success { background: var(--green-50); border-color: var(--green-100); color: var(--green-800); }
.alert-warning { background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-800); }
.alert-danger  { background: var(--red-50); border-color: var(--red-200); color: var(--red-700); }
html.dark .alert-info    { background: rgba(74,124,238,.1); border-color: rgba(74,124,238,.25); color: #b8cdfb; }
html.dark .alert-success { background: rgba(0,166,80,.1); border-color: rgba(0,166,80,.25); color: #8ee4b5; }
html.dark .alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.25); color: #fcd34d; }
html.dark .alert-danger  { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); color: #fca5a5; }

/* ---------- Estadísticas ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stats.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .stats.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
button.stat { cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.stat:hover { border-color: var(--brand-300); box-shadow: var(--shadow); transform: translateY(-1px); }
button.stat.active { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--ring); }
.stat .stat-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.stat .stat-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.stat .stat-icon svg { width: 16px; height: 16px; }
.stat .stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .stat-sub { font-size: 12px; color: var(--text-3); }
.tone-blue .stat-icon { background: var(--brand-50); color: var(--brand-600); }
.tone-amber .stat-icon { background: var(--amber-50); color: var(--amber-600); }
.tone-green .stat-icon { background: var(--green-50); color: var(--green-600); }
.tone-red .stat-icon { background: var(--red-50); color: var(--red-600); }
.tone-violet .stat-icon { background: var(--violet-50); color: var(--violet-700); }
.tone-magenta .stat-icon { background: var(--magenta-50); color: var(--magenta-600); }
html.dark .stat .stat-icon { background: var(--surface-3) !important; }

/* ---------- Tablas ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1; padding: 11px 14px; text-align: left; white-space: nowrap;
  background: var(--surface-2); color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.is-new { animation: rowIn .6s ease-out; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-check { width: 44px; padding-right: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-id { font-weight: 700; color: var(--brand-700); white-space: nowrap; font-variant-numeric: tabular-nums; }
html.dark .table .t-id { color: var(--brand-300); }
.table .t-main { font-weight: 600; color: var(--text); }
.table .t-sub { font-size: 12px; color: var(--text-3); }
.nowrap { white-space: nowrap; }
@keyframes rowIn { from { background: var(--brand-50); } to { background: transparent; } }
.checkbox { width: 17px; height: 17px; accent-color: var(--brand-600); cursor: pointer; }

/* ---------- Barra de herramientas / filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1 1 240px; min-width: 200px; }
.toolbar .select { width: auto; min-width: 150px; }
.date-range { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); height: 34px; }
.date-range input { border: 0; background: transparent; height: 26px; font-size: 12.5px; color: var(--text); padding: 0 2px; width: 118px; }
.date-range input:focus { outline: none; }
.date-range span { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; }
.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100); color: var(--brand-800); font-weight: 600; font-size: 13px; }
html.dark .bulkbar { background: rgba(74,124,238,.1); border-color: rgba(74,124,238,.25); color: #b8cdfb; }

/* ---------- Pestañas segmentadas ---------- */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); }
.segmented button {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; transition: all .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }
html.dark .segmented button.active { color: var(--brand-300); }
.segmented .count { min-width: 20px; padding: 0 6px; height: 18px; border-radius: 99px; background: var(--border); font-size: 11px; display: inline-grid; place-items: center; }
.segmented button.active .count { background: var(--brand-100); color: var(--brand-700); }
html.dark .segmented button.active .count { background: rgba(74,124,238,.2); color: #b8cdfb; }

/* ---------- Paginación ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }
.pager-btns { display: flex; gap: 4px; align-items: center; }
.pager-btns button { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.pager-btns button:hover:not(:disabled) { border-color: var(--brand-400); color: var(--brand-700); }
.pager-btns button.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pager-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Vacío / carga ---------- */
.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty .empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty .empty-icon svg { width: 26px; height: 26px; }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: shimmer 1.3s infinite; }
html.dark .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.loading-block { display: grid; place-items: center; gap: 12px; padding: 50px 20px; color: var(--text-3); }
.loading-block .spinner { color: var(--brand-500); }

/* ---------- Avatares ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; font-weight: 700; font-size: 13px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.avatar.muted { background: var(--surface-3); color: var(--text-3); }

/* ---------- Ventanas (diálogo) y panel lateral ---------- */
.modal-root { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 640px) { .modal-root { align-items: center; padding: 20px; } }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); animation: fade .2s ease-out; }
.modal {
  position: relative; width: 100%; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.22,.61,.36,1);
}
@media (min-width: 640px) { .modal { border-radius: var(--radius-xl); max-width: 520px; } .modal.lg { max-width: 760px; } .modal.sm { max-width: 420px; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-head p { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.modal-head .btn-icon { margin: -6px -8px 0 auto; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.modal-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.modal-icon svg { width: 22px; height: 22px; }
.modal-icon.danger { background: var(--red-50); color: var(--red-600); }
.modal-icon.info { background: var(--brand-50); color: var(--brand-600); }
.modal-icon.warning { background: var(--amber-50); color: var(--amber-600); }
html.dark .modal-icon { background: var(--surface-3) !important; }

.drawer-root { position: fixed; inset: 0; z-index: 80; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%; max-width: 760px; display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg); border-left: 1px solid var(--border);
  animation: slideIn .28s cubic-bezier(.22,.61,.36,1);
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
body.no-scroll { overflow: hidden; }

/* Detalle (pares etiqueta / valor) */
.dl { display: grid; gap: 16px 22px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .dl { grid-template-columns: 1fr 1fr; } .dl .full { grid-column: 1 / -1; } }
.dl dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.dl dd { margin: 0; color: var(--text); word-break: break-word; }
.dl dd.pre { white-space: pre-line; line-height: 1.6; }
.box { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.box-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text); margin: 24px 0 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Cronómetro */
.timer { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--amber-700); }
html.dark .timer { color: #fbbf24; }
.timer::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Línea de tiempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 16px; }
.timeline li:last-child { padding-bottom: 0; }
.tl-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface); border: 2px solid var(--border); color: var(--text-3); }
.tl-dot svg { width: 14px; height: 14px; }
.tl-dot.blue { border-color: var(--brand-300); color: var(--brand-600); background: var(--brand-50); }
.tl-dot.green { border-color: var(--green-100); color: var(--green-600); background: var(--green-50); }
.tl-dot.red { border-color: var(--red-200); color: var(--red-600); background: var(--red-50); }
.tl-dot.amber { border-color: var(--amber-200); color: var(--amber-600); background: var(--amber-50); }
.tl-dot.violet { border-color: var(--violet-100); color: var(--violet-700); background: var(--violet-50); }
html.dark .tl-dot { background: var(--surface-3) !important; }
.tl-body { min-width: 0; flex: 1; padding-top: 5px; }
.tl-body .tl-title { font-size: 13px; font-weight: 600; }
.tl-body .tl-meta { font-size: 11.5px; color: var(--text-3); }
.tl-body .tl-text { margin-top: 6px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; white-space: pre-line; color: var(--text-2); }

/* ---------- Estrellas ---------- */
.stars { display: inline-flex; gap: 1px; color: var(--amber-500); font-size: 15px; letter-spacing: 1px; line-height: 1; }
.stars .off { color: var(--border-strong); }
.star-input { display: flex; justify-content: center; gap: 6px; padding: 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.star-input button { border: 0; background: none; cursor: pointer; font-size: 40px; line-height: 1; color: var(--border-strong); transition: transform .12s, color .12s; padding: 0 2px; }
.star-input button:hover { transform: scale(1.15); }
.star-input button.on { color: var(--amber-500); }
.star-input button:focus-visible { outline: 2px solid var(--brand-500); border-radius: 6px; }

/* ---------- Barras (reportes) ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 84px; align-items: center; gap: 12px; font-size: 13px; }
@media (min-width: 640px) { .bar-row { grid-template-columns: 110px minmax(0, 1fr) 96px 70px 70px; } }
.bar-row .bar-label { font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 26px; border-radius: 8px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--brand-500), var(--brand-600)); transition: width .5s cubic-bezier(.22,.61,.36,1); min-width: 2px; }
.bar-fill.over { background: linear-gradient(90deg, var(--amber-500), var(--orange-600)); }
.bar-track .bar-meta { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red-500); opacity: .7; }
.bar-row .bar-value { text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row .bar-extra { text-align: right; font-size: 12px; color: var(--text-3); display: none; }
@media (min-width: 640px) { .bar-row .bar-extra { display: block; } }
.dist-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 36px; gap: 12px; align-items: center; font-size: 12.5px; }
.dist-row .stars { justify-content: flex-start; white-space: nowrap; letter-spacing: 1px; }
.dist-row .bar-track { height: 10px; }
.dist-row .bar-fill { background: var(--amber-500); min-width: 0; }

/* ---------- Notificaciones flotantes ---------- */
.toasts { position: fixed; z-index: 120; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: #0f172a; color: #f1f5f9; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  animation: toastIn .35s cubic-bezier(.22,.61,.36,1);
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success svg { color: #4ade80; }
.toast.error { background: #7f1d1d; }
.toast.error svg { color: #fecaca; }
.toast.warning svg { color: #fbbf24; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }
html.dark .toast { background: #1e293b; border: 1px solid var(--border-strong); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   PÁGINAS
   ========================================================================== */

/* ---------- Inicio ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 36px 26px;
  background: radial-gradient(1200px 400px at 85% -10%, rgba(255,255,255,.18), transparent 60%),
              linear-gradient(135deg, var(--brand-800) 0%, var(--brand-600) 55%, #3f78ee 100%);
  color: #fff; box-shadow: 0 24px 60px -30px rgba(35,71,156,.8);
}
html.dark .hero { background: radial-gradient(1000px 400px at 85% -10%, rgba(93,139,243,.18), transparent 60%), linear-gradient(135deg, #0d1a3f 0%, #17357f 60%, #1f4bb4 100%); }
@media (min-width: 768px) { .hero { padding: 56px 56px; } }
.hero-grid { position: relative; display: grid; gap: 34px; align-items: center; }
@media (min-width: 1024px) { .hero-grid { grid-template-columns: 1.25fr .75fr; } }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.hero .eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.2); }
.hero h2 { margin-top: 18px; font-family: var(--font-display); font-size: clamp(30px, 5vw, 50px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; color: #fff; }
.hero h2 em { font-style: normal; background: linear-gradient(90deg, #fde68a, #fff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { margin-top: 16px; max-width: 560px; font-size: 16px; line-height: 1.6; color: rgba(255,255,255,.85); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero .btn-cta { --b-bg: #fde047; --b-fg: #1c1600; --b-bd: #fde047; --b-hover: #facc15; height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; box-shadow: 0 12px 30px -12px rgba(250,204,21,.8); }
.hero .btn-outline { --b-bg: rgba(255,255,255,.08); --b-fg: #fff; --b-bd: rgba(255,255,255,.35); --b-hover: rgba(255,255,255,.16); height: 48px; padding: 0 20px; font-size: 15px; border-radius: 13px; }
.hero-logo { position: relative; justify-self: center; width: min(320px, 78vw); aspect-ratio: 1; display: grid; place-items: center; }
.hero-logo::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.28), transparent 70%); filter: blur(10px); }
.hero-logo .tile { position: relative; width: 82%; aspect-ratio: 1; border-radius: 36px; background: #fff; display: grid; place-items: center; padding: 14%; box-shadow: 0 30px 60px -25px rgba(10,20,50,.7); animation: float 7s ease-in-out infinite; }
.hero-logo .tile::after { content: ""; position: absolute; inset: -8px; border-radius: 42px; border: 2px dashed rgba(255,255,255,.35); }
@keyframes float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(-1deg); } }
.hero-deco { position: absolute; border-radius: 50%; pointer-events: none; }
.hero-deco.a { width: 340px; height: 340px; right: -120px; bottom: -160px; background: rgba(219,20,127,.22); filter: blur(60px); }
.hero-deco.b { width: 300px; height: 300px; left: -120px; top: -140px; background: rgba(0,166,80,.22); filter: blur(60px); }

.features { display: grid; gap: 16px; margin-top: 22px; }
@media (min-width: 768px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 22px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .f-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; }
.feature .f-icon svg { width: 22px; height: 22px; }
.feature h3 { font-size: 15px; font-weight: 700; }
.feature p { margin-top: 6px; color: var(--text-2); font-size: 13.5px; }

.steps { display: grid; gap: 14px; margin-top: 22px; counter-reset: paso; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { position: relative; padding: 18px; border-radius: var(--radius-lg); border: 1px dashed var(--border-strong); }
.step::before { counter-increment: paso; content: counter(paso); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-600); color: #fff; font-weight: 800; font-size: 13px; margin-bottom: 10px; }
.step h4 { font-size: 14px; }
.step p { margin-top: 4px; font-size: 13px; color: var(--text-2); }

/* ---------- Páginas de acceso (login, encuesta) ---------- */
.auth-page { min-height: 100vh; display: grid; }
@media (min-width: 960px) { .auth-page { grid-template-columns: 1.05fr 1fr; } }
.auth-aside { display: none; position: relative; overflow: hidden; padding: 48px; color: #fff;
  background: radial-gradient(900px 400px at 100% 0%, rgba(255,255,255,.15), transparent 60%), linear-gradient(150deg, var(--brand-900), var(--brand-600)); }
@media (min-width: 960px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside .brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.auth-aside .brand img { width: 44px; height: 44px; border-radius: 12px; }
.auth-aside h2 { font-family: var(--font-display); font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: #fff; }
.auth-aside p { margin-top: 14px; max-width: 420px; color: rgba(255,255,255,.8); font-size: 15px; line-height: 1.6; }
.auth-aside .logo-tile { width: 150px; padding: 18px; border-radius: 24px; background: #fff; box-shadow: 0 20px 50px -20px rgba(0,0,0,.5); }
.auth-aside small { color: rgba(255,255,255,.6); }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .auth-logo { width: 120px; margin: 0 auto 22px; }
@media (min-width: 960px) { .auth-card .auth-logo { display: none; } }
.auth-card h1 { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-2); margin-top: 6px; margin-bottom: 26px; }
.pass-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.rel { position: relative; }

.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.public-top { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.public-top img { height: 34px; width: auto; }
.public-top .sep { width: 1px; height: 26px; background: var(--border); }
.public-top strong { font-family: var(--font-display); font-size: 14px; }
.public-top span { font-size: 12px; color: var(--text-3); }

/* ---------- Ticket creado / resultado ---------- */
.success-box { text-align: center; padding: 10px 0; }
.success-icon { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--green-50); color: var(--green-600); box-shadow: 0 0 0 10px color-mix(in srgb, var(--green-50) 50%, transparent); animation: pop .35s ease-out; }
.success-icon svg { width: 34px; height: 34px; }
.ticket-number { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 22px; padding: 18px 34px; border-radius: 18px; background: var(--brand-50); border: 1px dashed var(--brand-300); }
html.dark .ticket-number { background: rgba(74,124,238,.1); border-color: rgba(74,124,238,.35); }
.ticket-number small { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.ticket-number strong { font-family: var(--font-display); font-size: 32px; font-weight: 800; color: var(--brand-700); letter-spacing: .01em; }
html.dark .ticket-number strong { color: var(--brand-300); }

/* Progreso del ticket (consulta pública) */
.progress-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0; }
.progress-steps .ps { text-align: center; font-size: 12px; color: var(--text-3); font-weight: 600; }
.progress-steps .ps i { display: block; height: 6px; border-radius: 99px; background: var(--surface-3); margin-bottom: 8px; }
.progress-steps .ps.done i { background: var(--green-600); }
.progress-steps .ps.current i { background: var(--brand-600); }
.progress-steps .ps.fail i { background: var(--red-500); }
.progress-steps .ps.done, .progress-steps .ps.current { color: var(--text); }

/* Listas editables (configuración) */
.list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; font-weight: 500; }
.list-item .order { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; width: 22px; }
.list-item .actions { display: flex; gap: 2px; opacity: .65; }
.list-item:hover .actions { opacity: 1; }

/* Registros (alarmas) */
.log-item { display: flex; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.log-item:last-child { border-bottom: 0; }
.log-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.log-icon svg { width: 16px; height: 16px; }
.log-icon.ok { background: var(--green-50); color: var(--green-600); }
.log-icon.err { background: var(--red-50); color: var(--red-600); }
html.dark .log-icon { background: var(--surface-3) !important; }
.log-msg { margin-top: 4px; font-size: 12px; color: var(--text-3); word-break: break-word; }
.log-msg.err { font-family: var(--font-mono); color: var(--red-600); }
html.dark .log-msg.err { color: #f87171; }

/* Créditos */
.credits { text-align: center; }
.credits .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--brand-50); color: var(--brand-700); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
html.dark .credits .chip { background: rgba(74,124,238,.14); color: #9ab7fa; }
.credits h3 { margin-top: 16px; font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.credits .dev { display: flex; align-items: center; gap: 14px; margin: 22px 0 18px; padding: 14px; text-align: left; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); }
.credits .dev .avatar { width: 52px; height: 52px; font-size: 17px; }
.credits .dev small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brand-600); }

/* ==========================================================================
   UTILIDADES
   ========================================================================== */
.flex { display: flex; } .inline-flex { display: inline-flex; } .grid { display: grid; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; min-width: 0; } .shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; } .mx-auto { margin-left: auto; margin-right: auto; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; } .max-w-sm { max-width: 420px; } .max-w-md { max-width: 560px; } .max-w-lg { max-width: 760px; }
.text-center { text-align: center; } .text-right { text-align: right; }
.text-xs { font-size: 12px; } .text-sm { font-size: 13px; } .text-lg { font-size: 16px; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.muted { color: var(--text-3); } .text-2 { color: var(--text-2); }
.text-danger { color: var(--red-600); } .text-success { color: var(--green-600); } .text-warning { color: var(--amber-600); }
.mono { font-family: var(--font-mono); } .tabular { font-variant-numeric: tabular-nums; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pre-line { white-space: pre-line; }
.stack > * + * { margin-top: 18px; }
.stack-sm > * + * { margin-top: 10px; }
.grid-2 { display: grid; gap: 18px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2-1 { grid-template-columns: 1.6fr 1fr; } }
.grid-2 > * { min-width: 0; }
@media (max-width: 639px) { .hide-sm { display: none !important; } }
@media (max-width: 1023px) { .hide-md { display: none !important; } }
@media (max-width: 1279px) { .hide-lg { display: none !important; } }

/* ---------- Ajustes para teléfonos ---------- */
@media (max-width: 639px) {
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; gap: 4px; }
  .stat .stat-value { font-size: 22px; }
  .stat .stat-sub { display: none; }
  .stat .stat-label { font-size: 10.5px; }
  .stat .stat-icon { width: 24px; height: 24px; }
  .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex-shrink: 0; }
  .toolbar .select { flex: 1 1 45%; min-width: 0; }
  .date-range { width: 100%; }
  .date-range input { flex: 1; width: auto; min-width: 0; }
  .topbar-title h1 { font-size: 15px; }
  .page-head h2 { font-size: 19px; }
  .drawer-body, .drawer-head, .drawer-foot { padding-left: 16px; padding-right: 16px; }
}

.fade-up { animation: fadeUp .45s cubic-bezier(.22,.61,.36,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .footer, .toolbar, .btn, .backdrop { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
