/* Tokens. Neutral only: LGL has no design system yet, so black, white and Montserrat. */
:root {
  --ground:#f4f5f7; --card:#fff; --fg:#0f1115; --muted:#6b7280; --line:#e7e8ec; --soft:#f0f1f4;
  --bad:#b42318; --warn:#9a6700; --good:#1a7f37;
  --shadow:0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.05);
  --r-card:20px; --r-ctl:10px; --r-in:8px; --r-pill:9999px; /* control radius = card radius minus 10px padding; inner = control minus 2px track */
  --h-sm:28px; --h-md:32px; --h-lg:40px;
  --ease:150ms ease-out;
}
@media (prefers-color-scheme: dark) { :root {
  --ground:#0b0c0e; --card:#141518; --fg:#ececf0; --muted:#8b8f98; --line:#363942; --soft:#1c1e22;
  --bad:#ff7b72; --warn:#e3b341; --good:#56d364; --shadow:0 1px 2px rgba(0,0,0,.4);
} }
* { box-sizing:border-box; }
html { scrollbar-gutter:stable; }
body { margin:0; background:var(--ground); color:var(--fg); font:400 15px/1.5 Montserrat, system-ui, sans-serif; -webkit-font-smoothing:antialiased; }
main { max-width:1440px; margin:0 auto; padding:32px 24px 72px; }
main.narrow { max-width:520px; margin:48px auto; background:var(--card); border-radius:var(--r-card); box-shadow:var(--shadow); padding:32px; }
h1 { font-size:28px; line-height:1.15; letter-spacing:-.02em; font-weight:600; margin:0 0 24px; }
h2 { font-size:17px; line-height:1.3; font-weight:600; margin:32px 0 8px; }
h2:first-child { margin-top:0; }
p { margin:0 0 12px; }
label, legend { display:block; font-size:13px; font-weight:500; margin:20px 0 8px; padding:0; }
fieldset { border:0; padding:0; margin:0; min-width:0; }
.hint { color:var(--muted); font-size:13px; }
.err { color:var(--bad); } .ok { color:var(--good); }
.msg { min-height:20px; margin:12px 0; font-size:13px; }
[hidden] { display:none !important; }

/* controls: 40 prominent (forms), 32 standard, 28 inside rows */
input, select, textarea, button { font:inherit; color:inherit; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width:100%; height:var(--h-lg); padding:0 12px; border:1px solid var(--line); border-radius:var(--r-ctl); background:var(--card);
  transition:border-color var(--ease);
}
textarea { height:auto; min-height:88px; padding:10px 12px; resize:vertical; line-height:1.5; }
input:hover, select:hover, textarea:hover { border-color:color-mix(in srgb, var(--fg) 30%, var(--line)); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline:2px solid var(--fg); outline-offset:2px; }
button { height:var(--h-lg); padding:0 18px; border:1px solid var(--fg); border-radius:var(--r-ctl); background:var(--fg); color:var(--card); font-weight:500; cursor:pointer; transition:opacity var(--ease), background-color var(--ease); }
button:hover { opacity:.88; } button:active { opacity:.78; }
button.ghost { background:transparent; color:var(--fg); border-color:var(--line); }
button.ghost:hover { background:var(--soft); opacity:1; }
button:disabled { opacity:.45; cursor:default; }
.bar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:0 0 16px; }
.bar input, .bar select { width:auto; height:var(--h-md); }
.bar button { height:var(--h-md); }

/* tabs and filters are pills; current one is filled soft and 500 */
.pills { display:flex; gap:6px; flex-wrap:wrap; }
.pill { height:var(--h-md); padding:0 14px; border-radius:var(--r-pill); border:1px solid var(--line); background:transparent; color:var(--muted); font-size:13px; font-weight:400; }
.pill:hover { background:var(--soft); opacity:1; }
.pill.on { background:var(--soft); color:var(--fg); border-color:var(--fg); font-weight:500; }
.top { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:24px; flex-wrap:wrap; }
.top h1 { margin:0; }
.top button { height:var(--h-md); }

/* surfaces */
.card { background:var(--card); border-radius:var(--r-card); box-shadow:var(--shadow); padding:24px; }
.card.flush { padding:0; overflow:hidden; }
.hero { display:flex; align-items:center; gap:20px; margin:0 0 24px; padding:8px 4px; }
.fig { font-size:56px; line-height:1; letter-spacing:-.03em; font-weight:600; font-variant-numeric:tabular-nums; min-width:56px; }
.hero .lead { font-size:21px; line-height:1.3; letter-spacing:-.01em; margin:0 0 4px; }
.hero .sub { color:var(--muted); font-size:13px; margin:0; }
.tools { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:16px 20px; flex-wrap:wrap; border-bottom:1px solid var(--line); }
.tools select { width:auto; height:var(--h-md); font-size:13px; }

/* the table */
.wrap { overflow-x:auto; }
table { border-collapse:collapse; width:100%; font-size:13px; }
th { text-align:left; font-weight:500; color:var(--muted); white-space:nowrap; padding:10px 8px; border-bottom:1px solid var(--line); }
td { padding:6px 8px; height:44px; vertical-align:middle; }
th:first-child, td:first-child { padding-left:20px; }
th:last-child, td:last-child { padding-right:20px; }
tr.r:hover td { background:color-mix(in srgb, var(--soft) 60%, transparent); }
tr.grp td { height:40px; padding-top:16px; font-size:13px; font-weight:500; background:var(--card); border-bottom:1px solid var(--line); }
tr.grp .n { color:var(--muted); font-weight:400; margin-left:6px; }
td.name { white-space:nowrap; }
td.num, th.num { font-variant-numeric:tabular-nums; }
tr.detail td { height:auto; padding:12px 20px 20px; background:var(--soft); }
.notes { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.notes label { margin:0 0 6px; }
@media (max-width:720px) { .notes { grid-template-columns:1fr; } }

input.sm, .rbtn, .chev { height:var(--h-sm); font-size:13px; }
input[type=date].sm { width:120px; padding:0 8px; border-color:transparent; background:transparent; }
tr.r:hover input[type=date].sm, input[type=date].sm:focus-visible { border-color:var(--line); background:var(--card); }
.rbtn { max-width:280px; padding:0 10px; display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:var(--r-ctl); background:transparent; color:var(--fg); font-weight:400; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rbtn:hover { background:var(--soft); opacity:1; }
.rbtn.empty { color:var(--muted); border-style:dashed; }
.chev { width:var(--h-sm); padding:0; border:0; background:transparent; color:var(--muted); display:inline-grid; place-items:center; }
.chev:hover { background:var(--soft); color:var(--fg); opacity:1; }
.chev svg { transition:transform var(--ease); }
.chev[aria-expanded=true] svg { transform:rotate(180deg); }

/* status chip: a word, a dot, and the only full-round shape in the app besides pills */
.chip { display:inline-flex; align-items:center; gap:6px; height:22px; padding:0 10px; border-radius:var(--r-pill); background:var(--soft); font-size:13px; white-space:nowrap; }
.chip::before { content:''; width:6px; height:6px; border-radius:var(--r-pill); background:var(--muted); }
.chip.overdue { color:var(--bad); } .chip.overdue::before { background:var(--bad); }
.chip.due { color:var(--warn); } .chip.due::before { background:var(--warn); }
.chip.ok { color:var(--good); } .chip.ok::before { background:var(--good); }

/* popover for choosing responsible people */
.pop { position:fixed; z-index:20; min-width:220px; max-height:320px; overflow:auto; padding:6px; background:var(--card); border:1px solid var(--line); border-radius:var(--r-ctl); box-shadow:0 12px 32px rgba(16,24,40,.16); }
.pop label { display:flex; align-items:center; gap:10px; height:36px; margin:0; padding:0 10px; border-radius:var(--r-in); font-size:13px; font-weight:400; cursor:pointer; }
.pop label:hover { background:var(--soft); }
.pop input { width:16px; height:16px; accent-color:var(--fg); }
.toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); padding:10px 16px; border-radius:var(--r-ctl); background:var(--fg); color:var(--card); font-size:13px; box-shadow:var(--shadow); }

dialog { border:0; border-radius:var(--r-card); background:var(--card); color:var(--fg); max-width:440px; width:92%; padding:28px; box-shadow:0 24px 64px rgba(16,24,40,.25); }
dialog::backdrop { background:rgba(15,17,21,.45); }
.checks label { display:flex; gap:10px; align-items:center; font-weight:400; margin:4px 0; }
.checks input { width:16px; height:16px; accent-color:var(--fg); }

/* public form: answers are tiles, not radio dots */
.opts { display:flex; gap:8px; flex-wrap:wrap; }
.opts label { position:relative; display:flex; align-items:center; height:var(--h-lg); margin:0; padding:0 16px; border:1px solid var(--line); border-radius:var(--r-ctl); font-size:13px; font-weight:400; cursor:pointer; transition:background-color var(--ease), border-color var(--ease); }
.opts label:hover { background:var(--soft); }
.opts label:has(input:checked) { border-color:var(--fg); background:var(--soft); font-weight:500; }
.opts label:has(:focus-visible) { outline:2px solid var(--fg); outline-offset:2px; }
.opts input { position:absolute; opacity:0; inset:0; width:100%; height:100%; margin:0; cursor:pointer; }

@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }

/* answers read as plain words; the menu opens on click, an empty one shows a faint plus on hover */
.ans { height:var(--h-sm); min-width:72px; padding:0 8px; border:0; border-radius:var(--r-ctl); background:transparent; color:var(--fg); font-size:13px; font-weight:400; text-align:left; transition:background-color var(--ease), opacity var(--ease); }
.ans:hover { background:var(--soft); opacity:1; }
.ans.no { color:var(--bad); }
.ans.empty { color:var(--muted); opacity:0; }
tr.r:hover .ans.empty, .ans.empty:focus-visible, .ans.empty:hover { opacity:1; }
.pop .opt { display:flex; align-items:center; justify-content:space-between; width:100%; height:36px; padding:0 10px; border:0; border-radius:var(--r-in); background:transparent; color:var(--fg); font-size:13px; font-weight:400; text-align:left; }
.pop .opt:hover { background:var(--soft); opacity:1; }
.pop .opt.on { font-weight:500; }
.pop .opt.on::after { content:'\2713'; }

/* dictation button beside a label */
.lblrow { display:flex; align-items:flex-end; justify-content:space-between; margin-top:20px; }
.lblrow label { margin:0 0 8px; }
.mic { display:inline-flex; align-items:center; gap:6px; height:var(--h-md); padding:0 10px; margin-bottom:4px; border:1px solid var(--line); border-radius:var(--r-ctl); background:transparent; color:var(--muted); font-size:13px; font-weight:400; }
.mic:hover { background:var(--soft); color:var(--fg); opacity:1; }
.mic[aria-pressed=true] { background:var(--bad); border-color:var(--bad); color:#fff; }
.tabs { margin-bottom:24px; }
.pop .pad { padding:8px 10px; margin:0; }

/* overview: everything but the name is centred, headers included */
.grid th:nth-child(n+2):nth-child(-n+8), .grid td:nth-child(n+2):nth-child(-n+8) { text-align:center; }
.ans { text-align:center; }
.ans { white-space:nowrap; }

/* history of the last three updates */
.hist { margin-top:20px; font-size:13px; }
.hist summary { cursor:pointer; font-weight:500; }
.histrow { padding:10px 0; border-bottom:1px solid var(--line); }
.histrow p { margin:0; white-space:pre-wrap; }
tr.detail .hist { grid-column:1 / -1; margin-top:16px; }

.brand { display:flex; align-items:center; gap:12px; margin-bottom:24px; }
.brand h1 { margin:0; }
.top .brand { margin:0; }
