:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #F7F7F7;
  --surface: #FFFFFF;
  --ink: #111318;
  --muted: #6B7079;
  --faint: #B3B7BE;
  --line: #E7E8EB;
  --hover: #F1F2F4;
  --press: rgba(17, 19, 24, .05);
  --active: #DCE7FB;
  --accent: #2E7CF6;
  --brand: #2E7CF6;
  --danger: #E5484D;
  --shadow: 0 1px 2px rgba(17, 19, 24, .06), 0 12px 32px rgba(17, 19, 24, .12);
  --toast-bg: #111318;
  --toast-ink: #F7F7F7;
  --hl-yellow: #FDE937;
  --hl-green: #8EE3C3;
  --hl-red: #FF8A73;
  --hl-blue: #C9DDFB;
  --hl-purple: #E1D3FA;
  --hue: #2E7CF6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316; --surface: #1A1B1F; --ink: #F2F3F5; --muted: #9196A0; --faint: #5A5E66;
    --line: #2A2C31; --hover: #222328; --press: rgba(255, 255, 255, .06); --active: #1F2D47;
    --accent: #5B9BFF; --danger: #FF6B70;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .5);
    --toast-bg: #F2F3F5; --toast-ink: #121316;
    --hl-yellow: #E8D21F; --hl-green: #5FCFA8; --hl-red: #F07A62; --hl-blue: #A9C6F7; --hl-purple: #C9B3F2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121316; --surface: #1A1B1F; --ink: #F2F3F5; --muted: #9196A0; --faint: #5A5E66;
  --line: #2A2C31; --hover: #222328; --press: rgba(255, 255, 255, .06); --active: #1F2D47;
  --accent: #5B9BFF; --danger: #FF6B70;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .5);
  --toast-bg: #F2F3F5; --toast-ink: #121316;
  --hl-yellow: #E8D21F; --hl-green: #5FCFA8; --hl-red: #F07A62; --hl-blue: #A9C6F7; --hl-purple: #C9B3F2;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--bg); scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 16px/1.42 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[contenteditable]:focus-visible { outline: none; }
[data-ph]:empty::before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; }
.visually-hidden { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.app { flex: 1; min-height: 0; display: flex; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 290px; flex: none; display: flex; flex-direction: column; overflow-y: auto;
  padding: 34px 18px 18px max(18px, env(safe-area-inset-left, 0px)); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 6px; line-height: 1; color: var(--ink); }
.wordmark { display: block; height: 44px; width: auto; }
.brand-sub { display: flex; align-items: center; gap: 7px; min-height: 1.4em; margin: 10px 8px 20px; color: var(--muted); font-size: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; margin-bottom: 12px;
  border-radius: 11px; background: var(--press); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: none; background: none; outline: none; color: var(--ink); font-size: 15px; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-gap { height: 10px; }
.nav-row {
  display: flex; align-items: center; gap: 12px; min-height: 44px; width: 100%; padding: 0 4px 0 10px;
  border: none; background: none; border-radius: 11px; color: var(--muted); cursor: pointer; text-align: left;
  outline-offset: -2px;
}
.nav-row:hover { background: var(--press); }
.nav-row.active { background: var(--active); color: var(--accent); }
.nav-row .bt { flex: 1; min-width: 0; color: var(--ink); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.nav-row .bt[contenteditable] { white-space: normal; text-overflow: clip; background: var(--surface); border-radius: 6px; padding: 0 4px; margin: 0 -4px; }
.nav-row .bc { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; padding-right: 6px; }
.nav-row .icon-btn.sm { opacity: 0; }
.nav-row:hover .icon-btn.sm, .nav-row:focus-within .icon-btn.sm { opacity: 1; }
.nav-row[class*="hl-"] .bt, .nav-row[class*="hl-"] .bc, .nav-row[class*="hl-"] svg, .nav-row[class*="hl-"] .icon-btn.sm { color: #111; }
.nav-row.hl-yellow { background: var(--hl-yellow); } .nav-row.hl-green { background: var(--hl-green); }
.nav-row.hl-red { background: var(--hl-red); } .nav-row.hl-blue { background: var(--hl-blue); } .nav-row.hl-purple { background: var(--hl-purple); }
.nav-row[class*="hl-"].active { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .55); }
.nav-row.sys .bt { color: var(--muted); }
.nav-row.sys.active .bt { color: var(--ink); }
.add-board, .foot-link {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 10px; border: none; background: none;
  border-radius: 11px; color: var(--faint); font-size: 16px; text-align: left; width: 100%;
}
.add-board:hover, .foot-link:hover { color: var(--ink); background: var(--press); }
.foot-link { color: var(--muted); font-size: 15px; }
.results { display: flex; flex-direction: column; gap: 2px; }
.result { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 10px; border: none; background: none; border-radius: 10px; text-align: left; }
.result:hover { background: var(--press); }
.r-text { font-size: 15.5px; overflow-wrap: anywhere; }
.r-path { font-size: 13px; color: var(--muted); }
.no-results { color: var(--muted); padding: 8px 10px; margin: 0; }
.side-foot { margin-top: auto; padding-top: 26px; display: flex; flex-direction: column; gap: 2px; }
.foot-label { font-size: 13px; color: var(--muted); margin: 14px 10px 6px; }
.seg { display: flex; gap: 3px; padding: 3px; margin: 0 4px 6px; background: var(--press); border-radius: 10px; }
.seg button { flex: 1; border: none; background: none; padding: 6px 4px; border-radius: 8px; font-size: 13.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); position: relative; }
.topbar { display: none; }
.icon-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; padding: 0; border: none; background: none; border-radius: 10px; color: var(--ink); }
.icon-btn:hover { background: var(--press); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; color: var(--faint); }
.icon-btn.sm:hover { color: var(--ink); }
.btn {
  height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; flex: none;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 560;
}
.btn:hover { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.danger { color: var(--danger); }
.tabs { display: none; }

.pages {
  flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: max-content; justify-content: start; align-items: stretch;
  overflow: auto; padding: 0 0 0 10px; overscroll-behavior: contain; scrollbar-width: thin;
}
.column {
  width: 344px;
  padding: 0 28px 140px; border-left: 1px solid var(--line);
}
.column:first-child { border-left-color: transparent; }
.column.collapsed { width: 56px; padding: 0; }
.strip {
  width: 100%; height: 100%; padding: 52px 0 0; border: none; background: none; display: flex; justify-content: center;
  color: var(--muted); font-size: 17px; font-weight: 500;
}
.strip span { position: sticky; top: 52px; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 70vh; overflow: hidden; text-overflow: ellipsis; }
.strip:hover { color: var(--ink); background: var(--hover); }
.col-top { display: flex; align-items: flex-start; gap: 4px; position: sticky; top: 0; z-index: 3; margin: 0 -28px; padding: 40px 28px 0; background: var(--surface); }
.col-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: linear-gradient(var(--surface), transparent); pointer-events: none; }
.col-title {
  flex: 1; min-width: 0; outline: none; cursor: text; overflow-wrap: anywhere;
  font-size: 42px; font-weight: 800; letter-spacing: -.04em; line-height: 1.06;
}
.col-top .icon-btn.sm { margin-top: 8px; }
.col-count { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 14px; }
.col-desc { margin-top: 8px; color: var(--muted); font-size: 15px; outline: none; cursor: text; overflow-wrap: anywhere; }
.progress { height: 3px; margin: 14px 0 6px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--hue); transition: width .4s cubic-bezier(.2, .7, .2, 1); }
.col-gap { height: 14px; }

.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) 26px; align-items: start; column-gap: 11px;
  padding: 6px 6px; margin: 1px -6px; border-radius: 9px; position: relative;
  -webkit-touch-callout: none; touch-action: manipulation;
}
.item:hover { background: var(--hover); }
.item.nocheck { grid-template-columns: minmax(0, 1fr) 26px; }
.item.heading { grid-template-columns: minmax(0, 1fr) 26px; padding-top: 20px; padding-bottom: 4px; }
.item.heading:hover { background: none; }
.item.heading .line .text { font-weight: 720; font-size: 18px; letter-spacing: -.015em; }
.item[class*="hl-"], .item[class*="hl-"]:hover { color: #111; }
.item.hl-yellow { background: var(--hl-yellow); } .item.hl-green { background: var(--hl-green); }
.item.hl-red { background: var(--hl-red); } .item.hl-blue { background: var(--hl-blue); } .item.hl-purple { background: var(--hl-purple); }
.item[class*="hl-"] .more, .item[class*="hl-"] .ind, .item[class*="hl-"] .sub .text { color: rgba(0, 0, 0, .6); }
.item.drop-target { box-shadow: inset 0 0 0 2px var(--accent); }
.item[class*="hl-"] .check { background: rgba(255, 255, 255, .75); border-color: rgba(0, 0, 0, .35); }
.item[class*="hl-"].st-progress > .check { background: linear-gradient(90deg, var(--hue) 50%, rgba(255, 255, 255, .75) 50%); border-color: var(--hue); }
.item[class*="hl-"].st-done > .check, .item[class*="hl-"].st-cancel > .check, .item[class*="hl-"] .sub.st-done > .check, .item[class*="hl-"] .sub.st-cancel > .check { background: var(--hue); border-color: var(--hue); }

.check {
  width: 20px; height: 20px; margin-top: 1px; padding: 0; display: grid; place-items: center;
  border: 1.5px solid var(--faint); border-radius: 5px; background: var(--surface); color: transparent;
  transition: background .15s, border-color .15s;
}
.check svg { width: 12px; height: 12px; }
.check:hover { border-color: var(--hue); }
.st-progress > .check { border-color: var(--hue); background: linear-gradient(90deg, var(--hue) 50%, var(--surface) 50%); }
.st-done > .check, .st-cancel > .check { background: var(--hue); border-color: var(--hue); color: #fff; }
.st-done > .check svg, .st-cancel > .check svg { animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
.st-cancel > .body .line .text, .sub.st-cancel > .text { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.hide-done .item.st-done, .hide-done .item.st-cancel { display: none; }

.body { min-width: 0; }
.line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px; }
.text {
  min-height: 1.42em; min-width: 2ch; max-width: 100%; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text;
  -webkit-user-select: none; user-select: none;
}
.line .text { flex: 0 1 auto; }
.text[contenteditable] { -webkit-user-select: text; user-select: text; flex-basis: 100%; }
.ind {
  display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; font-weight: 600;
  border: none; background: none; padding: 0; height: 20px; align-self: center; font-variant-numeric: tabular-nums;
}
.ind svg { width: 16px; height: 16px; }
.ind.note { color: var(--muted); }
.due {
  display: inline-flex; align-items: center; gap: 5px; align-self: center; padding: 1px 7px 1px 6px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--hover);
}
.due svg { width: 12px; height: 12px; }
.due.today { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.due.overdue { background: var(--danger); color: #fff; }
.item[class*="hl-"] .due { background: rgba(255, 255, 255, .55); color: #111; }
.cover {
  display: block; width: 100%; margin: 9px 0 4px; padding: 0; border: none; background: var(--hover);
  border-radius: 6px; overflow: hidden; cursor: zoom-in;
}
.cover img { display: block; width: 100%; max-height: 460px; object-fit: cover; -webkit-user-drag: none; user-select: none; pointer-events: none; }
.more {
  width: 26px; height: 22px; padding: 0; display: grid; place-items: center; border: none; background: none;
  border-radius: 7px; color: var(--faint); opacity: 0;
}
.more:hover { color: var(--ink); background: var(--press); }
.item:hover > .more, .item:focus-within > .more { opacity: 1; }

.subs { list-style: none; margin: 6px 0 0; padding: 0; }
.sub {
  position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 9px; align-items: start;
  padding: 4px 22px 4px 18px;
}
.sub::before {
  content: ""; position: absolute; left: 3px; top: -6px; width: 10px; height: 18px;
  border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); border-bottom-left-radius: 5px;
}
.item[class*="hl-"] .sub::before { border-color: rgba(0, 0, 0, .25); }
.sub .check { width: 18px; height: 18px; border-radius: 4.5px; margin-top: 1px; }
.sub .check svg { width: 11px; height: 11px; }
.sub .text { font-size: 15px; }
.sub .bullet { width: 6px; height: 6px; margin: 8px 6px; border-radius: 50%; background: var(--faint); }
.sub-del { position: absolute; right: 0; top: 4px; width: 22px; height: 20px; padding: 0; border: none; background: none; border-radius: 6px; color: var(--faint); display: grid; place-items: center; opacity: 0; }
.sub:hover .sub-del, .sub:focus-within .sub-del { opacity: 1; }
.sub-add button { display: flex; align-items: center; gap: 8px; padding: 4px 0 2px 18px; border: none; background: none; color: var(--faint); font-size: 14px; }
.sub-add button:hover { color: var(--muted); }

.add-row { list-style: none; }
.add-row button, .add-section {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 7px 0; border: none; background: none;
  color: var(--faint); text-align: left;
}
.add-row button:hover, .add-section:hover { color: var(--muted); }
.add-section { margin-top: 12px; }
.add-col {
  flex: 0 0 220px; width: 220px; align-self: start; height: 46px; margin: 40px 28px 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--line); border-radius: 12px; background: none; color: var(--muted); font-weight: 560;
}
.add-col:hover { color: var(--ink); border-color: var(--faint); }
.empty { flex: 1; width: min(420px, 80vw); align-self: center; text-align: center; color: var(--muted); padding: 60px 16px; }
.empty p { margin: 0 0 14px; }
.item.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 18%, transparent); } 100% { background: transparent; } }

.toolbar {
  position: absolute; right: 20px; bottom: 20px; z-index: 5; display: flex; gap: 4px; padding: 6px;
  background: var(--bg); border-radius: 16px; box-shadow: 0 0 0 1px var(--line), 0 6px 20px rgba(0, 0, 0, .06);
}
.toolbar .icon-btn { width: 42px; height: 42px; border-radius: 11px; color: var(--ink); }
.toolbar .icon-btn[aria-pressed="true"] { background: var(--active); color: var(--accent); }

/* ---------- Smart views (Today, Archive, Trash) ---------- */
.smart { flex: 1; min-height: 0; overflow-y: auto; padding: 44px 40px 100px; }
.smart-inner { max-width: 720px; }
.smart-title { margin: 0; font-size: 42px; font-weight: 800; letter-spacing: -.04em; line-height: 1.06; }
.smart-sub { margin: 8px 0 0; color: var(--muted); font-size: 15px; max-width: 60ch; }
.smart-actions { margin-top: 14px; display: flex; gap: 8px; }
.smart-group { margin: 26px 0 6px; font-size: 18px; font-weight: 720; letter-spacing: -.015em; }
.srow { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 11px; align-items: start; padding: 8px 6px; margin: 0 -6px; border-radius: 9px; }
.srow.noc { grid-template-columns: minmax(0, 1fr) auto; }
.srow:hover { background: var(--hover); }
.sbody { min-width: 0; cursor: pointer; }
.stext { overflow-wrap: anywhere; }
.spath { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; color: var(--muted); font-size: 13.5px; }
.sbtns { display: flex; gap: 6px; align-items: center; }
.smart-empty { color: var(--muted); margin-top: 30px; }

/* ---------- Drag ---------- */
.item.placeholder { background: color-mix(in srgb, var(--hue) 9%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--hue) 40%, transparent); }
.item.placeholder > * { visibility: hidden; }
.ghost {
  position: fixed; left: 0; top: 0; z-index: 70; margin: 0; pointer-events: none; list-style: none;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); max-height: 260px; overflow: hidden;
}
.ghost .more { opacity: 0; }
body.dragging { cursor: grabbing; -webkit-user-select: none; user-select: none; }
body.dragging .add-row, body.dragging .sub-add { display: none; }
body.dragging .pages { scroll-snap-type: none !important; }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: transparent; transition: background .2s; }
.scrim.dim { background: rgba(0, 0, 0, .32); }
.popover {
  position: fixed; z-index: 40; min-width: 230px; max-width: calc(100vw - 16px); max-height: calc(100% - 16px); overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow);
}
.mi {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 10px 11px; border: none; background: none; border-radius: 9px; text-align: left;
}
.mi:hover:not(:disabled) { background: var(--hover); }
.mi:disabled { opacity: .4; cursor: default; }
.mi.danger { color: var(--danger); }
.mi .tick { display: grid; color: var(--accent); }
.sep { height: 1px; margin: 6px 4px; background: var(--line); }
.pop-label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; padding: 8px 10px 6px; }
.sw { width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%; background: var(--c); }
.sw.none { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--faint); position: relative; }
.sw.none::after { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1.5px; background: var(--faint); transform: rotate(45deg); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.icon-grid { display: grid; grid-template-columns: repeat(5, 40px); gap: 4px; padding: 6px 8px; }
.icon-grid button { width: 40px; height: 40px; border: none; background: none; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.icon-grid button:hover { background: var(--hover); color: var(--ink); }
.icon-grid button[aria-pressed="true"] { background: var(--active); color: var(--accent); }

.sheet {
  position: fixed; z-index: 45; left: 50%; bottom: 0; width: min(540px, 100%); max-height: 88%; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  transform: translate(-50%, 105%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet.open { transform: translate(-50%, 0); }
.grabber { width: 38px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--line); }
.sheet-title { margin: 0 0 2px; font-size: 19px; font-weight: 720; letter-spacing: -.015em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.field-label { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 550; font-size: 14.5px;
}
.chip svg { width: 17px; height: 17px; }
.chip:hover:not(:disabled) { background: var(--hover); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.chip:disabled { opacity: .5; cursor: default; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.status-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; background: var(--press); border-radius: 11px; }
.status-seg button { border: none; background: none; padding: 8px 4px; border-radius: 9px; font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.status-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.status-seg .check { pointer-events: none; }
.date-input, .note-input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 16px;
}
.date-input { height: 40px; margin-top: 10px; padding: 0 12px; max-width: 240px; }
.note-input { min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.sheet-img { margin-bottom: 10px; border-radius: 10px; overflow: hidden; background: var(--hover); max-width: 260px; }
.sheet-img img { display: block; width: 100%; max-height: 200px; object-fit: cover; }
.sheet-actions { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--line); }
.sheet-actions .mi { padding: 12px 4px; font-size: 16px; }

.lightbox { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .86); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }

.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .38); }
.modal { width: min(540px, 100%); padding: 20px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.01em; }
.modal p { margin: 0 0 12px; color: var(--muted); max-width: 62ch; }
.modal textarea {
  width: 100%; height: 190px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.modal .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.modal .row .spacer { flex: 1; }
.modal .msg { min-height: 1.4em; margin: 10px 0 0; font-size: 13.5px; color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 12px;
  background: var(--toast-bg); color: var(--toast-ink); box-shadow: var(--shadow); max-width: calc(100vw - 24px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { padding: 6px 10px; border: none; background: none; border-radius: 8px; color: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
/* ---------- Logo, sync status, accounts ---------- */
.logo { width: 38px; height: 38px; flex: none; border-radius: 9px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.sync-dot.synced { background: var(--accent); }
.sync-dot.syncing { background: #F5A623; }
.sync-dot.error { background: var(--danger); }

.auth {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px); background: var(--bg);
}
.auth-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-card .logo { width: 52px; height: 52px; border-radius: 14px; }
.auth-card h1 { margin: 6px 0 0; line-height: 1; color: var(--ink); }
.auth-card h1 .wordmark { height: 52px; }
.auth-sub { margin: 0 0 6px; color: var(--muted); }
.auth-err { min-height: 1.3em; margin: 0; color: var(--danger); font-size: 14px; }
.btn.primary { height: 46px; justify-content: center; border: none; background: var(--accent); color: var(--surface); font-size: 16px; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn.primary:disabled { opacity: .6; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-width: 380px; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .auth-card input {
  height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 16px; width: 100%;
}
.field input:focus, .auth-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.check-field { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 15px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-block { margin-top: 30px; padding-top: 4px; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.form-msg { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.pw-note { margin-top: 8px; font-size: 14px; color: var(--ink); max-width: 52ch; }
.pw-code { font: 600 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 2px 6px; border-radius: 6px; background: var(--active); color: var(--ink); user-select: all; -webkit-user-select: all; }
/* ---------- Things-style additions ---------- */
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-self: center; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: none; cursor: pointer; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--hover); white-space: nowrap; }
.item[class*="hl-"] .tag { background: rgba(255, 255, 255, .55); color: #111; }
.ind.repeat { color: var(--muted); }
.ind.repeat svg { width: 14px; height: 14px; }
.tag-input { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font-size: 15px; width: 150px; }
.chip.tag-chip[aria-pressed="true"]::after { content: "×"; margin-left: 2px; font-weight: 700; }
.filter-bar {
  display: flex; align-items: center; gap: 10px; margin: 10px 26px 0; padding: 8px 8px 8px 14px; border-radius: 12px;
  background: var(--active); color: var(--accent); font-weight: 600; font-size: 14.5px; width: fit-content;
}
.filter-bar button { border: none; background: none; color: inherit; font-weight: 700; padding: 2px 8px; border-radius: 8px; }
.filter-bar button:hover { background: var(--press); }
.item.filtered-out { display: none; }
.hide-done .item.st-done.just-done, .hide-done .item.st-cancel.just-done { display: grid; animation: settle 1.3s ease forwards; }
@keyframes settle { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.fab {
  display: none; position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); z-index: 20;
  width: 58px; height: 58px; border: none; border-radius: 50%; background: var(--brand); color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 45%, transparent), 0 1px 3px rgba(0, 0, 0, .2);
  place-items: center;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(.94); }
.qf-wrap { position: fixed; inset: 0; z-index: 75; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(0, 0, 0, .28); }
.qf { width: min(560px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.qf input { border: none; outline: none; background: none; color: var(--ink); font-size: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.qf-list { overflow-y: auto; padding: 6px; }
.qf-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: none; background: none; border-radius: 10px; text-align: left; color: var(--ink); }
.qf-item[aria-selected="true"] { background: var(--active); }
.qf-item svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.qf-item .qf-sub { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.qf-item .qf-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qf input::-webkit-search-cancel-button { display: none; }
.qf-hint { padding: 8px 18px 12px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
kbd { font: 600 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border-radius: 5px; background: var(--hover); border: 1px solid var(--line); }
.day-group { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.day-num { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1; min-width: 34px; }
.day-name { font-size: 16px; font-weight: 650; }
.day-sub { color: var(--muted); font-size: 14px; }

/* ---------- Markdown ---------- */
.md strong { font-weight: 700; }
.md em { font-style: italic; }
.md del { color: var(--muted); }
.md code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 1px 5px; border-radius: 5px; background: var(--hover); }
.md mark { background: color-mix(in srgb, var(--hl-yellow) 70%, transparent); border-radius: 3px; padding: 0 2px; }
.md a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; overflow-wrap: anywhere; }
.item[class*="hl-"] .md a { color: #0b3d91; }
.text[contenteditable] code, .text[contenteditable] strong { font: inherit; background: none; padding: 0; }
.note-view { padding: 10px 12px; border-radius: 10px; background: var(--bg); cursor: text; line-height: 1.5; overflow-wrap: anywhere; }
.note-view > :first-child { margin-top: 0; }
.note-view > :last-child { margin-bottom: 0; }
.note-view p { margin: 0 0 8px; }
.note-view .md-h { font-weight: 720; margin: 12px 0 6px; }
.note-view .md-h1 { font-size: 1.25em; }
.note-view .md-h2 { font-size: 1.12em; }
.note-view ul, .note-view ol { margin: 0 0 8px; padding-left: 22px; }
.note-view li { margin: 2px 0; }
.note-view li.md-deep { margin-left: 18px; }
.note-view li.md-task { list-style: none; margin-left: -20px; display: flex; gap: 8px; align-items: baseline; }
.note-view li.md-task.md-deep { margin-left: -2px; }
.md-box { flex: none; width: 14px; height: 14px; border: 1.5px solid var(--faint); border-radius: 4px; transform: translateY(2px); }
.md-box.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.note-view blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.note-view pre { margin: 0 0 8px; padding: 10px; border-radius: 8px; background: var(--hover); overflow-x: auto; }
.note-view pre code { background: none; padding: 0; }
.note-view hr { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
.note-view + .chips { margin-top: 8px; }
.note-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 8px; }
.note-hint { color: var(--muted); font-size: 12.5px; }
.btn.primary-sm { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary-sm:hover { background: var(--accent); filter: brightness(1.06); }
.modal p code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); padding: 1px 4px; border-radius: 4px; }

.app-version { margin: 10px 10px 0; font-size: 12px; color: var(--faint); min-height: 1em; }

/* ---------- Touch screens ---------- */
@media (hover: none) {
  .more { opacity: 1; }
  .nav-row .icon-btn.sm { opacity: 1; }
  .item:hover:not([class*="hl-"]), .nav-row:hover:not([class*="hl-"]):not(.active), .result:hover, .srow:hover { background: none; }
}

/* ---------- Tablet ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
  .sidebar { width: 236px; padding: 28px 12px 16px max(12px, env(safe-area-inset-left, 0px)); }
  .wordmark { height: 38px; }
  .logo { width: 34px; height: 34px; }
  .nav-row .bt { font-size: 16px; }
  .column { width: 312px; padding: 0 22px 140px; }
  .col-top { margin: 0 -22px; padding: 34px 22px 0; }
  .col-title { font-size: 34px; }
  .smart { padding: 36px 28px 100px; }
}

/* ---------- Larger screens: details open as a centred dialog ---------- */
@media (min-width: 761px) {
  .sheet {
    top: 50%; bottom: auto; width: min(520px, calc(100vw - 40px)); max-height: min(86vh, 860px); border-radius: 18px;
    transform: translate(-50%, -47%) scale(.98); opacity: 0; pointer-events: none;
    transition: transform .2s cubic-bezier(.2, .8, .2, 1), opacity .16s ease;
  }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet .grabber { display: none; }
  .sheet { padding-top: 22px; }
}

/* ---------- Phone: a home screen, then one column per page ---------- */
@media (max-width: 760px) {
  body[data-view="board"] .sidebar { display: none; }
  body[data-view="home"] .main { display: none; }
  .sidebar { width: 100%; padding: 44px 22px 24px; }
  .brand { margin: 0 2px; }
  .wordmark { height: 52px; }
  .brand-sub { margin: 8px 2px 22px; font-size: 16px; }
  .search { height: 44px; }
  .search input { font-size: 16px; }
  .nav-row { min-height: 54px; padding-left: 8px; gap: 14px; }
  .nav-row .bt { font-size: 20px; }
  .nav-row .bc { font-size: 15px; }
  .nav-row.active:not([class*="hl-"]) { background: none; color: var(--muted); }
  .add-board, .foot-link { font-size: 18px; min-height: 50px; }
  .r-text { font-size: 17px; }

  .topbar { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 6px 8px 0; }
  .board-title {
    flex: 1; min-width: 0; padding: 2px 6px; border-radius: 8px; outline: none; text-align: center;
    font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .board-title:focus { text-overflow: clip; background: var(--hover); }
  .toolbar { display: none; }

  .tabs {
    display: flex; position: relative; gap: 2px; padding: 0 14px; overflow-x: auto; scrollbar-width: none;
    border-bottom: 1px solid var(--line);
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: none; position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 10px 12px;
    border: none; background: none; color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap;
  }
  .tab.collapsed { opacity: .5; font-weight: 500; }
  .tab .tc { color: var(--faint); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .tab[aria-selected="true"] { color: var(--ink); }
  .tab[aria-selected="true"]::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--hue);
  }
  .tab-add { color: var(--muted); padding-left: 8px; padding-right: 8px; }

  .pages { display: flex; padding: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .pages::-webkit-scrollbar { display: none; }
  .column {
    flex: 0 0 100%; width: auto; min-height: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain;
    scroll-snap-align: start; scroll-snap-stop: always; border-left: none; scrollbar-width: none;
    padding: 0 22px calc(env(safe-area-inset-bottom, 0px) + 120px) 24px;
  }
  .column::-webkit-scrollbar { display: none; }
  .col-top { margin: 0 -22px 0 -24px; padding: 22px 22px 0 24px; }
  .add-col { display: none; }
  .col-title { font-size: 38px; }
  .col-count { display: none; }
  .col-desc { font-size: 18px; }
  .progress { margin: 18px 0 8px; }
  .item { column-gap: 13px; padding: 9px 6px; grid-template-columns: 24px minmax(0, 1fr) 28px; }
  .item.nocheck, .item.heading { grid-template-columns: minmax(0, 1fr) 28px; }
  .item .line .text { font-size: 18px; line-height: 1.36; }
  .item.heading { padding-top: 24px; }
  .item.heading .line .text { font-size: 21px; }
  .check { width: 24px; height: 24px; border-radius: 6px; margin-top: 0; }
  .check svg { width: 14px; height: 14px; }
  .sub .text { font-size: 16.5px; }
  .sub .check { width: 21px; height: 21px; }
  .due { font-size: 14px; }
  .ind { font-size: 14px; }
  .add-row button, .add-section { font-size: 18px; padding: 9px 0; gap: 13px; }
  .smart { padding: 26px 22px 100px 24px; }
  .smart-title { font-size: 38px; }
  .srow .stext { font-size: 18px; }
  .logo { width: 44px; height: 44px; border-radius: 10px; }
  .sbtns { flex-wrap: wrap; justify-content: flex-end; }
  .srow.noc { grid-template-columns: 1fr; row-gap: 8px; }
  .srow.noc .sbtns { justify-content: flex-start; }
  body[data-view="board"][data-screen="board"] .fab { display: grid; }
  .filter-bar { margin: 10px 14px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* adding a list of to-dos */
.mi .tick kbd { color: var(--muted); font-weight: 500; }
.modal.dump { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.modal.dump textarea { height: 150px; flex: none; font: inherit; font-size: 16px; line-height: 1.45; }
.dump-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.dump-to { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dump-to select { min-width: 0; max-width: 240px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.dump-split { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dump-preview { min-height: 0; overflow-y: auto; margin-top: 10px; }
.dump-preview:empty { display: none; }
.dump-preview ul { margin: 0; padding: 0; list-style: none; }
.dump-preview > ul { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }
.dump-preview li { padding: 4px 0 4px 22px; position: relative; font-size: 14.5px; overflow-wrap: anywhere; }
.dump-preview li::before { content: ''; position: absolute; left: 0; top: 8px; width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 4px; }
.dump-preview li ul li { font-size: 13.5px; color: var(--muted); }
.dump-preview li ul li::before { width: 10px; height: 10px; top: 8px; }
.dump-preview .dp-sec { padding-left: 0; font-weight: 600; margin-top: 4px; }
.dump-preview .dp-sec::before { display: none; }
.dump-preview .dp-done { color: var(--muted); text-decoration: line-through; }
.dump-preview .dp-skip { color: var(--muted); opacity: .55; text-decoration: line-through; }
.dump-preview .dp-tag { color: var(--accent); font-size: 13px; }
.modal .dump-preview .dp-note, .modal.dump .dp-note { margin: 8px 0 0; font-size: 13px; }
