:root {
  --bg: #f7f6f3;
  --panel: #efede8;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #74706a;
  --faint: #a8a39b;
  --line: #e4e1da;
  --hover: rgba(31, 29, 26, 0.05);
  --accent: #2f6f62;
  --accent-soft: rgba(47, 111, 98, 0.12);
  --p1: #d1453b;
  --p2: #e88a1a;
  --p3: #3b6fd6;
  --p4: #9a958d;
  --u1: #c2416d;
  --u2: #b88a00;
  --u3: #2a9a84;
  --u4: #8e3cc0;
  --follow: #8e3cc0;
  --danger: #c0392b;
  --radius: 10px;
  --sidebar: 280px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --panel: #232325;
    --surface: #2a2a2d;
    --text: #ecebe8;
    --muted: #a09d97;
    --faint: #6f6c67;
    --line: #36363a;
    --hover: rgba(255, 255, 255, 0.06);
    --accent: #5fb3a1;
    --accent-soft: rgba(95, 179, 161, 0.16);
    --p1: #ff6b61;
    --p2: #ffa24a;
    --p3: #6f9bff;
    --p4: #85827c;
    --u1: #d4507e;
    --u2: #e8c547;
    --u3: #72cbb7;
    --u4: #a54fd6;
    --follow: #a54fd6;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { display: flex; height: 100%; height: 100dvh; width: 100%; overflow: hidden; }

/* ---------- sidebar ---------- */
#sidebar {
  width: var(--sidebar-w, var(--sidebar));
  flex: none;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 12px) 10px calc(env(safe-area-inset-bottom) + 10px);
  overflow: hidden;
}
.space-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--hover);
  border-radius: 9px;
  margin: 0 4px 12px;
}
.space-switch button {
  flex: 1;
  padding: 6px 8px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.space-switch button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
#nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  text-align: left;
  min-height: 36px;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-more { display: none; width: 22px; height: 22px; margin: -4px -4px -4px 0; place-items: center; border-radius: 5px; color: var(--muted); }
.nav-more svg { width: 16px; height: 16px; }
.nav-more:hover { background: var(--hover); color: var(--text); }
@media (hover: hover) and (pointer: fine) {
  .nav-item[data-project]:is(:hover, .menu-open) .count { display: none; }
  .nav-item[data-project]:is(:hover, .menu-open) .nav-more { display: grid; }
  .nav-item.menu-open { background: var(--hover); }
}
.nav-item .glyph { color: var(--muted); }
.nav-item.active .glyph { color: var(--accent); }
.nav-item .hash { color: var(--faint); width: 20px; text-align: center; font-weight: 600; }
.twisty { width: 20px; height: 20px; display: grid; place-items: center; color: var(--faint); border-radius: 4px; margin-left: -4px; }
.twisty svg { width: 14px; height: 14px; transition: transform .15s; }
.twisty.open svg { transform: rotate(90deg); }
.twisty:hover { background: var(--hover); }
.nav-item :is(.hash, .twisty).p1 { color: var(--p1); }
.nav-item .hash.p1 { font-weight: 800; }
.nav-item .twisty.p1 svg { stroke-width: 2.6; }
.nav-asap { display: grid; place-items: center; flex: none; width: 15px; margin: 0 -2px 0 -12px; color: var(--u1); }
.nav-asap svg { width: 15px; height: 15px; }
.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.nav-head button { color: var(--muted); border-radius: 5px; padding: 2px; }
.nav-head button:hover { background: var(--hover); color: var(--text); }
.nav-head svg { width: 16px; height: 16px; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.sidebar-foot .ghost { display: flex; gap: 8px; align-items: center; color: var(--muted); padding: 6px; border-radius: 7px; }
.sidebar-foot .ghost:hover { background: var(--hover); color: var(--text); }
.sync-state { font-size: 12px; color: var(--faint); }
.sync-state.err { color: var(--danger); }

/* ---------- main ---------- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 20px 6px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
.topbar h1 { flex: 1; font-size: 22px; margin: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar h1 .crumb { color: var(--faint); font-weight: 500; font-size: 14px; display: block; }
#menuBtn { display: none; }
.top-actions { display: flex; gap: 2px; }
.icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); }
.icon:hover { background: var(--hover); color: var(--text); }
.icon.on { color: var(--accent); background: var(--accent-soft); }
.icon.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#content { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 20px calc(env(safe-area-inset-bottom) + 100px); }
#content > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.desc-block { color: var(--muted); font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; border-radius: 6px; }
.desc-block:hover { color: var(--text, inherit); }
.preamble { margin: 0 0 10px; }
.section-desc { margin: 6px 0 2px; }
.dlg textarea.desc-input { width: 100%; box-sizing: border-box; min-height: 120px; resize: vertical; font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: inherit; }

.section { margin-bottom: 18px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
}
.section-head .title { flex: 1; }
.section-head .count { color: var(--faint); font-weight: 500; font-size: 13px; }
.section-head .icon { width: 28px; height: 28px; }
.section-head.overdue { color: var(--p1); }

ul.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.task .check {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.6px solid var(--pc, var(--p4));
  background: color-mix(in srgb, var(--pc, var(--p4)) 10%, transparent);
  flex: none;
  display: grid;
  place-items: center;
  color: var(--pc);
  transition: background .15s;
}
.task .check svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; transition: opacity .12s; }
.task .check:hover svg { opacity: .7; }
.task.p1 { --pc: var(--p1); }
.task.p2 { --pc: var(--p2); }
.task.p3 { --pc: var(--p3); }
.task.p1 .check, .task.p2 .check, .task.p3 .check { border-width: 2px; }
.task.done .check, .task.completing .check { background: var(--pc, var(--p4)); color: #fff; }
.task.done .check svg, .task.completing .check svg { opacity: 1; }
.task.done .title { text-decoration: line-through; color: var(--faint); }
.task.completing { opacity: .5; transition: opacity .3s .2s; }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.task .title { word-wrap: break-word; }
.task .desc { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.task .meta:empty { display: none; }
.meta .due { display: inline-flex; align-items: center; gap: 3px; }
.meta .due.overdue { color: var(--p1); }
.meta .due.today { color: var(--accent); font-weight: 600; }
.meta .label { color: var(--muted); }
.meta .label::before { content: "@"; color: var(--faint); }
.meta .proj { margin-left: auto; color: var(--faint); }
.meta svg { width: 12px; height: 12px; }
.task .row-actions { display: flex; opacity: 0; transition: opacity .1s; }
.task:hover .row-actions { opacity: 1; }
.task .row-actions .icon { width: 28px; height: 28px; }
.task .row-actions svg { width: 16px; height: 16px; }
@media (hover: none) { .task .row-actions { display: none; } }

.add-task { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 9px 4px; width: 100%; text-align: left; }
.add-task svg { color: var(--accent); width: 18px; height: 18px; }
.add-task:hover { color: var(--accent); }
.add-section { display: flex; align-items: center; gap: 10px; color: var(--faint); margin: 6px 0 20px; width: 100%; font-weight: 600; font-size: 14px; }
.add-section::before, .add-section::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: 0; transition: opacity .1s; }
.add-section:hover { color: var(--accent); }
.add-section:hover::before, .add-section:hover::after { opacity: .5; }

.inline-add { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; margin: 8px 0; }
.inline-add input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; font-weight: 600; font-size: 16px; }
.inline-add .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.inline-add .chips { margin-top: 6px; }
.inline-add .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.chip.p1 { color: var(--p1); } .chip.p2 { color: var(--p2); } .chip.p3 { color: var(--p3); }

.btn { padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; background: var(--hover); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: default; }
.btn.danger { color: var(--danger); }
.btn:hover:not(:disabled) { filter: brightness(0.96); }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty svg { width: 48px; height: 48px; color: var(--faint); stroke-width: 1.2; margin-bottom: 8px; }
.empty .big { font-weight: 600; color: var(--text); font-size: 16px; }

#fab {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  z-index: 5;
}
#fab svg { width: 26px; height: 26px; stroke-width: 2.2; }

/* ---------- menus, dialogs, toast ---------- */
.popmenu {
  position: fixed;
  z-index: 40;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 5px;
}
.popmenu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; text-align: left; }
.popmenu button:hover { background: var(--hover); }
.popmenu button.danger { color: var(--danger); }
.popmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

dialog {
  border: 0;
  padding: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px);
}
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 17px; }
.dlg-body { padding: 6px 16px 12px; overflow-y: auto; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px 16px; border-top: 1px solid var(--line); }
.dlg-foot .spacer { flex: 1; }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  outline: none;
  font-size: 16px; /* stops iOS zooming */
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field small { display: block; color: var(--faint); font-size: 12px; margin-top: 4px; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.title-input { width: 100%; border: 0; outline: 0; background: none; font-size: 19px; font-weight: 700; padding: 4px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: min(140px, 100%); }
.prio-pick { display: flex; gap: 6px; }
.prio-pick button { flex: 1; padding: 7px 0; border-radius: 8px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; display: flex; gap: 5px; justify-content: center; align-items: center; }
.prio-pick button svg { width: 14px; height: 14px; }
.prio-pick button[data-p="1"] { color: var(--p1); } .prio-pick button[data-p="2"] { color: var(--p2); }
.prio-pick button[data-p="3"] { color: var(--p3); } .prio-pick button[data-p="4"] { color: var(--p4); }
.prio-pick button.sel { background: color-mix(in srgb, currentColor 14%, transparent); border-color: currentColor; }
.note { font-size: 13px; color: var(--muted); background: var(--hover); padding: 10px 12px; border-radius: 8px; margin: 8px 0; }
.note code, .dlg code { font-size: 12px; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
.space-card { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px 10px; margin: 10px 0; }
.space-card h3 { display: flex; align-items: center; justify-content: space-between; font-size: 15px; margin: 8px 0 0; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 90px);
  transform: translate(-50%, 20px);
  background: #2b2a28;
  color: #f4f2ee;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: #8fd3c4; font-weight: 700; }

#scrim { display: none; }

/* iOS zooms the page when a focused field's text is under 16px, and an
   installed app then stays zoomed (cut-off + button, sideways scrolling). */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
  .title-input { font-size: 19px !important; }
}

/* ---------- phone layout ---------- */
@media (max-width: 760px) {
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  body.drawer #sidebar { transform: none; }
  body.drawer #scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 20; }
  #menuBtn { display: grid; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .topbar h1 { font-size: 20px; }
  #content { padding-left: 16px; padding-right: 16px; }
  .task { padding: 11px 2px; }
  .nav-item { min-height: 42px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .dlg { max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- task sheet ---------- */
#sheetHost {
  padding: 0; margin: 0; border: 0; border-radius: 0;
  background: transparent; box-shadow: none;
  width: 100vw; max-width: 100vw; height: 100%; height: 100dvh; max-height: 100dvh;
  overflow: hidden;
}
#sheetHost::backdrop { background: rgba(0, 0, 0, .4); }
.sheet-layer {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
}
.sheet-layer + .sheet-layer { background: rgba(0, 0, 0, .3); }
.sheet {
  width: 100%; max-width: 560px;
  max-height: 100%;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .25);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: sheet-up .22s ease-out;
}
.sheet.task-sheet { min-height: min(560px, 100%); }
.sheet.picker.tall { height: 100%; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 761px) {
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; max-height: min(760px, 100%); }
  .sheet.picker.tall { height: min(640px, 100%); }
  .sheet.task-sheet { min-height: 0; }
}
.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 6px 14px 10px; }
.sheet-title { text-align: center; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.round.ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.round.ok svg { stroke-width: 2.4; }
.round.sm { width: 32px; height: 32px; }
.round.sm svg { width: 16px; height: 16px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 14px 18px; flex: 1; }
.sheet-hint { color: var(--faint); font-size: 12px; margin: 10px 4px 0; }

.card { background: var(--surface); border-radius: 16px; padding: 4px 16px 14px; }
.sheet .task { border: 0; padding: 12px 0 10px; }
.t-head { display: flex; gap: 12px; align-items: flex-start; }
.t-head .check { width: 24px; height: 24px; margin-top: 2px; }
.t-head .check svg { width: 14px; height: 14px; }
.t-main { flex: 1; min-width: 0; cursor: text; }
.t-title { font-size: 20px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.task.done .t-title { text-decoration: line-through; color: var(--faint); }
.t-desc { color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 6px; max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.t-desc:not(:has(+ *)) { -webkit-mask-image: none; }
.t-desc a, .t-desc-input a { color: var(--accent); }
.t-title-input, .t-desc-input { width: 100%; border: 0; outline: 0; background: none; resize: none; padding: 0; overflow: hidden; }
.t-title-input { font-size: 20px !important; font-weight: 650; line-height: 1.3; }
.t-desc-input { font-size: 16px !important; line-height: 1.45; min-height: 3em; color: var(--text); }
.t-desc-edit { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0 4px; }
.t-desc-edit .prop-icon { margin-top: 2px; }

.prop { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; min-height: 48px; }
.prop-icon { width: 24px; display: grid; place-items: center; color: var(--muted); flex: none; }
.prop-icon.due.set { color: var(--p3); } .prop-icon.due.today { color: var(--accent); } .prop-icon.due.overdue { color: var(--p1); }
.prop-text { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; border-top: 1px solid var(--line); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-text.muted { color: var(--faint); }
.label-list { gap: 6px; flex-wrap: wrap; white-space: normal; padding: 8px 0; }
.label-list .chip { font-size: 13px; }

.pills { display: flex; gap: 8px; overflow-x: auto; padding-top: 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; display: flex; align-items: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); background: var(--bg); }
.pill svg { width: 17px; height: 17px; }
.pill:active { background: var(--hover); }

.list { background: var(--surface); border-radius: 16px; overflow: hidden; }
.list-item { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; min-height: 48px; padding: 0 14px; }
.list-item + .list-item::before { content: ""; position: absolute; left: 52px; right: 0; top: 0; border-top: 1px solid var(--line); }
.list-item:active { background: var(--hover); }
.li-icon { width: 24px; display: grid; place-items: center; color: var(--muted); flex: none; }
.li-text { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.is-section .li-text { color: var(--muted); }
.li-aside { color: var(--faint); font-size: 14px; }
.li-check { color: var(--accent); }
.li-check svg { stroke-width: 2.4; }
.q-today { color: var(--accent); } .q-tomorrow { color: var(--p2); } .q-weekend { color: var(--p3); } .q-nextweek { color: #8e6bd6; }
.list-empty { padding: 18px 14px; color: var(--faint); text-align: center; }
.box { width: 22px; height: 22px; border-radius: 6px; border: 1.6px solid var(--faint); display: grid; place-items: center; color: transparent; flex: none; }
.box.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.box svg { width: 14px; height: 14px; stroke-width: 3; }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 0 12px; margin-bottom: 12px; color: var(--faint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 11px 0; font-size: 16px; color: var(--text); }
.date-text { width: 100%; border: 0; outline: 0; background: var(--surface); border-radius: 12px; padding: 11px 12px; font-size: 16px; }
.date-preview { color: var(--muted); font-size: 13px; padding: 6px 4px 10px; }

.cal { background: var(--surface); border-radius: 16px; padding: 10px 12px 12px; margin-top: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: 12px; color: var(--faint); padding: 4px 0; }
.cal-grid button { aspect-ratio: 1; max-height: 42px; border-radius: 50%; font-size: 15px; display: grid; place-items: center; margin: 0 auto; width: 100%; max-width: 42px; }
.cal-grid button.past { color: var(--faint); }
.cal-grid button.now { color: var(--accent); font-weight: 700; }
.cal-grid button.sel { background: var(--accent); color: #fff; font-weight: 700; }

/* menus inside the sheet */
.popmenu .mi-label { flex: 1; }
.popmenu .mi-check { color: var(--accent); display: grid; }
.popmenu .mi-check svg { stroke-width: 2.4; }
.popmenu.large { min-width: 230px; padding: 6px; }
.popmenu.large button { padding: 12px 12px; font-size: 16px; gap: 14px; }

.secret { -webkit-text-security: disc; text-security: disc; font-family: monospace; }
.round.ok:disabled { opacity: .4; cursor: default; }
.prop-note { margin-left: 8px; font-size: 12px; color: var(--p2); }
.add-sheet .t-desc-input { min-height: 1.5em; }

/* urgency + follow up */
.u1 { color: var(--u1); } .u2 { color: var(--u2); } .u3 { color: var(--u3); } .u4 { color: var(--u4); } .u0 { color: var(--muted); }
.uic { display: inline-grid; place-items: center; }
.follow { color: var(--follow); }
.meta .urg { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.meta .label.follow, .meta .label.follow::before { color: var(--follow); }
.chip.u1 { color: var(--u1); } .chip.u2 { color: var(--u2); } .chip.u3 { color: var(--u3); } .chip.u4 { color: var(--u4); }
.chip.follow { color: var(--follow); }

/* sync state */
.sync-state.warn { color: var(--p2); }
#syncBtn { position: relative; }
#syncBtn[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--p2); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* Drag to reorder */
.task { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.task.drag-src { opacity: .35; }
.drag-ghost {
  position: fixed; z-index: 50; margin: 0; pointer-events: none; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.28); padding-left: 10px; padding-right: 10px;
  transform: scale(1.02); list-style: none;
}
.drag-ghost .row-actions { opacity: 0 !important; }
body.dragging, body.dragging * { cursor: grabbing !important; }

.t-stamps { color: var(--faint); font-size: 12px; text-align: center; padding: 10px 4px 2px; }

/* Format check warning (sidebar) and a dot on the phone menu button */
.format-warn { display: flex; align-items: center; gap: 8px; margin: 6px 6px 0; padding: 6px 8px; border-radius: 7px; font-size: 13px; color: var(--p2); text-decoration: none; }
.format-warn[hidden] { display: none; }
.format-warn:hover { background: var(--hover); }
.format-warn svg { width: 16px; height: 16px; flex: none; }
#menuBtn { position: relative; }
body.format-bad #menuBtn::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--p2); }

/* Recent agent changes */
.agent-dlg { min-width: min(480px, calc(100vw - 32px)); }
.agent-list { list-style: none; margin: 0; padding: 0; }
.agent-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.agent-list li:last-child { border-bottom: 0; }
.agent-main { flex: 1; min-width: 0; }
.agent-subject { overflow-wrap: anywhere; }
.agent-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.agent-undone { font-size: 13px; color: var(--faint); padding: 0 6px; }
.agent-list li.agent-empty { color: var(--muted); justify-content: center; border: 0; padding: 18px 0; }
.agent-msg { font-size: 14px; color: var(--p1); background: var(--hover); border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; }
.agent-msg.ok { color: var(--accent, inherit); }

/* Bin */
.nav-gap { height: 12px; }
.bin-item { align-items: center; }
.bin-item .check { pointer-events: none; opacity: .6; }
.bin-item .btn { flex: none; padding: 6px 12px; font-size: 13px; }
.bin-folder { width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); margin-top: 1px; }
.bin-item .meta { gap: 4px 10px; }
.bin-item .meta .proj { margin-left: 0; color: var(--muted); }

/* Subtasks */
.task[data-depth] { padding-left: calc(4px + var(--depth, 0) * 28px); }
.drag-ghost { padding-left: calc(10px + var(--depth, 0) * 28px) !important; }
.task.drag-hidden { display: none; }
.meta .subcount { display: inline-flex; align-items: center; gap: 3px; }
.meta .subcount svg, .sub-meta svg { width: 13px; height: 13px; }
.t-parent { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding: 2px 2px 8px; max-width: 100%; }
.t-parent svg { width: 15px; height: 15px; flex: none; }
.t-parent span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.subtasks { margin-top: 12px; padding-top: 6px; padding-bottom: 6px; }
.sub-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 0 4px; }
.sub-head svg { width: 16px; height: 16px; }
.sub-head .count { margin-left: auto; font-weight: 400; }
.sub-row { border-bottom: 1px solid var(--line); padding: 8px 0 !important; align-items: center; }
.sub-main { flex: 1; min-width: 0; cursor: pointer; }
.sub-meta { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.sub-add { display: flex; align-items: center; gap: 10px; padding: 8px 0 4px; }
.sub-add .plus { width: 20px; display: grid; place-items: center; color: var(--accent); }
.sub-add input { flex: 1; border: 0; background: transparent; color: inherit; font: inherit; padding: 4px 0; outline: none; }

/* Search */
.search-box { display: flex; align-items: center; gap: 8px; margin: 6px auto 8px; padding: 0 12px; border-radius: 12px; background: var(--hover); position: sticky; top: 0; z-index: 2; }
.search-box .glyph { color: var(--muted); display: grid; }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 16px; padding: 11px 0; outline: none; -webkit-appearance: none; appearance: none; }
.search-count { color: var(--muted); font-size: 13px; padding: 4px 4px 6px; }

/* Drag the sidebar edge to resize it (desktop only) */
#sidebarResizer { flex: none; width: 7px; margin: 0 -3px 0 -4px; z-index: 5; cursor: col-resize; position: relative; touch-action: none; }
#sidebarResizer::after { content: ''; position: absolute; inset: 0 3px; background: var(--line); transition: background .15s; }
#sidebarResizer:hover::after, body.resizing #sidebarResizer::after { background: var(--accent); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 760px) { #sidebarResizer { display: none; } }

/* Dropping a task on the sidebar (desktop) */
.nav-item.drop-target { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: inset 0 0 0 2px var(--accent); color: var(--text); }
.drag-ghost.over-nav { width: 240px !important; padding-left: 10px !important; opacity: .92; }
.drag-ghost.over-nav .meta, .drag-ghost.over-nav .desc { display: none; }

/* Dragging projects in the sidebar */
.nav-item.drag-src { opacity: .4; }
.nav-item.drop-into { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.nav-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.nav-item.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.nav-ghost { position: fixed; z-index: 60; pointer-events: none; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,.25)); max-width: 260px; opacity: .95; }

/* Other filters (collapsible) */
.nav-filters { color: var(--muted); }
.nav-filters .glyph svg { transition: transform .15s; transform: rotate(-90deg); }
.nav-filters.open .glyph svg { transform: none; }
.nav-sub .nav-item { padding-left: 26px; }

/* Sub-project links at the end of a project */
.sub-links { list-style: none; margin: 4px 0 0; padding: 0; }
.sub-links .nav-item { border-bottom: 1px solid var(--line); border-radius: 0; min-height: 44px; }
.sub-links .nav-item:hover { border-radius: 7px; }
.sub-links .go { display: grid; color: var(--faint); }
.sub-links .go svg { width: 14px; height: 14px; }

/* Sort sub-projects */
.sort-choices { display: grid; gap: 8px; }
.sort-choice { display: grid; gap: 2px; text-align: left; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; }
.sort-choice:hover { background: var(--hover); border-color: var(--accent); }

/* Projects heading: ⋯ shows on hover on a computer, always on a phone */
.nav-head-actions { display: flex; gap: 2px; }
@media (hover: hover) and (pointer: fine) {
  .nav-head-more { opacity: 0; }
  .nav-head:hover .nav-head-more, .nav-head-more:focus-visible { opacity: 1; }
}

/* Assistant briefs */
.nav-item.unread .name { font-weight: 700; color: var(--text); }
.nav-item .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.brief { margin: 4px 0 20px; }
.brief-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.brief-meta .glyph { display: grid; color: var(--accent); }
.brief-meta b { color: var(--text); }
.brief-body { font-size: 15.5px; line-height: 1.55; }
.brief-body p { margin: 0 0 12px; }
.brief-body ol, .brief-body ul { margin: 0 0 12px; padding-left: 24px; }
.brief-body li { margin: 4px 0; }
.brief-body ul { list-style: disc; }
.brief-body ul ul { list-style: circle; }
.brief-body h2, .brief-body h3, .brief-body h4 { margin: 18px 0 8px; font-size: 17px; }
.brief-body blockquote { margin: 0 0 12px; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.brief-body code { font-size: .9em; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
.brief-body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.brief-body a { color: var(--accent); }
.blink { cursor: pointer; font-weight: 600; text-decoration: none; color: var(--accent); border-bottom: 1px dotted currentColor; }
.blink:hover { border-bottom-style: solid; }
.blink.bl-task, .blink.bl-project { color: var(--text); }
.blink.f-p1 { color: var(--p1); } .blink.f-p2 { color: var(--p2); } .blink.f-p3 { color: var(--p3); }
.blink.f-asap { color: var(--u1); } .blink.f-u2 { color: var(--u2); } .blink.f-u3 { color: var(--u3); } .blink.f-u4 { color: var(--u4); }
.blink.f-u5 { color: var(--muted); }
.blink-missing { font-weight: 600; }
.brief-loading { color: var(--muted); padding: 20px 0; }
.brief-list { list-style: none; margin: 0; padding: 0; }
.brief-list > li { border-bottom: 1px solid var(--line); }
.brief-line { display: flex; align-items: center; }
.brief-row .chev { display: grid; color: var(--muted); }
.brief-row .chev svg { width: 16px; height: 16px; transition: transform .15s; transform: rotate(-90deg); }
.brief-list > li.open .brief-row .chev svg { transform: none; }
.brief-list > li.open .brief-row .glyph { color: var(--accent); }
.brief-list > li > .brief-body, .brief-list > li > .brief-loading { padding: 2px 4px 14px 60px; }
.brief-row { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 4px; text-align: left; min-width: 0; }
.brief-row .glyph { display: grid; color: var(--muted); }
.brief-row .name { font-weight: 600; flex: none; }
.brief-row .btitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-row .when { flex: none; }
.brief-meta .btitle { font-weight: 600; color: var(--text); }
.brief-meta .btitle::before { content: '·'; margin-right: 6px; color: var(--muted); font-weight: 400; }
.brief-row .when { color: var(--muted); font-size: 14px; margin-left: auto; }
.brief-list .icon { color: var(--muted); }
.brief-arch-toggle { width: 100%; text-align: left; display: flex; align-items: center; gap: 6px; }
.brief-arch-toggle .glyph { display: grid; color: var(--muted); }
.brief-arch-toggle .glyph svg { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform .15s; }
.brief-arch-toggle.open .glyph svg { transform: none; }

/* A task just jumped to from its task view */
.task.flash { animation: task-flash 1.6s ease-out; }
@keyframes task-flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }

/* Project staleness */
.stale-glyph { color: var(--p1); }
.stale-links .crumb { color: var(--muted); font-weight: 400; }
.stale-fields { display: grid; gap: 12px; }
.stale-fields input { max-width: 120px; }
.stale-btn { position: relative; color: var(--faint); }
.stale-btn.tracking { color: var(--accent); }
.stale-btn.stale { color: var(--p1); }
.stale-n { position: absolute; top: 1px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--p1); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.stale-ok { color: var(--accent); }
.stale-days { display: inline-flex; align-items: center; gap: 3px; color: var(--p1); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.stale-days svg { width: 16px; height: 16px; }
.stale-btn[hidden] { display: none; }

/* ---------- task detail (two panes on wide screens, stacked on phones) ---------- */
.sheet.detail { max-width: 560px; }
.td-head { display: flex; align-items: center; gap: 8px; padding: 6px 14px 10px; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--text); min-width: 0; flex: 0 1 auto; max-width: 220px; }
.crumb:last-of-type { flex-shrink: 0.3; }
.crumb:hover { background: var(--hover); }
.crumb .hash { color: var(--muted); font-weight: 500; }
.crumb-icon { display: grid; color: var(--muted); }
.crumb-icon svg { width: 15px; height: 15px; }
.crumb-text { overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { color: var(--faint); font-size: 13px; padding: 0 1px; }
.crumb-anc { display: contents; }
@media (max-width: 760px) { .crumb-anc { display: none; } }

.td { display: flex; flex-direction: column; gap: 12px; }
.td-main { background: var(--surface); border-radius: 16px; padding: 14px 16px 10px; }
.td-main .t-head { padding: 0; border: 0; }
.td-main .t-title { cursor: text; border-radius: 6px; }
.t-desc { cursor: text; }
.t-desc-empty { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 14px; margin-top: 6px; cursor: text; }
.t-desc-empty svg { width: 15px; height: 15px; }
.task.done .t-desc-empty { display: none; }

.td-edit { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 4px; margin: -7px -4px 0 -11px; background: var(--bg); }
.td-edit:focus-within { border-color: var(--faint); }
.td-edit .t-desc-edit { padding: 4px 0 2px; gap: 8px; }
.td-edit .t-desc-edit .prop-icon { width: 16px; color: var(--faint); }
.td-edit .t-desc-edit .prop-icon svg { width: 15px; height: 15px; }
.td-edit .t-desc-input { min-height: 1.45em; font-size: 15px !important; }
.td-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 10px -4px 0 0; }
.sheet[data-mode="edit"] .td-subs, .sheet[data-mode="edit"] .td-add-sub, .sheet[data-mode="edit"] .td-side, .sheet[data-mode="edit"] .td-head { opacity: .45; pointer-events: none; }

.td-add-sub { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 0 4px; margin-top: 6px; }
.td-add-sub svg { width: 16px; height: 16px; }
.td-add-sub:hover { color: var(--text); }
.td-subs { margin-top: 12px; }
.td-subs .sub-head { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.sub-toggle-all { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--text); font-size: 14px; }
.sub-toggle-all .glyph { display: grid; color: var(--muted); transition: transform .15s; }
.sub-toggle-all .glyph svg { width: 15px; height: 15px; }
.td-subs.collapsed .sub-toggle-all .glyph { transform: rotate(-90deg); }
.td-subs.collapsed .sub-head { border-bottom: 0; }
.sub-toggle-all .count { font-weight: 400; color: var(--muted); }
.mini-btn { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 9px; border-radius: 6px; background: var(--hover); }
.mini-btn:hover { color: var(--text); }
.td-subs .sub-row .title { overflow-wrap: anywhere; }
.td-subs .sub-row.done .title { text-decoration: line-through; color: var(--faint); }
.sub-meta { flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.sub-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.sub-due.today { color: var(--accent); } .sub-due.overdue { color: var(--p1); }
.td-subs .sub-add { border-bottom: 1px solid var(--line); padding: 8px 0; }

.td-side { background: var(--surface); border-radius: 16px; padding: 2px 16px; }
.td-field { display: flex; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--line); }
.td-label { width: 82px; flex: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.td-value { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 4px -8px; border-radius: 8px; cursor: pointer; text-align: left; }
.td-value:hover, .td-value:focus-visible { background: var(--hover); }
.td-val { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.td-val .label-list { padding: 0; display: flex; }
.td-ic { display: grid; color: var(--muted); flex: none; }
.td-ic svg, .td-val .uic svg { width: 17px; height: 17px; }
.td-ic.due.today, .td-txt.due.today { color: var(--accent); } .td-ic.due.overdue, .td-txt.due.overdue { color: var(--p1); } .td-ic.due.set { color: var(--p3); }
.td-val .hash { color: var(--muted); font-weight: 500; }
.td-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-txt.muted { color: var(--faint); }
.td-txt.wrap { white-space: normal; overflow-wrap: anywhere; }
.td-chev { display: grid; color: var(--faint); opacity: 0; }
.td-chev svg { width: 15px; height: 15px; }
.td-value:hover .td-chev { opacity: 1; }
.td-clear { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); flex: none; }
.td-clear svg { width: 14px; height: 14px; }
.td-clear:hover { background: var(--hover); color: var(--text); }
.td-empty { justify-content: space-between; margin: 0 -8px; width: calc(100% + 16px); flex: none; }
.td-empty .td-label { width: auto; }
.td-plus { display: grid; color: var(--muted); }
.td-plus svg { width: 17px; height: 17px; }
.td-side > .td-field:last-child { border-bottom: 0; }
.td-stamps { padding: 10px 0 12px; font-size: 12px; color: var(--faint); display: grid; gap: 2px; }
.td-stamps span { display: inline-block; width: 70px; }
@media (hover: none) { .td-chev { opacity: 1; } }

@media (min-width: 761px) {
  .sheet.detail { max-width: 880px; height: min(640px, 100%); }
  .sheet.detail::before { display: none; }
  .sheet.detail .td-head { padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
  .sheet.detail .td-head .round { background: none; border: 0; }
  .sheet.detail .td-head .round:hover { background: var(--hover); }
  .sheet.detail .sheet-body.td { display: grid; grid-template-columns: 1fr 272px; gap: 0; padding: 0; overflow: hidden; }
  .td-main { background: none; border-radius: 0; padding: 18px 24px; overflow-y: auto; }
  .td-side { background: var(--panel); border-radius: 0 0 18px 0; padding: 12px 18px; overflow-y: auto; }
  .td-field { display: block; padding: 10px 0 6px; min-height: 0; }
  .td-field .td-label { width: auto; font-size: 13px; margin-bottom: 4px; }
  .td-value { margin: 0 -8px; }
  .td-empty { margin: -6px -8px 0; }
  .td-empty .td-label { margin: 0; }
}

/* pickers that drop down beside a field on wide screens */
.sheet-layer.pop-layer { display: block; padding: 0; background: transparent !important; }
.sheet.pop { position: fixed; width: 320px; max-width: calc(100vw - 16px); height: auto !important; max-height: min(560px, calc(100% - 16px)); border-radius: 12px; animation: none; box-shadow: var(--shadow); border: 1px solid var(--line); padding-top: 10px; }
.sheet.pop::before, .sheet.pop .sheet-head { display: none; }
.sheet.pop .sheet-body { padding: 0 10px 10px; }
.sheet.pop.tall .sheet-body { max-height: 420px; }
.sheet.pop .list-item { min-height: 38px; }
.sheet.pop .li-text { font-size: 14px; }
.sheet.pop .search input, .sheet.pop .date-text { font-size: 14px; padding: 8px 0; }
.sheet.pop .date-text { padding: 8px 10px; }
.sheet.pop .list-item:hover { background: var(--hover); }
.sheet.pop .cal-grid button { max-height: 34px; max-width: 34px; font-size: 13px; }
.sheet.pop .cal-grid button:hover:not(.sel) { background: var(--hover); }

/* task details on phones: card with rows and chips, sub-tasks below */
.prop-hash { font-size: 20px; font-weight: 500; color: var(--muted); line-height: 1; }
.prop-sub { color: var(--muted); }
.prop-text.due.today { color: var(--accent); } .prop-text.due.overdue { color: var(--p1); }
.pill .uic svg { width: 17px; height: 17px; }
.ph-subs { margin-top: 18px; }
.ph-subs-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px 6px; }
.ph-subs-title { font-weight: 700; font-size: 16px; }
.ph-subs-head .count { color: var(--muted); font-size: 14px; }
.ph-spacer { flex: 1; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); flex: none; }
.icon-btn:active { background: var(--hover); }
.icon-btn svg { width: 20px; height: 20px; }
.ph-collapse svg { transition: transform .15s; }
.ph-subs.collapsed .ph-collapse svg { transform: rotate(-90deg); }
.ph-subs-list { padding: 0 16px; }
.ph-subs-list .sub-row:last-child, .ph-subs-list .sub-add:last-child { border-bottom: 0; }
.ph-subs-list .sub-row.done .title { text-decoration: line-through; color: var(--faint); }
.ph-subs-list .sub-add { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ph-subs-list .sub-add input { font-size: 16px; }
.t-head .t-title, .t-head .t-desc { cursor: pointer; }
.ph-subs-title, .ph-subs-head .mini-btn { white-space: nowrap; }
.ph-subs-head .mini-btn { margin-left: auto; }
.ph-subs-head { gap: 4px; padding-right: 0; }
.ph-subs-head .count { margin-left: 4px; }
.ph-subs-head .icon-btn { width: 32px; height: 32px; }

/* ---------- settings menu ---------- */
.set-menu { padding-top: 2px; }
.set-sec { border-bottom: 1px solid var(--line); }
.set-sec:last-child { border-bottom: 0; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 4px; text-align: left; font-size: 16px; }
.set-row > svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.set-title { font-weight: 600; flex: none; }
.set-meta { flex: 1; min-width: 0; color: var(--faint); font-size: 14px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chev { display: grid; flex: none; color: var(--faint); transition: transform .15s; }
.set-chev svg { width: 16px; height: 16px; }
.set-sec.open .set-chev { transform: rotate(90deg); }
.set-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); vertical-align: middle; margin-left: 4px; }
.set-body { padding: 0 4px 14px; }
.set-body .space-card:first-child { margin-top: 0; }
.set-body .stale-fields { padding-top: 4px; }
.set-body .stale-fields .field { margin: 0; }

/* Agenda and My Day */
.section-head.today { color: var(--accent); }
.section-head .btn.resched { color: var(--p1); padding: 4px 10px; font-size: 13px; margin-left: 6px; }
.myday-glyph, .myday-mark { color: #e0a100; display: inline-flex; }
.meta .myday-mark svg { width: 13px; height: 13px; }
.myday-date { color: var(--muted); font-size: 14px; margin: -4px 0 8px; }
.prop-x { color: var(--faint); display: grid; place-items: center; width: 42px; margin-left: -14px; align-self: stretch; border-top: 1px solid var(--line); }
.prop-x svg { width: 16px; height: 16px; }
.cal-grid button.busy { position: relative; }
.cal-grid button.busy::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; opacity: .55; }
.cal-grid button.sel.busy::after { background: #fff; opacity: .9; }
.agenda-day ul.tasks:empty { min-height: 44px; }
/* Agenda sidebar: overdue, today and upcoming counts */
.ag-counts { display: inline-flex; gap: 7px; font-size: 12px; font-variant-numeric: tabular-nums; margin-left: auto; }
.ag-counts .ag-over { color: var(--p1); font-weight: 700; }
.ag-counts .ag-today { color: var(--accent); font-weight: 700; }
.ag-counts .ag-later { color: var(--faint); }
.section-head .btn.add-myday, .section-head .btn.resched { white-space: nowrap; flex: none; }
.section-head .btn.add-myday { color: var(--accent); padding: 4px 10px; font-size: 13px; margin-left: 6px; }
@media (max-width: 600px) {
  .brief-row { flex-wrap: wrap; row-gap: 2px; }
  .brief-row .btitle { flex: 1; }
  .brief-row .when { flex-basis: 100%; margin-left: 56px; font-size: 13px; }
  .brief-list > li > .brief-body, .brief-list > li > .brief-loading { padding-left: 4px; }
}
