/* YouDo — layout: phone-first single column with a raised capture button; desktop gets a left rail and a right detail drawer */
:root {
  --bg: #F5F7F6;
  --surface: #FFFFFF;
  --surface-2: #ECF0EE;
  --ink: #1A1A1A;
  --ink-2: #56605B;
  --ink-3: #8A948F;
  --line: #E1E7E4;
  --accent: #2ECC71;
  --accent-ink: #12803F;
  --accent-soft: #DDF5E7;
  --idea: #FF69B4;
  --idea-ink: #C0176F;
  --idea-soft: #FFE6F2;
  --p1: #E5484D;
  --p2: #F08C00;
  --p3: #2F7CF6;
  --p4: #A1AAA6;
  --warn-soft: #FFF1DD;
  --danger: #D93036;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 8px 24px rgba(20, 30, 25, .08);
  --shadow-lg: 0 -6px 40px rgba(20, 30, 25, .18);
  --scrim: rgba(17, 22, 20, .38);
  --font-display: "Unbounded", "Onest", system-ui, sans-serif;
  --font-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --kb: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101312; --surface: #181C1A; --surface-2: #222826; --ink: #EDF2EF; --ink-2: #A9B3AE; --ink-3: #747F7A;
    --line: #2A312E; --accent: #2ECC71; --accent-ink: #4BDD8A; --accent-soft: #15301F;
    --idea: #FF69B4; --idea-ink: #FF8FC8; --idea-soft: #3A1A2B; --p1: #FF5C61; --p2: #FFA126; --p3: #5B9BFF; --p4: #6F7975;
    --warn-soft: #33270F; --danger: #FF5C61; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 -6px 40px rgba(0,0,0,.5); --scrim: rgba(0,0,0,.55); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101312; --surface: #181C1A; --surface-2: #222826; --ink: #EDF2EF; --ink-2: #A9B3AE; --ink-3: #747F7A;
  --line: #2A312E; --accent: #2ECC71; --accent-ink: #4BDD8A; --accent-soft: #15301F;
  --idea: #FF69B4; --idea-ink: #FF8FC8; --idea-soft: #3A1A2B; --p1: #FF5C61; --p2: #FFA126; --p3: #5B9BFF; --p4: #6F7975;
  --warn-soft: #33270F; --danger: #FF5C61; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 -6px 40px rgba(0,0,0,.5); --scrim: rgba(0,0,0,.55); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}
a { color: var(--accent-ink); }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.xs { width: 13px; height: 13px; }
.i.fill { fill: currentColor; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
#app { min-height: 100%; }
#side { display: none; }
#main { max-width: 680px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 16px calc(var(--tab-h) + var(--safe-b) + 40px); }
.top { display: flex; align-items: center; gap: 8px; min-height: 52px; position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 -16px; padding: 6px 16px; }
.top.scrolled { box-shadow: 0 1px 0 var(--line); }
.top h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -.01em; margin: 0; flex: 1; min-width: 0; text-wrap: balance; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .back { margin-left: -8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { color: var(--accent-ink); }
.crumb { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin: -2px 0 6px; }
.crumb button { color: var(--ink-2); font-weight: 500; }

/* Tab bar */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--ink-3); height: 100%; justify-content: center; position: relative; }
.tab .i { width: 22px; height: 22px; }
.tab.on { color: var(--ink); }
.tab.on .i { color: var(--accent-ink); }
.tab .badge { position: absolute; top: 8px; left: calc(50% + 6px); }
.fab {
  justify-self: center; width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: #0E1A13; display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 -2px 0 rgba(0,0,0,.12); transform: translateY(-10px);
  transition: transform .15s ease;
}
.fab .i { width: 28px; height: 28px; stroke-width: 2.6; }
.fab:active { transform: translateY(-8px) scale(.96); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--p1); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.badge.soft { background: var(--surface-2); color: var(--ink-2); }

/* ---------- Today hero ---------- */
.hero { display: flex; align-items: center; gap: 14px; padding: 6px 0 14px; }
.hero-num { font-family: var(--font-display); font-weight: 700; font-size: 58px; line-height: .9; letter-spacing: -.04em; }
.hero-txt { flex: 1; min-width: 0; }
.hero-wd { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; }
.hero-mo { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.ring { width: 58px; height: 58px; position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .bgc { stroke: var(--surface-2); }
.ring .fgc { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring-t { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.hero-actions { display: flex; gap: 4px; }

/* ---------- Sections & rows ---------- */
.sec { margin-top: 18px; }
.sec-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; padding: 0 2px 6px; }
.sec-h .n { color: var(--ink-3); font-weight: 500; }
.sec-h .sp { flex: 1; }
.sec-h .link { text-transform: none; letter-spacing: 0; color: var(--accent-ink); font-weight: 600; font-size: 13px; padding: 4px 6px; border-radius: 8px; }
.sec-h .link:hover { background: var(--accent-soft); }
.sec-h.late { color: var(--p1); }
.sec-h.focus { color: var(--ink); }
.sec-h .ttl-i { color: var(--accent-ink); }
.list { background: var(--surface); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; }
.list.flat { background: none; border: 0; border-radius: 0; }

.sw { position: relative; overflow: hidden; }
.sw + .sw { border-top: 1px solid var(--line); }
.sw-bg { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 22px; font-weight: 600; font-size: 14px; gap: 8px; color: #fff; opacity: 0; }
.sw-bg.l { background: var(--accent); color: #0E1A13; }
.sw-bg.r { background: var(--p3); justify-content: flex-end; }
.sw.go-r .sw-bg.l, .sw.go-l .sw-bg.r { opacity: 1; }
.row {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--surface); cursor: pointer;
  transition: background .12s, opacity .3s; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.row:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.row.anim { transition: transform .22s ease, background .12s; }
.row-body { flex: 1; min-width: 0; padding-top: 1px; }
.row-title { font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.row-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.m-due.today { color: var(--accent-ink); font-weight: 600; }
.m-due.late { color: var(--p1); font-weight: 600; }
.m-st.doing { color: var(--p3); font-weight: 600; }
.m-st.waiting { color: var(--p2); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-3)); display: inline-block; flex: none; }
.row.done .row-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.row.leaving { opacity: .35; }
.row .star { color: var(--p2); margin-top: 2px; }
.row-acts { display: none; gap: 2px; margin: -6px -6px -6px 0; }
@media (hover: hover) and (pointer: fine) {
  .row:hover .row-acts { display: flex; }
  .row:hover .star { display: none; }
}
.row-acts .icon-btn { width: 34px; height: 34px; }

.chk {
  --pc: var(--p4); width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--pc); display: grid; place-items: center; flex: none; margin-top: -1px;
  color: transparent; background: color-mix(in srgb, var(--pc) 8%, transparent); transition: background .15s, transform .15s;
  position: relative;
}
.chk::after { content: ""; position: absolute; inset: -10px; }
.chk .i { width: 14px; height: 14px; stroke-width: 3; }
.chk:hover { color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); }
.chk.p1 { --pc: var(--p1); } .chk.p2 { --pc: var(--p2); } .chk.p3 { --pc: var(--p3); } .chk.p4 { --pc: var(--p4); }
.chk.on { background: var(--accent); border-color: var(--accent); color: #0E1A13; }
.chk.pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.25); } }
.bulb { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--idea-soft); color: var(--idea-ink); flex: none; margin-top: -1px; }
.bulb .i { width: 15px; height: 15px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-top: 12px; }
.card-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.card-h .sp { flex: 1; }
.card-s { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.card.inbox { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.card.inbox .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.card.inbox .tx { flex: 1; min-width: 0; }
.card.inbox b { font-size: 15px; }
.card.idea { background: var(--idea-soft); border-color: color-mix(in srgb, var(--idea) 30%, transparent); }
.card.idea .card-h { color: var(--idea-ink); }
.idea-q { font-size: 18px; font-weight: 600; line-height: 1.35; margin: 10px 0 4px; overflow-wrap: anywhere; cursor: pointer; }
.idea-sub { font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card.nudge { background: var(--warn-soft); border-color: transparent; }
.card.note { background: var(--surface-2); border-color: transparent; font-size: 14px; color: var(--ink-2); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px; font-weight: 600; font-size: 14px; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.btn:hover { filter: brightness(.97); }
.btn.pri { background: var(--accent); color: #0E1A13; }
.btn.ink { background: var(--ink); color: var(--bg); }
.btn.idea { background: var(--idea); color: #2A0A1A; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.line { background: var(--surface); border: 1px solid var(--line); }
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn.sm { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .i { width: 17px; height: 17px; }
.add-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; color: var(--ink-3); font-size: 15px; text-align: left; }
.add-row:hover { color: var(--accent-ink); }
.sw + .add-row { border-top: 1px solid var(--line); }
.add-row .plus { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-ink); }

/* Empty */
.empty { text-align: center; padding: 40px 20px 28px; color: var(--ink-2); }
.empty-art { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 22px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.empty-art .i { width: 30px; height: 30px; }
.empty-t { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--ink); text-wrap: balance; }
.empty-s { font-size: 14px; margin: 6px auto 16px; max-width: 320px; text-wrap: balance; }
.mini-empty { padding: 12px 14px; color: var(--ink-3); font-size: 14px; }

/* Chips & segmented */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; font-size: 14px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; flex: none;
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.on .dot { box-shadow: 0 0 0 2px var(--ink); }
.chip .i { width: 15px; height: 15px; }
.chip.x { padding-right: 6px; }
.chip.x .xb { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.chip.parsed { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.chip.date-in { position: relative; overflow: hidden; }
.chip.date-in input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.chip.time-in input { border: 0; background: transparent; width: 74px; padding: 0; outline: none; color: inherit; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 2px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button.on.idea { color: var(--idea-ink); }
.seg button .i { width: 16px; height: 16px; }
.prio { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prio button { height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.prio button .i { width: 15px; height: 15px; }
.prio .p1 .i { color: var(--p1); } .prio .p2 .i { color: var(--p2); } .prio .p3 .i { color: var(--p3); } .prio .p4 .i { color: var(--p4); }
.prio button.on { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }

/* Sheets */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .18s ease; }
.sheet {
  position: relative; width: 100%; max-width: 680px; background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  max-height: calc(100% - 28px - var(--safe-t)); display: flex; flex-direction: column; animation: up .24s cubic-bezier(.2,.9,.3,1);
  padding-bottom: var(--safe-b); margin-bottom: var(--kb);
}
.sheet.tall { height: calc(100% - 28px - var(--safe-t)); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.sh-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px 16px; flex: none; }
.sh-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.sh-head .sp { flex: 1; }
.sh-body { overflow-y: auto; padding: 4px 16px 16px; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sh-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--line); flex: none; }
.sh-foot .sp { flex: 1; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Capture */
.cap-text { width: 100%; border: 0; outline: none; resize: none; background: transparent; font-size: 19px; line-height: 1.4; padding: 6px 0; min-height: 64px; max-height: 40vh; }
.cap-text::placeholder { color: var(--ink-3); }
.cap-box { display: flex; gap: 8px; align-items: flex-start; }
.mic { width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.mic.live { background: var(--p1); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--p1) 25%, transparent); } }
.opt { margin-top: 14px; }
.opt-l { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.parsed-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hint { font-size: 12.5px; color: var(--ink-3); }
.ai-list { margin-top: 12px; display: grid; gap: 8px; }
.ai-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.ai-item input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.ai-item .t { font-weight: 600; font-size: 15px; }
.ai-item .m { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* Detail */
.d-title { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0 4px; }
.d-title textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; font-size: 20px; font-weight: 600; line-height: 1.35; padding: 0; min-height: 28px; overflow: hidden; }
.d-title .chk { margin-top: 2px; }
.prop { padding: 12px 0; border-top: 1px solid var(--line); }
.prop:first-child { border-top: 0; }
.prop-l { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 8px; }
.prop-l .sp { flex: 1; }
.prop-l .val { color: var(--ink-2); font-weight: 500; text-transform: none; }
.sel { height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 10px; font-size: 14px; }
.subs { display: grid; }
.sub { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.sub .chk { width: 20px; height: 20px; }
.sub .chk .i { width: 12px; height: 12px; }
.sub input[type=text] { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; padding: 2px 0; }
.sub.done input[type=text] { color: var(--ink-3); text-decoration: line-through; }
.sub .icon-btn { width: 30px; height: 30px; }
.sub-add { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--ink-3); }
.sub-add input { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; padding: 4px 0; }
.notes { width: 100%; min-height: 96px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); padding: 10px 12px; outline: none; resize: vertical; font-size: 15px; line-height: 1.5; }
.notes:focus { border-color: var(--ink-3); }
.d-foot { font-size: 12.5px; color: var(--ink-3); padding: 14px 0 4px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--ink-2); background: var(--surface); }
.toggle.on { border-color: var(--p2); color: var(--ink); background: color-mix(in srgb, var(--p2) 12%, var(--surface)); }
.toggle.on .i { color: var(--p2); }

/* Week strip */
.week { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 4px -16px 6px; padding: 2px 16px 8px; }
.week::-webkit-scrollbar { display: none; }
.wd { flex: none; width: 48px; padding: 8px 0 7px; border-radius: 14px; text-align: center; background: var(--surface); border: 1px solid var(--line); }
.wd .a { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; }
.wd .b { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin-top: 2px; }
.wd .c { height: 6px; display: flex; justify-content: center; gap: 2px; margin-top: 4px; }
.wd .c i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.wd.today { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.wd.today .a { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.wd.sun .a { color: var(--p1); }
.day-h { display: flex; align-items: baseline; gap: 8px; padding: 0 2px 6px; }
.day-h b { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.day-h span { font-size: 13px; color: var(--ink-3); }
.day-h .sp { flex: 1; }
.day-h .icon-btn { width: 32px; height: 32px; }
.day-empty { font-size: 13px; color: var(--ink-3); padding: 2px 2px 0; }

/* Ideas */
.idea-grid { display: grid; gap: 10px; }
.icard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.icard:hover { border-color: color-mix(in srgb, var(--idea) 45%, var(--line)); }
.icard .t { font-size: 15.5px; font-weight: 500; line-height: 1.38; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.icard .m { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.icard .m > span { display: inline-flex; align-items: center; gap: 4px; }
.icard.due { border-color: color-mix(in srgb, var(--idea) 55%, transparent); }
.icard.arch { opacity: .65; }
.grp-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin: 20px 2px 8px; }
.grp-h .n { color: var(--ink-3); font-weight: 500; }
.grp-sub { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin: 10px 2px 6px; text-transform: uppercase; letter-spacing: .05em; }

/* Browse */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 10px; min-height: 96px; }
.tile:hover { border-color: var(--ink-3); }
.tile .ti { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.tile .tt { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.tile .ts { font-size: 12.5px; color: var(--ink-3); margin-top: -6px; }
.tile.hot .ti { background: var(--p1); color: #fff; }
.area { margin-top: 22px; }
.area-h { display: flex; align-items: center; gap: 10px; padding: 0 2px 8px; }
.area-h .bar { width: 6px; height: 26px; border-radius: 3px; background: var(--c); flex: none; }
.area-h .nm { font-family: var(--font-display); font-size: 17px; font-weight: 600; text-align: left; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-h .ct { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.prow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; background: var(--surface); }
.prow + .prow { border-top: 1px solid var(--line); }
.prow:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.prow .pi { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); flex: none; font-weight: 700; font-size: 13px; font-family: var(--font-display); }
.prow .pb { flex: 1; min-width: 0; }
.prow .pn { font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pm { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 10px; }
.prow .chev { color: var(--ink-3); }
.prow.paused .pn { color: var(--ink-3); }
.pbar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 2px; }
.proj-hero { padding: 2px 0 8px; }
.proj-hero .pbar { height: 6px; border-radius: 3px; margin-top: 10px; }
.proj-stats { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; flex-wrap: wrap; }
.view-bar { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; }
.view-bar .sp { flex: 1; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 10px; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 10px; scroll-snap-type: x mandatory; }
.col { background: var(--surface-2); border-radius: 16px; padding: 10px; scroll-snap-align: start; min-height: 140px; display: flex; flex-direction: column; gap: 8px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 2px 4px 4px; }
.col-h .n { color: var(--ink-3); font-weight: 500; }
.col-h .dot { width: 9px; height: 9px; }
.kc { background: var(--surface); border-radius: 12px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); cursor: grab; border-left: 3px solid var(--pc, var(--p4)); }
.kc.p1 { --pc: var(--p1); } .kc.p2 { --pc: var(--p2); } .kc.p3 { --pc: var(--p3); }
.kc .t { font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.kc .m { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.kc .m .sp { flex: 1; }
.kc .mv { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.kc.done .t { text-decoration: line-through; color: var(--ink-3); }

/* Matrix */
.mx { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.q { border-radius: 18px; padding: 12px; background: var(--surface); border: 1px solid var(--line); min-height: 150px; display: flex; flex-direction: column; }
.q-h { display: flex; align-items: center; gap: 6px; }
.q-h b { font-size: 14px; }
.q-h .n { margin-left: auto; font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.q-s { font-size: 12px; color: var(--ink-3); margin: 2px 0 8px; }
.q.q1 { border-color: color-mix(in srgb, var(--p1) 40%, var(--line)); }
.q.q1 .q-h { color: var(--p1); }
.q.q2 .q-h { color: var(--p3); }
.q.q3 .q-h { color: var(--p2); }
.q.q4 .q-h { color: var(--ink-3); }
.q-i { font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; width: 100%; }
.q-i:hover { color: var(--accent-ink); }
.q-more { font-size: 12.5px; color: var(--ink-3); padding-top: 6px; }
.mx-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 8px; text-transform: uppercase; letter-spacing: .05em; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.stat b { font-family: var(--font-display); font-size: 24px; font-weight: 600; display: block; }
.stat span { font-size: 12.5px; color: var(--ink-3); }

/* Review / triage */
.steps { display: grid; gap: 10px; margin-top: 8px; }
.step { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.step .num { width: 30px; height: 30px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 14px; flex: none; }
.step.ok .num { background: var(--accent); color: #0E1A13; }
.step .b { flex: 1; min-width: 0; }
.step .t { font-weight: 600; }
.step .s { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.step .acts { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.tri-title { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); padding: 12px; font-size: 18px; font-weight: 600; line-height: 1.35; resize: none; outline: none; min-height: 56px; }
.tri-prog { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.progress-line { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin: 2px 16px 0; }
.progress-line i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* Settings */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .b { flex: 1; min-width: 0; }
.set-row .t { font-weight: 500; }
.set-row .s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.help { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.help li { margin: 4px 0; }
.help code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; color: var(--ink); }

/* Search */
.search-in { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); margin: 0 16px; }
.search-in input { flex: 1; border: 0; outline: none; background: transparent; font-size: 17px; }
.res-h { font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 16px 2px 6px; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Toast & dialogs */
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 80; width: max-content; max-width: calc(100% - 24px); }
.toast { display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--bg); padding: 10px 10px 10px 16px; border-radius: 14px; box-shadow: var(--shadow); font-size: 14px; animation: up .2s ease; }
.toast .tx { flex: 1; }
.toast button { color: var(--accent); font-weight: 700; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.dlg-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.dlg { position: relative; background: var(--surface); border-radius: 22px; padding: 20px; width: 100%; max-width: 380px; box-shadow: var(--shadow); animation: up .2s ease; }
.dlg h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.dlg p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; }
.dlg input[type=text] { width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; font-size: 16px; outline: none; margin-bottom: 14px; }
.dlg input[type=text]:focus { border-color: var(--ink-3); }
.dlg .acts { display: flex; gap: 8px; justify-content: flex-end; }
.menu { position: relative; width: 100%; max-width: 680px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px 8px calc(12px + var(--safe-b)); animation: up .2s ease; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 12px; font-size: 15.5px; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu .mh { font-size: 13px; color: var(--ink-3); padding: 8px 14px 6px; font-weight: 600; }

.banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--warn-soft); font-size: 13.5px; margin-top: 10px; }
.banner .tx { flex: 1; }
.skel { height: 52px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; margin-top: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.foot-note { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 28px; }

/* ---------- Desktop ---------- */
@media (min-width: 960px) {
  #tabbar { display: none; }
  #side {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 264px; padding: 18px 12px; border-right: 1px solid var(--line);
    background: var(--surface); overflow-y: auto; gap: 2px; z-index: 10;
  }
  #main { --gut: max(36px, calc((100vw - 264px - 760px) / 2)); margin-left: 264px; max-width: none; padding: 18px var(--gut) 80px; }
  body.has-drawer #main { margin-right: 460px; --gut: max(28px, calc((100vw - 724px - 760px) / 2)); }
  .sheet-wrap:not(.drawer) .grab { display: none; }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: #0E1A13; display: grid; place-items: center; }
  .brand-mark .i { stroke-width: 3; }
  .brand b { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
  .brand div span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: -2px; }
  .side-add { margin: 0 4px 12px; }
  .nav { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 11px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); width: 100%; text-align: left; }
  .nav:hover { background: var(--surface-2); color: var(--ink); }
  .nav.on { background: var(--accent-soft); color: var(--ink); }
  .nav.on > .i { color: var(--accent-ink); }
  .nav .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav .cnt { font-size: 12.5px; color: var(--ink-3); }
  .nav.sub { height: 34px; padding-left: 38px; font-size: 13.5px; }
  .nav .dot { margin: 0 6px; }
  .side-h { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; padding: 16px 10px 6px; }
  .side-sp { flex: 1; min-height: 16px; }
  .sheet-wrap.drawer { justify-content: flex-end; align-items: stretch; pointer-events: none; }
  .sheet-wrap.drawer .scrim { display: none; }
  .sheet-wrap.drawer .sheet { pointer-events: auto; max-width: 460px; height: 100%; max-height: none; border-radius: 0; border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(0,0,0,.06); animation: slide .2s ease; }
  .sheet-wrap.drawer .grab { display: none; }
  .sheet-wrap:not(.drawer) .sheet { border-radius: 24px; margin-bottom: 8vh; max-height: 84vh; }
  .sheet-wrap:not(.drawer) { align-items: center; }
  #toast { bottom: 24px; }
  .top { margin: 0 calc(-1 * var(--gut)); padding: 10px var(--gut); }
  .pills { margin: 0 0 4px !important; padding: 0 !important; }
  .board { margin: 10px 0 0; padding: 0 0 10px; }
  .chips.scroll { margin: 0; padding: 0; flex-wrap: wrap; }
  .week { margin: 4px 0 6px; padding: 2px 0 8px; }
  .menu { border-radius: 22px; margin-bottom: 10vh; max-width: 380px; }
  .dlg-wrap.menu-wrap { align-items: center; }
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@media (max-width: 380px) {
  .hero-num { font-size: 48px; }
  .prio button span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.cap-text:focus-visible, .d-title textarea:focus-visible, .sub input:focus-visible, .sub-add input:focus-visible, .search-in input:focus-visible, .tri-title:focus-visible { outline: none; }
body.sheet-open #toast { bottom: auto; top: calc(var(--safe-t) + 14px); }

.pills { margin: -2px -16px 4px; }
