/* Hi-Lights brand (Studio Precept guidelines, via the Hi-Lights design system).
   Red does the shouting, slate does the talking: mostly white and slate, red used deliberately. */

/* NeoSans Regular: headers. Frutiger is used only if it is installed on the device
   (the Frutiger files are restricted-embedding, so they are not served from here). */
@font-face { font-family: "NeoSans"; src: url("/fonts/NeoSans-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Frutiger HL"; src: local("Frutiger 45 Light"), local("Frutiger-Light"), local("FrutigerLTStd-Light"); font-weight: 300; }
@font-face { font-family: "Frutiger HL"; src: local("Frutiger 65 Bold"), local("Frutiger-Bold"), local("FrutigerLTStd-Bold"); font-weight: 700; }

:root {
  /* brand tokens */
  --red: #ef3e42;
  --red-70: #f4787b;
  --red-20: #fcd8d9;
  --red-10: #fdecec;
  --slate: #415968;
  --slate-70: #7a8b95;
  --slate-50: #a0acb4;
  --slate-20: #d9dee1;
  --slate-10: #eceef0;
  --white: #ffffff;
  /* roles */
  --surface: var(--white);
  --surface-alt: var(--slate-10);
  --ink: var(--slate);
  --accent: var(--red);
  --border: var(--slate-20);
  --ok: #1d7a46;
  --err: #b3261e;
  --radius-sm: 4px;
  --radius-md: 8px;
  --display: NeoSans, "Neo Sans", Ubuntu, "Trebuchet MS", sans-serif;
  --text: "Frutiger HL", "Frutiger LT Std", Hind, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light; /* the guidelines define no dark mode */
  /* roles used for dark mode (light values) */
  --page: var(--slate-10);
  --fill: var(--slate);          /* solid slate buttons, header bars, pills */
  --on-fill: #ffffff;            /* text on those fills */
  --band: #f6f7f8;               /* alternate table rows */
  --amber-bg: #fff4d6; --amber-line: #e8c766; --amber-strong: #c98a00;
  --ok-bg: #e3f3e8; --ok-line: #b9dfc5;
  --mgr-bg: #fff8f8;
  --ot-ink: #a3281e;
  --btn-hover: #33475a;
  --flag-bg: #fde3e3; --flag-ink: #b3261e;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 16px/1.45 var(--text);
}
.boot { padding: 2rem; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--display); font-weight: 400; }
button, input, select, textarea { font: inherit; color: inherit; }
strong, b { font-weight: 700; }

/* ---------- header ---------- */
.topbar {
  background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--border);
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.topbar .brand { display: flex; align-items: center; gap: 14px; margin-right: auto; text-decoration: none; color: inherit; }
.topbar .brand img { height: 36px; width: auto; display: block; margin: 4px 0; }
.topbar .brand span { font-family: var(--display); font-size: 1.15rem; border-left: 1px solid var(--border); padding-left: 14px; }
.topbar .who { font-size: .9rem; }
.nav { display: flex; gap: 4px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.nav a {
  color: var(--ink); text-decoration: none; padding: 11px 14px 9px; border-bottom: 3px solid transparent;
  white-space: nowrap; font-family: var(--display);
}
.nav a:hover { background: var(--slate-10); }
.nav a.on { border-color: var(--accent); }
main { padding: 16px; max-width: 1680px; margin: 0 auto; }

/* ---------- controls ---------- */
.btn {
  background: var(--fill); color: var(--on-fill); border: 1px solid var(--fill); border-radius: var(--radius-md); padding: 10px 16px;
  cursor: pointer; font-weight: 700; min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--btn-hover); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--slate-70); }
.btn.secondary:hover { background: var(--slate-10); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--slate-70); }
.btn.ghost:hover { background: var(--slate-10); }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--slate-70); border-radius: var(--radius-sm);
  background: var(--surface); min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--slate-70); }
input:disabled, select:disabled, textarea:disabled { background: transparent; color: var(--ink); border-color: transparent; opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 1px;
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.muted { color: var(--ink); font-size: .92rem; }
.error { color: var(--err); margin: .5rem 0; }
.notice { padding: 10px 14px; border-radius: var(--radius-md); margin: 0 0 12px; background: var(--red-10); border: 1px solid var(--red-20); }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- login ---------- */
.login { max-width: 420px; margin: 9vh auto 0; padding: 0 16px; }
.login .logo { display: block; height: 56px; width: auto; margin: 0 auto 24px; }
.login .logo-dark { height: 44px; margin-top: 6px; margin-bottom: 30px; }
.login .card { display: grid; gap: 12px; padding: 24px; }
.login h1 { color: var(--accent); font-size: 2rem; }
.login .foot { text-align: center; font-size: .75rem; margin-top: 16px; }

/* ---------- month bar ---------- */
.monthbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.monthbar h2 { font-size: 1.4rem; min-width: 9ch; text-align: center; }
.total-pill { background: var(--fill); color: var(--on-fill); padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.cost-pill { background: var(--red-20); color: var(--ink); }

/* ---------- timesheet grid ---------- */
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.sheet .head { display: none; }
.day {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px;
  border-bottom: 1px solid var(--border); position: relative;
}
.day:last-child { border-bottom: 0; }
.day.weekend { background: var(--slate-10); }
.day.incomplete { box-shadow: inset 4px 0 0 var(--accent); }
.day .date { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-size: 1.05rem; }
.day .date .hrs { font-variant-numeric: tabular-nums; font-family: var(--text); font-weight: 700; }
.day .full { grid-column: 1 / -1; }
.lbl { display: block; font-size: .75rem; margin-bottom: 2px; font-weight: 700; }
.lbl.mgmt::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }
.day textarea { resize: vertical; min-height: 44px; }
.day .mgmt-box textarea { border-color: var(--accent); background: var(--red-10); }
.day .mgmt-box textarea:disabled { border-color: transparent; }
.day .mgmt-box textarea:disabled:not(.has-note) { background: transparent; }
.status { font-size: .75rem; min-height: 1em; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }
.pair-hint { grid-column: 1 / -1; font-size: .8rem; font-weight: 700; }

@media (min-width: 1440px) {
  .sheet .head, .day {
    display: grid; align-items: start; gap: 6px; padding: 6px 10px;
    grid-template-columns: 74px minmax(120px, 1.6fr) 124px repeat(4, 86px) 68px 172px minmax(100px, 1fr) minmax(100px, 1fr) 96px;
  }
  .sheet .head {
    background: var(--fill); color: var(--on-fill); font-weight: 700; font-size: .85rem; text-align: center;
    padding-top: 10px; padding-bottom: 10px; position: sticky; top: 0; z-index: 2; align-items: center;
  }
  .sheet .head .mgmt-h { box-shadow: inset 0 -4px 0 var(--accent); margin: -10px -4px; padding: 10px 4px; align-self: stretch; display: flex; align-items: center; justify-content: center; }
  .day .date { grid-column: auto; display: block; padding-top: 10px; font-size: .95rem; }
  .day .date .hrs { display: none; }
  .day .full { grid-column: auto; }
  .day .lbl { display: none; }
  .day .hrs-cell { text-align: center; padding-top: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .day textarea, .day input, .day select { min-height: 38px; padding: 6px 8px; }
  .day textarea { height: 38px; overflow: hidden; resize: none; }
  .day .status { grid-column: auto; position: absolute; right: 12px; bottom: 1px; font-size: .65rem; }
  .pair-hint { display: none; }
}
@media (max-width: 1439px) { .day .hrs-cell { display: none; } .sheet { max-width: 680px; } .day .mgmt-box.empty-ro { display: none; } }

/* fixed cost: amount + what it was for */
.cost-inputs { display: grid; grid-template-columns: 76px 1fr; gap: 6px; }

/* work type colour coding (kept from the original sheet so staff recognise it); also applies when disabled */
select[data-wt] { font-weight: 700; }
select[data-wt="Event"]        { background: #d8eccb; color: #2d6a1b; }
select[data-wt="Sick"]         { background: #d6e6f7; color: #1d4f85; }
select[data-wt="Office"]       { background: #e6dcf5; color: #55338c; }
select[data-wt="Warehouse"]    { background: var(--red-20); color: #a3281e; }
select[data-wt="Holiday"]      { background: #fbe5a3; color: #7a5600; }
select[data-wt="Off"]          { background: var(--fill); color: var(--on-fill); }
select[data-wt="Other"]        { background: var(--slate-10); color: var(--ink); }
select[data-wt]:disabled      { opacity: 1; border-color: transparent; }

/* ---------- tables (overview / employees) ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--fill); color: var(--on-fill); font-size: .85rem; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: var(--band); }
tfoot td { font-weight: 700; background: var(--slate-10); border-top: 2px solid var(--slate); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.tag.open { background: var(--red-10); color: var(--ink); border: 1px solid var(--red-20); }
.tag.locked { background: var(--fill); color: var(--on-fill); }
.tag.off { background: var(--slate-10); color: var(--ink); }
.form-grid { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; } }
.team-filter { width: auto; min-width: 140px; min-height: 36px; padding: 6px 10px; }
td input { min-width: 140px; }
a.link { color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; background: none; border: 0; padding: 0; }

@media (max-width: 520px) {
  .topbar .brand img { height: 30px; }
  .topbar .brand span { font-size: 1rem; padding-left: 10px; }
  .topbar .who { order: 3; width: 100%; font-size: .8rem; margin-top: -4px; }
}

/* ---------- activity ---------- */
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.presence::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--slate-50); }
.presence.online { font-weight: 700; }
.presence.online::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.presence.never::before { background: transparent; border: 1.5px solid var(--slate-50); }
td .sub { display: block; font-size: .78rem; margin-top: 2px; }
.activity { margin-top: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.act-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.act-head h3 { font-size: 1.25rem; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-list li { display: flex; justify-content: space-between; gap: 6px 16px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.act-main { min-width: 0; overflow-wrap: anywhere; }
.act-change { font-variant-numeric: tabular-nums; }
.act-change .empty { font-style: italic; color: var(--slate-70); }
.act-when { font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Employees list: on phones each person becomes a card with a label above every box */
@media (max-width: 760px) {
  .people-wrap { background: transparent; border: 0; overflow: visible; }
  table.people, table.people tbody, table.people tr, table.people td { display: block; width: 100%; }
  table.people thead { display: none; }
  table.people tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 10px; }
  table.people tbody tr:nth-child(even) td { background: transparent; }
  table.people td { border: 0; padding: 0; white-space: normal; overflow-wrap: anywhere; }
  table.people td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 700; margin-bottom: 3px; }
  table.people td input, table.people td select { min-width: 0; width: 100%; }
  table.people td.actions:empty { display: none; }
}

/* ---------- sign-in code ---------- */
.code-step { display: grid; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.code-step[hidden] { display: none; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; min-height: 56px; }

/* ---------- clock-change notice and warning on a day ---------- */
.day .day-note, .day .day-warn { grid-column: 1 / -1; font-size: .85rem; border-radius: var(--radius-sm); padding: 6px 10px; }
.day .day-note { background: var(--slate-10); border: 1px solid var(--border); }
.day .day-warn { background: var(--amber-bg); border: 1px solid var(--amber-line); font-weight: 700; }
.day .day-warn[hidden] { display: none; }

/* ---------- team tick boxes under a manager's role ---------- */
.team-access { display: grid; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--border); }
.ticks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ticks label.check { min-height: 28px; }

/* "Sees all teams" tick box under a manager's role */
.role-field { display: grid; gap: 6px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; white-space: nowrap; }
label.check input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--ink); }
label.check[hidden] { display: none; }
td label.check input, table.people td label.check input { width: 18px; min-width: 0; flex: none; }
.role-field label.check { justify-self: start; }

/* Standard day button on each day, and the standard day setting on the Employees tab */
.std-btn {
  font: inherit; font-size: .8rem; font-weight: 700; color: var(--ink); background: var(--surface);
  border: 1px solid var(--slate-70); border-radius: 999px; padding: 4px 12px; min-height: 32px; cursor: pointer;
  font-family: var(--text); white-space: nowrap;
}
.std-btn:hover:not(:disabled) { background: var(--slate-10); }
.std-btn[aria-pressed="true"] { background: var(--fill); color: var(--on-fill); border-color: var(--fill); }
.std-btn[aria-pressed="true"]::before { content: "✓ "; }
.std-btn:disabled { opacity: .45; cursor: default; }
.std-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.std-short { display: none; }
@media (max-width: 1439px) {
  .day .date { flex-wrap: wrap; row-gap: 8px; }
  .day .date .std-btn { order: 3; width: 100%; min-height: 40px; font-size: .85rem; }
}
@media (min-width: 1440px) {
  .day .date { display: grid; gap: 6px; justify-items: start; }
  .day .date .std-btn { margin: 0; padding: 3px 8px; min-height: 26px; font-size: .72rem; }
  .std-long { display: none; } .std-short { display: inline; }
}
.std-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; min-width: 230px; }
.std-pair select { min-width: 0; }
.std-pair .std-type { grid-column: 1 / -1; }

/* ---------- break, overtime, day pay, manager overrides ---------- */
.small-print { font-size: .8rem; margin: -4px 0 10px; }
.ot-pill { background: var(--red-20); color: var(--ink); }
.pay-pill { background: var(--surface); color: var(--ink); border: 1px solid var(--slate-70); }
.day .hrs .ot-tag, .ot-cell { font-weight: 700; color: var(--ot-ink); }
.day .hrs .ot-tag { margin-left: 8px; font-size: .85rem; }
.break-tag { display: block; font-size: .65rem; font-weight: 400; white-space: nowrap; }
.ot-cell { display: none; }
.pay-inputs { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.pay-view { font-weight: 700; font-size: 1.05rem; padding: 6px 0; }
.day .pay-box.empty-ro { display: none; }
.day .overridden { border: 2px solid var(--amber-strong) !important; background: var(--amber-bg) !important; }
.override-note { grid-column: 1 / -1; background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: var(--radius-sm); padding: 6px 10px; font-size: .85rem; }
.override-note[hidden] { display: none; }
.override-notice { background: var(--amber-bg); border-color: var(--amber-line); }
@media (min-width: 1440px) {
  .sheet.with-ot .head, .sheet.with-ot .day {
    grid-template-columns: 74px minmax(110px, 1.6fr) 120px repeat(4, 84px) 64px 56px 160px minmax(90px, 1fr) minmax(90px, 1fr) 184px;
  }
  .ot-cell { display: block; text-align: center; padding-top: 10px; font-variant-numeric: tabular-nums; }
  .day .pay-box.empty-ro { display: block; }
  .pay-view { text-align: center; font-size: .95rem; padding-top: 10px; }
  .pay-inputs { grid-template-columns: 70px auto; gap: 6px; }
  .pay-inputs input[type="text"] { min-height: 38px; padding: 6px 8px; }
  .override-note { font-size: .78rem; padding: 4px 8px; }
}

/* ---------- employee-facing tweaks ---------- */
.confirmed-pill { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.pay-view { display: flex; align-items: center; gap: 8px; color: var(--ok); }
.pay-view .tick { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: var(--on-fill); font-size: .8rem; }
.mgmt-msg { background: var(--red-10); border: 1px solid var(--red-20); border-radius: var(--radius-sm); padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- phones: filled-in days shrink to one line ---------- */
.day-summary, .day-hide, .phone-only { display: none; }
@media (max-width: 1439px) {
  .phone-only { display: block; }
  .day.collapsed { display: block; padding: 0; }
  .day.collapsed > :not(.day-summary) { display: none !important; }
  .day.collapsed .day-summary {
    display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%;
    padding: 12px; background: transparent; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
  }
  .day.collapsed .day-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
  .sum-date { font-family: var(--display); font-size: 1.05rem; white-space: nowrap; }
  .sum-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
  .sum-right { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
  .sum-hrs { font-weight: 700; font-variant-numeric: tabular-nums; }
  .sum-hrs::after { content: " ›"; color: var(--slate-70); }
  .sum-tag { font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
  .sum-tag.changed { background: var(--amber-bg); border: 1px solid var(--amber-line); }
  .sum-tag.note { background: var(--red-10); border: 1px solid var(--red-20); }
  .sum-tag.paid { background: var(--ok-bg); color: var(--ok); }
  .day-hide:not([hidden]) { display: inline-block; order: 2; margin-left: auto; background: none; border: 0; padding: 4px 0; font: inherit; font-size: .85rem; font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; cursor: pointer; }
}

/* ---------- manager section: notes, day pay and Confirmed, set apart from the employee's fields ---------- */
.mgr-section { display: grid; gap: 10px; border: 1px solid var(--red-20); background: var(--mgr-bg); border-radius: var(--radius-md); padding: 10px 12px 12px; margin-top: 4px; }
.mgr-title { font-family: var(--display); font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.mgr-title::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--accent); }
.mgr-section .mgmt-box textarea { background: var(--surface); }
.mgr-section .mgmt-msg { background: var(--surface); }
@media (max-width: 1439px) {
  .day .mgr-section.empty-ro { display: none; }
}
@media (min-width: 1440px) {
  /* on wide screens the two boxes sit in their own columns, shaded and divided from the rest */
  .mgr-section { display: contents; }
  .mgr-title { display: none; }
  .day .mgmt-box, .day .pay-box { background: var(--mgr-bg); margin: -6px 0; padding: 6px 6px; align-self: stretch; }
  .day .mgmt-box { border-left: 3px solid var(--accent); padding-left: 10px; }
  .day .mgmt-box.empty-ro, .day .pay-box.empty-ro { display: block; }
  .day .mgmt-box.empty-ro > *, .day .pay-box.empty-ro > * { visibility: hidden; }
  .sheet .head .mgmt-h:first-of-type { border-left: 3px solid var(--accent); }
}

@media (max-width: 1439px) { .day .date .hrs { margin-left: 10px; } }

/* ---------- dark mode (per person, from the toggle in the header) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --red-10: #3a2224; --red-20: #5a2f32;
  --slate: #c9d4da; --slate-70: #7d8d97; --slate-50: #56656e; --slate-20: #2e3a42; --slate-10: #232d34;
  --white: #1b2329;
  --surface: #1b2329; --page: #11171b; --ink: #e3e9ec; --border: #2e3a42;
  --fill: #33495a; --on-fill: #f1f5f7; --btn-hover: #3f586b;
  --band: #20292f;
  --amber-bg: #3a3014; --amber-line: #8a6d1e; --amber-strong: #d6a530;
  --ok: #5fcf8e; --ok-bg: #1d3326; --ok-line: #2f5a3f;
  --mgr-bg: #261d20;
  --ot-ink: #ff9a90; --err: #ff8a80;
  --flag-bg: #5c1f1f; --flag-ink: #ffb4ab;
}
:root[data-theme="dark"] select[data-wt="Event"]     { background: #24401a; color: #b9e6a3; }
:root[data-theme="dark"] select[data-wt="Sick"]      { background: #1c3550; color: #a8cdf2; }
:root[data-theme="dark"] select[data-wt="Office"]    { background: #35284f; color: #d3bff2; }
:root[data-theme="dark"] select[data-wt="Warehouse"] { background: #4d2420; color: #f5b5ae; }
:root[data-theme="dark"] select[data-wt="Holiday"]   { background: #4b3a0c; color: #f6d77a; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
.theme-btn { white-space: nowrap; }

/* ---------- hours against the 8-hour day, and days over 12 hours ---------- */
.diff { font-weight: 700; font-variant-numeric: tabular-nums; }
.diff.over { color: var(--ot-ink); }
.diff.under { color: var(--ink); }
.day .hrs .diff { margin-left: 8px; font-size: .85rem; }
.day.long-day .hrs-cell, .day.long-day .hrs { background: var(--flag-bg); color: var(--flag-ink); border-radius: var(--radius-sm); }
.day.long-day .hrs { padding: 2px 6px; }
.day.long-day .hrs::after { content: " · over 12 hrs"; font-size: .75rem; }
@media (min-width: 1440px) { .day.long-day .hrs-cell { margin: 4px 0; padding: 6px 0; } }
td.flag { background: var(--flag-bg) !important; color: var(--flag-ink); font-weight: 700; }
td.flag .flag-note { display: block; font-size: .72rem; font-weight: 700; }

/* a day a manager has signed off: green tick next to the date on the employee's timesheet */
.day.signed-off .date .date-btn::after { content: " ✓"; color: var(--ok); font-weight: 700; }

.rate-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: .88rem; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); min-height: 36px; }
.rate-switch .rate-label { font-weight: 700; }

/* ---------- preset buttons with icons ---------- */
.icon { width: 1.3em; height: 1.3em; flex: none; vertical-align: -0.25em; }
.std-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.std-btn .icon { color: var(--accent); }
.std-btn[aria-pressed="true"] .icon { color: var(--on-fill); }
.std-btn[aria-pressed="true"]::before { content: none; }
.std-btn[aria-pressed="true"]::after { content: "✓"; margin-left: 2px; }
.preset-btns { display: flex; gap: 6px; }
@media (max-width: 1439px) {
  .day .date .preset-btns { order: 3; width: 100%; }
  .day .date .preset-btns .std-btn { flex: 1; width: auto; min-height: 40px; font-size: .85rem; }
}
@media (min-width: 1440px) {
  .day .date .preset-btns { flex-direction: column; align-items: flex-start; gap: 4px; }
  .day .date .preset-btns .std-btn { padding: 3px 7px; min-height: 24px; font-size: .7rem; gap: 4px; }
}
.preset-stack { display: grid; gap: 8px; }
.preset-name { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; }
.preset-name .icon, .preset-ro .icon, .site-switch .rate-label .icon { color: var(--accent); }
.preset-ro { display: flex; align-items: center; gap: 6px; }
.site-switch { margin-bottom: 14px; }
.site-switch .rate-label { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- day header: date, preset buttons and hours on one line ---------- */
.date-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: default; white-space: nowrap; }
.day .date { align-items: center; }
@media (max-width: 1439px) {
  .day .date { flex-wrap: nowrap; gap: 8px; }
  .date-btn { cursor: pointer; }
  .day .date .preset-btns { order: 0; width: auto; flex: 1; justify-content: flex-start; gap: 6px; }
  .day .date .preset-btns .std-btn { flex: 0 1 auto; width: auto; min-height: 34px; padding: 4px 10px; font-size: .78rem; }
  .day .date .hrs { margin-left: auto; white-space: nowrap; }
  .compact-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 10px; }
  .compact-bar .small-print { margin: 0; }
  .sum-main.empty { color: var(--slate-70); font-style: italic; }
}
@media (min-width: 1440px) {
  .sheet .head, .day { grid-template-columns: 128px minmax(110px, 1.6fr) 120px repeat(4, 84px) 64px 160px minmax(90px, 1fr) minmax(90px, 1fr) 184px; }
  .sheet.with-ot .head, .sheet.with-ot .day { grid-template-columns: 128px minmax(100px, 1.6fr) 118px repeat(4, 82px) 64px 56px 156px minmax(80px, 1fr) minmax(80px, 1fr) 184px; }
  .day .date { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding-top: 6px; }
  .day .date .preset-btns { flex-direction: row; gap: 4px; }
  /* icon-only buttons on wide screens; the label shows on hover */
  .day .date .preset-btns .std-btn { padding: 0; width: 30px; height: 30px; min-height: 0; border-radius: 50%; }
  .day .date .preset-btns .std-btn .std-long { display: none; }
  .day .date .preset-btns .std-btn[aria-pressed="true"]::after { content: none; }
}

/* ---------- matrix ---------- */
.seg { display: inline-flex; border: 1px solid var(--slate-70); border-radius: var(--radius-md); overflow: hidden; }
.seg button { background: var(--surface); color: var(--ink); border: 0; padding: 6px 14px; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; min-height: 36px; }
.seg button.on { background: var(--fill); color: var(--on-fill); }
.matrix-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 12px; }
.matrix-pick .rate-label { font-weight: 700; font-size: .88rem; }
.matrix-pick button.link { background: none; border: 0; padding: 0 4px; font: inherit; font-size: .88rem; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 10px 4px 8px; font-size: .85rem; }
.chip.on { border-color: var(--fill); }
.chip-team { display: inline-block; margin-left: 6px; font-size: .7rem; font-weight: 700; color: var(--slate-70); }
.mx-name .chip-team { display: block; margin: 0; }
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { white-space: nowrap; }
.matrix .mx-name { position: sticky; left: 0; z-index: 2; text-align: left; min-width: 150px; background: var(--surface); border-right: 1px solid var(--border); }
.matrix thead .mx-name { background: var(--fill); z-index: 3; }
.matrix tbody .mx-name { font-weight: 400; }
.mx-day { text-align: center; min-width: 104px; font-size: .78rem; }
.mx-day span { display: block; font-weight: 400; opacity: .85; }
.mx-day b { font-size: 1rem; }
.mx-day.today { box-shadow: inset 0 -4px 0 var(--accent); }
.matrix.month .mx-day { min-width: 92px; }
.mx-cell { vertical-align: top; padding: 6px 8px; border-left: 1px solid var(--border); min-width: 92px; font-size: .82rem; }
.mx-cell.we, .matrix tbody tr:nth-child(even) td.mx-cell.we { background: var(--slate-10); }
.mx-cell[data-wt]:not([data-wt=""]) { box-shadow: inset 4px 0 0 var(--slate-50); }
.mx-cell.mx-cell[data-wt="Event"] { box-shadow: inset 4px 0 0 #5aa03c; }
.mx-cell.mx-cell[data-wt="Office"] { box-shadow: inset 4px 0 0 #8a63c9; }
.mx-cell.mx-cell[data-wt="Warehouse"] { box-shadow: inset 4px 0 0 var(--accent); }
.mx-cell.mx-cell[data-wt="Holiday"] { box-shadow: inset 4px 0 0 #d9a400; }
.mx-cell.mx-cell[data-wt="Sick"] { box-shadow: inset 4px 0 0 #3a7bd5; }
.mx-link { display: grid; gap: 1px; color: inherit; text-decoration: none; }
.mx-link:hover .mx-times { text-decoration: underline; }
.mx-type { font-size: .7rem; font-weight: 700; color: var(--slate-70); text-transform: none; }
.mx-times { font-variant-numeric: tabular-nums; }
.mx-hrs { font-weight: 700; font-variant-numeric: tabular-nums; }
.mx-ok { color: var(--ok); font-weight: 700; }
.mx-cell.long .mx-hrs { color: var(--flag-ink); background: var(--flag-bg); border-radius: 3px; padding: 0 3px; justify-self: start; }
.mx-total { font-weight: 700; border-left: 1px solid var(--border); }

.compact-bar .btn { white-space: nowrap; flex: none; }
