/* Twig — see docs/visual-direction.md */

/* Atkinson Hyperlegible Next (variable, 400–600), served from fonts/ so Twig works offline.
   SIL Open Font License: fonts/OFL.txt. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #EEF1EC;
  --card: #FBFCFA;
  --ink: #1C231E;
  --ink-soft: #5D675F;
  --bark: #C3CAC1;
  --stem: #A3ADA1;
  --sap: #2E7556;
  --sap-wash: #DCEBE2;
  --amber: #B7791F;
  --amber-text: #8F5E17; /* amber for words: 4.5:1 on paper and card (plain --amber is 3.2:1, fine for icons) */
  --danger: #B3402F;
  --danger-wash: #F6E1DC;
  --hover: #E5EAE3;
  --lane: color-mix(in srgb, var(--ink) 4%, var(--paper)); /* a board list: a step below the page, so its cards stand up off it */
  --shadow: 0 1px 0 rgba(28, 35, 30, 0.04);
  --overlay: rgba(28, 35, 30, 0.32);

  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-xs: 13px; --t-s: 14px; --t-m: 16px; --t-l: 19px; --t-xl: 23px;

  --indent: 40px;   /* one tree level */
  --stem-x: 20px;   /* where a parent's stem runs, from its card's left edge */
  --elbow-y: 26px;  /* where a stem turns into a child card, from the row top */
  --stem-w: 2px;
  --radius-root: 12px;
  --radius-card: 8px;
  --panel-w: 380px;
  --rail-w: 210px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131714;
    --card: #1B201C;
    --ink: #E3E8E1;
    --ink-soft: #9AA59C;
    --bark: #3A443C;
    --stem: #56625A;
    --sap: #6DBE95;
    --sap-wash: #1F3329;
    --amber: #E0A54A;
    --amber-text: #E0A54A;
    --danger: #E47A68;
    --danger-wash: #3A211C;
    --hover: #222923;
    --lane: #0E110F;
    --shadow: none;
    --overlay: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-m)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sap); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; background: var(--card); padding: 8px 12px; z-index: 50; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */

.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.app.with-panel { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--panel-w); }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px;
  border-right: 1px solid var(--bark);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: var(--t-l); padding: 4px 8px 18px; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--sap); stroke-width: 3; stroke-linecap: round; }
.brand svg circle { fill: var(--sap); stroke: none; }
.places { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.places a, .rail-settings {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 10px; border-radius: 6px;
  text-decoration: none; background: none; border: 0; text-align: left; font-size: var(--t-s);
}
.places a:hover, .rail-settings:hover { background: var(--hover); }
.places a[aria-current="page"] { background: var(--card); font-weight: 600; box-shadow: inset 0 0 0 1px var(--bark); }
.count { color: var(--ink-soft); font-size: var(--t-xs); }
.rail-settings { margin-top: auto; }
.rail-note { margin: 8px 10px 0; color: var(--ink-soft); font-size: var(--t-xs); line-height: 1.4; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; background: var(--paper);
  border-bottom: 1px solid transparent;
}
.capture { flex: 1; max-width: 640px; display: flex; gap: 8px; }
.capture input {
  flex: 1; min-width: 0; padding: 10px 14px;
  border: 1px solid var(--bark); border-radius: 10px; background: var(--card);
}
.capture input::placeholder { color: var(--ink-soft); }
.capture input:focus-visible { outline-offset: 0; border-color: var(--sap); }
.capture-add { padding: 0 14px; border-radius: 10px; border: 1px solid var(--bark); background: var(--card); font-size: var(--t-s); }
.capture-add:hover { background: var(--hover); }
.save-status { margin: 0 0 0 auto; font-size: var(--t-xs); color: var(--ink-soft); white-space: nowrap; }
.save-status[data-state="error"], .save-status[data-state="conflict"] { color: var(--danger); font-weight: 600; }

.view { padding: 8px 28px 120px; outline: none; max-width: 860px; width: 100%; }

/* ---------- banners ---------- */

#banners:empty { display: none; }
#banners { padding: 0 28px; display: grid; gap: 8px; max-width: 860px; }
.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--bark);
}
.banner p { margin: 0; flex: 1 1 280px; }
.banner.warn { background: var(--danger-wash); border-color: var(--danger); }
.banner.info { background: var(--sap-wash); border-color: transparent; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--bark); background: var(--card);
  font-size: var(--t-s); text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--sap); border-color: var(--sap); color: var(--card); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--sap); }
.btn.danger { color: var(--danger); }
.btn.quiet { border-color: transparent; background: none; }
.btn.quiet:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: .5; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: none; color: var(--ink-soft);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- view header & breadcrumb ---------- */

.view-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; margin: 10px 0 14px; }
.view-head > :first-child { min-width: 0; flex: 1 1 12rem; } /* the title or path; the tools wrap below it on a phone */
.view-title { margin: 0; font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.01em; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 12px 0 10px; font-size: var(--t-s); color: var(--ink-soft); list-style: none; padding: 0; }
.crumbs li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li + li::before { content: "›"; color: var(--bark); }
.crumbs a, .crumbs button { color: var(--ink-soft); text-decoration: none; background: none; border: 0; padding: 2px 4px; border-radius: 4px; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover, .crumbs button:hover { color: var(--ink); background: var(--hover); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.crumb-title { margin: 0; font: inherit; min-width: 0; overflow-wrap: anywhere; } /* the focused card's heading, styled as a crumb */
.up-link { font-size: var(--t-s); }

/* ---------- card tree ---------- */

.tree { list-style: none; margin: 0; padding: 0; }
.row {
  position: relative;
  padding: 6px 0 6px calc(var(--depth) * var(--indent));
}
.row.top { margin-top: 18px; }
.row.top:first-child { margin-top: 0; }
/* A row not built yet (see tree.js): about a card's height, its title where the card's would be.
   Off screen the browser skips its layout too (it holds no focus ring or stem that could be clipped). */
.row.is-stub { min-height: 70px; content-visibility: auto; contain-intrinsic-size: auto 58px; }
.row.top.is-stub { min-height: 102px; contain-intrinsic-size: auto 90px; }
.stub-title { display: block; margin: 0 0 0 64px; padding: 0; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* stems */
.g { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; }
.g > i { position: absolute; display: block; border-color: var(--stem); border-style: solid; border-width: 0; }
.g > i.lit { border-color: var(--sap); z-index: 1; }
.g .pass { top: 0; bottom: 0; border-left-width: var(--stem-w); }
.g .top { top: 0; height: calc(var(--elbow-y) - 10px); border-left-width: var(--stem-w); }
.g .curve {
  top: calc(var(--elbow-y) - 10px); height: 10px; width: calc(var(--indent) - var(--stem-x));
  border-left-width: var(--stem-w); border-bottom-width: var(--stem-w); border-bottom-left-radius: 10px;
}
.g .bottom { top: calc(var(--elbow-y) - 10px); bottom: 0; border-left-width: var(--stem-w); }
.g .below { top: 24px; bottom: 0; border-left-width: var(--stem-w); }

.card {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: start; gap: 2px 6px;
  padding: 6px 6px 6px 4px;
  width: fit-content; min-width: min(300px, 100%); max-width: 100%;
  background: var(--card); border: 1px solid var(--bark); border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  cursor: default;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.card:hover { border-color: color-mix(in srgb, var(--bark) 60%, var(--ink-soft)); }
.card.root { padding: 12px 10px 12px 8px; border-radius: var(--radius-root); min-width: min(440px, 100%); }
.card.selected { border-color: var(--sap); box-shadow: 0 0 0 1px var(--sap); }
.card:focus-visible { outline-offset: 3px; border-radius: var(--radius-card); }

.chev { width: 24px; height: 28px; border: 0; background: none; color: var(--ink-soft); border-radius: 6px; display: grid; place-items: center; }
.chev:hover { background: var(--hover); color: var(--ink); }
.chev svg { width: 14px; height: 14px; transition: transform .16s var(--ease); }
.chev[aria-expanded="false"] svg { transform: rotate(-90deg); }
.chev-space { width: 24px; }

.status { width: 28px; height: 28px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.status:hover:not(:disabled) { background: var(--hover); }
.status svg { width: 18px; height: 18px; }

.title {
  min-width: 0; padding: 2px 4px; margin: 0;
  font-size: var(--t-m); font-weight: 500; line-height: 24px;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  border-radius: 4px; cursor: default;
}
.card.root .title { font-size: var(--t-l); font-weight: 600; }
.title.untitled { color: var(--ink-soft); font-style: italic; font-weight: 400; }
.card.is-done .title { color: var(--ink-soft); }
.title-edit {
  min-width: 0; width: 100%; padding: 1px 4px; margin: 0;
  font-weight: 500; line-height: 24px; resize: none; overflow: hidden;
  border: 1px solid var(--sap); border-radius: 4px; background: var(--card);
  outline: none;
}
.card.root .title-edit { font-size: var(--t-l); font-weight: 600; }

.meta { display: flex; align-items: center; gap: 8px; padding-top: 4px; font-size: var(--t-xs); color: var(--ink-soft); white-space: nowrap; }
.bar { width: 44px; height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--sap); border-radius: 2px; }
.card.root .bar { width: 64px; }
.more { color: var(--ink-soft); }

/* Deep in a branch on a phone the indent leaves little room: wrap rather than widen the page. */
.deeper {
  margin: 6px 0 0 calc((var(--depth) + 1) * var(--indent)); font-size: var(--t-s);
  max-width: calc(100% - (var(--depth) + 1) * var(--indent)); white-space: normal; text-align: left;
}

.add-row { margin-top: 10px; padding-left: calc(var(--depth, 0) * var(--indent)); }
.add-card { color: var(--ink-soft); }

/* ---------- empty states ---------- */

.empty {
  margin: 48px 0; padding: 28px; max-width: 520px;
  border: 1px dashed var(--bark); border-radius: var(--radius-root);
}
.empty h2 { margin: 0 0 6px; font-size: var(--t-l); }
.empty p { margin: 0 0 14px; color: var(--ink-soft); }

/* ---------- trash ---------- */

.trash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trash-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 12px 10px 16px; background: var(--card); border: 1px solid var(--bark); border-radius: var(--radius-card);
}
.trash-item .what { flex: 1 1 240px; min-width: 0; }
.trash-item .what strong { display: block; font-weight: 500; overflow-wrap: anywhere; }
.trash-item .what span { color: var(--ink-soft); font-size: var(--t-xs); }
.trash-item .what .origin { display: block; overflow-wrap: anywhere; }
.trash-item .acts { display: flex; gap: 6px; }

/* ---------- panel ---------- */

.panel {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  background: var(--card); border-left: 1px solid var(--bark);
  padding: 14px 20px 40px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.panel-path { font-size: var(--t-xs); color: var(--ink-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-title {
  width: 100%; margin: 6px 0 10px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px;
  font-size: var(--t-xl); font-weight: 600; line-height: 1.3; resize: none; overflow: hidden; background: none;
}
.panel-title:hover { border-color: var(--bark); }
.panel-title:focus-visible { outline: none; border-color: var(--sap); }
.panel section { margin: 18px 0; }
.panel h3 { margin: 0 0 6px; font-size: var(--t-s); font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: 9px; background: var(--paper); border: 1px solid var(--bark); }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: var(--t-s); }
.seg button svg { width: 14px; height: 14px; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: inset 0 0 0 1px var(--bark); font-weight: 600; }
.seg button:disabled { opacity: .5; } /* a read-only tab: the status shows, but can't be changed here */
/* Switches between places or shapes sit in one row, however many choices they have. */
.shape-switch, .agenda-tabs, .board-mode { display: inline-grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: auto; justify-self: start; }
.progress-line { margin: 8px 0 0; font-size: var(--t-s); color: var(--ink-soft); }
.progress-line strong { color: var(--ink); font-weight: 600; }
.why summary { cursor: pointer; width: fit-content; margin-top: 4px; font-size: var(--t-xs); color: var(--sap); }
.why .hint { margin: 6px 0 2px; font-size: var(--t-xs); color: var(--ink-soft); }
.why-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; font-size: var(--t-s); }
.why-list li { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; min-width: 0; }
.why-list .status { flex: none; align-self: center; display: inline-flex; }
.why-list .linklike { overflow-wrap: anywhere; }
.why-list .hint { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.notes {
  width: 100%; min-height: 120px; padding: 10px 12px; border: 1px solid var(--bark); border-radius: 8px;
  background: var(--paper); line-height: 1.55; resize: vertical; max-width: 68ch;
}
.notes:focus-visible { outline: none; border-color: var(--sap); }
.notes[hidden], .notes-view[hidden], .notes-section .btn[hidden], .notes-hint[hidden] { display: none; }
.notes-view { padding: 10px 12px; border: 1px solid var(--bark); border-radius: var(--radius-card); background: var(--card); cursor: text; overflow-wrap: anywhere; line-height: 1.5; }
.notes-view > :first-child { margin-top: 0; }
.notes-view > :last-child { margin-bottom: 0; }
.notes-view p { margin: 0 0 8px; }
.notes-view .notes-h { margin: 12px 0 6px; font-size: var(--t-m); }
.notes-view h4.notes-h { font-size: var(--t-l); }
.notes-view a { color: var(--sap); }
.notes-view code { font-size: .92em; padding: 1px 4px; border-radius: 4px; background: var(--paper); }
.notes-list { margin: 0 0 8px; padding-left: 20px; }
.notes-list li { margin: 2px 0; }
.notes-check { list-style: none; margin-left: -20px !important; }
.notes-check label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.notes-check input { margin-top: 4px; flex: none; }
.notes-check.done span { color: var(--ink-soft); text-decoration: line-through; }
.notes-section .btn { margin-top: 6px; }
.notes-hint { margin: 6px 0 0; font-size: var(--t-xs); }
.breakdown summary { cursor: pointer; font-size: var(--t-s); font-weight: 600; padding: 4px 0; width: fit-content; }
.breakdown textarea { width: 100%; min-height: 110px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--bark); border-radius: 8px; background: var(--paper); line-height: 1.5; resize: vertical; }
.breakdown .hint { margin: 6px 0 8px; font-size: var(--t-xs); color: var(--ink-soft); }
.breakdown .bd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; }
.breakdown .bd-head .hint { margin: 6px 0 0; }
.breakdown .bd-head .btn { margin-top: 6px; }
.breakdown .bd-summary { margin: 8px 0 4px; }
.bd-preview { list-style: none; margin: 0 0 10px; padding: 8px 10px; max-height: 240px; overflow-y: auto; border-left: 2px solid var(--bark); font-size: var(--t-s); }
.bd-preview li { padding: 1px 0 1px calc(var(--depth, 0) * 16px); overflow-wrap: anywhere; }
.bd-preview li::before { content: '\2022'; color: var(--ink-soft); margin-right: 6px; }
.breakdown .row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); }
.check input { width: 16px; height: 16px; accent-color: var(--sap); }
.children { list-style: none; margin: 0 0 8px; padding: 0; }
.children li { display: flex; align-items: center; gap: 4px; }
.children .child-title { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 5px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.children .child-title:hover { background: var(--hover); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--bark); }
.labels-home { display: contents; }
.panel-more summary { cursor: pointer; width: fit-content; padding: 4px 0; font-size: var(--t-s); font-weight: 600; color: var(--ink-soft); }
.panel-more summary:hover { color: var(--ink); }
.panel-more-body { display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
.panel-more .panel-actions { padding-top: 0; border-top: 0; }

/* ---------- menu, dialog, toasts ---------- */

/* Menus: an icon column, the action, and its key on the right, so the menu teaches the keyboard. */
.menu {
  position: fixed; z-index: 40; inset: auto; margin: 0; color: var(--ink); /* also when shown as a popover */ min-width: 232px; max-width: min(340px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow: auto; overscroll-behavior: contain;
  padding: 6px; background: var(--card); border: 1px solid var(--bark); border-radius: 12px;
  box-shadow: var(--float);
}
.menu.opens-down { transform-origin: top left; animation: menu-down .14s var(--ease); }
.menu.opens-up { transform-origin: bottom left; animation: menu-up .14s var(--ease); }
@keyframes menu-down { from { opacity: 0; transform: translateY(-3px) scale(.98); } }
@keyframes menu-up { from { opacity: 0; transform: translateY(3px) scale(.98); } }
.menu-title {
  padding: 4px 10px 6px; font-size: var(--t-xs); font-weight: 600; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.menu button {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: 32px; padding: 5px 10px 5px 8px; text-align: left; overflow-wrap: anywhere;
  border: 0; background: none; border-radius: 7px; font-size: var(--t-s); line-height: 20px;
}
.menu.plain button { grid-template-columns: minmax(0, 1fr) auto; }
.menu.plain .mi-icon { display: none; }
.menu button:focus { background: var(--hover); outline: none; }
.menu button:focus-visible { outline: 2px solid var(--sap); outline-offset: -2px; }
.menu button:disabled { opacity: .45; }
.menu button:disabled:focus { background: none; }
.mi-icon { display: grid; place-items: center; width: 18px; height: 18px; color: var(--ink-soft); }
.mi-icon svg { width: 17px; height: 17px; }
.mi-keys { font-size: 12px; color: var(--ink-soft); white-space: nowrap; padding-left: 12px; }
.menu button:focus .mi-icon, .menu button:focus .mi-keys { color: var(--ink); }
.menu button.danger, .menu button.danger .mi-icon { color: var(--danger); }
.menu button.danger:focus { background: var(--danger-wash); }
.menu hr { border: 0; border-top: 1px solid var(--bark); margin: 5px 4px; }
/* a line of choices, like a card's status */
.menu-row { display: flex; gap: 4px; padding: 2px 0 2px; }
.menu .menu-chip {
  flex: 1 1 0; grid-template-columns: auto auto; justify-content: center; gap: 6px; min-height: 32px; padding: 4px 8px;
  border: 1px solid var(--bark); border-radius: 999px; font-size: var(--t-xs); font-weight: 600; white-space: nowrap;
}
.menu .menu-chip .mi-icon, .menu .menu-chip .mi-icon svg { width: 16px; height: 16px; }
.menu .menu-chip.checked { border-color: var(--sap); background: var(--sap-wash); }
.menu .menu-chip.checked:focus { background: color-mix(in srgb, var(--sap-wash) 70%, var(--hover)); }

/* Dialogs: a sticky heading row with a × close, soft corners, a lifted surface over a blurred page. */
dialog {
  width: min(480px, calc(100vw - 32px)); padding: 0 22px 22px; border: 1px solid var(--bark); border-radius: 16px;
  background: var(--card); color: var(--ink); box-shadow: var(--float);
}
dialog[open] { animation: dialog-in .18s var(--ease); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); animation: backdrop-in .18s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes backdrop-in { from { opacity: 0; } }
.dialog-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  margin: 0 -22px 8px; padding: 18px 22px 10px; background: var(--card);
}
.dialog-head h2 { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.dialog-x { width: 32px; height: 32px; margin-right: -8px; flex: none; }
dialog h2 { margin: 0 0 8px; font-size: var(--t-l); line-height: 1.3; }
dialog p { margin: 0 0 12px; color: var(--ink-soft); }
dialog .dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
dialog section + section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--bark); }
dialog section:has(> .settings-fold) + section:has(> .settings-fold) { margin-top: 0; padding-top: 0; }
.settings-fold > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; }
.settings-fold > summary::-webkit-details-marker { display: none; }
.settings-fold > summary::after { content: ''; width: 7px; height: 7px; margin-left: auto; margin-right: 6px; border: solid var(--ink-soft); border-width: 0 1.6px 1.6px 0; rotate: 45deg; translate: 0 -2px; transition: rotate .15s; }
.settings-fold[open] > summary::after { rotate: 225deg; translate: 0 2px; }
.settings-fold > summary h3 { margin: 0; }
.settings-fold > summary:hover h3 { color: var(--sap); }
.settings-fold[open] > summary { margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .settings-fold > summary::after { transition: none; } }
dialog h3 { margin: 0 0 6px; font-size: var(--t-m); }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.account-problem { color: var(--danger); font-size: var(--t-s); }

/* ---------- the sign-in page (#/sign-in) ---------- */

.signin { max-width: 440px; margin: 48px auto 0; }
.signin-mark { display: block; width: 44px; height: 44px; margin: 0 0 20px; }
.signin-stem { fill: none; stroke: var(--sap); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.signin-bud { fill: var(--sap); transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  /* The one moment: Twig's sprig grows in when the page opens, then the bud. */
  .signin-grow .signin-stem { stroke-dasharray: 1; animation: sprig-grow .9s cubic-bezier(.16, 1, .3, 1) both; }
  .signin-grow .signin-bud { animation: bud-open .5s cubic-bezier(.16, 1, .3, 1) .55s both; }
}
@keyframes sprig-grow { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes bud-open { from { transform: scale(0); } to { transform: scale(1); } }
.signin-title { font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
.signin-title:focus { outline: none; }
.signin-lead { margin: 10px 0 28px; color: var(--ink-soft); font-size: var(--t-m); line-height: 1.55; }
.signin-lead strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.signin-wide { width: 100%; min-height: 48px; justify-content: center; font-size: var(--t-m); }
.signin-google { gap: 10px; font-weight: 600; }
.signin-g { width: 18px; height: 18px; flex: none; }
.signin-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-soft); font-size: var(--t-xs); }
.signin-or::before, .signin-or::after { content: ""; flex: 1; height: 1px; background: var(--bark); }
.signin-form { display: grid; gap: 10px; }
.signin-label { font-size: var(--t-s); font-weight: 600; }
.signin-input {
  width: 100%; min-height: 48px; padding: 0 14px; font-size: var(--t-m);
  border: 1px solid var(--bark); border-radius: 10px; background: var(--card); color: var(--ink);
}
.signin-input::placeholder { color: var(--ink-soft); }
.signin-input:focus-visible { outline-offset: 0; border-color: var(--sap); }
.signin-small { margin: 0; color: var(--ink-soft); font-size: var(--t-xs); line-height: 1.5; }
.signin .account-problem { margin: 12px 0 0; }
.signin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.signin-actions .btn { min-height: 44px; padding-inline: 16px; }
.signin-next { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--bark); }
.signin-next h2 { margin: 0 0 8px; font-size: var(--t-s); font-weight: 600; }
.signin-next ul { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: var(--t-s); line-height: 1.5; }
.signin-next li { margin: 6px 0; }
.signin-next li::marker { color: var(--sap); }
.signin-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 28px 0 0; font-size: var(--t-s); }
.signin-foot a { color: var(--ink-soft); text-underline-offset: 3px; }
.signin-foot a:hover { color: var(--ink); }
.signin-foot .btn { min-height: 44px; }
@media (max-width: 899px) { .signin { margin-top: 20px; } }
.btn.danger-quiet { color: var(--danger); border-color: transparent; background: none; padding-left: 0; }
.versions { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.versions li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--bark); font-size: var(--t-s); }
.versions li:first-child { border-top: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--sap); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.import-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.import-compare > div { padding: 10px 12px; border: 1px solid var(--bark); border-radius: 10px; min-width: 0; }
.import-stats, .import-errors { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: var(--t-s); overflow-wrap: anywhere; }
.import-errors { margin-bottom: 4px; }
.import-warning { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--danger-wash); color: var(--ink); font-size: var(--t-s); }
.keys { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: var(--t-s); }
.keys dt { font-weight: 600; }
.keys dd { margin: 0; color: var(--ink-soft); }
.keys dt { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.key-group + .key-group { margin-top: 14px; }
.key-group h4 { margin: 0 0 6px; font-size: var(--t-s); font-weight: 600; }
.key-or { font-weight: 400; font-size: var(--t-xs); color: var(--ink-soft); padding: 0 2px; }
kbd { font: inherit; padding: 0 5px; border: 1px solid var(--bark); border-radius: 4px; background: var(--paper); }

.toasts {
  position: fixed; left: 50%; bottom: max(20px, calc(var(--toast-lift, 0px) + 8px)); transform: translateX(-50%); z-index: 45; /* --toast-lift: canvas.js */
  display: grid; gap: 8px; width: min(440px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: var(--ink); color: var(--paper); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  animation: rise .2s var(--ease);
}
.toast p { margin: 0; flex: 1; font-size: var(--t-s); }
.toast button { border: 0; background: none; color: var(--paper); font-weight: 600; padding: 6px 10px; border-radius: 6px; font-size: var(--t-s); }
.toast button:hover { background: color-mix(in srgb, var(--paper) 15%, transparent); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.recovery { max-width: 560px; margin: 48px 0; }
.recovery h1 { font-size: var(--t-xl); margin: 0 0 8px; }
.recovery p { color: var(--ink-soft); }

.bottombar { display: none; }

/* ---------- narrow screens (full mobile layout arrives in Milestone 3) ---------- */

@media (max-width: 899px) {
  :root { --indent: 22px; --stem-x: 12px; }
  .app, .app.with-panel { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { padding: 10px 16px; gap: 10px; }
  /* Phones submit with the keyboard's key, but that key isn't obvious: show Add once there's text,
     in the mic's place (the mic stays while it's listening). */
  .capture:has(input:placeholder-shown) .capture-add { display: none; }
  .capture:has(input:not(:placeholder-shown)) .capture-mic:not(.is-listening) { display: none; }
  .capture-add, .capture-add:hover { min-height: 44px; background: var(--sap); border-color: var(--sap); color: var(--card); font-weight: 600; }
  .view { padding: 4px 16px 120px; }
  #banners { padding: 0 16px; }
  .panel {
    position: fixed; inset: 0; z-index: 30; height: auto; border-left: 0;
    padding: 12px 16px 96px;
    animation: rise .2s var(--ease);
  }
  .card { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .card .meta { grid-column: 3 / -1; grid-row: 2; padding: 0 4px 2px; }
  .status { width: 40px; height: 40px; }
  .chev { height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; /* one row, however many places */
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--bark);
  }
  .bottombar a, .bottombar button {
    min-height: 48px; display: grid; place-items: center; border: 0; background: none;
    text-decoration: none; font-size: var(--t-s); border-radius: 8px;
  }
  .bottombar [aria-current="page"] { font-weight: 600; color: var(--sap); }
  .bottombar button { position: relative; }
  .bottombar .tend-dot { position: absolute; top: 10px; right: calc(50% - 26px); margin: 0; } /* beside the label, not under it */
  /* The keyboard shrinks the page (interactive-widget in index.html): while typing, the bar would sit
     on top of it, so it steps aside. */
  body:has(:is(input:not([type=checkbox], [type=radio], [type=file]), textarea, [contenteditable="true"]):focus) .bottombar { display: none; }
  .toasts { bottom: max(84px, calc(var(--toast-lift, 0px) + 8px)); }
}

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

/* ---------- command bar ---------- */

.rail-search {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; padding: 8px 10px;
  min-height: 40px; border: 1px solid var(--bark); border-radius: 10px; background: var(--card); color: var(--ink-soft);
  font-size: var(--t-s); text-align: left;
}
.rail-search:hover { background: var(--hover); color: var(--ink); }
.rail-search kbd { font: inherit; font-size: var(--t-xs); color: var(--ink-soft); }
dialog.palette {
  width: min(640px, calc(100vw - 32px)); max-height: min(70vh, 560px); margin: 12vh auto auto; padding: 0;
  flex-direction: column; overflow: hidden;
}
dialog.palette[open] { display: flex; }
.palette-input {
  margin: 12px; padding: 12px 14px; border: 1px solid var(--bark); border-radius: 10px; background: var(--paper);
  font-size: var(--t-m);
}
.palette-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; }
.palette-group { padding: 10px 8px 4px; font-size: var(--t-xs); color: var(--ink-soft); }
.palette-option { display: grid; gap: 2px; padding: 8px 10px; min-height: 44px; border-radius: 8px; cursor: pointer; }
.palette-option[aria-selected="true"] { background: var(--hover); box-shadow: inset 2px 0 0 var(--sap); }
.palette-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-path, .palette-snippet { font-size: var(--t-xs); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.palette .palette-status { margin: 0; padding: 0 20px 14px; }
.palette-status:empty { display: none; }
@media (max-width: 899px) {
  dialog.palette { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; border: 0; }
}

/* ---------- move picker ---------- */

dialog.picker { width: min(520px, calc(100vw - 32px)); }
.picker-search {
  width: 100%; padding: 9px 12px; margin: 4px 0 10px;
  border: 1px solid var(--bark); border-radius: 8px; background: var(--paper);
}
.picker-search:focus-visible { outline: none; border-color: var(--sap); }
.picker-list { list-style: none; margin: 0; padding: 0; max-height: min(52vh, 420px); overflow: auto; }
.picker-option { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.picker-option[aria-selected="true"] { background: var(--sap-wash); }
.picker-option[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }
.picker-label { font-weight: 500; overflow-wrap: anywhere; }
.picker-path { font-size: var(--t-xs); color: var(--ink-soft); overflow-wrap: anywhere; }
.picker-more { margin: 8px 0 0; font-size: var(--t-xs); color: var(--ink-soft); }
.picker-more:empty { display: none; }
.file-btn { padding: 4px 10px; align-self: center; }

/* ---------- desktop canvas ---------- */

:root {
  --dot: #C9D0C6; --lift: 0 1px 2px rgba(28, 35, 30, .06), 0 6px 16px -8px rgba(28, 35, 30, .18);
  --float: 0 1px 2px rgba(28, 35, 30, .08), 0 14px 36px -10px rgba(28, 35, 30, .32); /* menus, the selection bar */
}
@media (prefers-color-scheme: dark) {
  :root {
    --dot: #2B332D; --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 18px -8px rgba(0, 0, 0, .5);
    --float: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -10px rgba(0, 0, 0, .75);
  }
}

.app.canvas-mode { height: 100vh; min-height: 0; }
.app.canvas-mode .workspace { height: 100vh; }
.view.is-board { max-width: 1400px; }
/* A board has no big card under its crumbs, so its name is the page's heading: a step above the list names. */
.view.is-board .crumb-title { font-size: var(--t-l); }
.view.is-canvas { flex: 1; min-height: 0; max-width: none; padding: 0; display: flex; flex-direction: column; }
.view.is-canvas .view-top { padding: 0 28px; }
.view.is-canvas .view-head { align-items: center; margin: 2px 0 10px; min-height: 36px; }
.view.is-canvas .view-head .crumbs { margin: 0; min-width: 0; }
.view.is-canvas .view-top > .crumbs { margin: 6px 0 10px; }
.view.is-canvas .add-card { flex: none; color: var(--ink); }
.view.is-canvas .empty { margin: 24px 28px; }

.canvas {
  position: relative; flex: 1; min-height: 0; overflow: clip;
  border-top: 1px solid var(--bark);
  background-color: var(--paper);
  cursor: grab; touch-action: none; user-select: none;
}
.canvas-dots {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle at center, var(--dot) 1.2px, transparent 1.7px);
  background-size: 24px 24px;
}
.canvas-shield { position: absolute; inset: 0; z-index: 4; cursor: grabbing; }
.canvas-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.canvas.gliding .canvas-world { transition: transform .3s var(--ease); }
.canvas.gliding .canvas-dots { transition: background-position .3s var(--ease), background-size .3s var(--ease); }

.canvas-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.canvas-edges path {
  fill: none; stroke: var(--stem); stroke-width: 2; stroke-linecap: round;
  transition: d .26s var(--ease), opacity .2s var(--ease), stroke .15s;
}
.canvas-edges path.lit { stroke: var(--sap); stroke-width: 2.5; }

.ccard {
  position: absolute; left: 0; top: 0; width: 248px; height: 104px;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 10px 10px 10px 8px;
  background: var(--card); border: 1px solid var(--bark); border-radius: 10px;
  box-shadow: var(--lift);
  cursor: pointer;
  transition: transform .26s var(--ease), rotate .2s var(--ease), opacity .2s var(--ease), border-color .15s, box-shadow .15s;
}
.ccard:hover { border-color: color-mix(in srgb, var(--bark) 55%, var(--ink-soft)); }
.ccard.root { border-radius: 12px; border-color: color-mix(in srgb, var(--bark) 70%, var(--ink-soft)); }
.ccard.selected { border-color: var(--sap); box-shadow: 0 0 0 1px var(--sap), var(--lift); z-index: 2; }
.ccard:focus-visible { outline-offset: 3px; border-radius: 12px; }
.ccard.carried, .canvas-edges path.carried { transition: none; }
/* The card in the hand tilts (as on the outline and board); only the tilt animates, the move stays 1:1. */
.ccard.carried.lifted { rotate: 3deg; transition: rotate .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s; }
@media (prefers-reduced-motion: reduce) { .ccard.carried.lifted { rotate: none; } }
.canvas-leaving { position: absolute; left: 0; top: 0; }
.ccard.leaving { pointer-events: none; }
.ccard.lifted { z-index: 5; box-shadow: 0 2px 4px rgba(28, 35, 30, .12), 0 14px 28px -8px rgba(28, 35, 30, .4); }

.ccard-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 2px; min-height: 0; }
.ccard .title {
  font-size: 15px; line-height: 22px; font-weight: 500; padding: 3px 2px 0;
  -webkit-line-clamp: 2; cursor: inherit;
}
.ccard.root .title { font-size: var(--t-m); font-weight: 600; }
.ccard.is-done .title { color: var(--ink-soft); }
.ccard .title-edit { font-size: 15px; line-height: 22px; max-height: 50px; overflow: auto; margin-top: 2px; }
.ccard .more { width: 28px; height: 28px; opacity: 0; transition: opacity .15s; }
.ccard:hover .more, .ccard.selected .more, .ccard:focus-within .more, .ccard .more[aria-expanded="true"] { opacity: 1; }
.ccard .meta { padding: 0 0 0 32px; min-height: 26px; gap: 8px; }
.ccard .meta .bar { width: 56px; }
/* Cut (waiting to be pasted) and filtered-out cards are quieter by colour, not opacity, so their words keep 4.5:1. */
.ccard.is-cut, .card.is-cut { border-style: dashed; background: color-mix(in srgb, var(--card) 45%, transparent); box-shadow: none; }
:is(.ccard, .card):is(.is-cut, .dimmed:not(.selected)) :is(.title, .excerpt, .meta) { color: var(--ink-soft); }
.card .excerpt {
  grid-column: 3 / 4; grid-row: 2; margin: 0; padding: 0 4px; font-size: var(--t-s); line-height: 20px; color: var(--ink-soft);
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 899px) {
  .card .excerpt { grid-column: 3 / -1; }
  .card:has(.excerpt) .meta { grid-row: 3; }
}
.ccard .excerpt {
  margin: 2px 0 0 32px; font-size: var(--t-xs); line-height: 18px; color: var(--ink-soft);
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.grow {
  position: absolute; right: -14px; top: 52px; transform: translateY(-50%); /* level with where lines join (ANCHOR_Y) */
  display: inline-flex; align-items: center; gap: 1px;
  height: 26px; min-width: 28px; padding: 0 4px 0 7px; border-radius: 13px;
  border: 1px solid var(--bark); background: var(--card); color: var(--ink-soft);
  font-size: var(--t-xs); font-weight: 600; box-shadow: var(--shadow);
}
.grow svg { width: 13px; height: 13px; transition: transform .2s var(--ease); }
.grow:hover { border-color: var(--sap); color: var(--sap); }
.grow.is-open { background: var(--sap); border-color: var(--sap); color: var(--card); }
.grow.is-open svg { transform: rotate(180deg); }
.grow.is-empty { color: var(--ink-soft); border-style: dashed; box-shadow: none; }
.grow.is-empty:hover:not(:disabled) { border-style: solid; }
.grow:disabled { opacity: .5; cursor: default; }

.canvas-tools {
  position: absolute; right: 16px; bottom: 16px; z-index: 6;
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--card); border: 1px solid var(--bark); border-radius: 10px; box-shadow: var(--lift);
}
.canvas-btn {
  min-width: 32px; height: 30px; padding: 0 8px; border: 0; background: none; border-radius: 7px;
  font-size: var(--t-s); color: var(--ink);
}
.canvas-btn:hover { background: var(--hover); }
.canvas-btn.zoom-label { min-width: 52px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.canvas-btn.fit { border-left: 1px solid var(--bark); border-radius: 0 7px 7px 0; padding: 0 12px; font-weight: 500; }

/* dropping a dragged card onto another card */
.ccard.drop-inside { border-color: var(--sap); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sap) 35%, transparent), var(--lift); background: var(--sap-wash); }
.ccard.drop-invalid { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 30%, transparent); }
.canvas .drop-note {
  position: absolute; left: 0; top: 0; z-index: 8; pointer-events: none; max-width: 280px;
  padding: 5px 10px; border-radius: 7px; font-size: var(--t-xs); font-weight: 600;
  background: var(--sap); color: var(--card); box-shadow: var(--lift);
}
.canvas .drop-note.refused { background: var(--danger); }

/* ---------- labels ---------- */

:root {
  --lab-sap: #2E7556; --lab-amber: #9A6414; --lab-clay: #A24E31; --lab-slate: #3F6487; --lab-plum: #7A4B7D; --lab-stone: #5E665F;
}
@media (prefers-color-scheme: dark) {
  :root { --lab-sap: #6DBE95; --lab-amber: #E0A54A; --lab-clay: #E48A6B; --lab-slate: #8DB3DA; --lab-plum: #C99CCC; --lab-stone: #A6AFA7; }
}
.c-sap { --lab: var(--lab-sap); } .c-amber { --lab: var(--lab-amber); } .c-clay { --lab: var(--lab-clay); }
.c-slate { --lab: var(--lab-slate); } .c-plum { --lab: var(--lab-plum); } .c-stone { --lab: var(--lab-stone); }

.chips { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.chip {
  display: inline-block; max-width: 92px; padding: 1px 7px; border-radius: 999px;
  font-size: 12px; line-height: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* Text leans toward the ink (darker in light, lighter in dark) so every label colour clears 4.5:1 on its tint. */
  color: color-mix(in srgb, var(--lab, var(--ink-soft)) 72%, var(--ink)); background: color-mix(in srgb, var(--lab, var(--ink-soft)) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lab, var(--ink-soft)) 28%, transparent);
}
.chip.more-chips { --lab: var(--ink-soft); }
.due-chip { font-size: 12px; line-height: 18px; font-weight: 600; white-space: nowrap; color: var(--ink-soft); }
.due-chip.today { color: var(--sap); }
.due-chip.overdue { color: var(--danger); }
.due-chip.done { text-decoration: line-through; } /* struck through, not faded: faded fell under 4.5:1 */
.due-section { display: grid; gap: 8px; }
.due-summary { margin: 0; }
.due-summary.overdue { color: var(--danger); font-weight: 600; }
.due-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.due-inputs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.due-pick input[type="text"] { width: 100%; box-sizing: border-box; }
.repeat-row { display: flex; align-items: center; gap: 8px; }
.repeat-row[hidden] { display: none; }
.remind-row { display: grid; gap: 6px; justify-items: start; margin-top: 8px; }
.remind-row [hidden] { display: none; }
.remind-row .hint { margin: 0; }
.topbar { flex-wrap: wrap; }
.capture-chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 0; }
.capture-chips[hidden] { display: none; }
/* What the capture box understood: full words, each with its × in reach (label chips stay small). */
.capture-chips .chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; min-height: 28px; max-width: none;
  border: 1px solid var(--bark); border-radius: 999px; background: var(--card); font-size: var(--t-xs); color: var(--ink-soft);
  box-shadow: none; font-weight: 400; line-height: 1.3;
}
.capture-chips .chip:not(:has(.chip-x)) { padding-right: 10px; }
.chip-x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 16px; line-height: 1; }
.chip-x:hover { background: var(--hover); color: var(--ink); }
.chip-offer { border-style: dashed; color: var(--sap); font-weight: 600; cursor: pointer; }
.chip-offer:hover { background: var(--sap-wash); }
.capture { position: relative; }
.capture-mic {
  flex: none; width: 44px; display: grid; place-items: center; border: 1px solid var(--bark); border-radius: 10px;
  background: var(--card); color: var(--ink-soft);
}
.capture-mic[hidden] { display: none; }
.capture-mic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.capture-mic:hover { background: var(--hover); color: var(--ink); }
.capture-mic.is-listening { color: var(--sap); border-color: var(--sap); }
@media (prefers-reduced-motion: no-preference) { .capture-mic.is-listening { animation: mic-pulse 1.2s ease-in-out infinite; } }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--sap) 25%, transparent); } }
.capture-suggest {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: min(420px, calc(100vw - 32px)); max-height: 280px;
  overflow-y: auto; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--bark); border-radius: 10px;
  background: var(--card); box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
.capture-suggest[hidden] { display: none; }
/* Under the empty, focused box: what it understands. Laid over the page, so nothing moves when it goes. */
.capture-hint {
  position: absolute; z-index: 29; top: calc(100% + 4px); left: 0; max-width: min(420px, calc(100vw - 32px));
  margin: 0; padding: 6px 10px; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 1px var(--bark);
  font-size: var(--t-xs); color: var(--ink-soft); pointer-events: none;
}
.capture-hint[hidden] { display: none; }
.capture-option { display: grid; gap: 2px; padding: 8px 10px; min-height: 40px; border-radius: 8px; cursor: pointer; }
.capture-option[aria-selected="true"] { background: var(--hover); }
.capture-option-path { font-size: var(--t-xs); color: var(--ink-soft); }
.linklike { all: unset; cursor: pointer; color: var(--sap); text-decoration: underline; }
.linklike:focus-visible { outline: 2px solid var(--sap); outline-offset: 2px; }
.agenda-tabs { margin: 0 0 16px; }
.agenda-tabs a { padding: 5px 12px; border-radius: 7px; font-size: var(--t-s); color: var(--ink); text-decoration: none; }
.agenda-tabs a[aria-current="page"] { background: var(--card); box-shadow: inset 0 0 0 1px var(--bark); font-weight: 600; }
.agenda-day h2 { font-size: var(--t-s); color: var(--ink-soft); margin: 18px 0 6px; }
.agenda-day.overdue h2 { color: var(--danger); }
.agenda-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.agenda-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card); box-shadow: inset 0 0 0 1px var(--bark); }
.agenda-row .status { border: 0; background: none; padding: 4px; display: inline-flex; }
.agenda-what { display: grid; min-width: 0; }
.agenda-title { all: unset; cursor: pointer; font-weight: 500; overflow-wrap: anywhere; }
.agenda-title:focus-visible { outline: 2px solid var(--sap); outline-offset: 2px; border-radius: 4px; }
.agenda-where { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-row { grid-template-columns: auto minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; }
/* A long Today (hundreds picked) lays out only the rows near the screen; nothing in a row draws outside it. */
.agenda-row { content-visibility: auto; contain-intrinsic-size: auto 58px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
/* "Do today": a quiet sun that fills in amber once picked. */
.today-toggle[aria-pressed="true"] { color: var(--amber); }
.plan-btn[aria-pressed="true"] { color: var(--amber-text); }
.today-toggle[aria-pressed="true"] svg circle, .plan-btn[aria-pressed="true"] svg circle { fill: currentColor; }
.plan-btn[aria-pressed="true"] { border-color: var(--amber); }
.panel-plan { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.agenda-day.picked h2 { color: var(--amber-text); }
.plan-day { margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; background: var(--sap-wash); box-shadow: inset 0 0 0 1px var(--bark); }
.plan-day h2 { margin: 0 0 4px; font-size: var(--t-m, 16px); }
.plan-day h3 { margin: 12px 0 6px; font-size: var(--t-s); color: var(--ink-soft); }
.plan-day .hint { margin: 0 0 8px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.plan-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 6px 8px; border-radius: 8px; background: var(--card); }
.plan-row > :first-child { min-width: 0; flex: 1 1 10rem; overflow-wrap: anywhere; }
.plan-acts, .plan-all { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-all { margin-top: 8px; }
.shape-switch a { padding: 5px 12px; border-radius: 7px; font-size: var(--t-s); color: var(--ink); text-decoration: none; }
.shape-switch a[aria-current="page"] { background: var(--card); box-shadow: inset 0 0 0 1px var(--bark); font-weight: 600; }
.board { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 12px; }
.board-col { background: var(--paper); border: 1px solid var(--bark); border-radius: var(--radius-root); padding: 10px; min-height: 120px; display: grid; gap: 8px; align-content: start; }
.board-col.drop { border-color: var(--sap); box-shadow: inset 0 0 0 1px var(--sap); }

/* Carrying a card (src/views/card-drag.js): it tilts in the hand, a little see-through, over an
   empty slot where it was; on letting go it glides flat into place. */
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing;
  background: var(--card); border-color: var(--bark);
  box-shadow: 0 2px 4px rgba(28, 35, 30, .12), 0 14px 28px -8px rgba(28, 35, 30, .4);
  transition: rotate .22s cubic-bezier(.34, 1.56, .64, 1), scale .22s cubic-bezier(.34, 1.56, .64, 1), opacity .15s;
  will-change: transform;
}
.drag-ghost.moving { rotate: 4deg; scale: 1.02; opacity: .9; }
.drag-ghost.settling {
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), rotate .2s ease-out, scale .2s ease-out, opacity .2s, box-shadow .2s;
  box-shadow: 0 1px 2px rgba(28, 35, 30, .1);
}
.drag-source { background: color-mix(in srgb, var(--ink) 9%, transparent) !important; border-color: transparent !important; box-shadow: none !important; }
.drag-source > * { visibility: hidden; }
.drag-landing { visibility: hidden; }
.carrying, .carrying * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.drop-line {
  position: fixed; left: 0; top: 0; z-index: 999; height: 3px; border-radius: 2px;
  background: var(--sap); pointer-events: none;
}
.drop-line.refused { background: var(--danger); }
.tree .card.drop-inside { outline: 2px solid var(--sap); outline-offset: -2px; background: var(--sap-wash); }
.tree .card.drop-invalid { outline: 2px solid var(--danger); outline-offset: -2px; }
@media (pointer: coarse) {
  .tree .card, .board-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .tree .card textarea { -webkit-user-select: text; user-select: text; } /* typing a title still works */
}
@media (prefers-reduced-motion: reduce) { .drag-ghost, .drag-ghost.settling { transition: none; } .drag-ghost.moving { rotate: none; scale: none; } }
.board-col h2 { font-size: var(--t-s); margin: 0; display: flex; align-items: center; gap: 8px; }
.board-count { font-weight: 400; color: var(--ink-soft); font-size: var(--t-xs); }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board-card { background: var(--card); border: 1px solid var(--bark); border-radius: var(--radius-card); padding: 8px 10px; display: grid; gap: 6px; }
.board-card[draggable="true"] { cursor: grab; }
.board-card.selected { border-color: var(--sap); }
.board-head { display: flex; align-items: flex-start; gap: 4px; margin-left: -6px; }
.board-head .status { flex: none; margin-top: -2px; }
.board-title { all: unset; cursor: pointer; font-weight: 500; overflow-wrap: anywhere; padding-top: 2px; min-height: 24px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; } /* the whole title is in details */
.board-title:focus-visible { outline: 2px solid var(--sap); outline-offset: 2px; border-radius: 4px; }
.board-progress { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.board-progress .bar { width: 40px; }
.board-where { margin: 2px 0 0; font-size: var(--t-xs); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-soft); }
.board-move { margin-left: auto; padding: 2px 8px; font-size: var(--t-xs); }
.board-empty { margin: 0; font-size: var(--t-xs); color: var(--ink-soft); }
.board-add { justify-self: start; }
.board-add-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--bark); border-radius: 8px; background: var(--card); color: var(--ink); }
.board-add-input::placeholder { color: var(--ink-soft); }
.board-add-input:focus-visible { outline: none; border-color: var(--sap); box-shadow: 0 0 0 1px var(--sap); }
select.repeat-select { padding: 4px 8px; border: 1px solid var(--bark); border-radius: 8px; background: var(--card); color: var(--ink); }
/* The board's bar: Columns (Lists | Status) and the summary line the cards add up to. */
.board-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; }
.board-summary { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--t-s); color: var(--ink-soft); }
.board-summary p { margin: 0; }
.board-summary strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.board-summary .bar.wide { width: 96px; flex: none; }
.board-summary.has-overdue p { color: var(--ink); }

/* Lists boards: fixed-width lanes side by side, like lists on a table; a long list scrolls inside
   itself so its "+ Add a card" stays in reach. */
.board-lists { grid-auto-columns: 272px; align-items: start; }
.board-lane { padding: 8px; gap: 6px; max-height: calc(100dvh - 210px); grid-template-rows: auto minmax(0, 1fr) auto; background: var(--lane); border-color: transparent; }
.board-lane .board-list { overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.board-lane .board-empty { padding: 4px 6px; }
.lane-head { display: flex; align-items: center; gap: 4px; min-width: 0; }
.lane-head h2 { flex: 1; min-width: 0; }
.lane-name { all: unset; cursor: pointer; padding: 4px 6px; border-radius: 6px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lane-name:hover { background: var(--hover); }
.lane-name:focus-visible { outline: 2px solid var(--sap); outline-offset: 0; }
.lane-menu { flex: none; }
.lane-new { background: none; border: 1px dashed var(--bark); min-height: 0; max-height: none; grid-template-rows: auto; }
.lane-new .board-add { justify-self: stretch; text-align: left; }
.lane-starter { justify-self: start; }
.board-add-box { display: grid; gap: 6px; }
.board-add-acts { display: flex; gap: 6px; }
.board-card.is-done .board-title { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-soft) 60%, transparent); }
.board-card .chips { flex-wrap: wrap; overflow: visible; }
.board-has-notes { display: inline-flex; }
.board-has-notes svg { width: 14px; height: 14px; }
/* Where a carried card would land: a line above the card it goes before, or at the list's end. */
.board-card.drop-before { box-shadow: 0 -5px 0 -2px var(--sap); }
.board-list.drop-end { box-shadow: 0 5px 0 -2px var(--sap); }
.board-lane.drop { border-color: var(--sap); }
@media (max-width: 899px) {
  .board, .board-lists { grid-auto-columns: 85%; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 12px; scroll-padding: 0 16px; }
  .board-lane { max-height: calc(100dvh - 250px); }
  .board-bar { gap: 10px; }
  .board-col { scroll-snap-align: start; }
}
.ccard .meta { overflow: hidden; }
.ccard .meta .chips { flex: 0 0 auto; max-width: 62%; }
.ccard .meta .bar { width: auto; flex: 0 1 56px; min-width: 0; } /* the bar gives way before label names do */
.ccard .meta .chip { min-width: 0; flex-shrink: 1; }
.rail-settings + .rail-settings { margin-top: 0; }
.panel-labels .chips { flex-wrap: wrap; overflow: visible; }
.panel-labels .chip { max-width: 100%; }
.labels-section { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.labels-section h3 { flex-basis: 100%; }

.ccard.dimmed, .card.dimmed { background: transparent; border-color: color-mix(in srgb, var(--bark) 60%, transparent); }
.ccard.dimmed:hover, .ccard.dimmed.selected, .card.dimmed.selected { background: var(--card); }
.ccard.dimmed.selected, .card.dimmed.selected { border-color: var(--sap); }

/* When the details narrow the view, the header's tools shorten instead of stacking: labels that have
   an icon become icon-only (still named for screen readers), and "Add card inside" becomes "Add card". */
.view-top { container-type: inline-size; }
.tool-icon svg { width: 16px; height: 16px; flex: none; }
@container (max-width: 560px) {
  .view-head .tool-icon { padding-inline: 9px; }
  .view-head .tool-icon .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .view-head .tool-more { display: none; }
}
.view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: none; max-width: 100%; }
.filter-btn.on { border-color: var(--sap); color: var(--sap); font-weight: 600; }

dialog.labels-dialog { width: min(520px, calc(100vw - 32px)); }
.label-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.label-row { display: flex; align-items: center; gap: 4px; padding-right: 2px; border-radius: 8px; }
.label-row:hover, .label-row:focus-within { background: var(--hover); }
.label-row .label-pick:hover { background: none; }
.label-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--lab); }
.label-dot.big { width: 16px; height: 16px; }
.label-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.label-pick:hover { background: var(--hover); }
.label-pick input { width: 16px; height: 16px; accent-color: var(--sap); }
.label-pick .chip { max-width: 100%; font-size: 13px; }
.color-select { font-size: var(--t-xs); padding: 4px; border-radius: 6px; border: 1px solid var(--bark); background: var(--card); }
.new-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.new-label .prompt-input { flex: 1 1 180px; }
.swatches { display: inline-flex; gap: 4px; }
.swatch { position: relative; width: 22px; height: 22px; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--lab); box-shadow: 0 0 0 2px var(--card); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--lab); }
.swatch input:focus-visible + span { outline: 2px solid var(--sap); outline-offset: 3px; }
.hint { color: var(--ink-soft); font-size: var(--t-s); }

.prompt-input { width: 100%; padding: 8px 10px; border: 1px solid var(--bark); border-radius: 8px; background: var(--paper); }
.prompt-input:focus-visible { outline: none; border-color: var(--sap); }
.prompt-label { display: grid; gap: 6px; font-size: var(--t-s); font-weight: 600; }

.mi-check { display: grid; place-items: center; color: var(--sap); padding-left: 12px; }
.mi-check svg { width: 16px; height: 16px; }
.menu .menu-chip .mi-label:empty { display: none; }

/* ---------- groves ---------- */

.grove-switch {
  display: grid; width: 100%; margin: 0 0 12px; padding: 7px 10px; text-align: left;
  border: 1px solid var(--bark); border-radius: 9px; background: var(--card);
}
.grove-switch:hover { border-color: var(--sap); }
.grove-label { font-size: var(--t-xs); color: var(--ink-soft); }
.grove-name { font-weight: 600; font-size: var(--t-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grove-name::after { content: " ▾"; color: var(--ink-soft); font-weight: 400; }
.grove-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.grove-list li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; }
.grove-list li.active { background: var(--sap-wash); }
.grove-row-name { flex: 1; min-width: 0; display: grid; }
.grove-row-name strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grove-row-name span { font-size: var(--t-xs); color: var(--ink-soft); }
.grove-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.grove-pick .btn { width: 100%; justify-content: flex-start; }

/* ---------- automations ---------- */

dialog.automations-dialog { width: min(640px, calc(100vw - 32px)); }
.rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rule { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--bark); border-radius: 9px; background: var(--card); }
.rule p { flex: 1; margin: 0; color: var(--ink); }
.rule.off p { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--bark); }
.switch { position: relative; width: 34px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--bark); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); transition: transform .15s var(--ease); }
.switch input:checked + span { background: var(--sap); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--sap); outline-offset: 2px; }
.rule-form { display: grid; gap: 8px; }
.rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule-word { width: 44px; font-weight: 600; color: var(--ink-soft); }
/* Twig's own dropdown (stands in for <select>) */
.dropdown {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 34px; padding: 5px 8px 5px 10px;
  border: 1px solid var(--bark); border-radius: 9px; background: var(--card); font-size: var(--t-s); font-weight: 500; text-align: left;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.dropdown:hover { background: var(--hover); border-color: color-mix(in srgb, var(--bark) 50%, var(--ink-soft)); }
.dropdown[aria-expanded="true"] { border-color: var(--sap); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sap) 22%, transparent); }
.dropdown .mi-icon, .dropdown .mi-icon svg { width: 16px; height: 16px; }
.dropdown-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-chev { width: 14px; height: 14px; flex: none; color: var(--ink-soft); }

/* settings: a choice between options */
.choices { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.choices legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--bark); border-radius: 10px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--sap); background: var(--sap-wash); }
.choice input { margin: 4px 0 0; accent-color: var(--sap); }
.choice > span { display: grid; }
.choice strong { font-weight: 600; }
.choice > span > span { font-size: var(--t-s); color: var(--ink-soft); }
.rule-arg { display: inline-flex; align-items: center; gap: 6px; }
.rule-preview { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--paper); color: var(--ink); font-size: var(--t-s); }
.rule-actions { display: flex; justify-content: flex-end; }

/* ---------- the selection bar ---------- */

.sel-bar {
  position: absolute; left: 0; top: 0; z-index: 7;
  display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--card); border: 1px solid var(--bark); border-radius: 12px; box-shadow: var(--float);
  visibility: hidden; opacity: 0;
  transition: opacity .12s var(--ease), visibility 0s linear .12s;
}
.sel-bar.shown { visibility: visible; opacity: 1; transition: opacity .12s var(--ease); }
.sel-bar.shown.easing { transition: opacity .12s var(--ease), transform .26s var(--ease); }
.canvas.gliding .sel-bar.shown { transition: opacity .12s var(--ease), transform .3s var(--ease); }
.canvas.panning .sel-bar { pointer-events: none; }
.sel-group { display: flex; gap: 2px; }
.sel-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--bark); }
.sel-btn {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--ink-soft);
}
.sel-btn svg { width: 18px; height: 18px; }
.sel-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.sel-btn[aria-pressed="true"] { background: var(--sap-wash); box-shadow: inset 0 0 0 1.5px var(--sap); }
.sel-btn:disabled { opacity: .4; }
.sel-btn:focus-visible { outline-offset: -2px; border-radius: 8px; }
.sel-tip {
  position: absolute; left: 0; top: 0; z-index: 9;
  display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 7px;
  background: var(--ink); color: var(--paper); font-size: var(--t-xs); font-weight: 600; white-space: nowrap;
}
.sel-tip kbd { background: none; color: inherit; font-weight: 500; padding: 0 4px; border-color: color-mix(in srgb, var(--paper) 40%, transparent); }

/* first-visit tip: a strip under the board, never over its cards */
.board-hint {
  flex: none; margin: 0; display: flex; align-items: center; gap: 6px;
  padding: 4px 16px 4px 28px; border-top: 1px solid var(--bark);
  background: var(--card); font-size: var(--t-xs); color: var(--ink-soft);
}
.board-hint .icon-btn { width: 28px; height: 28px; flex: none; font-size: var(--t-m); }

/* settings: a switch with its name and help */
.pref { display: flex; align-items: flex-start; gap: 12px; margin: 2px 0 16px; }
.pref .switch { margin-top: 2px; }
.pref p { margin: 0; }
.pref-name { font-weight: 600; color: var(--ink); }
.pref-help { font-size: var(--t-s); color: var(--ink-soft); }

/* ---------- canvas cards: label strips, title, notes, then a footer with the status pill and badges ---------- */

.ccard { justify-content: flex-start; padding: 10px 10px 9px 12px; border-radius: 12px; }
.ccard.root { border-radius: 14px; }
.ccard:not(.selected, .lifted, .drop-inside, .drop-invalid):hover { box-shadow: 0 1px 2px rgba(28, 35, 30, .08), 0 10px 22px -10px rgba(28, 35, 30, .28); }
.ccard .strips { display: flex; gap: 4px; flex: none; margin: 1px 0 7px; }
.ccard .strip { width: 34px; height: 6px; border-radius: 3px; background: var(--lab); }
.ccard-head { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
.ccard .title { padding: 1px 2px 0; }
.ccard .title-edit { margin-top: 0; }
.ccard .excerpt { margin: 2px 0 0 2px; padding-right: 14px; } /* clear of the count button on the edge */
.ccard .excerpt.short { -webkit-line-clamp: 1; }
/* The foot clips what doesn't fit, so it reaches 4px into the card's padding: a focus ring on its
   first or last button stays whole. Move (Inbox) never gives way; the status words and dates do. */
.ccard .foot { display: flex; align-items: center; gap: 8px; min-height: 26px; margin: auto -4px -4px; padding: 6px 4px 4px; overflow: hidden; }
.ccard .foot .file-btn { flex: none; }
.ccard .foot .pill { flex-shrink: .001; min-width: 24px; } /* gives way only once the dates have */
.ccard .foot .pill-text { min-width: 0; overflow: hidden; white-space: nowrap; }
.ccard .foot .due-chip { overflow: hidden; text-overflow: ellipsis; }
.ccard .foot .due-chip, .ccard .foot .later-chip { flex: 0 1 auto; min-width: 0; }
.ccard .foot .later-chip { overflow: hidden; }
.pill {
  --pill: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 24px; padding: 0 10px 0 8px;
  border: 0; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--pill); background: color-mix(in srgb, var(--pill) 14%, transparent);
  transition: background .12s;
}
.pill:hover:not(:disabled) { background: color-mix(in srgb, var(--pill) 24%, transparent); }
.pill svg { width: 14px; height: 14px; flex: none; }
.pill.s-todo { --pill: var(--lab-slate); }
.pill.s-doing { --pill: var(--lab-amber); }
.pill.s-done { --pill: var(--sap); }
.pill.s-none { background: none; box-shadow: inset 0 0 0 1px var(--bark); font-weight: 500; opacity: .8; }
.ccard:hover .pill.s-none, .ccard.selected .pill.s-none { opacity: 1; }
/* A card with no status shows just the ring; the words come back on the selected card. */
.ccard:not(.selected) .pill.s-none { width: 24px; padding: 0; justify-content: center; }
.ccard:not(.selected) .pill.s-none .pill-text { display: none; }
.ccard .foot .bar { flex: 0 1 40px; min-width: 16px; }
.pill:disabled { cursor: default; }
.badge { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.badge svg { width: 14px; height: 14px; }
.badge.complete { color: var(--sap); font-weight: 600; }
.ccard .foot .file-btn { margin-left: auto; }
.ccard.is-done .title { color: var(--ink-soft); }

/* settings: AI assistants */
.assist-status { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--paper); color: var(--ink) !important; font-size: var(--t-s); }
.connect-how h4, .assist-log h4 { margin: 12px 0 4px; }
.code-row { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 10px; }
.code {
  flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--bark); border-radius: 8px; background: var(--paper);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.connect-how details summary { cursor: pointer; color: var(--ink-soft); font-size: var(--t-s); }
.assist-log ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--t-s); }

/* outline cards share the softer look */
.card { border-radius: 10px; }
.card.root { border-radius: 14px; }
.card:not(.selected):hover { box-shadow: 0 1px 2px rgba(28, 35, 30, .06), 0 8px 18px -10px rgba(28, 35, 30, .22); }

/* ---------- touch: every control takes a 44 px tap ---------- */

/* Where a control must stay small to keep cards light, an invisible margin around it takes the
   tap (centred, except where neighbours would share it: then it leans away from them). Where
   a control's own box clips (crumbs, menus) or controls sit side by side (toolbars), it grows. */
/* Installed as an app: pulling down at the top must not reload the page (a website keeps it). */
@media (display-mode: standalone) {
  html, body { overscroll-behavior-y: none; }
}

@media (pointer: coarse) {
  .chev, .status, .icon-btn, .pill, .btn, .toast button, .seg button, .shape-switch a, .dropdown { position: relative; }
  :where(.chev, .status, .icon-btn, .pill, .grow, .btn, .toast button, .seg button, .shape-switch a, .dropdown)::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
  }
  .chev::after { left: auto; right: 0; width: 44px; transform: translateY(-50%); }
  /* on a board card, ⋯ (top right) and the count button (right edge) lean apart */
  .ccard .more::after { top: auto; bottom: 0; transform: translateX(-50%); }
  .grow::after { top: 0; left: auto; right: -20px; transform: none; } /* down and out, clear of File */
  .ccard .foot { overflow: visible; } /* else it would clip the status pill's margin */
  .crumbs a, .crumbs button { min-width: 44px; padding: 12px 6px; margin: -10px 0; text-align: center; } /* the margin keeps the row's height */
  .crumbs { row-gap: 20px; } /* so wrapped lines of crumbs don't cover each other */
  .menu button, .menu .menu-chip { min-height: 44px; }
  .sel-btn { width: 44px; height: 44px; }
  .canvas-btn { min-width: 44px; height: 44px; }
  .places a, .rail-settings { min-height: 44px; }
}

@media (forced-colors: active) {
  .pill { border: 1px solid CanvasText; }
  .sel-btn[aria-pressed="true"], .menu .menu-chip.checked { outline: 2px solid Highlight; }
  .ccard.selected { outline: 2px solid Highlight; }
}

/* ---------- Later (put off) ---------- */

.later-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.later-chip svg { width: 13px; height: 13px; }
/* A put-off card stays in its place, quieter: its words take the soft ink (fading them fell under
   4.5:1), its controls don't change. */
.card:has(> .meta > .later-chip) > .title, .card:has(> .meta > .later-chip) > .excerpt,
.ccard:has(.foot > .later-chip) .title, .board-card:has(.later-chip) .board-title { color: var(--ink-soft); }
.later-box:empty { display: none; }
.later-group { margin: 18px 0 8px; }
.later-group summary { cursor: pointer; font-size: var(--t-s); color: var(--ink-soft); padding: 6px 0; width: fit-content; }
.later-group summary:focus-visible { outline: 2px solid var(--sap); outline-offset: 2px; border-radius: 4px; }
.later-group .agenda-list { margin-top: 6px; }
.later-row { grid-template-columns: minmax(0, 1fr) auto auto; }

/* ---------- Flow mode ---------- */

.flow { max-width: 40rem; margin-inline: auto; } /* one task, in the middle of the screen */
.flow-kicker { margin: 0; font-size: var(--t-s); color: var(--ink-soft); }
.flow-timer { display: inline-flex; align-items: center; gap: 6px; }
.flow-clock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--sap); }
.flow-card { margin-top: 8px; padding: 22px 22px 18px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--bark), var(--shadow); }
.flow-count { margin: 0 0 6px; font-size: var(--t-s); color: var(--ink-soft); }
.flow-path { margin: 0 0 4px; font-size: var(--t-s); color: var(--ink-soft); overflow-wrap: anywhere; }
.flow-title { margin: 0 0 10px; font-size: var(--t-xl); line-height: 1.3; overflow-wrap: anywhere; }
.flow-title:focus, .flow-end h2:focus { outline: none; }
.flow-title:focus-visible, .flow-end h2:focus-visible { outline: 2px solid var(--sap); outline-offset: 4px; border-radius: 4px; }
.flow-notes { margin: 14px 0 4px; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.flow-finished { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 4px; }
.flow-finished li { display: flex; align-items: center; gap: 6px; }
.flow-finished svg { width: 16px; height: 16px; color: var(--sap); }
@media (max-width: 600px) {
  .flow-card { padding: 16px; }
  .flow-actions .btn.primary { flex: 1 1 100%; justify-content: center; }
}

/* ---------- Archive ---------- */

.archived-link { gap: 6px; color: var(--ink-soft); margin-left: auto; }
.archive-list .what strong { overflow-wrap: anywhere; }

/* ---------- Card links ---------- */

.card-link { display: inline; padding: 0 6px; margin: 0 1px; border: 1px solid var(--bark); border-radius: 6px; background: var(--sap-wash); color: var(--ink); font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.card-link:hover { border-color: var(--sap); }
.card-link:focus-visible { outline: 2px solid var(--sap); outline-offset: 1px; }
.card-link.trashed { background: none; color: var(--ink-soft); }
.card-link-note { font-size: 12px; }
s.card-link.missing { border-style: dashed; background: none; color: var(--ink-soft); cursor: default; }
.notes-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.link-pick { position: static; margin: 4px 0 0; }
.mentioned-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

/* ---------- Sort the Inbox ---------- */

.sort-card { margin-top: 8px; padding: 22px 22px 18px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--bark), var(--shadow); }
.sort-notes { margin: 0 0 6px; color: var(--ink-soft); overflow-wrap: anywhere; }
.sort-h { margin: 16px 0 8px; font-size: var(--t-s); color: var(--ink-soft); }
.sort-homes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sort-home { width: 100%; min-height: 48px; justify-content: flex-start; gap: 10px; white-space: normal; text-align: left; }
.sort-home kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--bark); font-size: 12px; color: var(--ink-soft); }
.sort-home-text { display: grid; min-width: 0; }
.sort-home-text strong { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 600px) { .sort-card { padding: 16px; } }

/* ---------- Tend ---------- */

.tend-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--sap); vertical-align: middle; }
.tend-dot[hidden] { display: none; }
.tend-section .hint { margin-top: 0; }
.tend-done { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tend-done li { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.tend-done svg { color: var(--sap); flex: none; }
.tend-when { margin-left: auto; color: var(--ink-soft); font-size: var(--t-xs); white-space: nowrap; }
.tend-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0; }
.linkish { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.linkish:hover { text-decoration: underline; }
/* The phone's More sheet: rows like the rail's places, a full finger tall. */
.more-list { display: grid; margin: 0 0 12px; border: 1px solid var(--bark); border-radius: 10px; background: var(--card); overflow: hidden; }
.more-row {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px;
  border: 0; border-top: 1px solid var(--bark); background: none; color: inherit;
  font-size: var(--t-m); text-align: left; text-decoration: none;
}
.more-row:first-child { border-top: 0; }
.more-row:hover, .more-row:active { background: var(--hover); }
.more-row > span:first-child { flex: 1; }
.more-row .count { color: var(--ink-soft); font-size: var(--t-s); }
.more-row .more-value { color: var(--ink-soft); font-size: var(--t-s); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-row .tend-dot { margin: 0; }
.more-note { margin: 4px 2px 0; color: var(--ink-soft); font-size: var(--t-s); line-height: 1.5; }
@media (max-width: 899px) { .wide-only { display: none; } }
.tend .trash-item .what .linkish { display: block; font-weight: 500; }
.tend .trash-item .what span { display: block; }
.tend .trash-item .acts { flex-wrap: wrap; }

/* ---------- Icons and the bloom ---------- */

.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 14px; }
.icon-choice { aspect-ratio: 1; min-width: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; font-size: 20px; cursor: pointer; }
.icon-choice:hover { background: var(--hover); }
.icon-choice.current { box-shadow: inset 0 0 0 2px var(--sap); background: var(--sap-wash); }
.icon-own { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.icon-own input { width: 6em; margin-left: 6px; font-size: 18px; }
.icon-own + .pref-help.error-text { color: var(--danger); }
@media (max-width: 420px) { .icon-grid { grid-template-columns: repeat(5, 1fr); } }

.leaf-mark { display: inline-flex; align-items: center; color: var(--sap); }
.leaf-mark svg { width: 14px; height: 14px; }
.bloom .leaf-mark { animation: leaf-unfurl 600ms var(--ease) both; }
.bloom .bar > span { animation: bar-glow 600ms var(--ease); }
@keyframes leaf-unfurl { from { transform: scale(0.2) rotate(-60deg); opacity: 0; } 70% { transform: scale(1.35) rotate(8deg); opacity: 1; } to { transform: none; } }
@keyframes bar-glow { 50% { box-shadow: 0 0 0 3px var(--sap-wash); } }
@media (prefers-reduced-motion: reduce) { .bloom .leaf-mark, .bloom .bar > span { animation: none; } }

/* Fingers: every control a phone person taps is at least 44px tall, without changing how it looks
   (titles get invisible padding, cancelled out by margin). */
@media (pointer: coarse) {
  .agenda-tabs a, .shape-switch a, .seg button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .agenda-title, .lane-name { padding-block: 10px; margin-block: -10px; }
  .board-title { min-height: 40px; } /* clamped to 4 lines: padding would show a fifth */
  select.repeat-select, .board-add-input, .prompt-input, .due-inputs input, .calendar-form input { min-height: 44px; }
  details > summary { padding-block: 10px; }
  .board-move, .lane-menu { min-height: 44px; min-width: 44px; }
}

/* Today: the day's schedule (cards given a time, calendar events), Done today, the calendar in settings. */
.sched-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sched-row { display: grid; grid-template-columns: 8.75rem minmax(0, 1fr); align-items: center; gap: 10px; }
.sched-time { font-size: var(--t-xs); color: var(--ink-soft); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sched-event { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--bark); background: color-mix(in srgb, var(--card) 40%, transparent); color: var(--ink-soft); }
.sched-event svg { flex: none; width: 18px; height: 18px; }
.sched-title { min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.sched-row.is-past .sched-title { color: var(--ink-soft); }
.sched-note { margin: 8px 0 0; font-size: var(--t-xs); color: var(--ink-soft); }
.sched-note.problem, .pref-help.problem { color: var(--danger); }
.sched-note .btn { margin-left: 4px; }
.agenda-row.is-done .agenda-title { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--stem); }
.done-today { margin-top: 18px; }
.done-today > summary { cursor: pointer; width: fit-content; list-style-position: inside; }
.done-today > summary h2 { display: inline; margin: 0; }
.done-today .agenda-list { margin-top: 8px; }
.pick-next { margin-top: 4px; }
.pick-next h2 { font-size: var(--t-s); color: var(--ink-soft); margin: 18px 0 6px; }
.pick-next .agenda-where { font-size: var(--t-xs); color: var(--ink-soft); flex: 0 1 auto; }
.calendar-offer { margin-top: 18px; }
.calendar-form { display: grid; gap: 6px; margin: 10px 0 4px; }
.calendar-form label { font-weight: 600; font-size: var(--t-s); }
.calendar-form input { width: 100%; }
.calendar-help ul { margin: 6px 0 0; padding-left: 1.2em; font-size: var(--t-s); }
.calendar-help li + li { margin-top: 4px; }
.calendar-help > summary { cursor: pointer; font-size: var(--t-s); color: var(--sap); font-weight: 600; width: fit-content; }
.schedule-section .due-quick a.btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }
.schedule-section .due-quick a.btn svg { width: 16px; height: 16px; flex: none; }
@media (max-width: 640px) {
  .sched-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sched-time { text-align: left; padding-left: 4px; }
}
