:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #d9d4c8;
  --brand: #1f4e79;
  --brand-ink: #ffffff;
  --good: #1f7a4d;
  --warn: #b25e00;
  --bad: #b3261e;
  --soft: #eaf1f8;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 17px; line-height: 1.4; }
[hidden] { display: none !important; }

header.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--brand); color: var(--brand-ink); padding: 10px 20px;
}
header.bar h1 { font-size: 20px; margin: 0; margin-right: auto; }
header.bar a { color: var(--brand-ink); }
.pill {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18); font-weight: 600; font-size: 15px;
}
.pill.on { background: #2e9e68; }
.pill.off { background: rgba(0, 0, 0, 0.3); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
h2 { margin: 0 0 12px; font-size: 22px; }
h3 { margin: 18px 0 8px; font-size: 17px; }
.muted { color: var(--muted); }
.error { color: var(--bad); font-weight: 600; min-height: 1.4em; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.right { text-align: right; }
.grow { flex: 1; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px;
}
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--bad); }
button.big { font-size: 20px; padding: 14px 22px; }
button.small { padding: 4px 10px; font-size: 14px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
header.bar button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }

input, select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); max-width: 100%;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid #8fb8e0; outline-offset: 1px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
label input, label select { display: block; margin-top: 4px; width: 100%; font-weight: 400; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }

table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
.scroll { overflow-x: auto; }
#teams td:first-child { min-width: 170px; }
th { white-space: normal; vertical-align: bottom; }
td.actions button { margin: 0 0 4px 4px; }
.tag { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--brand); }
.tag.test { background: #fdecc8; color: var(--warn); }

/* POS */
.tap { text-align: center; padding: 50px 20px; }
.tap h2 { font-size: 34px; }
.tap input { font-size: 26px; text-align: center; width: 320px; letter-spacing: 0.08em; }
.pos { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .pos { grid-template-columns: 1fr; } }
.balances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.balance { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.balance b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.balance span { font-size: 13px; color: var(--muted); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item .name { flex: 1; font-size: 20px; font-weight: 600; }
.item .price { color: var(--muted); font-weight: 400; font-size: 16px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 52px; height: 52px; font-size: 26px; padding: 0; }
.qty output { width: 44px; text-align: center; font-size: 26px; font-weight: 700; }
.total-line { display: flex; justify-content: space-between; font-size: 24px; font-weight: 700; padding-top: 14px; }

.receipt {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; line-height: 1.35;
  background: #fffdf7; border: 1px dashed var(--line); padding: 14px 10px; margin: 0 auto;
  width: calc(32ch + 22px); white-space: pre; color: #111;
}
.receipt .B, .receipt .H { font-weight: 700; }
.receipt .H { font-size: 17px; text-align: center; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button[aria-selected="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.days button { min-width: 84px; font-size: 18px; }
.days button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: min(560px, 94vw); }
dialog::backdrop { background: rgba(20, 30, 40, 0.45); }

@media print {
  body * { visibility: hidden; }
  .receipt, .receipt * { visibility: visible; }
  .receipt { position: absolute; left: 0; top: 0; border: none; }
}
