/* Keel — ink on warm paper, one accent, no chrome.
   Tokens first; every colour in the app comes from this block. */

:root {
  --bg:          #faf9f7;
  --bg-raised:   #ffffff;
  --bg-sunken:   #f2f0ec;
  --bg-hover:    #f0eee9;
  --ink:         #1a1917;
  --ink-muted:   #6b6862;
  --ink-faint:   #9c9891;
  --line:        #e5e1da;
  --line-strong: #d3cec4;

  --accent:      #2f6f6a;
  --accent-ink:  #ffffff;
  --accent-soft: #e4efed;

  --danger:      #a83a2e;
  --danger-soft: #f7e9e7;

  --p1: #c4342a;
  --p2: #c07617;
  --p3: #3b6fa8;

  --shadow-pop: 0 6px 24px rgba(26, 25, 23, .11), 0 1px 2px rgba(26, 25, 23, .07);

  --radius: 6px;
  --radius-lg: 10px;
  --row-h: 38px;
  --sidebar-w: 240px;
  --measure: 760px;

  --font: system-ui, "Segoe UI Variable Text", "Segoe UI", -apple-system,
          BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", ui-monospace, Consolas, monospace;

  --speed: 120ms;
}

/* Dark from the same tokens: warm, not blue-black. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #171614;
    --bg-raised:   #1f1e1b;
    --bg-sunken:   #121110;
    --bg-hover:    #262421;
    --ink:         #edeae4;
    --ink-muted:   #a09b92;
    --ink-faint:   #74706a;
    --line:        #2e2c28;
    --line-strong: #423f3a;

    --accent:      #79b8b1;
    --accent-ink:  #10201f;
    --accent-soft: #21322f;

    --danger:      #e0796b;
    --danger-soft: #33211e;

    --p1: #e0776b;
    --p2: #d9a05b;
    --p3: #7ba7d6;

    --shadow-pop: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --bg:          #171614;
  --bg-raised:   #1f1e1b;
  --bg-sunken:   #121110;
  --bg-hover:    #262421;
  --ink:         #edeae4;
  --ink-muted:   #a09b92;
  --ink-faint:   #74706a;
  --line:        #2e2c28;
  --line-strong: #423f3a;

  --accent:      #79b8b1;
  --accent-ink:  #10201f;
  --accent-soft: #21322f;

  --danger:      #e0796b;
  --danger-soft: #33211e;

  --p1: #e0776b;
  --p2: #d9a05b;
  --p3: #7ba7d6;

  --shadow-pop: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
}

/* --- reset ------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised); color: var(--ink);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background var(--speed) ease, border-color var(--speed) ease;
}
.btn:hover { background: var(--bg-hover); }
.btn--primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn--primary:hover { filter: brightness(1.07); }
.btn--quiet {
  border-color: transparent; background: transparent; color: var(--ink-muted);
}
.btn--quiet:hover { background: var(--bg-hover); color: var(--ink); }

/* --- login ------------------------------------------------------------ */

.login-page { background: var(--bg-sunken); }

.login {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px 15vh;
  text-align: center;
}

.login__mark { color: var(--accent); margin-bottom: 14px; }

.login__title {
  font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2;
}

.login__sub { color: var(--ink-muted); margin-top: 4px; font-size: 13px; }

.login__form {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 260px; margin-top: 26px;
}

.login__input {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised);
  text-align: center;
}
.login__input:focus { outline: none; border-color: var(--accent); }

.login__button { height: 38px; }

.login__error {
  min-height: 20px; margin-top: 12px;
  color: var(--danger); font-size: 13px;
}

/* --- app shell -------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100%;
}

.sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg-sunken);
  padding: 14px 10px 10px;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 14px;
  color: var(--ink); font-weight: 600; letter-spacing: -.01em;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand svg { color: var(--accent); }

.sidebar__section { margin-top: 18px; }

.sidebar__heading {
  padding: 0 8px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint);
}

.nav__item {
  display: flex; align-items: center; gap: 9px;
  height: 30px; padding: 0 8px;
  border-radius: var(--radius);
  color: var(--ink-muted); font-size: 13.5px;
}
.nav__item:hover { background: var(--bg-hover); color: var(--ink); text-decoration: none; }
.nav__item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.nav__icon { display: flex; flex: 0 0 auto; opacity: .8; }
.nav__label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__count { flex: 0 0 auto; color: var(--ink-faint); font-size: 12px; }
.nav__item.is-active .nav__count { color: inherit; opacity: .75; }

.sidebar__foot {
  margin-top: auto; padding-top: 14px;
  display: flex; align-items: center; gap: 2px;
}
.sidebar__foot .btn { height: 28px; padding: 0 9px; font-size: 12.5px; }
.sidebar__theme [data-theme-icon] { display: none; }
:root[data-theme="dark"] .sidebar__theme [data-theme-icon="light"],
.sidebar__theme [data-theme-icon="dark"] { display: flex; }
:root[data-theme="dark"] .sidebar__theme [data-theme-icon="dark"] { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar__theme [data-theme-icon="dark"] { display: none; }
  :root:not([data-theme="light"]) .sidebar__theme [data-theme-icon="light"] { display: flex; }
}

/* --- main column ------------------------------------------------------ */

.main { overflow-y: auto; }

/* Nothing is typed on a list page any more, so the reading gets the room the
   capture box used to take. */
.main__inner {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 56px 32px 120px;
}

.page-head { margin-bottom: 30px; }
.page-head__title {
  font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25;
}
.page-head__sub { margin-top: 3px; color: var(--ink-muted); font-size: 13px; }

.group + .group { margin-top: 40px; }
.group__title {
  padding-bottom: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-faint);
}

.empty {
  padding: 28px 0;
  color: var(--ink-faint); font-size: 13.5px;
}

/* --- htmx progress ---------------------------------------------------- */

.progress {
  position: fixed; inset: 0 auto auto 0;
  height: 2px; width: 0;
  background: var(--accent);
  opacity: 0;
  transition: width 200ms ease, opacity 200ms ease;
  z-index: 50;
}
.progress.is-busy { width: 70%; opacity: 1; }
.progress.is-done { width: 100%; opacity: 0; transition: width 120ms ease, opacity 320ms ease; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- task rows --------------------------------------------------------- */

.tasks { border-top: 1px solid var(--line); }

.task {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  min-height: var(--row-h); padding: 12px 6px 12px 2px;
  border-bottom: 1px solid var(--line);
  scroll-margin: 80px;
}
.task:hover { background: var(--bg-hover); }
.task:focus { outline: none; }
.task:focus-visible { outline: none; }
.task:focus::before,
.task.is-selected::before {
  content: ""; position: absolute; inset: 0 -8px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  z-index: 0;
}
.task > * { position: relative; z-index: 1; }

.task__check {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 22px; padding: 0;
  border: 0; background: none; cursor: pointer;
}

.check {
  display: flex; align-items: center; justify-content: center;
  width: 17px; height: 17px;
  border: 1.6px solid var(--line-strong); border-radius: 50%;
  color: transparent;
  transition: background var(--speed) ease, border-color var(--speed) ease,
              color var(--speed) ease;
}
.check--p1 { border-color: var(--p1); background: color-mix(in srgb, var(--p1) 9%, transparent); }
.check--p2 { border-color: var(--p2); background: color-mix(in srgb, var(--p2) 9%, transparent); }
.check--p3 { border-color: var(--p3); background: color-mix(in srgb, var(--p3) 9%, transparent); }

.task__check:hover .check { border-color: var(--accent); color: var(--accent); }
.task.is-done .check {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}

.task__body { flex: 1 1 auto; min-width: 0; }

.task__content {
  display: block;
  color: var(--ink); font-size: 14px; line-height: 1.45;
  overflow-wrap: anywhere;
}
.task__content:hover { text-decoration: none; color: var(--accent); }
.task.is-done .task__content { color: var(--ink-faint); text-decoration: line-through; }

.task__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  margin-top: 4px;
}

/* --- chips ------------------------------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; line-height: 1.5;
  color: var(--ink-faint);
  white-space: nowrap;
}
.chip svg { opacity: .8; }
.chip--due.is-overdue { color: var(--danger); font-weight: 550; }
.chip--due.is-today { color: var(--accent); font-weight: 550; }
.chip--label { color: var(--ink-muted); }
.chip--label:hover { color: var(--accent); text-decoration: none; }
.chip--kind {
  padding: 0 6px; border-radius: 999px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  font-size: 11px; letter-spacing: .02em;
}
/* The four facts a row carries read as one set, so they sit together under the
   task rather than one of them being flung to the far margin. */
.chip--project { color: var(--ink-faint); }

/* --- toasts ------------------------------------------------------------ */

.toasts {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60; pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 12px 9px 14px;
  border-radius: var(--radius-lg);
  background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in 140ms ease-out;
}
.toast.is-leaving { opacity: 0; transition: opacity 200ms ease; }

.toast__undo {
  border: 0; background: none; padding: 0;
  color: inherit; font-weight: 600; text-decoration: underline;
  cursor: pointer; opacity: .85;
}
.toast__undo:hover { opacity: 1; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* --- quick add --------------------------------------------------------- */

/* --- the Hand Off page --------------------------------------------------
   The landing page and the only one with a box. Everything here is sized so
   the box is the thing your eye lands on and nothing competes with it. */

.handoff {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px 64px;
}
.handoff__inner { width: 100%; max-width: 620px; }

.handoff__title {
  margin: 0; text-align: center;
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink);
}
.handoff__sub {
  margin: 6px 0 28px; text-align: center;
  font-size: 13.5px; color: var(--ink-faint);
}

.handoff__form { margin: 0; }
.handoff__input {
  width: 100%; height: 54px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--bg-raised); color: var(--ink);
  font-size: 16px; font-family: inherit;
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}
.handoff__input::placeholder { color: var(--ink-faint); }
.handoff__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Lines the queue is still holding. Quiet, and almost never seen: it appears
   only when a send is failing, and says the line is waiting rather than lost. */
.handoff__pending {
  margin: 14px 0 0; text-align: center;
  font-size: 12px; color: var(--ink-faint);
}

/* What the last few captures became. Quiet: it is a receipt, not a list. */
.handed { margin: 26px 0 0; }
.handed__title {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-muted);
}
.handed__list { list-style: none; margin: 0; padding: 0; }
.handed__item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  animation: parse-in 160ms ease-out;
}
.handed__item:first-child { border-top: none; }

.handed__line { display: flex; align-items: baseline; gap: 6px; }
.handed__content {
  color: var(--ink); font-size: 14.5px; text-decoration: none;
}
.handed__content:hover { color: var(--accent); }
.handed__read { color: var(--ink-faint); cursor: help; line-height: 1; }

.handed__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* A chip that is also a control: it says what was decided, and opens the
   options on a click. Never on its own -- the box above has the focus.

   Readable, not decorative: these four chips *are* the answer Keel gave, so they
   carry a border and muted ink rather than the faint grey a passive chip uses. */
.handed__chips .chip { color: var(--ink-muted); }
.pop--chip { position: relative; display: inline-flex; }
.pop--chip > summary {
  padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; list-style: none;
  transition: border-color var(--speed) ease, color var(--speed) ease;
}
.pop--chip > summary::-webkit-details-marker { display: none; }
.pop--chip > summary:hover { color: var(--ink); border-color: var(--ink-faint); }
.pop--chip > summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.pop--chip[open] > summary { border-color: var(--accent); color: var(--ink); }

/* A row's popover hangs off the right edge; a chip's belongs under the chip. */
.pop--chip .pop__menu { left: 0; right: auto; }
.pop__menu--kind { min-width: 130px; }

.handoff__nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px;
  margin: 44px 0 0;
  font-size: 12.5px;
}
.handoff__nav a, .handoff__nav-btn {
  color: var(--ink-muted); text-decoration: none;
  background: none; border: none; padding: 0;
  font: inherit; cursor: pointer;
}
.handoff__nav a:hover, .handoff__nav-btn:hover { color: var(--accent); }

.chip--prio { font-weight: 600; }
.chip--prio.p1 { color: var(--p1); }
.chip--prio.p2 { color: var(--p2); }
.chip--prio.p3 { color: var(--p3); }

@keyframes parse-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}
}

/* --- task detail ------------------------------------------------------- */

.backlink {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 14px;
  color: var(--ink-faint); font-size: 12.5px;
}
.backlink:hover { color: var(--accent); text-decoration: none; }

.detail {
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
}

.detail__head { display: flex; align-items: flex-start; gap: 8px; }
.detail__check { margin-top: 3px; }
.check.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.detail__content {
  flex: 1 1 auto;
  border: 0; background: none; padding: 2px 0;
  font-size: 19px; font-weight: 550; line-height: 1.35; letter-spacing: -.01em;
  resize: none; overflow: hidden;
}
.detail__content:focus { outline: none; }
.detail__content.is-done { color: var(--ink-faint); text-decoration: line-through; }

.detail__description {
  padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 13.5px; line-height: 1.55; resize: vertical;
}
.detail__description:focus { outline: none; border-color: var(--accent); }

.fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-faint);
}
.field__input {
  height: 32px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised); font-size: 13px;
}
.field__input:focus { outline: none; border-color: var(--accent); }

.prio-group { display: flex; gap: 4px; }
.prio {
  display: flex; align-items: center; justify-content: center;
  height: 32px; flex: 1 1 0; min-width: 44px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 12px; font-weight: 600; color: var(--ink-faint);
  cursor: pointer;
}
.prio:hover { background: var(--bg-hover); }
.prio--p1.is-on { color: var(--accent-ink); background: var(--p1); border-color: var(--p1); }
.prio--p2.is-on { color: var(--accent-ink); background: var(--p2); border-color: var(--p2); }
.prio--p3.is-on { color: var(--accent-ink); background: var(--p3); border-color: var(--p3); }
.prio.is-on { color: var(--ink); border-color: var(--ink-faint); }
.prio:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.detail__note {
  display: flex; align-items: center; gap: 5px;
  color: var(--ink-muted); font-size: 12.5px;
}
.detail__actions { display: flex; align-items: center; gap: 8px; }
.detail__delete { margin-left: auto; color: var(--danger); }
.detail__delete:hover { background: var(--danger-soft); color: var(--danger); }

/* --- panels: subtasks, comments, links --------------------------------- */

.panel { margin-top: 26px; }
.panel__title {
  display: flex; align-items: center; gap: 6px; padding-bottom: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-faint);
}

.comments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.comment {
  padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-raised);
}
.comment__body { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.comment__foot {
  display: flex; align-items: center; gap: 8px; margin-top: 5px;
  color: var(--ink-faint); font-size: 11.5px;
}
.comment__delete {
  margin-left: auto; padding: 0 4px;
  border: 0; background: none; color: var(--ink-faint);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.comment__delete:hover { color: var(--danger); }

.comment-form { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.comment-form__input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised); font-size: 13.5px; line-height: 1.55; resize: vertical;
}
.comment-form__input:focus { outline: none; border-color: var(--accent); }

.links { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius);
}
.link:hover { background: var(--bg-hover); }
.link__kind { color: var(--ink-faint); display: flex; }
.link__label { font-size: 13.5px; }
.link__url {
  flex: 1 1 auto; min-width: 0;
  color: var(--ink-faint); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.link-form { display: flex; flex-wrap: wrap; gap: 6px; }
.link-form__label { flex: 1 1 130px; }
.link-form__url { flex: 2 1 220px; }
.link-form__kind { flex: 0 0 90px; }

.provenance {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 12px;
}
.provenance__raw { font-style: italic; }

/* --- keyboard help ----------------------------------------------------- */

.help { position: fixed; inset: 0; z-index: 80; display: flex;
        align-items: center; justify-content: center; }
.help[hidden] { display: none; }
.help__backdrop { position: absolute; inset: 0; background: rgba(20, 19, 17, .38); }

.help__panel {
  position: relative;
  width: min(420px, calc(100vw - 40px));
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
}

.help__title {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 12px;
}

.help__list { display: flex; flex-direction: column; gap: 7px; }
.help__list > div { display: flex; align-items: baseline; gap: 12px; }
.help__list dt { flex: 0 0 118px; display: flex; gap: 3px; }
.help__list dd { margin: 0; font-size: 13px; color: var(--ink-muted); }

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--bg-sunken);
  font: 500 11px/1 var(--font); color: var(--ink-muted);
}

.help__close { margin-top: 16px; width: 100%; }

/* --- the Projects page ------------------------------------------------- */
/* Rows, not cards: this is a list you edit in place, the same shape as a task
   list. The description sits under the name because it is the longer, softer
   half -- and because it is the half the capture parser actually reads. */

.panel__head { padding-bottom: 8px; }
.panel__head .panel__title { padding-bottom: 2px; }
.panel__note {
  max-width: 60ch;
  font-size: 12.5px; color: var(--ink-faint);
}

.tree { list-style: none; margin: 6px 0 0; padding: 0; }

/* The tree nests to any depth (Plan v2), so the rows are one flat list and the
   indent comes from --depth. A rule per level would cap the depth in CSS. */
.tree__item { border-top: 1px solid var(--line); }
.tree__item:last-child { border-bottom: 1px solid var(--line); }
.tree__item .rowform { padding-left: calc(var(--depth, 0) * 20px); }

.rowform { padding: 8px 0; }
.rowform__line { display: flex; align-items: center; gap: 8px; }

.rowform__name, .rowform__desc, .rowform__parent {
  height: 30px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font-size: 13px; font-family: inherit;
}
.rowform__name { flex: 0 1 220px; font-weight: 550; }
.rowform__parent { flex: 0 0 auto; color: var(--ink-muted); }
.rowform__desc {
  display: block; width: 100%; margin-top: 2px;
  color: var(--ink-muted); font-size: 12.5px;
}
.rowform__name:hover, .rowform__desc:hover, .rowform__parent:hover {
  border-color: var(--line);
}
.rowform__name:focus, .rowform__desc:focus, .rowform__parent:focus {
  outline: none; border-color: var(--accent); background: var(--bg-raised);
}
.rowform__name[readonly] { color: var(--ink-muted); cursor: default; }
.rowform__name[readonly]:hover { border-color: transparent; }

.rowform__count { flex: 1 1 auto; text-align: right; color: var(--ink-faint); font-size: 12px; }
.rowform__fixed {
  color: var(--ink-faint); font-size: 12px; font-style: italic;
}

.btn--small { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* Buttons stay out of the way until the row is in play, like the row tools. */
.rowform .btn { opacity: 0; transition: opacity var(--speed) ease; }
.rowform:hover .btn, .rowform:focus-within .btn { opacity: 1; }
@media (hover: none) { .rowform .btn { opacity: 1; } }

.rowform--new { border-top: 1px solid var(--line); margin-top: 2px; }
.rowform--new .btn { opacity: 1; }
.rowform__error {
  margin-top: 12px; padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}

.sidebar__manage { color: inherit; }
.sidebar__manage:hover, .sidebar__manage.is-active { color: var(--accent); text-decoration: none; }

/* --- editing in place, from a list row ---------------------------------- */
/* Out of the way until the row is in play. A <details> popover rather than a
   menu widget: it opens with a click or the keyboard and needs no script. */

.task { position: relative; }

.task__tools {
  display: flex; align-items: center; gap: 2px;
  margin-left: 6px;
  opacity: 0;
  transition: opacity var(--speed) ease;
}
.task:hover .task__tools,
.task:focus-within .task__tools,
.task__tools:has([open]) { opacity: 1; }

/* No hover to reveal them with, so leave them out. */
@media (hover: none) { .task__tools { opacity: 1; } }

.pop { position: relative; }
.pop__btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--radius);
  color: var(--ink-faint);
  cursor: pointer; list-style: none;
}
.pop__btn::-webkit-details-marker { display: none; }
.pop__btn:hover { background: var(--bg-hover); color: var(--ink); }
.pop[open] .pop__btn { background: var(--bg-hover); color: var(--ink); }

.pop__menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 168px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--bg-raised); box-shadow: var(--shadow-pop);
  animation: parse-in 120ms ease-out;
}
.pop__menu--prio { min-width: 92px; }
.pop__menu--due { min-width: 210px; }
.pop__row { display: flex; flex-wrap: wrap; gap: 4px; }
.pop__row .pop__item { flex: 1 1 auto; text-align: center; }

.pop__item {
  padding: 5px 8px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font-size: 12.5px; font-family: inherit; text-align: left;
  cursor: pointer;
}
.pop__item:hover { background: var(--bg-hover); }
.pop__item.is-on { border-color: var(--line-strong); font-weight: 600; }
.pop__item--p1 { color: var(--p1); }
.pop__item--p2 { color: var(--p2); }
.pop__item--p3 { color: var(--p3); }

.pop__input {
  width: 100%; height: 30px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-raised); color: var(--ink);
  font-size: 13px; font-family: inherit;
}
.pop__input:focus { outline: none; border-color: var(--accent); }

.detail__hint { color: var(--ink-faint); font-size: 12.5px; }
