:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1c1f24;
  --muted: #646b76;
  --border: #dde1e6;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --mine: #2f5bd3;
  --mine-text: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e3f4ea;
  --warn: #9a5b00;
  --warn-bg: #fdf0d9;
  --bad: #b3261e;
  --bad-bg: #fbe4e2;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --surface: #1b1e24;
    --surface-2: #252932;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --border: #2f343e;
    --accent: #6d8ff0;
    --accent-text: #0d1220;
    --mine: #3b5fc9;
    --mine-text: #ffffff;
    --ok: #6fd39b;
    --ok-bg: #173826;
    --warn: #f2bd63;
    --warn-bg: #3a2c12;
    --bad: #f28b82;
    --bad-bg: #42201e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 14px;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: default; }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--bad); }
.hidden { display: none !important; }

/* ---------- Encabezado ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; }
.topbar .who { color: var(--muted); font-size: 14px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 20px; }
.login-card label { display: block; font-size: 14px; margin: 12px 0 4px; color: var(--muted); }
.login-card input { width: 100%; }
.login-card button { width: 100%; margin-top: 20px; padding: 10px; }

/* ---------- Chat ---------- */
.chat-page { display: flex; flex-direction: column; height: 100%; max-width: 720px; margin: 0 auto; background: var(--bg); }
.period {
  margin: 12px 16px 0; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px;
}
.period strong { font-size: 16px; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--mine); color: var(--mine-text); border-color: var(--mine); border-bottom-right-radius: 4px; }
.msg.me img { display: block; max-width: 220px; max-height: 260px; border-radius: 10px; }
.msg .time { display: block; font-size: 12px; opacity: .75; margin-top: 4px; }
.msg.typing { color: var(--muted); }
.composer {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.composer .preview { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); font-size: 14px; }
.composer .preview img { height: 48px; width: 48px; object-fit: cover; border-radius: 8px; }
.composer .preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Panel ---------- */
.admin-main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 10px 14px; white-space: nowrap; color: var(--muted); }
.tabs button.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 600; text-align: center; margin-left: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; cursor: zoom-in; display: block; background: var(--surface-2); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 13px; white-space: nowrap; }
.pill.pendiente { background: var(--surface-2); color: var(--muted); }
.pill.aprobado { background: var(--ok-bg); color: var(--ok); }
.pill.rechazado { background: var(--bad-bg); color: var(--bad); }
.pill.sospechoso { background: var(--warn-bg); color: var(--warn); }
.reasons { margin: 4px 0 0; padding-left: 18px; color: var(--warn); font-size: 14px; }
.amount-input { width: 90px; text-align: right; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.new-user { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.notice { background: var(--ok-bg); color: var(--ok); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.notice code { font-size: 16px; font-weight: 700; user-select: all; }

/* ---------- Visor de imagen ---------- */
dialog.viewer { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog.viewer::backdrop { background: rgba(0, 0, 0, .8); }
dialog.viewer img { max-width: 96vw; max-height: 88vh; display: block; border-radius: 8px; }
dialog.viewer .viewer-bar { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }

@media (max-width: 640px) {
  .msg { max-width: 90%; }
  .card .value { font-size: 20px; }
  .hide-sm { display: none; }
}

/* ---------- Tema vidrio (chat, login y panel): fondo negro + superficies difuminadas ---------- */
body.glass {
  --g-text: #f2efe8;
  --g-muted: rgba(242, 239, 232, .6);
  --g-surface: rgba(255, 255, 255, .06);
  --g-surface-hover: rgba(255, 255, 255, .1);
  --g-border: rgba(255, 255, 255, .12);
  --g-blur: blur(22px) saturate(150%);
  /* Los colores base también pasan a vidrio, así todos los componentes se adaptan. */
  --bg: #000;
  --surface: var(--g-surface);
  --surface-2: rgba(255, 255, 255, .04);
  --text: var(--g-text);
  --muted: var(--g-muted);
  --border: var(--g-border);
  --accent: #f2efe8;
  --accent-text: #111;
  --ok: #7fd6a4;
  --ok-bg: rgba(127, 214, 164, .14);
  --warn: #f0c27a;
  --warn-bg: rgba(240, 194, 122, .14);
  --bad: #f19a92;
  --bad-bg: rgba(241, 154, 146, .14);
  background: #000;
  color: var(--g-text);
  color-scheme: dark;
}
/* Luces tenues detrás: sin algo detrás, el difuminado sobre negro puro no se notaría. */
body.glass::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 30% at 25% 30%, rgba(214, 170, 92, .16), transparent 70%),
    radial-gradient(35% 28% at 78% 62%, rgba(70, 120, 140, .18), transparent 70%),
    radial-gradient(30% 22% at 50% 95%, rgba(214, 170, 92, .10), transparent 70%);
  filter: blur(40px);
}
.glass .chat-page, .glass .login-wrap { background: transparent; }

.glass .topbar,
.glass .period,
.glass .msg.bot,
.glass .composer,
.glass .login-card {
  background: var(--g-surface);
  -webkit-backdrop-filter: var(--g-blur);
  backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 30px rgba(0, 0, 0, .35);
  color: var(--g-text);
}
.glass .topbar { border-width: 0 0 1px; box-shadow: none; }
.glass .topbar a, .glass button.link { color: var(--g-text); opacity: .85; }
.glass .muted, .glass .topbar .who, .glass .msg.typing { color: var(--g-muted); }
.glass .period { border-radius: 18px; }

.glass .msg.bot { border-radius: 20px 20px 20px 6px; }
.glass .msg.me {
  background: rgba(242, 239, 232, .14);
  -webkit-backdrop-filter: var(--g-blur);
  backdrop-filter: var(--g-blur);
  border: 1px solid rgba(242, 239, 232, .22);
  color: var(--g-text);
  border-radius: 20px 20px 6px 20px;
}

/* La barra de envío flota como una cápsula, igual que el campo de la referencia. */
.glass .composer {
  margin: 0 12px calc(12px + env(safe-area-inset-bottom));
  padding: 8px 8px 8px 10px;
  border-radius: 999px;
}
.glass .composer .preview { color: var(--g-muted); }
.glass button, .glass input {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  color: var(--g-text);
  border-radius: 999px;
}
.glass button:hover { background: var(--g-surface-hover); }
.glass button.primary {
  background: rgba(242, 239, 232, .9);
  border-color: transparent;
  color: #111;
}
.glass button.primary:disabled { background: rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .55); opacity: 1; }
.glass button.link { background: none; border: 0; }
.glass input::placeholder { color: var(--g-muted); }
.glass .login-card { border-radius: 24px; }
.glass .login-card input { border-radius: 12px; padding: 10px 14px; }
/* La cápsula flota sobre los mensajes para que se vea el difuminado al desplazarse. */
.glass .chat-page { position: relative; }
.glass .messages { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.glass .composer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; }
/* Vidrio oscuro: legible aunque pase una foto blanca por detrás. */
.glass .composer { background: rgba(24, 26, 30, .62); }

/* Botones redondos con ícono (+ para agregar foto, flecha para enviar). */
.icon-btn {
  flex: none;
  width: 44px; height: 44px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
}
.glass .composer .icon-btn {
  background: rgba(255, 255, 255, .14);
  border: 0;
  color: var(--g-text);
}
.glass .composer .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.glass .composer .icon-btn.send:not(:disabled) { background: rgba(242, 239, 232, .9); color: #111; }
.glass .composer .icon-btn:disabled { opacity: .45; }
.glass .composer { padding: 6px; gap: 10px; }

/* ---------- Panel con tema vidrio ---------- */
.glass .card,
.glass .table-wrap,
.glass .notice {
  background: var(--g-surface);
  -webkit-backdrop-filter: var(--g-blur);
  backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-border);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 30px rgba(0, 0, 0, .35);
}
.glass .topbar { position: sticky; top: 0; z-index: 5; }
.glass th { background: rgba(255, 255, 255, .04); }
.glass .tabs { border-bottom-color: var(--g-border); }
.glass .tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.glass .tabs button.active { border-bottom-color: var(--g-text); }
.glass .tabs button:hover { background: none; color: var(--g-text); }
.glass select, .glass input[type="date"], .glass input[type="number"] {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--g-text);
}
.glass .amount-input { border-radius: 10px; padding: 6px 10px; }
.glass select option { background: #1a1c20; color: var(--g-text); }
.glass .admin-main button:not(.link) { border-radius: 999px; }
.glass .badge { background: #e5675c; }
.glass dialog.viewer .viewer-bar a { color: var(--g-text); }
.glass .admin-main h3 { font-weight: 600; }
.glass .admin-main .tabs button { border-radius: 0; }

/* Logo en el inicio de sesión */
.login-card .login-logo { margin: 4px 0 18px; line-height: 0; }
.login-card .login-logo img { display: block; width: 100%; height: auto; }
.login-card .login-logo + p { text-align: center; }

/* Pie de página */
.site-footer { text-align: center; font-size: 13px; color: var(--muted); padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); letter-spacing: .02em; }
.site-footer.fixed { position: fixed; left: 0; right: 0; bottom: 0; padding-top: 0; }

/* Logo en la barra del chat */
.topbar .topbar-logo { line-height: 0; }
.topbar .topbar-logo img { height: 24px; width: auto; display: block; }

/* Interruptor de recepción (panel) */
.recepcion { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.recepcion-title { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.recepcion .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); flex: none; }
.recepcion.abierta .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }

/* Chat bloqueado */
.composer .locked-note { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 0 6px; min-width: 0; }
.composer .locked-note svg { flex: none; }
.composer.locked .icon-btn, .composer.locked .preview { display: none; }
.composer:not(.locked) .locked-note { display: none; }
.glass .composer.locked { padding: 12px 18px; }

/* Confirmación dentro de la página y avisos */
.confirm-inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
button.danger { background: var(--bad); border-color: var(--bad); color: #111; }
button.danger:hover { background: var(--bad); filter: brightness(1.1); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: rgba(30, 32, 36, .9); color: #f2efe8; border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); font-size: 14px;
}
.toast.error { border-color: rgba(241, 154, 146, .5); }

/* ---------- Carrusel de marcas (inicio de sesión) ---------- */
.glass .login-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; padding-bottom: 64px; }
.brands { width: 100vw; display: grid; gap: 22px; }
.marquee {
  overflow: hidden;
  /* Desvanecido en los bordes, como en la referencia. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}
.marquee .track { display: flex; width: max-content; animation: marquee-left 30s linear infinite; }
.marquee .track[data-dir="right"] { animation-name: marquee-right; }
.marquee .group { display: flex; flex: none; }
@keyframes marquee-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes marquee-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .marquee .track { animation: none; } }

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 44px; height: 30px;
  color: #c9b48f; /* dorado tenue */
  font-size: 18px; font-weight: 500; white-space: nowrap;
  opacity: .85;
}
.brand-abr { font-weight: 700; letter-spacing: .14em; }
.brand-abr small { font-size: 11px; font-weight: 600; letter-spacing: .2em; opacity: .8; }
.brand-claude svg { flex: none; }
body.glass { overflow-x: hidden; }

/* Ajustes: marcas más pequeñas y pasando por detrás de la tarjeta de inicio de sesión. */
.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; }
.login-card .lead { text-align: center; margin: 4px 0 8px; }
.glass .login-wrap { position: relative; padding-bottom: 16px; }
.glass .login-card { position: relative; z-index: 1; }
.brands {
  position: fixed; left: 0; top: 50%; z-index: 0;
  transform: translateY(-50%);
  gap: 18px;
  pointer-events: none;
}
.brand { font-size: 15px; height: 24px; padding: 0 34px; gap: 6px; }
.brand-abr small { font-size: 9px; }
.brands .marquee { -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); }
.login-card .login-logo.small-logo { margin: 2px auto 14px; max-width: 190px; }
.topbar .panel-brand { display: flex; align-items: center; gap: 12px; line-height: 1; }
.topbar .panel-brand span { font-size: 14px; font-weight: 500; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--border); }

/* Selectores: flecha propia con espacio a la derecha para que no toque el borde redondeado. */
.glass select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23f2efe8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  cursor: pointer;
}

/* Pregunta con botones dentro del chat */
.msg .choices { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.msg .choice { border-radius: 999px; padding: 7px 14px; font-size: 14px; }
.glass .msg .choice { background: rgba(255, 255, 255, .1); border: 1px solid var(--g-border); color: var(--g-text); }
.glass .msg .choice.primary { background: rgba(242, 239, 232, .9); color: #111; border-color: transparent; }
.msg .choice:disabled { opacity: .45; cursor: default; }
.pill.confirmado { background: rgba(140, 170, 255, .16); color: #a9bcff; }
.toast.ok { border-color: rgba(127, 214, 164, .5); }

/* Fechas del periodo junto al botón de abrir recepción */
.rec-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-fechas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-fechas input[type="date"] { padding: 7px 12px; }
.glass optgroup { background: #1a1c20; color: var(--g-muted); font-style: normal; }

/* Alertas: el texto alineado con el resto de la columna y el punto colgando por fuera. */
.reasons { padding-left: 0; margin-left: 0; list-style-position: outside; }
.reasons li { margin-left: 0; }

/* Aprobar y Rechazar del mismo tamaño */

/* Panel: ocupa casi todo el ancho de la ventana, con un margen pequeño y parejo a ambos lados. */
.admin-main { max-width: none; padding: 20px clamp(16px, 2.5vw, 40px); }

/* Botón destructivo con borde */
.glass .admin-main button.danger-outline { border-color: rgba(241, 154, 146, .45); color: var(--bad); }
.glass .admin-main button.danger-outline:hover { background: var(--bad-bg); }
.confirm-inline > span { max-width: 360px; }

/* Detalle de reservas leídas por la IA (panel) */
.cobros { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 4px; }
.cobros li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); font-size: 13px; }
.cobros li .muted { grid-column: 1; font-size: 12px; }
.cobros li strong { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-variant-numeric: tabular-nums; }

/* Instrucción fija arriba del chat del empleado */
.instruccion {
  margin: 10px 16px 0; padding: 10px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.45; color: var(--g-muted, var(--muted));
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border); border-radius: 14px;
}
.instruccion svg { flex: none; margin-top: 2px; color: #c9b48f; }
.instruccion strong { color: var(--g-text, var(--text)); font-weight: 600; }


/* ==========================================================================
   Mejoras de accesibilidad y CSS moderno (revisión con modern-web-guidance)
   ========================================================================== */

/* --- Pestañas: estado desde aria-selected; subrayado con borde en un pseudo-elemento
       (no box-shadow/fondo, que desaparecen en modo de alto contraste) y sin cambiar tamaños. --- */
.tabs button { position: relative; font-weight: 500; }
.glass .tabs button, .glass .tabs button.active { border-bottom: 0; font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; inset-inline: 8px; inset-block-end: -1px;
  border-block-end: 2px solid currentColor; border-radius: 2px;
}
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
[role="tabpanel"][hidden] { display: none !important; }

/* --- Diálogos modales nativos --- */
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { overflow: hidden; overscroll-behavior: contain; }
dialog.confirm {
  max-width: min(440px, calc(100vw - 32px)); padding: 22px 22px 18px;
  border: 1px solid var(--border); border-radius: 18px;
  background: #16181c; color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
dialog.confirm::backdrop { background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.confirm h2 { margin: 0 0 8px; font-size: 18px; }
dialog.confirm p { margin: 0 0 18px; color: var(--muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-actions button { border-radius: 999px; padding: 9px 18px; }
.glass .confirm-actions button { background: rgba(255, 255, 255, .08); border: 1px solid var(--border); color: var(--text); }
.glass .confirm-actions button.danger { background: var(--bad); border-color: var(--bad); color: #111; }
dialog.viewer .viewer-bar a { color: var(--g-text, #fff); }
dialog.viewer .viewer-bar button { border-radius: 999px; }

/* --- Avisos: un contenedor fijo (popover manual en la capa superior) que apila los avisos. --- */
.toast-region {
  position: fixed; inset: auto 16px 16px auto; margin: 0; padding: 0;
  border: 0; background: transparent; overflow: visible;
  width: min(420px, calc(100vw - 32px));
  display: none; flex-direction: column; gap: 8px;
}
.toast-region:popover-open { display: flex; }
.toast-region .toast {
  position: static; transform: none; max-width: none;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 10px 10px 14px; font-size: 14px; line-height: 1.4;
  opacity: 1; translate: 0 0;
  transition: opacity .2s, translate .2s;
}
@starting-style { .toast-region .toast { opacity: 0; translate: 0 8px; } }
@media (prefers-reduced-motion: reduce) { .toast-region .toast { transition: none; } }
.toast-region .toast p { margin: 0; flex: 1; overflow-wrap: anywhere; }
.toast-close {
  flex: none; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1); border: 0; color: inherit; font-size: 18px; line-height: 1;
}

/* --- Tablas: contenedor desplazable con teclado y vista de tarjetas en espacios angostos. --- */
.table-wrap { container-type: inline-size; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@container (width < 600px) {
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { display: none; } /* los nombres de columna van en cada celda */
  .table-wrap tr { padding: 10px 4px; border-bottom: 1px solid var(--border); }
  .table-wrap tr:last-child { border-bottom: 0; }
  .table-wrap td { border: 0 !important; padding: 4px 12px; text-align: left !important; }
  .table-wrap td[data-label]:not(:first-child)::before {
    content: attr(data-label);
    display: block; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  }
  .table-wrap td.hide-sm { display: block; }
  .table-wrap .empty { text-align: center !important; }
}

/* --- Logo del carrusel: máscara CSS con el color exacto (antes, cadena de filtros aproximada). --- */
.brand-logo {
  display: inline-block; height: 17px; aspect-ratio: 1018 / 198;
  background-color: currentColor;
  -webkit-mask: url("/static/logo-stargate.png") no-repeat center / contain;
  mask: url("/static/logo-stargate.png") no-repeat center / contain;
}

/* --- Carrusel: se puede pausar (WCAG 2.2.2) y se detiene al escribir en el formulario. --- */
.brands.pausado .marquee .track,
.login-wrap:has(.login-card:focus-within) .marquee .track { animation-play-state: paused; }
.marquee-toggle {
  position: fixed; right: 16px; bottom: 14px; z-index: 2;
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
}
@media (prefers-reduced-motion: reduce) { .marquee-toggle { display: none; } }

/* Panel: en pantallas medianas y grandes ocupa ~81% del ancho, centrado. En pantallas angostas usa casi todo el ancho. */
@media (min-width: 900px) {
  .admin-main { width: 81%; max-width: 1600px; margin-inline: auto; padding-inline: 0; }
}

/* Columna Monto: encabezado y valor centrados; campo compacto con el símbolo $ dentro. */
th.monto, td.monto { text-align: center; white-space: nowrap; }
.amount-field {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 8px; border-radius: 8px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums; cursor: text;
}
.amount-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.amount-field span { color: var(--muted); font-size: 14px; }
.glass .amount-field .amount-input,
.amount-field .amount-input {
  width: 5.5ch; padding: 0; border: 0; border-radius: 0; background: transparent;
  text-align: left; font-size: 14px; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.amount-field .amount-input::-webkit-inner-spin-button,
.amount-field .amount-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
td.monto .muted { display: block; margin-top: 4px; }

/* Monto: alineado a la izquierda como los demás encabezados. */
th.monto, td.monto { text-align: left; }

/* Estado: encabezado, etiquetas y botones centrados sobre una misma línea vertical. */
th.estado, td.estado { text-align: center; }
td.estado .estado-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
td.estado .row-actions { flex-direction: column; align-items: center; margin-top: 8px; }
@container (width < 600px) {
  .table-wrap td.estado { text-align: left !important; }
  td.estado .estado-pills { justify-content: flex-start; }
  td.estado .row-actions { flex-direction: row; align-items: flex-start; }
}

/* Monto: centrado sobre su campo, igual que Estado (Empleado y Enviado quedan a la izquierda). */
th.monto, td.monto { text-align: center; }
@container (width < 600px) { .table-wrap td.monto { text-align: left !important; } }

/* Chat: la barra, la tarjeta del periodo y la instrucción mantienen su tamaño;
   solo el área de mensajes se achica y se desplaza (antes la instrucción se aplastaba
   y su texto se montaba encima de los mensajes). */
.chat-page > .topbar,
.chat-page > .period,
.chat-page > .instruccion { flex: none; }
.chat-page > .messages { min-height: 0; }
@media (max-width: 640px) {
  .instruccion { font-size: 12.5px; padding: 8px 12px; margin-top: 8px; }
}

/* Instrucción de comprobantes válidos como mensaje automático dentro del chat. */
.msg.instruccion-msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.instruccion-msg svg { flex: none; margin-top: 3px; color: #c9b48f; }
.msg.instruccion-msg strong { font-weight: 600; }

/* Visor de fotos: botón X fijo arriba a la derecha (siempre a la vista) y la foto
   cabe completa con su barra de abajo dentro de la pantalla. */
dialog.viewer { overflow: visible; }
dialog.viewer img { max-height: calc(100dvh - 120px); object-fit: contain; }
.viewer-x {
  position: fixed; z-index: 2;
  top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(30, 32, 36, .85); color: #f2efe8;
  border: 1px solid rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.viewer-x:hover { background: rgba(60, 62, 68, .95); }
.viewer-x:focus-visible { outline: 2px solid #f2efe8; outline-offset: 2px; }

/* Pestañas en pantallas angostas: solo se deslizan de izquierda a derecha.
   - overflow-y: hidden → no se mueven hacia arriba/abajo (antes el subrayado sobresalía 1 px y
     permitía arrastrar la barra en vertical).
   - overscroll-behavior-x: contain → al llegar al borde no "rebota" ni arrastra la página.
   - scroll-snap → al soltar, se acomoda en una pestaña. Sin barra de desplazamiento visible. */
.tabs {
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; scroll-snap-align: start; }
.tabs button[aria-selected="true"]::after { inset-block-end: 0; }
@media (max-width: 480px) {
  .tabs { gap: 0; }
  .tabs button { padding: 10px 11px; }
}

/* Vista previa de varias fotos en la barra de envío: miniaturas superpuestas. */
.composer .preview .preview-strip { display: flex; flex: none; }
.composer .preview .preview-strip img {
  width: 34px; height: 34px; object-fit: cover; border-radius: 8px;
  border: 2px solid rgba(24, 26, 30, .9);
}
.composer .preview .preview-strip img + img { margin-left: -14px; }
.composer .preview .preview-strip img:nth-child(n+5) { display: none; } /* se ven máx. 4 */

/* Versión en el pie de página */
.site-footer .version { display: block; margin-top: 2px; font-size: 11px; opacity: .75; letter-spacing: .04em; }

/* Varias fotos enviadas juntas: cuadrícula dentro de una sola burbuja */
.msg.me.fotos { padding: 6px; }
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; width: min(260px, 70vw); }
.fotos-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; display: block; max-width: none; max-height: none; }
.msg.me.fotos .time { padding: 2px 6px 0; }

/* Envío que la IA todavía está leyendo (panel) */
.pill.leyendo { background: rgba(140, 170, 255, .14); color: #a9bcff; }

/* ---------- Envíos agrupados (una fila por envío) ---------- */
.fila-envio:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mini-stack { display: flex; align-items: center; }
.mini-stack img {
  width: 40px; height: 52px; object-fit: cover; border-radius: 6px; display: block;
  border: 2px solid #16181c; background: var(--surface-2);
}
.mini-stack img + img { margin-left: -18px; }
.mini-stack .mas { margin-left: 6px; font-size: 12px; color: var(--muted); }
.aviso-sospecha { color: var(--warn); }
.ir-sospechosos { padding: 2px 0; font-size: 13px; text-decoration: underline; }
.glass .ir-sospechosos { color: var(--warn); }

/* Ventana con las fotos de un envío */
dialog.lote-dialog {
  width: min(1100px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  padding: 20px; border: 1px solid var(--border); border-radius: 18px;
  background: #121418; color: var(--text); overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
dialog.lote-dialog::backdrop { background: rgba(0, 0, 0, .65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.lote-head { padding-right: 56px; margin-bottom: 14px; }
.lote-head h2 { margin: 0 0 4px; font-size: 19px; }
.lote-head p { margin: 0; }
dialog.lote-dialog .thumb { width: 72px; height: 96px; }

/* Aprobar (chulo) y Rechazar (X): botones redondos con ícono, uno al lado del otro. */
td.estado .row-actions { flex-direction: row; justify-content: center; align-items: center; gap: 10px; }
.glass .admin-main .btn-ico, .btn-ico {
  width: 38px; height: 38px; padding: 0; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  border: 1.5px solid; background: transparent;
}
.btn-ico.aprobar { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.btn-ico.rechazar { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.btn-ico.aprobar:hover { background: var(--ok-bg); }
.btn-ico.rechazar:hover { background: var(--bad-bg); }
.btn-ico:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Chulo y X en gris, como el resto de los botones de la página. */
.glass .admin-main .btn-ico, .glass .btn-ico, .btn-ico.aprobar, .btn-ico.rechazar {
  color: var(--g-text, var(--text));
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
}
.btn-ico.aprobar:hover, .btn-ico.rechazar:hover { background: rgba(255, 255, 255, .12); }

/* Última recepción registrada (tarjeta de recepción cerrada) */
.rec-ultima { margin-top: 6px; color: var(--g-text, var(--text)); opacity: .85; }

/* Chat: las fotos enviadas se pueden tocar para verlas en grande. */
img.ampliable { cursor: zoom-in; }
img.ampliable:focus-visible { outline: 2px solid #f2efe8; outline-offset: 2px; }

/* Chat: visor en carrusel. Cada foto ocupa todo el ancho y se desliza con el dedo (scroll-snap). */
dialog.viewer.carrusel { width: min(96vw, 720px); }
.carrusel-pista {
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; touch-action: pan-x pinch-zoom; border-radius: 8px;
}
.carrusel-pista::-webkit-scrollbar { display: none; }
.carrusel-pista:focus-visible { outline: 2px solid #f2efe8; outline-offset: 2px; }
.carrusel-foto { flex: 0 0 100%; display: grid; place-items: center; scroll-snap-align: center; scroll-snap-stop: always; }
dialog.viewer .carrusel-foto img { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-select: none; }
.carrusel-nav { display: flex; align-items: center; gap: 10px; }
.carrusel-nav[hidden] { display: none; }
.carrusel-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(30, 32, 36, .85); color: #f2efe8; border: 1px solid rgba(255, 255, 255, .25);
  touch-action: manipulation; cursor: pointer;
}
.carrusel-btn:disabled { opacity: .35; cursor: default; }
.carrusel-btn:focus-visible { outline: 2px solid #f2efe8; outline-offset: 2px; }
.carrusel-cuenta { color: #f2efe8; font-variant-numeric: tabular-nums; min-width: 3.5em; text-align: center; }

/* =====================================================================
   Panel del administrador (1.23.26): menú lateral + saludo + tarjetas de cifras.
   Organización inspirada en tableros de consola; identidad Stargate (oscuro, vidrio, grises).
   ===================================================================== */
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.admin-col { display: flex; flex-direction: column; min-width: 0; }
.admin-shell .admin-main { width: auto; max-width: 1240px; margin: 0 auto; padding: 32px clamp(20px, 3vw, 48px) 8px; flex: 1; width: 100%; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px 14px; border-right: 1px solid var(--g-border);
  background: rgba(18, 19, 22, .55); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
}
.sidebar-brand { display: block; padding: 4px 10px 14px; }
.sidebar-brand img { width: 150px; height: auto; display: block; }
.side-label { margin: 10px 10px 4px; font-size: 12px; letter-spacing: .04em; color: var(--g-muted); }

.side-tabs.tabs { flex-direction: column; gap: 2px; border: 0; margin: 0; overflow: visible; }
.glass .side-tabs.tabs button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px;
  color: var(--g-muted); font-weight: 500; text-align: left;
}
.glass .side-tabs.tabs button:hover { background: var(--g-surface); color: var(--g-text); }
.glass .side-tabs.tabs button[aria-selected="true"] { background: var(--g-surface-hover); color: var(--g-text); }
.side-tabs.tabs button[aria-selected="true"]::after { display: none; }
.side-tabs.tabs button svg { flex: none; }
.side-tabs .badge { margin-left: auto; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--g-muted); text-decoration: none; }
.side-link:hover { background: var(--g-surface); color: var(--g-text); }
.side-link:focus-visible { outline: 2px solid var(--g-text); outline-offset: -2px; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--g-surface); border: 1px solid var(--g-border);
}
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--g-surface-hover); color: var(--g-text); font-weight: 600;
}
.side-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.side-user-text .who { color: var(--g-text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .link { font-size: 13px; }

/* Saludo con la acción principal a la derecha */
.saludo-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.saludo-bar h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 600; letter-spacing: -.01em; }
.saludo-bar p { margin: 4px 0 0; }

/* Tarjetas de cifras */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.glass .card.stat { border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 128px; }
.stat-label { color: var(--g-muted); font-size: 14px; }
.stat-value { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: auto; }
.stat-de { font-size: 16px; font-weight: 500; color: var(--g-muted); }
.stat-sub { min-height: 1.4em; }
.glass .card.stat-anillo { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.stat-anillo > div { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.anillo { flex: none; }
.anillo circle { fill: none; stroke-width: 6; }
.anillo-fondo { stroke: var(--g-border); }
.anillo-valor { stroke: var(--g-text); stroke-linecap: round; }

/* Gráfica de comprobantes por día */
.glass .card.chart-card { border-radius: 18px; padding: 18px 20px 14px; margin-bottom: 20px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-head h2 { margin: 0; font-size: 15px; font-weight: 500; color: var(--g-muted); }
.chart { position: relative; }
.chart-max { position: absolute; top: -2px; left: 0; font-variant-numeric: tabular-nums; }
.chart-barras { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding-top: 16px; border-bottom: 1px solid var(--g-border); }
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 3px; cursor: default; }
.chart-barra { width: 100%; max-width: 28px; margin: 0 auto; background: rgba(242, 239, 232, .55); border-radius: 4px 4px 0 0; transition: background .15s; }
.chart-col.activa .chart-barra { background: var(--g-text); }
.chart-eje { display: flex; gap: 2px; margin-top: 6px; }
.chart-eje span { flex: 1; min-width: 3px; white-space: nowrap; overflow: visible; text-align: center; }
.chart-eje span:first-child { text-align: left; }
.chart-eje span:last-child { text-align: right; }
.chart-tip {
  position: absolute; top: 4px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  padding: 4px 10px; border-radius: 8px; font-size: 13px; color: var(--g-text);
  background: rgba(30, 32, 36, .92); border: 1px solid var(--g-border);
}
.chart-vacio { margin: 8px 0 4px; }
@media (prefers-reduced-motion: reduce) { .chart-barra { transition: none; } }

/* Teléfono y tablet angosta: el menú lateral pasa a ser una barra arriba con las secciones deslizables. */
@media (max-width: 899px) {
  .admin-shell { display: block; }
  .sidebar {
    position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 6px 10px; padding: 10px 16px 0; border-right: 0; border-bottom: 1px solid var(--g-border);
  }
  .sidebar-brand { padding: 0; order: 1; }
  .sidebar-brand img { width: 118px; }
  .side-label { display: none; }
  .sidebar-foot { order: 2; margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 4px; }
  .side-link span, .side-user-text .muted { display: none; }
  .side-link { padding: 8px; }
  .side-user { background: none; border: 0; padding: 4px 0; gap: 8px; }
  .side-user .avatar { display: none; }
  .side-user-text .who { font-size: 13px; color: var(--g-muted); max-width: 90px; }
  .side-tabs.tabs { order: 3; flex: 1 0 100%; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .side-tabs.tabs::-webkit-scrollbar { display: none; }
  .glass .side-tabs.tabs button { width: auto; flex: none; padding: 8px 12px; gap: 8px; scroll-snap-align: start; }
  .admin-shell .admin-main { padding: 20px 16px 8px; }
  .saludo-bar { align-items: flex-start; }
}
@media (max-width: 599px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .glass .card.stat { min-height: 0; padding: 14px; }
  .stat-value { font-size: 24px; }
  .glass .card.stat-anillo { flex-direction: column; align-items: flex-start; gap: 6px; }
  .stat-anillo .anillo { width: 40px; height: 40px; order: -1; position: absolute; top: 12px; right: 12px; }
  .glass .card.stat-anillo { position: relative; padding-right: 58px; }
}

/* Menú lateral contraíble (1.24.26): en computador queda solo con íconos. */
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 2px; }
.sidebar-head .sidebar-brand { padding-bottom: 14px; }
.sidebar-brand .brand-mini { display: none; }
.glass .side-toggle {
  flex: none; width: 34px; height: 34px; padding: 0; margin-bottom: 14px; border-radius: 10px; display: grid; place-items: center;
  background: none; border: 1px solid transparent; color: var(--g-muted); cursor: pointer;
}
.glass .side-toggle:hover { background: var(--g-surface); color: var(--g-text); }
.side-toggle:focus-visible { outline: 2px solid var(--g-text); outline-offset: 2px; }
.admin-shell { transition: grid-template-columns .2s ease; }
@media (prefers-reduced-motion: reduce) { .admin-shell { transition: none; } }

@media (min-width: 900px) {
  .admin-shell.contraido { grid-template-columns: 72px minmax(0, 1fr); }
  .contraido .sidebar { padding-inline: 10px; align-items: center; }
  .contraido .sidebar-head { flex-direction: column; padding: 0; }
  .contraido .sidebar-head .sidebar-brand { padding: 0 0 6px; }
  .contraido .brand-full, .contraido .side-label,
  .contraido .side-tabs.tabs button > span:not(.badge), .contraido .side-link span,
  .contraido .side-user-text { display: none; }
  .contraido .sidebar-brand .brand-mini { display: block; width: 32px; height: 32px; border-radius: 8px; }
  .contraido .side-tabs.tabs { width: 100%; }
  .glass .contraido .side-tabs.tabs button { justify-content: center; padding: 10px; position: relative; }
  .contraido .side-tabs .badge { position: absolute; top: 2px; right: 4px; margin: 0; font-size: 10px; min-width: 16px; padding: 0 4px; }
  .contraido .sidebar-foot { width: 100%; align-items: center; }
  .contraido .side-link { justify-content: center; padding: 10px; width: 100%; }
  .contraido .side-user { padding: 6px 0; background: none; border: 0; flex-direction: column; gap: 4px; }
  .contraido .side-user .link { font-size: 12px; }
}
@media (max-width: 899px) { .side-toggle, .brand-mini { display: none !important; } }

/* Usuarios: chulito gris de "usuario especial" (1.25.26). No luce como botón: solo el ícono. */
.table-wrap td.col-especial, .table-wrap th.col-especial { width: 44px; text-align: center; padding-inline: 4px; }
.glass .admin-main button.chulito, button.chulito {
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; box-shadow: none;
  display: inline-grid; place-items: center; cursor: pointer; color: rgba(242, 239, 232, .22);
}
.glass .admin-main button.chulito:hover { background: none; color: rgba(242, 239, 232, .5); }
.glass .admin-main button.chulito[aria-pressed="true"] { color: rgba(242, 239, 232, .8); }
button.chulito:focus-visible { outline: 2px solid var(--g-text); outline-offset: 1px; }

/* Selector de recepción encima de las tarjetas del Resumen (1.26.26). */
.periodo-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.periodo-nav[hidden] { display: none; }
.periodo-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.periodo-txt strong { font-weight: 600; }
.glass .admin-main button.periodo-btn {
  flex: none; width: 36px; height: 36px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text); touch-action: manipulation;
}
.glass .admin-main button.periodo-btn:disabled { opacity: .3; cursor: default; }
.periodo-btn:focus-visible { outline: 2px solid var(--g-text); outline-offset: 2px; }

/* Reporte de pago (1.27.26): tabla editable con aspecto de documento. */
.rep-barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rep-barra p { margin: 0; }
.rep-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.glass .card.rep-doc { border-radius: 18px; padding: 24px clamp(16px, 3vw, 32px); max-width: 860px; }
.glass .rep-titulo {
  width: 100%; font-size: clamp(20px, 2.4vw, 26px); font-weight: 500; padding: 6px 8px; margin: 0 0 14px -8px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
}
.glass .rep-titulo:hover, .glass .rep-titulo:focus { border-color: var(--g-border); background: var(--g-surface); }
.rep-tabla { width: 100%; border-collapse: collapse; }
.rep-tabla th, .rep-tabla td { border: 1px solid var(--g-border); padding: 4px 8px; text-align: left; vertical-align: middle; }
.rep-tabla thead th { font-size: 13px; letter-spacing: .04em; padding-block: 10px; }
.rep-tabla th:nth-child(2), .rep-tabla td:nth-child(2) { width: 34%; }
.rep-tabla th:last-child, .rep-tabla td:last-child { width: 40px; border-left: 0; text-align: center; padding: 0; }
.rep-tabla td:nth-child(2) { border-right: 1px solid var(--g-border); }
.rep-tabla tfoot th, .rep-tabla tfoot td { padding-block: 10px; font-weight: 500; }
.rep-tabla tfoot td#rep-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.glass .rep-tabla input { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 6px; box-shadow: none; }
.glass .rep-tabla input:hover, .glass .rep-tabla input:focus { border-color: var(--g-border); background: var(--g-surface); }
.rep-monto { display: flex; align-items: center; gap: 2px; }
.rep-monto input { font-variant-numeric: tabular-nums; }
.rep-nota { display: block; padding: 0 6px 4px; }
.glass .admin-main .rep-agregar { margin: 12px 0 18px; }
.rep-notas-lbl { display: block; font-style: italic; color: var(--g-muted); margin-bottom: 6px; }
.glass #rep-notas { width: 100%; resize: vertical; border-radius: 12px; padding: 10px 12px; font: inherit; }

/* Menús desplegables (1.30.26): ⋯ de la recepción y menú del usuario. */
.menu-wrap { position: relative; }
.menu-wrap[hidden] { display: none; }
.menu {
  position: absolute; z-index: 30; min-width: 220px; padding: 6px; border-radius: 14px;
  background: rgba(28, 29, 33, .97); border: 1px solid var(--g-border); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
}
.menu[hidden] { display: none; }
.glass .menu .menu-item, .glass .admin-main .menu .menu-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 9px;
  background: none; color: var(--g-text); font: inherit; cursor: pointer;
}
.glass .menu .menu-item:hover, .glass .menu .menu-item:focus-visible { background: var(--g-surface-hover); outline: none; }
.glass .menu .menu-item.danger { color: var(--bad); }
#per-menu { top: calc(100% + 6px); left: 0; }

/* Cuadro del usuario: todo es un botón que abre su menú (arriba del cuadro). */
.glass button.side-user { width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.glass button.side-user:hover, .glass button.side-user[aria-expanded="true"] { background: var(--g-surface-hover); }
button.side-user:focus-visible { outline: 2px solid var(--g-text); outline-offset: 2px; }
.side-user-chev { flex: none; color: var(--g-muted); transition: transform .15s; }
.side-user[aria-expanded="false"] .side-user-chev { transform: rotate(180deg); }
#user-menu { bottom: calc(100% + 6px); left: 0; right: 0; }
@media (prefers-reduced-motion: reduce) { .side-user-chev { transition: none; } }
@media (min-width: 900px) {
  .contraido .side-user-chev { display: none; }
  .contraido #user-menu { left: calc(100% + 10px); bottom: 0; right: auto; }
}
@media (max-width: 899px) {
  .side-user-chev { display: none; }
  #user-menu { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; }
}

/* Ventana "Restaurar recepciones". */
.restaurar-dialog { width: min(92vw, 520px); }
.rest-lista { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.rest-lista li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--g-surface); border: 1px solid var(--g-border); }
.rest-lista li.muted { justify-content: center; }
.restaurar-dialog .viewer-x { position: absolute; top: 12px; right: 12px; }
/* El menú del usuario puede salir por fuera del menú lateral (contraído): que quede encima del contenido. */
.sidebar { z-index: 10; }

/* Menú del usuario (1.31.26): cuadro sombreado (rectángulo redondeado relleno, sin borde) y opciones con
   ícono; una línea separa "Cerrar sesión". */
.glass button.side-user { background: rgba(255, 255, 255, .07); border: 0; border-radius: 14px; padding: 10px 12px; }
.glass button.side-user:hover, .glass button.side-user[aria-expanded="true"] { background: rgba(255, 255, 255, .12); }
.glass .side-user .avatar { border-radius: 10px; background: rgba(255, 255, 255, .1); }
.glass .menu .menu-item:has(svg) { display: flex; align-items: center; gap: 12px; }
.menu-item svg { flex: none; color: var(--g-muted); }
.menu-item:hover svg, .menu-item:focus-visible svg { color: var(--g-text); }
.menu-sep { border: 0; border-top: 1px solid var(--g-border); margin: 6px 8px; }
@media (max-width: 899px) { .glass button.side-user { background: none; padding: 4px 0; } }
@media (min-width: 900px) { .contraido .glass button.side-user, .glass .contraido button.side-user { padding: 6px; } }
.menu .menu-item span { white-space: nowrap; }
@media (min-width: 900px) { .admin-shell:not(.contraido) #user-menu { right: auto; min-width: 100%; width: max-content; } }

/* Calendario de rango (1.32.26): vidrio oscuro, grises, un solo calendario para inicio y fin. */
.cal-wrap { position: relative; }
.glass .admin-main button.cal-trigger {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px; font-variant-numeric: tabular-nums;
}
.cal-trigger svg { color: var(--g-muted); }
.cal {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: 320px; max-width: calc(100vw - 32px);
  padding: 14px; border-radius: 18px; background: rgba(24, 25, 29, .97); border: 1px solid var(--g-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
}
.cal[hidden] { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.glass .admin-main button.cal-nav {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text);
}
.cal-ayuda { margin: 6px 0 8px; min-height: 1.4em; }
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 0 3px; table-layout: fixed; }
.cal-grid th { font-size: 12px; font-weight: 500; color: var(--g-muted); padding: 4px 0; text-align: center; }
.cal-grid td { padding: 0; text-align: center; }
.glass .admin-main button.cal-dia {
  width: 100%; aspect-ratio: 1; max-height: 40px; padding: 0; border: 0; border-radius: 10px; background: none;
  color: var(--g-text); font-variant-numeric: tabular-nums; font-size: 14px; cursor: pointer; position: relative;
}
.glass .admin-main button.cal-dia:hover { background: var(--g-surface-hover); }
.glass .admin-main button.cal-dia.fuera { color: rgba(242, 239, 232, .32); }
.glass .admin-main button.cal-dia.hoy::after {
  content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; opacity: .7;
}
/* Rango: franja gris continua entre inicio y fin; los extremos en gris claro con número oscuro. */
.glass .admin-main button.cal-dia.rango { background: rgba(255, 255, 255, .1); border-radius: 0; }
.glass .admin-main button.cal-dia.inicio, .glass .admin-main button.cal-dia.fin { background: #e9e6df; color: #141518; font-weight: 600; }
.glass .admin-main button.cal-dia:focus-visible { outline: 2px solid var(--g-text); outline-offset: 1px; z-index: 1; }
.cal-pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--g-border); }
.cal-pie .small { font-variant-numeric: tabular-nums; }
.glass .admin-main #cal-listo:disabled { opacity: .4; cursor: default; }
@media (max-width: 480px) {
  .cal { position: fixed; left: 16px; right: 16px; top: auto; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; max-width: none; }
}
/* La tarjeta de recepción queda encima de las de abajo, para que el calendario no se tape. */
.recepcion { position: relative; z-index: 15; }
@media (max-width: 899px) { .sidebar { z-index: 20; } } /* la barra fija de arriba va sobre la tarjeta de recepción al deslizar */
.glass .cal-grid th, .glass .cal-grid td, .cal-grid tr { border: 0 !important; background: none !important; box-shadow: none !important; }
.glass .cal-grid thead th { position: static; }

/* Calendario más compacto (1.33.26). */
.cal { width: 268px; padding: 11px; border-radius: 16px; }
.cal-head h3 { font-size: 14px; }
.glass .admin-main button.cal-nav { width: 28px; height: 28px; }
.cal-ayuda { margin: 4px 0 6px; font-size: 12px; }
.cal-grid { border-spacing: 0 2px; }
.cal-grid th { font-size: 11px; padding: 2px 0; }
.glass .admin-main button.cal-dia { max-height: 32px; font-size: 13px; border-radius: 8px; }
.glass .admin-main button.cal-dia.hoy::after { bottom: 3px; width: 3px; height: 3px; margin-left: -1.5px; }
.cal-pie { margin-top: 8px; padding-top: 8px; }
.cal-pie .small { font-size: 12px; }
.glass .admin-main #cal-listo { padding: 6px 14px; font-size: 13px; }

/* Luz que sigue al mouse en el panel (1.34.26): blanca, sutil, detrás del contenido (como las otras luces). */
.luz-cursor {
  position: fixed; left: 0; top: 0; z-index: -1; pointer-events: none;
  width: 480px; height: 480px; margin: -240px 0 0 -240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .14) 0%, rgba(255, 255, 255, .06) 32%, transparent 70%);
  opacity: 0; transition: opacity .6s ease; will-change: transform;
}
.luz-cursor.visible { opacity: 1; }
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) { .luz-cursor { display: none; } }

/* ---------- Inicio de sesión: cinta en el borde superior de la tarjeta y luces en movimiento ---------- */
/* La cinta va dentro del contenedor (no fija): su posición la calcula login.html
   para que la 2.ª fila quede cortada a la mitad por el borde superior de la tarjeta. */
.login-page .brands { position: absolute; left: 0; top: 0; transform: none; }

/* Inicio de sesión y chat del empleado: las luces dorada y azul recorren toda la pantalla siempre en sentido contrario:
   la azul es el reflejo de la dorada respecto al centro de la pantalla (mismo ciclo).
   Solo se cruzan cerca del centro, en el tramo 80 %–97 % del ciclo (~10 % del tiempo juntas). */
body.luces-moviles::before,
body.luces-moviles::after {
  content: "";
  position: fixed; left: 0; top: 0; z-index: -1;
  width: 70vmax; height: 55vmax;
  margin: -27.5vmax 0 0 -35vmax; /* el centro de la luz es el punto que se mueve */
  border-radius: 50%;
  pointer-events: none;
  filter: blur(30px);
  will-change: transform;
  animation-duration: 64s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
body.luces-moviles::before {
  background: radial-gradient(closest-side, rgba(214, 170, 92, .18), rgba(214, 170, 92, .07) 55%, transparent);
  animation-name: luz-dorada;
}
body.luces-moviles::after {
  background: radial-gradient(closest-side, rgba(70, 120, 140, .22), rgba(70, 120, 140, .08) 55%, transparent);
  animation-name: luz-azul;
}
@keyframes luz-dorada {
  0%, 100% { transform: translate(20vw, 25vh); }
  22% { transform: translate(78vw, 20vh); }
  44% { transform: translate(82vw, 74vh); }
  64% { transform: translate(24vw, 80vh); }
  80% { transform: translate(16vw, 40vh); }
  85% { transform: translate(43vw, 47vh); } /* cruce */
  92% { transform: translate(45vw, 48vh); } /* cruce */
  97% { transform: translate(28vw, 30vh); }
}
@keyframes luz-azul { /* reflejo exacto: (100 − x, 100 − y) */
  0%, 100% { transform: translate(80vw, 75vh); }
  22% { transform: translate(22vw, 80vh); }
  44% { transform: translate(18vw, 26vh); }
  64% { transform: translate(76vw, 20vh); }
  80% { transform: translate(84vw, 60vh); }
  85% { transform: translate(57vw, 53vh); } /* cruce */
  92% { transform: translate(55vw, 52vh); } /* cruce */
  97% { transform: translate(72vw, 70vh); }
}
@media (prefers-reduced-motion: reduce) {
  body.luces-moviles::before { animation: none; transform: translate(25vw, 30vh); }
  body.luces-moviles::after { animation: none; transform: translate(78vw, 62vh); }
}

/* Marca ABR LLC: Inter Black para "ABR" e Inter SemiBold para "LLC" (fuente alojada en el servidor). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 900; font-display: swap; src: url("/static/inter-900.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/inter-600.woff2") format("woff2"); }
.brand-abr { font-family: "Inter", system-ui, sans-serif; font-weight: 900; }
.brand-abr small { font-family: "Inter", system-ui, sans-serif; font-weight: 600; }

/* Texto "envíos" junto al número: solo en la vista de tarjeta. */
.envios-txt { display: none; }

/* Usuarios en el celular: tarjeta compacta, sin etiquetas.
   Línea 1: nombre (+ admin) y chulito de especial · Línea 2: usuario · envíos · estado · Línea 3: acciones. */
@container (width < 600px) {
  .tabla-usuarios tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 8px; }
  .tabla-usuarios td { padding: 0 4px; }
  .tabla-usuarios td[data-label]:not(:first-child)::before { display: none; }
  .tabla-usuarios td:nth-child(1) { flex: 1 1 calc(100% - 60px); order: 1; min-width: 0; }
  .tabla-usuarios td.col-especial { order: 2; width: auto; padding: 0; }
  .tabla-usuarios td:nth-child(2) { order: 3; color: var(--g-muted); font-size: 14px; }
  .tabla-usuarios td:nth-child(3) { order: 4; color: var(--g-muted); font-size: 14px; }
  .tabla-usuarios .envios-txt { display: inline; }
  .tabla-usuarios td:nth-child(2)::after { content: " ·"; }
  .tabla-usuarios td:nth-child(4) { order: 5; }
  .tabla-usuarios td:nth-child(4) .pill { font-size: 12px; }
  .tabla-usuarios td:nth-child(5) { order: 6; flex: 1 0 100%; margin-top: 6px; }
  .tabla-usuarios td:empty, .tabla-usuarios td:has(> .row-actions:empty) { display: none; }
  .tabla-usuarios .row-actions button { padding: 6px 12px; font-size: 13px; }
}

/* Celular: las luces en movimiento eran más anchas que la pantalla (70vmax) y casi no se notaban;
   aquí son más chicas (según el lado corto) y un poco más intensas, para que se vea el desplazamiento. */
@media (max-width: 899px) {
  body.luces-moviles::before,
  body.luces-moviles::after { width: 95vmin; height: 95vmin; margin: -47.5vmin 0 0 -47.5vmin; filter: blur(24px);
    animation-duration: 44s; /* un poco más rápido que en la computadora (64 s); igual en las dos luces para seguir en espejo */ }
  body.luces-moviles::before { background: radial-gradient(closest-side, rgba(214, 170, 92, .30), rgba(214, 170, 92, .12) 55%, transparent); }
  body.luces-moviles::after { background: radial-gradient(closest-side, rgba(70, 120, 140, .36), rgba(70, 120, 140, .14) 55%, transparent); }
}

/* ---------- Administradores: permisos (1.42.26) ---------- */
/* Reloj de autorización de 1 hora: gris sin autorización, verde mientras está vigente. */
.glass .admin-main button.chulito.reloj { color: rgba(242, 239, 232, .32); }
.glass .admin-main button.chulito.reloj:hover { color: rgba(242, 239, 232, .55); }
.glass .admin-main button.chulito.reloj[aria-pressed="true"] { color: var(--ok); }
/* Reporte de pago para los otros administradores: sin botones de edición (Copiar y abrir Google Docs sí). */
.reporte-solo-lectura #rep-restablecer,
.reporte-solo-lectura #rep-agregar,
.reporte-solo-lectura .rep-quitar { display: none; }
/* Opciones del menú que necesitan autorización: se ven apagadas (al tocarlas explican por qué). */
.menu-item[aria-disabled="true"] { opacity: .45; }
/* Ventana "Poderes de manejo" */
dialog.poderes-dialog {
  width: min(92vw, 520px); max-width: none; max-height: 88dvh; overflow-y: auto;
  overscroll-behavior: contain; /* al llegar al final no arrastra la página de atrás */
  scroll-behavior: smooth;
}
/* Computadora: más ancha y en dos columnas, para que todo quepa sin deslizar. */
.pod-grid { display: grid; gap: 0 28px; }
@media (min-width: 760px) {
  dialog.poderes-dialog { width: min(92vw, 820px); }
  .pod-grid { grid-template-columns: 1fr 1fr; }
}
.poderes-dialog .viewer-x { position: absolute; top: 12px; right: 12px; }
.poderes-dialog h2 { padding-right: 40px; }
.poderes-dialog h3 { font-size: 14px; margin: 18px 0 6px; }
dialog.poderes-dialog p { margin: 0 0 8px; line-height: 1.5; }
.pod-lista { margin: 0; padding-left: 20px; line-height: 1.5; }
.pod-lista li { margin: 2px 0; }
.pod-estado { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--g-border); }
.pod-estado.ok { background: var(--ok-bg); border-color: transparent; }
.pod-reloj { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; vertical-align: -1px; margin-right: 2px; }
.pod-reloj.gris { color: rgba(242, 239, 232, .4); }
.pod-reloj.verde { color: var(--ok); }

/* ---------- Empleado: inicio (Enviar comprobantes / Historial) e historial (1.44.26) ---------- */
.chat-page[hidden], .inicio-page[hidden], .historial-page[hidden] { display: none !important; }
.inicio-page, .historial-page { min-height: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; }
.topbar .volver {
  display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px; border-radius: 50%;
  color: var(--g-text); text-decoration: none; flex: none;
}
.topbar .volver:hover { background: var(--g-surface-hover); }
.topbar .volver:focus-visible { outline: 2px solid var(--g-text); outline-offset: 1px; }
.topbar-titulo { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }

.inicio-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px 32px; }
.inicio-saludo { font-size: 26px; font-weight: 600; margin: 0 0 4px; }
.inicio-sub { margin: 0 0 22px; }
.inicio-opciones { display: grid; gap: 14px; }
.inicio-op {
  display: flex; align-items: center; gap: 16px; padding: 20px 18px; border-radius: 22px;
  background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text); text-decoration: none;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 30px rgba(0, 0, 0, .35);
  transition: background-color .15s ease, transform .15s ease;
}
.inicio-op:hover { background: var(--g-surface-hover); }
.inicio-op:active { transform: scale(.99); }
.inicio-op:focus-visible { outline: 2px solid var(--g-text); outline-offset: 3px; }
.inicio-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .08); }
.inicio-texto { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.inicio-texto strong { font-size: 17px; font-weight: 600; }
.inicio-texto .muted { font-size: 14px; }
.inicio-chev { flex: none; opacity: .5; }

.historial-lista { flex: 1; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; }
.historial-vacio { text-align: center; margin-top: 40px; }
.hist-card {
  display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 20px;
  background: var(--g-surface); border: 1px solid var(--g-border);
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
}
.hist-info { flex: 1; min-width: 0; }
.hist-info h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.hist-info p { margin: 0 0 8px; font-size: 13.5px; }
.hist-total { font-size: 20px; font-variant-numeric: tabular-nums; }
.hist-actual { color: var(--ok); }
/* Pila de fotos: hasta 3 una encima de otra, ligeramente giradas; al tocarla se abre el carrusel. */
.glass button.hist-pila {
  position: relative; flex: none; width: 92px; height: 116px; padding: 0; border: 0; background: none; box-shadow: none;
  cursor: pointer; border-radius: 12px;
}
.hist-pila img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
  border: 2px solid rgba(242, 239, 232, .85); background: #1a1c20;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  transform: rotate(calc(var(--capa) * 6deg)) translate(calc(var(--capa) * 4px), calc(var(--capa) * -2px));
  transition: transform .2s ease;
}
.hist-pila:hover img { transform: rotate(calc(var(--capa) * 9deg)) translate(calc(var(--capa) * 7px), calc(var(--capa) * -3px)); }
.hist-pila:focus-visible { outline: 2px solid var(--g-text); outline-offset: 6px; }
.hist-cuenta {
  position: absolute; right: -8px; bottom: -8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  background: #f2efe8; color: #111; font-size: 13px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
@media (prefers-reduced-motion: reduce) { .hist-pila img, .inicio-op { transition: none; } }

/* León en la cinta de marcas: la imagen es una máscara, así toma el mismo dorado que los demás logos. */
.brand-leon {
  display: inline-block; height: 30px; aspect-ratio: 143 / 160;
  background-color: currentColor;
  -webkit-mask: url("/static/leon.png") no-repeat center / contain;
  mask: url("/static/leon.png") no-repeat center / contain;
}

/* ---------- Empleado: ventana "Reglas de envío" (1.47.26) ---------- */
dialog.reglas-dialog {
  width: min(calc(100vw - 32px), 560px); max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 22px 20px; border: 1px solid var(--g-border); border-radius: 24px;
  background: #16181c; color: var(--g-text); box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
dialog.reglas-dialog::backdrop { background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.reglas-dialog .viewer-x { position: absolute; top: 14px; right: 14px; }
.reglas-dialog h2 { font-size: 21px; font-weight: 600; margin: 0 48px 4px 0; }
.reglas-intro { margin: 0 0 8px; font-size: 14px; }
.regla { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--g-border); }
.regla-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .08); }
.regla h3 { font-size: 15px; font-weight: 600; margin: 6px 0 6px; }
.regla p { margin: 0 0 6px; font-size: 14.5px; line-height: 1.5; }
.regla p.muted { font-size: 13.5px; }
.regla ul { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.5; }
.regla li { margin: 3px 0; }
.regla-aviso { margin-top: 6px; padding: 14px; border: 1px solid rgba(241, 154, 146, .35); border-radius: 16px; background: rgba(229, 103, 92, .10); }
.regla-aviso .regla-ico { color: #f19a92; background: rgba(241, 154, 146, .14); }
.regla-aviso h3 { color: #f5b3ad; }
.reglas-acciones { margin-top: 16px; }
.reglas-acciones button { width: 100%; padding: 12px; border-radius: 999px; font-size: 15px; }
.glass button.inicio-op { width: 100%; text-align: left; font: inherit; cursor: pointer; border-radius: 22px; padding: 20px 18px; background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text); }
.glass button.inicio-op:hover { background: var(--g-surface-hover); }

/* Bienvenida (primera vez en el dispositivo), con el mismo estilo que la ventana de reglas. */
dialog.bienvenida-dialog { width: min(calc(100vw - 32px), 460px); text-align: center; padding: 28px 24px 22px; }
.bienvenida-logo img { width: 170px; height: auto; display: block; margin: 0 auto 18px; }
.bienvenida-dialog h2 { margin: 0 0 10px; font-size: 22px; }
.bienvenida-texto { margin: 0 0 16px; font-size: 15.5px; line-height: 1.55; }
.bienvenida-pasos { text-align: left; margin: 0; padding: 14px 16px 14px 32px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid var(--g-border); font-size: 14px; line-height: 1.5; }
.bienvenida-pasos li { margin: 4px 0; }
.bienvenida-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bienvenida-acciones button { width: 100%; }

/* ---------- Empleado: menú del usuario y cambiar contraseña (1.51.26) ---------- */
.usuario-menu-wrap { margin-left: auto; }
.glass button.usuario-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px 7px 14px; border-radius: 999px;
  background: none; border: 1px solid transparent; box-shadow: none; color: var(--g-text); font-size: 14px; cursor: pointer;
}
.glass button.usuario-btn:hover, .glass button.usuario-btn[aria-expanded="true"] { background: var(--g-surface-hover); border-color: var(--g-border); }
.glass button.usuario-btn:focus-visible { outline: 2px solid var(--g-text); outline-offset: 2px; }
.usuario-btn svg { opacity: .7; transition: transform .15s ease; }
.usuario-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.usuario-nombre { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu.usuario-menu { top: calc(100% + 6px); right: 0; left: auto; width: max-content; min-width: 210px; }
.glass .menu a.menu-item { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--g-text); }
@media (prefers-reduced-motion: reduce) { .usuario-btn svg { transition: none; } }

dialog.clave-dialog { width: min(calc(100vw - 32px), 420px); }
.clave-form label { display: block; font-size: 14px; margin: 12px 0 6px; color: var(--g-muted); }
.clave-form input { width: 100%; border-radius: 12px; padding: 11px 14px; background: var(--g-surface); border: 1px solid var(--g-border); color: var(--g-text); font: inherit; }
.clave-form input:focus-visible { outline: 2px solid var(--g-text); outline-offset: 1px; }
.clave-form #clave-ayuda { margin: 6px 0 0; }
.clave-form .error { min-height: 1.2em; margin: 12px 0 4px; }
.clave-form .bienvenida-acciones { margin-top: 8px; }

/* Historial: tarjeta de ejemplo (plantilla igual para todos; no es un comprobante real). */
.hist-ejemplo { border-style: dashed; border-color: rgba(242, 239, 232, .28); }
.hist-etiqueta {
  display: inline-block; margin-bottom: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #111; background: #e6c98f;
}
.hist-nota { margin: 8px 0 0; }

/* Registro de acciones (solo el administrador principal). */
.registro-barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.registro-barra p { margin: 0; }
td.reg-fecha { white-space: nowrap; color: var(--g-muted); font-variant-numeric: tabular-nums; }
td.reg-detalle { color: var(--g-muted); overflow-wrap: anywhere; }
.reg-mas { margin-top: 12px; }
/* Registro de acciones en ventana (menú del usuario). */
dialog.confirm.registro-dialog { width: min(calc(100vw - 32px), 980px); max-width: none; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; }
.registro-dialog .viewer-x { position: absolute; top: 12px; right: 12px; }
.registro-dialog h2 { padding-right: 48px; }
.registro-dialog .registro-barra p { color: var(--g-muted); }
.menu .menu-item[hidden] { display: none !important; }
/* Menú: opción con una segunda línea (estado del respaldo). */
.glass .menu .menu-item.menu-item-doble > span { display: flex; flex-direction: column; gap: 2px; }
.menu-sub { font-size: 12px; color: var(--g-muted); white-space: nowrap; }
.menu-sub.error { color: var(--bad); }

/* Pie del panel más compacto: textos un poco más chicos y menos espacio abajo. */
body.admin-page .site-footer { font-size: 12px; padding: 16px 16px calc(10px + env(safe-area-inset-bottom)); line-height: 1.35; }
body.admin-page .site-footer .version { font-size: 10px; margin-top: 1px; }
body.admin-page .site-footer .rol-pie { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
