/* The app's one stylesheet (ADR-0047; spec G §5, wave 7). Mobile first: one column, 17 px text, and taps at least
   44 px tall. Inputs keep 16 px or more, so a phone does not zoom in when one takes focus. Nothing is under 14 px and
   nothing is italic: emphasis is weight 600. */

/* Inter, variable, the latin subset, served from this origin (CSP font-src 'self'): @fontsource-variable/inter 5.3.0,
   its license in fonts/OFL.txt. Until it loads, the system face shows the text. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The tokens (spec G §5): base, accent and three status colors, light here. Dark follows the system unless
   <html data-theme="light"> holds light, and <html data-theme="dark"> holds dark whatever the system says (theme.ts).
   These three blocks are the only place a color is written; every rule below names a token. */
:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #efebe3;
  --fg: #1c1a17;
  --fg-2: #55504a;
  --line: #e3ded4;
  --accent: #2f5fd0;
  --accent-ink: #ffffff;
  --good: #1f7a4d;
  --bad: #b3261e;
  --warn: #9a6700;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161513;
    --surface: #1f1d1a;
    --surface-2: #292622;
    --fg: #ede9e1;
    --fg-2: #a9a39a;
    --line: #363229;
    --accent: #8fb0ff;
    --accent-ink: #0f1a33;
    --good: #7fd4a0;
    --bad: #ff8d82;
    --warn: #e3b341;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161513;
  --surface: #1f1d1a;
  --surface-2: #292622;
  --fg: #ede9e1;
  --fg-2: #a9a39a;
  --line: #363229;
  --accent: #8fb0ff;
  --accent-ink: #0f1a33;
  --good: #7fd4a0;
  --bad: #ff8d82;
  --warn: #e3b341;
}

* {
  box-sizing: border-box;
}

/* The owner's text size (wave 10, C122): the root is 17 px times font_scale (settings.ts sets --font-scale on <html>),
   and every text size is in rem over it; paddings, radii, line heights and icon boxes stay in px. */
html {
  font-size: calc(17px * var(--font-scale, 1));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Body: 17/26 400, letter spacing 0.01em. */
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 26px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* The page's column. Its foot keeps room for what floats over it: the tab bar, and above the bar the running-timer
   marker on the left and the + button on the right. */
main.app {
  max-width: 672px;
  margin: 0 auto;
  padding: 0 16px calc(148px + env(safe-area-inset-bottom, 0px));
  overflow-wrap: anywhere;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

/* Every link is a tap target of 44 px or more, in a heading or a line of text alike. */
a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  color: var(--accent);
}

/* Screen heading: 24/30 700. */
h1 {
  font-size: 1.4118rem;
  line-height: 30px;
  font-weight: 700;
  margin: 16px 0 8px;
}

/* Group header: 15/20 600 in the second text color, no capitals. */
h2 {
  font-size: 0.8824rem;
  line-height: 20px;
  font-weight: 600;
  color: var(--fg-2);
  margin: 24px 0 8px;
}

/* Row title: 18/24 500. A project's name on its card and an item's title. */
h3,
.card h2 {
  font-size: 1.0589rem;
  line-height: 24px;
  font-weight: 500;
  color: var(--fg);
  margin: 0 0 4px;
}

strong,
b {
  font-weight: 600;
}

/* A text block stays within 65 characters a line. */
p {
  max-width: 65ch;
  margin: 4px 0;
}

/* One column that never grows past the page: a row's one-line title ellipsizes instead of widening its card. */
ul.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}

.card.closed {
  opacity: 0.8;
}

/* Meta: 14/20 400 in the second text color, letter spacing 0.02em. */
.quiet {
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

/* A count line: figures of one width, so counts line up. */
.counts {
  font-variant-numeric: tabular-nums;
}

.confirm {
  color: var(--good);
}

.refused {
  color: var(--bad);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

label {
  display: block;
  margin-top: 12px;
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

/* Inputs, text boxes and selects never under 16 px (wave 10, C122): iOS Safari zooms the page into a smaller field on
   focus, as it would at font_scale 0.9. */
input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: max(16px, 1rem);
  line-height: 26px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* Buttons: 16/20 600, radius 10. */
button {
  min-height: 44px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.9412rem;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

button.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.5;
}

/* An icon (icons.ts): 20 px by its own width and height, in the text color around it. */
svg.icon {
  flex: none;
  vertical-align: middle;
}

/* Tags (C58). A chip is a dot in the tag's color and the name in the text color: the name carries the meaning. The
   app sets each dot's --tag and --tag-dark through the DOM's style object, never a style attribute (view.ts).
   Chips: 14/20 600. */
ul.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 4px 0;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dot {
  flex: none;
  width: 11.2px;
  height: 11.2px;
  border-radius: 50%;
  background: var(--tag, #898781);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dot {
    background: var(--tag-dark, #898781);
  }
}

:root[data-theme="dark"] .dot {
  background: var(--tag-dark, #898781);
}

/* The filter row: one chip a tag, each a link at least 44 px tall (the `a` rule); the chosen one is outlined. */
nav.filter {
  gap: 8px;
  margin: 8px 0 12px;
}

nav.filter a.chip {
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
}

nav.filter a.chip[aria-current="true"] {
  border-color: var(--accent);
}

/* A project's own color (C57), apart from its tags': a bar down its card's left edge, and a dot before its name on its
   screen. Set as --brand through the DOM's style object, like a tag's dot. A project without one shows neither. */
.card.branded {
  border-left: 4px solid var(--brand, var(--line));
}

.brand-dot {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: 0.05em;
  background: var(--brand, transparent);
}

/* A Last night row's name (wave 6, K4): a tap shows its source. Plain text in a full-width button, 44 px tall (the
   button rule), set as a row title. */
button.disclosure {
  display: block;
  width: 100%;
  padding: 8px 0;
  text-align: left;
  font-size: 1.0589rem;
  line-height: 24px;
  font-weight: 500;
  border: none;
  background: none;
}

/* The row (spec G §3, row.ts): collapsed at least 56 px, padding 12/16, the project's color as a 3 px bar down its
   left edge (--brand, set through CSSOM). Sizes that are not tap targets are set by width and aspect-ratio. */
ul.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

li.row {
  position: relative;
  min-height: 56px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

li.row::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--brand, transparent);
}

.card ul.rows {
  margin-top: 8px;
}

.card li.row:last-child {
  border-bottom: none;
}

/* Expanded in place: the surface, radius 12, no page change. */
li.row.expanded {
  overflow: hidden;
  background: var(--surface);
  border-radius: 12px;
  border-bottom-color: transparent;
}

.row .line {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* The circle: 24 px, stroke 2, in a 44 by 44 target whose circle lines up with the row's padding. Checked, it fills
   with --good over 300 ms. */
.row .check {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  margin-left: -10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--surface);
}

.row .circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 50%;
  transition:
    background-color 300ms,
    border-color 300ms;
}

.row .circle svg {
  opacity: 0;
  transition: opacity 300ms;
}

.row.checked .circle {
  background: var(--good);
  border-color: var(--good);
}

.row.checked .circle svg {
  opacity: 1;
}

/* The rest of the line: one tap target (a button, or on the Projects screen a link) holding the title, the meta line
   and the due chip. */
.row .main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--fg);
  text-align: left;
  text-decoration: none;
  font-weight: 400;
}

.row .text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Row title: 18/24 500, one line, an ellipsis past it. Checked, it strikes through over 300 ms. */
.row .title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1.0589rem;
  line-height: 24px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: line-through transparent;
  transition:
    text-decoration-color 300ms,
    color 300ms;
}

.row.checked .title {
  color: var(--fg-2);
  text-decoration-color: currentColor;
}

/* The owner's task_title_lines (wave 10, C122): 2 or 3 clamps the title to that many lines; 1, or none set, is the one
   line above. Its text is cut in row.ts too (titleCap), where the clamp is not supported. */
:root[data-task-title-lines="2"] .row .title,
:root[data-task-title-lines="3"] .row .title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  white-space: normal;
}

:root[data-task-title-lines="2"] .row .title {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

:root[data-task-title-lines="3"] .row .title {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* The owner's task_row_layout (C122): "plain" drops the meta line and the due chip's pin at the right end, the chip
   after the title on its line, for a denser list. "tick-left-date-right" is the row above. */
:root[data-task-row-layout="plain"] .row .text {
  flex: 0 1 auto;
}

:root[data-task-row-layout="plain"] .row .meta {
  display: none;
}

/* Meta line: 14/20 in the second text color, one line. */
.row .meta {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
  color: var(--fg-2);
}

/* The 12-hour stop's meta wraps (wave 14, RA2): its day and time are what it is for, and Keep and Edit leave it little width. */
.row.confirm-time .meta {
  white-space: normal;
}

/* A time entry's meta wraps, at any point if it must (wave 15): a project's long name, one with no break among them,
   shows whole on a second line and holds the row to the screen, help on or off, where one line spilled past it. */
.row.entry .meta {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Wave 11 (C138): after the project's name, the priority's chevrons, in the accent for 1 and the text color for 2
   and 3, and the effort's bars, the lit ones in the text color and the rest faint; each 14 px (icons.ts). */
.row .meta svg {
  vertical-align: -2px;
}

.row .meta > * + svg {
  margin-left: 6px;
}

.row .chevrons {
  color: var(--fg);
}

.row .chevrons.p1 {
  color: var(--accent);
}

.row .bars {
  color: var(--fg);
}

.row .bars rect {
  fill: currentColor;
  stroke: none;
}

.row .bars rect.off {
  opacity: 0.25;
}

/* The due chip: 14/20 600 in a pill on --surface-2; overdue in --bad, today in --accent. */
.row .due {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.row .due.overdue {
  color: var(--bad);
}

.row .due.today {
  color: var(--accent);
}

/* An Ask's Yes (filled accent) and No (outlined), each at least 44 by 64; a closed row's Reopen. */
.row .answer {
  flex: none;
  min-width: 64px;
}

.row .reopen {
  flex: none;
}

/* The expanded row (C138): About, the why at body size; Detail, its lines beside the pencil, and the pencil's editor;
   the options as buttons; the fields, the response, Done and Wrong; then the History fold. */
.row .more {
  padding-top: 4px;
}

.row .why {
  font-size: 1rem;
  line-height: 26px;
  margin: 8px 0;
}

.row .detail {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.row .detail-text {
  flex: 1;
  min-width: 0;
}

.row .detail-text p {
  margin: 8px 0;
}

.row .detail-text p.next {
  font-weight: 600;
}

.row .detail .edit {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg-2);
}

.row .editor {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.row .editor input,
.row .editor textarea {
  margin-top: 0;
}

.row .editor textarea {
  min-height: 78px;
  field-sizing: content;
}

.row .options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Wave 11 (C140): Later's four choices in a wrapping row, and the re-date line under the row's line. */
.row .later {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.row p.moved {
  margin: 0 0 4px;
}

.row .fold {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 0 12px 0 0;
  border: none;
  background: none;
  color: var(--fg-2);
}

.row .history p {
  margin: 4px 0;
}

.row .fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 16px 0 12px;
}

.row .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row .field label {
  margin-top: 0;
}

.row .field input {
  width: auto;
  margin-top: 0;
}

.row .field-name {
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
  color: var(--fg-2);
}

.segmented {
  display: inline-flex;
}

.segmented button {
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 0;
  margin-left: -1px;
  font-variant-numeric: tabular-nums;
}

.segmented button:first-child {
  margin-left: 0;
  border-radius: 10px 0 0 10px;
}

.segmented button:last-child {
  border-radius: 0 10px 10px 0;
}

.segmented button[aria-pressed="true"] {
  position: relative;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

button.good {
  color: var(--surface);
  background: var(--good);
  border-color: var(--good);
}

/* A group header that opens its group (Done · n): the header's own type, a 44 px target. */
h2.group {
  font-variant-numeric: tabular-nums;
}

h2 button.group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 0 0;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

/* The snackbar after a close: fixed just above the tab bar, in the text color's ground, until the next action or
   navigation. The page keeps room under its last row for it, and the marker moves up over it. */
main.app.has-snackbar {
  padding-bottom: calc(196px + env(safe-area-inset-bottom, 0px));
}

.snackbar {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  z-index: 3;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  padding: 4px 4px 4px 16px;
  border-radius: 12px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.9412rem;
  line-height: 20px;
}

.snackbar .text {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.snackbar button {
  border: none;
  background: none;
  color: var(--bg);
  text-decoration: underline;
}

.snackbar .refused {
  flex-basis: 100%;
  padding-bottom: 8px;
  color: var(--bg);
  font-weight: 600;
}

/* The tab bar (C79; bar B1, the design's frames 1 to 8): fixed at the foot, 68 px over the phone's home area, four
   equal tabs, each a 22 px icon over a 14 px label in the second text color; the current one in the accent, its label
   600. Its surface reaches the screen's edges; its tabs keep to the page's column. */
nav.tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0;
  height: calc(68px + env(safe-area-inset-bottom, 0px));
  padding: 0 max(0px, calc((100% - 672px) / 2)) env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

nav.tabs a.tab {
  position: relative;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--fg-2);
  text-decoration: none;
}

nav.tabs a.tab .label {
  font-size: 0.8236rem;
  line-height: 18px;
  font-weight: 500;
}

nav.tabs a.tab[aria-current="page"] {
  color: var(--accent);
}

nav.tabs a.tab[aria-current="page"] .label {
  font-weight: 600;
}

/* The Tasks tab's badge (C84; the Brain tab's until PG-1 A): the count of open items that need you, in the accent, over the icon's right. */
nav.tabs .badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* The running-timer marker (C77; bar B1): bottom left above the tab bar, a 44 px tap holding a 36 px pill on the
   surface with a line border: a pulsing 8 px dot in the accent, the time as 14/20 600 in figures of one width, and the
   project's name cut to fit. A paused timer's dot is still. */
a.marker {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  left: max(16px, calc((100% - 672px) / 2 + 16px));
  z-index: 3;
  color: var(--fg);
  text-decoration: none;
}

main.app.has-snackbar a.marker {
  bottom: calc(136px + env(safe-area-inset-bottom, 0px));
}

a.marker .pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

a.marker .pulse {
  position: relative;
  flex: none;
  width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
}

a.marker .pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-out infinite;
}

a.marker .pulse.still::after {
  animation: none;
  opacity: 0;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

a.marker .time {
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

a.marker .project {
  max-width: 112px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 500;
  color: var(--fg-2);
}

/* A screen's heading row (menu.ts): the menu button at its left end, its 44 px target lined up with the page's
   padding, then the heading. Its box reaches 12 px past the column on the right too, for the change order's icon, whose
   -12 px margin takes the padding (wave 13, RA1). */
header.heading {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px -12px 8px -12px;
  padding-right: 12px;
}

header.heading h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

button.menu-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg);
}

/* The menu (bar B1 as AJ amended it): a panel from the left, 80 % of the width and at most 320 px, the full height, on
   the surface, over a scrim that closes it. It slides in on the draw that opens it only (reduced motion: no slide). The
   scrim is the text color's shade in light and the ground's in dark, as the design's. */
button.scrim {
  position: fixed;
  inset: 0;
  z-index: 4;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: color-mix(in srgb, var(--fg) 45%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button.scrim {
    background: color-mix(in srgb, var(--bg) 45%, transparent);
  }
}

:root[data-theme="dark"] button.scrim {
  background: color-mix(in srgb, var(--bg) 45%, transparent);
}

div.menu {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  width: 80%;
  max-width: 320px;
  overflow-y: auto;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-right: 1px solid var(--line);
}

div.menu.slide {
  animation: menu-in 200ms ease-out;
}

@keyframes menu-in {
  from {
    transform: translateX(-100%);
  }
}

ul.menu-rows {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

ul.menu-rows li {
  border-bottom: 1px solid var(--line);
}

/* A row: a link or a button the panel's full width, its name at the left. */
ul.menu-rows a,
ul.menu-rows li > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 12px 0 16px;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--fg);
  font-size: 1rem;
  line-height: 26px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}

ul.menu-rows a svg.icon {
  color: var(--fg-2);
}

/* The theme control's row: its name, then System · Light · Dark. */
ul.menu-rows li.theme {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
}

ul.menu-rows li.theme .name {
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

/* The notifications row (wave 8, A3.2): its button as any row's, then what it is now under it. */
ul.menu-rows li.notify p {
  margin: 0;
  padding: 0 16px 12px;
  font-size: 0.8236rem;
  line-height: 20px;
}

/* Reduced motion: the same end state, with nothing animated. */
@media (prefers-reduced-motion: reduce) {
  .row .circle,
  .row .circle svg,
  .row .title {
    transition: none;
  }

  a.marker .pulse::after {
    animation: none;
    opacity: 0;
  }

  div.menu.slide {
    animation: none;
  }
}

/* The screens' own blocks follow (C85): each screen's module keeps its rules in its marked block below, so lanes
   building different tabs write in different places. A rule two screens share belongs above. */

/* Tab: Tasks (src/tabs/tasks.ts), and lane D's other pieces: the quick input (src/input.ts), the row's detail
   (row.ts) and a project's status line and phase (src/tabs/projects.ts). */

/* The Tasks list's Sort and Filter chips (wave 11, C139): two pills like the phase chip, and the open one's short list
   of choices under them, the one shown in the accent. */
.list-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

button.list-chip {
  flex: none;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8236rem;
  line-height: 20px;
}

button.list-chip[aria-expanded="true"] {
  border-color: var(--accent);
}

ul.choices {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  padding: 0;
}

ul.choices button[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* The quick input's project chips (the design's frame 2, once Week's too): one row that scrolls sideways, each chip a
   44 px target holding a 36 px pill on --surface-2 with the project's 8 px dot; the chosen one in the accent. */
.project-chips {
  display: flex;
  gap: 6px;
  margin: 4px -16px 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.project-chips button.chip {
  flex: none;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
}

.project-chips .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg);
  white-space: nowrap;
}

.project-chips button.chip[aria-pressed="true"] .pill {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.project-dot {
  flex: none;
  width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--brand, transparent);
}

/* The week note (frame 2): a collapsed card, its label in the meta type, that opens to the page's text. */
button.note-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px 8px 14px;
  border-radius: 12px;
  text-align: left;
}

button.note-card .label {
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

.week-note {
  padding: 4px 14px 8px;
}

/* The quick input (src/input.ts, bar B3; spec G §4): the + button, 56 px, bottom right above the tab bar, in the
   accent; it moves above the snackbar while one shows, as the marker does. */
button.fab {
  position: fixed;
  right: max(16px, calc((100% - 672px) / 2 + 16px));
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  min-height: 56px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}

main.app.has-snackbar button.fab {
  bottom: calc(136px + env(safe-area-inset-bottom, 0px));
}

/* Its sheet: from the foot, over the menu's scrim, its top corners 16, on the surface. */
button.scrim.sheet-scrim {
  z-index: 6;
}

div.sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 7;
  max-width: 672px;
  margin: 0 auto;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  background: var(--surface);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

button.sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg-2);
}

div.sheet input {
  margin-top: 12px;
}

/* The typed line: 18 px. */
div.sheet input.quick-line {
  font-size: max(16px, 1.0589rem);
  line-height: 24px;
}

/* The words the line set, as chips under it: a tap keeps the word as text. A project's suggestion completes the word. */
.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

button.token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

button.token.suggestion {
  color: var(--accent);
}

/* The row's detail (row.ts, C86): a text box that keeps the detail's lines, in the pencil's editor (C138). */
textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: max(16px, 1rem);
  line-height: 26px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

/* A project's status line (projects.ts, bar B3.3): a tap edits it in place, on a row of its own at the page's width
   (wave 12, A4). Help mode wraps the line in a span, which takes the line's place. Under it one wrapping row: the phase
   chip (C80), whose tap lists the phases, the current one in the accent; the Parked chip; then Park or Unpark (C162). A
   chip wider than the row breaks its text inside the row. */
.status-row {
  display: flex;
}

.status-row > span.help-anchor.wrap:first-child {
  flex: 1 1 100%;
  min-width: 0;
}

.status-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.status-meta > span.help-anchor.wrap {
  min-width: 0;
}

button.status-line {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--fg);
  text-align: left;
  font-size: 1rem;
  line-height: 26px;
  font-weight: 400;
}

.status-edit {
  flex: 1 1 100%;
  min-width: 0;
}

button.phase-chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8236rem;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

ul.phases {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
  padding: 0;
}

ul.phases button[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* A project's identity block (projects.ts, wave 8 A1): each field's name in the second text color over its values, one
   a line; a long path wraps rather than widening the page. */
dl.identity {
  margin: 4px 0 12px;
}

dl.identity div {
  padding: 4px 0;
}

dl.identity dt {
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

dl.identity dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* The Projects list (projects.ts, wave 11 C139): one line a project, a 44 px link holding its dot and name, then its
   phase, open count and soonest due day in the meta type; a line under each, no card. */
ul.project-lines {
  gap: 0;
}

li.project-line {
  border-bottom: 1px solid var(--line);
}

li.project-line a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 10px 0;
  color: var(--fg);
  text-decoration: none;
}

li.project-line .name {
  font-weight: 600;
}

li.project-line .meta {
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* A line's meta and its Parked chip (wave 12, A4): together after the name, wrapping as one, so the chip takes no width
   from the name. */
li.project-line .line-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
}

/* The Parked chip (wave 12, C162): on a project's line and under its status line, the due chip's pill; it is no control. */
.parked-chip {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Archived in the app (wave 13, C172): the list's count line, its Show a 44 px text button; a hidden project listed by
   Show is dimmed; a picker's hidden project reads its mark in the second text color. */
p.projects-count {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 4px;
}

li.project-line.hidden > a {
  opacity: 0.6;
}

/* Unarchive on a hidden project's line (wave 14, RA2): undimmed at the line's right, its refusal under the line. */
li.project-line.archived {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
}

li.project-line.archived > a {
  flex: 1 1 0;
  min-width: 0;
}

li.project-line.archived > p.refused {
  flex-basis: 100%;
}

/* Help on: the line's badge keeps the corner, Unarchive and its own badge clear of it and inside the line. */
main.help li.project-line.archived {
  padding-right: 44px;
}

.mark {
  color: var(--fg-2);
  font-weight: 400;
}

/* Help on: a line's badge sits inside the line's right end, its tap reach with it (wave 13, RA1). */
li.project-line > button.help-badge {
  right: 12px;
}

/* Help on: a badge's 12 px tap reach at the page's edge runs past it. These two screens clip it there, so they do not
   scroll sideways; the reach inside the page stays. */
main.help:has(ul.project-lines),
main.help:has(.status-row) {
  overflow-x: clip;
}

/* Help on (wave 12, A4): the status line's two rows keep a badge and its reach inside their own width. */
main.help .status-row,
main.help .status-meta {
  padding-right: 20px;
}

/* Tab: Brain, and the menu's screens (src/tabs/brain.ts, people.ts, closed.ts, nights.ts). */

/* A night's change (the Brain tab's Last night; Older nights): its name a full-width tap that shows its source, and at
   its right its Undo, or the lock. */
ul.changes .line {
  display: flex;
  align-items: center;
  gap: 8px;
}

ul.changes button.disclosure {
  flex: 1;
  min-width: 0;
  width: auto;
}

/* Undo (spec G §6): a text button at least 44 by 64, in the accent, its icon before its word. */
ul.changes button.undo {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  padding: 8px 4px 8px 8px;
  border: none;
  background: none;
  color: var(--accent);
}

/* The lock: the undo needs a scope the app's sign-in does not hold, so a Claude session undoes it. */
ul.changes .lock {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  color: var(--fg-2);
}

/* Brain info's figures (the design's frame 5): each name at the left in the second text color, its figure at the
   right, on one card. */
dl.info {
  margin: 0 0 12px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

dl.info div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

dl.info div:last-child {
  border-bottom: none;
}

dl.info dt {
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

dl.info dd {
  margin: 0;
  font-size: 0.9412rem;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Closed items' control, Done · Wrong · Expired, under the heading. */
div.closed-states {
  margin: 4px 0 8px;
}

/* A person's next touch: a date field as wide as a date, not the row. */
li.person input[type="date"] {
  width: auto;
}

/* Tab: Time (src/tabs/time.ts). */

/* A select: the input's frame on the ground, 16/20 500, the design's chevron at its right (time.ts draws it over the
   select, where a tap passes through it). The Time tab's are the app's first; a later screen's use this rule too. */
select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 36px 0 12px;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: max(16px, 0.9412rem);
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.time .select {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
  color: var(--fg-2);
}

.time .select.dotted select {
  padding-left: 30px;
}

/* A project's 8 px dot in its own color (--brand, set through CSSOM), the second text color for a project with none. */
.time .select .pdot {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 8px;
  aspect-ratio: 1;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--brand, var(--fg-2));
  pointer-events: none;
}

.time .select svg.icon {
  position: absolute;
  top: 50%;
  right: 10px;
  margin-top: -10px;
  pointer-events: none;
}

.time > .meta {
  margin: -4px 0 8px;
}

/* A text button: the accent on no ground, 44 px tall (the button rule). */
.time button.text {
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--accent);
}

.time button.text.bad,
.time button.bad {
  color: var(--bad);
}

/* The timer card (the design's frames 6 to 8): the selects, the time run, the dial, then the Detail and the actions. */
.time .timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 16px;
}

.time .timer-card .fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.time .timer-card .field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time .timer-card .field label {
  flex: none;
  width: 56px;
  margin: 0;
  font-weight: 600;
}

/* The time run: 44/52 700 in figures of one width. */
.time .elapsed {
  margin-top: 12px;
  font-size: 2.5883rem;
  line-height: 52px;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* The time as a tap, while a timer is open (wave 12, C155): the figure's own type, a 44 px target. */
button.elapsed-tap {
  padding: 0 8px;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  font-variant-numeric: inherit;
  letter-spacing: inherit;
}

.time .timer-card .elapsed-edit {
  width: 100%;
  margin-top: 12px;
}

.time .started {
  margin: 0;
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* The dial: a 168 px ring (time-ring.ts) with the 88 px play button at its center. */
.time .dial {
  position: relative;
  width: 168px;
  aspect-ratio: 1;
  margin-top: 8px;
}

.time .dial .ring {
  position: absolute;
  inset: 0;
}

.time .dial .track {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
}

.time .dial .tick {
  stroke: var(--line);
  stroke-width: 2;
  stroke-linecap: round;
}

.time .dial .tick.major {
  stroke: var(--fg-2);
}

.time .dial .arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
}

.time .dial .head {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
}

.time .dial button.play {
  position: absolute;
  top: 40px;
  left: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  min-height: 88px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent);
}

.time .timer-card .detail {
  width: 100%;
}

.time .timer-card .run-acts {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
}

.time .timer-card .grow {
  flex: 1;
}

/* A question asked in place (switch the timer, discard it, void an entry): its words, then its two answers. */
.time .ask {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.time .ask p {
  margin: 0;
}

/* The entries: a group header with its action at the right, and rows whose right side holds the duration and the
   billed mark (Unbilled in the second text color on the second surface, Billed in --good). */
.time .group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 24px 0 8px;
}

.time .group-head h2 {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.time li.row .side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-left: 4px;
}

.time .duration {
  font-size: 0.9412rem;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.time .bill {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.time .bill.billed {
  color: var(--good);
}

/* The editor: two columns of fields (project and task, start and stop), the Detail, then its actions. */
.time .card.editor {
  margin-top: 8px;
}

.time .two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 12px;
}

/* T2z: at a phone's width half a row cuts a date and time down to its date, so each takes the row. */
@media (max-width: 599px) {
  .time .two .wall {
    grid-column: 1 / -1;
  }
}

.time .stack select {
  margin-top: 4px;
}

/* The Mark billed sheet (the design's frame 9): from the foot, over the menu's scrim; it scrolls inside the screen's
   height when the screen is short, so its wrapper takes the height and lets taps through to the scrim. */
.time .sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  pointer-events: none;
}

.time .bill-sheet {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 672px;
  min-height: 0;
  margin: 0 auto;
  overflow-y: auto;
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 24px color-mix(in srgb, var(--fg) 18%, transparent);
  pointer-events: auto;
}

.time .bill-sheet .handle {
  flex: none;
  align-self: center;
  width: 40px;
  aspect-ratio: 10;
  border-radius: 999px;
  background: var(--line);
}

.time .bill-sheet .sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.time .bill-sheet .sheet-head h2 {
  margin: 0;
  color: var(--fg);
  font-size: 1.4118rem;
  line-height: 30px;
  font-weight: 700;
}

.time .bill-sheet button.close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg);
}

.time .bill-sheet .summary {
  margin: 12px 0 4px;
  font-variant-numeric: tabular-nums;
}

.time .bill-sheet button.full {
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  font-size: 1rem;
}

/* The change order (change-order.ts, wave 9 C118): its icon at the heading row's right end, a 44 px target lined up
   with the page's padding as the menu button's is; its panel flies out from the top right, over the page, on the
   surface, the context line and the cross at its top, the field and its tick under them. */
button.change-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  margin: 0 -12px 0 auto;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg);
}

div.change-order {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 8px;
  z-index: 5;
  width: calc(100% - 16px);
  max-width: 360px;
  padding: 4px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.change-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-right: -12px;
}

.change-head p.context {
  min-width: 0;
  margin: 0;
}

button.change-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg-2);
}

/* Wave 10 (C122): the field is a text box the panel's width, 3 lines growing with the text to 8 (26 px lines, 8 px
   padding and a 1 px border each side), the tick under it at the right. */
div.change-order textarea {
  margin-top: 4px;
  min-height: 96px;
  max-height: 226px;
  field-sizing: content;
  resize: none;
  overflow-y: auto;
}

div.change-order .send {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* The Modules page (tabs/modules.ts, wave 9 C113): each module's title with its switch at the right, then one checkbox
   a pack. On is the accent, as a pressed segment is. */
.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

ul.packs {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

ul.packs li.pack {
  margin-top: 8px;
}

/* A pack whose record waits for the owner (wave 15, C213, bar A5 line 1): its name as text, no checkbox. */
ul.packs li.pack p.pack-waiting {
  margin: 0;
}

/* The waiting block (bar A5 line 2): every proposal, the list whole; past 70 % of the screen's height it scrolls
   inside itself. Each value wraps rather than widening its card. */
ul.waiting-list {
  max-height: 70vh;
  overflow-y: auto;
}

li.proposal h3,
li.proposal p,
dl.proposal-values dd {
  overflow-wrap: anywhere;
}

dl.proposal-values {
  margin: 4px 0 8px;
}

dl.proposal-values div {
  display: flex;
  gap: 12px;
  padding: 2px 0;
}

dl.proposal-values dt {
  flex: none;
  width: 96px;
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
  letter-spacing: 0.02em;
}

dl.proposal-values dd {
  min-width: 0;
  margin: 0;
}

button[role="switch"][aria-checked="true"],
button[role="checkbox"][aria-checked="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* The Settings sheet (tabs/settings.ts, wave 10 C121): each knob's title and help, its control, then its Reset. A slider
   runs the card's width with its value at the right. */
li.knob .slider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

li.knob .slider input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  accent-color: var(--accent);
}

li.knob .slider output {
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

li.knob .reset {
  margin-top: 8px;
}

/* The Money screen (tabs/money.ts, wave 10 C123): an invoice is a row, its total before its due chip; the detail's
   columns and lines are tables the column's width, numbers to the right. */
.row.invoice .amount {
  flex: none;
  font-variant-numeric: tabular-nums;
}

table.columns,
table.lines {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 0.8236rem;
  line-height: 20px;
}

table.columns th,
table.columns td,
table.lines th,
table.lines td {
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

table.columns th,
table.lines th {
  color: var(--fg-2);
  font-weight: 600;
}

table.lines td.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Pages (tabs/pages.ts, PG-C5): a page's prose as the week note's, then a list page's table in its own box, which
   scrolls sideways when the columns are wider than the page (A11), so the page never does. Words wrap inside a cell,
   never a letter at a time. A column head is a 44 px button that sorts by it; a tick is a 44 px box; a ticked row is
   dimmed in its place. */
.page-prose {
  margin-top: 8px;
}

.page-table {
  max-width: 100%;
  margin-top: 8px;
  overflow-x: auto;
  overflow-wrap: break-word;
}

.page-table table {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.8236rem;
  line-height: 20px;
}

.page-table th,
.page-table td {
  padding: 0 8px 0 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.page-table td {
  max-width: 20em;
}

.page-table td.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.page-table button.sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  padding: 0 8px 0 0;
  border: none;
  background: none;
  color: var(--fg-2);
  font-size: inherit;
  white-space: nowrap;
}

.page-table th.tick,
.page-table td.tick {
  width: 44px;
  padding: 0;
}

.page-table button.tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  color: var(--fg);
  border: none;
  background: none;
}

.page-table button.tick[aria-checked="true"] {
  color: var(--accent);
}

.page-table tr.done td:not(.tick) {
  opacity: 0.55;
}

.page-add h2 {
  margin-top: 24px;
}

/* Help mode (src/help.ts, wave 11 C141). The toggle in the heading row, left of the change order's icon, lit while
   on. A badge is a 20 px "?" at its control's top-right corner, placed absolutely so nothing moves; its tap area
   reaches 12 px past it on each side, 44 px in all, as every tap target here does. It stands 4 px past its control, so
   the reach of one at the column's edge ends at the page's, inside the 16 px margin (wave 13, RA1). A control that cannot hold the
   badge (a button, a link, an input) is wrapped in a span or div that can. The card is the fly-out's: fixed at the
   top right over a scrim, its name on one line and its text under it. */
.heading > .help-toggle,
.heading > .help-anchor {
  margin-left: auto;
}

.heading > .help-toggle ~ button.change-button,
.heading > .help-anchor ~ button.change-button {
  margin-left: 0;
}

button.help-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg);
}

button.help-toggle.on {
  color: var(--accent);
}

.help-anchor {
  position: relative;
}

span.help-anchor.wrap {
  display: inline-block;
  max-width: 100%;
}

div.help-anchor.wrap {
  display: block;
}

nav.tabs > span.help-anchor.wrap {
  display: flex;
}

nav.tabs > span.help-anchor.wrap > a.tab {
  flex: 1;
}

button.help-badge {
  position: absolute;
  top: -8px;
  right: -4px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  min-height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 700;
}

button.help-badge::after {
  content: "";
  position: absolute;
  inset: -12px;
}

/* The toggle's own badge stands at its top-left corner: its reach ends 2 px short of the toggle's center, so a tap there
   turns help off, and clear of the change order's button on the other side. */
.heading > .help-anchor > button.help-badge {
  right: auto;
  left: -12px;
}

/* Help on: a title that fills its line stops short of that badge, which reaches 8 px over the heading's right end. */
main.help header.heading h1 {
  padding-right: 8px;
}

/* A tab's badge sits inside its tab, its reach with it: the bar meets the screen's edge (RA1r). */
nav.tabs > span.help-anchor.wrap > button.help-badge {
  right: 12px;
}

/* A badge on the row's meta line is not cut off by its one-line overflow. */
main.help .row .meta {
  overflow: visible;
}

button.scrim.help-scrim {
  z-index: 8;
}

div.help-card {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 8px;
  z-index: 9;
  width: calc(100% - 16px);
  max-width: 360px;
  padding: 4px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-right: -12px;
}

.help-head p.help-name {
  margin: 0;
  font-weight: 600;
}

button.help-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--fg-2);
}

div.help-card p.help-text {
  margin: 4px 0 0;
}

/* The connection map (wave 12, C156): rows of nodes, one column on a phone, a connector between rows. Each state is a
   token and a word: --good connected, --fg-2 on --line available, --accent recommended. */
p.map-legend {
  margin: 0 0 16px;
  color: var(--fg-2);
  font-size: 0.8236rem;
  line-height: 20px;
}

.map-key {
  font-weight: 600;
}

.map-key.connected,
button.map-node.connected .map-word {
  color: var(--good);
}

.map-key.available,
button.map-node.available .map-word {
  color: var(--fg-2);
}

.map-key.recommended,
button.map-node.recommended .map-word {
  color: var(--accent);
}

section.map-row {
  position: relative;
}

section.map-row + section.map-row {
  margin-top: 24px;
}

section.map-row + section.map-row::before {
  content: "";
  position: absolute;
  top: -20px;
  bottom: calc(100% + 4px);
  left: 24px;
  width: 2px;
  background: var(--fg-2);
}

section.map-row h2.group {
  margin: 0 0 8px;
}

/* Each card takes its own height (wave 15, oversight after the 1,280 px render): a code box that makes one card tall
   leaves the others in its row as they were. */
ul.map-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  align-items: start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

button.map-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  text-align: left;
}

button.map-node.connected {
  border-color: var(--good);
}

button.map-node.recommended {
  border-color: var(--accent);
}

/* A node's name, a routine's ref among them, breaks inside the node rather than widening it (wave 13, C174). */
.map-name {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* A node's help badge sits inside its corner: on a phone the node meets the page's 16 px margin, and the badge's 12 px
   tap reach past its usual place would run off the page. */
ul.map-nodes button.help-badge {
  right: 4px;
}

.map-word {
  font-size: 0.8236rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* The Connections check (wave 15, C192): Check now under the connector and the skills nodes, and the code's box under
   the one that asked; the node keeps its own height. */
ul.map-nodes li.has-check {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

ul.map-nodes li.has-check button.map-node {
  height: auto;
}

.check-box {
  width: 100%;
  padding: 0 12px 8px;
}

.check-box p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.check-box .check-code {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.check-box .check-line {
  user-select: all;
}

/* The Time tab's mode row (tabs/timesheet.ts, wave 13 C168): Timer, Week and Month under the heading, in sight on every
   Time view, each a 44 px link, the one shown lit. */
.time-modes {
  display: flex;
  gap: 4px;
  margin: 0 0 8px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}

a.time-mode {
  flex: 1 1 0;
  justify-content: center;
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.9412rem;
  font-weight: 600;
  text-decoration: none;
}

a.time-mode[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent);
}

/* The Week and Month views (tabs/timesheet.ts, wave 13 C169). One column on a phone; from 900 px the page widens, the
   week's days stand side by side with the sums beneath them, and the month's cells list their entries. */
.ts-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

button.ts-step {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
}

p.ts-range {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
  text-align: center;
  font-weight: 600;
}

button.ts-home {
  flex: none;
  padding: 8px;
  font-size: 0.8236rem;
}

.ts-hours {
  flex: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ts-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ts-running {
  color: var(--accent);
  font-size: 0.8236rem;
  line-height: 20px;
  font-weight: 600;
}

p.ts-running {
  margin: 0;
}

/* The open timer stands on its own line under a total, so the total stays under the sums it adds. */
p.ts-total .ts-running {
  flex: 1 1 100%;
  text-align: right;
}

.ts-day-name,
.ts-day-head .ts-running {
  white-space: nowrap;
}

section.ts-day {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.ts-day-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ts-day-head h2 {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: var(--fg);
}

section.ts-day.today .ts-day-name {
  color: var(--accent);
}

button.ts-add {
  flex: none;
  width: 44px;
  padding: 0;
  font-size: 1.1765rem;
}

p.ts-none {
  margin: 0 0 8px;
}

ul.ts-entries,
ul.ts-projects {
  list-style: none;
  margin: 0;
  padding: 0;
}

button.ts-entry-tap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  width: 100%;
  padding: 8px 0;
  border: none;
  border-radius: 0;
  background: none;
  text-align: left;
  font-weight: 400;
}

.ts-start {
  flex: none;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.ts-what {
  flex: 1 1 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  min-width: 0;
}

.ts-task {
  min-width: 0;
  color: var(--fg-2);
  overflow-wrap: anywhere;
}

.ts-billed {
  flex: none;
  color: var(--good);
  font-size: 0.8236rem;
  font-weight: 600;
}

section.ts-foot {
  margin-top: 12px;
}

li.ts-project,
p.ts-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0;
}

li.ts-project .ts-name {
  flex: 1 1 0;
}

p.ts-total {
  justify-content: space-between;
  max-width: none;
  font-weight: 600;
}

/* The Month: seven columns of whole weeks; the sums of a week run under its row on a phone. */
.ts-weekdays,
.ts-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.ts-weekdays {
  color: var(--fg-2);
  font-size: 0.8236rem;
  text-align: center;
}

.ts-weekdays > span:last-child {
  display: none;
}

.ts-week {
  margin-bottom: 8px;
}

button.ts-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  min-height: 56px;
  padding: 4px 2px;
  overflow: hidden;
  border-radius: 8px;
  font-size: 0.8236rem;
  font-weight: 400;
  text-align: left;
}

button.ts-cell.out {
  opacity: 0.5;
}

button.ts-cell.today .ts-date {
  color: var(--accent);
  font-weight: 700;
}

button.ts-cell.open {
  border-color: var(--accent);
}

.ts-cell-entries,
button.ts-cell .ts-running {
  display: none;
}

.ts-week-sums {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 4px;
  font-size: 0.8236rem;
}

@media (min-width: 900px) {
  main.app:has(.timesheet) {
    max-width: 1280px;
  }

  .ts-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
  }

  section.ts-day {
    border-bottom: none;
    border-right: 1px solid var(--line);
    padding-right: 8px;
  }

  /* A column's header: the day and its sum, then the open timer and the "+", each on its own line when it must. */
  .ts-days .ts-day-head {
    flex-wrap: wrap;
  }

  .ts-days .ts-day-head h2 {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .ts-days .ts-add {
    margin-left: auto;
  }

  button.ts-entry-tap {
    justify-content: space-between;
  }

  .ts-what {
    order: 3;
    flex: 1 1 100%;
  }

  .ts-weekdays,
  .ts-week {
    grid-template-columns: repeat(7, minmax(0, 1fr)) 160px;
  }

  .ts-weekdays > span:last-child {
    display: block;
  }

  button.ts-cell {
    min-height: 120px;
  }

  .ts-cell-entries {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
  }

  /* An entry takes two lines, its name over its hours, so the name stays readable in a 900 px cell. */
  .ts-cell-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 4px;
    min-width: 0;
  }

  .ts-cell-entry .ts-name {
    flex: 1 1 calc(100% - 28px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  button.ts-cell .ts-running {
    display: block;
  }

  .ts-week-sums {
    grid-column: auto;
  }
}

/* The Table (tabs/timesheet.ts, wave 13 C170): a row a line under a header a day. Day, project, task, hours and billed on
   a phone; start, end and note join from 900 px. A box is a 44 px button holding a drawn square. */
.ts-table-tools {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ts-span {
  display: flex;
  gap: 4px;
}

.ts-select {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 8px;
}

.ts-count {
  flex: 1 1 auto;
  font-weight: 600;
}

.ts-change {
  margin-bottom: 8px;
}

button.ts-box {
  flex: none;
  position: relative;
  width: 44px;
  padding: 0;
  border: none;
  background: none;
}

button.ts-box::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid var(--fg-2);
  border-radius: 4px;
}

button.ts-box[aria-pressed="true"]::before {
  border-color: var(--accent);
  background: var(--accent);
}

p.ts-pass {
  margin: 0 0 8px;
  font-weight: 600;
}

.ts-undo {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.ts-cols,
button.ts-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 5fr) minmax(0, 3fr) 44px 44px;
  gap: 4px;
  align-items: baseline;
}

.ts-cols {
  color: var(--fg-2);
  font-size: 0.8236rem;
  overflow-wrap: normal;
}

.ts-select ~ .ts-cols {
  padding-left: 44px;
}

.ts-c-wide {
  display: none;
}

section.ts-table-day {
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
}

/* A day's sum stands over the Hours column, its right edge on theirs, clear of the Billed column and of a badge. */
section.ts-table-day h2 {
  padding-right: 48px;
}

.ts-cols .ts-hours,
button.ts-row .ts-hours {
  text-align: right;
}

.ts-span button[aria-pressed="true"],
button.ts-all[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

ul.ts-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

li.ts-line {
  display: flex;
  align-items: center;
}

button.ts-row {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 0;
  border: none;
  border-radius: 0;
  background: none;
  text-align: left;
  font-size: 0.8236rem;
  font-weight: 400;
}

.ts-c-project {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.ts-c-project .brand-dot {
  flex: none;
}

@media (min-width: 900px) {
  .ts-cols,
  button.ts-row {
    grid-template-columns: 32px minmax(0, 2fr) minmax(0, 2fr) 56px 56px minmax(0, 3fr) 56px 56px;
  }

  section.ts-table-day h2 {
    padding-right: 60px;
  }

  .ts-c-wide {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
  }
}
