/* ---- Design tokens -------------------------------------------------------- */
:root {
  /* violet-biased neutrals */
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #efeaf7;
  --fg: #1b1626;
  --muted: #6c6480;
  --border: #ddd5ec;
  /* violet primary + amber complement */
  --accent: #7c3aed;
  --accent-2: #b45309;
  --accent-fg: #ffffff;
  --danger: #c0322b;
  --ok: #1a7f37;
  /* sharp radius scale */
  --r-card: 2px;
  --r-ctrl: 1px;
  --r-badge: 0px;
  --radius: var(--r-card);
  --gap: 1rem;
  --maxw: 62rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  /* time-management: priority = urgency colour (ports corlib priority_color) */
  --prio-mandatory: #d1394a;
  --prio-important: #c9761d;
  --prio-beneficial: #2f9e57;
  --prio-optional: #8b8397;
  --sleep: #5a7fb4;
  /* certainty ramp — alpha applied over a block's base colour: solid certain
     core, translucent stretch (window slack), faint transition lead/trail */
  --cert-certain: 0.92;
  --cert-stretch: 0.42;
  --cert-transition: 0.18;
  /* calendar-morph: per-block base colour = oklch(--cal-l --cal-c <hashed-hue>);
     --cert-band is the alpha of the connective band behind a morph run */
  --cal-l: 0.7;
  --cal-c: 0.125;
  --cert-band: 0.12;
  /* Colour-morph band alpha == the certain-core alpha, so a block's solid fill and the band it
     hands off to meet with no brightness step (a seamless colour-to-colour transition). */
  --cal-blend: var(--cert-certain);
}

:root[data-theme="dark"] {
  --bg: #0f0d15;
  --surface: #17141f;
  --surface-2: #201b2b;
  --fg: #e9e5f2;
  --muted: #a29bb6;
  --border: #322a42;
  --accent: #a78bfa;
  --accent-2: #fbbf24;
  --accent-fg: #120f1a;
  --danger: #ff6b61;
  --ok: #57c884;
  --prio-mandatory: #ff6b7a;
  --prio-important: #f0b357;
  --prio-beneficial: #5fca86;
  --prio-optional: #9a92ad;
  --sleep: #6f8fc4;
  /* 0.47 keeps the block-label (var(--fg) #e9e5f2) at >=4.5:1 WCAG contrast over the fill
     (worst hue ~190deg: 5.26:1 at rest, 4.83:1 under the hover brightness(1.06)). */
  --cal-l: 0.47;
  --cal-c: 0.14;
  --cert-band: 0.16;
}

/* ---- Base ----------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: var(--mono); letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.25rem; }
p { margin: 0.25rem 0; }
.muted { color: var(--muted); }

img { max-width: 100%; }

/* Keyboard-first: always show a clear focus ring (foundation for Slice 2). */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Buttons & inputs ----------------------------------------------------- */
button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--r-ctrl);
  border: 1px solid transparent;
  padding: 0.5rem 0.85rem;
  background: var(--surface-2);
  color: var(--fg);
  transition: background 0.12s ease, border-color 0.12s ease;
}
button:hover { border-color: var(--border); }
button:disabled { opacity: 0.6; cursor: default; }

button.primary {
  background: var(--accent);
  color: var(--accent-fg);
  width: 100%;
  padding: 0.6rem;
  font-weight: 600;
}
button.ghost { background: transparent; border-color: var(--border); }
button.secondary {
  background: transparent;
  color: var(--accent-2);
  border-color: var(--accent-2);
  font-weight: 600;
}
button.secondary:hover { border-color: var(--accent-2); }
button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0.25rem;
  text-decoration: underline;
}
button.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field span { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
input {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}
input:focus-visible { outline-offset: 0; border-color: var(--accent); }

.error { color: var(--danger); font-size: 0.9rem; }

/* ---- Cards ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.brand { font-family: var(--mono); font-weight: 700; letter-spacing: -0.01em; }

/* ---- Auth screen ---------------------------------------------------------- */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.auth-topbar {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
}
.auth-card {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* ---- App shell ------------------------------------------------------------ */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar .spacer { flex: 1; }
.topbar .user { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.45rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.05rem 0.45rem;
  border-radius: var(--r-badge);
  background: var(--accent);
  color: var(--accent-fg);
}
.badge.amber { background: var(--accent-2); color: var(--accent-fg); }
/* Report triage priority accents, low → critical. */
.badge.priority-low { background: var(--ok); color: var(--accent-fg); }
.badge.priority-medium { background: var(--accent-2); color: var(--accent-fg); }
.badge.priority-high { background: color-mix(in oklab, var(--danger) 65%, var(--accent-2)); color: var(--accent-fg); }
.badge.priority-critical { background: var(--danger); color: var(--accent-fg); }

.content {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.systems {
  margin-top: 1.25rem;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.system-card { position: relative; }
.system-card .soon {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-badge);
  padding: 0.05rem 0.45rem;
}

.splash {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 2rem;
}

/* ---- Authenticated shell + sidebar ---------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.9rem 0.75rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar-brand { font-family: var(--mono); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.04em; padding: 0.25rem 0.5rem; }
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-links a {
  display: block;
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--r-ctrl);
  border-left: 3px solid transparent;
  color: var(--fg);
  text-decoration: none;
}
.nav-links a:hover { background: var(--surface-2); }
.nav-links a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--fg);
  text-decoration: none;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius);
}
.account-link:hover { background: var(--surface-2); }
.account-link[aria-current="page"] { background: var(--accent); color: var(--accent-fg); }
.shell-main { min-width: 0; }
.page { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem; }
.settings-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .nav-links { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
}

/* ---- Tables & forms ------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }

/* Keybindings page: the global-commands table and each per-view table are separate
   <table> elements, so table-layout: auto would size their columns independently and
   the Keys/Rebind cells would never line up across sections. Pin shared widths instead. */
.kb-table { table-layout: fixed; }
.kb-table .kb-col-keys { width: 13rem; }
.kb-table .kb-col-rebind { width: 6rem; }

.session-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* Delete confirm: stack both states in one grid cell so the row reserves the
   wider (confirm) footprint and does not reflow when confirmation appears. */
.delete-control { display: inline-grid; align-items: center; }
.delete-control > .dc-slot { grid-area: 1 / 1; display: inline-flex; gap: 0.35rem; align-items: center; }
.delete-control .hidden { visibility: hidden; }

.form { display: flex; flex-direction: column; gap: 0.7rem; max-width: 26rem; margin-top: 1rem; }
.preset-picker { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; max-width: 44rem; }
.task-form { max-width: 44rem; }
.task-form fieldset.field { border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 0.5rem 0.75rem; }
.task-form textarea { min-height: 4rem; resize: vertical; }
.form h2 { margin-bottom: 0.25rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; }
.ok { color: var(--ok); font-size: 0.9rem; }
.small { padding: 0.25rem 0.55rem; font-size: 0.85rem; }
.inline-reset { display: inline-flex; gap: 0.35rem; align-items: center; }
.inline-reset input { padding: 0.3rem 0.45rem; }
.inline-actions { display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.danger:hover { border-color: var(--danger); }

.toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.field.inline { flex-direction: row; align-items: center; gap: 0.4rem; }
select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}

kbd {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-badge);
  padding: 0.05rem 0.4rem;
}
input.capture { border-color: var(--accent); font-family: var(--mono); }
/* In the keybindings tables the capture input sits in a fixed-width Keys column
   (see .kb-table); without a matching width it overflows into the Rebind column. */
.kb-table input.capture { width: 100%; box-sizing: border-box; }

/* ---- Command palette + which-key overlays --------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
}
.palette {
  width: min(92vw, 34rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.palette-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  background: var(--surface);
  color: var(--fg);
}
.palette-input:focus-visible { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 0.35rem; max-height: 50vh; overflow-y: auto; }
.palette-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-ctrl);
  cursor: pointer;
}
.palette-list li.active { background: var(--accent); color: var(--accent-fg); }
.palette-key {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.35rem;
  white-space: nowrap;
}
.palette-list li.active .palette-key {
  color: var(--accent-fg);
  border-color: currentColor;
  background: transparent;
}
.picker-slot { font-size: 0.85em; white-space: nowrap; }

.whichkey {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  max-width: 16rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.whichkey-buffer {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}
.whichkey ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.whichkey li { display: flex; gap: 0.5rem; align-items: center; font-size: 0.9rem; }

/* ---- Label-jump (easymotion) overlay -------------------------------------- */
.jump-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
.jump-label {
  position: fixed;
  transform: translate(-2px, -2px);
  padding: 0.05rem 0.3rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.3;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-fg);
  background: var(--accent);
  border-radius: var(--r-badge);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.jump-label b { opacity: 0.55; }

/* ---- Time management ------------------------------------------------------ */
.tm-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
.tm-current > :first-child { min-width: 0; overflow-wrap: anywhere; }
.tm-current.doing { border-left-color: var(--accent); }
.tm-current.doing.over { border-left-color: var(--prio-mandatory); }
.tm-current.next { border-left-color: var(--prio-beneficial); }
.tm-current.next.due { border-left-color: var(--accent-2); }
.tm-over { color: var(--prio-mandatory); font-weight: 600; }
.tz-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.75rem 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--r-card);
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
}
.tz-hint .inline-actions { display: flex; gap: 0.4rem; }
.tz-hint .inline-actions button { flex: 1 1 0; }
.form-note { margin: 0.75rem 0 0.25rem; font-size: 0.85rem; }
.tm-add {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
/* Direct child only: the bar's own input.field. A bare descendant selector leaked into the
   nested new-from-preset popup, stretching its column rows to a 14rem flex-basis. */
.tm-add > .field { flex: 1; }
.agenda-scroll {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
.agenda-item {
  display: grid;
  /* minmax(0, …): let long names wrap instead of blowing out the column. */
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.agenda-item:last-child { border-bottom: none; }
/* On phones the fixed 7rem date column starves the name (~111px at 390px), splitting words
   mid-syllable. Stack the date on its own full-width row above the name instead. */
@media (max-width: 30rem) {
  .agenda-item { grid-template-columns: minmax(0, 1fr) auto; }
  .agenda-when { grid-column: 1 / -1; }
}
a.agenda-item { color: inherit; text-decoration: none; }
a.agenda-item:hover { background: var(--surface-2); }
.agenda-when {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.9rem;
}
.agenda-frag { font-size: 0.85em; }
.pinned-badge {
  font-size: 0.75em;
  margin-left: 0.3rem;
  vertical-align: 1px;
  cursor: help;
}
/* An event row plus its trailing Skip/Attend control. */
.agenda-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.agenda-row:last-child { border-bottom: none; }
.agenda-row > .agenda-item { flex: 1; min-width: 0; border-bottom: none; }
.agenda-name { overflow-wrap: anywhere; }
.agenda-declined { opacity: 0.7; }

/* ---- Time views: sub-nav + banner ----------------------------------------- */
.tm-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.tm-nav-link {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  color: var(--fg);
  text-decoration: none;
}
.tm-nav-link:hover { background: var(--surface-2); }
.tm-nav-link[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.tm-banner {
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--r-card);
  background: var(--surface);
}
.tm-banner-line { font-size: 0.85rem; }
.tm-banner-line.danger { color: var(--danger); }
/* Overflow rows past the visible cap, revealed by the "Show N more" toggle. */
.tm-banner-rest { display: none; }
.tm-banner-rest.open { display: block; }
.tm-banner-more { margin-top: 0.35rem; }

/* ---- Agenda week view ----------------------------------------------------- */
.agenda-day {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.agenda-day-name { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; }
.agenda-day-free { font-size: 0.8rem; }
.agenda-empty { padding: 0.5rem 0.75rem; margin: 0; }
.agenda-item.edge {
  border-left: 3px solid var(--bar, transparent);
  padding-left: calc(0.75rem - 3px);
}
/* Small priority dot beside a task name: the base colour now encodes group/type, so urgency
   rides along as this dot in its priority tone. */
.prio-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: baseline;
  background: var(--prio, var(--muted));
  flex: none;
}

/* ---- Review: day-by-day tracked actuals ----------------------------------- */
/* A muted outcome tag (completed / partial / on hold) after a session's task name. */
.review-outcome { font-size: 0.85em; margin-left: 0.35rem; }

/* ---- Weeks browser + upcoming events -------------------------------------- */
.tm-weeklabel { font-family: var(--mono); font-size: 0.85rem; margin-left: auto; }
.tm-preview-note { font-size: 0.8rem; margin: 0 0 0.5rem; }
.tm-listing {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
.tm-listing-head { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; }
.tm-listing-items {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.tm-listing-items li { font-size: 0.9rem; }

/* ---- Gantt ---------------------------------------------------------------- */
.gantt-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
.gantt-scroll:focus-visible { outline-offset: -2px; }
/* The 9rem day-label column is fixed; the track column is `1fr` (see .gantt-day-row below) so
   it fills whatever width the card has — no min-width, so no nested scrollbar on ordinary
   desktop/tablet widths. Below ~26rem (small phones) the track gets too thin to read a bar in,
   so we fall back to a fixed min-width and let .gantt-scroll's overflow-x produce a scrollbar. */
.gantt { padding: 0.5rem 0.75rem; }
@media (max-width: 26rem) {
  .gantt { min-width: 30rem; }
}
.gantt-ruler-row,
.gantt-day-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: center;
  gap: 0.5rem;
}
.gantt-ruler-row { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.gantt-ruler {
  position: relative;
  height: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.gantt-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}
.gantt-tick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 1rem;
  height: 0.25rem;
  border-left: 1px solid var(--border);
}
.gantt-day-row { margin-top: 0.3rem; }
.gantt-day-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.gantt-day-label.link { text-decoration: none; }
a.gantt-day-label.link:hover { color: var(--accent); text-decoration: underline; }
.gantt-track {
  position: relative;
  height: 1.5rem;
  background: var(--surface-2);
  border-radius: var(--r-ctrl);
  overflow: hidden;
}
.gantt-block { position: absolute; inset: 0; }
.gantt-seg {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 2px;
}
.gantt-seg.transition {
  background: color-mix(in srgb, var(--bar) calc(var(--cert-transition) * 100%), transparent);
}
.gantt-seg.stretch {
  background: color-mix(in srgb, var(--bar) calc(var(--cert-stretch) * 100%), transparent);
}
.gantt-seg.certain {
  background: color-mix(in srgb, var(--bar) calc(var(--cert-certain) * 100%), transparent);
}
.gantt-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding-left: 0.3rem;
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  color: var(--fg);
  max-width: 100%;
}
.gantt-now {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--accent-2);
  z-index: 2;
}

/* ---- Calendar-morph view -------------------------------------------------- */
/* No inner vertical scroll: the column grows and the page scrolls. Beware: overflow-x
   below makes overflow-y COMPUTE to auto, so any descendant hanging past the grid bottom
   grows a nested vertical scrollbar (e2e: flows/test_calendar_scroll.py). Day columns are
   `minmax(0, 1fr)` (grid_style in calendar.rs) with no min-width on the grid itself, so they
   flex down to fill the card's actual width instead of forcing a horizontal scrollbar on
   ordinary desktop/tablet viewports. Below ~26rem (small phones) seven flexed columns are no
   longer legible at any width, so we fall back to a fixed min-width there and let
   .cal-scroll's overflow-x produce a scrollbar — a deliberate last resort, not the default. */
.cal-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
/* Row 1: corner + day headers (auto height). Row 2: ruler + tracks (--cal-col-h). */
.cal-grid {
  display: grid;
  grid-auto-rows: auto var(--cal-col-h, 44rem);
  column-gap: 0;
}
@media (max-width: 26rem) {
  .cal-grid { min-width: 30rem; }
}
/* Tighten head chrome a touch once columns get narrow enough (tablets, tucked sidebars) that
   full padding starts crowding the day/date labels, well before the phone scroll fallback. */
@media (max-width: 40rem) {
  .cal-head { padding: 0.2rem 0.15rem; }
  .cal-head-day { font-size: 0.72rem; }
  .cal-head-date { font-size: 0.64rem; }
}
.cal-corner { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.cal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  padding: 0.3rem 0.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.cal-head-day { font-family: var(--mono); font-size: 0.78rem; font-weight: 600; }
.cal-head-date { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.cal-head.today { color: var(--accent); }
.cal-head.focus { box-shadow: inset 0 -2px 0 var(--accent); }

.cal-ruler {
  position: relative;
  height: var(--cal-col-h, 44rem);
}
.cal-tick {
  position: absolute;
  right: 0.35rem;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}
/* The top tick sits at y=0; translateY(-50%) would push its upper half under the sticky
   header. Anchor it below the line instead so it reads in full. */
.cal-tick:first-child { transform: translateY(0); }
/* Symmetric guard for a tick on the bottom edge: its lower half would hang below the
   ruler and (overflow-y computing to auto on .cal-scroll) grow a nested scrollbar. */
.cal-tick-end { transform: translateY(-100%); }
.cal-tick::after {
  content: "";
  position: absolute;
  right: -0.35rem;
  top: 50%;
  width: 0.25rem;
  border-top: 1px solid var(--border);
}

/* Plain track — no hour grid, so the semi-transparent blocks read cleanly (no lines showing
   through). Hours are read off the left ruler. */
.cal-track {
  position: relative;
  height: var(--cal-col-h, 44rem);
  border-left: 1px solid var(--border);
  /* Enforce the .cal-scroll no-inner-scroll contract: any descendant spilling past the
     track bottom would grow a nested scrollbar. clip (unlike hidden) adds no scroll box. */
  overflow: clip;
}
.cal-track.focus { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }

/* Connective band behind a run of related blocks: makes them read as one morphing band. */
.cal-band {
  position: absolute;
  border-radius: var(--r-ctrl);
  z-index: 0;
  pointer-events: none;
}
/* One block = one gradient (the certainty fade lives in its `background`, set inline). Hard
   borders on known start/end edges are also set inline; vague edges have none. */
.cal-block {
  position: absolute;
  z-index: 1;
  border-radius: var(--r-ctrl);
  overflow: hidden;
  min-height: 2px;
  display: block;
  color: inherit;
  text-decoration: none;
}
a.cal-block:hover { filter: brightness(1.06); }
a.cal-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 4; }
.cal-block.sleep { --cal-color: var(--sleep); }
.cal-block-label {
  position: absolute;
  top: 1px;
  left: 0.3rem;
  right: 0.2rem;
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  pointer-events: none;
}
.cal-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--accent-2);
  /* Sit fully above the instant: at end of day the 2px would otherwise hang below the
     track and scroll .cal-scroll. Upward overflow at day start is hidden by the header. */
  transform: translateY(-2px);
  z-index: 2;
  pointer-events: none;
}

/* Task rows are now <button>s that open the action menu; reset UA chrome so they read as the
   links/blocks they replaced. */
button.agenda-item,
button.gantt-day-label,
button.cal-block {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  text-align: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
button.agenda-item {
  width: 100%;
  border-bottom: 1px solid var(--border);
}
button.agenda-item:hover { background: var(--surface-2); }
button.agenda-item:focus-visible,
button.gantt-day-label:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
button.gantt-day-label.link:hover { color: var(--accent); text-decoration: underline; }
button.cal-block:hover { filter: brightness(1.06); }
button.cal-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 4; }
/* The label is absolutely positioned, so button padding only inflates the border-box floor —
   a short block at day end would then poke past the track and scroll .cal-scroll. */
button.cal-block { padding: 0; }

/* Ghost preview + hint while a calendar block is being grabbed/dragged. */
.cal-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 5;
  border: 2px dashed var(--accent);
  border-radius: var(--r-ctrl);
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  pointer-events: none;
}

/* New: an empty track invites a press to create an event there; the crosshair cursor only
   shows over the background — buttons (blocks) keep their own pointer cursor. */
.cal-track { cursor: crosshair; }

/* New: the live rectangle while dragging (or the resolved single default slot on release) a
   new event's time range on an empty part of the track (calendar create-on-track flow). */
.cal-select {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 5;
  border: 2px dashed var(--accent-2);
  border-radius: var(--r-ctrl);
  background: color-mix(in oklab, var(--accent-2) 18%, transparent);
  pointer-events: none;
}
.cal-grab-hint { color: var(--accent); font-size: 0.85rem; }

/* Per-task action menu (floating popup) + its span sub-dialog. */
.task-menu-backdrop { position: fixed; inset: 0; z-index: 70; }
.task-menu {
  position: fixed;
  z-index: 71;
  min-width: 12rem;
  max-width: 16rem;
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}
.task-menu:focus-visible { outline: none; }
.task-menu-title {
  padding: 0.35rem 0.6rem 0.5rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--r-ctrl);
  cursor: pointer;
  font-size: 0.9rem;
}
.task-menu-item.active { background: var(--accent); color: var(--accent-fg); }
.task-menu-item.danger { color: var(--danger); }
.task-menu-item.danger.active { background: var(--danger); color: #fff; }
.task-menu-key {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-badge);
  padding: 0 0.3rem;
}
.task-menu-item.active .task-menu-key {
  color: var(--accent-fg);
  border-color: currentColor;
  background: transparent;
}
.task-span { display: flex; flex-direction: column; gap: 0.6rem; padding: 1rem; }
.task-span-title { font-weight: 600; }

/* ---- Bug-report dialog / admin page --------------------------------------- */
.report-form { display: flex; flex-direction: column; gap: 0.6rem; padding: 1rem; }
.hint { margin: 0; font-size: 0.85rem; color: var(--muted); }
.report-preview {
  max-height: 30vh;
  overflow: auto;
  margin: 0;
  padding: 0.5rem;
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.report-row { cursor: pointer; }
/* A long unbreakable title must not blow out the shared Title column and shove the
   triage actions off-screen; break it so the column can stay narrow. */
.report-title { overflow-wrap: anywhere; max-width: 32rem; }
.report-detail td { background: var(--bg); }
.report-body { white-space: pre-wrap; margin: 0.4rem 0; }
.cal-weeklabel { font-family: var(--mono); font-size: 0.85rem; margin-left: auto; }

/* ---- Stats view ----------------------------------------------------------- */
.stats-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.25rem 0 1rem;
}
.stats-summary strong { font-family: var(--mono); font-size: 1.2rem; }
.table-scroll { overflow-x: auto; }
.stats-table td { font-variant-numeric: tabular-nums; }
.stat-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 2.5rem;
  min-width: 5rem;
}
.stat-bar {
  width: 6px;
  min-height: 2px;
  background: var(--bar, var(--accent));
  border-radius: 1px;
}

/* ---- Config editor -------------------------------------------------------- */
.config-group {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.config-group legend {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 0.4rem;
  color: var(--muted);
}

/* ---- Debug clock (feature `debug-time`) ----------------------------------- */
.debug-clock {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 21rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--accent-2);
  border-radius: var(--r-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.debug-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.debug-collapse {
  font: inherit;
  line-height: 1;
  padding: 0 0.4rem;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: inherit;
}
.debug-clock.collapsed { width: auto; }
.debug-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--accent-2);
}
.debug-now { font-family: var(--mono); font-weight: 600; }
.debug-mode { display: flex; gap: 0.25rem; }
.debug-mode button { flex: 1; padding: 0.25rem; }
.debug-mode button.active { background: var(--accent); color: var(--accent-fg); }
.debug-steps { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.debug-step { padding: 0.2rem 0.4rem; font-family: var(--mono); font-size: 0.8rem; }
.debug-jump { display: flex; gap: 0.25rem; }
.debug-jump input { flex: 1; min-width: 0; }
.debug-actions { display: flex; gap: 0.25rem; }
.debug-actions button { flex: 1; }

/* ---- Keybindings page: group headers ------------------------------------- */
.keybind-group-head th {
  padding-top: 1.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

/* ---- Weeks: grouped, expandable "also relevant" listing ------------------ */
.tm-listing-group { margin-top: 0.5rem; }
.tm-listing-group-name {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.tm-listing-detail { border-bottom: 1px solid var(--border); }
.tm-listing-detail:last-child { border-bottom: none; }
.tm-listing-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
  cursor: pointer;
  font-size: 0.9rem;
}
.tm-listing-summary:hover { color: var(--accent); }
.tm-listing-meta { font-family: var(--mono); font-size: 0.8rem; }
.tm-listing-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.1rem 0 0.4rem 0.9rem;
}
.tm-listing-facts { font-size: 0.8rem; }
.tm-listing-desc { margin: 0; font-size: 0.85rem; }

/* ---- Textarea: same tokens as inputs (fixes white bg in dark mode) -------- */
textarea {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}
textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }

/* ---- Native select: custom caret + consistent chrome --------------------- */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 0.95rem center, right 0.65rem center;
  background-size: 0.34rem 0.34rem, 0.34rem 0.34rem;
  background-repeat: no-repeat;
  padding-right: 1.7rem;
}

/* ---- Inline duration/timing rows: narrow numbers so the unit never overlaps ---- */
.field.inline { flex-wrap: wrap; align-items: center; }
.field.inline input[type="number"] { width: 5rem; }

/* ---- Combobox ------------------------------------------------------------ */
.combobox { position: relative; }
.combo-input { width: 100%; }
.combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.2rem;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--fg) 12%, transparent);
}
.combo-opt { padding: 0.35rem 0.5rem; border-radius: var(--r-ctrl); cursor: pointer; font-size: 0.9rem; }
.combo-opt:hover { background: var(--surface-2); }
.combo-opt.active { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* ---- Tag chips ----------------------------------------------------------- */
.tagchips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  background: var(--surface);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.15rem 0.1rem 0.5rem;
  font-size: 0.85rem;
  background: var(--surface-2);
  border-radius: 999px;
}
.chip-x {
  border: none;
  background: transparent;
  padding: 0 0.3rem;
  line-height: 1;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
}
.chip-x:hover { color: var(--danger); }
.chip-input { border: none; background: transparent; padding: 0.2rem; min-width: 6rem; flex: 1; }
.chip-input:focus-visible { outline: none; }
.deferred-chips {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

/* ---- Field help marker + invalid datetime -------------------------------- */
.help {
  display: inline-grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  cursor: help;
}
input.invalid { border-color: var(--danger); }
.combobox::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.combo-input { padding-right: 1.6rem; }

/* ---- Quick bar (persistent add on every /time view) ---------------------- */
.quickbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.quickbar .tm-add { flex: 1 1 20rem; }

/* Anchor styled as a button (e.g. "New task…"). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  cursor: pointer;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  padding: 0.5rem 0.85rem;
  background: var(--surface-2);
  color: var(--fg);
  text-decoration: none;
}
.btn.ghost { background: transparent; }
.btn:hover { border-color: var(--accent); }

/* Add row: input takes the space; the buttons stay content-sized (not huge).
   Wraps on narrow viewports: input + Add first, the ghost buttons below. */
.tm-add { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }
.tm-add > .field { flex: 1 1 14rem; min-width: 0; }
.tm-add .primary { flex: 0 0 auto; width: auto; padding: 0.5rem 1rem; }
.tm-add .btn { flex: 0 0 auto; }

/* Active-task controls: compact, not full-width. */
.tm-current button { width: auto; }

/* ---- Config page: wider, flat sections, two-column grid ------------------- */
.config-form { max-width: 52rem; display: flex; flex-direction: column; gap: 1.5rem; }
.config-group { display: flex; flex-direction: column; gap: 0.6rem; }
.config-group h3 {
  margin: 0;
  padding-bottom: 0.3rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.75rem 1.25rem;
}
/* Toolbar buttons (Apply / Save / Reset) are content-sized, never full width. */
.toolbar .primary { width: auto; }

/* Group-colour picker: a swatch + hue slider + reset per group. The swatch previews the exact
   theme-aware oklch the block/bar will use, so the pick reads true in light and dark. */
.group-color-row {
  display: flex;
  /* ~29rem min-content: on phones the number + reset wrap to a second line instead of
     widening the page (mobile pattern, cf. .tm-add). */
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.group-swatch {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  flex: none;
}
.group-color-name { min-width: 8rem; font-size: 0.9rem; overflow-wrap: anywhere; }
.group-hue-number { width: 4rem; flex: none; }

/* The hue slider's track is painted with the full spectrum (at the theme's calendar-block
   lightness/chroma) so it reads as a colour picker at a glance, not a generic progress bar.
   Needs the vendor-prefixed track/thumb pseudo-elements to override the native flat track. */
.group-hue {
  flex: 1;
  min-width: 8rem;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  /* One gradient definition, reused by both vendor-prefixed track pseudo-elements below. */
  --hue-spectrum: linear-gradient(
    to right,
    oklch(var(--cal-l) var(--cal-c) 0deg),
    oklch(var(--cal-l) var(--cal-c) 30deg),
    oklch(var(--cal-l) var(--cal-c) 60deg),
    oklch(var(--cal-l) var(--cal-c) 90deg),
    oklch(var(--cal-l) var(--cal-c) 120deg),
    oklch(var(--cal-l) var(--cal-c) 150deg),
    oklch(var(--cal-l) var(--cal-c) 180deg),
    oklch(var(--cal-l) var(--cal-c) 210deg),
    oklch(var(--cal-l) var(--cal-c) 240deg),
    oklch(var(--cal-l) var(--cal-c) 270deg),
    oklch(var(--cal-l) var(--cal-c) 300deg),
    oklch(var(--cal-l) var(--cal-c) 330deg),
    oklch(var(--cal-l) var(--cal-c) 360deg)
  );
}
.group-hue::-webkit-slider-runnable-track {
  height: 0.6rem;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--hue-spectrum);
}
.group-hue::-moz-range-track {
  height: 0.6rem;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--hue-spectrum);
}
.group-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0.9rem;
  height: 0.9rem;
  margin-top: -0.2rem;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--fg);
  cursor: pointer;
}
.group-hue::-moz-range-thumb {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--fg);
  cursor: pointer;
}

/* ---- Actionable warnings banner ------------------------------------------ */
.tm-banner-item { border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.tm-banner-item:last-child { border-bottom: none; }
.tm-banner-item > summary {
  cursor: pointer;
  padding: 0.3rem 0;
  list-style: none;
}
.tm-banner-item > summary::-webkit-details-marker { display: none; }
.tm-banner-item > summary::before { content: "▸ "; color: var(--muted); }
.tm-banner-item[open] > summary::before { content: "▾ "; }
.tm-banner-item.danger > summary { color: var(--danger); font-weight: 600; }
.tm-banner-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.1rem 0 0.5rem 1rem;
  font-size: 0.88rem;
}

/* ---- Tasks list view ------------------------------------------------------ */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.task-list-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.task-list-item.archived { opacity: 0.6; }
.task-list-row {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  cursor: pointer;
}
.task-list-row:hover { border-color: var(--accent); }

/* ---- Preset prompt popup -------------------------------------------------- */
/* Width/spacing override the shared `.form` (max-width: 26rem, gap: 0.7rem) and `.card`
   padding, which are tuned for the wide task form and read cramped/sparse in the popup. The
   popup is NOT its own scroll container: an `overflow` here would clip the absolutely
   positioned combobox dropdowns, so `.preset-overlay` scrolls a tall popup instead. */
.preset-popup {
  width: min(92vw, 40rem);
  max-width: none;
  margin: 0;
  gap: 0.55rem;
  padding: 1.1rem 1.25rem;
}
.preset-overlay { overflow-y: auto; padding-bottom: 12vh; }
.preset-popup:focus-visible { outline: none; }
.preset-popup h2 { margin: 0 0 0.4rem; }

/* ---- Preset editor (tri-state Skip/Set/Ask per field) --------------------- */
.preset-field {
  display: grid;
  grid-template-columns: auto 10rem 1fr;
  align-items: start;
  gap: 0.6rem;
}
.preset-field-label { padding-top: 0.45rem; font-size: 0.9rem; }
.preset-field-widget { min-width: 0; }
.preset-field-widget.skipped { opacity: 0.45; pointer-events: none; }
.tri-state {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  overflow: hidden;
  margin-top: 0.15rem;
}
.tri-opt {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.tri-opt + .tri-opt { border-left: 1px solid var(--border); }
.tri-opt.active {
  background: var(--accent);
  color: var(--accent-fg);
}
@media (max-width: 40rem) {
  .preset-field { grid-template-columns: auto 1fr; }
  .preset-field-widget { grid-column: 1 / -1; }
}

/* Blocking settings (per-classification policy editor) */
.field.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.field.checkbox span { font-family: inherit; font-size: inherit; color: inherit; }
.app-checklist {
  max-height: 12rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  padding: 0.4rem 0.6rem;
}
.app-row { display: flex; align-items: center; gap: 0.5rem; }
.app-row span { font-family: inherit; font-size: inherit; color: inherit; }
.app-row code { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.add-row { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.add-row input { flex: 1; min-width: 0; }
