:root {
  --black: #000;
  --ink: #111;
  --yellow: #ffd400;
  --yellow-soft: #fff6c2;
  --white: #fff;
  --grey: #8a8a8a;
  --line: #2a2a2a;
  --ok: #19a34a;
  --bad: #d92d20;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--black);
  color: var(--white);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1, h2 { margin: 0 0 8px; line-height: 1.15; }
h1 { font-size: 22px; color: var(--yellow); }
h2 { font-size: 17px; }
a { color: var(--yellow); }
.muted { color: var(--grey); font-size: 14px; }
.hidden { display: none !important; }

/* buttons & inputs */
button, .btn {
  appearance: none; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--yellow); color: var(--ink); font-weight: 800; font-size: 16px;
  padding: 12px 16px; text-decoration: none; display: inline-block; text-align: center;
}
button.ghost { background: transparent; color: var(--yellow); border: 2px solid var(--yellow); }
button.danger { background: transparent; color: #ff8a80; border: 2px solid #5a2320; }
button:disabled { opacity: .5; cursor: default; }
input, select {
  width: 100%; font-size: 18px; padding: 12px; border-radius: 12px;
  border: 2px solid var(--line); background: #161616; color: var(--white);
}
input:focus, select:focus { outline: none; border-color: var(--yellow); }
label { display: block; font-size: 14px; color: var(--grey); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.card { background: #151515; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
.msg { margin-top: 12px; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 18px; }
.msg.ok { background: #0f2d1a; color: #6ee7a0; border: 2px solid var(--ok); }
.msg.err { background: #2d0f0f; color: #ffaaa3; border: 2px solid var(--bad); }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
header.top img { width: 44px; height: 44px; }
header.top .title { display: flex; align-items: center; gap: 10px; }

/* voucher page */
body.voucher main { text-align: center; padding-top: 20px; }
body.voucher .logo { width: 220px; height: 220px; }
.deal { font-size: 40px; font-weight: 900; color: var(--yellow); margin: 12px 0 6px; letter-spacing: .5px; }
.small-deal { font-size: 26px; }
.lead { font-size: 18px; margin: 4px 0 14px; }
.code {
  display: inline-block; background: var(--white); color: var(--ink);
  font-size: 44px; font-weight: 900; letter-spacing: 2px; padding: 14px 22px;
  border-radius: 16px; border: 5px solid var(--yellow);
}
.small { color: var(--grey); font-size: 14px; }
.bar { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.bar p { color: #ccc; margin: 4px 0 12px; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* staff page */
.big-input { font-size: 28px; text-align: center; letter-spacing: 1px; font-weight: 800; }
.validate { width: 100%; font-size: 22px; padding: 18px; margin-top: 10px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list button { padding: 6px 10px; font-size: 14px; }
#scanner video { width: 100%; border-radius: 12px; margin-top: 10px; background: #000; }

/* dashboard */
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.totals div { background: #151515; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.totals b { display: block; font-size: 22px; color: var(--yellow); }
.totals span { font-size: 12px; color: var(--grey); }
.periods { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.periods button { padding: 8px 12px; font-size: 14px; background: #1d1d1d; color: var(--white); border: 1px solid var(--line); }
.periods button.on { background: var(--yellow); color: var(--ink); }
.codes { list-style: none; padding: 0; margin: 0; }
.codes li { background: #151515; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.codes .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.codes .code-name { font-weight: 900; font-size: 18px; }
.codes .driver { color: #ddd; }
.codes .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; text-align: center; }
.codes .stats b { display: block; font-size: 18px; }
.codes .stats span { font-size: 11px; color: var(--grey); }
.codes .due b { color: var(--yellow); }
.codes .btns { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.codes .btns button { padding: 8px 12px; font-size: 14px; flex: 1; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.pill.active { background: #0f2d1a; color: #6ee7a0; }
.pill.unassigned { background: #2a2a2a; color: #ccc; }
.pill.disabled { background: #2d0f0f; color: #ffaaa3; }
dialog { background: #151515; color: var(--white); border: 1px solid var(--line); border-radius: 16px; width: min(92vw, 440px); padding: 16px; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.history { font-size: 14px; color: #ccc; margin-top: 10px; }
.history div { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* print stickers */
.wide { width: 100%; margin-top: 10px; display: block; }
.codes .head-wrap { display: flex; gap: 12px; align-items: center; }
.thumb { width: 72px; height: 72px; border-radius: 50%; flex: 0 0 72px; cursor: zoom-in; background: #222; border: 0; padding: 0; }
.thumb img { width: 72px; height: 72px; border-radius: 50%; display: block; }
.codes .head-wrap .info { flex: 1; min-width: 0; }
.sticker-big { width: 100%; height: auto; border-radius: 50%; display: block; background: #222; }
