:root {
  --bg: #f2f6f0; --surface: #ffffff; --surface-2: #f6f9f4; --ink: #0f1a10; --ink-2: #43523f; --ink-3: #66755f;
  --line: #dfe7da; --line-2: #c8d4c2; --accent: #15803d; --accent-ink: #ffffff; --accent-soft: #e0f3e1; --gold: #a16c00;
  --grad: linear-gradient(180deg, #1c9a4b, #147a39); --glow: rgba(21, 128, 61, .22); --halo: #d8efd6;
  --ok: #0f7a55; --ok-soft: #e0f3ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #c22c2c; --bad-soft: #fbe6e6;
  --info: #2f5fd0; --info-soft: #e6edfb; --violet: #8a5c00; --violet-soft: #fbf0d0;
  --shadow: 0 1px 2px rgba(16, 30, 18, .05), 0 4px 14px rgba(16, 30, 18, .05);
  --shadow-lg: 0 12px 40px rgba(16, 30, 18, .18);
  --radius: 16px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050a05; --surface: #0d160d; --surface-2: #142014; --ink: #f3f7f1; --ink-2: #c3cfbf; --ink-3: #93a38e;
    --line: #1f3120; --line-2: #31502f; --accent: #43e03a; --accent-ink: #041204; --accent-soft: #123311; --gold: #f7c948;
    --grad: linear-gradient(180deg, #6bf25c, #2fc728); --glow: rgba(67, 224, 58, .28); --halo: #0f3a0e;
    --ok: #58e68f; --ok-soft: #0f3020; --warn: #f0b252; --warn-soft: #342812; --bad: #ff8585; --bad-soft: #3a1b1d;
    --info: #7fa3ff; --info-soft: #1a2540; --violet: #f7c948; --violet-soft: #2f2609; --shadow: none; --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num, .money { font-variant-numeric: tabular-nums; }
.code { font-family: var(--mono); font-weight: 600; letter-spacing: .02em; }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); letter-spacing: 0; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 550;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.me { padding: 6px 10px 10px; font-size: 13px; }
.me strong { display: block; font-size: 14px; }
.main { min-width: 0; padding: 28px 32px 60px; max-width: 1320px; width: 100%; }
.topbar { display: none; }
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-body { padding: 16px 18px 18px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; position: relative; }
.kpi .label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); display: flex; justify-content: space-between; align-items: center; }
.kpi .value { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .value.sm { font-size: 24px; }
.kpi .sub { font-size: 13px; color: var(--ink-3); }
.kpi .sub b { color: var(--ok); font-weight: 650; }
.kpi .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.kpi.alert { border-color: var(--warn); }
a.kpi { text-decoration: none; }
a.kpi:hover { border-color: var(--line-2); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 18px; align-items: start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger.solid { background: #c22c2c; color: #fff; border-color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { flex: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.activo, .pill.aprobada, .pill.valida { color: var(--ok); background: var(--ok-soft); }
.pill.pausado, .pill.pendiente { color: var(--warn); background: var(--warn-soft); }
.pill.reservada { color: var(--info); background: var(--info-soft); }
.pill.vencida { color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); }
.pill.rechazada, .pill.anulada, .pill.cancelado { color: var(--bad); background: var(--bad-soft); }
.pill.cerrado { color: var(--info); background: var(--info-soft); }
.pill.finalizado { color: var(--violet); background: var(--violet-soft); }
.pill.borrador { color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--warn); color: var(--surface); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

/* Sorteos en el resumen */
.raffle-list { display: flex; flex-direction: column; }
.raffle-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 16px 18px; border-top: 1px solid var(--line); }
.raffle-row:first-child { border-top: 0; }
.raffle-row h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.raffle-row h3 a { text-decoration: none; }
.raffle-row h3 a:hover { text-decoration: underline; }
.raffle-row .prize { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.raffle-row .row-actions { display: flex; gap: 6px; align-items: flex-start; }
.raffle-row .stats { grid-column: 1 / -1; display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.raffle-row .stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; min-width: 2px; }
.raffle-row.paused .bar i { background: var(--warn); }
.raffle-row.paused { background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--warn-soft) 45%, transparent) 10px 20px); }

/* Feed de tickets */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); font-weight: 650; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.feed { list-style: none; margin: 0; padding: 4px 0; max-height: 640px; overflow: auto; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; padding: 10px 18px; border-top: 1px solid var(--line); align-items: center; }
.feed li:first-child { border-top: 0; }
.feed li.new { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.feed .tk { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.feed .code { font-size: 14px; }
.feed .who { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .when { font-size: 12px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.feed .rf { font-size: 12px; color: var(--ink-3); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.feed a { text-decoration: none; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t td.r, .t th.r { text-align: right; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover { background: var(--surface-2); }
.t .sub { font-size: 12px; color: var(--ink-3); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search input[type=search] { padding-left: 34px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > span em { color: var(--accent); font-style: normal; }
.field small { color: var(--ink-3); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], input[type=datetime-local], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
}
textarea { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; }
input:disabled, select:disabled { background: var(--surface-2); color: var(--ink-3); }
input[aria-invalid="true"] { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.check span { font-size: 14px; }
.check small { display: block; color: var(--ink-3); font-size: 12px; }
.total-box { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); }
.total-box span { font-weight: 600; color: var(--ink-2); }
.total-box strong { font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.combos-editor .combo-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); padding: 4px 0; }

.prize-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prize-line + form { margin-top: 14px; }
.prize-won { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--ink); }

/* Modal */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal.wide { width: min(820px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 12, 18, .5); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.modal-head p { margin: 3px 0 0; color: var(--ink-3); font-size: 14px; }
.modal-body { padding: 14px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.ticket-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; }
.ticket-chips span { font-family: var(--mono); font-weight: 650; font-size: 13px; padding: 4px 8px; border-radius: 7px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.ticket-chips span.anulada { text-decoration: line-through; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.winner { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--violet-soft); color: var(--ink); margin-bottom: 18px; }
.winner .big { font-family: var(--mono); font-size: 30px; font-weight: 800; color: var(--violet); }

.demo-bar { position: sticky; top: 0; z-index: 30; background: #ffd23f; color: #1b1813; font-weight: 700; font-size: 14px; text-align: center; padding: 8px 16px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.receipts { display: flex; flex-wrap: wrap; gap: 10px; }
.receipts img { display: block; height: 170px; max-width: 100%; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.receipts .btn { margin-top: 6px; }
.form-sec { margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; }
.fin-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.fin-line.total strong { font-size: 20px; }
.fin-line.good strong { color: var(--ok); }
.fin-line.bad strong { color: var(--bad); }
.fin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.card-body h3 { font-size: 14px; margin: 18px 0 6px; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 360px; animation: in .2s ease-out; }
.toast.error { background: #c22c2c; color: #fff; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border: 1px solid var(--line); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Tutorial ---------- */
.tour { position: fixed; inset: 0; z-index: 200; }
.tour-shade { position: fixed; inset: 0; background: rgba(8, 10, 16, .62); }
.tour-spot {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px rgba(8, 10, 16, .62);
  transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease;
}
.tour-card {
  position: fixed; width: min(380px, calc(100vw - 32px)); padding: 18px 18px 14px; border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  transition: top .3s ease, left .3s ease;
}
.tour-card:focus { outline: none; }
.tour-card.center { top: 50%; left: 50%; transform: translate(-50%, -50%); transition: none; }
.tour-card h2 { margin: 6px 0 6px; font-size: 18px; letter-spacing: -.01em; }
.tour-card p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }
.tour-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-count { font-size: 12px; font-weight: 650; color: var(--accent); }
.tour-dots { display: flex; gap: 4px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.tour-dots i.done { background: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.tour-dots i.on { width: 16px; border-radius: 99px; background: var(--accent); }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-actions .btn.ghost { color: var(--ink-3); padding: 0 6px; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }

/* ---------- Login / páginas públicas ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 30px 28px; }
.auth-card .brand { justify-content: center; padding-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 21px; margin: 10px 0 4px; }
.auth-card > p { text-align: center; color: var(--ink-3); margin: 0 0 22px; font-size: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 44px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 18px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; height: 32px; width: 36px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 8px; }

.verify-card { width: min(440px, 100%); padding: 0; overflow: hidden; }
.verify-top { padding: 24px; text-align: center; color: #fff; background: #12805c; }
.verify-top.bad { background: #b3261e; }
.verify-top.win { background: #5b3fc4; }
.verify-top .big { font-size: 22px; font-weight: 800; margin-top: 6px; }
.verify-body { padding: 20px 24px 24px; }
.verify-note { margin: 14px 0 0; font-size: 13px; }

.toolbar select { width: auto; max-width: 100%; }
.t th.r { white-space: normal; }
.t td strong { white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-2.side-first > .stack { order: -1; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: 16px; }
  .tabbar { display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none; padding: 4px 0; position: relative; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .badge { position: absolute; top: -2px; left: 54%; transform: scale(.85); }
  .main { padding: 18px 16px 96px; }
  .page-head h1 { font-size: 22px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 24px; }
  .kpi .value.sm { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .raffle-row { grid-template-columns: 1fr; }
  .feed .rf { display: none; }
  .t th, .t td { padding: 10px; }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 110px 1fr; }
}

/* Selector de idioma */
.idioma { display: inline-flex; flex: none; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.idioma button { min-width: 42px; min-height: 40px; padding: 0 10px; border: 0; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.idioma button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.idioma button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.side-foot .idioma { margin: 0 10px 10px; }
.idioma.suelto { position: absolute; top: 14px; right: 14px; z-index: 2; }

/* ---------- Marca y trébol de carga ---------- */
.brand.rds { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.brand.rds svg { width: 34px; height: 34px; color: var(--accent); flex: none; }
.brand.rds b { color: var(--gold); font-weight: 900; text-transform: uppercase; }
.brand.rds small { margin-top: 1px; }
#cargador { visibility: visible; position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 22px; background: #050a05; color: #43e03a; transition: opacity .35s; animation: salida .4s 9s forwards; }
#cargador.fuera { opacity: 0; pointer-events: none; }
#cargador svg { width: 116px; height: 116px; filter: drop-shadow(0 0 22px rgba(67, 224, 58, .55)); animation: latido 1.1s ease-in-out infinite alternate; }
#cargador p { display: flex; gap: 8px; margin: 0; }
#cargador i { width: 12px; height: 12px; border-radius: 50%; background: #f7c948; animation: punto .9s ease-in-out infinite alternate; }
#cargador i:nth-child(2) { animation-delay: .2s; }
#cargador i:nth-child(3) { animation-delay: .4s; }
@keyframes latido { from { transform: rotate(-12deg) scale(.9); } to { transform: rotate(12deg) scale(1.06); } }
@keyframes punto { to { transform: scale(.45); opacity: .45; } }
@keyframes salida { to { opacity: 0; visibility: hidden; } } /* si el código falla, el trébol no tapa la página para siempre */

@media (prefers-reduced-motion: reduce) { #cargador svg, #cargador i { animation: none; } }

/* ---------- Panel ---------- */
body.panel { background: radial-gradient(1100px 460px at 70% -60px, var(--halo), transparent) no-repeat var(--bg); }
.panel .side { background: linear-gradient(180deg, var(--accent-soft), var(--surface) 210px); }
.panel .side .brand { padding-bottom: 22px; }
.panel .side .brand svg { width: 42px; height: 42px; }
.nav a[aria-current="page"] { font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.panel .btn.primary { background: var(--grad); border-color: transparent; font-weight: 700; box-shadow: 0 4px 16px var(--glow); }
.panel .btn { transition: background .15s, border-color .15s, transform .1s; }
.panel .btn:active { transform: scale(.97); }
.panel .kpi { overflow: hidden; transition: border-color .15s, transform .15s; }
.panel .kpi.accent { --tone: var(--gold); }
.panel .kpi.ok { --tone: var(--accent); }
.panel .kpi.warn { --tone: var(--warn); }
.panel .kpi.info { --tone: var(--info); }
.panel .kpi.violet { --tone: var(--violet); }
.panel .kpi { background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 13%, var(--surface)), var(--surface) 62%); }
.panel .kpi .ico { width: 36px; height: 36px; border-radius: 11px; flex: none; background: color-mix(in srgb, var(--tone) 18%, var(--surface)) !important; color: var(--tone) !important; }
.panel a.kpi:hover { transform: translateY(-2px); border-color: var(--tone); }
.panel .card-head h2 { font-size: 16px; }
.panel .bar { height: 10px; }
.panel .raffle-row:not(.paused) .bar i { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.raffle-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.raffle-id img { width: 60px; height: 60px; flex: none; object-fit: cover; border-radius: 12px; border: 1px solid var(--line-2); }
.panel .topbar .brand svg { width: 30px; height: 30px; }
.panel .auth-card { border-radius: 22px; box-shadow: 0 0 70px var(--glow); }
.panel .auth-card .brand { flex-direction: column; font-size: 25px; gap: 6px; }
.panel .auth-card .brand svg { width: 92px; height: 92px; filter: drop-shadow(0 0 20px var(--glow)); animation: brote .7s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes brote { from { transform: scale(0) rotate(-140deg); } }
@media (max-width: 820px) { .panel .topbar .brand { font-size: 15px; gap: 7px; } }
@media (prefers-reduced-motion: reduce) { .panel .auth-card .brand svg { animation: none; } }

/* Lectura automática del comprobante y conciliación */
.ai-box { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ai-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-head .pill { margin-left: auto; }
.ai-failed { margin: 0; padding-left: 18px; color: var(--bad, #b42318); font-size: 14px; display: grid; gap: 2px; }
.ai-box details summary { cursor: pointer; font-size: 14px; color: var(--ink-2); }
.ai-box details .kv { margin-top: 8px; }
.recon-result { display: grid; gap: 4px; font-size: 14px; }
.file-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.file-pick input[type=file] { font: inherit; font-size: 14px; color: var(--ink-2); max-width: 100%; }
.file-pick input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-2, var(--line)); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.dup-box { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--warn, #b54708); border-radius: 12px; background: var(--warn-soft); }
.dup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dup-grid figure { margin: 0; display: grid; gap: 6px; align-content: start; }
.dup-grid figcaption { font-size: 13px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dup-grid img { display: block; width: 100%; max-height: 360px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
@media (max-width: 560px) { .dup-grid { grid-template-columns: 1fr; } }
.bank-box { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--good, #067647); border-radius: 12px; background: var(--good-soft, var(--accent-soft)); }
.bank-box p { margin: 0; font-size: 14px; }
.bank-box .btn { justify-self: start; }
