:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #16181d;
  --muted: #646b78;
  --line: #dfe2e8;
  --accent: #2557d6;
  --accent-text: #ffffff;
  --ok: #157a3c;
  --ok-bg: #e3f6ea;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --panel: #1b1e24;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2d313a;
    --accent: #5b8cff;
    --accent-text: #0b0d12;
    --ok: #6fdc97;
    --ok-bg: #12301f;
    --bad: #ff8a80;
    --bad-bg: #3a1714;
    --warn: #ffd37a;
    --warn-bg: #3a2c0c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

button, .btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 10px; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.link { border: none; background: none; color: var(--accent); padding: 4px 6px; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
input, select {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-width: 0;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text); margin: 8px 0; font-size: 15px; }
label.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-bottom: none; }
.table-scroll { overflow-x: auto; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.wait { background: var(--warn-bg); color: var(--warn); }
.tag.manual { background: var(--line); color: var(--text); }
.tag.off { background: var(--bad-bg); color: var(--bad); }

.notice { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { border-radius: 999px; }
.tabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Scan station ---------- */
.station { max-width: 760px; margin: 0 auto; padding: 16px; }
.who { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.who .name { font-size: 30px; font-weight: 800; }
.big-status {
  border-radius: 18px; padding: 28px 22px; text-align: center; margin-bottom: 14px;
  background: var(--panel); border: 2px solid var(--line); min-height: 170px;
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.big-status .headline { font-size: 34px; font-weight: 800; }
.big-status .detail { font-size: 19px; }
.big-status.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.big-status.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.big-status.wait { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.big-status .contents { display: inline-flex; flex-direction: column; gap: 4px; text-align: left; margin-top: 4px; font-size: 21px; color: var(--text); }
.big-status .contents .qty { font-weight: 800; display: inline-block; min-width: 2.2em; }
.big-status .contents .variant { font-weight: 800; }
.scan-input { width: 100%; font-size: 22px; padding: 16px; text-align: center; letter-spacing: .5px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .n { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 14px; }

.worker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.worker-grid button { padding: 22px 10px; font-size: 19px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 14px auto 0; }
.pinpad button { font-size: 26px; padding: 18px 0; }
.pin-dots { font-size: 34px; letter-spacing: 10px; text-align: center; min-height: 46px; }
.modal-back { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal { background: var(--panel); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; border: 1px solid var(--line); }

@media (max-width: 560px) {
  .who .name { font-size: 24px; }
  .big-status .headline { font-size: 26px; }
  .stat .n { font-size: 28px; }
}

/* Password/PIN boxes mask themselves so browsers don't pop up "save password" or wipe what was typed */
input.masked { letter-spacing: 2px; }

/* Worker's own earnings on the scan station */
.stat.earn .n { color: var(--ok); }

/* "+$1.10" that pops up in the green box after each scan */
.earned-pop { font-size: 44px; font-weight: 900; color: var(--ok); line-height: 1.1; animation: earned-pop .45s ease-out; }
@keyframes earned-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .earned-pop { animation: none; } }
