/* =============================================================================
   698 Macon — neo-brutalist design system
   Tokens · typography · components · calendar · responsive
   ============================================================================= */

/* Theming: this block is the complete light palette and the default. The dark
   palette follows it — see the note there for how the OS preference and the
   Settings picker each select it. Everything a theme needs to change is a token
   here, which is why dark needs no second stylesheet. */
:root {
  color-scheme: light;

  /* surfaces */
  --bg:           #fbf8f1;
  --surface:      #ffffff;
  --surface-soft: #f3efe4;
  --surface-mute: #e9e3d4;

  /* ink — every value below clears 4.5:1 on --bg, --surface and --surface-soft */
  --ink:        #0a0a0a;
  --ink-soft:   #2a2a28;
  --ink-muted:  #494946;
  --ink-faint:  #5c5c59;

  /* accent (terracotta). --accent-ink is INK, not white: white on this orange
     is only 3.36:1 and every primary button label failed WCAG AA. */
  --accent:      #e8623d;
  --accent-dark: #b8451f;
  --accent-soft: #ffe4d6;
  --accent-ink:  #0a0a0a;

  /* status — each pair verified ≥4.5:1 */
  --success:    #1a6b43;
  --success-bg: #e4f2e8;
  --warn:       #8a4a10;
  --warn-bg:    #fdeed6;
  --danger:     #b32116;
  --danger-bg:  #ffe6e3;
  --done-bg:    #e4f2e8;

  /* theme-dependent one-offs (were hard-coded hex, which broke in dark) */
  --today-bg:        #fff5ec;
  --input-focus-bg:  #fffbf6;
  --stripe:          rgba(10, 10, 10, 0.025);
  --backdrop:        rgba(10, 10, 10, 0.6);
  --shadow-color:    var(--ink);
  --today-ring:      var(--accent-dark);
  /* Text sitting ON an --ink block (skip link, step numerals, unit chip). Must
     flip with the theme: --ink is near-black in light and near-white in dark,
     so a fixed accent here reads at 5.9:1 in light and 2.4:1 in dark. */
  --on-ink:          #e8623d;

  /* primitives */
  --border:        2px solid var(--ink);
  --border-thick:  3px solid var(--ink);
  --hairline:      2px solid var(--surface-mute);
  --shadow-hard:   4px 4px 0 0 var(--shadow-color);
  --shadow-card:   6px 6px 0 0 var(--shadow-color);
  --shadow-tiny:   2px 2px 0 0 var(--shadow-color);

  /* spacing scale (4pt base) */
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* semantic stacking order */
  --z-sticky:  10;
  --z-tabbar:  20;
  --z-toast:   30;

  /* motion */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --dur-fast: 90ms;
  --dur-base: 180ms;

  /* typography */
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Dark palette. Deliberately plain hex rather than light-dark(): that function
   only resolves in properties that parse as a <color>, and these tokens are
   substituted into shorthands all over this file (`background:`, `border:`,
   `box-shadow:`). Inside a shorthand it silently keeps the light branch, which
   produced light-ink text on a white button in dark mode. Plain values work in
   every property, so the duplication below buys correctness.
   The two selectors are the two ways dark is reached:
     1. the OS preference, when the user has never chosen (the default)
     2. an explicit choice, stamped on <html> by the Settings picker
   `:not([data-theme="light"])` is what lets an explicit Light override a dark
   OS setting rather than being ignored.

   Dark keeps the same neo-brutalist language inverted — bright ink on near
   black — but the hard offset shadow becomes a warm mid-grey. Pure black
   vanishes against a dark page and pure white glares; the mid-grey keeps the
   offset-block structure legible without shouting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:           #14120d;
    --surface:      #1f1c16;
    --surface-soft: #2a2620;
    --surface-mute: #191710;

    --ink:        #f5f1e6;
    --ink-soft:   #ded9cc;
    --ink-muted:  #b3ada0;
    --ink-faint:  #9c9689;

    --accent:      #f4794f;
    --accent-dark: #c9552c;
    --accent-soft: #3d2015;
    --accent-ink:  #14120d;

    --success:    #6fd39b;
    --success-bg: #16281f;
    --warn:       #e8b268;
    --warn-bg:    #2e2314;
    --danger:     #ff9084;
    --danger-bg:  #331916;
    --done-bg:    #16281f;

    --today-bg:       #2e1d12;
    --input-focus-bg: #26221a;
    --stripe:         rgba(245, 241, 230, 0.035);
    --backdrop:       rgba(0, 0, 0, 0.78);
    --shadow-color:   #6b6455;
    --today-ring:     #f4794f;
    --on-ink:         #14120d;

    --hairline: 2px solid #322d25;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:           #14120d;
  --surface:      #1f1c16;
  --surface-soft: #2a2620;
  --surface-mute: #191710;

  --ink:        #f5f1e6;
  --ink-soft:   #ded9cc;
  --ink-muted:  #b3ada0;
  --ink-faint:  #9c9689;

  --accent:      #f4794f;
  --accent-dark: #c9552c;
  --accent-soft: #3d2015;
  --accent-ink:  #14120d;

  --success:    #6fd39b;
  --success-bg: #16281f;
  --warn:       #e8b268;
  --warn-bg:    #2e2314;
  --danger:     #ff9084;
  --danger-bg:  #331916;
  --done-bg:    #16281f;

  --today-bg:       #2e1d12;
  --input-focus-bg: #26221a;
  --stripe:         rgba(245, 241, 230, 0.035);
  --backdrop:       rgba(0, 0, 0, 0.78);
  --shadow-color:   #6b6455;
  --today-ring:     #f4794f;
  --on-ink:         #14120d;

  --hairline: 2px solid #322d25;
}

/* Cross-document view transitions. Every action here is a form POST + redirect
   or a plain link, so without this each Done / Skip / month change is a white
   flash. Three lines turn all of them into a crossfade, which is exactly the
   "motion conveys a transition between views" case — no JS, no router.
   Nested in no-preference so reduced-motion users get no transition at all. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  /* Structural guard against sideways over-scroll. `clip`, not `hidden`: hidden
     would make <html> a scroll container and break the sticky header. Every
     press in this design shifts a button 4px right, so a full-width button can
     add 4px of scrollable width with nothing actually overflowing. */
  overflow-x: clip;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  font-kerning: normal;
  /* faint diagonal-stripe pattern for that paper feel */
  background-image:
    repeating-linear-gradient(
      135deg,
      transparent 0,
      transparent 24px,
      var(--stripe) 24px,
      var(--stripe) 25px
    );
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-xs);
  top: var(--space-xs);
  z-index: var(--z-toast);
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-base) var(--ease-out-quart);
}
.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--on-ink);
}

/* !important because this is a utility that must beat any component rule it
   lands inside. Without it a more specific selector can restore the element's
   size while leaving it absolutely positioned, which silently widens the page. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  float: none !important;
  overflow: hidden !important;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- typography ---------- */
/* Fixed rem ramp, not clamp(): product UI wants spatial predictability. */
h1, h2, h3 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: 2rem; text-transform: uppercase; }
h2 { font-size: 1.125rem; text-transform: uppercase; letter-spacing: 0.02em; }
h3 { font-size: 1rem; }
p  { margin: 0 0 var(--space-sm); color: var(--ink-soft); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
.subtle { color: var(--ink-muted); font-size: 0.88rem; }
.mono   { font-family: var(--font-mono); }
.prose  { max-width: 68ch; }
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-dark); }

/* ---------- layout shell ---------- */
.frame {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--surface);
  border-bottom: var(--border-thick);
}
.frame-inner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: var(--space-sm) 1.25rem;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand::before {
  content: "▌";
  color: var(--accent-dark);
  margin-right: 0.3rem;
}
.brand:hover { color: var(--ink); }
.nav-top-links { display: flex; gap: var(--space-xs); }
.nav-link {
  padding: 0.4rem 0.7rem;
  background: var(--surface);
  border: var(--border);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav-link:hover { background: var(--surface-soft); color: var(--ink); }
/* Matches the mobile tab bar's active state exactly — the same "you are here"
   used to look like two different things depending on viewport. */
.nav-link[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--ink);
}
.nav-spacer { flex: 1; }
.nav-user {
  padding: 0.3rem 0.55rem;
  border: var(--border);
  background: var(--surface-soft);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1240px, 100%);
  margin: 1.25rem auto;
  padding: 0 1.25rem 5rem;
}

/* ---------- flash toast ---------- */
.flash {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  margin: 0 0 1.25rem;
  border: var(--border);
  box-shadow: var(--shadow-hard);
  font-weight: 700;
  background: var(--surface);
  /* Arrives on its own after a page-reloading POST, so it needs to announce
     itself as new rather than look like it was always there. */
  animation: flash-in 220ms var(--ease-out-quart) both;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.flash::before {
  content: "→";
  color: var(--accent-dark);
  font-size: 0.9rem;
}
.flash.success { background: var(--success-bg); }
.flash.success::before { content: "✓"; color: var(--success); }
.flash.error   { background: var(--danger-bg); }
.flash.error::before   { content: "!"; color: var(--danger); }

/* ---------- buttons ---------- */
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: var(--border);
  box-shadow: var(--shadow-hard);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    transform var(--dur-fast) var(--ease-out-quart),
    box-shadow var(--dur-fast) var(--ease-out-quart),
    background var(--dur-base) var(--ease-out-quart);
  cursor: pointer;
  white-space: nowrap;
}
/* Hover-capable pointers only. On touch, :hover sticks after a tap — leaving a
   button shifted 2px with a collapsed shadow until you tap elsewhere. */
@media (hover: hover) {
  .button:hover,
  button:hover {
    transform: translate(2px, 2px);
    box-shadow: var(--shadow-tiny);
    background: var(--accent-dark);
    color: #ffffff;
  }
}
.button:active,
button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.button.secondary,
button.secondary {
  background: var(--surface);
  color: var(--ink);
}
.button.secondary:hover,
button.secondary:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
.button.danger,
button.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: 4px 4px 0 0 var(--danger);
}
.button.danger:hover,
button.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: 2px 2px 0 0 var(--danger);
}
.button.small,
button.small {
  min-height: 36px;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  box-shadow: var(--shadow-tiny);
}
@media (hover: hover) {
  .button.small:hover,
  button.small:hover {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 0 var(--shadow-color);
  }
}
.button.small:active,
button.small:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
/* Touch input needs the full 44px even where the desktop control is compact. */
@media (pointer: coarse) {
  .button.small,
  button.small { min-height: 44px; padding-inline: 0.75rem; }
}
button:disabled,
.button.disabled,
button[aria-disabled="true"] {
  cursor: not-allowed;
  background: var(--surface-mute);
  color: var(--ink-muted);
  border-color: var(--ink-muted);
  box-shadow: none;
  transform: none;
}
button:disabled:hover {
  background: var(--surface-mute);
  color: var(--ink-muted);
  transform: none;
  box-shadow: none;
}

/* ---------- page header / toolbar ---------- */
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.title-stack { display: grid; gap: 0.2rem; }
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 0.2rem;
}
.button-row {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  align-items: center;
}
.toolbar {
  display: flex;
  align-items: end;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

/* ---------- panels ---------- */
.panel {
  background: var(--surface);
  border: var(--border);
  box-shadow: var(--shadow-card);
  padding: 1.1rem;
  margin: 0 0 1.25rem;
}
.panel:last-child { margin-bottom: 0; }
.panel.compact { max-width: 720px; }
.panel.flat { box-shadow: none; }
.panel > h2 { margin-bottom: var(--space-sm); }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}
.panel-head h2 { margin: 0; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.25rem;
  align-items: start;
}
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-content: start; }

/* ---------- forms ---------- */
form { margin: 0; }
/* display:block (not grid) so an inline "— optional" hint stays on the
   label's own line instead of being pushed to its own row. */
label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
}
label > input,
label > select,
label > textarea,
label > .every-row,
label > .swatches,
label > .weekday-pills { margin-top: 0.35rem; }
.field {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
}
.field > .swatches,
.field > .weekday-pills { margin-top: 0.35rem; }
.req { color: var(--danger); margin-left: 0.15rem; }

input[type="email"],
input[type="text"],
input[type="search"],
input[type="date"],
input[type="number"],
input[type="time"],
input[type="tel"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  background: var(--surface);
  color: var(--ink);
  border: var(--border);
  border-radius: 0;
  font: inherit;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--ink);
  outline-offset: 0;
  background: var(--input-focus-bg);
}
input[aria-invalid="true"],
textarea[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-bg); }
.field-error {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--danger);
  font-weight: 700;
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.form-grid.two   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full-span { grid-column: 1 / -1; }
/* A submit button shouldn't stretch to a whole form column. */
.form-grid > button,
.form-grid > .button { justify-self: start; }

/* checkbox row — one checkbox vocabulary for the whole app */
.checkbox-row,
.checkbox-grid {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.checkbox-grid { align-items: stretch; }
.checkbox-row label,
.checkbox-grid label,
.assignee-grid label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: var(--border);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  user-select: none;
}
.checkbox-row label:has(input:checked),
.checkbox-grid label:has(input:checked),
.assignee-grid label:has(input:checked) {
  background: var(--accent-soft);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: var(--shadow-tiny);
}
.checkbox-row input[type="checkbox"],
.checkbox-grid input[type="checkbox"],
.assignee-grid input[type="checkbox"] {
  appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 2px solid var(--ink);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  transition: background var(--dur-fast) var(--ease-out-quart);
}
.checkbox-row input[type="checkbox"]:checked,
.checkbox-grid input[type="checkbox"]:checked,
.assignee-grid input[type="checkbox"]:checked {
  background: var(--ink);
}
.checkbox-row input[type="checkbox"]:checked::after,
.checkbox-grid input[type="checkbox"]:checked::after,
.assignee-grid input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--on-ink);
  /* Confirms the tap landed — the toggle is the whole interaction here. */
  animation: check-pop 140ms var(--ease-out-quart);
}
@keyframes check-pop {
  from { transform: scale(0.2); }
  to   { transform: scale(1); }
}

/* assignee toggles */
.assignee-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.assignee-grid label { min-height: 48px; }

/* color swatches */
.swatches {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-height: 44px;
  align-items: center;
}
.swatch {
  position: relative;
  width: 38px;
  height: 38px;
  border: var(--border);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.swatch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.swatch:has(input:checked) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: var(--shadow-tiny);
}
.swatch:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.8rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: var(--border);
}
th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--surface-soft);
}
.nowrap { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
@media (hover: hover) {
  tbody tr:hover td { background: var(--accent-soft); }
}

/* ---------- badges/chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  white-space: nowrap;
}
.badge.muted { background: var(--surface-soft); color: var(--ink-muted); border-color: var(--ink-muted); }
.badge.warn  { background: var(--warn-bg);  color: var(--warn);  border-color: var(--warn); }
.badge.danger{ background: var(--danger-bg);color: var(--danger);border-color: var(--danger); }
.badge.accent{ background: var(--accent);   color: var(--accent-ink); border-color: var(--ink); }
.badge.success{ background: var(--success-bg); color: var(--success); border-color: var(--success); }

/* Task colour marker. Replaces the old side-stripe: a stripe down the edge of
   a card is never intentional, a keyed swatch next to the title is. */
.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--ink);
  background: var(--event-color, var(--accent));
}

/* ---------- calendar ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: var(--border);
  background: var(--ink);
  gap: 2px;
  box-shadow: var(--shadow-card);
}
.weekday,
.day {
  background: var(--surface);
}
.weekday {
  padding: 0.55rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface-soft);
  text-align: left;
}
.day {
  min-height: 124px;
  padding: 0.45rem 0.35rem;
  display: grid;
  /* Explicit shrinkable column. An implicit `auto` track sizes to the longest
     task title, so the cell's contents overflow — and an overflowing grid item
     centres, which pushed day numbers outside the calendar entirely. */
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 0.3rem;
  position: relative;
  /* Explicit: .day is a <button>, and the global button rule sets
     color:var(--accent-ink). Without this reset every day number and event
     title inherits it and renders invisible against --surface. */
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  transition: background var(--dur-base) var(--ease-out-quart);
}
.day.outside { background: var(--surface-mute); color: var(--ink-muted); }
.day.outside .day-number { opacity: 0.75; }
.day.today { background: var(--today-bg); }
.day.today::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid var(--today-ring);
  pointer-events: none;
}
button.day { cursor: pointer; }
@media (hover: hover) {
  button.day:hover { background: var(--accent-soft); transform: none; box-shadow: none; color: var(--ink); }
}
button.day:active { transform: none; box-shadow: none; }
button.day:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}
.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: inherit;
}
.day-number .num {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.day-number .badge {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
}

/* Street cleaning suspension. A top bar rather than a background, because .day's
   background is already spoken for by .outside and .today — and ::after is free
   (.today uses ::before for its ring, so the two can coexist on one cell). Uses
   the existing --warn tokens, which are defined in both dark blocks already. */
.day.asp-suspended::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--warn);
  pointer-events: none;
}
.asp-flag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.3rem;
  color: var(--warn);
  background: var(--warn-bg);
  border: 2px solid var(--warn);
  white-space: nowrap;
}
.calendar-note { margin-top: var(--space-xs); }
.asp-note {
  margin: 0 0 var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  color: var(--warn);
  background: var(--warn-bg);
  border-left: 5px solid var(--warn);
}
.asp-note strong { color: inherit; }

/* Base = the desktop-detail view. Declared BEFORE the mobile media query so
   the compact mobile view can actually win the cascade. */
.day-events { display: contents; }
.day-dots   { display: none; }

/* The task colour is the event's whole border, not a stripe down one edge, and
   not an inline swatch — in a 115px month cell every pixel spent on decoration
   is a character taken off the title. */
.event {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  min-height: 28px;
  padding: 0.25rem 0.3rem;
  background: var(--surface);
  border: 2px solid var(--event-color, var(--ink));
  font-size: 0.76rem;
  color: var(--ink);
  text-align: left;
}
.event > .dot { display: none; }
.event > .event-text { min-width: 0; overflow: hidden; }
.event.done {
  background: var(--done-bg);
}
.event-title,
.event-person {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-title { font-weight: 700; color: var(--ink); }
.event.done .event-title { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.event-person {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.more-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- agenda rows ----------
   Rows separated by hairlines, not cards. These live inside a .panel or a
   <dialog>, and a card inside a card is always wrong. */
/* align-content:start on both, and it is load-bearing. `normal` computes to
   `stretch` for a grid, and stretch hands leftover height to auto-sized rows —
   so the moment anything upstream gives one of these a definite height, the
   spare space gets divided between the rows instead of sitting at the bottom.
   On an iPhone that turned one chore's day sheet into a full screen with the
   title at the top, the assignee floating in the middle and Done/Skip stranded
   at the very bottom. Keep these even though the parent also sets it: they make
   each level independently immune rather than trusting the one above. */
.agenda {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
.agenda-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
  gap: 0.35rem;
  padding: var(--space-sm) 0;
  border-top: var(--hairline);
}
.agenda-item > * { min-width: 0; }
.task-title-line h3 { min-width: 0; overflow-wrap: break-word; }
.agenda-item:first-child { border-top: 0; padding-top: 0; }
.agenda-item:last-child { padding-bottom: 0; }
.agenda-item.done .task-title-line h3 {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--ink-muted);
}
.agenda-meta {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.agenda-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  max-width: 60ch;
}
.task-title-line {
  display: flex;
  gap: var(--space-xs);
  align-items: baseline;
  flex-wrap: wrap;
}
/* flex-basis 0, not auto: with an auto basis the h3's max-content hypothetical
   size doesn't fit the line, so the colour marker gets pushed onto a line of
   its own. Basis 0 keeps them together and lets the title wrap inside itself. */
.task-title-line h3,
.task-title-line > strong { flex: 1 1 0; min-width: 0; margin: 0; font-size: 1rem; }
.task-title-line .dot { position: relative; top: -0.1em; }
.actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.empty {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: 46ch;
}
.empty strong { display: block; color: var(--ink); margin-bottom: 0.2rem; }
.empty .actions { margin-top: var(--space-sm); }
.status-line {
  min-height: 22px;
  margin: var(--space-sm) 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

/* ---------- task form ---------- */
.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
}
/* Flattened: a legend, a rule, and space. No boxes inside the panel box. */
.field-group {
  display: grid;
  gap: 0.85rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-top: var(--border);
  padding-top: var(--space-md);
}
.task-form > .field-group:first-of-type { border-top: 0; padding-top: 0; }
.field-group legend {
  display: block;
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.field-group legend .step {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 0.45rem;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.7rem;
  vertical-align: -0.2em;
}
.hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--ink-faint);
}
p.hint {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
  max-width: 62ch;
}
p.hint:last-child { margin-bottom: 0; }
/* A hint that follows a control needs air, and more than the gap suggests: the
   button above it casts a 4px hard shadow outside its own box, so 0.75rem of
   margin reads as ~8px. Hints that lead into a control keep their tight gap. */
form + p.hint,
.theme-choice + p.hint,
.checkbox-row + p.hint,
.assignee-grid + p.hint,
p.hint + p.hint,
.form-row + p.hint { margin-top: var(--space-sm); }
h2 + p.hint { margin-top: calc(var(--space-xs) * -1); }
.form-grid p.hint { margin-top: -0.35rem; }
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.form-row .grow { min-width: 0; }
.every-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: var(--border);
  background: var(--surface);
}
.every-row input {
  border: 0;
  background: transparent;
  padding-right: 0.5rem;
}
.every-row input:focus {
  outline-offset: -3px;
}
.every-row .unit {
  padding: 0 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--on-ink);
  align-self: stretch;
  display: inline-grid;
  place-items: center;
}
/* The UA's `[hidden] { display: none }` is a bare attribute selector, so any class
   that sets `display` outranks it and the element comes back visible while still
   reading as hidden to assistive tech — which is how `.cadence-only` once ended up
   showing. General rather than patched per component, so the next `hidden` element
   inside a flex or grid container doesn't reintroduce it. */
[hidden] { display: none !important; }

/* ---------- documents ----------
   Same vocabulary as the rest of the system: hard border, offset shadow, mono
   uppercase tags. <details> does the collapsing with no JavaScript, which suits a
   page carrying twenty items with files against only a few of them. */
.doc-group {
  border: var(--border);
  background: var(--surface-soft);
  margin-bottom: var(--space-sm);
}
.doc-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: 0.6rem var(--space-sm);
  cursor: pointer;
  font-family: var(--font-body);
  list-style: none;
}
.doc-group > summary::-webkit-details-marker { display: none; }
/* A rotating caret drawn in CSS, so the disclosure state is visible without an
   icon font or an inline SVG per group. */
.doc-group > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0; height: 0;
  border-left: 7px solid var(--ink);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out-quart);
}
.doc-group[open] > summary::before { transform: rotate(90deg); }
.doc-group > summary:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
@media (hover: hover) {
  .doc-group > summary:hover { background: var(--accent-soft); }
}
.doc-group-title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-top: var(--border);
  background: var(--surface);
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: var(--space-sm);
  background: var(--surface);
  border: var(--border);
  box-shadow: var(--shadow-tiny);
  min-width: 0;
}
.doc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xs);
}
.doc-kind {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.4rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 2px solid var(--ink);
}
.doc-kind.add { background: var(--surface-mute); }
.doc-size {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
}
.doc-name {
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  /* The whole name is the target; it is the only reason the card exists. */
  flex: 1 1 auto;
}
.doc-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
.doc-meta .badge { font-size: 0.6rem; }

/* The add slot reads as an empty frame waiting to be filled. */
.doc-card-add {
  border-style: dashed;
  box-shadow: none;
  background: var(--surface-soft);
}
.doc-card-add .doc-date { font-size: 0.72rem; }
input[type="file"] {
  padding: 0.45rem 0.5rem;
  line-height: 1.4;
  font-size: 0.78rem;
}

/* A chore's name is content, not a field label, but it lives inside a <label> so
   it inherits this design's mono/uppercase label treatment. Put it back to body
   type — "TAKE TRASH TO CURB" in mono reads as a form field, not a chore. */
.lead-row .task-title-line strong {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.lead-row > .hint { text-transform: none; letter-spacing: 0; }

/* weekday toggle pills */
.weekday-pills {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}
.weekday-pills .pill {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0;
  background: var(--surface);
  border: var(--border);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}
.weekday-pills .pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.weekday-pills .pill:has(input:checked) {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-tiny);
}
.weekday-pills .pill:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- day modal dialog ---------- */
.day-modal {
  width: min(560px, calc(100% - 2rem));
  /* dvh, not vh: on iOS `vh` is the *large* viewport and ignores Safari's own
     chrome, so 80vh can be taller than what you can actually see. */
  max-height: min(80dvh, 720px);
  padding: 0;
  margin: auto;
  border: var(--border-thick);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  font-family: var(--font-body);
  border-radius: 0;
  overflow: auto;
}
.day-modal::backdrop {
  background: var(--backdrop);
}
.day-modal[open] {
  display: grid;
  /* Every row hugs its content, and leftover height is NOT handed out.
     This was `grid-template-rows: auto 1fr`, which baked in two assumptions
     that both broke on a real iPhone:
       1. Exactly two children. The street-cleaning note is a third, so it took
          the 1fr row and filled the screen with a block of cream.
       2. That `1fr` shrink-wraps when the height is indefinite. Chrome does;
          iOS Safari stretches it, so a one-task sheet grew to 80vh with the
          Done/Skip buttons stranded at the bottom of the screen.
     align-content:start makes the layout correct whichever way an engine
     resolves the height, and survives adding a fourth child later. */
  grid-template-rows: none;
  align-content: start;
}

/* Sheet entrance. allow-discrete lets `display` and `overlay` animate, so a
   native <dialog> can transition in and out with no JS at all; @starting-style
   supplies the "before open" values. Exit runs at ~70% of the entrance. */
.day-modal {
  opacity: 0;
  translate: 0 8px;
  scale: 0.98;
  transition:
    opacity 130ms var(--ease-out-quart),
    translate 130ms var(--ease-out-quart),
    scale 130ms var(--ease-out-quart),
    display 130ms allow-discrete,
    overlay 130ms allow-discrete;
}
.day-modal[open] {
  opacity: 1;
  translate: 0 0;
  scale: 1;
  transition-duration: 190ms;
}
@starting-style {
  .day-modal[open] { opacity: 0; translate: 0 8px; scale: 0.98; }
}
.day-modal::backdrop {
  opacity: 0;
  transition:
    opacity 190ms var(--ease-out-quart),
    display 190ms allow-discrete,
    overlay 190ms allow-discrete;
}
.day-modal[open]::backdrop { opacity: 1; }
@starting-style {
  .day-modal[open]::backdrop { opacity: 0; }
}
.day-modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0.9rem var(--space-md);
  background: var(--surface);
  border-bottom: var(--border);
}
.day-modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
  text-transform: none;
  letter-spacing: -0.01em;
}
.day-modal .agenda,
.day-modal .empty {
  padding: 0.85rem var(--space-md) 1.25rem;
}

/* ---------- theme picker (Settings) ---------- */
.theme-choice {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.theme-choice label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 48px;
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: var(--border);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  user-select: none;
  transition:
    background var(--dur-base) var(--ease-out-quart),
    box-shadow var(--dur-fast) var(--ease-out-quart),
    transform var(--dur-fast) var(--ease-out-quart);
}
.theme-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-choice label:has(input:checked) {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-tiny);
}
.theme-choice label:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
/* Miniature of what each option looks like: page, surface, accent. Reads at a
   glance in a way the word "Dark" doesn't when you're already in dark mode. */
.theme-swatch {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 26px;
  height: 20px;
  border: 2px solid currentColor;
  overflow: hidden;
}
.theme-swatch i { display: block; }
.theme-swatch .a { background: #fbf8f1; }
.theme-swatch .b { background: #e8623d; }
.theme-choice .dark .a { background: #14120d; }
.theme-choice .dark .b { background: #f4794f; }
.theme-choice .system { grid-template-columns: 1fr 1fr; }
.theme-choice .system .a { background: linear-gradient(135deg, #fbf8f1 50%, #14120d 50%); }
.theme-choice .system .b { background: linear-gradient(135deg, #e8623d 50%, #f4794f 50%); }

/* ---------- utilities ---------- */
.hero {
  display: grid;
  gap: 0.35rem;
  padding-bottom: var(--space-xs);
  border-bottom: var(--border);
  margin-bottom: 1.1rem;
}
.hero h1 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.hero h1 .sep { color: var(--accent-dark); }
.hero .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.row {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- bottom tab bar (mobile only) ---------- */
.tab-bar { display: none; }

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 1000px) {
  .split { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .form-grid,
  .form-grid.two,
  .form-grid.three { grid-template-columns: 1fr; }
  .assignee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  main { padding-bottom: 6.5rem; margin-top: var(--space-sm); }
  .frame-inner { padding: 0.6rem 0.9rem; gap: var(--space-xs); }
  .nav-top-links { display: none; } /* moved to bottom tab bar */
  .nav-user { display: none; }
  .panel { padding: 0.85rem; box-shadow: var(--shadow-hard); }
  .page-head { gap: 0.6rem; }
  h1 { font-size: 1.75rem; }

  /* tables → labelled stacked rows (the labels come from thead via data-label) */
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr {
    padding: var(--space-sm) 0;
    border-top: var(--hairline);
  }
  tbody tr:first-child { border-top: 0; padding-top: 0; }
  tbody tr:last-child { padding-bottom: 0; }
  td { border-bottom: 0; padding: 0.15rem 0; }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  td.actions-cell { padding-top: var(--space-xs); }
  tr:last-child td { border-bottom: 0; }

  /* Compact calendar: day number + one dot per task. Full titles live in the
     day sheet, which is one tap away. */
  .calendar { box-shadow: var(--shadow-hard); }
  .weekday {
    padding: 0.35rem 0.3rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-align: center;
  }
  .day {
    min-height: 62px;
    padding: 0.3rem 0.25rem;
    gap: 0.2rem;
    text-align: center;
    align-content: start;
  }
  .day-number {
    justify-content: center;
    font-size: 0.78rem;
  }
  .day-number .num { font-size: 0.86rem; }
  .day-number .badge { display: none; } /* the today ring already marks it */
  /* No room for a text pill in a 47px cell — the top bar carries it, and the
     accessible name and day sheet carry the words. */
  .asp-flag { display: none; }
  .day.today::before { border-width: 3px; }
  .day-events { display: none; }
  .day-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    align-content: center;
    padding: 0 2px;
  }
  .day-dots .event-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border: 1px solid var(--ink);
  }
  .day-dots .event-dot.done { border-style: dotted; opacity: 0.55; }
  .day-dots .dot-more {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--ink-muted);
    margin-left: 1px;
  }
  .form-row { grid-template-columns: 1fr; }

  .button-row { gap: 0.4rem; }
  .button, button { font-size: 0.84rem; }

  .assignee-grid { grid-template-columns: 1fr; }
  .swatch { width: 44px; height: 44px; }

  /* Bottom sheet on phones — so it rises from the edge it's anchored to
     instead of scaling from the middle of the screen. */
  .day-modal {
    width: 100%;
    max-width: none;
    max-height: 88vh;
    margin: auto 0 0;
    border-width: 3px 0 0;
    scale: 1;
    translate: 0 16px;
  }
  @starting-style {
    .day-modal[open] { scale: 1; translate: 0 16px; }
  }

  /* bottom tab bar */
  .tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-tabbar);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: var(--surface);
    border-top: var(--border-thick);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    display: grid;
    place-items: center;
    gap: 0.15rem;
    min-height: 58px;
    padding: 0.45rem 0.25rem;
    background: var(--surface);
    color: var(--ink);
    border-left: var(--border);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .tab:first-child { border-left: 0; }
  .tab .glyph { font-size: 1.2rem; line-height: 1; }
  .tab[aria-current="page"] {
    background: var(--accent);
    color: var(--accent-ink);
  }
}

/* Motion here is feedback, never decoration — so "off" is an instant state
   change, not a broken interface. Every animated thing above still reaches its
   end state; it just gets there immediately. The dialog needs its opacity and
   transform neutralised explicitly, because a 0.01ms transition on `display`
   would otherwise still open it from the hidden values. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .button:hover, button:hover,
  .button:active, button:active { transform: none; }
  .day-modal, .day-modal[open] { opacity: 1; translate: none; scale: 1; }
  .day-modal[open]::backdrop { opacity: 1; }
}

@media print {
  .frame, .tab-bar, .actions, .page-head, .skip-link { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; break-inside: avoid; }
}
