/* MTM Work Study — every colour is a custom property. No literals below the :root blocks.
 *
 * The palette is the shared MTM one (matching MTM Checkout / Inventory / Studios) rather
 * than anything invented here: the Georgia State blue bar is the brand, and an app in this
 * suite that looks like its own product is the bug. Contrast ratios are measured, not
 * guessed — tests/test_contrast.py re-measures them on every run.
 *
 * Phone-first: a DWR is filed one-handed, standing in a doorway, at the end of a shift.
 */
:root {
  --ink: #16151a;
  --ink-soft: #55525e;
  --ink-faint: #6e6a79;        /* AA 4.82:1 on --paper */
  --paper: #f7f5f2;
  --surface: #ffffff;
  --line: #e2ddd6;
  --line-strong: #cec7bd;

  /* MTM brand — Georgia State blue. The bar is this colour in BOTH themes:
     it is the brand, not a surface, so it does not follow the light/dark palette. */
  --mtm-blue: #0039A6;
  --mtm-blue-ink: #ffffff;
  --mtm-blue-dim: #bfdbfe;

  --accent: var(--mtm-blue);
  --accent-ink: #ffffff;
  --accent-soft: #dde7f8;

  --ok: #2f4a20;
  --ok-bg: #e5efdc;
  --warn: #7a4a11;
  --warn-bg: #f7ead6;
  --danger: #99301f;
  --danger-bg: #f8e3df;

  --radius: 6px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

/* 🔴 Defined ONCE. A dark palette written twice drifts, and is then wrong only for
   system-default users — now the majority path. These lines only REDEFINE tokens that
   already exist above; a colour whose sole definition lives here is how you get one
   theme's text on the other theme's background. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ece9e4;
    --ink-soft: #a5a0a9;
    --ink-faint: #8b8694;      /* AA 4.87:1 on --surface */
    --paper: #131217;
    --surface: #1c1a21;
    --line: #2e2b35;
    --line-strong: #453f4d;
    --accent: #6f9be8;
    --accent-ink: #131217;
    --accent-soft: #23303f;
    --ok: #a9cf8e;
    --ok-bg: #1e2a18;
    --warn: #e0b072;
    --warn-bg: #2e2415;
    --danger: #e79c8d;
    --danger-bg: #331c18;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px;
}

/* ── brand bar ───────────────────────────────────────────────────── */
.bar {
  background: var(--mtm-blue);
  color: var(--mtm-blue-ink);
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.bar h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.bar .ver { color: var(--mtm-blue-dim); font-size: 12px; }
.bar .who { margin-left: auto; color: var(--mtm-blue-dim); font-size: 13px; }

nav.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav.tabs button {
  flex: 0 0 auto;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
nav.tabs button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── layout ──────────────────────────────────────────────────────── */
main { max-width: 860px; margin: 0 auto; padding: 20px 16px 0; }
.view[hidden] { display: none; }

h2.page { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.02em; }
.lede { color: var(--ink-soft); margin: 0 0 18px; font-size: 15px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.card > header { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card > header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card > header p { margin: 4px 0 0; color: var(--ink-faint); font-size: 13px; }
.card .body { padding: 16px; }

/* ── form ────────────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--ink-faint); }

.control {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
}
.control:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea.control { resize: vertical; min-height: 74px; }

.row2 { display: flex; gap: 10px; flex-wrap: wrap; }
.row2 > * { flex: 1 1 130px; }

/* the running total, filled in as the times change */
.total {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 15px;
  color: var(--ink);
}
.total strong { font-size: 17px; }
.total.bad { background: var(--danger-bg); color: var(--danger); }

/* yes/no confirmation */
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice button {
  flex: 1 1 150px;
  padding: 12px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}
.choice button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.choice button[aria-pressed="true"].no {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn);
}

.btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 13px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
a.btn { display: inline-block; text-decoration: none; text-align: center; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  width: auto;
  padding: 8px 13px;
  font-size: 14px;
  font-weight: 500;
}
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

/* ── messages ────────────────────────────────────────────────────── */
.note {
  padding: 11px 13px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.note.ok    { background: var(--ok-bg);     color: var(--ok); }
.note.warn  { background: var(--warn-bg);   color: var(--warn); }
.note.info  { background: var(--accent-soft); color: var(--ink); }
.note.quiet { background: var(--surface);   color: var(--ink-soft); }
.empty { color: var(--ink-faint); font-size: 14.5px; padding: 4px 0; }

/* ── findings / lists ────────────────────────────────────────────── */
.finding { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; }
.finding .head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.finding .who-name { font-weight: 600; }
.finding .what { color: var(--ink-soft); font-size: 14.5px; margin-top: 3px; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid currentColor;
  white-space: nowrap;
  margin-left: auto;
}
.tag.review  { background: var(--warn-bg);   color: var(--warn); }
.tag.unknown { background: var(--surface);   color: var(--ink-soft); }
.tag.ok      { background: var(--ok-bg);     color: var(--ok); }

details.evidence { margin-top: 10px; }
details.evidence > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  list-style: none;
}
details.evidence > summary::-webkit-details-marker { display: none; }
details.evidence > summary::before { content: "▸ "; }
details.evidence[open] > summary::before { content: "▾ "; }
.evidence .panel {
  margin-top: 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.evidence .why { margin: 0 0 9px; font-style: italic; }
.evidence dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.evidence dt { color: var(--ink-faint); }
.evidence dd { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }

.item { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item p { margin: 0; }
.item .meta { font-size: 13px; color: var(--ink-faint); margin-top: 3px; }
.item.flag { border-left: 3px solid var(--warn); }

table.plain { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.plain th, table.plain td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.plain th { color: var(--ink-faint); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.scroll-x { overflow-x: auto; }

footer.ver-foot {
  max-width: 860px;
  margin: 22px auto 0;
  padding: 0 16px;
  color: var(--ink-faint);
  font-size: 12px;
}

/* ── signed out ──────────────────────────────────────────────────── */
.signin { max-width: 440px; margin: 14vh auto; padding: 0 18px; text-align: center; }
.signin h2 { font-size: 24px; margin: 0 0 8px; }

@media (max-width: 560px) {
  main { padding: 14px 12px 0; }
  .card .body, .finding, .item { padding-left: 13px; padding-right: 13px; }
  .tag { margin-left: 0; }
}

/* ── the projects board — the sheet's shape ──────────────────────── */
details.addrow { margin-bottom: 14px; }
details.addrow > summary {
  cursor: pointer; font-size: 14px; color: var(--accent);
  padding: 8px 0; list-style: none;
}
details.addrow > summary::-webkit-details-marker { display: none; }
details.addrow > summary::before { content: "+ "; font-weight: 700; }

.board-sec { margin-bottom: 18px; }
.board-sec > h3 {
  margin: 0 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-faint);
}
.board-sec .count { color: var(--ink-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }

table.board { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.board th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  color: var(--ink-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
}
table.board td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.board tr:last-child td { border-bottom: 0; }
table.board .loc { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
table.board .what { font-weight: 500; }
table.board .who { white-space: nowrap; color: var(--ink-soft); }
table.board .note { color: var(--ink-faint); font-size: 13px; }
table.board td.act { text-align: right; white-space: nowrap; }
table.board select.mini {
  font: inherit; font-size: 13px; padding: 4px 6px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--surface); color: var(--ink);
}
tr.is-done .what { text-decoration: line-through; color: var(--ink-faint); }
table.board td.cell { cursor: text; }
table.board td.cell:hover { background: var(--accent-soft); }
table.board .cell-in {
  font: inherit; width: 100%; box-sizing: border-box; padding: 4px 6px;
  border: 1px solid var(--accent); border-radius: 4px;
  background: var(--paper); color: var(--ink); resize: vertical;
}
table.board td.note .cell-in { font-size: 13px; }

/* The owner picker: several people per row, searchable across the registry. */
.owner-pick {
  min-width: 240px; display: flex; flex-direction: column; gap: 6px;
  padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper);
}
.owner-pick input[type="text"] {
  font: inherit; font-size: 13px; width: 100%; box-sizing: border-box;
  padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--surface); color: var(--ink);
}
.owner-list { max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; }
.owner-opt {
  display: flex; align-items: center; gap: 7px; padding: 4px 3px;
  font-size: 13.5px; white-space: nowrap; cursor: pointer;
}
.owner-opt:hover { background: var(--accent-soft); }
.owner-opt .tag {
  margin-left: auto; font-style: normal; font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft);
  padding: 1px 5px; border-radius: 3px;
}
.owner-list .empty { padding: 8px 3px; font-size: 13px; color: var(--ink-faint); }
.owner-free { display: block; font-size: 11.5px; color: var(--ink-faint); }
.owner-free input { margin-top: 3px; }
.owner-actions { display: flex; gap: 6px; }

/* Who said a board row was finished. Shown whatever the row's current status
   is: after Ben reopens a row, "Korbin called this done and it was reopened"
   is the state, and hiding half of it makes the reopen look unexplained. */
.done-by {
  display: block;
  font-size: .78rem;
  color: var(--ok);
  font-weight: 600;
  margin-top: 3px;
}

/* A day can hold several shifts. The add/remove controls are quiet on purpose:
   most days are one shift, and a loud button next to the times invites a second
   row nobody needs. */
.linkish {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.linkish:hover { text-decoration: underline; }

#f-shifts .shift + .shift { margin-top: 10px; }

.with-remove { display: flex; align-items: center; gap: 8px; }
.with-remove .control { flex: 1 1 auto; min-width: 0; }
.with-remove .remove-shift { flex: 0 0 auto; color: var(--ink-faint); }

/* Broken gear, forwarded from studio sessions. */
.gear-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-top: 1px solid var(--line);
}
.gear-row:first-of-type { border-top: 0; }
.gear-item { font-family: var(--mono); font-size: 13px; }
.gear-problem { margin: 2px 0 3px; }
.small { font-size: 12px; }

/* Coverage warning above the pay-period list. Loud on purpose: the failure it
   reports is otherwise completely silent. */
.banner-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* Teams — Ben's spreadsheet shape: a person per row, a team per column. */
table.grid { width:100%; border-collapse:collapse; font-size:14px; }
table.grid th, table.grid td { padding:7px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle; }
table.grid thead th { background:var(--surface); position:sticky; top:0; font-weight:600; font-size:13px; }
table.grid tr.meets th { font-weight:400; }
table.grid tr.meets .mt { color:var(--ink-faint); font-size:11px; line-height:1.3; display:block; }
table.grid th.vert span { display:block; font-size:12px; line-height:1.25; }
table.grid th.tick, table.grid td.tick { text-align:center; width:84px; }
table.grid td.nm { white-space:nowrap; }
table.grid td.em { font-size:13px; line-height:1.5; }
table.grid td.em .addr { display:block; overflow-wrap:anywhere; }
/* The grid needs the width: widen main only while Teams is showing. */
main:has(#view-teams:not([hidden])) { max-width: 1240px; }
/* 🔴 The label needs its own box AND a gap — without the margin it renders as
   "PERSONALjuggyboijuzzou@gmail.com", which is how it shipped in v0.34.1. */
table.grid td.em .addr .kind {
  display:inline-block; min-width:56px; margin-right:8px;
  color:var(--ink-faint); font-size:11px; text-transform:uppercase; letter-spacing:.04em;
}
td.tick .on {
  display:inline-block; width:9px; height:9px; border-radius:50%;
  background:var(--accent);
}
