/* PolyWorker — dark only. Jobs are coloured lanes; everything else stays quiet. */
/* The hidden attribute always wins. Without this, any class that sets display (.btn is inline-flex) shows an
   element the page meant to hide. */
[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --bg: #141826;
  --surface: #1C2133;
  --raised: #252B40;
  --line: #343B55;
  --line-soft: #2A3047;
  --text: #E4E7F1;
  --muted: #9AA2BD;
  --faint: #6C7491;
  --signal: #82A8FF;
  --signal-ink: #0F1630;
  --amber: #F2B356;
  --coral: #F07A78;
  --mint: #7FD1A8;
  --lane: var(--signal);
  --radius-s: 6px;
  --radius-m: 10px;
  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.4rem;
  --step-3: 1.85rem;
  --hover: rgb(255 255 255 / .04);
  --shadow: rgb(0 0 0 / .35);
}

/* Light mode, chosen in Settings (or "System" on a device set to light, below). Same roles, light values: every text colour keeps at least 4.5:1 contrast on
   the surfaces it sits on, and white text on the --signal buttons does too. */
[data-theme="light"] {
  color-scheme: light;
  --bg: #F3F4F8;
  --surface: #FFFFFF;
  --raised: #ECEEF4;
  --line: #CDD2DF;
  --line-soft: #E2E5EE;
  --text: #1B2033;
  --muted: #545D78;
  --faint: #636B86;
  --signal: #2F5FD0;
  --signal-ink: #FFFFFF;
  --amber: #9A5B00;
  --coral: #C2353A;
  --mint: #18794E;
  --hover: rgb(0 0 0 / .04);
  --shadow: rgb(27 32 51 / .16);
}

* { box-sizing: border-box; }
:root { --control-h: 2.7rem; }
html, body { margin: 0; height: 100%; }
/* Installed app (home screen): no rubber-band bounce or pull-to-refresh at the page edges, so it feels like an app.
   In a browser tab the browser's own bounce and pull-to-refresh are left alone. */
@media (display-mode: standalone), (display-mode: fullscreen) {
  html, body { overscroll-behavior: none; }
}
/* Panels that scroll on their own stop at their edges instead of dragging the page with them. */
.side, .cal-scroll, .chat-list, .messages { overscroll-behavior: contain; }
/* Auth screens opt out: iPhone browsers (Brave included) treat 100vh as taller
   than the visible page, so a 100%-tall body plus a 100vh card sits low. */
html:has(.auth-wrap), html:has(.legal),
html:has(.auth-wrap) body, html:has(.legal) body { height: auto; min-height: 100vh; min-height: 100svh; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--step-0)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-1); }
h3 { font-size: var(--step-0); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--step--1); }
.num { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; word-break: break-word; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.5rem 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  padding: 1.1rem .8rem;
  display: flex; flex-direction: column; gap: 1.1rem;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 650; font-size: 1.05rem; color: var(--text); padding: 0 .5rem; }
.brand:hover { text-decoration: none; }
/* Bars are sized in em so the mark scales with .brand's font-size (1em ≈ 16.8px at the default 1.05rem) */
.brand-mark { display: inline-flex; gap: .12em; }
.brand-mark i { width: .24em; height: 1.07em; border-radius: .12em; display: block; }
.brand-mark i:nth-child(1) { background: #82A8FF; }
.brand-mark i:nth-child(2) { background: #F2B356; height: .83em; margin-top: .24em; }
.brand-mark i:nth-child(3) { background: #7FD1A8; height: .6em; margin-top: .48em; }
.brand-name { line-height: 1; }
.brand small { color: var(--faint); font-weight: 400; font-size: .8em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--muted); padding: .42rem .6rem; border-radius: var(--radius-s);
  display: flex; justify-content: space-between; align-items: center;
}
.nav a:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--raised); color: var(--text); }
.nav-group-title { color: var(--faint); font-size: var(--step--1); padding: 0 .6rem .2rem; }
.nav .lane-link { border-left: 3px solid var(--lane); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding-left: .55rem; }
.nav .lane-link .live { width: 7px; height: 7px; border-radius: 50%; background: var(--lane); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lane) 25%, transparent); }
.side-foot { margin-top: auto; padding-top: .6rem; }
/* Account menu: one button at the foot of the sidebar; its menu opens upwards over the nav. */
.account-menu { position: relative; }
.account-btn { list-style: none; display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: var(--radius-s); cursor: pointer; color: var(--text); border: 1px solid transparent; }
.account-btn::-webkit-details-marker { display: none; }
.account-btn:hover, .account-btn.on, .account-menu[open] > .account-btn { background: var(--raised); }
.account-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.avatar { position: relative; flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 600; letter-spacing: .02em; background: color-mix(in srgb, var(--signal) 22%, var(--raised)); color: var(--text); }
.avatar-dot { position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--surface); }
.account-who { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.account-name { font-size: var(--step--1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { font-size: .75rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chev { flex: none; width: .65rem; height: .65rem; color: var(--faint); transform: rotate(180deg); transition: transform .15s ease; }
.account-menu[open] .account-chev { transform: none; }
.account-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + .4rem); z-index: 30; display: flex; flex-direction: column; gap: 2px; padding: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 10px 30px rgb(0 0 0 / .35); }
.account-signout { margin-top: .3rem; padding-top: .35rem; border-top: 1px solid var(--line-soft); }
.account-signout .btn { justify-content: flex-start; width: 100%; padding: .42rem .6rem; font: inherit; font-size: var(--step-0); font-weight: 400; color: var(--muted); border: 0; }
.account-signout .btn:hover { color: var(--text); background: var(--raised); }
.account-pop .side-legal a { padding: 0; border-radius: 0; background: none; }
.account-pop .side-legal { padding-bottom: .2rem; }
@media (prefers-reduced-motion: reduce) { .account-chev { transition: none; } }

.timer {
  border: 1px solid var(--line); border-left: 4px solid var(--lane);
  border-radius: var(--radius-s); padding: .6rem .7rem; background: var(--bg);
}
.timer .t { font: 600 1.25rem/1.1 var(--font-mono); font-variant-numeric: tabular-nums; }
.timer .who { font-size: var(--step--1); color: var(--muted); margin-bottom: .2rem; }
.timer form { display: inline; }
.timer .row { display: flex; gap: .4rem; margin-top: .45rem; flex-wrap: wrap; }
.focus-box {
  border: 1px dashed var(--lane); border-radius: var(--radius-s); padding: .5rem .7rem; background: var(--bg);
  margin-top: .5rem;
}
.focus-box .t { font: 600 1.1rem/1.1 var(--font-mono); font-variant-numeric: tabular-nums; }
.focus-box .who { font-size: var(--step--1); color: var(--muted); margin-bottom: .2rem; }
.focus-box .row { display: flex; gap: .4rem; margin-top: .45rem; flex-wrap: wrap; }
.away-dialog { width: min(520px, calc(100vw - 2rem)); padding: 1.1rem 1.2rem; border: 1px solid var(--line);
  border-radius: var(--radius-m); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.away-dialog::backdrop { background: rgba(0,0,0,.45); }
.away-dialog .actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.check-inline { display: inline-flex; gap: .3rem; align-items: center; margin: 0 .9rem .3rem 0; }
.plan-pick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; cursor: pointer; }
.plan-lane { border-left: 4px solid var(--lane); }
.list li.done { opacity: .6; }
/* ---------- public booking pages (templates/book) ---------- */
.book-body { background: var(--bg); }
.book-wrap { max-width: 1080px; margin: 0 auto; padding: 2.2rem 1.4rem 3rem; }
.book-head h1 { font-size: var(--step-2); letter-spacing: .01em; margin: 0; }
.book-head p { margin: .2rem 0 1.2rem; }
.book-intro { white-space: pre-line; max-width: 70ch; margin: -.4rem 0 1.2rem; color: var(--muted); }
.book-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; align-items: start; }
.book-grid > .panel + .panel { margin-top: 0; }
.book-pick-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft); padding-bottom: .7rem; margin-bottom: 1rem; }
.book-pick-head h2 { margin: 0; }
.book-tz label { display: flex; align-items: center; gap: .5rem; }
.book-tz select { max-width: 260px; color: var(--signal); background-color: transparent; border-color: transparent; text-align: right; }
.book-tz select:hover, .book-tz select:focus { border-color: var(--line); }
.book-lengths { display: flex; gap: .4rem; flex-wrap: wrap; margin: -.2rem 0 1rem; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: .25rem .75rem; font-size: var(--step--1); color: var(--muted); }
.pill:hover { border-color: var(--muted); text-decoration: none; color: var(--text); }
.pill.on { border-color: var(--signal); color: var(--signal); }
.book-cal-times { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.6rem; }
.book-month { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.book-month .btn { font-size: 1.15rem; line-height: 1; padding: .2rem .55rem; }
.book-days { width: 100%; border-collapse: collapse; table-layout: fixed; }
.book-days th { font-size: var(--step--1); font-weight: 500; color: var(--signal); padding: .35rem 0; text-align: center; }
.book-days td { text-align: center; padding: .15rem 0; }
.book-d { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 2.4rem;
  height: 2.4rem; border-radius: var(--radius-s); color: var(--faint); position: relative; font-variant-numeric: tabular-nums; }
.book-d.out { visibility: hidden; }
.book-d.today { font-weight: 700; }
.book-d.open { color: var(--signal); font-weight: 600; }
.book-d.open::after { content: ""; position: absolute; bottom: .3rem; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.book-d.open:hover { background: color-mix(in srgb, var(--signal) 14%, transparent); text-decoration: none; }
.book-d.on { background: var(--signal); color: var(--signal-ink); }
.book-d.on::after { background: var(--signal-ink); }
.book-times h3 { font-size: var(--step-0); font-weight: 600; margin: .35rem 0 .8rem; }
.book-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.book-slot { display: block; text-align: center; padding: .6rem .4rem; border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--text); font-variant-numeric: tabular-nums; }
.book-slot:hover { border-color: var(--signal); text-decoration: none; }
.book-slot.on { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 16%, transparent); color: var(--signal); font-weight: 600; }
.book-slot.extra { display: none; }
.book-more { text-align: center; margin: .9rem 0 0; }
.book-summary h2 { font-size: var(--step-0); margin: 0 0 .7rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line-soft); }
.book-sum-title { font-weight: 600; margin: 0 0 .2rem; }
.book-sum-when { margin: 0 0 .8rem; line-height: 1.45; }
.book-sum-facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; margin: 0 0 1rem; font-size: var(--step--1); }
.book-sum-facts dt { color: var(--faint); }
.book-sum-facts dd { margin: 0; color: var(--muted); }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.book-foot { margin-top: 2rem; text-align: center; }
@media (max-width: 860px) {
  .book-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .book-cal-times { grid-template-columns: 1fr; }
  .book-wrap { padding: 1.2rem .9rem 2rem; }
}

.main { padding: 1.8rem 2.2rem 4rem; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: .3rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.btn.menu-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  font: 500 var(--step--1)/1 var(--font); color: var(--text);
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .55rem .85rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--coral); }
.btn.danger:hover { border-color: var(--coral); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }
.btn.sm { padding: .35rem .6rem; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--signal); cursor: pointer; padding: 0; font: inherit; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.field label { font-size: var(--step--1); color: var(--muted); }
.field .help { font-size: var(--step--1); color: var(--faint); }
.field .err { font-size: var(--step--1); color: var(--coral); }
.field.check { flex-direction: row; align-items: center; gap: .5rem; }
.field.check.has-help { align-items: flex-start; }
.field.check.has-help > input { margin-top: .2rem; }
.field.check.has-help .help { display: block; margin-top: .15rem; }
/* Checkboxes side by side in a form grid line up at the top, even when one has help text under it. */
.form-grid > .field.check { align-items: flex-start; align-self: start; padding-top: .25rem; }
.form-grid > .field.check > input { margin-top: .2rem; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], input:not([type]), select, textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .55rem .65rem; font: inherit; font-size: var(--step-0);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); }
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }

/* Every single-line control is the same height in every browser. Browsers size dropdowns, date pickers and number
   boxes in their own way (Safari most of all), so the height is set rather than left to padding, and dropdowns
   are drawn here instead of by the browser. Compact controls further down set height: auto. */
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=time], input[type=search], input:not([type]), select {
  height: var(--control-h); line-height: 1.25; padding-top: 0; padding-bottom: 0;
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239AA2BD' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: .7rem auto;
}
[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23545D78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* "System" (the default when signed out, and a choice in Settings): light when the device is set to light, otherwise dark. Same values as light mode above. */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    color-scheme: light;
    --bg: #F3F4F8;
    --surface: #FFFFFF;
    --raised: #ECEEF4;
    --line: #CDD2DF;
    --line-soft: #E2E5EE;
    --text: #1B2033;
    --muted: #545D78;
    --faint: #636B86;
    --signal: #2F5FD0;
    --signal-ink: #FFFFFF;
    --amber: #9A5B00;
    --coral: #C2353A;
    --mint: #18794E;
    --hover: rgb(0 0 0 / .04);
    --shadow: rgb(27 32 51 / .16);
  }
  [data-theme="system"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23545D78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

select::-ms-expand { display: none; }
/* Safari and iOS: date fields add their own padding and centre the date. */
input[type=date]::-webkit-datetime-edit, input[type=datetime-local]::-webkit-datetime-edit,
input[type=time]::-webkit-datetime-edit { padding: 0; line-height: 1.25; }
input[type=date]::-webkit-date-and-time-value, input[type=datetime-local]::-webkit-date-and-time-value,
input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* iOS Safari gives date fields a minimum width wider than a phone column and ignores width: 100% until the
   native look is turned off. They keep their picker; only the box is ours. */
input[type=date], input[type=datetime-local], input[type=time] {
  -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%;
}
input[type=color] { width: 3rem; height: var(--control-h); padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer; }
.color-pair { display: flex; align-items: center; gap: .5rem; }
.color-pair input[type="color"] { flex: none; }
.color-pair input[type="text"] { flex: 1; width: auto; min-width: 0; }
input[type=checkbox] { accent-color: var(--signal); width: 1rem; height: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 1.1rem; }
.form-grid .wide { grid-column: 1 / -1; }
fieldset { border: 0; border-top: 1px solid var(--line-soft); padding: 1.1rem 0 0; margin: 0 0 1rem; }
legend { color: var(--text); font-weight: 600; padding-right: .6rem; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.inline-form .grow { flex: 1 1 220px; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters select, .filters input { width: auto; min-width: 9rem; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m); padding: 1.1rem 1.2rem; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.panel-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.stack > * + * { margin-top: 1rem; }

/* ---------- lanes (the signature element) ---------- */
.lanes { display: flex; flex-direction: column; gap: .55rem; }
.lane {
  display: grid; grid-template-columns: 6px minmax(140px, 1.1fr) minmax(170px, 1fr) minmax(0, 2fr) auto;
  gap: 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m);
  padding: .85rem 1rem .85rem 0; overflow: hidden;
}
.lane.is-live { border-color: color-mix(in srgb, var(--lane) 55%, var(--line)); }
.lane-bar { align-self: stretch; background: var(--lane); margin: -.85rem 0; }
.lane-name { font-weight: 600; }
.lane-name a { color: var(--text); }
.lane-meta { font-size: var(--step--1); color: var(--muted); }
.lane-ctx { font-size: var(--step--1); color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lane-ctx em { color: var(--faint); font-style: normal; }
.hours { display: flex; flex-direction: column; gap: .3rem; }
.hours-track { height: 6px; background: var(--raised); border-radius: 3px; position: relative; overflow: hidden; }
.hours-fill { position: absolute; inset: 0 auto 0 0; background: var(--lane); border-radius: 3px; }
.hours-fill.over { background: repeating-linear-gradient(-45deg, var(--lane), var(--lane) 4px, var(--amber) 4px, var(--amber) 8px); }
.core { display: inline-flex; align-items: center; gap: .3rem; }
.core::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.core.in::before { background: var(--mint); }

.capacity { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.capacity .big { font-size: var(--step-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.capacity-track { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--raised); margin: .6rem 0 .2rem; }
.capacity-track span { display: block; height: 100%; background: var(--lane); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .6rem 0; border-top: 1px solid var(--line-soft); display: flex; gap: .7rem; align-items: flex-start; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lane); flex: none; margin-top: .45rem; }
.tag { display: inline-block; font-size: .75rem; padding: .08rem .45rem; border-radius: 999px; background: var(--raised); color: var(--muted); border: 1px solid var(--line-soft); }
.tag.job { border-color: color-mix(in srgb, var(--lane) 50%, transparent); color: var(--text); }
.tag.job::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--lane); margin-right: .35rem; vertical-align: 1px; }
.tag.urgent, .tag.overdue { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 40%, transparent); }
.tag.high { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.tag.blocked { color: var(--amber); }
.tag.done { color: var(--mint); }
.tag.ai { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 40%, transparent); }
.status-form select {
  width: auto; min-width: 6.6rem; height: auto; padding: .2rem 1.5rem .2rem .15rem; background-position: right .4rem center; font-size: var(--step--1);
  background-color: transparent; border-color: transparent; color: var(--muted); cursor: pointer;
}
.status-form select:hover, .status-form select:focus { background-color: var(--bg); border-color: var(--line); color: var(--text); }

.list > li.task { align-items: center; gap: .85rem; padding-left: .7rem; border-left: 3px solid var(--lane); }
.task .meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin-top: .12rem; color: var(--faint); font-size: var(--step--1); }
.task .ref { color: var(--faint); }
.task .facts {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: .05rem;
  min-width: 7.4rem; text-align: right; font-size: var(--step--1); line-height: 1.35;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.task .facts .overdue { color: var(--coral); }
.task .facts .when:empty { min-height: 1.2em; }
.task .facts .est { color: var(--faint); }

.dayhead {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin: 1.25rem 0 .15rem; font-size: var(--step-0); font-weight: 600; color: var(--text);
}
h2 + .dayhead { margin-top: .15rem; }
.dayhead .total { color: var(--muted); font-weight: 500; }
.log { list-style: none; margin: 0; padding: 0; }
/* One grid per row. Desktop: time | length | what | Meeting tag, with the job under the time and any note
   under the title. The title links to the entry (or meeting) and its link covers the row; buttons sit above it. */
.log > li {
  position: relative;
  display: grid; grid-template-columns: 7.6rem 4.8rem minmax(0, 1fr) auto;
  grid-template-areas: "when dur work kind" "job job note note";
  gap: .3rem .8rem; align-items: baseline;
  padding: .55rem .15rem .55rem .7rem; border-top: 1px solid var(--line-soft); border-left: 3px solid var(--lane);
}
.log > li:first-child { border-top: 0; }
.log > li:hover { background: color-mix(in srgb, var(--lane) 5%, transparent); }
.log .when { grid-area: when; color: var(--muted); }
.log .dur { grid-area: dur; font-weight: 600; }
.log .kind { grid-area: kind; justify-self: start; align-self: start; }
.log .work { grid-area: work; min-width: 0; color: var(--text); text-decoration: none; }
.log .work.faint { color: var(--faint); }
.log .row-link::after { content: ""; position: absolute; inset: 0; }
.log .row-link:focus-visible { outline: none; }
.log .row-link:focus-visible::after { outline: 2px solid var(--signal); outline-offset: -2px; border-radius: var(--radius-s); }
.log .tag.job { grid-area: job; justify-self: start; }
.log .note { grid-area: note; color: var(--faint); font-size: var(--step--1); }
.log .row-delete, .log .row-actions {
  position: absolute; right: .15rem; top: .4rem; z-index: 1; opacity: 0; pointer-events: none;
  background: var(--surface); padding-left: .45rem;
}
.log .row-actions { display: flex; gap: .2rem; align-items: center; }
.log > li:hover > .row-delete, .log > li:focus-within > .row-delete,
.log > li:hover .row-actions, .log > li:focus-within .row-actions { opacity: 1; pointer-events: auto; }
.log .row-menu { display: none; }
.row-menu > summary { list-style: none; min-width: 2.2rem; justify-content: center; font-size: 1.1rem; line-height: 1; letter-spacing: .05em; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-list {
  position: absolute; right: 0; top: calc(100% + .3rem); z-index: 5; min-width: 12rem;
  display: grid; gap: .1rem; padding: .3rem; border-radius: var(--radius-s);
  background: var(--raised); border: 1px solid var(--line); box-shadow: 0 10px 30px rgb(0 0 0 / .35);
}
.row-menu-list form { margin: 0; }
.row-menu-list .btn { width: 100%; justify-content: flex-start; color: var(--text); }
/* Touch screens wider than a phone: no hover to reveal buttons, so meetings use the ⋯ menu and entries are edited by tapping. */
@media (hover: none) and (min-width: 821px) {
  .log .row-delete, .log .row-actions { display: none; }
  .log .row-menu { display: block; position: absolute; right: .15rem; top: .35rem; z-index: 1; }
}
.page-head + .timer-warning { margin-bottom: 1rem; }
.tidy { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }

/* Meetings marked Not attended: still shown, so they can be undone, but plainly out of the count. */
.not-attended .title, .not-attended .work, .cal-ev.not-attended .t { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
.agenda-item.not-attended, .meeting-row.not-attended { opacity: .62; }
.agenda-item.not-attended:hover, .agenda-item.not-attended:focus-within,
.meeting-row.not-attended:hover, .meeting-row.not-attended:focus-within { opacity: 1; }
.cal-ev.not-attended, .block.not-attended { opacity: .45; background: transparent !important; border: 1px solid var(--lane); color: var(--text) !important; }
.attend-note { margin: 0 0 1rem; align-self: end; }

table.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th { text-align: left; color: var(--faint); font-weight: 500; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* ---------- schedule ---------- */
/* Wide screens: the calendar fills the window and scrolls inside it, with the day and hour labels pinned.
   100dvh is the height actually visible; 100vh (the fallback for older browsers) can be taller on phones. */
.page-schedule { overflow: hidden; }
.page-schedule .shell,
.page-schedule .main { height: 100vh; height: 100dvh; }
.page-schedule .main {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding-bottom: 1.2rem;
}
.page-schedule .main > * { flex: none; }
.page-schedule .cal { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.cal { border: 1px solid var(--line-soft); border-radius: var(--radius-m); background: var(--surface); }
.cal-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.cal-head, .cal-body { display: grid; grid-template-columns: 3.6rem repeat(7, minmax(8.25rem, 1fr)); min-width: 62rem; }
.cal-head { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal-gutter, .cal-times { position: sticky; left: 0; z-index: 3; background: var(--surface); }
.cal-gutter { z-index: 5; }
.cal-dayhead { text-align: center; padding: .45rem .25rem .55rem; border-left: 1px solid var(--line-soft); }
.cal-dayhead .dow { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; }
.cal-dayhead .dom { display: inline-flex; align-items: center; justify-content: center; min-width: 1.7rem; height: 1.7rem; margin-top: .1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-dayhead.today .dow { color: var(--signal); }
.cal-dayhead.today .dom { color: var(--signal-ink); background: var(--signal); border-radius: 999px; }
.cal-col { position: relative; border-left: 1px solid var(--line-soft); }
.cal-col.today { background: color-mix(in srgb, var(--signal) 8%, transparent); }
.cal-slot { border-top: 1px solid var(--line-soft); box-sizing: border-box; }
.cal-hour { box-sizing: border-box; border-top: 1px solid transparent; color: var(--faint); font-size: .68rem; text-align: right; padding: .15rem .4rem 0 0; font-variant-numeric: tabular-nums; }
.cal-ev { position: absolute; z-index: 1; overflow: hidden; box-sizing: border-box; background: var(--lane); border-radius: 4px; padding: 2px 5px; font-size: .72rem; line-height: 1.25; }
.cal-ev:hover { text-decoration: none; filter: brightness(1.08); }
.cal-ev .t { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev .m, .cal-ev .why { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.cal-ev.hard { outline: 2px solid var(--coral); outline-offset: -2px; }
.cal-ev.soft { outline: 1px solid var(--amber); outline-offset: -1px; }
.cal-now { position: absolute; left: 0; right: 0; z-index: 2; height: 2px; background: var(--coral); pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -1px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
/* Phones and small tablets: the heading and buttons wrap and take much of the screen, so don't lock the page.
   The page scrolls normally, and the calendar is a window one screen tall: scroll the page until it fills the
   screen, then scroll inside it. When it reaches the top or bottom, scrolling carries on to the page. */
@media (max-width: 820px) {
  .page-schedule { overflow: visible; }
  .page-schedule .shell, .page-schedule .main { height: auto; }
  .page-schedule .main { display: block; overflow: visible; padding-bottom: 1.5rem; }
  .page-schedule .cal { display: block; }
  .page-schedule .cal-scroll { height: calc(100vh - 1.5rem - 2px); height: calc(100svh - 1.5rem - 2px); }  /* 2px: the frame's border */
}
/* Today and tomorrow: grouped by day; each meeting is its title, then time, job and tag on one line. */
.agenda-day + .agenda-day { margin-top: .4rem; }
.agenda .dayhead { margin-top: .9rem; }
.agenda .agenda-day:first-child .dayhead { margin-top: .1rem; }
.agenda .list > li.agenda-item { display: grid; gap: .3rem; padding: .6rem 0 .6rem .7rem; border-left: 3px solid var(--lane); }
.agenda-item .title { font-weight: 500; }
.agenda-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.agenda .when { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--step--1); }
.clash-text { color: var(--coral); font-size: var(--step--1); }
.clash-text.soft { color: var(--amber); }

.dayboard-scale, .dayrow { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .6rem; align-items: center; }
.dayboard-scale { margin-bottom: .15rem; }
.dayboard-scale .scale { position: relative; height: 1rem; }
.dayboard-scale .scale span { position: absolute; top: 0; color: var(--faint); font-size: .7rem; font-variant-numeric: tabular-nums; transform: translateX(-50%); }
.dayboard-scale .scale span:first-child { transform: none; }
.dayrow { margin: .3rem 0; }
.dayrow .name { color: var(--text); font-size: var(--step--1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .track { position: relative; height: 1.75rem; background: var(--bg); border-radius: 4px; }
.dayrow .coreband { position: absolute; top: 0; bottom: 0; background: var(--raised); border-radius: 3px; }
.dayrow .block { position: absolute; top: 3px; bottom: 3px; z-index: 1; overflow: hidden; white-space: nowrap; color: var(--text); font-size: .7rem; line-height: 1.35rem; padding: 0 .35rem; border-radius: 3px; border-left: 3px solid var(--lane); background: color-mix(in srgb, var(--lane) 42%, var(--bg)); }
.dayrow .block.hard { outline: 1px solid var(--coral); }
.dayrow .block.soft { outline: 1px solid var(--amber); }
.dayrow .block:hover { text-decoration: none; }
.dayrow .now { position: absolute; top: 0; bottom: 0; z-index: 2; width: 1px; background: var(--text); }
.switch-card { border-left: 4px solid var(--lane); background: var(--bg); border-radius: var(--radius-s); padding: .75rem .9rem; margin-bottom: 1rem; }
.switch-facts { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: var(--step--1); }
.switch-facts li + li { margin-top: .15rem; }

/* ---------- flashes ---------- */
.flashes { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.2rem; }
.flash { padding: .65rem .9rem; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; }
.flash.success { border-left-color: var(--mint); }
.flash.error { border-left-color: var(--coral); }
.flash.warning { border-left-color: var(--amber); }
.flash.info { border-left-color: var(--signal); }

.empty { color: var(--muted); padding: 1.2rem 0; }
.empty a { font-weight: 500; }

/* ---------- auth & landing ---------- */
.auth-wrap {
  min-height: 100vh;
  min-height: 100svh; /* visible height while the mobile toolbar is open; 100vh includes it */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}
.auth { width: 100%; max-width: 400px; margin-block: auto; }
.auth .brand { justify-content: center; margin-bottom: 1.75rem; font-size: 1.75rem; }
.auth .panel { padding: 1.6rem; }
.auth h1 { font-size: var(--step-2); }
.auth-foot { text-align: center; margin-top: 1rem; color: var(--muted); font-size: var(--step--1); }

.landing { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.5rem 5rem; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4.5rem; }
.landing-nav .brand { font-size: 1.5rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); line-height: 1.05; letter-spacing: -0.025em; margin-bottom: 1.1rem; }
.hero p { color: var(--muted); font-size: var(--step-1); }
.hero-demo { display: flex; flex-direction: column; gap: .5rem; }
.demo-lane { display: grid; grid-template-columns: 6px 1fr auto; gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m); padding: .75rem 1rem .75rem 0; overflow: hidden; }
.demo-lane .lane-bar { margin: -.75rem 0; }
.demo-lane .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--step--1); }
.demo-clash { color: var(--coral); font-size: var(--step--1); padding-left: 1.2rem; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem 2.5rem; margin-top: 5rem; }
.features h3 { font-size: var(--step-1); margin-bottom: .4rem; }
.features p { color: var(--muted); }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.2rem; height: calc(100vh - 3.6rem); }
.chat-list { overflow-y: auto; }
.chat-list a { display: block; padding: .45rem .6rem; border-radius: var(--radius-s); color: var(--muted); font-size: var(--step--1); border-left: 3px solid var(--lane); margin-bottom: 2px; }
.chat-list a.btn { border-left: 1px solid var(--line); color: var(--text); margin-bottom: .8rem; }
.chat-list a.on, .chat-list a:not(.btn):hover { background: var(--surface); color: var(--text); text-decoration: none; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m); }
.chat-top { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.chat-top .scope { display: flex; align-items: center; gap: .55rem; font-weight: 600; }
.chat-top .scope .dot { margin: 0; }
.chat-top form { display: flex; gap: .4rem; align-items: center; }
.chat-top select { width: auto; height: auto; padding: .35rem 1.7rem .35rem .5rem; background-position: right .55rem center; font-size: var(--step--1); }
.messages { flex: 1; overflow-y: auto; padding: 1.2rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; background: var(--raised); padding: .65rem .9rem; border-radius: var(--radius-m) var(--radius-m) 2px var(--radius-m); }
.msg.assistant { align-self: flex-start; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg .body code { font-family: var(--font-mono); font-size: .88em; background: var(--bg); padding: .05rem .3rem; border-radius: 4px; }
.msg .acts { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.act { font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.act.write { color: var(--signal); border-color: color-mix(in srgb, var(--signal) 45%, transparent); }
.act.fail { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 45%, transparent); }
.msg.pending .body { color: var(--faint); }
.composer { border-top: 1px solid var(--line-soft); padding: .8rem; display: flex; gap: .6rem; align-items: flex-end; }
.composer textarea { min-height: 2.8rem; max-height: 12rem; }
.suggest { display: flex; flex-wrap: wrap; gap: .4rem; }
.suggest button { font: inherit; font-size: var(--step--1); color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .75rem; cursor: pointer; }
.suggest button:hover { color: var(--text); border-color: var(--muted); }
.chat-empty { margin: auto; text-align: center; max-width: 460px; color: var(--muted); }
.chat-empty .suggest { justify-content: center; margin-top: 1rem; }
.chat-nav { display: none; gap: .3rem; }
.chat-list-head { display: none; font-size: var(--step--1); color: var(--muted); font-weight: 600; margin: .4rem 0 .6rem; }

/* Wide screens: a conversation fills the window and the page itself doesn't scroll. Messages scroll in the middle
   and the message box stays at the bottom. */
@media (min-width: 821px) {
  .page-chat { overflow: hidden; }
  .page-chat .shell { height: 100vh; height: 100dvh; }
  .page-chat .main { height: 100%; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 1.8rem; }
  .page-chat .chat-layout { flex: 1; min-height: 0; height: auto; }
}

/* Phones: the chat is pinned to the edges of the screen (position: fixed; inset: 0) and only the messages scroll,
   like a chat app. Pinned edges are placed by the browser itself, so this doesn't rely on its reported screen
   height (100vh, 100dvh, visualViewport), which some iPhone browsers, Brave among them, get wrong until the page
   is scrolled. The page underneath is given no height, so there's nothing to scroll and nothing slides under the
   browser's toolbars. Notices (the plan banner, flashes) sit above the chat. */
@media (max-width: 820px) {
  .page-chat { background: var(--surface); }
  .page-chat .shell { min-height: 0; }
  .page-chat .main { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
  .page-chat .main > .menu-toggle { display: none; }
  .page-chat .main > .flashes { flex: none; margin: .5rem .6rem 0; }
  .page-chat .chat-layout { flex: 1; min-height: 0; height: auto; display: flex; flex-direction: column; gap: 0; }
  .page-chat .chat-list { display: none; }
  .page-chat .chat-main { flex: 1; min-height: 0; border: 0; border-radius: 0; }
  .page-chat .chat-top { flex: none; padding: .45rem .6rem; gap: .35rem .5rem; }
  .page-chat .chat-nav { display: flex; }
  .page-chat .chat-top .actions { margin-left: auto; }
  .page-chat .chat-top select { max-width: 9.5rem; }
  .page-chat .chat-top .scope { order: 3; flex: 1 0 100%; min-width: 0; font-size: var(--step--1); }
  .page-chat #chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .page-chat .messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .9rem .8rem; }
  .page-chat .msg.user { max-width: 88%; }
  .page-chat .composer { flex: none; padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom)); }
  .page-chat .composer textarea { font-size: 16px; min-height: 2.6rem; resize: none; }   /* 16px stops iPhones zooming in */
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .cols { grid-template-columns: minmax(0, 1fr); }   /* minmax: a wide table scrolls in its panel, not the page */
  .lane { grid-template-columns: 6px 1fr 1fr; }
  .lane-ctx { grid-column: 2 / -1; }
  .lane .actions { grid-column: 2 / -1; }
  .hero { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  /* The menu drawer runs from the top to the bottom of what's visible (not 100vh, which on phones includes the
     area behind the browser's toolbar), and scrolls if it doesn't fit, so Settings and Sign out are reachable. */
  .side { position: fixed; inset: 0 auto 0 0; height: auto; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s ease;
          overscroll-behavior: contain; padding-bottom: calc(1.1rem + env(safe-area-inset-bottom)); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .45); }
  .btn.menu-toggle { display: inline-flex; margin-bottom: 1rem; }
  .main { padding: 1.1rem 1rem 3rem; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-layout > .chat-list { order: 2; overflow: visible; }      /* Assistant page: conversations under the form */
  .chat-layout > .chat-list > a.btn { display: none; }             /* "New conversation" is the form above */
  .chat-list-head { display: block; }
  .lane { grid-template-columns: 6px 1fr; }
  .lane > :not(.lane-bar) { grid-column: 2; }
  .list > li.task { flex-wrap: wrap; }
  .task .grow { flex: 1 1 calc(100% - 1rem); }
  .task .facts { flex-direction: row; gap: .7rem; min-width: 0; align-items: center; }
  .status-form { margin-left: auto; }
  /* Phones: time, length and tag on one line, then the title and job across the full width. */
  /* Phones: time, length, tag and job on the first line; the title across the full width under it.
     An entry with no description stays on one line. Tap the row to edit; meetings have a ⋯ menu. */
  .log > li {
    grid-template-columns: auto auto auto minmax(0, 1fr) auto 2.2rem;
    grid-template-areas: "when dur . . job menu" "work work work work kind ." "note note note note note note";
    gap: .3rem .6rem; align-items: center; padding-right: .1rem;
  }
  .log .when, .log .dur, .log .tag { white-space: nowrap; }
  .log .tag.job { justify-self: end; }
  .log .kind { align-self: center; justify-self: end; }
  /* No description: nothing to show, so the row is one line. The link stays (it still opens the entry). */
  .log > li.entry-row .work { grid-area: auto; grid-row: 2; grid-column: 1 / -1; }
  .log > li.no-desc .work { grid-area: auto; grid-row: 1; grid-column: 3; font-size: 0; }
  .log .row-delete, .log .row-actions { display: none; }
  .log .row-menu { display: block; grid-area: menu; position: relative; z-index: 1; }

  .features { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.cols > .panel + .panel { margin-top: 0; }


/* ---------- legal pages and footer ---------- */
.legal { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.legal-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.legal-tabs { display: flex; gap: .25rem; }
.legal-tabs a { color: var(--muted); padding: .4rem .7rem; border-radius: var(--radius-s); font-size: var(--step--1); }
.legal-tabs a:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.legal-tabs a.on { background: var(--raised); color: var(--text); }
.legal-doc h1 { margin-bottom: .3rem; }
.legal-doc h2 { margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); scroll-margin-top: 1rem; }
.legal-doc h3 { margin-top: 1.4rem; }
.legal-doc .lead { font-size: var(--step-1); color: var(--text); margin: 1.2rem 0 0; }
.legal-doc ul { padding-left: 1.2rem; margin: 0 0 1em; }
.legal-doc li { margin-bottom: .4rem; }
.legal-doc code { font-family: var(--font-mono); font-size: .9em; background: var(--raised); padding: .05rem .35rem; border-radius: 4px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 0 0 1.2rem; font-size: var(--step--1); }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: .6rem .7rem; border-top: 1px solid var(--line-soft); }
.legal-table th { color: var(--muted); font-weight: 500; border-top: 0; border-bottom: 1px solid var(--line); }
.legal-table td:first-child { min-width: 9rem; }
@media (max-width: 640px) { .legal-table { display: block; overflow-x: auto; } }
.legal-foot { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); }
.legal-foot p { margin: .6rem 0 0; }
.legal-links { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: var(--step--1); }
.landing .legal-foot { margin-top: 4rem; }
.auth .legal-foot { margin-top: 2rem; border-top: 0; text-align: center; padding-top: 0; }
.auth .legal-links { justify-content: center; }
.auth .legal-foot p { margin-inline: auto; }
.side-legal { display: flex; flex-wrap: wrap; gap: .1rem .7rem; padding: .5rem .6rem 0; font-size: .75rem; }
.side-legal a { color: var(--faint); }
.side-legal a:hover { color: var(--muted); }
.field.check.terms { align-items: flex-start; }
.field.check.terms input { margin-top: .25rem; flex: none; }
.field.check.terms label { line-height: 1.45; }

/* ---------- captcha and contact ---------- */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.field.captcha .label { display: block; font-size: var(--step--1); color: var(--muted); margin-bottom: .35rem; }
.pcaptcha { min-height: 64px; }      /* room for PCaptcha's widget before its script arrives, so the form doesn't jump */
.contact-form { max-width: 560px; margin-top: 1.4rem; }
.contact-form textarea { min-height: 9rem; }

/* ---------- two-step sign-in and passkeys ---------- */
.or { display: flex; align-items: center; gap: .8rem; color: var(--faint); font-size: var(--step--1); margin: 1rem 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
.err-line { color: var(--coral); margin: .6rem 0 0; }
.steps { padding-left: 1.2rem; margin: 0 0 1rem; }
.steps > li { margin-bottom: 1.4rem; padding-left: .3rem; }
.qr { display: block; width: max-content; max-width: 100%; margin: .8rem 0 .6rem; padding: .6rem; background: #fff; border-radius: var(--radius-s); line-height: 0; }
.qr img { display: block; }
code.secret { font-family: var(--font-mono); font-size: var(--step-0); letter-spacing: .05em; background: var(--bg); border: 1px solid var(--line); padding: .35rem .6rem; border-radius: var(--radius-s); user-select: all; word-break: break-all; }
pre.codes { font-family: var(--font-mono); font-size: var(--step-1); line-height: 1.9; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .8rem 1rem; columns: 2; margin: 1rem 0; user-select: all; }
.inline-pw { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-pw input { flex: 1 1 10rem; width: auto; min-width: 0; }

/* ---------- Settings and Security: one stacked column of cards, in labelled groups ---------- */
/* minmax(0, 1fr): a plain grid column grows to fit its widest content (a table, a long URL), which pushed
   pages such as Administration > Billing wider than a phone screen. Tables scroll sideways in .table-wrap. */
.sec-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; max-width: 760px; }
.sec-stack code { overflow-wrap: anywhere; }
.sec-stack > .panel { margin: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .45rem; }
.sec-head h2 { margin: 0; }
.sec-desc { color: var(--muted); font-size: var(--step--1); margin: 0 0 1rem; }
.sec-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.sec-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 0; border-top: 1px solid var(--line-soft); }
.sec-row:last-child { border-bottom: 1px solid var(--line-soft); }
.sec-row-main { min-width: 0; }
.sec-row details[open] { flex: 1 1 100%; }
details.reveal > summary { list-style: none; cursor: pointer; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal[open] > summary { margin-bottom: .7rem; }
details.reveal .inline-pw { margin: 0; }
.passkey-add { margin-top: 1.2rem; }
.passkey-add h3 { margin-bottom: .6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.codes-box { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); }
.support-code { font-family: var(--font-mono); font-size: 2.2rem; letter-spacing: .2em; text-align: center; padding: .7rem 1rem .7rem 1.2rem; max-width: 18rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-m); margin: 0 0 .7rem; user-select: all; }
.sec .actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .6rem; }

/* ---------- Administration > Models ---------- */
.admin-section { margin-bottom: 2.2rem; }
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem 1rem; margin-bottom: .9rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; align-items: stretch; }
.prov-grid > .prov { display: flex; flex-direction: column; margin: 0; }
.prov .panel-head { align-items: center; margin-bottom: 1rem; min-height: 2.4rem; }
.prov .panel-head h3 { margin: 0; font-size: var(--step-1); }
.prov-help { margin: -.3rem 0 0; min-height: 2.6em; }
.prov-actions { margin-top: auto; padding-top: 1rem; display: flex; gap: .5rem; }
.models-table td { vertical-align: middle; }
.add-model { margin-top: 1rem; }
.add-model > summary { cursor: pointer; font-weight: 600; list-style: none; }
.add-model > summary::-webkit-details-marker { display: none; }
.add-model > summary::before { content: "+"; display: inline-block; width: 1.1rem; color: var(--muted); font-weight: 400; }
.add-model[open] > summary::before { content: "\2212"; }
.add-model[open] > summary { margin-bottom: 1.1rem; }
.add-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.4fr); gap: 0 1rem; }
.add-foot { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1rem; }
.add-foot .field { margin: 0; }
@media (max-width: 760px) { .add-grid { grid-template-columns: 1fr; } }

/* A button that stays in place but can't be used right now. */
.btn.is-disabled { opacity: .4; cursor: default; pointer-events: none; user-select: none; }

/* ---------- Calendars ---------- */
.feed-facts { display: grid; gap: .4rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 0 0 1rem; }
.feed-facts dt { color: var(--faint); font-size: var(--step--1); }
.feed-facts dd { margin: 0; }
.sec-notes { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: var(--step--1); }
.sec-notes li { margin-bottom: .5rem; }
.sec-notes strong { color: var(--text); font-weight: 600; }
details.howto { margin-top: 1.1rem; font-size: var(--step--1); }
details.howto > summary { cursor: pointer; color: var(--muted); }
details.howto ul { margin: .7rem 0 0; padding-left: 1.2rem; color: var(--muted); }
details.howto li { margin-bottom: .5rem; }
.feed-facts + .err-line { margin: -.2rem 0 1rem; }

/* ---------- Billing ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.plan-card { display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-m); }
.plan-card .btn { margin-top: auto; }
.plan-name { font-size: var(--step-1); font-weight: 650; }
.plan-days { color: var(--muted); font-size: var(--step--1); }
.plan-price { margin: .5rem 0 .1rem; }
.price-now { font-size: 1.7rem; font-weight: 700; }
.price-old { color: var(--faint); text-decoration: line-through; }
.plans-table input { min-width: 0; }
.plans-table td { vertical-align: middle; }

/* ---------- Administration > Usage ---------- */
.usage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.usage-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .8rem; }
.usage-filters label { display: flex; flex-direction: column; gap: .25rem; font-size: var(--step--1); color: var(--muted); }
.usage-filters input, .usage-filters select { width: auto; max-width: 12rem; height: auto; padding: .35rem .5rem; font-size: var(--step--1); }
.usage-filters select { padding-right: 1.7rem; background-position: right .55rem center; }
.usage-presets { display: flex; gap: .3rem; margin-right: .4rem; }
.usage-where { margin: 0; color: var(--muted); }
.usage-where strong { color: var(--text); }
.usage-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.usage-tile { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m); padding: .8rem 1rem; }
.usage-tile .k { font-size: var(--step--1); color: var(--muted); }
.usage-tile .v { font-size: 1.6rem; font-weight: 600; margin-top: .15rem; }
.usage-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; padding: 0; margin: 0 0 .6rem; font-size: var(--step--1); color: var(--muted); }
.usage .sw { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .4rem; vertical-align: -.05rem; }
.usage-chart-wrap { position: relative; overflow-x: auto; }
.usage-chart { display: block; width: 100%; min-width: 600px; height: auto; }
.usage-chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.usage-chart .grid.base { stroke: var(--line); }
.usage-chart .tick { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.usage-chart .hit { fill: transparent; }
.usage-chart .ubar.on .hit { fill: var(--hover); }
.usage-chart .ubar:focus-visible .hit { fill: color-mix(in srgb, var(--text) 8%, transparent); }
.usage-tip { position: absolute; z-index: 5; pointer-events: none; white-space: pre; background: var(--raised); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: .45rem .6rem; font-size: var(--step--1);
  font-variant-numeric: tabular-nums; box-shadow: 0 6px 20px var(--shadow); }
.usage-table th.r, .usage-table td.r { text-align: right; }
.usage-table td:first-child { white-space: nowrap; }
@media (max-width: 820px) {
  .usage-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-tile .v { font-size: 1.3rem; }
}

/* Administration > Users: "Delete…" opens a confirm-by-email form under the row's buttons. */
details.delete-user > summary { list-style: none; cursor: pointer; }
details.delete-user > summary::-webkit-details-marker { display: none; }
details.delete-user[open] { flex: 1 1 100%; }
details.delete-user[open] > summary { margin-bottom: .5rem; }
details.delete-user .small { margin: .4rem 0 0; }

/* ---------- Polly: changes waiting for approval, meeting notes ---------- */
.review { margin-top: .7rem; padding: .7rem .8rem; border: 1px solid color-mix(in srgb, var(--signal) 45%, transparent); border-radius: var(--radius-m); background: var(--bg); }
.review-head { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; margin-bottom: .5rem; }
.review-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .35rem; }
.review-list label { display: flex; gap: .5rem; align-items: flex-start; cursor: pointer; }
.review-list input { width: auto; margin-top: .2rem; }
.meeting-panel { border-top: 1px solid var(--line-soft); padding: .8rem 1rem; display: grid; gap: .5rem; }
.meeting-panel[hidden] { display: none; }
.meeting-head { display: flex; justify-content: space-between; align-items: center; }
.meeting-panel textarea { max-height: 40vh; }
.composer-tools { padding: .4rem .8rem 0; border-top: 1px solid var(--line-soft); }
.composer-tools + .composer { border-top: 0; }

/* ---------- task board ---------- */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.view-switch a { padding: .38rem .8rem; color: var(--muted); font-size: var(--step--1); }
.view-switch a + a { border-left: 1px solid var(--line); }
.view-switch a.on { background: var(--raised); color: var(--text); }
.view-switch a:hover { text-decoration: none; color: var(--text); }
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: .9rem; align-items: start; overflow-x: auto; padding-bottom: .5rem; }
.board-col { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m); padding: .7rem; min-width: 0; }
.board-col h2 { font-size: var(--step-0); display: flex; align-items: center; gap: .5rem; margin: 0 0 .6rem; }
.board-col .count { font-size: .75rem; color: var(--muted); background: var(--raised); border-radius: 999px; padding: 0 .45rem; font-weight: 400; }
.board-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; min-height: 4rem; border-radius: var(--radius-s); }
.board-cards.drop-here { outline: 2px dashed color-mix(in srgb, var(--signal) 60%, transparent); outline-offset: 3px; }
.board-empty { color: var(--faint); font-size: var(--step--1); padding: .8rem .2rem; text-align: center; }
.card { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--lane); border-radius: var(--radius-s); padding: .55rem .65rem; cursor: grab; display: grid; gap: .35rem; }
.card.dragging { opacity: .5; }
.card.saving { opacity: .7; }
.card .title { color: var(--text); font-weight: 500; word-break: break-word; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; color: var(--faint); font-size: var(--step--1); }
.card .overdue { color: var(--coral); }
.card-move select { width: auto; height: auto; padding: .2rem 1.4rem .2rem .4rem; background-position: right .4rem center; background-size: .6rem auto; font-size: .75rem; }
@media (max-width: 820px) {
  .board { grid-template-columns: repeat(4, minmax(78vw, 1fr)); scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
}
.composer-tools[hidden] { display: none; }
/* Settings and Security share one layout: groups of cards in a single column, and one way to confirm with
   your password (macros.confirm_with_password). */
.stack-title { font-size: var(--step--1); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 -.3rem; }
.stack-group { margin-top: 2rem; }
.sec-stack > form { margin: 0; }
.stack-save { display: flex; gap: .6rem; position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.sec .field:last-child { margin-bottom: 0; }
.sec input[readonly] { color: var(--muted); background: transparent; }
.pw-confirm { display: grid; gap: .2rem; max-width: 26rem; }
.pw-confirm .field { margin-bottom: .6rem; }
.pw-confirm .actions { margin-top: .2rem; }
.sec-row .pw-confirm { margin-top: .2rem; }
/* An open confirmation shows only its own buttons; the one that opened it comes back on Cancel. Without
   scripts the opener stays, so it can still be closed. */
.js details.reveal[open] > summary { display: none; }
.danger-zone { border-color: color-mix(in srgb, var(--coral) 45%, var(--line-soft)); }
.danger-zone .sec-head h2 { color: var(--coral); }
.nav .tag { margin-left: .3rem; }
/* ---------- Quick (the installed app's home screen) ----------
   One column, as wide as Settings and Security. The job lanes are the centrepiece: each job is a tile in its own
   colour, and the running one lights up and holds the clock and Stop. Everything else stays quiet. */
.quick { max-width: 720px; display: grid; gap: 1rem; }
.quick > .page-head { margin-bottom: 0; }
.quick .panel { margin: 0; }
.quick .sec-head { margin-bottom: .9rem; }

.quick-install { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .55rem .6rem .55rem 1rem; border: 1px solid color-mix(in srgb, var(--signal) 40%, var(--line-soft)); border-radius: var(--radius-m); background: color-mix(in srgb, var(--signal) 7%, var(--surface)); }
.quick-install[hidden] { display: none; }
.quick-install p { margin: 0; font-size: var(--step--1); color: var(--muted); }
.quick-install strong { color: var(--text); font-weight: 600; }
.quick-install em { font-style: normal; color: var(--text); }
.share-glyph { width: .8em; height: 1em; vertical-align: -.12em; color: var(--signal); }

.quick-lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; }
.lane-tile { font: inherit; color: var(--text); text-align: left; display: flex; flex-direction: column; gap: .3rem; min-height: 6.2rem; padding: .85rem 1rem .9rem; background: color-mix(in srgb, var(--lane) 8%, var(--bg)); border: 1px solid color-mix(in srgb, var(--lane) 30%, var(--line)); border-left: 5px solid var(--lane); border-radius: var(--radius-m); cursor: pointer; }
button.lane-tile:hover { background: color-mix(in srgb, var(--lane) 15%, var(--bg)); border-color: color-mix(in srgb, var(--lane) 60%, var(--line)); border-left-color: var(--lane); }
button.lane-tile:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.lane-tile .lane-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .2rem .6rem; }
.lane-tile .name { font-size: var(--step-1); font-weight: 600; }
.lane-tile .core { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.lane-tile .core::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); margin-right: .35rem; vertical-align: 1px; }
.lane-tile .meta { font-size: var(--step--1); color: var(--muted); }
.lane-tile .meta.warn { color: var(--amber); }
.lane-tile.is-running { cursor: default; background: color-mix(in srgb, var(--lane) 20%, var(--bg)); border-color: var(--lane); }
.lane-tile .clock { font-size: var(--step-2); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.lane-tile .lane-stop { align-self: flex-start; margin-top: auto; }
.parking { margin: 1rem 0 0; }
.parking textarea { min-height: 3.6rem; }
.quick-capture textarea { min-height: 5.2rem; }

/* Segmented choices (what to capture, due date): one bordered strip of equal parts, like List / Board. */
.seg { position: relative; min-width: 0; border: 0; padding: 0; margin: 0; }
.seg legend:not(.sr-only) { font-size: var(--step--1); color: var(--muted); padding: 0; margin-bottom: .3rem; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-fill, .seg-items { display: flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--bg); }
.seg-fill { margin-bottom: .9rem; }
.seg-fill label, .seg-items label { flex: 1 1 0; text-align: center; white-space: nowrap; padding: .55rem .8rem; color: var(--muted); font-size: var(--step--1); cursor: pointer; }
.seg-fill label + input + label, .seg-items label + input + label { border-left: 1px solid var(--line); }
.seg-fill label:hover, .seg-items label:hover { color: var(--text); }
.seg input:checked + label { background: var(--raised); color: var(--text); font-weight: 600; }
.seg input:focus-visible + label { outline: 2px solid var(--signal); outline-offset: -2px; }

.quick-capture > .field { margin-bottom: .9rem; }
.quick-capture .context-help { display: none; }
.quick-capture:has(#kind-context:checked) .context-help { display: block; }
.quick-capture:has(#kind-note:checked) .task-opt, .quick-capture:has(#kind-context:checked) .task-opt { display: none; }
.capture-row { display: grid; grid-template-columns: minmax(8rem, 1fr) auto auto auto; gap: .8rem 1rem; align-items: end; }
.capture-row .field { margin: 0; }
.capture-row .field.check { min-height: 2.5rem; }
.quick-save { min-width: 7rem; min-height: 2.6rem; }
.quick-links { display: none; }

@media (max-width: 820px) {
  .quick-lanes { grid-template-columns: 1fr; }
  .lane-tile { min-height: 0; }
  .quick .sec-head { flex-wrap: wrap; }
  .capture-row { grid-template-columns: 1fr; }
  .capture-row .field.check { min-height: 0; }
  .quick-save { width: 100%; padding-top: .7rem; padding-bottom: .7rem; }
  .quick-links { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; }
  .page-quick .main { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}

/* ---------- Analytics ---------- */
.analytics { max-width: 980px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.analytics > * { min-width: 0; }      /* wide tables scroll inside their own box instead of widening the page */
.analytics > .page-head { margin-bottom: 0; }
.analytics .panel { margin: 0; }
.analytics .panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .6rem 1rem; margin-bottom: .8rem; }
.analytics .panel-head p { margin: .2rem 0 0; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-m); padding: .9rem 1rem 1rem; }
.stat-label { font-size: var(--step--1); color: var(--muted); }
.stat-value { font-size: var(--step-2); font-weight: 600; margin: .15rem 0 .25rem; font-variant-numeric: tabular-nums; }
.stat-note { font-size: var(--step--1); color: var(--faint); line-height: 1.45; }
.chart { margin: 0; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg.chart-narrow { display: none; }
@media (max-width: 640px) {
  .chart-svg.chart-wide { display: none; }
  .chart-svg.chart-narrow { display: block; }
}
.chart-svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .tick, .chart-svg .xlab { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .xlab { fill: var(--muted); }
.chart-svg .cap { stroke: var(--muted); stroke-width: 1.5; }
.chart-svg .cap-text { fill: var(--muted); font-size: 11px; }
.chart-svg .top-label { fill: var(--text); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-svg .top-label.over { fill: var(--coral); }
.chart-svg .hit { fill: transparent; cursor: default; outline: none; }
.chart-svg .hit.on, .chart-svg .hit:focus-visible { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.chart-svg .hit:focus-visible { stroke: var(--signal); stroke-width: 2; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .5rem 0 0; padding: 0 0 0 34px; font-size: var(--step--1); color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .4rem; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-tip { position: absolute; z-index: 50; pointer-events: none; background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .5rem .65rem; font-size: var(--step--1); line-height: 1.5; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: 18rem; }
.chart-tip-head { font-weight: 600; margin-bottom: .1rem; }
.chart-table { margin: .6rem 0 0; }
.chart-table summary { cursor: pointer; font-size: var(--step--1); color: var(--muted); }
.chart-table .table { margin-top: .4rem; }
.sub-title { font-size: var(--step-0); margin: 1.4rem 0 .4rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-table td { white-space: nowrap; }
.share { display: inline-block; vertical-align: middle; width: 5rem; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.share-bar { display: block; height: 100%; border-radius: 3px; }
.split-table .over { color: var(--amber); }
.notes { margin: .9rem 0 0; padding-left: 1.1rem; font-size: var(--step--1); color: var(--muted); display: grid; gap: .3rem; }
.notes:empty { display: none; }
@media (max-width: 820px) {
  .stat-row { grid-template-columns: 1fr; }
  .legend { padding-left: 0; }
}

/* ---------- Today: one card per job, read top to bottom ---------- */
.job-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: .9rem; margin-bottom: 1.6rem; }
.job-card { display: flex; flex-direction: column; gap: .75rem; min-width: 0; background: var(--surface); border: 1px solid var(--line-soft); border-left: 4px solid var(--lane); border-radius: var(--radius-m); padding: .95rem 1.1rem 1rem; }
.job-card.is-live { border-color: color-mix(in srgb, var(--lane) 55%, var(--line)); border-left-color: var(--lane); background: color-mix(in srgb, var(--lane) 5%, var(--surface)); }
.job-card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; min-height: 2rem; }
.job-card-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; min-width: 0; }
.job-card-title h3 { margin: 0; font-size: var(--step-1); }
.job-card-title h3 a { color: var(--text); }
.job-card-role { font-size: var(--step--1); color: var(--muted); }
.job-card-head .btn, .job-card-head .live-tag { flex: none; }
.live-tag { color: var(--text); border-color: color-mix(in srgb, var(--lane) 60%, transparent); }
.job-card-clock { margin: -.35rem 0 0; font-size: var(--step--1); color: var(--muted); }
.job-card-hours { display: grid; gap: .4rem; }
.job-card-figures { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; font-size: var(--step--1); color: var(--muted); }
.job-card-figures strong { color: var(--text); font-size: var(--step-0); font-weight: 600; }
.job-card-figures a { color: var(--muted); white-space: nowrap; }
.job-card-figures a:hover { color: var(--text); }
.job-card-facts { margin: 0; display: grid; gap: .4rem; font-size: var(--step--1); }
.job-card-facts > div { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .6rem; }
.job-card-facts dt { color: var(--faint); }
.job-card-facts dd { margin: 0; color: var(--muted); min-width: 0; }
.job-card-facts dd a { color: var(--text); }
.job-card-ctx { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clash-inline { color: var(--coral); }
.job-card-kit { margin: auto 0 0; padding-top: .55rem; border-top: 1px solid var(--line-soft); font-size: .75rem; color: var(--faint); }

/* ---- money: earnings and invoices ---- */
.invoice-lines input { width: 100%; min-width: 4rem; }
.invoice-lines td:first-child input { min-width: 14rem; }
.invoice-lines tfoot td { border-bottom: 0; }
.overdue-text { color: var(--coral); }
fieldset[disabled] input, fieldset[disabled] textarea { opacity: .75; }

/* ---- busy calendars ---- */
.busy-list li { align-items: flex-start; flex-wrap: wrap; gap: .5rem; }
.copy-row { display: flex; gap: .4rem; margin: .4rem 0 .25rem; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--step--1); }
/* A row with a link to copy keeps the link wide: its buttons wrap underneath rather than squashing it. */
.list li > .grow:has(.copy-row) { flex: 1 1 20rem; min-width: min(100%, 20rem); }
.list li:has(> .grow .copy-row) { flex-wrap: wrap; }

/* ---- stand-up drafts ---- */
.mono-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--step--1); line-height: 1.5; }
.pre-line { white-space: pre-line; margin: 0; }

/* ---- leave ---- */
.tag.off-tag { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 40%, transparent); }
.day-off { font-size: .7rem; color: var(--mint); display: block; font-weight: 400; }

/* ---- focus blocks: planned work, drawn as an outline rather than a solid meeting ---- */
.cal-ev.focus { background: color-mix(in srgb, var(--lane) 18%, transparent); border: 1px dashed var(--lane); color: var(--text) !important; }

/* ---- command palette (static/js/palette.js) ---- */
.palette-open { white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .8rem; padding: .45rem .6rem; border: 1px solid var(--line-soft); border-radius: var(--radius-s); color: var(--faint); font-size: var(--step--1); background: var(--raised); }
.palette-open span { overflow: hidden; text-overflow: ellipsis; }
.palette-open kbd { flex: none; }
.palette-open:hover { color: var(--text); text-decoration: none; border-color: var(--line); }
kbd { font: inherit; font-size: .72rem; padding: .05rem .35rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--surface); }
.palette { width: min(640px, calc(100vw - 2rem)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.palette::backdrop { background: rgba(8, 10, 18, .55); }
.palette-box { margin: 0; }
.palette input[type=search] { width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; padding: .9rem 1rem; font-size: 1rem; background: transparent; }
.palette input[type=search]:focus { outline: none; box-shadow: none; }
.palette-list { list-style: none; margin: 0; padding: .35rem; max-height: min(60vh, 420px); overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-s); cursor: pointer; border-left: 3px solid var(--lane, transparent); }
.palette-item.on { background: var(--raised); }
.palette-item .tag { min-width: 3.6rem; text-align: center; }
.palette-text { display: flex; flex-direction: column; min-width: 0; }
.palette-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: .8rem; }
.palette-foot { margin: 0; padding: .5rem 1rem; border-top: 1px solid var(--line-soft); }

/* ---- a meeting for another job while a timer runs ---- */
.overlap-hint { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.flash-actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.flash-actions form { margin: 0; }

/* ---- narrow screens: grid and fieldset children may shrink, so wide tables scroll inside .table-wrap ---- */
.cols > *, .stack > * { min-width: 0; }
.table .tag.job { white-space: nowrap; }
fieldset { min-width: 0; }

/* ---- tables on phones and small tablets ----
   Data tables (those with a header row) keep their columns at a readable width and scroll sideways inside
   .table-wrap instead of squashing. Columns of free text (td.wrap) still wrap, within a sensible width. A soft
   shadow appears at whichever edge has more to scroll to. Label/value tables (no header row, like the job page's
   At a glance) keep wrapping to fit. */
@media (max-width: 820px) {
  .table-wrap {
    overscroll-behavior-x: contain;
    background:
      linear-gradient(to right, var(--surface) 40%, transparent) left center / 1.5rem 100% no-repeat local,
      linear-gradient(to left, var(--surface) 40%, transparent) right center / 1.5rem 100% no-repeat local,
      linear-gradient(to right, rgba(0, 0, 0, .28), transparent) left center / .6rem 100% no-repeat scroll,
      linear-gradient(to left, rgba(0, 0, 0, .28), transparent) right center / .6rem 100% no-repeat scroll;
  }
  .table-wrap > table.table:has(thead) { width: max-content; min-width: 100%; }
  .table:has(thead) th, .table:has(thead) td { white-space: nowrap; }
  .table:has(thead) th.wrap, .table:has(thead) td.wrap { white-space: normal; min-width: 11rem; max-width: 17rem; }
  .invoice-lines td:first-child input { min-width: 14rem; }
  .invoice-lines td input { min-width: 5rem; }
  .legal-table td:nth-child(2) { min-width: 15rem; }
}

/* ---- screen-share safe mode (app/safemode.py) ---- */
.safe-open { display: block; margin: 0 0 .5rem; color: var(--faint); }
.safe-pill { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin: 0 0 .6rem; padding: .4rem .5rem .4rem .6rem; border: 1px solid var(--lane); border-radius: var(--radius-s); background: color-mix(in srgb, var(--lane) 14%, transparent); font-size: var(--step--1); }
.safe-pill .dot, .safe-job .dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--lane); margin-right: .4rem; }
.safe-jobs { display: flex; flex-wrap: wrap; gap: .5rem; }
.safe-jobs form { margin: 0; }

/* ---- working-time limit (app/worklimit.py) ---- */
.limit-stats { margin: .4rem 0 1rem; }
.limit-bars { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 4px; }
.limit-bar { flex: 1; min-width: 4px; background: var(--signal); opacity: .75; border-radius: 3px 3px 0 0; }
.limit-bar.over { background: var(--coral); }
.limit-bar.now { opacity: .45; }
.limit-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--amber); pointer-events: none; }

/* ---- read-only pages shared by link (the accountant page) ---- */
.public-page { background: var(--bg); color: var(--text); }
.public-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* ---- receipts on expenses ---- */
.receipt-link { margin-left: .4rem; }
.receipt-menu { position: relative; }
.receipt-menu > summary { list-style: none; cursor: pointer; }
.receipt-menu > summary::-webkit-details-marker { display: none; }
.receipt-menu[open] > form, .receipt-menu[open] > form + form { position: relative; z-index: 2; }
.receipt-menu form { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.receipt-menu input[type=file] { max-width: 14rem; font-size: var(--step--1); }

/* Import time */
.import-opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 1rem; }
.import-opts .field > span { font-size: var(--step--1); color: var(--muted); }
.import-opts .field input[type=file] { max-width: 100%; }

/* Week in review */
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.review-grid textarea { width: 100%; }
.chat-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0 1rem; align-items: end; margin-top: .8rem; }
.chat-add .field > span { font-size: var(--step--1); color: var(--muted); }

/* ---- invoice lines on phones: each line is a card (description on top, then qty, unit, price, amount) ---- */
.invoice-lines .remove-text { display: none; }
@media (max-width: 640px) {
  .table-wrap:has(> .invoice-lines) { overflow: visible; background: none; }
  .table-wrap > table.table.invoice-lines { width: 100%; min-width: 0; }
  .invoice-lines, .invoice-lines tbody, .invoice-lines tfoot { display: block; }
  .invoice-lines thead { display: none; }
  .invoice-lines tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .6rem;
    padding: .8rem; margin-bottom: .7rem; border: 1px solid var(--line); border-radius: var(--radius-s); }
  .invoice-lines tbody td { display: block; padding: 0; border: 0; white-space: normal; }
  .invoice-lines tbody td[data-label]::before { content: attr(data-label); display: block; font-size: var(--step--1); color: var(--muted); margin-bottom: .2rem; }
  .invoice-lines tbody td:first-child { grid-column: 1 / -1; }
  .invoice-lines td:first-child input, .invoice-lines td input { min-width: 0; width: 100%; }
  .invoice-lines tbody td.num[data-label="Amount"] { grid-column: 1 / 3; align-self: end; text-align: left; font-weight: 600; }
  .invoice-lines .remove-cell { grid-column: 3; align-self: end; text-align: right; }
  .invoice-lines .remove-text { display: inline; font-size: var(--step--1); color: var(--muted); }
  .invoice-lines .remove-cell label { display: inline-flex; align-items: center; gap: .35rem; }
  .invoice-lines .empty-cell { display: none; }
  .invoice-lines tfoot tr { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .2rem; }
  .invoice-lines tfoot td { padding: 0; white-space: nowrap; }
}

/* Calendars from files */
.upload-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.upload-row input[type=file] { max-width: 100%; }
pre.manifest { max-height: 14rem; overflow: auto; font-size: var(--step--1); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem; white-space: pre; }
.offline-toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 60; max-width: min(92vw, 34rem); box-shadow: 0 6px 24px rgba(0,0,0,.35); }

/* "i" buttons that show a section's description (static/js/app.js) */
.help-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem;
  margin-left: .45rem; padding: 0; vertical-align: .15em; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font: italic 600 .75rem/1 Georgia, "Times New Roman", serif;
  cursor: pointer; flex: none; position: relative; }
.help-toggle:hover, .help-toggle:focus-visible { color: var(--text); border-color: var(--muted); }
.help-toggle[aria-expanded="true"] { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.help-toggle::before { content: ""; position: absolute; inset: -.6rem; }       /* a bigger target for fingers */
.help-moved { margin: 0 0 .8rem; }

/* A button cell in a row of fields (.chat-add, .import-opts): sits on the same line as the inputs beside it. */
.field.field-action { justify-content: flex-end; }
.field.field-action, .sec .field.field-action:last-child { margin-bottom: 1rem; }
.field.field-action > .btn { min-height: 2.7rem; }

/* Week grid (time/week.html) */
.week-grid th[scope=row] { white-space: nowrap; }
.week-grid th, .week-grid td { padding: .3rem .5rem; }
.week-grid .day { text-align: center; font-variant-numeric: tabular-nums; }
.week-grid .grid-cell { display: block; margin: 0 auto; width: 4.2rem; min-width: 3.6rem; text-align: right; padding: .45rem .5rem; font-variant-numeric: tabular-nums; }
.week-grid .grid-cell.today { border-color: var(--signal); }
.week-grid th.today { color: var(--signal); }
.facts .est.over { color: var(--amber); }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.nowrap-actions { flex-wrap: nowrap; justify-content: flex-end; gap: .3rem; }
.nowrap-actions form { margin: 0; }
.entry-meta .tag { margin-right: .25rem; }
.plain-list { margin: 0; padding-left: 1.1rem; }
.plain-list li { margin: .3rem 0; }

/* ---------- page widths ----------
   Every page shares one maximum width, so lines and forms don't stretch across a wide monitor, and pages that
   are one form (a task, a meeting, a time entry...) share a narrower one. The settings-style stacks use it too. */
:root { --page-max: 1320px; --page-narrow: 820px; }
.main > * { max-width: var(--page-max); }
.main.narrow > * { max-width: var(--page-narrow); }
.sec-stack { max-width: var(--page-narrow); }
.main > .menu-toggle { max-width: none; }

/* ---------- section tabs (Time, Money, Administration) ----------
   One look for moving between the pages of a section, distinct from the filter and period buttons on a page. */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line-soft); margin: -.2rem 0 1.2rem;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: .6rem .85rem .55rem; color: var(--muted); font-size: var(--step--1); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--line); }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--signal); }

/* A job's tag in a page title links back to the job. */
h1 a.tag.job { font-size: var(--step--1); vertical-align: middle; }
h1 a.tag.job:hover { text-decoration: none; filter: brightness(1.1); }

/* A note that belongs to a whole form row, under the fields rather than wedged between them. */
.form-note { margin: -.3rem 0 1rem; }

/* A file picker that looks like the other controls. */
input[type=file] { font: inherit; font-size: var(--step--1); color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: 500 var(--step--1)/1 var(--font); color: var(--text); background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: .5rem .8rem; margin-right: .7rem; cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--muted); }

/* ---------- moving between pages ----------
   Browsers that support cross-document view transitions (Chrome and Edge 126+, Safari 18.2+) swap one page for
   the next in a single step, instead of blanking the window and painting the new page from the top. The sidebar
   is matched between the two pages, so it stays put and only the content changes. Other browsers ignore all of
   this and load pages as before. Nothing here needs JavaScript. */
@view-transition { navigation: auto; }
.side { view-transition-name: sidebar; }
::view-transition-group(sidebar) { animation: none; }
::view-transition-old(root) { animation: 90ms ease-out both pw-fade-out; }
::view-transition-new(root) { animation: 140ms ease-out both pw-fade-in; }
@keyframes pw-fade-out { to { opacity: 0; } }
@keyframes pw-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
