/* Signal Box – British Rail corporate colours (1965 identity):
   Rail Blue for structure, Rail Grey for the ground, warning-panel yellow for caution and focus,
   signal red for danger. The lever-frame stripe under the header is the one decorative touch. */
@font-face {
  font-family: "Overpass";
  src: url("/fonts/overpass.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #1B3A5F; --brand-2: #2A507E; --brand-ink: #FFFFFF; --brand-deep: #0E2238;
  --red: #D2232A; --yellow: #F6C600; --black: #16202A; --blue: #2457A6;
  --bg: #E8EBEE; --panel: #FFFFFF; --ink: #16202A; --muted: #56616C; --line: #D2D8DE; --line-2: #BAC2CA;
  --key: #F6F7F9; --key-edge: #C3CBD3; --key-press: #E2E6EB; --sel: #DCE6F2;
  --good: #1F7A47; --warn: #9A6A00; --bad: #B71C22;
  --r-lg: 16px; --r-md: 10px; --r-sm: 7px;
  --rail: 92px; --tab: 64px;
  --font: "Overpass", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F151C; --panel: #17202A; --ink: #E7ECF1; --muted: #9AA6B2; --line: #26313D; --line-2: #34414F;
    --key: #1E2934; --key-edge: #0A0F15; --key-press: #283542; --sel: #1C3352;
    --brand-2: #4C7BB5; --good: #5CC489; --warn: #F2C94C; --bad: #F2766C; --blue: #8FB4E8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); min-height: 100vh;
  font: 16px/1.5 var(--font); font-feature-settings: "tnum" 0;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }

/* ---------- top bar & the lever-frame stripe ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: var(--brand); color: var(--brand-ink); min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--brand-ink); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: .01em; flex: none; }
.brand img { display: block; border-radius: 7px; }
.levers {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 29; height: 6px;
  /* a run of levers: red signals, yellow distant, black points, blue locks, white spare */
  background: repeating-linear-gradient(90deg,
    var(--red) 0 22px, var(--bg) 22px 26px, var(--red) 26px 48px, var(--bg) 48px 52px,
    var(--yellow) 52px 74px, var(--bg) 74px 78px, var(--black) 78px 100px, var(--bg) 100px 104px,
    var(--black) 104px 126px, var(--bg) 126px 130px, #2457A6 130px 152px, var(--bg) 152px 156px,
    #FFFFFF 156px 178px, var(--bg) 178px 182px);
  border-bottom: 1px solid var(--line);
}
#nav { display: flex; gap: 2px; align-items: center; margin-left: auto; flex-wrap: wrap; }
#nav a {
  display: inline-flex; align-items: center; gap: 7px; color: var(--brand-ink); text-decoration: none;
  padding: 7px 11px; border-radius: var(--r-sm); font-weight: 600; font-size: 15px; opacity: .82;
}
#nav a svg { width: 18px; height: 18px; opacity: .9; }
#nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
#nav a.on { opacity: 1; background: rgba(255,255,255,.14); box-shadow: inset 0 -3px 0 var(--yellow); }
.who-box { display: flex; align-items: center; gap: 10px; font-size: 14px; flex: none; }
.who-box .who-name { opacity: .75; }
.who-box button {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: var(--brand-ink); border-radius: var(--r-sm); padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.who-box button:hover { background: rgba(255,255,255,.1); }
.who-box svg { width: 16px; height: 16px; }

/* ---------- tab bar: side rail on tablets, bottom bar on phones ---------- */
#tabbar { display: none; }
#tabbar a, #tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; background: transparent; border: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; line-height: 1.15; text-align: center; padding: 8px 4px; border-radius: var(--r-md);
}
#tabbar svg { width: 24px; height: 24px; }
#tabbar a.on { color: var(--brand); background: var(--sel); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #tabbar a.on { color: var(--brand-ink); } }

main { max-width: 1180px; margin: 0 auto; padding: 20px 20px 40px; }

/* desktop: top menu */
@media (min-width: 1280px) { #tabbar { display: none !important; } }

/* tablet: rail on the left, top bar keeps brand + who */
@media (min-width: 700px) and (max-width: 1279px) {
  #nav { display: none; }
  .who-box { margin-left: auto; }
  #tabbar.has-items {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; z-index: 20; left: 0; top: calc(62px + env(safe-area-inset-top)); bottom: 0; width: var(--rail);
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto;
  }
  #tabbar .more { display: none; }
  body.railed main { margin-left: var(--rail); max-width: none; padding: 18px 18px 40px; }
}

/* phone: bottom bar with the main sections and a More sheet */
@media (max-width: 699px) {
  #nav { display: none; }
  .who-box { margin-left: auto; }
  .who-box .who-name, .who-box button span { display: none; }
  .brand { font-size: 17px; }
  #tabbar.has-items {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  }
  #tabbar .extra { display: none; }
  body.railed main { padding: 14px 12px calc(var(--tab) + 28px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(var(--tab) + 16px + env(safe-area-inset-bottom)) !important; }
}

/* More sheet (phones) */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(10, 20, 14, .45); display: flex; align-items: flex-end; }
.sheet-card {
  width: 100%; background: var(--panel); border-radius: 18px 18px 0 0; padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.2); animation: sheet-up .18s ease-out;
}
.sheet-card .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 2px auto 10px; }
.sheet-card a, .sheet-card button {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 10px; border: 0; background: transparent;
  color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 600; border-radius: var(--r-md); cursor: pointer; text-align: left;
}
.sheet-card a.on { background: var(--sel); }
.sheet-card svg { width: 22px; height: 22px; color: var(--muted); }
.sheet-card .sep { height: 1px; background: var(--line); margin: 6px 0; }
.sheet-card .who-line { padding: 4px 10px 8px; color: var(--muted); font-size: 14px; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-card { animation: none; } #toast { transition: none !important; } }

/* ---------- type & basics ---------- */
h1 { font-size: 28px; line-height: 1.15; font-weight: 800; margin: 2px 0 18px; letter-spacing: -.01em; }
h2 { font-size: 18px; line-height: 1.25; font-weight: 700; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 32px 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 6px; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.row.between { justify-content: space-between; }
h2.mt { margin-top: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); border-radius: var(--r-md);
  padding: 9px 15px; cursor: pointer; font-weight: 600; text-decoration: none; min-height: 40px; touch-action: manipulation;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line-2)); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.btn.small { padding: 4px 11px; font-size: 14px; min-height: 32px; border-radius: var(--r-sm); }
.btn.big { padding: 14px 24px; font-size: 18px; min-height: 52px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
a.btn { display: inline-flex; }

label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--panel); min-height: 44px;
}
textarea { resize: vertical; min-height: 0; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 2px;
}
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--brand); }
.form { max-width: 400px; margin: 28px auto; }
.form .field { margin-bottom: 14px; }
.err { color: var(--bad); min-height: 1.4em; font-size: 14px; font-weight: 600; margin: 4px 0; }
select.sel-inline { width: auto; padding: 5px 10px; min-height: 36px; }

/* login / setup */
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head img { width: 76px; height: 76px; border-radius: 18px; }
.auth-head h1 { margin: 12px 0 2px; }
.auth .form { margin: 0; max-width: none; }
.auth .btn.primary { width: 100%; min-height: 50px; font-size: 17px; }

/* ---------- Till ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.amount {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 4px;
  font-size: 56px; line-height: 1; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  padding: 22px 20px 18px; border-radius: var(--r-md); min-height: 96px;
  background: var(--brand); color: var(--brand-ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset 0 -4px 0 rgba(0,0,0,.18);
}
.amount.empty { color: color-mix(in srgb, var(--brand-ink) 45%, transparent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.key {
  font-size: 30px; font-weight: 700; padding: 16px 0; min-height: 64px; border-radius: var(--r-md); cursor: pointer;
  background: var(--key); border: 1px solid var(--line); box-shadow: 0 3px 0 var(--key-edge);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; font-variant-numeric: tabular-nums;
}
.key:active { background: var(--key-press); transform: translateY(2px); box-shadow: 0 1px 0 var(--key-edge); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.seg button, .who-btn {
  padding: 12px; border-radius: var(--r-md); border: 2px solid var(--line); background: var(--panel);
  cursor: pointer; font-weight: 700; min-height: 50px; touch-action: manipulation;
}
.seg button.on, .who-btn.on { border-color: var(--brand); background: var(--sel); box-shadow: inset 0 0 0 1px var(--brand); }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.who-btn { font-size: 20px; padding: 10px 4px; line-height: 1.1; }
.who-btn small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.record {
  width: 100%; font-size: 22px; padding: 18px; margin-top: 16px; border-radius: var(--r-md); border: 0; min-height: 66px;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; cursor: pointer; touch-action: manipulation;
  box-shadow: 0 4px 0 var(--brand-deep);
}
.record:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--brand-deep); }
.record:disabled { background: var(--line-2); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.big-total { font-size: 44px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 4px; }
.split { display: flex; gap: 6px 16px; color: var(--muted); font-size: 15px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.list li.void .sale-meta, .list li.void strong { text-decoration: line-through; color: var(--muted); }
.sale-meta { display: inline-flex; align-items: center; gap: 10px; }
.pay { font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--key); color: var(--muted); }
.pay-card { color: var(--blue); }
.list li.delete-ask { display: block; background: color-mix(in srgb, var(--bad) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line)); border-radius: var(--r-md); padding: 12px; margin: 6px 0; }
.list li.delete-ask .row { margin-top: 10px; }
.closed-banner { margin: 10px 0; padding: 12px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--yellow) 14%, var(--panel)); border: 1px solid var(--yellow); }
.closed-banner .btn { margin-top: 8px; }

/* ---------- reports & tables ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card { padding: 14px 16px; }
.card .label { font-size: 14px; color: var(--muted); font-weight: 600; }
.card .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.card .sub { font-size: 13px; color: var(--muted); }
.range { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.range .field { width: 170px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; border-bottom-color: var(--line-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 180px; max-width: 360px; }
tr.void td { color: var(--muted); text-decoration: line-through; }
tr.void td.keep { text-decoration: none; }

/* status pills: a coloured lamp + word, so meaning never relies on colour alone */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 2px 10px 2px 8px; border-radius: 99px; background: var(--key); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.pill.ok { color: var(--good); } .pill.ok::before { background: var(--good); }
.pill.wait { color: var(--warn); } .pill.wait::before { background: var(--yellow); }
.pill.off { color: var(--bad); } .pill.off::before { background: var(--red); }

/* ---------- rota ---------- */
.rota-day { display: grid; grid-template-columns: 130px 1fr 1fr; gap: 12px; align-items: start; margin-top: 12px; }
.rota-day.is-today { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.rota-day.past { opacity: .7; }
.rota-date strong { font-size: 17px; }
.rota-date .pill { margin-top: 6px; }
.rota-cell { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 9px; background: var(--panel); }
.rota-cell.short { border-color: var(--yellow); box-shadow: inset 3px 0 0 var(--yellow); }
.sess { font-weight: 700; }
.sess small { font-weight: 500; color: var(--muted); }
.count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.count.warn, .warn-text { color: var(--warn); font-weight: 700; }
.warn-text { font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--key); border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; font-size: 14px; font-weight: 600; }
.chip.me { background: var(--sel); border-color: var(--brand); }
.chip-x { border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; color: var(--muted); min-width: 22px; }
.chip-x:hover { color: var(--bad); }
label.check {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 16px; font-weight: 600;
  margin: 0 6px 6px 0; cursor: pointer; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--key);
}

/* ---------- timesheet ---------- */
.seg.seg3 { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.seg.seg3 button, .seg.seg4 button { font-size: 14px; padding: 9px 4px; min-height: 44px; }
.seg.seg4 { grid-template-columns: repeat(4, 1fr); margin: 4px 0 12px; }
.entry-form { border: 2px solid var(--brand); border-radius: var(--r-md); padding: 14px; margin-top: 10px; background: var(--panel); }
.entry-form .row.tight input { width: 136px; }
.entry-form .row.tight input[type="date"] { width: 176px; }
.entry-form .field { margin-bottom: 10px; }
.ts { display: flex; flex-direction: column; gap: 10px; }
.ts-day { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--panel); }
.ts-day.is-today { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.ts-day.future { opacity: .55; }
.ts-entry { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.ts-entry.rejected { opacity: .6; }
.ts-note { white-space: pre-wrap; margin-top: 6px; padding: 8px 12px; background: var(--bg); border-radius: var(--r-sm); font-size: 15px; border-left: 3px solid var(--line-2); }

/* ---------- end of day ---------- */
.cashup-calc { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; padding: 14px 16px; background: var(--bg); border-radius: var(--r-md); font-variant-numeric: tabular-nums; }
.cashup-calc .row { flex-wrap: nowrap; }
.diff.ok { color: var(--good); }
.diff.off { color: var(--warn); }
.row.tight label { margin: 0; }
.row.tight > input[type="date"] { width: 176px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translateX(-50%) translateY(16px);
  background: var(--black); color: #FFFFFF; padding: 13px 18px; border-radius: var(--r-md); opacity: 0;
  transition: opacity .18s, transform .18s; pointer-events: none; max-width: calc(100% - 32px); font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); border-left: 5px solid var(--brand-2);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { border-left-color: var(--red); }

/* ---------- responsive tuning ---------- */
@media (max-width: 1279px) {
  .pos { gap: 14px; }
}
/* tablet portrait and smaller: stack the till so the keypad gets the full width */
@media (max-width: 999px) {
  .pos { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .rota-day { grid-template-columns: 1fr; }
}
@media (max-width: 699px) {
  h1 { font-size: 24px; margin-bottom: 14px; }
  .panel { padding: 14px; border-radius: 14px; }
  .amount { font-size: 46px; min-height: 80px; padding: 18px 16px 14px; }
  .keypad { gap: 8px; margin-top: 10px; }
  .key { font-size: 27px; min-height: 58px; padding: 10px 0; }
  .who-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
  /* keep Record within thumb reach above the tab bar */
  .record { position: sticky; bottom: calc(var(--tab) + 10px + env(safe-area-inset-bottom)); z-index: 5; }
  .big-total { font-size: 38px; }
  .seg.seg4 { grid-template-columns: 1fr 1fr; }
  .range .field { width: calc(50% - 4px); }
  .cards { grid-template-columns: 1fr 1fr; }
  .card .value { font-size: 22px; }
  .row.between > h2 { margin-bottom: 4px; }
  .entry-form .row.tight input, .entry-form .row.tight input[type="date"] { width: 100%; }
  .entry-form .row.tight .field { flex: 1 1 120px; }
}
/* tablets: bigger keys for counter use */
@media (min-width: 700px) and (max-width: 1279px) {
  .key { min-height: 72px; font-size: 32px; }
  .who-btn { min-height: 62px; }
}
/* tablet on its side (the usual counter set-up): keypad on the left, who-served and Record on the right,
   so the whole sale fits on screen without scrolling */
@media (min-width: 900px) and (max-width: 1279px) and (orientation: landscape) {
  .pos { grid-template-columns: 1fr; }
  .till-main { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
  .till-main .ctl-col .seg { margin-top: 0; }
  .till-main .ctl-col h2.mt { margin-top: 18px; }
  .key { min-height: 64px; }
  .amount { min-height: 84px; font-size: 50px; padding: 18px 18px 14px; }
}
/* desktop: slightly shorter keys so Record stays in view on laptop screens */
@media (min-width: 1280px) {
  .key { min-height: 52px; padding: 8px 0; font-size: 28px; }
  .amount { min-height: 82px; font-size: 50px; padding: 16px 18px 12px; }
  .keypad { gap: 8px; }
  .till-main .ctl-col .seg { margin-top: 12px; }
}

/* ---------- print (end of day summary) ---------- */
@media print {
  .topbar, .levers, #tabbar, .sheet, .no-print, #toast, button, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  body.railed main, main { margin: 0; max-width: none; padding: 0; }
  .panel { border-color: #999; break-inside: avoid; }
}

/* ---------- contacts ---------- */
td.contact { white-space: normal; }
td.contact a { display: block; text-decoration: none; }
td.contact a:hover { text-decoration: underline; }
tr.editing td { background: var(--bg); }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.stack.narrow { max-width: 560px; }

/* ---------- rota print sheet ---------- */
.rota-tools { margin: -4px 0 14px; }
.rota-print { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  .rota-print { display: block; color: #000; }
  .rota-print .print-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .rota-print .print-title { font-size: 22px; font-weight: 800; }
  .rota-print table { border: 2px solid #1B3A5F; font-size: 13pt; }
  .rota-print th { background: #1B3A5F !important; color: #fff; font-size: 12pt; padding: 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rota-print td { white-space: normal; vertical-align: top; padding: 8px; border: 1px solid #999; width: 40%; }
  .rota-print td:first-child { width: 20%; }
  .rota-print .gap { color: #777; font-style: italic; }
  .rota-print .print-foot { font-size: 9pt; color: #555; margin-top: 8px; }
  main h1 { display: none; }
  .row.between:has(h1) { display: none; }
}

/* ---------- charts (Trends) ---------- */
:root { --c-main: #3A6797; --c-cash: #B06F00; --c-card: #2457A6; --c-ok: #1F7A47; --c-short: #E3A008; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --c-main: #6E9BD3; --c-cash: #C2861A; --c-card: #5B8FD9; --c-ok: #5CC489; --c-short: #E3A008; }
}
.section-head { font-size: 22px; font-weight: 800; margin: 26px 0 12px; }
.section-head:first-child { margin-top: 4px; }
.chart-card h2 { margin-bottom: 4px; }
.chart-note { margin: 0 0 8px; font-size: 14px; }
.chart { width: 100%; min-height: 120px; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: var(--ink); fill-opacity: .05; }
.bar.c-main { fill: var(--c-main); } .bar.c-cash { fill: var(--c-cash); } .bar.c-card { fill: var(--c-card); }
.bar.c-ok { fill: var(--c-ok); } .bar.c-short { fill: var(--c-short); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); margin: 2px 0 8px; font-weight: 600; }
.legend span, .split-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw.c-main, .seg.c-main, .hbar-fill.c-main { background: var(--c-main); }
.sw.c-cash, .seg.c-cash { background: var(--c-cash); }
.sw.c-card, .seg.c-card { background: var(--c-card); }
.sw.c-ok { background: var(--c-ok); } .sw.c-short { background: var(--c-short); }
.chart-tip {
  position: fixed; z-index: 70; pointer-events: none; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 11px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0,0,0,.15); font-variant-numeric: tabular-nums; max-width: 260px;
}
.chart-tip strong { display: block; margin-bottom: 2px; }
.hbars { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.hbar { display: grid; grid-template-columns: minmax(60px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 15px; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.hbar-track { height: 14px; border-radius: 0 4px 4px 0; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-value { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; text-align: right; min-width: 64px; }
.splitbar-track { display: flex; gap: 2px; height: 22px; margin: 6px 0 10px; }
.splitbar-track .seg { display: block; height: 100%; }
.splitbar-track .seg:first-child { border-radius: 4px 0 0 4px; } .splitbar-track .seg:last-child { border-radius: 0 4px 4px 0; }
.splitbar-track .seg:only-child { border-radius: 4px; }
.split-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-variant-numeric: tabular-nums; }
.btn.primary.small { color: var(--brand-ink); }
.who-box a.who-name { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-ink); text-decoration: none; padding: 5px 8px; border-radius: var(--r-sm); }
.who-box a.who-name:hover { background: rgba(255,255,255,.1); opacity: 1; }
#nav a { padding: 7px 9px; }
@media print { .chart-tip { display: none !important; } }

/* ---------- sample history ---------- */
.sample-panel { margin-top: 16px; }
.progress { margin: 6px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.progress-track { height: 10px; border-radius: 99px; background: var(--key); border: 1px solid var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .25s; }
@media (prefers-reduced-motion: reduce) { .progress-bar { transition: none; } }

/* quiet "more" button on each recent sale (delete lives behind it) */
.sale-more {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.sale-more svg { width: 20px; height: 20px; }
.sale-more:hover { background: var(--key); border-color: var(--line); color: var(--ink); }
.sale-more.on { background: var(--sel); border-color: var(--brand); color: var(--brand); }
.totals-box { margin-top: 4px; }
.totals-hint { margin: 10px 0 0; }

/* ---------- shop logo ---------- */
.brand-logo { height: 40px; width: auto; display: block; }
@media (max-width: 699px) { .brand-logo { height: 34px; } }
.auth-head img.auth-logo { width: min(100%, 360px); height: auto; border-radius: 0; }
.auth-head p { margin-top: 10px; }
.print-only { display: none; }
@media print {
  .print-only { display: flex !important; }
  .print-head { align-items: center; gap: 16px; margin-bottom: 12px; }
  .print-head img { height: 52px; width: auto; }
  .print-title { font-size: 22px; font-weight: 800; }
  .rota-print .print-head img { height: 52px; width: auto; }
}

/* ---------- backup ---------- */
.backup-panel { margin-top: 16px; }
.backup-panel .tips { margin: 6px 0 14px; padding-left: 20px; color: var(--muted); font-size: 15px; }
.backup-panel .tips li + li { margin-top: 4px; }
.file-in { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.backup-due {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r-md); font-weight: 600;
  background: color-mix(in srgb, var(--yellow) 18%, var(--panel)); border: 1px solid var(--yellow);
}
