/* Brinkburn St Brewery — Dashboard
   Brand: black & white with brewery copper. Poppins for headings (as on
   brinkburnbrewery.co.uk), IBM Plex Sans for figures and body text. */

:root {
  --ink: #000000;
  --ink-2: #3d3d3d;
  --ink-3: #6b6b6b;
  --line: #e2e1dd;
  --line-strong: #c9c7c1;
  --page: #f3f3f1;
  --panel: #ffffff;
  --copper: #bb864f;          /* brand accent */
  --copper-deep: #8f5f2e;     /* copper text on white (AA) */
  --copper-wash: #f6efe6;

  --s-tills: #b8721f;         /* chart series — validated for colour-blind separation */
  --s-online: #2a78d6;
  --s-xero: #a4407a;
  --s-prior: #9a9a96;

  --good: #2f7d32;
  --bad: #b3261e;
  --warn-bg: #fdf3e2;
  --warn-ink: #7a4b00;
  --bad-bg: #fbeceb;

  --radius-s: 4px;
  --radius-m: 8px;
  --sidebar: 248px;
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--page);
}
a { color: var(--copper-deep); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; line-height: 1.2; }
.num, table td.n, table th.n { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Shell ─────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: block; padding: 28px 24px 22px; text-decoration: none; color: #fff; }
.brand img { display: block; width: 150px; height: auto; }
.brand .brand-text { font: 600 18px/1.2 var(--font-head); }
.brand small { display: block; margin-top: 10px; font: 500 12px/1 var(--font-head); color: var(--copper); letter-spacing: .02em; }

.nav { padding: 6px 12px 16px; flex: 1; }
.nav h2 { font: 500 12px/1 var(--font-head); color: #8d8d8d; padding: 18px 12px 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-s);
  color: #d9d9d9;
  text-decoration: none;
  font: 500 14px/1.3 var(--font-head);
}
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; }
.nav a:hover { background: #1c1c1c; color: #fff; }
.nav a[aria-current="page"] { background: var(--copper); color: #000; }

.side-foot { padding: 16px 24px 22px; border-top: 1px solid #262626; font-size: 13px; color: #bdbdbd; }
.side-foot .who { color: #fff; font: 500 14px/1.3 var(--font-head); }
.side-foot .links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }
.side-foot .links a { color: #d9d9d9; text-decoration: none; }
.side-foot .links a:hover { color: var(--copper); }
.conn { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; }
.conn li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: none; }
.conn li[data-state="ok"] i { background: #6fbf73; }
.conn li[data-state="off"] i { background: #e06b5f; }

.main { min-width: 0; padding: 28px 36px 60px; }

/* Mobile top bar */
.topbar { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 30px; width: auto; }
  .topbar button { background: none; border: 1px solid #444; color: #fff; border-radius: var(--radius-s); padding: 6px 12px; font: 500 14px var(--font-head); }
  .main { padding: 18px 16px 48px; }
}

/* ── Toolbar & range heading ───────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.presets { display: flex; flex-wrap: wrap; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 4px; }
.presets button {
  border: 0; background: none; padding: 7px 10px; border-radius: var(--radius-s);
  font: 500 13.5px/1 var(--font-head); color: var(--ink-2); cursor: pointer;
}
.presets button:hover { background: var(--page); color: var(--ink); }
.presets button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.custom-range { display: none; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 100%; }
.custom-range.show { display: flex; }
.custom-range label { font-size: 13px; color: var(--ink-3); }
input[type="date"], select, input[type="text"], input[type="password"], input[type="search"] {
  font: 14px var(--font-body); color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: #fff;
  min-height: 38px;
}
.toolbar .spacer { flex: 1; }
.updated { font-size: 12.5px; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 14px/1 var(--font-head);
  padding: 10px 16px; border-radius: var(--radius-s);
  border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #262626; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.copper { background: var(--copper); border-color: var(--copper); color: #000; }
.btn.copper:hover { background: #a9773f; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e6b5b1; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.btn[disabled] { opacity: .5; cursor: default; }

.range-head { margin: 26px 0 22px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.range-head h1 { font-size: clamp(24px, 3.4vw, 38px); font-weight: 600; letter-spacing: -.01em; }
.range-head .report-name { font: 500 15px var(--font-head); color: var(--copper-deep); }
.range-head .days { font-size: 14px; color: var(--ink-3); }
.range-head .updated { margin-left: auto; }

/* ── Report controls (per report, one row) ─────────────────────────── */
.controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; margin-bottom: 18px; }
.controls label { display: grid; gap: 4px; font: 500 12.5px var(--font-head); color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 8px 13px; font: 500 13.5px var(--font-head); color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--copper-wash); color: var(--ink); box-shadow: inset 0 -2px 0 var(--copper); }

/* ── Content blocks ────────────────────────────────────────────────── */
#content { transition: opacity .15s; }
#content.loading { opacity: .25; pointer-events: none; filter: grayscale(.4); transition: opacity .15s; }

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m);
  margin-bottom: 18px;
}
.kpi { padding: 18px 22px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .label { font: 500 13px var(--font-head); color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi .label i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.kpi .value { font: 600 28px/1.15 var(--font-head); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi.lead .value { font-size: 34px; }
.kpi .sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.delta { font-weight: 600; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }
@media (max-width: 700px) { .kpi { border-right: 0; border-bottom: 1px solid var(--line); } .kpi:last-child { border-bottom: 0; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 18px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 16px 20px 0; }
.panel-head h2 { font-size: 16px; }
.panel-head .note { font-size: 13px; color: var(--ink-3); }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; }
.panel-body { padding: 14px 20px 20px; }
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.short { height: 220px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); padding: 12px 20px 0; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* Tables */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font: 500 12.5px var(--font-head); color: var(--ink-3); background: #fafaf8; position: sticky; top: 0; z-index: 1; }
table.data th.n, table.data td.n { text-align: right; }
table.data tbody tr:hover td { background: #faf8f4; }
table.data tr.total td { font-weight: 600; border-top: 2px solid var(--ink); border-bottom: 0; background: #fafaf8; }
table.data tr.sub td { font-weight: 600; background: #fafaf8; }
table.data tr.group td { font: 600 13px var(--font-head); background: #f5f4f0; color: var(--ink); padding-top: 12px; }
table.data td.empty { color: #b9b7b1; }
table.data tr.muted td { color: var(--ink-3); }
table.data td.best { color: var(--copper-deep); font-weight: 600; }
.tag { display: inline-block; font: 500 11.5px/1 var(--font-head); padding: 4px 7px; border-radius: 20px; margin-left: 8px; vertical-align: 1px; }
.tag.best { background: var(--copper-wash); color: var(--copper-deep); }
.tag.today { background: #eef4fc; color: #1d5aa6; }
.tag.off { background: #f0efeb; color: var(--ink-3); }
.pill { display: inline-block; font: 500 12px/1 var(--font-head); padding: 4px 8px; border-radius: 20px; background: #f0efeb; color: var(--ink-2); }
.pill.PAID { background: #e7f3e8; color: #22612a; }
.pill.AUTHORISED { background: var(--warn-bg); color: var(--warn-ink); }
.pill.DRAFT { background: #f0efeb; color: var(--ink-3); }

/* Staff grid */
table.data.grid td, table.data.grid th { padding: 7px 10px; }
table.data.grid th.day { text-align: center; line-height: 1.25; }
table.data.grid th.day b { display: block; font-weight: 600; color: var(--ink); }
table.data.grid th.day.we, table.data.grid td.we { background: #faf8f4; }
table.data.grid .sticky { position: sticky; left: 0; background: #fff; z-index: 2; box-shadow: 1px 0 0 var(--line); }
table.data.grid th.sticky { background: #fafaf8; z-index: 3; }
table.data.grid tr.group td.sticky, table.data.grid tr.sub td.sticky, table.data.grid tr.total td.sticky { background: inherit; }
.cell-h { font-weight: 600; text-align: center; }
.cell-h small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.cell-h.long { background: var(--bad-bg) !important; color: var(--bad); }
.cell-h.long small { color: var(--bad); }
.dept-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.who small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; }

/* Notices */
.notice { border-radius: var(--radius-m); padding: 12px 16px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.notice.warn { background: var(--warn-bg); border-color: #efd29f; color: var(--warn-ink); }
.notice.error { background: var(--bad-bg); border-color: #efc2be; color: #7d1a14; }
.notice.success { background: #e9f4ea; border-color: #bcdcbf; color: #1f5524; }
.notice.info { background: #eef4fc; border-color: #c9dcf5; color: #1d4a85; }
.empty-state { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.loading-line { padding: 60px 20px; text-align: center; color: var(--ink-3); font-family: var(--font-head); }

/* Tooltip (Chart.js external) */
.tip { position: absolute; pointer-events: none; background: #000; color: #fff; border-radius: var(--radius-s); padding: 9px 12px; font-size: 13px; min-width: 150px; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.tip .t { font: 500 12px var(--font-head); color: #c9c9c9; margin-bottom: 5px; }
.tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .r span { display: inline-flex; align-items: center; gap: 7px; color: #c9c9c9; }
.tip .r i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.tip .r b { font-variant-numeric: tabular-nums; font-weight: 600; color: #fff; }

/* ── Forms / admin pages ───────────────────────────────────────────── */
.page-title { margin: 6px 0 22px; }
.page-title h1 { font-size: 30px; }
.page-title p { margin: 6px 0 0; color: var(--ink-3); max-width: 70ch; }
.form-grid { align-items: start; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.field { display: grid; gap: 5px; }
.field > span { font: 500 13px var(--font-head); color: var(--ink-2); }
.field input, .field select { width: 100%; height: 40px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 16px; margin: 16px 0 0; }
legend { font: 600 14px var(--font-head); padding: 0 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; }
.checks label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.checks label small { display: block; color: var(--ink-3); font-size: 12.5px; }
.checks input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--copper-deep); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
details.edit > summary { list-style: none; cursor: pointer; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] { background: #fcfbf9; }
.user-row td { vertical-align: middle; }
.access { white-space: normal !important; max-width: 420px; color: var(--ink-2); font-size: 13px; }
.role { font: 500 12px/1 var(--font-head); padding: 4px 8px; border-radius: 20px; background: #f0efeb; }
.role.admin { background: #000; color: #fff; }
.status-off { color: var(--bad); font-weight: 500; }
.conn-card { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.conn-card:last-child { border-bottom: 0; }
.conn-card h3 { font-size: 16px; }
.conn-card p { margin: 4px 0 0; color: var(--ink-3); font-size: 13.5px; }
.conn-card .state { font: 500 13px var(--font-head); }
.conn-card form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); background: #fff; }
.login-art { background: #000; color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 44px; }
.login-art img { width: 260px; max-width: 70%; }
.login-form .remember { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 18px; cursor: pointer; }
.login-form .remember input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--copper); flex: none; }
.login-form .remember span { font-weight: 500; }
.login-form .remember small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.result-ok { color: #1a7f4b; font-weight: 600; }
.result-bad { color: #b42318; font-weight: 600; }
.result-info { color: var(--ink-3); }
.trust-tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: #f1e6d8; color: #7a5124; margin-left: 6px; white-space: nowrap; }
.login-art p { font: 500 15px/1.5 var(--font-head); color: #bdbdbd; max-width: 34ch; margin: 0; }
.login-art .stamp { font: 600 clamp(30px, 4vw, 48px)/1.1 var(--font-head); color: #fff; }
.login-art .stamp span { display: block; color: var(--copper); }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 44px clamp(24px, 6vw, 72px); }
.login-form h1 { font-size: 28px; margin-bottom: 6px; }
.login-form .lead { color: var(--ink-3); margin: 0 0 24px; }
.login-form .field { margin-bottom: 16px; }
.login-form .btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.login-form footer { margin-top: 30px; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; gap: 24px; }
  .login-art .stamp { font-size: 28px; }
}

@media print {
  .sidebar, .topbar, .toolbar, .week-row, .controls, .panel-head .actions { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .panel, .kpis { break-inside: avoid; }
}

/* Clickable chart legend */
.legend.interactive { align-items: center; }
.legend.interactive button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 4px 6px; margin: -4px -6px;
  border-radius: var(--radius-s); font: 13px var(--font-body); color: var(--ink-2); cursor: pointer; }
.legend.interactive button:hover { background: var(--page); }
.legend.interactive button i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend.interactive button[aria-pressed="false"] { color: #a8a6a0; text-decoration: line-through; }
.legend.interactive button[aria-pressed="false"] i { opacity: .25; }
.legend-groups { display: inline-flex; gap: 6px; margin-right: 10px; padding-right: 14px; border-right: 1px solid var(--line); }
.legend.interactive .chip { margin: 0; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 20px; font: 500 12.5px var(--font-head); text-decoration: none !important; color: var(--ink-2); }
.legend.interactive .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.legend.interactive .chip[aria-pressed="false"] { color: var(--ink-2); }
.legend.interactive .chip:hover { border-color: var(--ink); }
table.data.grid th.who { color: var(--ink); font: 500 14px var(--font-body); background: #fff; }

/* Expandable "Who paid" rows */
button.expand { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-align: left; }
button.expand:hover { color: var(--copper-deep); }
button.expand .chev { display: inline-block; width: 10px; color: var(--ink-3); transition: transform .15s; }
button.expand[aria-expanded="true"] .chev { transform: rotate(90deg); }
table.data tr.detail td { background: #fbfaf7; font-size: 13px; border-bottom-color: #efede8; }
table.data td.muted-cell { color: var(--ink-3); }
.grid-2 > * { min-width: 0; }

/* Wet / dry section on Hours vs income */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 30px 0 12px; padding-top: 22px; border-top: 1px solid #e3e1dc; }
.section-head h2 { font-size: 20px; margin: 0; }
.section-head .note { font-size: 13px; color: var(--ink-3); }
.footnote { font-size: 12.5px; color: var(--ink-3); margin: -4px 0 22px; max-width: 90ch; }

/* Products sold (Tills) */
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--copper-deep); text-decoration: underline; text-decoration-color: rgba(143, 95, 46, .35); text-underline-offset: 3px; cursor: pointer; text-align: inherit; }
.linkish:hover, .linkish:focus-visible { text-decoration-color: currentColor; }
.controls label.grow { flex: 1 1 220px; }
.controls label.grow input { width: 100%; }
.controls input[type="search"] { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); font: inherit; background: #fff; }
table.products td.cat { color: var(--ink-3); font-size: 13px; }
table.products td:first-child { font-weight: 500; }

/* Payments out */
.cat-input { width: 100%; max-width: 230px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); font: inherit; font-size: 13.5px; background: #fff; }
.cat-input:focus { outline: 2px solid var(--copper); outline-offset: 1px; }
.cat-status { display: block; font-size: 12px; color: var(--ink-3); }
.share { display: flex; align-items: center; gap: 8px; min-width: 120px; font-variant-numeric: tabular-nums; }
.share i { display: block; height: 8px; border-radius: 4px; background: var(--copper); flex: none; max-width: 70%; }
.hidden-tag { font-style: normal; font-size: 11.5px; color: #7a5124; background: #f1e6d8; padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
th button.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
th button.sort .arrow { color: var(--ink-3); font-size: 11px; }
th button.sort.on, th button.sort.on .arrow { color: var(--ink); }
select.cat-input { max-width: 240px; }
.cat-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Week buttons under the date bar */
.week-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.week-row .week-label { font: 500 12.5px var(--font-head); color: var(--ink-3); }
.week-row[hidden] { display: none; }
table.data tr.picked > td { background: var(--copper-wash); }
table.data th.sub-col { color: var(--ink-3); font-weight: 500; }

/* Loading banner */
.loader { position: sticky; top: 14px; z-index: 20; display: flex; align-items: center; gap: 14px; width: fit-content; max-width: 100%;
  margin: 0 auto 14px; padding: 12px 20px 12px 16px; background: #111; color: #fff; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.loader strong { display: block; font: 600 15px var(--font-head); }
.loader small { display: block; font-size: 12.5px; color: #c9c7c1; margin-top: 2px; }
.loader small:empty { display: none; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--copper); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
@media print { .loader { display: none !important; } }
.checks label.locked { opacity: .6; cursor: default; }

/* Other reports (owner-only section on the Users page) */
fieldset.other-reports { margin-top: 16px; border: 1px solid #e3cfb6; background: #fbf6ef; }
fieldset.other-reports legend { color: var(--copper-deep); }
.other-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; font-size: 13px; color: #6b4a26; max-width: 80ch; }
.other-note .lock { font-size: 13px; line-height: 1.4; }
.panel.private-panel { border-color: #e3cfb6; background: #fbf6ef; }
/* Staff tables (main and hidden-from-rota) line up column for column */
table.staff-grid { table-layout: fixed; width: 100%; }
table.staff-grid th:first-child, table.staff-grid td:first-child { width: 220px; }
table.staff-grid th:last-child, table.staff-grid td:last-child { width: 110px; }

/* Not takings list (Settings) */
.ignore-list ul { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-s); max-height: 320px; overflow: auto; background: #fff; max-width: 620px; }
.ignore-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ignore-list li:last-child { border-bottom: 0; }
.ignore-search { width: 100%; max-width: 620px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); font: inherit; }
td .ignore-btn { margin-left: 8px; font-size: 12px; padding: 2px 8px; }

/* Labour cost % against target */
.labour-pct { display: inline-block; font-weight: 600; padding: 1px 8px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.labour-pct.ok { background: #e3f3e8; color: #1a6b3c; }
.labour-pct.near { background: #fdf0d8; color: #8a5a00; }
.labour-pct.over { background: #fbe4e2; color: #a3261c; }
.ignored-out { list-style: none; margin: 0; padding: 0; max-width: 620px; }
.ignored-out li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* Labour cost: figures changed by hand, edit forms, spreadsheet comparison */
.tag.edited { background: #fff1d6; color: #8a5a00; }
.labour-editor { margin-top: 16px; padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: var(--radius-m); background: #fcfbf8; }
.labour-editor h3 { margin: 0 0 4px; font: 600 16px var(--font-head); }
.labour-editor .hint { margin: 0 0 14px; font-size: 13px; color: var(--ink-3); max-width: 80ch; }
.labour-editor[hidden] { display: none; }
.num-input, .note-input, .file-input { height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; font: inherit; background: #fff; width: 100%; }
.num-input { font-variant-numeric: tabular-nums; max-width: 160px; }
.num-input::placeholder { color: #b9b4aa; }
.file-input { padding: 7px 10px; max-width: 360px; }
.labour-sales-grid { display: grid; gap: 8px 10px; align-items: center; max-width: 760px; }
.labour-sales-grid strong { font: 600 13px var(--font-head); color: var(--ink-2); }
.labour-sales-grid .lab { font-size: 14px; }
.upload-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 6px; }
.panel .hint { font-size: 12.5px; color: var(--ink-3); }
table.compare td:first-child { min-width: 240px; white-space: normal; }
table.compare td, table.compare th { padding-left: 8px; padding-right: 8px; }
.cmp-name small { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; color: var(--warn-ink); max-width: 62ch; }
.cmp-name small.ok { color: var(--ink-3); }
table.data tr.diff-row td:first-child { box-shadow: inset 3px 0 0 #e0a83a; }
td.up-num, td.down-num { font-weight: 600; }
td.nowrap { white-space: nowrap; }
table.data tr.sub td { font-weight: 600; background: #faf9f6; }
td.edited-cell { background: #fff3d9 !important; box-shadow: inset 0 -2px 0 #e7b75a; cursor: help; }
.seg.wrap { flex-wrap: wrap; }
.tag.needs { background: var(--bad-bg); color: #7d1a14; }
td.needs-cell { color: #7d1a14; font-weight: 600; }
table.data tr.needs-row td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* Payroll checklist (Labour cost) */
.checklist { display: grid; gap: 10px; }
.check-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--radius-m); background: #fff6e6; border: 1px solid #f0d9ae; }
.check-top.ok { background: #eaf6ee; border-color: #bfe0c9; }
.check-top .note { color: var(--ink-3); font-size: 13px; }
.check-item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: #fff; }
.check-item.todo { border-color: #f0c98a; box-shadow: inset 3px 0 0 #e0a83a; }
.check-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.check-item.done .check-icon { background: #e1f3e6; color: #1a6b3c; }
.check-item.todo .check-icon { background: #fde7c4; color: #8a5a00; }
.check-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.check-state { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.check-item.todo .check-state { color: #8a5a00; }
.check-summary { margin: 4px 0 8px; font-size: 14px; color: var(--ink-2); max-width: 90ch; }
.check-editor { margin-top: 8px; }
.check-grid { display: grid; gap: 8px 10px; align-items: center; margin-bottom: 4px; max-width: 760px; }
.check-grid .lab { font-size: 14px; }
.check-grid .wk { font: 600 13px var(--font-head); color: var(--ink-2); }
.pp-tick { color: #1a6b3c; font-weight: 700; }
.rate-history { margin-top: 6px; display: grid; gap: 4px; }
.rate-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; }
.rate-line small { color: var(--ink-3); }
.rate-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.check-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.from-sheet { margin: 0 0 10px; font-size: 13px; color: #1f5f8b; background: #eef5fb; border: 1px solid #cfe3f3; border-radius: 8px; padding: 8px 10px; max-width: 90ch; }
.questions { margin: 6px 0 10px; display: grid; gap: 8px; }
.q-intro { margin: 0; font-weight: 600; font-size: 14px; color: #8a5a00; }
.q-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 12px; border-radius: 8px; background: #fff8ec; border: 1px solid #f0d9ae; font-size: 14px; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.checklist-steps { display: grid; gap: 10px; }
.checklist-steps[hidden] { display: none; }
.step-dots { display: inline-flex; gap: 6px; margin-left: 10px; vertical-align: middle; flex-wrap: wrap; }
.step-dot { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.step-dot.done { background: #d9f0e0; color: #14562f; }
.step-dot.todo { background: #fde2b8; color: #7a4b00; }
/* Pay period buttons: payroll checklist status */
/* Pay period buttons: separate cards in a grid, so the ✓ / ? badges line up down each column */
.week-row:has(.pp-grid) { display: block; }
.week-row:has(.pp-grid) .week-label { display: block; margin-bottom: 6px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 8px; }
.pp-grid button { white-space: nowrap; }
.pp-text { display: grid; gap: 1px; }
.pp-end { font-size: 12.5px; color: var(--ink-3); }
.pp-grid button[aria-pressed="true"] .pp-end { color: var(--ink-2); }
.pp-grid button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: #fff; font: 500 13.5px var(--font-head); color: var(--ink-2); cursor: pointer; line-height: 1.3; }
.pp-grid button:hover { border-color: var(--copper); }
.pp-grid button[aria-pressed="true"] { background: var(--copper-wash); color: var(--ink); border-color: var(--copper); box-shadow: inset 0 -2px 0 var(--copper); }
.pp-grid button:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
@media (max-width: 640px) { .pp-grid { grid-template-columns: 1fr; } .pp-grid button { padding: 11px 12px; } }
.pp-badge { display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 800; line-height: 1; }
.pp-badge.done { background: #1a7f43; color: #fff; }
.pp-badge.todo { background: #e39a1c; color: #fff; }
.check-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }

/* Daily takings — the spreadsheet, days across */
table.data.tk-sheet td, table.data.tk-sheet th { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
table.data.tk-sheet td.sticky { min-width: 190px; font-weight: 500; }
table.data.tk-sheet th.day b { font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
table.data.tk-sheet th.muted, table.data.tk-sheet td.muted { color: var(--ink-3); }
table.data.tk-sheet tr.group td { position: sticky; left: 0; }
table.data.tk-sheet tr.notes td { font-size: 15px; }
.tk-note { cursor: help; }
.tk-edit { display: grid; grid-template-columns: minmax(96px, auto) repeat(3, minmax(92px, 120px)) minmax(160px, 1fr); gap: 6px 10px; align-items: center; min-width: 640px; }
.tk-edit strong { font: 600 13px var(--font-head); color: var(--ink-2); }
.tk-edit .lab { font-size: 14px; white-space: nowrap; }
.tk-edit .lab.muted { color: var(--ink-3); }
.tk-edit .num-input, .tk-edit .note-input { width: 100%; }
.tk-badge { display: inline-flex; }
.tk-none { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.tk-none input { width: 18px; height: 18px; accent-color: #1a7f43; }
.tk-src { margin-left: 6px; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.tk-dh { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.tk-dh .pp-badge { width: 14px; height: 14px; font-size: 9px; }
table.data.tk-sheet td.tk-todo { color: var(--warn-ink); background: var(--warn-bg); font-weight: 700; text-align: center; }
table.data.tk-sheet td.tk-sheetval { color: var(--ink-2); }
.tk-edit .num-input:disabled { background: #f3f3f1; }

table.data td.strong { font-weight: 600; }

/* Kentucky Derby */
.derby-wrap { overflow-x: auto; }
.derby-track { display: block; width: 100%; min-width: 640px; height: auto; border-radius: 18px; }
.derby-track .dt-title { font: 800 30px var(--font-head); fill: rgba(255,255,255,.92); letter-spacing: .12em; }
.derby-track .dt-sub { font: 600 15px var(--font-body); fill: rgba(255,255,255,.85); }
.derby-track .dt-finish { font: 800 13px var(--font-head); fill: #fff; letter-spacing: .14em; }
.derby-track .dj-label { font: 700 11.5px var(--font-body); fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 3px; }
.derby-track .dj-label.top { font-size: 12.5px; fill: #ffe27a; }
.derby-track.running .leg.a { animation: dj-gallop .28s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: top center; }
.derby-track.running .leg.b { animation: dj-gallop .28s ease-in-out infinite alternate-reverse; transform-box: fill-box; transform-origin: top center; }
@keyframes dj-gallop { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@media (prefers-reduced-motion: reduce) { .derby-track.running .leg { animation: none; } }
.derby-podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 4px 0 22px; }
.dp-step { display: flex; flex-direction: column; align-items: center; width: 170px; text-align: center; }
.dp-medal { font-size: 30px; line-height: 1; }
.dp-fig { margin: 4px 0 2px; }
.dp-name { font: 600 15px var(--font-head); color: var(--ink); }
.dp-amt { font: 700 18px var(--font-head); color: var(--ink); margin: 2px 0 8px; }
.dp-block { width: 100%; border-radius: 10px 10px 0 0; color: #fff; font: 800 20px var(--font-head); display: flex; align-items: center; justify-content: center; }
.dp-step.p1 .dp-block { height: 96px; background: #d4a017; }
.dp-step.p2 .dp-block { height: 68px; background: #9aa3ad; }
.dp-step.p3 .dp-block { height: 48px; background: #b9773a; }
.dr-who { display: inline-flex; align-items: center; gap: 8px; }
.dr-bar { display: block; width: 160px; height: 10px; background: #efede8; border-radius: 6px; overflow: hidden; }
.dr-bar span { display: block; height: 100%; border-radius: 6px; }
.derby-edit { display: grid; grid-template-columns: 60px minmax(120px, 1fr) auto auto auto auto auto; gap: 12px 16px; align-items: center; min-width: 1040px; }
.de-name { font-weight: 600; display: flex; flex-direction: column; }
.de-name small { font-weight: 400; color: var(--warn-ink); font-size: 12px; }
.de-field { display: flex; flex-direction: column; gap: 4px; }
.de-field small { color: var(--ink-3); font-size: 12px; }
.de-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.de-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); cursor: pointer; padding: 0; }
.de-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.de-field input[type=color] { width: 48px; height: 30px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
@media (max-width: 640px) { .derby-podium { gap: 6px; } .dp-step { width: 31%; } .dp-fig svg { width: 60px; height: auto; } .dr-bar { width: 80px; } }
.derby-controls { margin-bottom: 12px; align-items: flex-end; }
.derby-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.derby-hour { font: 600 14px var(--font-head); color: var(--ink-2); min-width: 150px; }
.derby-track .dt-clock { font: 700 17px var(--font-head); fill: #ffe27a; }
.derby-tune { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.derby-tune h3 { margin: 0 0 4px; font: 600 15px var(--font-head); }
.derby-tune-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.de-phrow { display: flex; gap: 6px; align-items: center; }
.de-phbtn { position: relative; overflow: hidden; cursor: pointer; }
.de-phfile { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.de-phmsg { color: var(--ink-3); font-size: 11.5px; min-height: 14px; }
.de-prev svg { overflow: visible; }
.dp-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 4px solid; margin: 6px 0 -4px; background: #fff; }
.de-on button { padding: 4px 10px; font-size: 12.5px; }
.de-field select { max-width: 160px; }
.de-beers { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.de-beer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.de-beer input[type=text] { width: 190px; }
.de-cols { display: inline-flex; gap: 4px; }
.de-cols input[type=color] { width: 40px; height: 30px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.de-clip { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #f3f2ee; }
.de-clip.empty { display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 20px; }
.dp-name { display: flex; align-items: center; justify-content: center; gap: 6px; }
.dp-clip { height: 28px; width: auto; max-width: 40px; object-fit: contain; }
.derby-track .dt-title.arcade { fill: #0d5229; font-size: 30px; }
.derby-track .dt-sub.arcade { fill: #0d5229; font-size: 14px; }
.derby-track .dt-clock.arcade { fill: #0d5229; font-size: 16px; }
.derby-track .dt-seat { font: 800 15px var(--font-head); fill: #0d5229; }
.derby-track .dt-lane { font: 700 14px var(--font-body); fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.35); stroke-width: 3px; }
/* Derby full screen: one slim bar (race buttons · title · music & exit), the track fills the rest */
.derby-fsbar { display: none; }
.derby-stage:fullscreen, .derby-stage.derby-full { display: flex; flex-direction: column; gap: 8px; background: #0b3d22; padding: 8px 12px; box-sizing: border-box; }
.derby-stage.derby-full { position: fixed; inset: 0; z-index: 1000; overflow: hidden; }
body.derby-noscroll { overflow: hidden; }
.derby-stage:fullscreen .derby-controls, .derby-stage.derby-full .derby-controls { display: none; }
.derby-stage:fullscreen .derby-fsbar, .derby-stage.derby-full .derby-fsbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; flex: none; }
.fsb-left, .fsb-right { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.fsb-right { justify-content: flex-end; }
.fsb-title { text-align: center; color: #fff; line-height: 1.15; white-space: nowrap; }
.fsb-title b { display: block; font: 700 17px var(--font-head); }
.fsb-title span { font-size: 12px; color: #cfe6d7; }
.derby-fsbar label { font-size: 0; margin: 0; }           /* hide the "Race" / "Each hour" captions */
.derby-fsbar .seg button { font-size: 13px; padding: 5px 10px; }
.derby-fsbar .btn.small { font-size: 13px; padding: 5px 10px; white-space: nowrap; }
.derby-stage:fullscreen .derby-wrap, .derby-stage.derby-full .derby-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.derby-stage:fullscreen .derby-track, .derby-stage.derby-full .derby-track { width: 100%; height: 100%; max-width: 100%; min-width: 0; }
@media (max-width: 760px), (max-height: 480px) {
  .derby-stage:fullscreen, .derby-stage.derby-full { padding: 4px 6px; gap: 4px; }
  .derby-fsbar .seg button, .derby-fsbar .btn.small { font-size: 11.5px; padding: 3px 7px; }
  .fsb-title b { font-size: 14px; } .fsb-title span { font-size: 10.5px; }
}
