:root {
  color-scheme: light;
  --navy: #0b1328;
  --navy-2: #152142;
  --gold: #b7903c;
  --gold-light: #f3e5bd;
  --cream: #f7f4ec;
  --paper: #ffffff;
  --ink: #151a25;
  --muted: #687083;
  --line: #dfe3ea;
  --green: #16784a;
  --green-soft: #e7f6ee;
  --red: #b33a3a;
  --red-soft: #fbeaea;
  --amber: #8c5a0a;
  --amber-soft: #fff3d6;
  --shadow: 0 12px 34px rgba(11, 19, 40, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; background: var(--cream); color: var(--ink); font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; padding-bottom: 96px; }
a { color: #1557b0; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 1000; background: #fff; padding: 10px; }
.skip-link:focus { top: 12px; }
.topbar { position: sticky; top: 0; z-index: 50; min-height: 72px; padding: 12px max(18px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 14px; background: rgba(247, 244, 236, .94); border-bottom: 1px solid rgba(11,19,40,.08); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; }
.brand-mark, .hero-mark { display: grid; place-items: center; background: var(--navy); color: var(--gold-light); border: 2px solid var(--gold); font-weight: 900; letter-spacing: .04em; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand small { color: var(--muted); margin-top: 3px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.link-button { appearance: none; background: none; border: 0; color: #1557b0; padding: 8px 0; cursor: pointer; }
.page-shell { width: min(1120px, 100%); margin: 0 auto; padding: 26px 18px 48px; }
.page-heading { margin: 8px 0 24px; }
.page-heading h1 { margin: 0; color: var(--navy); font-size: clamp(2rem, 8vw, 3.7rem); letter-spacing: -.04em; line-height: 1.02; }
.page-heading p { max-width: 720px; }
.heading-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: .78rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.notice, .sensitive-banner { border: 1px solid #e4c879; border-radius: 13px; padding: 12px 14px; background: var(--amber-soft); color: #63400b; }
.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message { padding: 13px 15px; border-radius: 12px; background: #eef2f7; }
.message.success { background: var(--green-soft); color: #0e5b38; }
.message.error { background: var(--red-soft); color: #842b2b; }
.panel, .auth-card, .list-card, .metric, .action-card { background: var(--paper); border: 1px solid rgba(11, 19, 40, .09); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: clamp(18px, 4vw, 30px); margin-bottom: 22px; }
.auth-page { background: radial-gradient(circle at top, #26375c 0, var(--navy) 42%, #070b16 100%); padding-bottom: 0; }
.auth-page .topbar { background: transparent; border: 0; }
.auth-page .brand, .auth-page .user-chip { color: #fff; }
.auth-page .page-shell { display: grid; place-items: center; min-height: calc(100vh - 80px); }
.auth-card { width: min(480px, 100%); padding: clamp(24px, 7vw, 46px); }
.auth-card.wide-card { width: min(660px, 100%); }
.auth-card h1 { color: var(--navy); margin: 8px 0; font-size: clamp(2rem, 7vw, 3rem); letter-spacing: -.04em; }
.hero-mark { width: 76px; height: 76px; border-radius: 24px; font-size: 1.4rem; margin-bottom: 22px; }
.stack-form { display: grid; gap: 16px; margin-top: 22px; }
.stack-form > div { display: grid; gap: 7px; }
label { color: var(--navy); font-weight: 750; }
input, select, textarea { width: 100%; min-height: 48px; border: 1px solid #bfc6d2; border-radius: 12px; background: #fff; color: var(--ink); padding: 11px 13px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(183,144,60,.25); border-color: var(--gold); }
.errorlist { list-style: none; color: var(--red); background: var(--red-soft); border-radius: 8px; margin: 0; padding: 9px 11px; }
.helptext { color: var(--muted); font-size: .85rem; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 11px 17px; text-align: center; font-weight: 800; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--navy); color: #fff; }
.button.secondary { background: #fff; color: var(--navy); border-color: #aeb6c4; }
.button.danger { background: var(--red); color: #fff; }
.button.whatsapp { background: #177d50; color: #fff; }
.button.wide { width: 100%; margin-top: 8px; }
.button:disabled { opacity: .4; cursor: not-allowed; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.metric { padding: 18px; box-shadow: none; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 7px 0 2px; color: var(--navy); font-size: clamp(1.7rem, 7vw, 2.8rem); }
.metric.warning { background: var(--amber-soft); }
.metric-grid.compact .metric strong { font-size: 2rem; }
.quick-actions { display: grid; gap: 12px; margin: 22px 0 30px; }
.action-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; color: var(--navy); text-decoration: none; box-shadow: none; }
.action-card span { color: var(--muted); font-size: .9rem; }
.action-card.primary-action { background: var(--navy); color: #fff; }
.action-card.primary-action span { color: var(--gold-light); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-heading h2 { margin: 0; color: var(--navy); }
.list-card { overflow: hidden; box-shadow: none; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 72px; padding: 15px 18px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
.list-row span, .list-row small { display: block; }
.list-row small { margin-top: 4px; color: var(--muted); }
.amount { color: var(--navy); font-weight: 900; white-space: nowrap; }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.filter-bar label { display: grid; gap: 5px; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 14px 0 20px; }
.table-wrap { width: 100%; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f2f4f7; color: var(--navy); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.badge, .status { display: inline-block; width: fit-content; border-radius: 999px; padding: 4px 9px; font-size: .76rem; font-weight: 800; }
.badge { background: var(--navy); color: #fff; }
.status-available, .status-confirmed, .status-returned { background: var(--green-soft); color: var(--green); }
.status-review, .status-reversal_pending, .status-pending { background: var(--amber-soft); color: var(--amber); }
.status-sold { background: #edf1f7; color: #4f5b6d; }
.status-blocked, .status-reversed { background: var(--red-soft); color: var(--red); }
.summary-panel h2 { margin-top: 0; }
.summary-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.summary-columns p { display: flex; justify-content: space-between; max-width: 240px; }
.confirm-bar { position: sticky; bottom: 86px; z-index: 20; display: flex; justify-content: flex-end; gap: 10px; margin: 18px 0; padding: 12px; background: rgba(247,244,236,.94); backdrop-filter: blur(12px); border-radius: 14px; }
.ticket-preview { display: grid; gap: 3px; margin-bottom: 22px; }
.ticket-line, .ticket-total { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 2px; border-bottom: 1px dashed #c9ced7; }
.ticket-total { margin-top: 8px; border: 0; color: var(--navy); font-size: 1.25rem; }
.ticket-total strong { font-size: 1.6rem; }
.ticket-card { max-width: 720px; margin-inline: auto; }
.code-card { margin: 14px 0; padding: 16px; border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 14px; background: #fff; }
.code-card span, .code-card small { display: block; color: var(--muted); }
.code-card strong { display: block; margin: 7px 0; color: var(--navy); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1.15rem, 5vw, 1.65rem); overflow-wrap: anywhere; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.danger-link { display: block; margin-top: 24px; color: var(--red); text-align: center; }
.secret-box { margin: 16px 0; padding: 14px; border-radius: 12px; background: #edf1f7; overflow-wrap: anywhere; }
.secret-box span, .secret-box strong { display: block; }
.secret-box span { color: var(--muted); font-size: .85rem; }
.secret-box strong { margin-top: 5px; font-family: ui-monospace, SFMono-Regular, monospace; }
.qr-code { display: block; width: min(280px, 75vw); height: auto; margin: 18px auto; border: 12px solid #fff; }
.steps { padding-left: 22px; color: var(--muted); }
.steps li { margin-bottom: 8px; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 22px 0; }
.recovery-grid code { padding: 12px; border-radius: 9px; background: #edf1f7; text-align: center; }
.result-card dl { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.result-card dt { color: var(--muted); }
.result-card dd { margin: 0; font-weight: 750; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(11,19,40,.08); }
.bottom-nav a { display: grid; place-items: center; gap: 3px; min-height: 56px; color: #586174; font-size: .69rem; font-weight: 750; text-decoration: none; }
.bottom-nav a span { font-size: 1.25rem; }
.bottom-nav .nav-primary { color: var(--navy); }
.bottom-nav .nav-primary span { display: grid; place-items: center; width: 38px; height: 38px; background: var(--navy); color: #fff; border-radius: 13px; }

@media (min-width: 720px) {
  body { padding-bottom: 32px; }
  .bottom-nav { left: 50%; right: auto; width: min(620px, calc(100% - 32px)); transform: translateX(-50%); bottom: 14px; border: 1px solid var(--line); border-radius: 22px; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: repeat(5, minmax(120px, 1fr)); align-items: end; }
}

@media (max-width: 520px) {
  .user-chip > span { display: none; }
  .button-grid, .summary-columns, .recovery-grid { grid-template-columns: 1fr; }
  .confirm-bar { justify-content: stretch; }
  .confirm-bar form, .confirm-bar .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

