/* base.css — sistema de diseño compartido ("Liga Nocturna").
   Tinta azul + papel crema + neón solo como acento. Tema oscuro por defecto; añade .light a cualquier
   contenedor para el tema papel (panel del negocio, secciones crema del sitio).
   Variables semánticas: --bg --surface --surface-2 --surface-3 --text --muted --border --accent --btn-bg --btn-fg */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,100..900&family=Figtree:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --ink: #07121d; --bg: #07121d; --bg-2: #0a1927; --surface: #0d1f31; --surface-2: #12293f; --surface-3: #1a3752;
  --text: #f1ebdc; --muted: #8fa4b9; --border: rgba(241, 235, 220, .11); --border-2: rgba(241, 235, 220, .22);
  --cyan: #38e8ef; --red: #ff3d5a; --amber: #ffc857; --green: #3ddc97; --maple: #e6b36a; --paper: #f3ecda;
  --accent: var(--cyan); --btn-bg: var(--cyan); --btn-fg: #042029;
  --font-display: 'Archivo', 'Arial Narrow', sans-serif; --font-body: 'Figtree', system-ui, sans-serif; --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --r-s: 10px; --r-m: 16px; --r-l: 24px; --ease: cubic-bezier(.2, .8, .2, 1);
}
.light {
  --bg: #f3ecda; --bg-2: #ece3cd; --surface: #fffdf6; --surface-2: #f8f1df; --surface-3: #efe5cd;
  --text: #14202e; --muted: #667080; --border: rgba(20, 32, 46, .12); --border-2: rgba(20, 32, 46, .24);
  --accent: #078a95; --btn-bg: #0c1d2e; --btn-fg: #f3ecda; --cyan: #0aa7b3; --green: #14935f; --amber: #b87a00; --red: #d62747;
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.55 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body::before { content: ''; position: fixed; inset: 0; z-index: 300; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
.no-scroll { overflow: hidden; }
::-webkit-scrollbar { width: 9px; height: 9px; } ::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 9px; } ::-webkit-scrollbar-track { background: transparent; }

/* Tipografía */
.display { font-family: var(--font-display); font-stretch: 72%; font-weight: 900; text-transform: uppercase; letter-spacing: -.005em; line-height: .92; }
.h1 { font-size: clamp(2.8rem, 8.5vw, 7rem); } .h2 { font-size: clamp(2.2rem, 5.5vw, 4.2rem); } .h3 { font-size: clamp(1.5rem, 3vw, 2.1rem); } .h4 { font-size: 1.25rem; }
.outline { color: transparent; -webkit-text-stroke: 2px currentColor; }
.eyebrow { font: 700 .74rem/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: .6rem; }
.eyebrow::before { content: ''; width: 22px; height: 2px; background: currentColor; }
.muted { color: var(--muted); } .mono { font-family: var(--font-mono); } .sm { font-size: .875rem; } .xs { font-size: .78rem; } .bold { font-weight: 700; } .tc { text-align: center; } .tr { text-align: right; }
.num { font-family: var(--font-display); font-stretch: 85%; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.text-red { color: var(--red); } .text-cyan { color: var(--cyan); } .text-green { color: var(--green); } .text-amber { color: var(--amber); }

/* Layout */
.container { width: min(1200px, 100% - 2.5rem); margin-inline: auto; }
.row { display: flex; align-items: center; gap: .75rem; } .col { display: flex; flex-direction: column; gap: .75rem; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .end { justify-content: flex-end; } .center { justify-content: center; } .top { align-items: flex-start; }
.g1 { gap: .4rem; } .g2 { gap: 1rem; } .g3 { gap: 1.5rem; } .g4 { gap: 2.25rem; }
.mt1 { margin-top: .5rem; } .mt2 { margin-top: 1rem; } .mt3 { margin-top: 1.75rem; } .mt4 { margin-top: 3rem; }
.grid { display: grid; gap: 1rem; } .g-2 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(3, 1fr); } .g-4 { grid-template-columns: repeat(4, 1fr); }
.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hr { height: 1px; background: var(--border); border: 0; margin: 1rem 0; }
.i { flex: none; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .8rem 1.2rem; border-radius: 12px; border: 1.5px solid transparent; font: 700 .9rem/1.1 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer; transition: transform .12s var(--ease), box-shadow .12s, background .15s, border-color .15s; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); box-shadow: 0 3px 0 rgba(0, 0, 0, .38); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0, 0, 0, .38); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .38); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); } .btn-red:hover { transform: translateY(-1px); } .btn-red:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text); } .btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--surface-2); color: var(--text); } .btn-soft:hover { background: var(--surface-3); }
.btn-sm { padding: .5rem .8rem; font-size: .8rem; border-radius: 10px; } .btn-lg { padding: 1.05rem 1.7rem; font-size: 1rem; border-radius: 14px; } .btn-block { width: 100%; }
.btn-icon { padding: .6rem; border-radius: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Chips, puntos de estado, etiquetas */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border-radius: 99px; font: 700 .72rem/1.3 var(--font-body); letter-spacing: .02em; white-space: nowrap;
  --c: var(--muted); color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.chip.ok { --c: var(--green); } .chip.warn { --c: var(--amber); } .chip.bad { --c: var(--red); } .chip.info { --c: var(--cyan); } .chip.mute { --c: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.warn { background: var(--amber); } .dot.info { background: var(--cyan); }
.dot.live { animation: ping 1.8s infinite; box-shadow: 0 0 0 0 currentColor; color: var(--green); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }
.tag { font: 500 .72rem var(--font-mono); padding: .15rem .45rem; border-radius: 6px; background: var(--surface-3); color: var(--muted); }

/* Superficies */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); }
.pad { padding: 1.25rem; } .pad-l { padding: 1.75rem; } .pad-s { padding: .85rem; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-h h3 { font: 800 1rem var(--font-body); }
.soft { background: var(--surface-2); border-radius: var(--r-s); }
.ticket { --n: 62%; position: relative; background: var(--surface); border: 0; border-radius: var(--r-m);
  -webkit-mask: radial-gradient(circle 11px at 0 var(--n), #0000 98%, #000) left/51% 100% no-repeat, radial-gradient(circle 11px at 100% var(--n), #0000 98%, #000) right/51% 100% no-repeat;
  mask: radial-gradient(circle 11px at 0 var(--n), #0000 98%, #000) left/51% 100% no-repeat, radial-gradient(circle 11px at 100% var(--n), #0000 98%, #000) right/51% 100% no-repeat; }
.perf { border-top: 2px dashed var(--border-2); margin: 0; }
.stamp { display: inline-block; font: 900 1.05rem var(--font-display); font-stretch: 70%; text-transform: uppercase; letter-spacing: .06em; padding: .3rem .8rem; border: 3px solid var(--green); color: var(--green); border-radius: 6px; transform: rotate(-6deg); opacity: .95; }
.stamp.red { border-color: var(--red); color: var(--red); }

/* Formularios */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field > label, .lbl { font: 700 .72rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.in, .field input, .field select, .field textarea { width: 100%; padding: .75rem .9rem; border-radius: 12px; border: 1.5px solid var(--border-2); background: var(--surface-2); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.in::placeholder, input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 700 .82rem var(--font-body); padding: .5rem .9rem; border-radius: 9px; }
.seg button.on { background: var(--btn-bg); color: var(--btn-fg); }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border-2); border-radius: 12px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--surface-2); display: grid; place-items: center; } .stepper button:hover { background: var(--surface-3); }
.stepper b { min-width: 44px; text-align: center; font: 800 1.1rem var(--font-display); }
.switch { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 0; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch.on { background: var(--green); } .switch.on::after { transform: translateX(18px); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan), var(--accent)); transition: width .6s var(--ease); }

/* Tablas */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font: 700 .68rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; } .tbl tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); } .tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; } .tbl-wrap { overflow-x: auto; }

/* KPI */
.kpi { padding: 1.1rem 1.25rem; } .kpi .k { font: 700 .7rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font: 800 clamp(1.7rem, 3vw, 2.4rem)/1.05 var(--font-display); font-stretch: 80%; margin-top: .4rem; letter-spacing: -.01em; } .kpi .d { margin-top: .5rem; font-size: .8rem; color: var(--muted); }

/* Avatares */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font: 800 .78rem var(--font-body); color: #07121d; }
.avatar.a0 { background: #38e8ef; } .avatar.a1 { background: #ffc857; } .avatar.a2 { background: #ff8fa1; } .avatar.a3 { background: #7ee0b0; } .avatar.a4 { background: #b9a7ff; } .avatar.a5 { background: #f0a96b; }
.avatar.lg { width: 52px; height: 52px; font-size: 1rem; } .avatar.sm { width: 28px; height: 28px; font-size: .68rem; }

/* Modal / hoja */
.modal-wrap { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 1rem; background: rgba(3, 9, 15, .72); backdrop-filter: blur(5px); opacity: 0; transition: opacity .2s; }
.modal-wrap.in { opacity: 1; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--r-l); box-shadow: 0 40px 100px rgba(0, 0, 0, .55); transform: translateY(14px) scale(.98); transition: transform .28s var(--ease); }
.modal-wrap.in .modal { transform: none; } .modal.wide { width: min(860px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-b { padding: 1.4rem; } .modal-f { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: space-between; position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 640px) { .modal-wrap { place-items: end center; padding: 0; } .modal { border-radius: var(--r-l) var(--r-l) 0 0; max-height: 94dvh; width: 100%; } }

/* Toasts y confeti */
#toasts { position: fixed; z-index: 250; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem; align-items: flex-end; pointer-events: none; }
.toast { display: flex; gap: .7rem; align-items: flex-start; max-width: 360px; padding: .8rem 1rem; border-radius: 14px; background: #12293f; color: #f1ebdc; border: 1px solid rgba(241, 235, 220, .16); box-shadow: 0 14px 40px rgba(0, 0, 0, .45); font-size: .88rem; transform: translateY(12px); opacity: 0; transition: .3s var(--ease); }
.toast.in { transform: none; opacity: 1; } .toast b { display: block; font-size: .9rem; } .toast span { color: #c4d1de; }
.toast-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--green) 25%, transparent); color: var(--green); flex: none; }
.toast.bad .toast-ic { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); } .toast.info .toast-ic { background: color-mix(in srgb, var(--cyan) 22%, transparent); color: var(--cyan); }
.toast.warn .toast-ic { background: color-mix(in srgb, var(--amber) 25%, transparent); color: var(--amber); }
@media (max-width: 640px) { #toasts { left: 1rem; right: 1rem; bottom: 5.5rem; align-items: stretch; } .toast { max-width: none; } }
.confetti { position: fixed; inset: 0; z-index: 400; pointer-events: none; }

/* Utilidades responsive */
@media (max-width: 860px) { .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); } .hide-sm { display: none !important; } }
@media (max-width: 560px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } .container { width: min(1200px, 100% - 2rem); } }
@media (min-width: 861px) { .only-sm { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
