/* SEHL Pay Console — SEHL brand identity (gold, navy, ivory, ink). */
:root {
  --gold: #b0894f; --gold-deep: #97713a; --gold-soft: #f3ebdc; --gold-on-dark: #d8b676;
  --navy: #1f2a3c; --navy-2: #2a3850; --navy-line: #2f3d55; --navy-soft: #e7ebf1;
  --ink: #1b1f2a; --ink-soft: #555c6b; --ink-faint: #6b7180;
  --bg: #faf8f4; --bg-2: #f3efe8; --surface: #ffffff; --surface-2: #fbfaf7;
  --line: #e8e3da; --line-soft: #f0ece4;
  --ok: #22693f; --ok-soft: #e7f3ec; --ok-dot: #2f8f5b;
  --warn: #8a5a10; --warn-soft: #faf0db; --warn-dot: #c98a25;
  --danger: #9a3a24; --danger-soft: #f8e8e3; --danger-dot: #c0492f;
  --info: #245a82; --info-soft: #e6eef5; --info-dot: #2f6f9f;
  --neutral: #4b5160; --neutral-soft: #eceae5;
  --sh-1: 0 1px 2px rgba(27,31,42,.05); --sh-2: 0 14px 40px rgba(27,31,42,.16);
  --radius: 14px; --radius-sm: 10px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #eef0f4; --ink-soft: #b8bfcc; --ink-faint: #949cab;
  --bg: #121826; --bg-2: #172033; --surface: #1a2335; --surface-2: #1e283c;
  --line: #2c3850; --line-soft: #243048;
  --gold-soft: #2e2a20;
  --ok: #8fd6ad; --ok-soft: #173326; --warn: #f0c27a; --warn-soft: #3a2d14;
  --danger: #f1a594; --danger-soft: #3d1f19; --info: #9cc6ea; --info-soft: #172a3d;
  --neutral: #c3c9d4; --neutral-soft: #263147;
  --sh-1: 0 1px 2px rgba(0,0,0,.3); --sh-2: 0 14px 40px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--gold-deep); }
:root[data-theme="dark"] .main a:not(.btn):not(.kpi):not(.list-row) { color: var(--gold-on-dark); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.mono.faint, td.nowrap { white-space: nowrap; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: 13px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.005em; }
h1 { font-weight: 500; font-size: 34px; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--navy); color: var(--navy-soft); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.crest { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #fff; display: grid; place-items: center; font: 600 20px var(--serif); box-shadow: 0 6px 18px rgba(151,113,58,.35); flex: none; }
.brand-name { font: 600 19px var(--serif); color: #fff; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--gold-on-dark); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm); color: #c3c9d4; text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--navy-2); color: #fff; font-weight: 600; }
.nav a[aria-current="page"] svg { stroke: var(--gold-on-dark); }
.nav svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav .badge { margin-left: auto; background: var(--gold); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 8px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--navy-line); padding: 16px 8px 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.side-user { color: #fff; font-weight: 600; }
.side-role { color: #94a0b4; font-size: 12px; }
.side-foot button { justify-content: flex-start; padding-left: 0; color: #c3c9d4; }
.side .seg button { background: transparent; border-color: var(--navy-line); color: #c3c9d4; justify-content: center; padding-left: 14px; }
.side .seg button[aria-pressed="true"], :root[data-theme="dark"] .side .seg button[aria-pressed="true"] { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.main { flex: 1; min-width: 0; padding: 32px 40px 64px; }
.topbar { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; color: var(--ink-soft); max-width: 68ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 960px) {
  .shell { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; height: 100%; }
  .side.open { transform: none; box-shadow: var(--sh-2); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40; }
  .topbar .brand-name { font-size: 17px; }
  .main { padding: 24px 16px 56px; }
  h1 { font-size: 28px; }
  .scrim { position: fixed; inset: 0; background: rgba(10,14,22,.5); z-index: 45; }
}

/* ── Buttons & inputs ──────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; box-shadow: 0 6px 18px rgba(151,113,58,.25); }
.btn-primary:hover { background: #87652f; border-color: #87652f; }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-danger { background: var(--surface); border-color: var(--danger-dot); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { min-width: 44px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 12px; color: var(--ink-faint); }
.field .err { font-size: 12px; color: var(--danger); font-weight: 600; }
input, select, textarea { font: 15px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(176,137,79,.18); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger-dot); }
.money-input { position: relative; }
.money-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-family: var(--mono); }
.money-input input { padding-left: 28px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; min-height: 20px; height: 20px; margin-top: 1px; accent-color: var(--gold-deep); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font: 600 13px var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--gold-deep); border-color: var(--gold-deep); }

/* ── Cards, KPIs, tables ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-1); }
.card-pad { padding: 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi .k-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.kpi .k-value { font: 600 28px var(--mono); font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 13px; color: var(--ink-faint); }
.kpi.alert { border-color: var(--warn-dot); }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-faint); padding: 12px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td.amount, th.amount { text-align: right; }
.ref-main { font-weight: 600; }
td.ref { min-width: 220px; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.ref-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-neutral { background: var(--neutral-soft); color: var(--neutral); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-soft); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.notice { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 10px 20px; font-size: 14px; margin: 0; }
.dl dt { color: var(--ink-soft); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.amount-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line-soft); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.amount-strip > div { background: var(--surface); padding: 16px 18px; }
.amount-strip .k-label { font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.amount-strip .k-value { font: 600 22px var(--mono); font-variant-numeric: tabular-nums; }
.dark-card { background: var(--navy); color: #f4f1ec; border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.dark-card h2 { color: #fff; }
.dark-card .muted { color: #c3c9d4; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.dark-card .list-row { border-color: var(--navy-line); }
.list-row:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Auth ──────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 18px; padding: 32px; box-shadow: var(--sh-2); display: flex; flex-direction: column; gap: 20px; }
.auth-card .brand-name { color: var(--ink); }
.auth-card .brand-sub { color: var(--gold-deep); }
.auth-langs { display: flex; justify-content: center; gap: 6px; }

/* ── Dialog & toast ────────────────────────────────────────────────────── */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--sh-2); }
dialog::backdrop { background: rgba(10,14,22,.55); }
.dlg-head { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dlg-body { padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.dlg-foot { padding: 16px 24px 22px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--navy); color: #fff; padding: 14px 16px; border-radius: 12px; box-shadow: var(--sh-2); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.toast.ok { border-left: 0; }
.toast.ok::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #3fae72; margin-top: 7px; flex: none; }
.toast.err::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #e0735a; margin-top: 7px; flex: none; }
.secret { font: 600 20px var(--mono); letter-spacing: .04em; background: var(--gold-soft); color: var(--ink); padding: 14px; border-radius: var(--radius-sm); text-align: center; user-select: all; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 48px; display: flex; justify-content: center; color: var(--ink-faint); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
pre.detail { margin: 0; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-soft); max-width: 420px; }

/* ── Pager, codes, QR ───────────────────────────────────────────────────── */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
input.code-input { font-size: 24px; letter-spacing: .35em; text-align: center; font-family: var(--mono); }
.qr-wrap { display: flex; justify-content: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qr-wrap svg { width: 200px; height: 200px; display: block; }
input[type="date"] { min-width: 150px; }

/* ── Print: receipts and reports ───────────────────────────────────────── */
.receipt { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .side, .topbar, .toasts, .page-actions, .pager, .skip, dialog, .btn, .seg, form[data-search], form[data-date] { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card, .kpi, .amount-strip { box-shadow: none; border-color: #999; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  body.printing > :not(.receipt) { display: none !important; }
  .receipt { display: block; max-width: 420px; margin: 0 auto; font-family: var(--sans); }
  .receipt-head { text-align: center; margin-bottom: 16px; }
  .receipt-hotel { font: 600 20pt var(--serif); }
  .receipt-title { font-size: 11pt; letter-spacing: .12em; text-transform: uppercase; color: #444; margin-top: 4px; }
  .receipt table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
  .receipt td { padding: 5px 0; border-bottom: 1px dotted #bbb; font-size: 11pt; vertical-align: top; }
  .receipt td:first-child { color: #444; padding-right: 12px; }
  .receipt td.num { text-align: right; font-family: var(--mono); overflow-wrap: anywhere; }
  .receipt .receipt-total td { font-weight: 700; font-size: 13pt; border-bottom: 2px solid #000; border-top: 2px solid #000; }
  .receipt-foot { text-align: center; font-size: 9pt; color: #666; margin-top: 18px; }
}
