/* Newli Agenda — all styles live here. Design tokens first (Kirby's spec, 19 Nov 2026). */
:root {
  --font-head: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  /* grays */
  --bg: #FFFFFF;
  --bg-soft: #F6F6F5;
  --bg-hover: #F6F6F5;
  --ink: #111111;
  /* text */
  --ink-2: #666666;
  /* secondary */
  --ink-3: #999999;
  /* meta */
  --line: #E6E6E6;
  /* hairlines */
  --line-strong: #D0D0D0;
  /* primary = solid #111;
  magenta only for small accents */
  --primary: #111111;
  --primary-ink: #FFFFFF;
  --accent: #FF2E8A;
  /* active tab underline, focus ring, checked circle, quick-add + */
  --danger: #D1343B;
  --overdue: #D1343B;
  --focus: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--accent);
  --radius: 12px;
  --radius-btn: 8px;
  --radius-sm: 6px;
  --gap: 12px;
  --pad: 16px;
  --tap: 44px;
  --maxw: 1180px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 10px 40px rgba(0,0,0,.12);
  /* one fixed tag palette: pastel fill, dark same-hue text */
  --tag-grey-bg: #EDEDED;
  --tag-grey-fg: #444444;
  --tag-red-bg: #FBE1E1;
  --tag-red-fg: #8E2323;
  --tag-orange-bg: #FCE8D5;
  --tag-orange-fg: #8A4410;
  --tag-yellow-bg: #FAF0C8;
  --tag-yellow-fg: #6B5500;
  --tag-green-bg: #DDF1E2;
  --tag-green-fg: #1F6B35;
  --tag-blue-bg: #DDE9FA;
  --tag-blue-fg: #1F4E8C;
  --tag-purple-bg: #EAE1F7;
  --tag-purple-fg: #563A8A;
  --tag-pink-bg: #FADDEB;
  --tag-pink-fg: #8C2459;
  --pm-page: #FAFAF9;
  --pm-line: #EDEDED;
  --pm-card-line: #ECECEC;
  --pm-sub: #6B6B6B;
  --pm-soft: #F6F6F5;
  --line: #EDEDED;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--pm-page); color: var(--ink); }
body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  letter-spacing: 0;
}
h1, h2, h3 { font-family: var(--font-head); text-transform: uppercase; margin: 0; color: var(--ink); }
h1 { font-size: 15px; font-weight: 600; letter-spacing: .04em; line-height: 20px; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .08em; }
h3 { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--ink-2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-btn);
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-weight: 500; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.btn.primary:hover { background: #2a2a2a; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: var(--tap); padding: 0 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn {
  width: var(--tap); height: var(--tap); min-width: var(--tap); border: 0; background: transparent; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none; padding: 0;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn svg { width: 20px; height: 20px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- inputs ---------- */
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn); background: var(--bg); font-size: 16px; /* 16px stops iOS zoom */
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink); }
label.field, .field.drow { display: grid; gap: 6px; min-width: 0; }
label.field > span, .field.drow > span { font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-head); }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow, .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: var(--gap); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); cursor: pointer; }
.switch input { appearance: none; width: 42px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(16px); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-btn); padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; min-height: var(--tap); padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* pills: a 36px visible pill inside a 44px tap target (the pill is drawn by ::before) */
.pill { position: relative; z-index: 0; min-height: var(--tap); padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font-size: 13px; font-weight: 500; white-space: nowrap; color: #333; }
.pill::before { content: ''; position: absolute; inset: 4px 0; z-index: -1; border-radius: 999px; border: 1px solid var(--pm-card-line); background: #fff; }
.pill[aria-pressed="true"] { color: #fff; }
.pill[aria-pressed="true"]::before { background: #111; border-color: #111; }
.pill:focus-visible { box-shadow: none; }
.pill:focus-visible::before { box-shadow: var(--focus); }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: #fff; backdrop-filter: none; border-bottom: 1px solid var(--pm-line); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: none; margin: 0 auto; display: flex; align-items: center; gap: 4px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); min-height: 60px; }
.topbar h1 { flex: none; min-width: 0; padding: 0 0 0 4px; max-height: 16px; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; color: #111; } /* 2 lines, then ellipsis */
.brand-home { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px; }
.brand-logo { display: block; width: auto; }
.brand-home .brand-logo { height: 30px; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  flex: none;
  box-shadow: none;
}
main { max-width: var(--maxw); margin: 0 auto; padding: 12px max(var(--pad), env(safe-area-inset-right)) calc(48px + var(--safe-b)) max(var(--pad), env(safe-area-inset-left)); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; } /* 44px pills (36px drawn): same visual spacing as 16px around 36px */
.banner { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 24px calc(24px + var(--safe-b)); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.login-card .brand-logo { height: 32px; margin-bottom: 6px; }
.login-card h1 { font-size: 18px; letter-spacing: .1em; }
.login-card .lede { color: var(--ink-2); margin: 0; }
.login-card .dev { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 12px; }
.tag-dev { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); letter-spacing: .06em; text-transform: uppercase; }
.error { color: var(--danger); font-size: 14px; margin: 0; }
.error:empty { display: none; }

/* ---------- project list ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; min-height: var(--tap); padding: 0 10px; font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: 11px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 64px; }
.plist li a:hover { background: var(--bg-soft); }
.plist .pname { font-size: 16px; line-height: 22px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .pmeta { font-size: 12px; color: var(--ink-3); }
.badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; flex: none; border-color: var(--pm-card-line); }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-2); }
.empty p { margin: 0 0 12px; }

/* ---------- sections & tasks ---------- */
.section { margin-bottom: 16px; background: #fff; border: 1px solid var(--pm-card-line); border-radius: 12px; overflow: hidden; }
.section-head { display: flex; align-items: center; min-height: var(--tap); border-bottom: 1px solid var(--ink); margin: 0; padding: 0; }
.section-head .collapse-btn { margin-left: -10px; color: #9a9a9a; }
.section-head > .icon-btn:last-child { margin-right: -10px; }
.section-head .caret { display: inline-flex; transition: transform .15s; }
.section-head .caret svg { width: 18px; height: 18px; }
.section.collapsed .caret { transform: rotate(-90deg); }
.section-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: pointer; padding: 18px 0 14px; }
.section-head .count { font-family: var(--font-body); font-size: 12px; color: var(--ink-3); padding: 0 4px; }
.section.collapsed .tasks, .section.collapsed .quick-add, .section.collapsed .thead { display: none; }
.section.drop-target .section-head { background: var(--bg-soft); }

.tasks { list-style: none; margin: 0; padding: 0; min-height: 4px; }
.task { position: relative; display: flex; align-items: flex-start; gap: 4px; padding: 8px 14px 8px 8px; border-bottom: 1px solid var(--pm-line); cursor: pointer; min-height: 64px; background: var(--bg); }
.task:hover { background: #FBFBFA; }
.task .title { font-size: 15px; line-height: 22px; color: var(--ink); overflow-wrap: anywhere; font-family: var(--font-body); font-weight: 500; letter-spacing: -0.003em; }
.task.done .title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.task.done .chips { opacity: .55; }
.task.drop-before { box-shadow: inset 0 2px 0 var(--ink); }
.task.drop-after { box-shadow: inset 0 -2px 0 var(--ink); }
.task.dragging { opacity: .35; }
.drag-ghost { position: fixed; z-index: 70; pointer-events: none; background: var(--bg); box-shadow: var(--shadow); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 15px; max-width: 80vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body.is-dragging, body.is-dragging * { user-select: none; -webkit-user-select: none; cursor: grabbing !important; }
/* r3 (P1 20 Nov): while dragging, rows passed over don't light up (a grey row read as "drop onto this task"); only the
   line between rows, or the target section's header with a line under it, says where the task will land. */
body.is-dragging .task:hover { background: transparent; }
.section.drop-target .section-head { box-shadow: inset 0 -2px 0 var(--ink); }
.grip { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }

/* 44px hit area, 22px visual circle */
.check-hit { width: var(--tap); height: var(--tap); flex: none; display: inline-flex; align-items: center; justify-content: center; margin: -5px -6px -5px -12px; cursor: pointer; }
.check { appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); margin: 0; flex: none; cursor: pointer; position: relative; background: var(--bg); border-color: #CFCFCF; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ''; position: absolute; left: 6.5px; top: 2.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check:disabled { cursor: default; border-color: #CCCCCC; background: #F4F4F4; pointer-events: none; }
.check:disabled:checked { background: #CCCCCC; border-color: #CCCCCC; }
.check-hit:has(.check:disabled) { pointer-events: none; cursor: default; }
/* grip: full 44x44 hit area, never overlapping the complete circle. Phone: right end of the row. Desktop: left. */
.grip { width: var(--tap); height: var(--tap); flex: none; display: inline-flex; align-items: center; justify-content: center; color: #999999; touch-action: none; cursor: grab; border: 0; background: none; padding: 0; margin: -5px -10px -5px 0; order: 3; border-radius: var(--radius-sm); }
.grip:hover { background: var(--bg-hover); }
.grip svg { width: 16px; height: 16px; }
.task .body { flex: 1; min-width: 0; display: grid; gap: 6px; padding: 8px 0 6px 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { font-family: var(--font-body); font-size: 12px; font-weight: 500; line-height: 18px; padding: 0 9px 0 8px; border-radius: 999px; background: #F4F4F3; color: #555; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; box-shadow: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--pm-line); }
.chip.initials { background: #111; color: #fff; padding: 0 6px; min-width: 22px; text-align: center; font-weight: 600; border-color: #111; }
.chip.due { background: transparent; color: var(--pm-sub); padding: 0 2px; border: 0; }
.chip.due.today, .due-text.today { color: #111; font-weight: 500; }
.chip.due.overdue { color: #B42A31; box-shadow: none; padding: 0 2px; background: transparent; font-weight: 500; }
.due-text.overdue { color: #B42A31; box-shadow: inset 0 0 0 1px var(--overdue); padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 20px; display: inline-block; font-weight: 500; }
.chip.note { background: transparent; color: var(--ink-3); padding: 0; border: 0; }
.t-grey   { background: var(--tag-grey-bg);   color: var(--tag-grey-fg); }
.t-red    { background: var(--tag-red-bg);    color: var(--tag-red-fg); }
.t-orange { background: var(--tag-orange-bg); color: var(--tag-orange-fg); }
.t-yellow { background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); }
.t-green  { background: var(--tag-green-bg);  color: var(--tag-green-fg); }
.t-blue   { background: var(--tag-blue-bg);   color: var(--tag-blue-fg); }
.t-purple { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }
.t-pink   { background: var(--tag-pink-bg);   color: var(--tag-pink-fg); }
/* tag pills are neutral; the colour lives in a 6px dot (see the ::before rules) */
.chip.t-grey, .chip.t-red, .chip.t-orange, .chip.t-yellow, .chip.t-green, .chip.t-blue, .chip.t-purple, .chip.t-pink { background: #F4F4F3; color: #555; }

.quick-add { display: flex; gap: 0; align-items: center; min-height: 52px; padding: 0 14px 0 8px; border-top: 1px solid var(--pm-line); }
.quick-add .plus { color: var(--accent); font-size: 18px; width: 32px; text-align: center; flex: none; font-weight: 500; }
.quick-add :is(input, textarea) { flex: 1; min-width: 0; border: 0; background: transparent; min-height: var(--tap); padding: 0 4px; font-size: 16px; color: var(--ink); }
.quick-add :is(input, textarea)::placeholder { color: #A0A0A0; font-size: 14px; }
.quick-add :is(input, textarea):focus { outline: none; }
.add-section { display: flex; align-items: center; gap: 6px; border: 0; background: none; min-height: var(--tap); padding: 0; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.add-section .plus { color: var(--accent); font-size: 18px; }
.thead { display: none; }

/* ---------- desktop table (>= 900px) ---------- */
@media (min-width: 900px) {
  main { padding-left: 24px; padding-right: 24px; }
  /* the project view is its own scroller so wide tables scroll sideways and the header can stick */
  main.grid { max-width: none; height: calc(100vh - 57px - env(safe-area-inset-top)); height: calc(100vh - 61px); overflow: auto; overscroll-behavior: contain; padding: 8px 24px 48px; }
  main.grid > * { max-width: calc(var(--maxw) - 48px); margin-left: auto; margin-right: auto; min-width: var(--minw); }
  .grid .thead, .grid .task { display: grid; grid-template-columns: var(--cols); align-items: center; gap: 0 12px; }
  .grid .thead { position: sticky; top: 0; z-index: 3; background: var(--bg); font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--ink-2); padding: 10px 14px 6px 8px; border-bottom: 1px solid var(--line); }
  .grid .thead > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid .thead > :first-child { padding-left: 80px; }
  .grid .task { min-height: 52px; padding: 0 14px 0 8px; }
  .grid .task .chips { display: none; }
  .grid .task .body { padding: 0 0 0 4px; }
  .grid .task .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .grid .cell { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .grid .first { display: flex; align-items: center; gap: 0; min-width: 0; padding: 0; }
  .grid .grip { order: 0; margin: 0; }
  .grid .check-hit { margin: 0; }
  .grid .task:not(:has(.grip)) .first { padding-left: 44px; }
}
@media (max-width: 899px) { .grid .cell { display: none; } .grid .first { display: contents; } }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; box-shadow: var(--shadow); }
.sheet-head { display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 6px max(6px, env(safe-area-inset-right)) 6px max(var(--pad), env(safe-area-inset-left)); border-bottom: 1px solid var(--line); flex: none; }
.head-title-wrap { flex: 1; min-width: 0; display: flex; }
.head-title-view { flex: 1; min-width: 0; min-height: var(--tap); text-align: left; font-size: 17px; line-height: 24px; font-weight: 500; border: 0; background: transparent; padding: 8px 4px; border-radius: var(--radius-sm); color: var(--ink);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
button.head-title-view { cursor: text; }
button.head-title-view:hover { background: var(--bg-soft); }
.sheet-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sheet-head .head-title { flex: 1; min-width: 0; font-size: 17px; line-height: 24px; font-weight: 500; border: 0; padding: 8px 4px; border-radius: var(--radius-sm); background: transparent; resize: none; overflow-y: auto; max-height: 96px; }
.sheet-head .head-title:hover { background: var(--bg-soft); }
.sheet-head .head-title:focus { outline: none; background: var(--bg-soft); }
.sheet-scroll { overflow: auto; overscroll-behavior: contain; padding: 14px max(var(--pad), env(safe-area-inset-right)) calc(24px + var(--safe-b)) max(var(--pad), env(safe-area-inset-left)); }
@media (min-width: 700px) {
  .scrim { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; border-radius: 16px; max-height: 86vh; }
}
.actions { display: grid; gap: 8px; }
.actions .btn { justify-content: flex-start; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
input[type=date].input { display: block; min-width: 0; max-width: 100%; width: 100%; -webkit-appearance: none; appearance: none; }
.fields .full { grid-column: 1 / -1; }
.notes-log { list-style: none; margin: 0; padding: 0; }
.notes-log li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.notes-log .note-meta { color: var(--ink-3); font-size: 12px; margin-right: 2px; font-variant-numeric: tabular-nums; }
.notes-log .icon-btn { margin: -10px -10px -10px 0; color: var(--ink-3); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member .em { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.tagcol { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid transparent; background-clip: content-box; padding: 6px; }
.opt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.opt { display: inline-flex; align-items: center; }
.opt .opt-remove { color: var(--ink-3); margin-left: -6px; }
.opt .opt-remove svg { width: 16px; height: 16px; }
.swatch[aria-pressed="true"] { border-color: var(--ink); }
.foot-note { font-size: 12px; color: var(--ink-3); margin: 0; }

#toast { pointer-events: none; position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-btn); font-size: 14px; z-index: 80; max-width: calc(100vw - 32px); }
/* Hawkeye P4b: on a phone the Goals comment fields sit low on the screen (the Rock panel, the action comment sheet),
   so there the toast shows at the top instead of over the field the person just typed in */
@media (max-width: 699px) { body:has([data-test=rock-panel]) #toast, body:has(.g-csheet) #toast { top: calc(8px + env(safe-area-inset-top, 0px)); bottom: auto; } }

/* ---------- section headers: Asana-style open/close (whole header toggles) ---------- */
.section-head { cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; border-bottom: 1px solid var(--pm-line); padding: 0 8px 0 12px; min-height: 52px; }
.section-head:hover { background: transparent; }
.section-head .count { min-width: 20px; text-align: right; font-variant-numeric: tabular-nums; color: #9a9a9a; }

/* ---------- task rows: subtask progress + selected row ---------- */
.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-line .title { min-width: 0; }
.chip.sub { flex: none; background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--pm-sub); font-variant-numeric: tabular-nums; padding: 0 7px; border: 1px solid var(--pm-card-line); }
.chip.sub.all { color: var(--tag-green-fg); box-shadow: inset 0 0 0 1px #8CCB9C; }
.task.selected, .task.selected:hover { background: var(--bg-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- task detail: full-screen sheet on phone, right panel at >= 900px ---------- */
.detail { position: fixed; inset: 0; z-index: 30; background: #fff; display: flex; flex-direction: column; }
.detail-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--pm-line);
  padding: calc(6px + env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) 6px max(6px, env(safe-area-inset-left));
}
.detail-head .spacer { flex: 1; }
.only-desk { display: none; }
.only-phone, .only-desk { align-items: center; justify-content: center; }
.only-phone { display: inline-flex; }
.mark-complete { min-height: var(--tap); display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; border-color: var(--pm-card-line); }
.mark-complete:hover { background: var(--bg-hover); }
.mark-complete svg { width: 16px; height: 16px; }
.mark-complete.is-done { background: var(--tag-green-bg); border-color: #8CCB9C; color: var(--tag-green-fg); font-weight: 600; }
.mark-complete:disabled { opacity: .55; cursor: default; }
.detail-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px 24px 32px; }
.detail-body { display: grid; gap: 24px; max-width: 720px; margin: 0 auto; }
.detail-body > .banner { margin: 0; }
.detail-foot { flex: none; border-top: 1px solid var(--pm-line); background: var(--bg); padding: 8px max(var(--pad), env(safe-area-inset-right)) calc(8px + var(--safe-b)) max(var(--pad), env(safe-area-inset-left)); }
.detail-foot p { margin: 10px 0; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea.input { flex: 1; min-height: var(--tap); height: var(--tap); resize: none; padding-top: 10px; line-height: 22px; }
.composer .avatar { margin-bottom: 8px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.privacy { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--pm-sub); background: var(--pm-soft); border-radius: 8px; padding: 9px 12px; }
.privacy svg { width: 16px; height: 16px; flex: none; }

.detail-title-wrap { margin: -6px -8px -8px; }
.detail-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  width: 100%;
  min-height: var(--tap);
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-family: var(--font-body);
  text-transform: none;
  font-size: 22px;
  line-height: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
button.detail-title { cursor: text; }
button.detail-title:hover { background: var(--bg-soft); }
textarea.detail-title { display: block; resize: none; background: var(--bg-soft); outline: none; -webkit-line-clamp: unset; }
.detail .task-done-title { color: var(--ink-3); }

.dfields { display: grid; gap: 0; border-top: 1px solid var(--pm-line); }
.field.drow { grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--pm-line); }
.dval { display: flex; align-items: center; gap: 8px; min-width: 0; justify-content: flex-end; position: relative; }
.dval .input { flex: 1; min-width: 0; width: auto; }
.due-hint { font-size: 13px; color: #9a9a9a; white-space: nowrap; flex: none; }
.due-hint.today { color: var(--ink); font-weight: 700; }
.due-hint.overdue { color: var(--overdue); font-weight: 600; }
.proj-name { font-size: 14px; color: var(--ink); max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
.dval .sep { color: var(--ink-3); flex: none; }

.dblock { display: grid; gap: 10px; min-width: 0; }
.dblock h3 .count { font-family: var(--font-body); font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 22px; min-height: 72px; padding: 10px 12px; border-radius: var(--radius-btn); border: 1px solid transparent; }
.desc.editable { border-color: var(--line); cursor: text; }
.desc.editable:hover { border-color: var(--line-strong); background: #F2F2F1; }
.desc.empty-desc { color: var(--ink-3); }
.desc a, .c-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; overflow-wrap: anywhere; }
textarea.desc-input { min-height: 96px; resize: vertical; line-height: 22px; }

.subtasks, .links, .comments, .activity { list-style: none; margin: 0; padding: 0; }
.subtask { display: flex; align-items: center; gap: 4px; min-height: var(--tap); border-bottom: 1px solid var(--line); }
.subtask .check-hit { margin: 0 -6px 0 -12px; }
.sub-title { flex: 1; min-width: 0; min-height: var(--tap); border: 0; background: transparent; padding: 0 6px; font-size: 15px; border-radius: var(--radius-sm); color: var(--ink); }
span.sub-title { display: flex; align-items: center; overflow-wrap: anywhere; }
input.sub-title:focus { outline: none; background: var(--bg-soft); }
.subtask.done .sub-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.subtask .icon-btn, .links .icon-btn { color: var(--ink-3); margin-right: -10px; }
.links li { display: flex; align-items: center; gap: 10px; min-height: var(--tap); border-bottom: 1px solid var(--line); padding: 4px 0; }
.links li > svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.links a { color: var(--ink); font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.links a:hover { text-decoration: underline; }
.link-url { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 4px; }
.link-actions { display: flex; justify-content: flex-end; gap: 8px; }

.feed .tabs { margin-bottom: 0; border-bottom-color: var(--pm-line); }
.comments li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.c-meta { font-size: 13px; color: var(--ink-2); }
.c-meta strong { color: var(--ink); font-weight: 600; }
.c-meta time { color: var(--ink-2); margin-left: 4px; }
.c-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 22px; margin-top: 2px; }
.comments .icon-btn { color: var(--ink-3); margin: -10px -10px 0 0; }
.activity li { font-size: 13px; line-height: 20px; color: var(--ink-2); padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.activity strong { color: var(--ink); font-weight: 600; }
.activity time { color: var(--ink-2); }

@media (min-width: 900px) {
  :root { --detail-w: clamp(480px, 38vw, 560px); }
  .detail { inset: auto; top: 61px; right: 0; bottom: 0; width: var(--detail-w); z-index: 20; border-left: 1px solid var(--pm-line); box-shadow: -12px 0 32px rgba(17,17,17,.06); }
  .detail-head { padding: 6px max(8px, env(safe-area-inset-right)) 6px 16px; }
  .detail-close { order: 10; }
  .only-desk { display: inline-flex; }
  .only-phone { display: none; }
  .detail-scroll { padding: 18px max(24px, env(safe-area-inset-right)) 24px 24px; }
  .detail-foot { padding: 10px max(24px, env(safe-area-inset-right)) calc(10px + var(--safe-b)) 24px; }
  body.has-detail main.grid { margin-right: var(--detail-w); }
}
@media (max-width: 899px) { body.has-detail { overflow: hidden; } }


/* ---------- Kirby review of the task detail ---------- */
/* 1. desktop with the panel open: Assignee + Comments step aside, Task gets the room and wraps to 2 lines */
@media (min-width: 900px) {
  body.has-detail .grid .panel-hide { display: none; }
  body.has-detail .grid .thead, body.has-detail .grid .task { grid-template-columns: var(--cols-panel); }
  body.has-detail main.grid > * { min-width: var(--minw-panel); }
  body.has-detail .grid .task { padding: 6px 0; min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  body.has-detail .grid .task .title { white-space: normal; text-overflow: clip; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 20px; }
}
/* 2. project breadcrumb above the title */
.detail-crumb { font-size: 12px; line-height: 16px; color: var(--pm-sub); margin-bottom: -16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 3. view-only values are plain text */
.dtext { display: flex; align-items: center; min-height: var(--tap); font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.dtext.none { color: var(--ink-3); }
.done-chip { align-self: center; }
/* 4. due date: "Fri 20 Nov" + gray hint; a transparent native date input on top opens the system picker */
.due-pick { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; border-radius: var(--radius-btn); font-size: 15px; color: var(--ink); background: transparent; cursor: pointer; flex: none; font-variant-numeric: tabular-nums; }
.due-pick:hover { background: transparent; }
.due-pick.empty { color: var(--ink-3); }
.due-pick:focus-within { box-shadow: var(--focus); }
.due-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; font-size: 16px; }
.due-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.detail .due-hint.today { color: var(--ink-2); font-weight: 400; }
.due-clear { margin-left: 0; color: #B8B8B8; }
/* 5. subtask titles wrap */
.subtask { align-items: flex-start; border-bottom: 1px solid var(--pm-line); }
.subtask .icon-btn { flex: none; }
textarea.sub-title { display: block; resize: none; overflow: hidden; font: inherit; font-size: 16px; line-height: 22px; padding: 11px 6px; height: 44px; }
textarea.sub-title:focus { outline: none; background: var(--bg-soft); }
span.sub-title { padding: 11px 6px; line-height: 22px; display: block; }
/* 6. activity: "· date" never splits */
.activity time { white-space: nowrap; }
/* 7. "+ Add link" text button */
.text-btn { display: inline-flex; align-items: center; align-self: flex-start; justify-self: start; width: auto; text-align: left; min-height: var(--tap); padding: 0; border: 0; background: none; color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.text-btn:hover { text-decoration: underline; }

/* autosave status under the description / title */
.save-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; line-height: 18px; margin-top: 6px; color: var(--ink-2); }
.save-status.error { color: var(--overdue); font-weight: 600; }
.save-status.conflict { background: var(--bg-soft); border-radius: var(--radius-btn); padding: 4px 12px; color: var(--ink); }
.save-status .text-btn { font-size: 13px; }

/* unsaved-text bar (title / description): visible in every panel state, including view-only and "task deleted" */
.unsaved-bar { border: 1px solid var(--line-strong); border-left: 3px solid var(--overdue); border-radius: var(--radius-btn); padding: 10px 12px; background: var(--bg); font-size: 14px; line-height: 20px; color: var(--ink); display: grid; gap: 4px; }
.unsaved-bar.conflict { border-left-color: var(--ink); }
.unsaved-bar.offer { border-left-color: var(--line-strong); }
.unsaved-bar .u-actions { display: flex; flex-wrap: wrap; gap: 0 18px; }
.unsaved-bar .text-btn.danger { color: var(--danger); }
.unsaved-bar details.theirs summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; font-size: 14px; }
.unsaved-bar details.theirs .desc { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 8px 10px; max-height: 240px; overflow: auto; }

/* ---------- premium pass (Kirby, kirby-premium/premium.css), rules with no earlier home in this file ---------- */
.topbar-id { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 0; }
.newli-logo { display: inline-flex; align-self: flex-start; padding: 0 0 0 4px; }
.newli-logo img { display: block; height: 22px; width: auto; }
/* 44px hit area without changing the drawn logo or the header: a transparent ::before (Hawkeye PR2-P3-2). Phone: the
   logo sits above the project title, so the slop runs from the top of the back button's box down over the title's
   first ~80px (the title itself isn't a control, and the logo and Back both go home). */
.newli-logo { position: relative; }
.newli-logo::before { content: ''; position: absolute; top: -2px; bottom: -20px; left: -4px; right: -4px; }
.topbar .icon-btn { min-width: var(--tap); width: var(--tap); padding: 0; justify-content: center; } /* spec says 40px; kept at the 44px tap minimum */
.grid .thead { font-weight: 600; font-size: 11px; letter-spacing: .1em; color: var(--pm-sub); border-bottom: 0; background: transparent; padding: 10px 0 4px; position: static; }
h2, h3 { font-weight: 600; font-size: 11.5px; letter-spacing: .1em; color: var(--pm-sub); }
.grid .cell, .grid .task .title { font-size: 14px; }
.grid .cell { font-variant-numeric: tabular-nums; }
.chip.due, .due-text, .due-text-val, .due-hint, .count { font-variant-numeric: tabular-nums; }
.field.drow > span, label.field > span { font-family: var(--font-body); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--pm-sub); }
main.grid { padding: 8px max(20px, env(safe-area-inset-right)) calc(40px + var(--safe-b)) max(20px, env(safe-area-inset-left)); background: var(--pm-page); }
.section.collapsed .section-head { border-bottom: 0; }
.task:last-of-type { border-bottom: 0; }
.tasks:empty + .quick-add { border-top: 0; }
.grid .thead, .grid .task { padding-left: 8px; padding-right: 14px; }
.chip.t-red::before, .chip.t-blue::before, .chip.t-orange::before, .chip.t-yellow::before, .chip.t-green::before, .chip.t-grey::before, .chip.t-purple::before, .chip.t-pink::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex: none; background: #B5B5B5; }
.chip.t-red::before { background: #D1343B; }
.chip.t-blue::before { background: #2F6FDB; }
.chip.t-orange::before { background: #F59E0B; }
.chip.t-yellow::before { background: #E3C200; }
.chip.t-green::before { background: #2E9E57; }
.chip.t-purple::before { background: #7A5CC7; }
.chip.t-pink::before { background: #D94C8B; }
.chip.initials::before { display: none; }
.chip.sub::before { display: none; }
.dval select.input { appearance: none; -webkit-appearance: none; border: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B8B8B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat right 0 center; padding: 0 24px 0 0; text-align: right; text-align-last: right; font-size: 15px; font-weight: 400; min-height: 44px; border-radius: 0; cursor: pointer; }
.dval select.input:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.dval:has(.due-pick) { justify-content: flex-end; }
.desc, .desc.editable { background: var(--pm-soft); border: 0; border-radius: 12px; padding: 16px; font-size: 15px; line-height: 23px; }
.btn.primary, .composer .btn { background: #111; border-color: #111; }
/* view-only description: plain text on the same left edge as the field labels (no soft box) */
.desc:not(.editable) { padding: 0; border: 0; min-height: 0; background: transparent; border-radius: 0; }
/* phone: form controls stay at 16px so iOS doesn't zoom */
@media (max-width: 899px) { .dval select.input { font-size: 16px; } }
.input { border-color: var(--pm-card-line); }
@media (min-width: 900px) {
  main.grid { height: calc(100vh - 61px); padding: 8px max(24px, env(safe-area-inset-right)) calc(48px + var(--safe-b)) max(24px, env(safe-area-inset-left)); }
  .grid .thead { padding: 10px 14px 6px 8px; }
  .topbar-inner { padding: 0 max(20px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .topbar-id { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0; padding: 0; }
  .newli-logo { align-self: center; padding: 0 20px 0 6px; margin-right: 16px; border-right: 1px solid var(--pm-line); height: 28px; }
  .newli-logo img { height: 24px; }
  .newli-logo::before { top: -8px; bottom: -8px; left: 0; right: 0; } /* 28px link -> 44px, divider stays 28px */
  .topbar h1 { padding: 0; font-size: 12px; max-height: 20px; line-height: 20px; }
  .quick-add { min-height: 52px; }
}

/* ====================== compact density (Kirby kirby-premium/compact/compact-spec.md; John 11:06 "table spacing is way too wide") ====================== */
:root { --pm-head: #FAFAF9; }
body { font-size: 14px; }

/* Header stays 56-60px; desktop is full width */
.topbar-inner { min-height: 56px; }

/* One white surface, no cards */
main.grid { background: #fff; padding: 4px max(20px, env(safe-area-inset-right)) calc(24px + var(--safe-b)) max(20px, env(safe-area-inset-left)); }
.toolbar { padding: 4px 0 8px; gap: 8px; min-height: 40px; }
.pill { min-height: 32px; height: 32px; font-size: 12px; padding: 0 12px; }
.pill::before { inset: 0; }
.section { background: transparent; border: 0; border-radius: 0; margin: 0 0 10px; overflow: visible; }
.section-head { min-height: 36px; padding: 0 0 0 4px; background: var(--pm-head); border-top: 1px solid var(--pm-line); border-bottom: 1px solid var(--pm-line); }
.section-head h2 { padding: 0; font-size: 11px; letter-spacing: .1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line, header stays 36/32px */
.chips .chip.fit { flex: 0 1 auto; min-width: 0; }
/* visually hidden, still read by screen readers */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.chip .ct { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.more { flex: none; font-size: 11px; padding: 0 6px; }
.chips .chip.note { flex: none; }
.section-head .collapse-btn { margin-left: -8px; min-width: 44px; width: 44px; height: 36px; min-height: 36px; }
.section-head > .icon-btn:last-child { min-height: 36px; height: 36px; margin-right: 0; }
.section-head .caret svg { width: 16px; height: 16px; }
/* the buttons' 44px boxes overhang the 30/34px bar: paint them above the next row (.task is position: relative) */
.section-head .collapse-btn, .section-head > .icon-btn:last-child { position: relative; z-index: 1; }
.section.collapsed .section-head { border-bottom: 1px solid var(--pm-line); }
.task { padding: 8px 4px 8px 0; min-height: 0; }
.task .body { padding: 0 0 0 4px; gap: 1px; }
.task .title { font-size: 15px; line-height: 20px; }
.task .title-line { gap: 8px; }
.check-hit { margin: -8px -4px -8px -12px; height: 44px; }
.check { width: 20px; height: 20px; }
.check:checked::after { left: 5.5px; top: 2px; }
.chips { gap: 6px; flex-wrap: nowrap; overflow: hidden; line-height: 17px; min-height: 17px; }
.chip { font-size: 11.5px; line-height: 16px; padding: 0 8px 0 7px; gap: 5px; flex: none; }
.chip.initials { font-size: 10.5px; padding: 0 5px; min-width: 20px; }
.chip.due { font-size: 12px; padding: 0 1px; }
.chip.due.overdue { padding: 0 1px; }
.chip.note { font-size: 12px; color: var(--pm-sub); padding: 0; gap: 3px; display: inline-flex; align-items: center; }
.chip.note::before { content: ''; width: 12px; height: 12px; background: #9a9a9a; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 01-11.5 7.2L4 20l1-4.6A8 8 0 1121 12z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 01-11.5 7.2L4 20l1-4.6A8 8 0 1121 12z'/%3E%3C/svg%3E") center/contain no-repeat; border-radius: 0; }
.chip.sub { font-size: 11px; line-height: 16px; padding: 0 6px; }
.quick-add { min-height: 40px; padding: 0 4px; border-top: 1px solid var(--pm-line); }
.quick-add .plus { width: 28px; font-size: 16px; }
.quick-add :is(input, textarea) { min-height: 40px; font-size: 14px; }
.quick-add :is(input, textarea)::placeholder { font-size: 13px; }
.thead { border: 0; }

/* full width: undo the app's centered 1156px cap */
main.grid > * { max-width: none; margin-left: 0; margin-right: 0; }

/* Desktop: 32px rows, 13/12px type, one column header row */
@media (min-width: 900px) {
  .topbar-inner { padding: 0 max(20px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  main.grid { height: calc(100vh - 57px - env(safe-area-inset-top)); padding: 2px max(20px, env(safe-area-inset-right)) calc(24px + var(--safe-b)) max(20px, env(safe-area-inset-left)); }
  .toolbar { padding: 4px 0 6px; min-height: 40px; }
  .section { margin-bottom: 8px; }
  .section-head { min-height: 30px; padding-left: 0; } /* 30 + top/bottom hairlines = 32px */
  .section-head .collapse-btn { width: 32px; min-width: 32px; height: 30px; min-height: 30px; margin-left: 0; }
  .section-head > .icon-btn:last-child { height: 30px; min-height: 30px; width: 32px; min-width: 32px; }
  .section-head .count { font-size: 11px; }
  /* column header: one 28px row for the whole table, sticky at the top of the scroller (stays when sections collapse) */
  .grid .thead { min-height: 28px; height: 28px; padding: 0 8px 0 8px; align-items: center; font-size: 10.5px; border-bottom: 1px solid var(--pm-line); position: sticky; top: -2px; z-index: 3; background: #fff; } /* -2px: flush with the scroller top over its 2px padding */
  .grid .thead > :first-child { padding-left: 52px; }
  .grid .task { min-height: 32px; height: 32px; padding: 0 8px 0 4px; }
  .grid .task .title { font-size: 13px; line-height: 20px; font-weight: 500; }
  .grid .cell { font-size: 12px; line-height: 16px; }
  .grid .chip { font-size: 11px; line-height: 16px; }
  .grid .chip.initials { font-size: 10px; }
  .grid .check-hit { height: 32px; width: 32px; margin: 0; }
  .grid .check { width: 16px; height: 16px; }
  .grid .check:checked::after { left: 4.5px; top: 1.5px; width: 4px; height: 8px; }
  .grid .grip { width: 24px; min-width: 24px; height: 32px; }
  .grid .grip svg { width: 14px; height: 14px; }
  .grid .task:not(:has(.grip)) .first { padding-left: 24px; }
  .grid .task .body { padding: 0 0 0 2px; }
  .chip.sub { margin-left: 2px; }
  .quick-add { min-height: 28px; height: 28px; padding: 0 8px 0 4px; border-top: 0; border-bottom: 1px solid var(--pm-line); }
  .quick-add .plus { width: 24px; font-size: 14px; }
  .quick-add :is(input, textarea) { min-height: 28px; height: 28px; font-size: 12px; color: #6B6B6B; }
  .quick-add :is(input, textarea)::placeholder { font-size: 12px; color: #9a9a9a; }
  .detail { top: 57px; }
  body.has-detail .grid .task { min-height: 32px; height: 32px; padding-top: 0; padding-bottom: 0; }
  body.has-detail .grid .task .title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 20px; }
  body.has-detail .grid .thead, body.has-detail .grid .task { padding-right: 8px; }
  /* detail panel density */
  .detail-head { min-height: 52px; }
  .detail-scroll { padding: 16px 20px 24px; }
  .detail-body { gap: 16px; }
  .field.drow { min-height: 40px; }
  /* compact spec draws these at 36px; keep a 44px hit area with -4px margins so the 40px row doesn't grow */
  .dval select.input, .due-pick { min-height: 44px; margin: -4px 0; font-size: 14px; }
  .detail-title { font-size: 20px; line-height: 28px; }
  .desc, .desc.editable { padding: 12px 14px; font-size: 14px; line-height: 21px; }
}

/* Touch-primary screens at desktop widths (e.g. iPad landscape): keep the compact look but give every
   control a 44px hit area again (Hawkeye PR-P2-1). Drawn sizes stay: 16px check, 14px grip icon, 32px pills,
   30px section bar, 13/12px type. Stacked rows can't share hit-slop without overlapping, so on touch the row and
   the Add task line are 44px tall (content still drawn at the compact size); a mouse keeps 32px rows.
   `pointer: coarse` follows the PRIMARY pointer: touch laptops and most hybrids report a fine pointer (trackpad), so
   they get the 32px mouse layout; `any-pointer: coarse` would catch them but isn't used (mouse density wins there). */
@media (min-width: 900px) and (pointer: coarse) {
  .grid .task, body.has-detail .grid .task { min-height: var(--tap); height: var(--tap); }
  .grid .check-hit { width: var(--tap); height: var(--tap); margin: 0; }
  .grid .grip { width: var(--tap); min-width: var(--tap); height: var(--tap); margin: 0; } /* side by side with the check, never overlapping */
  .grid .task:not(:has(.grip)) .first { padding-left: var(--tap); }
  .grid .thead > :first-child { padding-left: 84px; } /* 44 grip + 44 check + 4 row pad - 8 header pad */
  .section-head .collapse-btn, .section-head > .icon-btn:last-child { width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); margin-top: -7px; margin-bottom: -7px; } /* 44px tap, 30px of layout */
  .pill { height: var(--tap); min-height: var(--tap); }
  .pill::before { inset: 6px 0; } /* still drawn at 32px */
  .toolbar { padding: 0 0 2px; }
  .quick-add, .quick-add :is(input, textarea) { min-height: var(--tap); height: var(--tap); }
  .grid .thead + .section { margin-top: 7px; } /* the first bar's buttons overhang 7px up: keep them clear of the sticky header (z 3) */
}

/* Phone: 52-56px rows, meta on one line, 36px section headers */
@media (max-width: 899px) {
  main.grid { padding: 0 max(20px, env(safe-area-inset-right)) calc(24px + var(--safe-b)) max(20px, env(safe-area-inset-left)); }
  .toolbar { padding: 2px 0; } /* 44px chip boxes drawn at 32px = the spec's 8px padding around 32px chips */
  .pill { height: var(--tap); min-height: var(--tap); }
  .pill::before { inset: 6px 0; }
  .section { margin-bottom: 10px; }
  .section-head { margin: 0 -20px; padding: 0 12px 0 16px; }
  .section-head .collapse-btn { margin-left: -12px; }
  .section-head { min-height: 34px; } /* 34 + hairlines = 36px */
  .section-head .collapse-btn, .section-head > .icon-btn:last-child { height: var(--tap); min-height: var(--tap); margin-top: -5px; margin-bottom: -5px; } /* 44px tap, 34px of layout */
  .task { padding: 8px 0 8px 0; }
  .task .body { padding: 0 0 0 4px; }
  .task .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .grid .task .title { font-size: 15px; } /* spec: 15px (the premium .grid rule would make it 14px) */
  .title-line { min-width: 0; }
  .task .grip { width: var(--tap); min-width: var(--tap); margin-left: -8px; margin-right: -16px; } /* 44px box, takes 28px */
  .quick-add { padding-left: 0; min-height: var(--tap); }
  .quick-add :is(input, textarea) { min-height: var(--tap); font-size: 16px; } /* 16px: no iOS zoom */
  .detail-scroll { padding: 16px 20px 24px; }
  .detail-body { gap: 20px; }
  .field.drow { min-height: 48px; }
}
