/* Layout: one column on phones; till and manager screens widen to two panes / tables. */
:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-2: #eef1ed;
  --ink: #17201c;
  --muted: #5a6761;
  --line: #d9dfd9;
  --accent: #1f5c47;        /* bottle green */
  --accent-ink: #ffffff;
  --accent-soft: #e2eee8;
  --brass: #a4762a;
  --good: #1d7445;
  --good-soft: #e1f2e7;
  --warn: #8f5d00;
  --warn-soft: #fbefd6;
  --bad: #b02a22;
  --bad-soft: #fbe4e1;
  --focus: #2d6bd0;
  --shadow: 0 1px 2px rgb(20 30 25 / 0.06), 0 8px 24px rgb(20 30 25 / 0.06);

  --display: 'Young Serif', Georgia, 'Times New Roman', serif;
  --body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r: 10px;
  --r-lg: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513; --surface: #18201c; --surface-2: #1f2824; --ink: #e5ebe7; --muted: #9ba9a2; --line: #2c3631;
    --accent: #62b893; --accent-ink: #0c1411; --accent-soft: #1b3128; --brass: #d3a650;
    --good: #5fc28a; --good-soft: #163022; --warn: #e2ab43; --warn-soft: #33270e; --bad: #f2827a; --bad-soft: #3a1c19;
    --focus: #7aa7f0; --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101513; --surface: #18201c; --surface-2: #1f2824; --ink: #e5ebe7; --muted: #9ba9a2; --line: #2c3631;
  --accent: #62b893; --accent-ink: #0c1411; --accent-soft: #1b3128; --brass: #d3a650;
  --good: #5fc28a; --good-soft: #163022; --warn: #e2ab43; --warn-soft: #33270e; --bad: #f2827a; --bad-soft: #3a1c19;
  --focus: #7aa7f0; --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--accent); }
small, .small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* Page shell for the standalone pages */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page.wide { max-width: 1120px; }
.brandbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.brandmark {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--display); font-size: 15px;
}
.brandname { font-family: var(--display); font-size: 1.15rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
}
.panel.flat { box-shadow: none; }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.92rem; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 12px; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
@media (max-width: 420px) { .choices { grid-template-columns: 1fr; } }
.choice {
  display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--ink);
}
.choice strong { font-size: 0.95rem; }
.choice span { font-size: 0.82rem; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

.codebox { font-family: var(--mono); font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--r); border: 1px solid transparent;
  padding: 11px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); padding-inline: 8px; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.big { padding: 18px 22px; font-size: 1.15rem; border-radius: var(--r-lg); }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }

/* Status */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.active, .pill.good { background: var(--good-soft); color: var(--good); }
.pill.pending, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.paused, .pill.rejected, .pill.bad, .pill.undone { background: var(--bad-soft); color: var(--bad); }
.notice { border-radius: var(--r); padding: 12px 14px; background: var(--surface-2); }
.notice.good { background: var(--good-soft); color: var(--good); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice strong { display: block; }
.error { color: var(--bad); font-weight: 600; }

/* Member card */
.membercard {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: 22px 22px 18px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.membercard::after {   /* brass edge, like a pub token */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--brass) 70%, transparent);
}
.membercard .who { font-family: var(--display); font-size: 1.7rem; line-height: 1.1; }
.membercard .meta { opacity: 0.85; font-size: 0.92rem; }
.qrwrap {
  background: #ffffff; border-radius: 14px; padding: 14px; margin-top: 18px;
  display: grid; justify-items: center; gap: 8px; color: #111;
}
.qrwrap svg { width: min(240px, 100%); height: auto; display: block; }
.qrwrap .mono { font-size: 1.35rem; letter-spacing: 0.12em; color: #111; }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .row { flex-wrap: nowrap; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  font: inherit; font-weight: 600; background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.78rem; margin-left: 4px; text-align: center; }

/* Till (inside the Lightspeed web view on an iPad) */
.till { display: flex; flex-direction: column; gap: 16px; }
.till .who { font-family: var(--display); font-size: 2rem; line-height: 1.1; }
.till input.big { font-size: 1.25rem; padding: 14px 16px; }
.verdict { border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); background: var(--surface); }
.verdict.yes { border-color: var(--good); box-shadow: inset 4px 0 0 var(--good); }
.verdict.no { border-color: var(--bad); box-shadow: inset 4px 0 0 var(--bad); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 50;
}

@media (prefers-reduced-motion: no-preference) {
  .fade { animation: fade 0.18s ease-out; }
  @keyframes fade { from { opacity: 0.4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

/* Manager screen: site rules and the weekly check */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 20px; }
.rule { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.checkcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.checkvalues { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; }
input[type="file"] { font: inherit; font-weight: 400; max-width: 100%; }

/* Rewards members and visit stamps */
.verdict.member { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.stamps { display: flex; flex-wrap: wrap; gap: 6px; }
.stamps span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; }
.stamps span.on { background: var(--accent); }
.membercard .stamps span { border-color: currentColor; }
.membercard .stamps span.on { background: currentColor; }

/* Star rating on the feedback page */
.stars { display: flex; gap: 8px; }
.stars button { font-size: 2rem; line-height: 1; width: 48px; height: 48px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; }
.stars button[aria-pressed="true"] { background: var(--accent-soft); color: var(--brass); border-color: var(--brass); }
.stars button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Wallet buttons on the card */
.wallet { display: flex; flex-wrap: wrap; gap: 8px; }
.wallet a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r);
  background: #000; color: #fff; text-decoration: none; font-weight: 600; font-size: 0.95rem; }

/* Manager screen: figures */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.figure .big { font-family: var(--display); font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.alert-row strong { display: block; }
