:root {
  color-scheme: light dark;
  --bg: #f3f5f1;
  --panel: #fff;
  --ink: #16241c;
  --muted: #526359;
  --line: #d5ddd5;
  --field-line: #879688;
  --accent: #176047;
  --on-accent: #fff;
  --tint: #e2f1e8;
  --danger: #9a3423;
  --error-bg: #ffebe5;
  --priority: #745008;
  --focus: #176047;
  font: 100%/1.45 system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151e18;
    --panel: #1d2921;
    --ink: #edf3eb;
    --muted: #bac9bc;
    --line: #3a4b3e;
    --field-line: #829587;
    --accent: #a2e3bf;
    --on-accent: #173726;
    --tint: #293f31;
    --danger: #ffad9e;
    --error-bg: #412721;
    --priority: #f4ce85;
    --focus: #a2e3bf;
  }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.6rem, 5vw, 2.25rem); letter-spacing: -.035em; line-height: 1.15; }
h2 { font-size: 1.125rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.shell { width: min(100% - 1.75rem, 56rem); margin-inline: auto; }
.skip { position: absolute; left: .75rem; top: .5rem; padding: .75rem; background: var(--panel); z-index: 1; }
.skip:not(:focus) { clip-path: inset(50%); }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner, .page-heading, .actions, .filter-row { display: flex; align-items: center; gap: .625rem; }
.topbar-inner, .page-heading { justify-content: space-between; }
.topbar-inner { min-height: 3.75rem; }
.brand { color: var(--ink); font-weight: 750; text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; }
.brand-mark { display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: .5rem; background: var(--accent); color: var(--on-accent); }
main { display: grid; align-content: start; gap: 1rem; padding-block: 1rem 3rem; }
.tabs { display: flex; gap: .25rem; padding: .25rem; background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; width: fit-content; max-width: 100%; }
.tabs a { min-height: 44px; padding: .5rem .75rem; display: grid; place-items: center; text-decoration: none; color: var(--muted); font-weight: 650; text-align: center; }
.tabs [aria-current] { border-radius: .5rem; background: var(--tint); color: var(--accent); }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.counts div, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; padding: .875rem; }
.counts div { display: flex; flex-direction: column-reverse; padding: .55rem .625rem; }
.counts dd { font-size: 1.4rem; font-weight: 730; font-variant-numeric: tabular-nums; }
.counts dt { font-size: .875rem; }
.counts a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); }
.capture h2, .editor h1 { margin-bottom: .55rem; }
.stack { display: grid; gap: .625rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.actions { flex-wrap: wrap; }
label { display: grid; gap: .25rem; font-weight: 600; }
input:not([type=hidden]), select, textarea { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--field-line); border-radius: .45rem; background: var(--panel); padding: .5rem .625rem; }
textarea { resize: vertical; }
.actions select { width: auto; max-width: 100%; }
.primary, .button, .quiet { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-height: 44px; padding: .45rem .75rem; border: 1px solid transparent; border-radius: .5rem; font-weight: 650; text-decoration: none; }
.primary { background: var(--accent); color: var(--on-accent); }
.button { background: var(--panel); border-color: var(--field-line); color: var(--ink); }
.quiet { background: transparent; color: var(--accent); }
.page-heading a { flex-shrink: 0; min-height: 44px; align-content: center; }
.filter-row { align-items: end; }
.filter-row label { min-width: 0; flex: 1; }
.filter-row label:first-child { max-width: 10rem; }
.filters details { border-bottom: 1px solid var(--line); padding-bottom: .25rem; }
.filters details > .actions { margin-block: .625rem; }
summary { min-height: 44px; align-content: center; cursor: pointer; color: var(--accent); }
.task-list, .metadata { list-style: none; margin: 0; padding: 0; }
.task-list { margin-block: .75rem; background: var(--panel); border: 1px solid var(--line); border-radius: .75rem; }
.task { display: flex; align-items: center; padding: .5rem .5rem .5rem .25rem; gap: .35rem; }
.task + .task { border-top: 1px solid var(--line); }
.task-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task-title { color: var(--ink); font-weight: 675; text-decoration: none; }
.task-title:hover, .edit-link:hover { text-decoration: underline; }
.task-action, .edit-link { min-height: 44px; min-width: 44px; display: inline-grid; place-items: center; color: var(--accent); background: transparent; border: 0; padding: .25rem; text-decoration: none; }
.checkbox { display: block; width: 1.25rem; height: 1.25rem; border: 1.5px solid var(--field-line); border-radius: .3rem; }
.task-action:hover .checkbox { background: var(--tint); border-color: var(--accent); }
.edit-link, .metadata { font-size: .875rem; }
.metadata { display: flex; flex-wrap: wrap; gap: .1rem .65rem; margin-top: .2rem; color: var(--muted); }
.overdue, .danger { color: var(--danger); }
.priority { color: var(--priority); }
.muted, .empty { color: var(--muted); }
.empty { padding-block: 1rem; }
.message { padding: .65rem .875rem; border-radius: .5rem; background: var(--tint); color: var(--ink); }
.error { background: var(--error-bg); color: var(--danger); }
.editor { width: min(100%, 37rem); margin-inline: auto; }
.back { width: fit-content; padding-block: .5rem; }
.delete-form, .taxonomy-row { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.taxonomy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .75rem; }
.taxonomy p, blockquote { overflow-wrap: anywhere; }

@media (max-width: 34rem) {
  .taxonomy { grid-template-columns: minmax(0, 1fr); }
  .tabs { width: 100%; }
  .tabs a { flex: 1; }
  .filter-row { flex-wrap: wrap; }
  .filter-row label { flex-basis: 33%; }
}
