/* ==========================================================================
   Kit de diseño Bogati — estilo común de TODOS los sistemas internos.
   No editar dentro de un sistema: se edita en "Diseño Bogati - Kit/kit" y se
   copia a cada sistema con `node copiar-kit.mjs`.
   Paneles de vidrio claros sobre un fondo cálido, bloques de distinto tamaño
   y el naranja de la marca (#FF982B) solo como acento. Modo claro y oscuro.
   Tipografía: Geist (texto y títulos) y Geist Mono (datos y rótulos).
   ========================================================================== */

@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400; font-display: swap; src: url(/kit/fuentes/geist-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 500; font-display: swap; src: url(/kit/fuentes/geist-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 600; font-display: swap; src: url(/kit/fuentes/geist-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 700; font-display: swap; src: url(/kit/fuentes/geist-sans-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/kit/fuentes/geist-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(/kit/fuentes/geist-mono-latin-500-normal.woff2) format('woff2'); }

/* ---------- tokens: modo claro ---------- */
:root {
  --naranja: #FF982B;
  --naranja-hover: #F58A17;
  --sobre-naranja: #2B1500;
  --cafe: #5F3000;
  --mono: 'Geist Mono', ui-monospace, Consolas, monospace;

  --bg: #F4EFE9;
  --mancha-1: rgb(255 166 77 / 34%);
  --mancha-2: rgb(255 214 170 / 60%);
  --mancha-3: rgb(160 100 50 / 12%);

  --vidrio: rgb(255 255 255 / 56%);
  --vidrio-fuerte: rgb(255 255 255 / 80%);
  --vidrio-borde: rgb(255 255 255 / 85%);
  --vidrio-luz: inset 0 1px 0 rgb(255 255 255 / 95%);
  --desenfoque: blur(24px) saturate(1.7);

  --surface: rgb(255 255 255 / 82%);
  --surface-2: rgb(255 255 255 / 45%);
  --surface-hover: rgb(255 255 255 / 70%);
  --border: rgb(80 45 10 / 10%);
  --border-strong: rgb(80 45 10 / 18%);
  --text: #22160B;
  --muted: #6E5A48;
  --subtle: #806B58;
  --marca-texto: #5F3000;
  --primary: #B05A00;            /* enlaces y foco: naranja oscurecido, legible sobre claro */
  --primary-soft: rgb(255 152 43 / 16%);
  --brillo: 0 6px 22px rgb(255 152 43 / 38%);

  --ok: #15803D;
  --ok-soft: rgb(21 128 61 / 11%);
  --warn: #9A5300;
  --warn-soft: rgb(217 119 6 / 13%);
  --danger: #B42318;
  --danger-soft: rgb(220 38 38 / 10%);
  --focus: #E07800;
  --shadow: 0 1px 2px rgb(90 45 0 / 5%), 0 12px 32px rgb(90 45 0 / 8%);
  --scrim: rgb(40 20 0 / 30%);
  --radius: 22px;
  --radius-sm: 12px;
  color-scheme: light;
}

/* ---------- tokens: modo oscuro ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0A07;
    --mancha-1: rgb(255 140 30 / 17%);
    --mancha-2: rgb(120 60 10 / 30%);
    --mancha-3: rgb(255 190 120 / 6%);
    --vidrio: rgb(30 21 14 / 58%);
    --vidrio-fuerte: rgb(40 29 20 / 78%);
    --vidrio-borde: rgb(255 255 255 / 8%);
    --vidrio-luz: inset 0 1px 0 rgb(255 255 255 / 6%);
    --surface: rgb(255 255 255 / 6%);
    --surface-2: rgb(255 255 255 / 4%);
    --surface-hover: rgb(255 255 255 / 8%);
    --border: rgb(255 255 255 / 8%);
    --border-strong: rgb(255 255 255 / 15%);
    --text: #F5EDE4;
    --muted: #BBA792;
    --subtle: #9A8571;
    --marca-texto: #F5EDE4;
    --primary: #FFAD5C;
    --primary-soft: rgb(255 152 43 / 16%);
    --brillo: 0 6px 26px rgb(255 152 43 / 45%);
    --ok: #6FD69A;
    --ok-soft: rgb(111 214 154 / 13%);
    --warn: #FFC56B;
    --warn-soft: rgb(255 197 107 / 13%);
    --danger: #FF8F84;
    --danger-soft: rgb(255 143 132 / 13%);
    --focus: #FFB366;
    --shadow: 0 12px 32px rgb(0 0 0 / 35%);
    --scrim: rgb(0 0 0 / 55%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0A07;
  --mancha-1: rgb(255 140 30 / 17%);
  --mancha-2: rgb(120 60 10 / 30%);
  --mancha-3: rgb(255 190 120 / 6%);
  --vidrio: rgb(30 21 14 / 58%);
  --vidrio-fuerte: rgb(40 29 20 / 78%);
  --vidrio-borde: rgb(255 255 255 / 8%);
  --vidrio-luz: inset 0 1px 0 rgb(255 255 255 / 6%);
  --surface: rgb(255 255 255 / 6%);
  --surface-2: rgb(255 255 255 / 4%);
  --surface-hover: rgb(255 255 255 / 8%);
  --border: rgb(255 255 255 / 8%);
  --border-strong: rgb(255 255 255 / 15%);
  --text: #F5EDE4;
  --muted: #BBA792;
  --subtle: #9A8571;
  --marca-texto: #F5EDE4;
  --primary: #FFAD5C;
  --primary-soft: rgb(255 152 43 / 16%);
  --brillo: 0 6px 26px rgb(255 152 43 / 45%);
  --ok: #6FD69A;
  --ok-soft: rgb(111 214 154 / 13%);
  --warn: #FFC56B;
  --warn-soft: rgb(255 197 107 / 13%);
  --danger: #FF8F84;
  --danger-soft: rgb(255 143 132 / 13%);
  --focus: #FFB366;
  --shadow: 0 12px 32px rgb(0 0 0 / 35%);
  --scrim: rgb(0 0 0 / 55%);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font: 400 15px/1.5 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(60vw 55vh at 88% -12%, var(--mancha-1), transparent 62%),
    radial-gradient(55vw 55vh at -12% 28%, var(--mancha-2), transparent 62%),
    radial-gradient(65vw 60vh at 55% 118%, var(--mancha-3), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.125rem; letter-spacing: -0.015em; }
h3 { font-size: 0.9375rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.small { font-size: 0.8125rem; }
.mono { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--subtle); }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--vidrio-fuerte); padding: 8px 12px; z-index: 100; border-radius: 10px; }
.skip-link:focus { left: 8px; }
.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; }

/* Panel de vidrio: base de menús, tarjetas y diálogos */
.vidrio, .card, .lateral, dialog {
  background: var(--vidrio);
  -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
  border: 1px solid var(--vidrio-borde);
  box-shadow: var(--vidrio-luz), var(--shadow);
}

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; font-size: 0.875rem; cursor: pointer; text-decoration: none !important;
  touch-action: manipulation; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .2s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--subtle); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--naranja); border-color: var(--naranja); color: var(--sobre-naranja); font-weight: 600; }
.btn-primary:hover { background: var(--naranja-hover); border-color: var(--naranja-hover); box-shadow: var(--brillo); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 0.8125rem; border-radius: 10px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tarjetas ---------- */
.card { border-radius: var(--radius); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.card-head h2 .ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }

/* ---------- formularios ---------- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 6px; color: var(--text); }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .field select {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--subtle); }
.field input:focus, .field select:focus { outline: none; border-color: var(--naranja); box-shadow: 0 0 0 4px var(--primary-soft); }
.field input[type="color"] { width: 100%; height: 44px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.help { font-size: 0.8125rem; color: var(--subtle); margin-top: 6px; }
.req { color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 0.9375rem; }
.check input { width: 18px; height: 18px; accent-color: var(--naranja); }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 50px !important; }
.pw-wrap button { position: absolute; right: 2px; top: 2px; width: 40px; height: 40px; border: 0; background: none; color: var(--subtle); cursor: pointer; border-radius: 10px; display: grid; place-items: center; }
.pw-wrap button:hover { color: var(--text); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 0.875rem; font-weight: 500; }
.alert svg { flex: none; margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-muted::before { display: none; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- marca ---------- */
/* Logo oficial: isotipo naranja + palabra "bogati" (café en claro, crema en oscuro). Sin efectos. */
.marca { display: inline-flex; align-items: center; gap: 7px; color: var(--marca-texto); text-decoration: none !important; }
.marca svg { display: block; flex: none; width: auto; }
.marca .texto { display: inline-flex; align-items: center; gap: 9px; }
.marca .sub { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--subtle); padding-left: 9px; border-left: 1px solid var(--border-strong); margin-top: 3px; }

/* ==========================================================================
   Pantallas de acceso (ingresar, cambiar contraseña, sin acceso)
   Foto real de Bogati desenfocada al fondo + panel de vidrio al centro.
   ========================================================================== */
.acceso { min-height: 100dvh; display: flex; flex-direction: column; position: relative; isolation: isolate; overflow: hidden; }
.acceso-fondo { position: absolute; inset: -90px; z-index: -1; background: url(/kit/img/kiosko.jpg) center / cover; filter: blur(70px) sepia(0.45) saturate(1.5); opacity: 0.55; }
.acceso-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px; padding-top: max(22px, env(safe-area-inset-top)); }
.acceso-main { flex: 1; display: grid; place-items: center; padding: 12px 16px 24px; }
.acceso-panel { width: 100%; max-width: 440px; border-radius: 28px; padding: 32px; background: var(--vidrio-fuerte); }
.acceso-pre { margin: 0 0 10px; }
.acceso-titulo { font-size: clamp(1.7rem, 3vw, 2rem); letter-spacing: -0.035em; margin: 0 0 8px; }
.acceso-sub { color: var(--muted); margin: 0 0 24px; }
.acceso-pie { text-align: center; padding: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
@media (max-width: 640px) {
  .acceso-top { padding: 16px; }
  .acceso-panel { padding: 24px 20px; border-radius: 24px; }
}

/* ---------- pestañas (control segmentado de vidrio) ---------- */
.segmentos { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; margin-bottom: 16px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--vidrio); -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque); border: 1px solid var(--vidrio-borde); box-shadow: var(--vidrio-luz); }
.segmentos button { min-height: 38px; padding: 6px 16px; border-radius: 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.segmentos button:hover { color: var(--text); }
.segmentos button[aria-selected="true"] { background: var(--vidrio-fuerte); color: var(--text); box-shadow: var(--vidrio-luz), 0 4px 14px rgb(90 45 0 / 10%); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { font-family: var(--mono); font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--subtle); }
tbody tr { transition: background-color .15s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td .btn-row { flex-wrap: nowrap; justify-content: flex-end; }
.celda-persona { display: flex; align-items: center; gap: 10px; }
.mini-icono { width: 34px; height: 34px; border-radius: 11px; }

/* ---------- diálogos y avisos ---------- */
dialog {
  border-radius: var(--radius); background: var(--vidrio-fuerte); color: var(--text);
  padding: 24px; width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
}
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog[open] { animation: aparecer .2s ease-out; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
dialog h2 { font-size: 1.25rem; margin-bottom: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px;
  background: #22160B; color: #fff; z-index: 60; font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 12px 30px rgb(40 20 0 / 25%); animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Sistemas sueltos (abiertos solos o dentro del panel)
   ========================================================================== */
/* Barra superior de un sistema */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px; min-height: 60px;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--vidrio-fuerte); -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
  border-bottom: 1px solid var(--vidrio-borde); box-shadow: var(--vidrio-luz);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.015em; }
.topbar .brand svg { display: block; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 0.8125rem; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pestañas sueltas (mismo aspecto que .segmentos) */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; margin-bottom: 16px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--vidrio); -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque); border: 1px solid var(--vidrio-borde); box-shadow: var(--vidrio-luz); }
.tabs button { min-height: 38px; padding: 6px 16px; border-radius: 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--vidrio-fuerte); color: var(--text); box-shadow: var(--vidrio-luz), 0 4px 14px rgb(90 45 0 / 10%); }

/* Dentro del panel (iframe) el fondo es transparente: se ve el fondo del panel */
html.incrustado body { background: transparent; }
