/* ---------- Tokens ---------- */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sidebar: #eef0f3;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --primary: #3b5bdb;
  --primary-contrast: #ffffff;
  --danger: #d6336c;
  --ok: #2f9e44;
  --warn: #e67700;
  --c-inbox: #1d8cf8;
  --c-today: #f2b200;
  --c-upcoming: #e8484d;
  --c-anytime: #2aa198;
  --c-someday: #b39a5b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --gutter: 16px;
  --topbar-h: 53px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1b1f27;
    --sidebar: #161a21;
    --text: #e6e8ec;
    --muted: #9aa3b2;
    --border: #2b313c;
    --primary: #6d8bff;
    --primary-contrast: #0d1020;
    --danger: #f06595;
    --ok: #51cf66;
    --warn: #ffa94d;
    --shadow: none;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.danger-text { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.inline { display: inline; }
[hidden] { display: none !important; }
.push-right { margin-left: auto; }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; height: var(--topbar-h); }
.topbar-inner {
  height: 100%; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 12px;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 14px; align-items: center; margin-left: auto; }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; white-space: nowrap; }
.linklike:hover { color: var(--text); }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-btn { display: none; cursor: pointer; color: var(--text); padding: 6px; margin-left: -6px; border-radius: 8px; }
/* On wide screens: collapse / expand the sidebar (narrow screens use .nav-toggle-btn) */
.sidebar-toggle-btn {
  display: inline-flex; cursor: pointer; color: var(--muted); background: none; border: 0;
  padding: 6px; margin-left: -6px; border-radius: 8px;
}
.sidebar-toggle-btn:hover { color: var(--text); background: var(--bg); }
body.sidebar-hidden .sidebar-toggle-fill { display: none; }
@media (max-width: 899px) { .sidebar-toggle-btn { display: none; } }
.nav-toggle-btn:hover { background: var(--bg); }
.nav-backdrop { display: none; }

/* ---------- App layout: sidebar + main ---------- */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.main {
  container: main / inline-size;
  min-width: 0;
  width: 100%;
  max-width: 1400px;
  padding: 24px clamp(var(--gutter), 3vw, 40px) 48px;
}
.main-solo { margin: 0 auto; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 10px 32px;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.side-group { margin-bottom: 12px; }
.side-heading {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
summary.side-heading { cursor: pointer; list-style: revert; justify-content: flex-start; gap: 4px; }
.side-area { margin-top: 4px; font-weight: 700; }
.side-area-projects { margin-left: 14px; padding-left: 4px; border-left: 1px solid var(--border); }
.side-shared { font-size: .7rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 3.5px 10px; border-radius: 6px; color: var(--text); font-weight: 500; line-height: 1.35;
}
.side-link:hover { text-decoration: none; background: color-mix(in srgb, var(--text) 6%, transparent); }
.side-link.active { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.side-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-count-today {
  color: #fff; background: var(--c-upcoming); border-radius: 999px; padding: 0 7px; font-weight: 700; font-size: .75rem;
}
.side-empty { padding: 0 10px; margin: 4px 0; }
.side-due { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: .72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.side-due svg { width: 11px; height: 11px; }
.side-due.deadline-today, .side-due.deadline-overdue { color: var(--danger); }
.side-bottom { border-top: 1px solid var(--border); padding-top: 10px; }
.scope-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.scope-switch a { padding: 5px 12px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.scope-switch a:hover { text-decoration: none; color: var(--text); }
.scope-switch a.active { background: var(--primary); color: var(--primary-contrast); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }

@media (max-width: 899px) {
  .nav-toggle-btn { display: inline-flex; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    display: none;
    position: fixed; z-index: 15; left: 0; top: var(--topbar-h); bottom: 0;
    width: min(300px, 85vw); height: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  }
  .nav-toggle:checked ~ .app .sidebar { display: block; }
  .nav-toggle:checked ~ .app .nav-backdrop {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 14; background: rgba(0, 0, 0, .3);
  }
  .topnav { gap: 10px; }
  .topnav .linklike { font-size: .85rem; }
  h1 { font-size: 1.35rem; }
}

@media (max-width: 480px) {
  .who { display: none; }
  .topbar-inner { gap: 8px; }
}

/* ---------- List icons ---------- */
.list-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.list-icon svg { width: 100%; height: 100%; }
.list-icon-inbox { color: var(--c-inbox); }
.list-icon-today { color: var(--c-today); }
.list-icon-upcoming { color: var(--c-upcoming); }
.list-icon-anytime { color: var(--c-anytime); }
.list-icon-someday { color: var(--c-someday); }
.list-icon-logbook { color: var(--ok); }
.list-title { display: flex; align-items: center; gap: 10px; }
.list-title .list-icon { width: 28px; height: 28px; }
.star { color: var(--c-today); font-size: .9em; }

/* Area colour palette (Area.Color). Each class sets --area-c; .has-color applies it. */
.c-gray { --area-c: var(--muted); }
.c-red { --area-c: #e5484d; }
.c-orange { --area-c: #f76b15; }
.c-yellow { --area-c: #c99400; }
.c-green { --area-c: #30a46c; }
.c-teal { --area-c: #12a594; }
.c-blue { --area-c: #0b78e3; }
.c-indigo { --area-c: #3e63dd; }
.c-purple { --area-c: #8e4ec6; }
.c-pink { --area-c: #d6409f; }
@media (prefers-color-scheme: dark) {
  .c-red { --area-c: #ff6369; }
  .c-orange { --area-c: #ff8b3e; }
  .c-yellow { --area-c: #ffd23f; }
  .c-green { --area-c: #4cc38a; }
  .c-teal { --area-c: #0bd8b6; }
  .c-blue { --area-c: #52a9ff; }
  .c-indigo { --area-c: #849dff; }
  .c-purple { --area-c: #bf7af0; }
  .c-pink { --area-c: #f986c9; }
}
.area-icon.has-color, .proj-icon.has-color { color: var(--area-c); }
.area-icon .area-icon-fill { fill: color-mix(in srgb, currentColor 14%, transparent); }
.area-icon.has-color .area-icon-fill { fill: color-mix(in srgb, var(--area-c) 25%, transparent); }
.proj-box.has-color { border-color: var(--area-c); }
.proj-box.has-color:hover { color: var(--area-c); background: color-mix(in srgb, var(--area-c) 12%, transparent); }
.proj-box.has-color.checked { background: var(--area-c); border-color: var(--area-c); color: #fff; }

/* Colour picker in the area form */
.swatch-field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.swatch-field legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch-dot {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  background: var(--area-c); border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--surface);
}
.swatch input:checked + .swatch-dot { border-color: var(--text); }
.swatch input:focus-visible + .swatch-dot { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Project / area icons */
.proj-icon, .area-icon { display: inline-flex; width: 18px; height: 18px; flex: none; color: var(--primary); }
.proj-icon svg, .area-icon svg { width: 100%; height: 100%; }
.proj-icon.is-done { color: var(--muted); }
.area-icon { color: var(--muted); }
.list-title .area-icon { width: 28px; height: 28px; }

/* Clickable project circle (complete / reopen) – round, so it reads differently from a todo's
   square checkbox. With "show progress" a pie inside fills up as the todos get done. */
.proj-box {
  position: relative; display: inline-grid; place-items: center;
  width: 22px; height: 22px; flex: none; padding: 0; cursor: pointer;
  border: 2.2px solid var(--primary); border-radius: 50%; background: transparent;
  color: transparent; font-weight: 800; font-size: .8rem; line-height: 1;
}
.proj-pie { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--primary); pointer-events: none; }
/* In the checkbox the ring is the border and the pie sits inside it: enlarged so the gap is narrow (~1.5px). */
.proj-box .proj-pie { transform: scale(1.32); }
.proj-box.has-color .proj-pie { color: var(--area-c); }
.proj-mark { position: relative; }
.proj-box:hover .proj-pie { opacity: .25; }
.proj-box.is-static:hover .proj-pie { opacity: 1; }
.proj-box.checked .proj-pie, .proj-box.cancelled .proj-pie { display: none; }
.btn .proj-icon { width: 16px; height: 16px; margin-right: 4px; color: currentColor; }
.proj-box:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.proj-box.is-static { display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.proj-box.is-static:not(.checked):not(.cancelled):hover { color: transparent; background: transparent; }
.proj-box.checked { background: var(--primary); color: var(--primary-contrast); }
.proj-box.cancelled { border-color: var(--muted); background: var(--border); color: var(--muted); }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title .proj-box { width: 26px; height: 26px; font-size: .95rem; }
.detail-title .tcheck { width: 24px; height: 24px; font-size: .85rem; border-width: 2px; }

/* ---------- Page bits ---------- */
.page-head { display: flex; gap: 8px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { margin: 0 0 .25rem; color: var(--muted); font-size: .9rem; }
.project-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: .25rem 0 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; line-height: 1.5; padding: 1px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .85rem; }
.chip-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.detail-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@container main (min-width: 980px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
.form-card { max-width: 760px; }
.auth-card { max-width: 420px; margin: 32px auto; }
.list-intro { margin: 0 0 12px; }
.list-foot { margin: 16px 0 0; }
.empty { padding: 12px 0; }
.group-head { display: flex; align-items: center; gap: 8px; margin-top: 1.4rem; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.card > .group-head:first-child { margin-top: 0; }
.group-head a { color: var(--text); }
.group-head.group-area { font-size: 1rem; color: var(--text); border-bottom-width: 2px; margin-top: 2.8rem; } /* a new area starts with a wider gap */
.group-day { font-size: 1.4rem; color: var(--text); letter-spacing: 0; }
.date-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
.quick-add { display: flex; gap: 8px; margin-bottom: 12px; }
.quick-add input { flex: 1; min-width: 0; }

/* ---------- Messages ---------- */
.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.msg { padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); margin-bottom: 8px; }
.msg-success { border-left-color: var(--ok); }
.msg-error { border-left-color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; min-height: 38px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--primary); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-small { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
.btn.is-on { border-color: var(--primary); color: var(--primary); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .9rem; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); border-color: var(--primary); }
.help { color: var(--muted); }
.help ul { margin: 4px 0 0; padding-left: 18px; }
.error, .form-errors { color: var(--danger); }
.form-errors ul { margin: 0 0 12px; padding-left: 18px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

.grid-form { display: grid; grid-template-columns: 1fr; column-gap: 16px; }
@container main (min-width: 600px) {
  .grid-form { grid-template-columns: 1fr 1fr; }
  .grid-form .field-wide { grid-column: 1 / -1; }
}

/* Toolbar under a "Todos" card head: how the board is organised, and filters. */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; }
.filters { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; }
.filters label { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.filters select { width: auto; min-width: 120px; padding: 4px 8px; font-size: .85rem; }

/* ---------- Badges / progress ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--bg); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge-open { color: var(--primary); }
.badge-in_progress { color: var(--warn); }
.badge-done { color: var(--ok); }
.progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress span { display: block; height: 100%; background: var(--ok); }

/* ---------- Project rows (projects inside Today / Upcoming) ---------- */
/* Same geometry as .todo-item so project and todo rows line up in mixed lists. */
.project-rows { list-style: none; margin: 0 0 4px; padding: 0; }
.project-row { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 3px 6px; border-radius: 7px; }
.project-row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.project-row .proj-box { width: 20px; height: 20px; border-width: 2px; font-size: .7rem; }
.project-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; color: var(--text); }
.project-row-main:hover { text-decoration: none; }
.project-row-main:hover .project-name { color: var(--primary); }
.project-row.is-done .project-name { color: var(--muted); }
.completed-projects { margin-top: 12px; }
.completed-projects summary { cursor: pointer; padding: 4px 0; }
.chip .area-icon { width: 14px; height: 14px; }
.project-name { font-weight: 600; }
.project-meta { color: var(--muted); font-size: .8rem; }
.todo-item-container .area-icon, .todo-item-container .proj-icon { width: 12px; height: 12px; }
.todo-item-container { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Things-style todo rows (project / area pages) ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-item { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 3px 6px; border-radius: 7px; }
.todo-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.todo-item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1.02rem; }
.todo-item-main:hover { text-decoration: none; }
.todo-item-text { display: flex; flex-direction: column; min-width: 0; }
.todo-item-title { min-width: 0; overflow-wrap: anywhere; }
.todo-item-sub { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; }
.todo-item-sub .proj-icon, .todo-item-sub .area-icon { width: 12px; height: 12px; color: currentColor; }
.todo-item-sub .proj-icon.has-color, .todo-item-sub .area-icon.has-color { color: var(--area-c); }
.todo-item.is-done .todo-item-title { color: var(--muted); }
/* Today: items finished today stay in the list until the day ends, struck out. */
.mixed-list .todo-item.is-done .todo-item-title, .mixed-list .project-row.is-done .project-name { text-decoration: line-through; }
.todo-item.is-cancelled .todo-item-title { text-decoration: line-through; }
.when-chip {
  flex: none; padding: 1px 7px; border-radius: 5px; font-size: 0.7rem; font-weight: 700; white-space: nowrap;
  background: color-mix(in srgb, var(--text) 12%, transparent); color: color-mix(in srgb, var(--text) 80%, transparent);
}
/* After the title, in its line: as tall as a capital letter (the page fills ¾ of the icon's box). */
.note-icon { display: inline-block; width: 1em; height: 1em; vertical-align: -.12em; color: var(--muted); }
.note-icon svg { display: block; width: 100%; height: 100%; }
.todo-item-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.deadline { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.deadline svg { width: 14px; height: 14px; }
.deadline-today, .deadline-overdue { color: var(--danger); }
.avatar.avatar-sm { width: 22px; height: 22px; font-size: .7rem; }
.tcheck {
  flex: none; width: 20px; height: 20px; padding: 0; cursor: pointer; border-radius: 5px;
  border: 1.5px solid color-mix(in srgb, var(--text) 45%, transparent); background: transparent;
  color: transparent; font-weight: 800; font-size: .75rem; line-height: 1;
}
.tcheck:hover { border-color: var(--primary); color: var(--primary); }
.tcheck.checked { background: var(--primary); border-color: var(--primary); color: #fff; }
.tcheck.cancelled { background: var(--border); border-color: var(--border); color: var(--muted); }
/* In progress: orange edge, lower half filled (like the ◐ status icon). */
.tcheck.in-progress {
  border-color: var(--warn);
  background: linear-gradient(to top, color-mix(in srgb, var(--warn) 75%, transparent) 50%, transparent 50%);
}
.tcheck.in-progress:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--warn) 18%, transparent); }
/* Narrow: the dates, comments etc. stay next to the title while there is room; only when less than
   ~6rem would be left for the title do they move to a line of their own (on the right). */
@container main (max-width: 560px) {
  .todo-item, .project-row { flex-wrap: wrap; row-gap: 2px; }
  .todo-item-main, .project-row-main { flex: 1 1 0; min-width: 6rem; }
  .todo-item-meta { margin-left: auto; gap: 8px; }
}

.is-cancelled .project-name { text-decoration: line-through; color: var(--muted); font-style: italic; }
@container main (max-width: 720px) {
  .card { padding: 16px; }
  .filters select { min-width: 0; }
}

/* ---------- Inline editing (project page) ---------- */
.project-head { min-width: 0; }
.inline-edit > summary { list-style: none; cursor: pointer; border-radius: 6px; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit > summary:hover { background: color-mix(in srgb, var(--text) 7%, transparent); outline: 4px solid color-mix(in srgb, var(--text) 7%, transparent); }
.inline-edit > summary.chip:hover { outline: 0; border-color: var(--muted); }
.inline-edit[open] > summary { display: none; }
.inline-edit-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inline-edit-form input[type=text], .inline-edit-form input[type=date], .inline-edit-form select { width: auto; padding: 5px 9px; font-size: .9rem; }
.inline-edit-form .inline-edit-title-input { font: inherit; font-size: 1.4rem; font-weight: 700; padding: 2px 8px; min-width: min(420px, 60vw); }
.inline-edit-block > summary { display: block; padding: 2px 4px; margin: 0 -4px; }
.inline-edit-form-block { display: block; }
.inline-edit-form-block textarea { width: 100%; }
.chip-add { border-style: dashed; color: var(--muted); }
/* Notes sit right under the page title (project, area and todo pages) */
.notes-top { margin: -4px 0 20px; max-width: 80ch; }
.notes-top .inline-edit-form-block { max-width: none; }
/* Markdown notes with an in-place editor */
.inline-notes { position: relative; }
.notes-view[data-opens-editor] { cursor: text; border-radius: 8px; padding: 4px 6px; margin: -4px -6px 8px; }
.notes-view[data-opens-editor]:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.inline-notes:has(.notes-editor[open]) .notes-view { display: none; }
.notes-editor > summary.notes-edit-btn { display: inline-block; color: var(--muted); font-size: .8rem; padding: 0 4px; margin-left: -4px; }
.notes-editor > summary.notes-edit-btn:hover { color: var(--text); outline: 0; }
.notes-editor > summary.notes-add { font-size: .95rem; padding: 2px 6px; margin-left: -6px; }
.notes-editor[open] > summary { display: none; }
.detail-title .inline-edit { min-width: 0; }

/* Todo page */
.todo-page { max-width: 860px; }
.todo-page .card + .form-card-follow, .todo-page .page-head + .card { margin-top: 0; }
.detail-title.is-done .inline-edit > summary { color: var(--muted); }
.chip-status { font-weight: 600; }
.chip .avatar { width: 18px; height: 18px; font-size: .62rem; margin-left: -5px; }
.chip .proj-icon, .chip .area-icon { width: 14px; height: 14px; }
.todo-meta-line { margin: 14px 0 0; }

/* ---------- Date picker (When / Due) ---------- */
.date-btn { font: inherit; border: 0; background: none; padding: 0; cursor: pointer; flex: none; }
/* The When chip keeps its grey background (.date-btn would clear it). */
button.date-btn.when-chip { padding: 1px 7px; background: color-mix(in srgb, var(--text) 12%, transparent); }
/* .date-btn takes the row's font; the When chip keeps its own, smaller size. */
button.date-btn.when-chip { font-size: .7rem; font-weight: 700; line-height: 1.45; }
/* The checkbox's form in a row: no line box around the box (it sat 1.5px low), so box and When chip,
   both centred in the row, share their middle. */
.todo-item > form:has(> .tcheck) { display: flex; }
button.date-btn:hover { filter: brightness(1.15); text-decoration: underline; text-underline-offset: 3px; }
button.date-btn.deadline { color: var(--muted); font-size: inherit; }
button.date-btn.deadline.deadline-today, button.date-btn.deadline.deadline-overdue { color: var(--danger); }
.date-picker {
  position: fixed; z-index: 50; width: 292px; padding: 10px 12px 12px;
  background: color-mix(in srgb, var(--surface) 92%, var(--text)); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.dp-title { text-align: center; font-weight: 700; color: var(--muted); font-size: .85rem; margin-bottom: 4px; }
.dp-option {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.dp-option:hover, .dp-option:focus-visible { background: color-mix(in srgb, var(--primary) 22%, transparent); outline: 0; }
.dp-clear { color: var(--muted); font-weight: 500; margin-top: 4px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 2px; }
.dp-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.dp-nav { border: 0; background: none; color: var(--text); font-size: 1.2rem; line-height: 1; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.dp-nav:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.dp-nav:disabled { opacity: .25; cursor: default; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }
.dp-day {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; line-height: 1;
}
.dp-day small { font-size: .55rem; font-weight: 700; color: var(--primary); text-transform: uppercase; }
.dp-day:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.dp-day:focus-visible, .dp-day:focus { outline: 0; background: var(--primary); color: var(--primary-contrast); }
.dp-day:focus small { color: inherit; }
.dp-day.dp-today { color: var(--c-today); font-size: 1.05rem; }
.dp-day.dp-today:focus { color: var(--primary-contrast); }
.dp-day.dp-selected:not(:focus) { box-shadow: inset 0 0 0 2px var(--primary); }
.dp-empty { aspect-ratio: 1; }

/* ---------- Keyboard shortcuts ---------- */
.todo-item.is-selected, .project-row.is-selected {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}
@media (min-width: 900px) {
  body.sidebar-hidden .app { grid-template-columns: minmax(0, 1fr); }
  body.sidebar-hidden .sidebar { display: none; }
}
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 5px; border-radius: 5px; text-align: center;
  font: 600 .78rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border: 1px solid var(--border); border-bottom-width: 2px; color: var(--text);
}
.side-shortcuts { color: var(--muted); font-size: .85rem; }
.side-shortcuts kbd { min-width: 20px; }
.shortcuts-help {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.shortcuts-help::backdrop { background: rgba(0, 0, 0, .45); }
.shortcuts-help h2 { margin: 0 0 4px; }
.shortcuts-close { position: absolute; top: 14px; right: 14px; }
.shortcut-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 28px; margin: 8px 0; }
.shortcut-groups h3 { margin: 14px 0 6px; }
.shortcut-groups dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; align-items: baseline; }
.shortcut-groups dt { white-space: nowrap; }
.shortcut-groups dd { margin: 0; font-size: .88rem; }

/* ---------- Comments ---------- */
.detail-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.form-card-follow { margin-top: 20px; }
.comments h2 { margin-bottom: 4px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:target { background: color-mix(in srgb, var(--c-today) 10%, transparent); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.comment-actions { margin-left: auto; display: flex; gap: 6px; }
.comment-form { margin-top: 16px; }
.comment-form textarea { min-height: 96px; resize: vertical; }
.comment-count { font-size: .8rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.comment-count:hover { text-decoration: none; color: var(--text); }
.md-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.md-preview-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.md-help summary { cursor: pointer; }
.md-help-body { margin-top: 6px; line-height: 1.9; }

/* Rendered Markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 .6em; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1.05rem; margin: .8em 0 .4em; color: var(--text); text-transform: none; letter-spacing: 0; }
.md h1 { font-size: 1.25rem; }
.md ul, .md ol { padding-left: 1.4em; }
.md code { font: .88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.md pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { border: 0; padding: 0; background: none; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--muted); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md img { max-width: 100%; height: auto; }
.md hr { border: 0; border-top: 1px solid var(--border); }

/* ---------- People ---------- */
.people { list-style: none; padding: 0; margin: 0 0 12px; }
.people li { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
/* A placeholder's avatar: click (or tap, or Tab + Space) to upload a photo of them; ✕ removes it. */
.placeholder-photo { position: relative; display: inline-flex; flex: none; }
.placeholder-photo-pick { display: inline-flex; cursor: pointer; border-radius: 50%; }
.placeholder-photo-pick:hover .avatar { box-shadow: 0 0 0 2px var(--primary); }
.placeholder-photo-pick:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.placeholder-photo-remove {
  position: absolute; top: -5px; right: -7px; width: 16px; height: 16px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .6rem; line-height: 1;
  cursor: pointer; opacity: 0;
}
.placeholder-photo:hover .placeholder-photo-remove, .placeholder-photo-remove:focus-visible { opacity: 1; }
@media (hover: none) { .placeholder-photo-remove { opacity: 1; } }
.avatar {
  overflow: hidden;
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); font-weight: 700; font-size: .8rem; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-img { background: none; }
.avatar.avatar-xl { width: 88px; height: 88px; font-size: 2rem; }
.topbar-user { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.topbar-user:hover { color: var(--text); text-decoration: none; }
.profile-head { display: flex; align-items: center; gap: 16px; margin: 16px 0 20px; }
.profile-name { font-size: 1.15rem; font-weight: 700; }
.avatar-form input[type=file] { font: inherit; color: var(--text); }
.profile-section { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 22px; }
.profile-section > p { margin: -6px 0 12px; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent);
  color: var(--muted); font-size: .74rem; font-weight: 600; line-height: 1.55;
  background: none; font-family: inherit; white-space: nowrap;
}
button.tag { cursor: pointer; }
button.tag:hover { color: var(--text); border-color: var(--text); }
.tag-inherited { border-style: dashed; opacity: .8; }
.tag-big { font-size: .9rem; padding: 2px 12px; cursor: pointer; list-style: none; color: var(--text); }
.tag-big::-webkit-details-marker { display: none; }
.tag-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: 1px; margin-left: 4px; }
.tag-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.tag-chips .chip-add { cursor: pointer; font-family: inherit; }
.tag-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tag-filter {
  padding: 2px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .82rem; font-weight: 600;
}
.tag-filter:hover { text-decoration: none; color: var(--text); }
.tag-filter.active { background: var(--muted); border-color: var(--muted); color: var(--surface); }

.tag-tree { list-style: none; margin: 12px 0 0; padding: 0; }
.tag-node {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 6px 6px 6px calc(6px + var(--depth, 0) * 24px); border-bottom: 1px solid var(--border);
}
.tag-node:last-child { border-bottom: 0; }
.tag-node:not([style*="--depth: 0"])::before { content: "└"; color: var(--muted); margin-right: -4px; }
.tag-node .inline-edit[open] { flex-basis: 100%; }
.tag-node-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.tag-node-actions select { max-width: 12rem; }
.tag-add select { max-width: 12rem; }

/* ---------- Choice picker (shares the look of .date-picker) ---------- */
.choice-picker { width: 280px; }
.cp-filter {
  width: 100%; margin: 2px 0 6px; padding: 6px 9px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem;
}
.cp-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; outline: 0; }
.cp-group { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 8px 2px; }
.cp-option {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px calc(8px + var(--depth, 0) * 16px);
  border-radius: 7px; cursor: pointer; font-size: .92rem;
}
.cp-option:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.cp-option.is-active { background: var(--primary); color: var(--primary-contrast); }
.cp-option.is-active .proj-icon, .cp-option.is-active .area-icon { color: inherit; }
.cp-option.is-active .status-icon { box-shadow: 0 0 0 1.5px var(--primary-contrast); }
.cp-label { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-label .proj-icon, .cp-label .area-icon { width: 15px; height: 15px; flex: none; }
.cp-label .list-icon { width: 15px; height: 15px; }
.cp-check { width: 16px; height: 16px; flex: none; border: 1.5px solid currentColor; border-radius: 4px; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700; opacity: .8; }
.cp-current { font-weight: 700; }
.cp-create { color: var(--primary); font-weight: 600; }
.cp-create.is-active { color: var(--primary-contrast); }
.cp-empty { padding: 8px; font-size: .85rem; list-style: none; }
.cp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
/* Status mark = a small todo checkbox (.tcheck), so columns and pickers look like the items. */
.status-icon {
  display: inline-grid; place-items: center; flex: none; width: 14px; height: 14px; border-radius: 4px;
  border: 1.5px solid color-mix(in srgb, var(--text) 45%, transparent); background: var(--surface);
  color: #fff; font-size: .55rem; font-weight: 800; line-height: 1;
}
.status-icon.status-in_progress {
  border-color: var(--warn);
  background: linear-gradient(to top, color-mix(in srgb, var(--warn) 75%, transparent) 50%, var(--surface) 50%);
}
.status-icon.status-done { background: var(--primary); border-color: var(--primary); }
.status-icon.status-cancelled { background: var(--border); border-color: var(--border); color: var(--muted); }
.avatar-none { background: none !important; border: 1.5px dashed var(--muted); color: var(--muted); }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; display: inline-flex; border-radius: 999px; }
.avatar-btn:hover .avatar { outline: 2px solid var(--primary); outline-offset: 1px; }
summary[data-choice-picker] { cursor: pointer; }

/* ---------- Quick find ---------- */
.quick-find {
  width: min(640px, calc(100vw - 32px)); max-height: min(70vh, 600px); margin: 10vh auto auto;
  padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.quick-find[open] { display: flex; flex-direction: column; }
.quick-find::backdrop { background: rgba(0, 0, 0, .35); }
.quick-find form { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.quick-find form .list-icon { color: var(--muted); }
.quick-find input {
  flex: 1; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.15rem; outline: 0; min-width: 0;
}
.qf-results { overflow-y: auto; padding: 0 10px; }
.qf-results:empty { display: none; }
.qf-results .group-head:first-child { margin-top: 10px; }
.qf-results .empty { padding: 8px 6px; }
.qf-hint { margin: 0; padding: 8px 16px; border-top: 1px solid var(--border); }
.side-search .list-icon { color: var(--muted); }
.list-icon-search, .list-icon-tags { color: var(--muted); }
.search-form input[type=search] { flex: 1; }

/* ---------- Board (Kanban) ---------- */
/* Todos card head: title on the left, then sort / layout switches and the add button on the right. */
.card-head:has(.sort-control, .layout-switch) { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.card-head h2 + .sort-control, .card-head h2 + .layout-switch { margin-left: auto; }
.page-head .sort-control { margin-left: auto; align-self: center; }
.page-head .scope-toggle { margin-left: auto; }
.page-head .scope-toggle + .sort-control { margin-left: 0; }
/* "Sort" in front of the sort choices. */
.sort-control { display: inline-flex; align-items: center; gap: 6px; }
.sort-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
/* List / Board icons */
.layout-switch a { display: inline-flex; align-items: center; gap: 5px; }
.layout-icon { width: 14px; height: 14px; flex: none; }
[data-sortable] > [data-item] { cursor: grab; }
[data-sortable] > [data-item].is-dragging { opacity: .4; }
.board { display: grid; grid-template-columns: repeat(var(--board-cols, 3), minmax(0, 1fr)); gap: 12px; align-items: start; }
.board.board-assignee { grid-template-columns: repeat(var(--board-cols, 3), minmax(200px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
.board-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-head .list-icon { width: 15px; height: 15px; }
.board-overdue-icon { color: var(--danger); font-weight: 700; }
.board-col[data-no-drop].is-drop-target { border-color: transparent; }
@container main (max-width: 720px) {
  .board { grid-template-columns: 1fr; }
}
.board-col {
  background: color-mix(in srgb, var(--text) 4%, transparent); border-radius: var(--radius);
  padding: 8px; min-height: 120px; border: 2px dashed transparent; transition: border-color .1s;
}
.board-col.is-drop-target { border-color: var(--primary); }
.board-head { display: flex; align-items: center; gap: 6px; margin: 2px 4px 8px; font-size: .82rem; }
.board-head .muted { margin-left: auto; font-weight: 600; }
.board-list { display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.board-list .todo-item.board-card {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  flex-wrap: wrap; align-items: flex-start; padding: 8px; cursor: grab;
}
.board-list .todo-item.board-card .todo-item-main { font-size: .95rem; }
.board-list .todo-item.board-card .todo-item-meta { flex-basis: 100%; justify-content: flex-end; }
.board-card.is-dragging { opacity: .45; }
.board-more { margin: 6px 4px 0; }
/* The board needs the full width: the People box moves below it. */
.detail-grid.detail-grid-board { grid-template-columns: minmax(0, 1fr); }
.board-list .todo-item.board-card .todo-item-main { flex: 1 1 8rem; }
.tag-node-actions label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.form-picker { cursor: pointer; font-family: inherit; justify-self: start; align-self: start; padding: 4px 12px; font-size: .92rem; }
.field .form-picker { margin-top: 2px; }

/* ---------- Placeholder people (no account) ---------- */
.avatar.avatar-placeholder { background: none; border: 1.5px dashed var(--muted); color: var(--muted); }
.badge-placeholder { border: 1px dashed var(--muted); background: none; color: var(--muted); }

/* ---------- Someday ---------- */
.chip-someday { color: var(--c-someday); border-color: color-mix(in srgb, var(--c-someday) 45%, transparent); }
.chip .list-icon { width: 14px; height: 14px; }
button.someday-chip { color: var(--c-someday); }
.dp-someday { color: var(--c-someday); }
.dp-someday-icon { width: 15px; height: 15px; vertical-align: -2px; }
.dp-option.is-current { box-shadow: inset 0 0 0 2px var(--primary); }
.area-someday { margin-top: 14px; }

/* Sidebar: areas can be dragged into your own order. */
.side-area-block.is-dragging { opacity: .4; }
.side-area-block > .side-area { cursor: grab; }

.comment-icon { width: 14px; height: 14px; flex: none; vertical-align: -2px; }
.comment-count { display: inline-flex; align-items: center; gap: 3px; }
.btn .comment-icon { width: 16px; height: 16px; margin-right: 2px; }

.tag-more { position: relative; }
.tag-more > summary { list-style: none; cursor: pointer; }
.tag-more > summary::-webkit-details-marker { display: none; }
.tag-more-list {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 200px; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; padding: 6px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.tag-more-item { display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; border-radius: 6px; color: var(--text); font-size: .88rem; }
.tag-more-item:hover { background: color-mix(in srgb, var(--text) 8%, transparent); text-decoration: none; }

/* ---------- Read-only (someone else's project) ---------- */
.lock-icon { width: 13px; height: 13px; flex: none; vertical-align: -2px; }
.chip-readonly { border-style: dashed; color: var(--muted); cursor: default; }
.chip-readonly .lock-icon { opacity: .75; }
.readonly-note {
  /* A plain block (not flex), so the text and the bold name flow as one paragraph. */
  display: block; margin: 10px 0 0; padding: 8px 12px; max-width: 70ch;
  border-radius: 8px; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); font-size: .88rem;
}
.readonly-note .lock-icon { margin-right: 6px; }
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--surface); font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  display: flex; align-items: center; gap: 8px;
}

/* Sidebar: collapsible areas. The chevron sits at the right of the area row. */
.side-area-block { position: relative; }
.side-collapse {
  position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; opacity: .55;
}
.side-collapse:hover, .side-collapse:focus-visible { opacity: 1; background: color-mix(in srgb, var(--text) 8%, transparent); }
.side-collapse svg { width: 16px; height: 16px; transition: transform .15s; }
.side-area-block.is-collapsed .side-collapse svg { transform: rotate(-90deg); }
.side-area-block.is-collapsed .side-area-projects { display: none; }
.side-area-block .side-area { padding-right: 30px; }
.side-collapsed-count { display: none; margin-left: auto; font-size: .75rem; font-weight: 600; color: var(--muted); }
.side-area-block.is-collapsed .side-collapsed-count { display: inline; }

/* Sent in the background, waiting for the server (live.js). */
[data-item].is-pending { opacity: .7; transition: opacity .2s; }
.toast[data-level="error"] { background: var(--danger); color: #fff; }

/* ---------- People (admins) ---------- */
.people-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.people-search { margin-left: auto; }
.people-search input { padding: 6px 10px; min-width: 14rem; }
.table-wrap { overflow-x: auto; }
.people-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.people-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.people-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.people-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.people-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.badge-admin { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
.list-icon-people { color: var(--muted); }

/* ---------- People box (project / area pages) ---------- */
.people-box .people li { display: flex; align-items: center; gap: 8px; }
.people-box .people-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-remove { margin-left: 2px; }
.icon-btn {
  border: 0; background: none; color: var(--muted); cursor: pointer; width: 24px; height: 24px; border-radius: 6px;
  display: inline-grid; place-items: center; font-size: .8rem;
}
.icon-btn:hover, .icon-btn:focus-visible { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.people-add { margin-top: 12px; display: grid; gap: 4px; }
.people-add-row { display: flex; gap: 6px; }
.people-add-row input { flex: 1; min-width: 0; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; }
.people-hint { margin: 10px 0 0; }

/* Anytime / Someday: project groups (heading + todos) that can be sorted and dragged. */
.project-groups > .project-group { cursor: auto; }
.project-group > .group-head { cursor: grab; }
.project-group > .group-head .date-hint { margin-left: auto; font-size: .8rem; }
.project-group.is-selected { background: none; box-shadow: none; }
.project-group.is-selected > .group-head {
  border-radius: 8px; background: color-mix(in srgb, var(--primary) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}
.project-group.is-dragging { opacity: .4; }
.card > .project-groups:first-child > .project-group:first-child > .group-head { margin-top: 0; }

/* Anytime / Someday: the heading icons (area box, project circle) sit in one column with the
   todo checkboxes below them, and the heading text lines up with the todo titles. */
.group-head-icon { gap: 10px; padding-left: 6px; }
.group-head-icon > .area-icon, .group-head-icon > .proj-icon, .group-head-icon > .list-icon { width: 20px; height: 20px; }
.group-empty { margin: 4px 0 8px; padding-left: 36px; } /* lines up with the titles */

/* Project / area pages: the side column with the People and Settings boxes. */
.detail-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
/* The buttons sit side by side and wrap; deleting and cancelling get their own row below a line. */
.settings-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.settings-box h2 { flex-basis: 100%; margin-bottom: 4px; }
.settings-box form { display: contents; }
.settings-box .btn { padding: 4px 10px; min-height: 30px; font-size: .85rem; } /* small, so two fit side by side */
.settings-box .btn .comment-icon, .settings-box .btn .proj-icon { width: 14px; height: 14px; }
.settings-danger { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.owner-fact { display: inline-flex; align-items: center; gap: 6px; }
.owner-fact .avatar { width: 20px; height: 20px; font-size: .65rem; }
.settings-box .readonly-note { flex-basis: 100%; margin: 0 0 4px; max-width: none; }
.filter-toggle svg { width: 14px; height: 14px; margin-right: 4px; }
.list-tools > .tag-bar { flex-basis: 100%; margin: 0; }
/* Board: a field at the bottom of a column to add a todo there (like the Inbox's quick add). */
.board-quick-add { margin-top: 6px; }
.board-quick-add input[type=text] {
  width: 100%; padding: 6px 8px; font-size: .88rem; border-radius: 8px;
  background: transparent; border: 1px dashed transparent; color: var(--text);
}
.board-quick-add input[type=text]::placeholder { color: var(--muted); }
.board-quick-add input[type=text]:hover { border-color: var(--border); }
.board-quick-add input[type=text]:focus { background: var(--surface); border-style: solid; }

/* ---------- Checklist (steps inside a todo) ---------- */
.checklist { margin: 14px 0 0; }
.checklist-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.checklist-item.is-dragging { opacity: .4; }
.check-handle { cursor: grab; color: var(--muted); opacity: 0; font-size: .85rem; width: 12px; user-select: none; }
.checklist-item:hover .check-handle { opacity: .7; }
.ccheck {
  flex: none; width: 16px; height: 16px; padding: 0; cursor: pointer; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--text) 40%, transparent); background: transparent;
  color: transparent; font-size: .6rem; font-weight: 800; line-height: 1;
}
.ccheck:hover { border-color: var(--primary); color: var(--primary); }
.ccheck.checked { background: var(--muted); border-color: var(--muted); color: var(--surface); }
.checklist-title-form { flex: 1; min-width: 0; }
.checklist-title-form input[type=text] {
  width: 100%; padding: 4px 6px; border: 1px solid transparent; background: transparent; border-radius: 6px; font-size: .95rem;
}
.checklist-title-form input[type=text]:hover { border-color: var(--border); }
.checklist-title-form input[type=text]:focus { background: var(--surface); }
.checklist-item.is-done .checklist-title-form input { color: var(--muted); text-decoration: line-through; }
.checklist-item .icon-btn { opacity: 0; }
.checklist-item:hover .icon-btn, .checklist-item .icon-btn:focus-visible { opacity: 1; }
.checklist-add { margin-top: 4px; padding-left: 20px; }
.checklist-count { display: inline-flex; align-items: center; gap: 3px; flex: none; color: var(--muted); font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.checklist-count svg { width: 14px; height: 14px; }
.checklist-count.is-complete { color: var(--ok); }

/* ---------- Headings: sections of a project's todos (as in Things) ---------- */
.heading-group.has-heading { margin-top: 18px; }
.heading-group.is-dragging { opacity: .4; }
.todo-heading {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
  padding-bottom: 3px; border-bottom: 1px solid var(--border);
}
.todo-heading-title, .heading-rename input.todo-heading-title {
  margin: 0; font-size: .95rem; font-weight: 700; color: var(--primary);
}
.heading-rename { flex: 1; min-width: 0; }
.heading-rename input.todo-heading-title {
  width: 100%; padding: 3px 6px; margin-left: -6px; border: 1px solid transparent; border-radius: 6px; background: transparent;
}
.heading-rename input.todo-heading-title:hover { border-color: var(--border); }
.heading-rename input.todo-heading-title:focus { background: var(--surface); color: var(--text); }
.heading-grip { cursor: grab; color: var(--muted); opacity: 0; font-size: .85rem; width: 12px; margin-left: -16px; user-select: none; }
.todo-heading:hover .heading-grip { opacity: .7; }
.heading-delete .linklike { opacity: 0; padding: 2px 6px; }
.todo-heading:hover .heading-delete .linklike, .heading-delete .linklike:focus-visible { opacity: 1; }
/* While a todo is dragged, empty sections become drop targets. */
.is-dragging-todo [data-section] > .todo-list:empty {
  min-height: 32px; border: 1px dashed var(--border); border-radius: 8px; margin-top: 4px;
}
/* Today and the next days of Upcoming: a quiet field below the day's todos. */
.day-quick-add .board-quick-add { margin-top: 0; }
.day-quick-add .board-quick-add input[type=text] { padding: 3px 8px; font-size: .84rem; }
.day-quick-add .board-quick-add input[type=text]:not(:focus)::placeholder { opacity: .55; }
.day-quick-add:hover .board-quick-add input[type=text]::placeholder { opacity: 1; }
/* Under each heading: quieter than the field below the list, it shows fully on hover / focus. */
.heading-quick-add .board-quick-add { margin-top: 0; }
.heading-quick-add .board-quick-add input[type=text] { padding: 3px 8px; font-size: .84rem; }
.heading-quick-add .board-quick-add input[type=text]:not(:focus)::placeholder { opacity: .55; }
.heading-group:hover .heading-quick-add .board-quick-add input[type=text]::placeholder { opacity: 1; }
.list-adds { display: flex; flex-wrap: wrap; gap: 0 12px; }
.list-adds .board-quick-add { flex: 1 1 200px; }
.list-adds .heading-add { flex: 0 1 220px; }
/* "Columns by [Status | Assignee | …]" above a board */
.board-mode { display: inline-flex; align-items: center; gap: 8px; }
.board-mode-label { color: var(--muted); font-size: .85rem; font-weight: 600; }

/* ---------- Reminders: a time on a todo's When date ---------- */
.bell-icon { width: 14px; height: 14px; flex: none; }
.reminder-time { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.chip-reminder { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; }
.dp-reminder {
  display: flex; align-items: center; gap: 6px; margin-top: 4px; padding: 6px 8px;
  border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); cursor: default;
}
.dp-reminder .dp-bell { width: 14px; height: 14px; }
.dp-time {
  margin-left: auto; padding: 3px 6px; font: inherit; color: var(--text);
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
}
.dp-time:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ---------- This Evening: the second part of Today ---------- */
.moon-icon { width: 14px; height: 14px; flex: none; color: #6b7bd6; }
.evening-section { margin-top: 18px; }
.evening-head { display: flex; align-items: center; gap: 6px; }
.evening-section.is-empty { display: none; }
.is-dragging-todo .evening-section.is-empty { display: block; } /* a place to drop while dragging */

/* ---------- The page's address (Settings box): one row of its own ---------- */
.settings-box .slug-form { flex-basis: 100%; display: flex; align-items: center; gap: 6px; }
.slug-form label { margin: 0 4px 0 0; white-space: nowrap; }
.slug-form .slug-prefix { white-space: nowrap; margin-right: -2px; }
.slug-form input[type=text] { flex: 0 1 35%; min-width: 8rem; padding: 3px 8px; min-height: 30px; font: inherit; font-size: .85rem; }

/* ---------- Calendar events (CalDAV) in Today, and the accounts on the profile page ---------- */
.calendar-events { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-event { display: flex; align-items: baseline; gap: 10px; padding: 1px 8px 1px 10px; border-left: 3px solid var(--cal-color, var(--muted)); margin: 2px 0; border-radius: 3px; line-height: 1.3; font-size: .92rem; }
.cal-time { flex: none; width: 6.5em; font-size: .8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-title { flex: 1; min-width: 0; }
.cal-where { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-failed { margin: 6px 0 0; }
.calendar-account { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.calendar-account-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calendar-account-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.calendar-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.calendar-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-size: .85rem;
}
.calendar-toggle.is-on { color: var(--text); border-color: color-mix(in srgb, var(--cal-dot, var(--primary)) 50%, var(--border)); }
.calendar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cal-color, var(--muted)); opacity: .35; }
.calendar-toggle.is-on .calendar-dot { opacity: 1; }
.calendar-add { margin-top: 10px; }
.calendar-add > summary { list-style: none; display: inline-flex; }
.calendar-add > summary::-webkit-details-marker { display: none; }
.check-label { display: inline-flex; align-items: center; gap: 6px; }
.cal-event.is-past { opacity: .45; }

/* ---------- API keys (profile page) ---------- */
.api-new-key { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--primary); border-radius: 8px; background: color-mix(in srgb, var(--primary) 8%, transparent); }
.api-new-key p { margin: 0 0 6px; }
.api-key { display: block; user-select: all; overflow-wrap: anywhere; font-size: .9rem; }
.api-tokens { list-style: none; margin: 10px 0; padding: 0; }
.api-tokens li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.api-token-name { font-weight: 600; }
.api-token-add { display: flex; gap: 8px; margin-top: 10px; }
.api-token-add input[type=text] { flex: 1; min-width: 0; }

/* ---------- Repeating todos ---------- */
.repeat-icon { width: 14px; height: 14px; flex: none; vertical-align: -2px; }
.repeat-mark { color: var(--muted); margin-right: 5px; }
/* As tall as a capital letter of the title (the arrows fill ¾ of the icon's box). */
.repeat-mark .repeat-icon { width: 1em; height: 1em; vertical-align: -.12em; }
.template-mark { display: inline-flex; color: var(--primary); margin-right: 4px; }
.template-mark .repeat-icon { width: 20px; height: 20px; }
.list-icon-repeating { color: var(--c-anytime); }
/* The repeat box on a copy's (or template's) page, as in Things: click it for the menu */
.repeat-box { position: relative; margin: 8px 0 6px; max-width: 34rem; }
.repeat-box > summary {
  list-style: none; display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  padding: 7px 10px; border-radius: 9px; background: color-mix(in srgb, var(--text) 7%, transparent);
}
.repeat-box > summary::-webkit-details-marker { display: none; }
.repeat-box > summary:hover, .repeat-box[open] > summary { background: color-mix(in srgb, var(--text) 11%, transparent); }
.repeat-box > summary .repeat-icon { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.repeat-box-text { display: flex; flex-direction: column; line-height: 1.3; font-size: .92rem; }
.repeat-box.is-paused .repeat-box-text { opacity: .7; }
.repeat-box-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 14rem; padding: 4px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.repeat-box-menu form { display: contents; }
.repeat-box-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
}
.repeat-box-item:hover, .repeat-box-item:focus-visible { background: color-mix(in srgb, var(--primary) 14%, transparent); text-decoration: none; }
.repeat-box-item .repeat-icon { color: var(--primary); }
.repeat-previews .repeat-preview { opacity: .7; }
.repeat-preview .tcheck.is-placeholder { border-style: dashed; cursor: default; }
.repeat-list { list-style: none; margin: 0 0 8px; padding: 0; }
.repeat-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.repeat-row .repeat-icon { color: var(--muted); }
.repeat-title { font-weight: 500; }
.repeat-rule { flex: 1; min-width: 10rem; }
.repeat-row.is-paused { opacity: .55; }
.repeat-bulk-actions { margin-top: 12px; align-items: center; }
.repeat-choice {
  position: fixed; z-index: 60; max-width: 22rem; padding: 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.repeat-choice p { margin: 0 0 10px; }
/* The Repeat form: only what the chosen mode and unit need */
.repeat-form .rf-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.repeat-form .rf-row input[type=number] { width: 5em; }
.repeat-form .rf-mode label { margin-right: 14px; }
.repeat-form .rf-days { display: flex; gap: 4px; flex-wrap: wrap; }
.repeat-form .rf-day { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; }
.repeat-form .rf-dates { display: flex; gap: 16px; flex-wrap: wrap; }
.repeat-form .rf-deadline-days input { width: 4em; }
.repeat-form .rf-week, .repeat-form .rf-month, .repeat-form .rf-after-help,
.repeat-form .rf-month-day, .repeat-form .rf-month-nth, .repeat-form .rf-deadline-days { display: none; }
.repeat-form:has(select[name=unit] option[value=week]:checked):has(input[name=mode][value=regular]:checked) .rf-week { display: block; }
.repeat-form:has(select[name=unit] option[value=month]:checked):has(input[name=mode][value=regular]:checked) .rf-month { display: block; }
.repeat-form:has(input[name=mode][value=after]:checked) .rf-after-help { display: block; }
.repeat-form:has(select[name=month_mode] option[value=day]:checked) .rf-month-day,
.repeat-form:has(select[name=month_mode] option[value=nth]:checked) .rf-month-nth { display: inline-flex; gap: 6px; }
.repeat-form:has(input[name=add_deadlines]:checked) .rf-deadline-days { display: inline; }
.repeat-form fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.repeat-form fieldset legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: .9rem; }
.repeat-form .rf-row select, .repeat-form .rf-row input { width: auto; }
.repeat-form .rf-dates input[type=date], .repeat-form input[type=time] { width: auto; }
/* The Repeat dialog as a popup (repeat-dialog.js) */
.repeat-dialog {
  width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px 16px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.repeat-dialog::backdrop { background: rgba(0, 0, 0, .4); }
.repeat-dialog h1 { font-size: 1.2rem; margin: 0 0 4px; }
.repeat-dialog > p.muted { font-size: .88rem; margin: 0 0 14px; }
.repeat-dialog .actions { position: sticky; bottom: -16px; margin: 14px -22px -16px; padding: 12px 22px;
  background: var(--surface); border-top: 1px solid var(--border); justify-content: flex-end; }

/* ---------- Multiple selection, Trash, Undo ---------- */
.todo-item.is-picked { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.bulk-bar {
  /* Below the pickers (z-index 50), which open above it. */
  position: fixed; z-index: 45; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100vw - 32px);
  padding: 8px 10px 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}
.bulk-count { font-weight: 600; font-size: .9rem; margin-right: 6px; }
.bulk-close { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 4px; cursor: pointer; }
.bulk-close:hover { color: var(--text); }
body:has(.bulk-bar) .toast { bottom: calc(var(--bulk-bar-h, 48px) + 36px); }
.bulk-bar .btn:disabled { opacity: .45; cursor: default; }
/* Select mode (touch screens): the "Select" button, and the bar spanning the bottom. */
.select-mode-btn {
  display: none; position: fixed; z-index: 44; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); min-height: 44px; padding: 0 18px; border-radius: 22px;
}
@media (hover: none), (pointer: coarse) {
  .select-mode-btn:not([hidden]) { display: inline-flex; align-items: center; }
}
.bulk-bar.is-select-mode {
  left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); transform: none; max-width: none;
  justify-content: center; padding: 8px;
}
.bulk-bar.is-select-mode .bulk-count { flex-basis: 100%; text-align: center; margin: 0 0 2px; }
.bulk-bar.is-select-mode .btn { min-height: 44px; padding: 0 14px; font-size: 1rem; }
body.select-mode main { padding-bottom: 140px; }
body.select-mode main [data-item] { cursor: pointer; -webkit-user-select: none; user-select: none; }
.drag-ghost {
  position: fixed; top: -100px; left: 0; padding: 4px 10px; border-radius: 8px;
  background: var(--primary); color: var(--primary-contrast); font-size: .85rem; font-weight: 600;
}
.sidebar .side-link.is-drop-hover {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.toast-action {
  margin-left: 6px; padding: 2px 10px; border-radius: 6px; border: 1px solid currentColor;
  background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}
.msg-undo { margin-left: 8px; }
.trash-item { align-items: center; }
.trash-item .todo-item-main { cursor: default; }
.trash-item .tcheck.is-static { pointer-events: none; opacity: .6; }

/* Upcoming: in a month group each row says its date. */
.upcoming-date {
  flex: none; min-width: 3.4em; padding: 1px 7px; border-radius: 5px; text-align: center; white-space: nowrap;
  font-size: .8rem; font-weight: 700; background: color-mix(in srgb, var(--text) 12%, transparent);
  color: color-mix(in srgb, var(--text) 80%, transparent);
}

/* Archiving headings: the button next to ✕, and archived headings in the Logbook. */
.heading-archive .linklike { opacity: 0; padding: 2px 6px; color: var(--muted); }
.todo-heading:hover .heading-archive .linklike, .heading-archive .linklike:focus-visible { opacity: 1; }
.heading-archive .archive-icon { width: 15px; height: 15px; vertical-align: -2px; }
.logbook-heading { margin: 4px 0 10px; }
.logbook-heading-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.logbook-heading-head .archive-icon { width: 17px; height: 17px; color: var(--muted); flex: none; }
.logbook-heading-title { font-weight: 600; }
.logbook-heading-restore { margin-left: auto; }
.logbook-heading .todo-list { padding-left: 20px; }

/* Sidebar: projects can be dragged into your own order. */
.sidebar [data-sidebar-project].is-dragging { opacity: .4; }

/* Top bar: New project / New area next to New todo (only the icon on narrow screens). */
/* The "+" create menu in the top bar (as on GitHub): one button, a small menu below it. */
.create-menu { position: relative; }
.create-menu > summary { list-style: none; gap: 2px; padding: 4px 6px 4px 8px; }
.create-menu > summary::-webkit-details-marker { display: none; }
.create-menu .create-plus { width: 17px; height: 17px; }
.create-menu .create-caret { width: 15px; height: 15px; opacity: .85; }
.create-menu[open] > summary { filter: brightness(1.12); }
.menu-popover {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.menu-popover [role="menuitem"] {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  color: var(--text); text-decoration: none; font-size: .92rem; white-space: nowrap;
}
.menu-popover [role="menuitem"]:hover, .menu-popover [role="menuitem"]:focus-visible {
  background: color-mix(in srgb, var(--text) 7%, transparent); text-decoration: none; outline: none;
}
.menu-popover .menu-label { flex: 1; }
.menu-popover .menu-icon, .menu-popover .proj-icon, .menu-popover .area-icon { width: 17px; height: 17px; color: var(--muted); flex: none; }
.menu-popover kbd { font-size: .72rem; color: var(--muted); background: none; border: 0; padding: 0; }
.menu-popover hr { border: 0; border-top: 1px solid var(--border); margin: 6px -6px; }
@media (pointer: coarse) { .menu-popover [role="menuitem"] { padding: 11px 12px; } .menu-popover kbd { display: none; } }
.side-area-block.is-drop-hover > .side-area { background: color-mix(in srgb, var(--primary) 22%, transparent); box-shadow: inset 0 0 0 2px var(--primary); }

/* Deadlines list */
.list-icon-deadlines { color: var(--danger); }
.side-count-deadlines { color: var(--danger); font-weight: 700; }
.group-head.group-overdue { color: var(--danger); }

/* Two-line rows (title + project/area underneath): the lines closer together. */
.todo-item-title, .project-name { line-height: 1.3; }
.todo-item-sub { line-height: 1.25; }

/* Deleting everything you own (profile) / resetting the database (People, admins). */
.danger-zone { border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); border-radius: 10px; padding: 14px 16px; margin-top: 18px; }
.danger-zone h2 { color: var(--danger); }
.danger-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.danger-form label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.danger-form input { min-width: 12rem; }

/* The app's version at the bottom of the sidebar. */
.side-footer { padding: 6px 10px 0; font-size: .72rem; color: var(--muted); opacity: .8; }

/* Icons drawn the same everywhere: the Today star and the deadline flag (templates/_star_icon.html,
   _flag_icon.html) instead of the ★ / ⚑ characters. Small icons next to text are 14px. */
.star-icon { width: 1.05em; height: 1.05em; vertical-align: -.15em; flex: none; }
.date-btn.star .star-icon, .todo-item-meta .star-icon { width: 15px; height: 15px; vertical-align: -2px; }
.flag-icon { width: 14px; height: 14px; flex: none; }
.chip .flag-icon, .chip .star-icon { width: 13px; height: 13px; vertical-align: -2px; }
.list-icon .flag-icon { width: 100%; height: 100%; }
.board-overdue-icon .flag-icon { width: 14px; height: 14px; vertical-align: -2px; }
.dp-day .star-icon { width: 15px; height: 15px; vertical-align: -2px; }

/* A box's own tools without a title (Today's sort switch): on the right. */
.card-head.card-tools { justify-content: flex-end; }
.card-head.card-tools .sort-control { margin-left: auto; }

/* Tags page: a tag's keyboard shortcut (one letter or digit). */
.tag-shortcut-input { width: 2.2em; text-align: center; text-transform: uppercase; padding: 2px 4px; }

/* Date picker: typing a date at the top. */
.dp-type { width: 100%; margin: 2px 0 2px; padding: 5px 8px; font: inherit; font-size: .88rem; }
.dp-hint { min-height: 1.2em; margin: 0 2px 4px; font-size: .78rem; color: var(--muted); }
.dp-hint.is-error { color: var(--danger); }
.dp-day.dp-preview:not(:focus) { background: color-mix(in srgb, var(--primary) 25%, transparent); box-shadow: inset 0 0 0 2px var(--primary); }

/* ---------- Editing a todo in place (inline-editor.js, _todo_card.html) ---------- */
.todo-item.inline-card {
  display: block; min-height: 0; margin: 8px -6px 12px; padding: 12px 14px 10px; cursor: default;
  border-radius: 12px; background: color-mix(in srgb, var(--surface), var(--text) 5%); border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .08);
}
.todo-item.inline-card:hover { background: color-mix(in srgb, var(--surface), var(--text) 5%); }
.inline-card-top { display: flex; align-items: center; gap: 10px; }
.inline-title, .inline-notes {
  width: 100%; border: 0; outline: 0; padding: 2px 0; background: transparent; color: var(--text); font: inherit;
}
.inline-title { font-size: 1.05rem; font-weight: 500; }
.inline-card.is-done .inline-title { color: var(--muted); }
.inline-notes { display: block; margin: 6px 0 0 30px; width: calc(100% - 30px); resize: none; overflow: hidden; color: var(--text); line-height: 1.45; font-size: .95rem; }
.inline-notes::placeholder, .inline-title::placeholder { color: var(--muted); opacity: .8; }
.inline-checklist { margin: 8px 0 0 30px; }
.inline-checklist .checklist { margin: 0; }
.inline-card-bar { display: flex; align-items: center; gap: 6px; margin: 12px 0 0 24px; }
.inline-spacer { flex: 1; }
.inline-chip, .inline-icon, .inline-tags {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 7px; border: 0; cursor: pointer;
  background: none; color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none;
}
.inline-chip:hover, .inline-icon:hover, .inline-tags:hover { background: color-mix(in srgb, var(--text) 8%, transparent); text-decoration: none; }
.inline-chip.is-empty, .inline-icon { color: var(--muted); font-weight: 500; }
.inline-chip .list-icon { width: 16px; height: 16px; }
.inline-chip .star-icon, .inline-chip .flag-icon, .inline-chip .moon-icon { width: 15px; height: 15px; }
.inline-due:not(.is-empty) { background: color-mix(in srgb, var(--text) 8%, transparent); }
.inline-due.deadline-today, .inline-due.deadline-overdue { color: var(--danger); }
.inline-icon svg, .inline-icon .list-icon { width: 17px; height: 17px; }
/* Icon-only buttons sit closer together than the chips with text. */
.inline-card-bar { gap: 2px; }
.inline-icon { padding: 4px 5px; }
.inline-card-bar .inline-spacer { margin-right: 4px; }
.inline-icon .list-icon-tags { color: currentColor; }
.inline-repeat.is-on { color: var(--primary); }
.inline-reminder { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 500; }
/* The card's fields look like text (the general input styles would frame them). */
.inline-card input.inline-title, .inline-card textarea.inline-notes,
.inline-card input.inline-title:focus, .inline-card textarea.inline-notes:focus {
  border: 0; box-shadow: none; outline: 0; background: transparent; border-radius: 0; min-height: 0;
}
.inline-card input.inline-title { padding: 2px 0; }
.inline-card textarea.inline-notes { padding: 0; }
.inline-comments .comment-icon { width: 16px; height: 16px; }
.inline-assignee .avatar { width: 20px; height: 20px; font-size: .65rem; }
.inline-assignee .list-icon { width: 16px; height: 16px; color: currentColor; }

/* ---------- Touch screens (iPad) ---------- */
/* Without hover, controls that appear on hover stay visible (a little quieter), so they can be found
   and tapped – and no invisible button gets tapped by accident. */
@media (hover: none) {
  .heading-grip, .check-handle { opacity: .55; }
  .heading-delete .linklike, .heading-archive .linklike, .checklist-item .icon-btn { opacity: .7; }
  .heading-quick-add .board-quick-add input[type=text]:not(:focus)::placeholder,
  .day-quick-add .board-quick-add input[type=text]:not(:focus)::placeholder { opacity: 1; }
}
/* Fingers need bigger targets; 16px text keeps Safari from zooming into a field when it is tapped. */
@media (pointer: coarse) {
  .board-quick-add input[type=text],
  .heading-quick-add .board-quick-add input[type=text],
  .day-quick-add .board-quick-add input[type=text] { padding: 9px 8px; font-size: 16px; }
  .inline-card-bar { gap: 4px; flex-wrap: wrap; }
  .inline-icon, .inline-chip, .inline-tags { min-height: 36px; padding: 6px 9px; }
  .heading-grip { width: 22px; margin-left: -24px; font-size: 1rem; text-align: center; }
  .heading-delete .linklike, .heading-archive .linklike { padding: 8px 10px; }
  .bulk-bar .btn { min-height: 36px; }
}

/* Placeholder page: the invitation link with Copy / E-mail. */
.invite-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.invite-row input { flex: 1 1 260px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.profile-section .name-form + .name-form { margin-top: 16px; }
.invite-send { margin-top: 10px; }

/* Project head: everyone in the project (owner first, highlighted); a name filters the todos. */
.project-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.person-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text); font-size: .85rem; text-decoration: none;
}
.person-chip:hover { background: color-mix(in srgb, var(--text) 6%, transparent); text-decoration: none; }
.person-chip .avatar { width: 22px; height: 22px; font-size: .65rem; }
.person-chip.is-owner { border-color: color-mix(in srgb, var(--primary) 55%, transparent); background: color-mix(in srgb, var(--primary) 12%, transparent); font-weight: 600; }
.person-chip.is-owner .avatar { box-shadow: 0 0 0 2px var(--primary); }
.person-role { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--primary); }
.person-chip.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
@media (pointer: coarse) { .person-chip { min-height: 36px; } }

/* Help texts switched off (Profile → Help texts): explanations go, warnings and data stay. */
body.hide-help .hint, body.hide-help .help, body.hide-help .list-intro, body.hide-help .list-foot,
body.hide-help .md-help { display: none !important; }

/* Today: "No heading" can be moved among your headings, so it has a (quiet) header there. */
.no-heading-title { margin: 0; font-size: .95rem; font-weight: 700; color: var(--muted); flex: 1; }
.board { overflow-x: auto; }
/* Projects as cards (the Today board): like todo cards. */
.board-list .project-row {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  flex-wrap: wrap; align-items: flex-start; padding: 8px; cursor: grab; border-radius: 8px;
}
.board-list .project-row .project-row-main { flex: 1 1 8rem; font-size: .95rem; }
.board-list .project-row .todo-item-meta { flex-basis: 100%; justify-content: flex-end; }
.board-list .project-row.is-dragging { opacity: .45; }

/* A project's todos done before today: below the list, closed by default. */
.completed-section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 6px; }
/* Its toggle: a small text link with an eye on the right, like "Hide for today" at the calendar events. */
.completed-toggle {
  display: flex; justify-content: flex-end; list-style: none; cursor: pointer; margin: 0 2px 4px;
  color: var(--muted); font-size: .8rem;
}
.completed-toggle::-webkit-details-marker { display: none; }
.completed-toggle > span { display: inline-flex; align-items: center; gap: 4px; }
.completed-toggle:hover { color: var(--text); }
.completed-section:not([open]) .when-open, .completed-section[open] .when-closed { display: none; }
.eye-icon { width: 14px; height: 14px; flex: none; }

/* Focus (a tag limits the whole app): the switch in the top bar, and the bar tinted in the tag's colour. */
.focus-switch label { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--muted); }
.focus-switch .focus-icon { width: 16px; height: 16px; flex: none; }
/* As tall as the small buttons next to it (.btn-small: 4px padding, a 1.5 line, 1px border). */
.focus-switch select {
  box-sizing: border-box; height: calc(1.5 * .85rem + 10px); max-width: 11rem; padding: 0 6px;
  font-size: .85rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.topbar.is-focused {
  background: color-mix(in srgb, var(--area-c) 20%, var(--surface));
  border-bottom: 2px solid var(--area-c);
}
.topbar.is-focused .focus-switch label { color: var(--area-c); }
.topbar.is-focused .focus-switch select { border-color: var(--area-c); font-weight: 600; }
@media (max-width: 899px) { .focus-switch select { max-width: 7.5rem; } }
.tag-color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--area-c); vertical-align: -1px; }
.tag-color-form select { font-size: .8rem; padding: 2px 4px; }
.tag-color-dot.is-none { background: transparent; border: 1px dashed var(--muted); }

/* The view control (_view_control.html), in two looks chosen on the profile. */
.card-head:has(.view-tabs, .view-split) { flex-wrap: wrap; gap: 8px; }
.view-tabs, .view-split { margin-left: auto; }
/* "tabs": the active view is a solid tab opening into a light panel with its options (chosen one white). */
.view-tabs { display: inline-flex; flex-direction: column; min-width: 0; }
.vt-tabs { display: flex; gap: 2px; }
.vt-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
  font-size: .85rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 8px 8px 0 0; background: color-mix(in srgb, var(--text) 4%, var(--surface));
}
.vt-tab:hover { color: var(--text); text-decoration: none; }
.vt-tab.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.vt-panel {
  padding: 4px; border-radius: 0 8px 8px 8px; background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-top: 2px solid var(--primary);
}
.view-tabs.is-board .vt-panel { border-radius: 8px 0 8px 8px; }
.vt-panel .sort-label, .vt-panel .board-mode-label { display: none; }
.vt-panel .sort-control, .vt-panel .board-mode { display: block; margin: 0; }
.vt-panel .scope-switch { display: flex; flex-wrap: wrap; gap: 3px; border: 0; border-radius: 0; overflow: visible; background: none; }
.vt-panel .scope-switch a { padding: 3px 10px; border-radius: 6px; font-size: .8rem; color: var(--primary); }
.vt-panel .scope-switch a:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.vt-panel .scope-switch a.active { background: var(--surface); color: var(--primary); }
/* "split": the active view is one button "List · Manual ▾" with a menu of its options; the other is plain. */
.view-split { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 9px; padding: 1px; gap: 1px; }
.vs-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px;
  font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; list-style: none; white-space: nowrap;
}
.vs-btn:hover { color: var(--text); text-decoration: none; }
.vs-btn.is-active { background: var(--primary); color: var(--primary-contrast); padding-right: 8px; }
.vs-menu { position: relative; }
.vs-menu > summary::-webkit-details-marker { display: none; }
.vs-current { font-weight: 500; opacity: .92; }
.vs-caret { width: 15px; height: 15px; }
.vs-menu .menu-popover { left: 0; right: auto; }
.view-split .vs-menu:last-child .menu-popover { left: auto; right: 0; }
.menu-heading { padding: 4px 10px 2px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.menu-check { color: var(--primary); font-weight: 700; }

/* "Hide for today" next to the calendar events (Today, Upcoming) – only once there are events on the page;
   once hidden, a quiet note to show them again. */
.calendar-hide { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin: 0 2px 4px; }
.calendar-hide .linklike { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; }
.calendar-hide .linklike:hover { color: var(--text); }
.calendar-hide.is-hidden-note { justify-content: flex-start; margin: 0 2px 8px; }
.calendar-hide.is-hidden-note .linklike { color: var(--primary); font-size: .8rem; }
main:not(:has(.calendar-events)) .calendar-hide:not(.is-hidden-note) { display: none; }

/* Comments in the inline editor (_card_comments.html): below the bar, closed until opened with the button. */
.inline-comments-btn.is-on { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.inline-comments { margin: 10px 0 0 24px; padding-top: 6px; border-top: 1px solid var(--border); }
.inline-comments-earlier-btn { font-size: .8rem; color: var(--primary); margin: 2px 0 4px; }
.inline-comment { display: flex; gap: 8px; padding: 6px 0; }
.inline-comment .avatar, .inline-comment-new .avatar { width: 22px; height: 22px; font-size: .65rem; flex: none; margin-top: 1px; }
.inline-comment-main { flex: 1; min-width: 0; }
.inline-comment-head { display: flex; align-items: baseline; gap: 6px; font-size: .78rem; }
.inline-comment-head strong { font-weight: 600; font-size: .82rem; }
.inline-comment-actions { margin-left: auto; display: inline-flex; gap: 0; opacity: 0; }
.inline-comment:hover .inline-comment-actions, .inline-comment-actions:focus-within { opacity: 1; }
@media (hover: none) { .inline-comment-actions { opacity: .75; } }
.inline-comment-actions .icon-btn { padding: 0 4px; font-size: .75rem; color: var(--muted); }
.inline-comment-actions .icon-btn svg { width: 13px; height: 13px; vertical-align: -2px; }
.inline-comment-body { font-size: .9rem; }
.inline-comment-body > :first-child { margin-top: 0; }
.inline-comment-body > :last-child { margin-bottom: 0; }
.inline-comment-edit textarea, .inline-comment-new textarea {
  width: 100%; min-height: 34px; padding: 6px 8px; font: inherit; font-size: .9rem; resize: vertical;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.inline-comment-edit-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.inline-comment-new { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.inline-comment-new textarea { flex: 1; }
@media (pointer: coarse) { .inline-comment-edit textarea, .inline-comment-new textarea { font-size: 16px; } }

/* Several assignees: overlapping avatars (_avatars.html). */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-more { background: color-mix(in srgb, var(--text) 12%, transparent); color: var(--text); font-size: .6rem; }
