/* Clearday for the web. Layout: a quiet sidebar of lists beside one centred column of to-dos,
   with glass controls floating over a soft wash of the accent colour. On a phone the sidebar
   is the home screen and a list slides over it. Colours and sizes follow the Mac app. */
:root {
  --accent-light: #1A73F0; --accent-dark: #4B9BFF;
  --accent: var(--accent-light);
  --bg: #FBFBFD; --side: rgba(244, 246, 251, .78); --card: #FFFFFF; --hover: #F0F1F4; --field: #EEEFF2;
  --ink: #1D1D1F; --ink2: #6E6E73; --ink3: #A1A1A8; --line: rgba(0, 0, 0, .09); --line2: rgba(0, 0, 0, .05);
  --glass: rgba(255, 255, 255, .72); --glass-strong: rgba(255, 255, 255, .9); --glass-edge: rgba(255, 255, 255, .7);
  --sun: #EDAA12; --moon: #5868C2; --red: #D9403A; --orange: #E0701A; --blue: #1A73F0; --sand: #B8924A; --green: #2E9B4F; --violet: #8E44D6;
  --on-accent: #FFFFFF;
  --wash: .16; --wash2: .07;
  --lift: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 30px rgba(0, 0, 0, .12);
  --pop: 0 2px 8px rgba(0, 0, 0, .08), 0 22px 60px rgba(0, 0, 0, .2);
  --float: 0 8px 22px rgba(0, 0, 0, .12);
  --scrim: rgba(10, 14, 22, .34);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .85, .25, 1);
  --bounce: cubic-bezier(.3, 1.5, .5, 1);
  --sab: env(safe-area-inset-bottom, 0px); --sat: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: var(--accent-dark);
    --bg: #1C1C1E; --side: rgba(30, 30, 33, .78); --card: #2C2C2E; --hover: #262628; --field: #2A2A2D;
    --ink: #F2F2F4; --ink2: #A0A0A8; --ink3: #6C6C74; --line: rgba(255, 255, 255, .1); --line2: rgba(255, 255, 255, .06);
    --glass: rgba(52, 52, 56, .68); --glass-strong: rgba(44, 44, 48, .92); --glass-edge: rgba(255, 255, 255, .13);
    --sun: #F6C343; --moon: #8E9BEA; --red: #F4675F; --orange: #F79447; --blue: #4B9BFF; --sand: #D2B06A; --green: #55C777; --violet: #B57BF2;
    --on-accent: #FFFFFF; --wash: .2; --wash2: .09;
    --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
    --pop: 0 2px 8px rgba(0, 0, 0, .35), 0 24px 60px rgba(0, 0, 0, .6);
    --float: 0 8px 22px rgba(0, 0, 0, .4);
    --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: var(--accent-dark);
  --bg: #1C1C1E; --side: rgba(30, 30, 33, .78); --card: #2C2C2E; --hover: #262628; --field: #2A2A2D;
  --ink: #F2F2F4; --ink2: #A0A0A8; --ink3: #6C6C74; --line: rgba(255, 255, 255, .1); --line2: rgba(255, 255, 255, .06);
  --glass: rgba(52, 52, 56, .68); --glass-strong: rgba(44, 44, 48, .92); --glass-edge: rgba(255, 255, 255, .13);
  --sun: #F6C343; --moon: #8E9BEA; --red: #F4675F; --orange: #F79447; --blue: #4B9BFF; --sand: #D2B06A; --green: #55C777; --violet: #B57BF2;
  --on-accent: #FFFFFF; --wash: .2; --wash2: .09;
  --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
  --pop: 0 2px 8px rgba(0, 0, 0, .35), 0 24px 60px rgba(0, 0, 0, .6);
  --float: 0 8px 22px rgba(0, 0, 0, .4);
  --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}
/* Pure black, for OLED screens. */
:root[data-black] {
  --bg: #000000; --side: rgba(8, 8, 9, .9); --card: #121214; --hover: #0E0E10; --field: #161618;
  --glass: rgba(22, 22, 24, .82); --glass-strong: rgba(18, 18, 20, .96); --wash: 0; --wash2: 0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; touch-action: manipulation; overscroll-behavior: none; }
#app { height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
svg { display: block; flex: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
input:focus-visible, textarea:focus-visible { outline: none; }
[hidden] { display: none !important; }
.only-narrow { display: none !important; }
::placeholder { color: var(--ink3); opacity: 1; }

.glass { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 0 0 1px var(--glass-edge), var(--float); }
.glass-strong { background: var(--glass-strong); -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  box-shadow: inset 0 0 0 1px var(--glass-edge), var(--pop); }

/* ---------- shell ---------- */
.boot { height: 100%; background: var(--bg); }
.app { position: relative; height: 100%; display: grid; grid-template-columns: 250px minmax(0, 1fr); overflow: hidden; }
.app.with-ai { grid-template-columns: 250px minmax(0, 1fr) 362px; }
.backdrop { position: absolute; inset: 0; z-index: 0; pointer-events: none; background:
  radial-gradient(620px circle at 0% 0%, color-mix(in srgb, var(--accent) calc(var(--wash) * 100%), transparent), transparent 70%),
  radial-gradient(560px circle at 100% 100%, color-mix(in srgb, var(--violet) calc(var(--wash2) * 100%), transparent), transparent 70%),
  var(--bg); }

.side { position: relative; z-index: 2; display: flex; flex-direction: column; min-height: 0; background: var(--side);
  -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); border-right: 1px solid var(--line); padding-top: var(--sat); }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 8px 14px; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 16px/1 var(--round); letter-spacing: -.01em; }
.brand img { border-radius: 7px; display: block; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-gap { height: 10px; flex: none; }
.nav-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; flex: none; padding: 0 10px; border-radius: 8px; text-align: left; font-size: 14px; color: color-mix(in srgb, var(--ink) 86%, transparent);
  transition: background-color .1s ease-out; }
.nav-row:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-row.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }
.nav-row.drop-over { background: color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.nav-ic { width: 20px; display: grid; place-items: center; flex: none; }
.nav-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-c { font-size: 12px; font-weight: 500; color: var(--ink2); font-variant-numeric: tabular-nums; }
.pct { font-family: var(--round); font-weight: 600; font-variant-numeric: tabular-nums; }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 6px 4px 10px; font-size: 12px; font-weight: 600; color: var(--ink2); flex: none; }
.nav-hint { font-size: 12px; color: var(--ink2); padding: 4px 10px; }
.fab { display: none; }
.side-foot { border-top: 1px solid var(--line2); padding: 6px 8px calc(6px + var(--sab)); }
.nav-row.ask { height: 40px; font-weight: 500; }
.kbd { font: 500 11px/1 var(--round); color: var(--ink2); padding: 4px 6px; border-radius: 5px; background: color-mix(in srgb, var(--ink) 8%, transparent); white-space: nowrap; }

.main { position: relative; z-index: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; animation: fade .14s ease-out; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.col { max-width: 792px; margin-inline: auto; padding: calc(46px + var(--sat)) 36px 150px; }
.col.wide { max-width: 980px; }
.toolbar { position: absolute; top: calc(14px + var(--sat)); right: 18px; z-index: 6; display: flex; gap: 8px; }
.lead { position: absolute; top: calc(14px + var(--sat)); left: 14px; z-index: 6; }
.main > .lead { display: none; }
.gbtn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); transition: transform .16s var(--bounce); }
.gbtn:active { transform: scale(.9); }
.ibtn { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--ink2); flex: none; }
.ibtn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.ibtn.tiny { width: 22px; height: 22px; border-radius: 6px; }
.save-error { position: absolute; top: calc(58px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 7; display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--red) 14%, var(--card)); color: var(--red); font-size: 13px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: var(--float); }

/* ---------- headers ---------- */
.head, .phead { padding: 0 180px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.head-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
h1 { font: 700 30px/1.15 var(--font); letter-spacing: -.022em; overflow-wrap: anywhere; }
.head-sub { color: var(--ink2); font-size: 14px; }
.prog { display: flex; align-items: center; gap: 10px; padding-top: 4px; font-size: 12px; font-weight: 500; color: var(--ink2); font-variant-numeric: tabular-nums; }
.bar { width: 160px; max-width: 45%; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--ink2) 16%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .36s var(--ease), background-color .36s; }
.phead .bar { width: 220px; }
.phead-row { display: flex; align-items: center; gap: 12px; }
.pbadge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--ink2) 10%, transparent); flex: none; transition: transform .16s var(--bounce), background-color .12s; }
.pbadge:hover { background: color-mix(in srgb, var(--ink2) 19%, transparent); }
.pbadge:active { transform: scale(.94); }
.ptitle { flex: 1; min-width: 0; border: 0; background: none; padding: 0; font: 700 30px/1.15 var(--font); letter-spacing: -.022em; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; }
.lbl { font-size: 12px; font-weight: 500; color: var(--ink2); }

/* ---------- sections and rows ---------- */
.sec { display: flex; align-items: baseline; gap: 8px; margin-top: 24px; padding: 0 0 7px 2px; margin-bottom: 4px; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.sec > span:first-child svg { transform: translateY(2px); }
.sec-t { font: 600 15px/1.25 var(--font); }
.sec small { font-size: 13px; color: var(--ink2); }
.sec.is-heading.drop-over, .sec-empty.drop-over { background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent); }
.sec-more { margin-left: auto; align-self: center; opacity: 0; }
.sec:hover .sec-more, .sec-more:focus-visible { opacity: 1; }
.sec.editing { border-bottom: 1.5px solid var(--accent); align-items: center; }
.sec-in { flex: 1; min-width: 0; border: 0; background: none; padding: 0; font: 600 15px/1.25 var(--font); }
.sec small.only-wide { font-size: 12px; color: var(--ink2); white-space: nowrap; }
.sec-empty { font-size: 12.5px; color: var(--ink2); padding: 6px 2px 8px; border-radius: 8px; }

.row { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; margin-inline: -12px; border-radius: 14px;
  transition: background-color .12s, box-shadow .28s var(--ease), margin .28s var(--ease), padding .28s var(--ease); }
.row:not(.open) { cursor: default; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (hover: hover) { .row:not(.open):hover { background: var(--hover); } }
.row.open { background: var(--card); box-shadow: inset 0 0 0 1px var(--line2), var(--lift); padding-block: 14px; margin-block: 8px; z-index: 2; }
.row.drop-over::before { content: ""; position: absolute; left: 6px; right: 6px; top: -1.5px; height: 3px; border-radius: 2px; background: var(--accent); }
.row.drag-source { opacity: .35; }
.drag-ghost { position: fixed !important; z-index: 200; margin: 0 !important; pointer-events: none; background: var(--card) !important; box-shadow: var(--pop) !important; border-radius: 14px; opacity: .96; transition: none !important; }
body.dragging { cursor: grabbing; -webkit-user-select: none; user-select: none; }
body.dragging * { cursor: grabbing !important; }

.cb { width: 36px; height: 36px; margin: -7px -8px; display: grid; place-items: center; flex: none; --cb: var(--accent); }
.cb i { width: 20px; height: 20px; border-radius: 6.5px; border: 1.5px solid color-mix(in srgb, var(--ink2) 62%, transparent); display: grid; place-items: center; transition: background-color .15s, border-color .15s, transform .22s var(--bounce); }
.cb.pri i { border: 1.8px solid var(--cb); background: color-mix(in srgb, var(--cb) 12%, transparent); }
.cb:active i { transform: scale(.82); }
.cb svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 18; stroke-dashoffset: 18; transition: stroke-dashoffset .22s ease-out .03s; }
.cb.on i { background: var(--cb); border-color: var(--cb); }
.cb.on svg { stroke-dashoffset: 0; }
.cb.small { width: 30px; height: 30px; margin: -6px -7px; }
.cb.small i { width: 17px; height: 17px; border-radius: 5.5px; }
.cb.small svg { width: 12px; height: 12px; }

.sum { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding-top: 1px; border-radius: 6px; }
.title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.title.blank, .row.done .title { color: var(--ink2); }
.row.done .title { text-decoration: line-through; text-decoration-color: var(--ink3); }
.meta { flex: none; max-width: 58%; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 8px; font-size: 12px; color: var(--ink2); }
.m { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.m.tag { color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.m.proj { display: inline-block; }

.editor { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.t-in, .notes { display: block; width: 100%; border: 0; background: none; resize: none; overflow: hidden; padding: 0; }
.t-in { font-size: 16px; line-height: 1.35; font-weight: 600; margin-top: 1px; }
.notes { font-size: 15px; line-height: 1.45; color: var(--ink2); min-height: 42px; }
.chips, .flow, .suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips { padding-top: 6px; }
.chip { --chip: var(--accent); display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 14px; font-size: 13.5px; font-weight: 500; white-space: nowrap; max-width: 100%;
  color: var(--ink2); background: color-mix(in srgb, var(--ink2) 11%, transparent); transition: transform .16s var(--bounce), background-color .12s; }
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip.set { color: color-mix(in srgb, var(--chip) 74%, var(--ink)); background: color-mix(in srgb, var(--chip) 14%, transparent); }
.chip.set .ic { color: var(--chip); }
.chip.bare { padding: 0 9px; }
@media (hover: hover) { .chip:not(:disabled):hover { background: color-mix(in srgb, var(--ink2) 19%, transparent); } .chip.set:not(:disabled):hover { background: color-mix(in srgb, var(--chip) 22%, transparent); } .chip.trash:hover { color: var(--red); } }
.chip:not(:disabled):active { transform: scale(.94); }
.chip.pulse { animation: pulse 1.2s ease-in-out infinite; opacity: 1; }
.hint { font-size: 13px; color: var(--ink2); }
.hint.pad { padding: 18px; text-align: center; }

.subs { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ink2) 7%, transparent); }
.sub { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.subcheck { color: var(--ink2); display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; transition: transform .16s var(--bounce); }
.subcheck.on { color: var(--accent); }
.subcheck.ghost { color: var(--ink3); }
button.subcheck:active { transform: scale(.85); }
.sub-in { flex: 1; min-width: 0; border: 0; background: none; padding: 2px 0; font-size: 14.5px; }
.sub-in.done { color: var(--ink2); text-decoration: line-through; text-decoration-color: var(--ink3); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px 16px 0; text-align: center; color: var(--ink3); }
.empty p { color: var(--ink2); max-width: 300px; text-wrap: balance; }
.linkish { margin-top: 20px; color: var(--ink2); font-size: 14px; font-weight: 500; min-height: 32px; }
.linkish:hover { color: var(--ink); }

/* ---------- quick add ---------- */
.qa { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 688px; margin-inline: auto; padding: 0 24px calc(18px + var(--sab)); pointer-events: none; }
.qa > * { pointer-events: auto; }
.qa-bar { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 9px 0 16px; border-radius: 24px; }
.qa-plus { color: var(--accent); }
.qa-in { flex: 1; min-width: 0; border: 0; background: none; padding: 0; height: 100%; font-size: 15px; }
.qa-tokens { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
.qa-tokens .chip { background: color-mix(in srgb, var(--chip) 14%, var(--card)); box-shadow: var(--float); }
.qa-pop { padding: 8px 10px; border-radius: 16px; }
.qa-go { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--on-accent); transition: transform .16s var(--bounce); }
.qa-go:active { transform: scale(.88); }
.qa-ai { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--violet); }
.qa-ai:hover { background: color-mix(in srgb, var(--violet) 14%, transparent); }

/* ---------- popovers, menus, dialogs ---------- */
.pop-layer { position: fixed; inset: 0; z-index: 100; }
.pop { position: absolute; border-radius: 14px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; visibility: hidden; transform-origin: var(--ox, 0) var(--oy, 0); }
.pop.in { visibility: visible; animation: pop .18s var(--ease); }
.pop-layer.sheet { background: var(--scrim); animation: fade .2s; }
.pop-layer.sheet .pop { left: 8px; right: 8px; bottom: calc(8px + var(--sab)); top: auto; border-radius: 20px; max-height: 78vh; animation: sheet .32s var(--ease); }
.menu { padding: 6px; min-width: 216px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border-radius: 8px; text-align: left; font-size: 14px; font-weight: 500; }
.menu-item:not(:disabled):hover, .pal-row.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.menu-item.danger { color: var(--red); }
.menu-item.danger .mi-ic { color: var(--red); }
.menu-item.back { color: var(--ink2); }
.mi-ic { width: 18px; display: grid; place-items: center; flex: none; color: var(--ink2); }
.mi-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-h { font-size: 12px; color: var(--ink2); flex: none; display: inline-flex; }
.mi-ck { color: var(--accent); flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 8px; }
.menu-title { padding: 8px 10px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink2); max-width: 280px; white-space: normal; line-height: 1.35; }

.field { width: 100%; height: 34px; border: 0; border-radius: 9px; background: var(--field); padding: 0 11px; font-size: 14px; }
.field:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.tag-editor, .icon-picker { padding: 12px; width: 268px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.icon-picker { width: 316px; }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 250px; overflow-y: auto; }
.icon-cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; color: var(--ink2); }
.icon-cell:hover { background: var(--hover); color: var(--ink); }
.icon-cell.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

.dp { padding: 12px; width: 292px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; margin-inline: auto; }
.dp-title { font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.dp-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dp-q { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: 9px; background: color-mix(in srgb, var(--ink2) 9%, transparent); font-size: 13.5px; font-weight: 500; }
.dp-q:hover { background: color-mix(in srgb, var(--ink2) 16%, transparent); }
.dp-q.on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.dp-head { display: flex; align-items: center; justify-content: space-between; }
.dp-month { font-weight: 600; font-size: 14.5px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow { font-size: 11px; font-weight: 600; color: var(--ink3); padding: 2px 0 4px; }
.dp-day { aspect-ratio: 1; border-radius: 50%; font-size: 13.5px; font-variant-numeric: tabular-nums; display: grid; place-items: center; }
.dp-day:hover { background: var(--hover); }
.dp-day.out { color: var(--ink3); }
.dp-day.past:not(.on) { color: var(--ink3); }
.dp-day.today { color: var(--accent); font-weight: 700; }
.dp-day.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.dp-time { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.dp-time label { font-size: 13px; font-weight: 500; color: var(--ink2); }
.dp-time input { border: 0; border-radius: 8px; background: var(--field); padding: 5px 8px; font-size: 14px; }
.dp-hours { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; }
.dp-h { flex: 1; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--ink2) 9%, transparent); font-size: 12.5px; font-weight: 500; }
.dp-h.on { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.dp-foot { display: flex; align-items: center; gap: 8px; }

.tbtn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 32px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 500; background: color-mix(in srgb, var(--ink2) 11%, transparent); text-decoration: none; color: var(--ink); white-space: nowrap; transition: transform .16s var(--bounce); }
.tbtn:not(:disabled):hover { background: color-mix(in srgb, var(--ink2) 19%, transparent); }
.tbtn:not(:disabled):active { transform: scale(.96); }
.tbtn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.tbtn.primary:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.tbtn.strong { color: var(--accent); font-weight: 600; }
.tbtn.quiet { background: none; color: var(--ink2); }
.tbtn.danger { color: var(--red); }
.tbtn.danger.solid { background: var(--red); color: #fff; }

.scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; padding: 24px; animation: fade .18s; }
.modal:focus { outline: none; }
.modal { background: var(--card); border-radius: 22px; box-shadow: var(--pop); width: 100%; max-height: 100%; overflow: hidden; display: flex; flex-direction: column; animation: rise .26s var(--ease); }

.palette { max-width: 600px; align-self: start; margin-top: min(14vh, 120px); border-radius: 16px; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 52px; border-bottom: 1px solid var(--line); color: var(--ink2); }
.pal-in input { flex: 1; min-width: 0; border: 0; background: none; font-size: 16px; color: var(--ink); height: 100%; }
.pal-list { overflow-y: auto; padding: 6px; max-height: min(52vh, 420px); }
.pal-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border-radius: 8px; text-align: left; font-size: 14.5px; }

.tour { max-width: 520px; padding: 28px; }
.tour-page { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; min-height: 318px; animation: slide .3s var(--ease); }
.tour-badge { --t: var(--accent); width: 96px; height: 96px; border-radius: 26px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--t) 92%, #fff), color-mix(in srgb, var(--t) 62%, #fff)); box-shadow: 0 10px 26px color-mix(in srgb, var(--t) 36%, transparent); }
.tour-badge.small { width: 56px; height: 56px; border-radius: 16px; }
.tour h2 { font: 700 24px/1.2 var(--font); letter-spacing: -.02em; text-wrap: balance; }
.tour p { color: var(--ink2); max-width: 400px; font-size: 15.5px; line-height: 1.45; text-wrap: pretty; }
.tour-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tour-hints span { font: 500 12px/1 var(--round); color: var(--ink2); padding: 6px 9px; border-radius: 7px; background: color-mix(in srgb, var(--ink2) 12%, transparent); }
.tour-dots { display: flex; justify-content: center; gap: 7px; padding: 6px 0 22px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--ink2) 26%, transparent); transition: width .3s var(--ease), background-color .3s; }
.tour-dots i.on { width: 20px; background: var(--accent); }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-foot .tbtn { min-height: 38px; padding: 0 16px; }

.settings { max-width: 600px; height: min(680px, 100%); }
.s-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px 22px; }
.s-head h2 { font: 700 20px/1.2 var(--font); letter-spacing: -.015em; }
.s-tabs { display: flex; gap: 4px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.s-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--ink2); white-space: nowrap; }
.s-tabs button:hover { background: var(--hover); }
.s-tabs button.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.s-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.s-card { background: color-mix(in srgb, var(--ink2) 7%, transparent); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.s-card h3 { font: 600 14.5px/1.3 var(--font); }
.s-note { font-size: 13.5px; color: var(--ink2); line-height: 1.45; }
.s-note .ok { color: var(--green); font-weight: 600; display: inline-flex; gap: 5px; align-items: center; vertical-align: -2px; }
.s-error { font-size: 13.5px; color: var(--red); font-weight: 500; }
.s-row, .key-row { display: flex; flex-wrap: wrap; gap: 8px; }
.key-row .field { flex: 1; min-width: 180px; height: 36px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; border-radius: 10px; background: color-mix(in srgb, var(--ink2) 12%, transparent); }
.seg button { height: 30px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; transition: transform .16s var(--bounce); }
.swatch:active { transform: scale(.9); }
.swatch.on { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--ink); }
.beta-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--violet) 11%, transparent); }
.tag-beta { font: 700 10.5px/1 var(--round); letter-spacing: .06em; text-transform: uppercase; color: var(--violet); padding: 4px 6px; border-radius: 5px; background: color-mix(in srgb, var(--violet) 16%, transparent); flex: none; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 10px; font-size: 14px; line-height: 1.4; }
.steps li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 12.5px/24px var(--round); text-align: center; }
.steps li > :not(:first-child) { grid-column: 2; justify-self: start; }
.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; line-height: 1.45; color: var(--ink2); }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.keys { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.keys div { display: flex; justify-content: space-between; gap: 12px; align-items: center; }

.card-editor { max-width: 620px; overflow: visible; background: none; box-shadow: none; }
.card-editor .row { margin: 0; }
.ce-foot { display: flex; justify-content: flex-end; padding: 8px 0 0; }
.ce-foot .tbtn { background: var(--card); box-shadow: var(--float); }

.toast { position: fixed; left: 50%; bottom: calc(84px + var(--sab)); transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; max-width: calc(100vw - 32px); box-shadow: var(--pop); animation: toast .28s var(--ease); }
.toast button { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }

/* ---------- board ---------- */
.board { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: calc(46px + var(--sat)); }
.board-head { padding-left: 36px; }
.lanes { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 4px 36px 96px; overflow-x: auto; overscroll-behavior-x: contain; }
.lane { flex: 0 0 272px; min-width: 0; display: flex; flex-direction: column; border-radius: 16px; background: color-mix(in srgb, var(--ink2) 7%, transparent); max-height: 100%; transition: background-color .12s, box-shadow .12s; }
.lanes.few .lane { flex: 1 1 0; max-width: 420px; }
.lane.drop-over { background: color-mix(in srgb, var(--accent) 11%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-size: 14px; font-weight: 600; }
.lane-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-c { font-size: 12px; font-weight: 500; color: var(--ink2); font-variant-numeric: tabular-nums; }
.lane-body { flex: 1; min-height: 60px; overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.lane-empty { font-size: 12.5px; color: var(--ink2); text-align: center; padding: 18px 8px; }
.card { background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: inset 0 0 0 1px var(--line2), 0 1px 2px rgba(0, 0, 0, .06); display: flex; flex-direction: column; gap: 6px; cursor: default; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform .16s var(--ease), box-shadow .16s; }
@media (hover: hover) { .card:hover { box-shadow: inset 0 0 0 1px var(--line), 0 4px 12px rgba(0, 0, 0, .1); transform: translateY(-1px); } }
.card.drag-source { opacity: .35; }
.card-top { display: flex; align-items: flex-start; gap: 9px; }
.card-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.35; }
.card.done .card-title { color: var(--ink2); text-decoration: line-through; text-decoration-color: var(--ink3); }
.card-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: var(--ink2); padding-left: 26px; }
.card-meta:empty { display: none; }

/* ---------- calendar ---------- */
.cal-head { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.cal-head .head-actions { padding-top: 0; gap: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); box-shadow: 0 0 0 1px var(--line); }
.cal-dow { background: var(--bg); font-size: 11.5px; font-weight: 600; color: var(--ink2); text-align: center; padding: 7px 0; }
.cal-day { background: var(--card); min-height: 92px; padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: default; transition: background-color .1s; }
.cal-day.out { background: color-mix(in srgb, var(--card) 55%, var(--bg)); }
.cal-day.out .cal-n { color: var(--ink3); }
.cal-day.on { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.drop-over { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.cal-day:focus-visible { outline-offset: -2px; border-radius: 0; }
.cal-n { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; display: flex; }
.cal-n span { min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 4px; }
.cal-day.today .cal-n span { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-item { font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-user-select: none; user-select: none; }
.cal-item.p1 { background: color-mix(in srgb, var(--red) 15%, transparent); }
.cal-item.p2 { background: color-mix(in srgb, var(--orange) 16%, transparent); }
.cal-item.done { color: var(--ink3); text-decoration: line-through; background: color-mix(in srgb, var(--ink2) 9%, transparent); }
.cal-more { font-size: 11px; color: var(--ink2); padding-left: 6px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-dots i.done { background: var(--ink3); }

/* ---------- Ask AI ---------- */
.assistant { position: relative; z-index: 3; margin: 6px 6px 6px 0; border-radius: 18px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; animation: fromright .3s var(--ease); }
.as-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 10px 14px; border-bottom: 1px solid var(--line2); font-size: 15px; }
.as-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.as-disclose { font-size: 12px; line-height: 1.4; color: var(--ink2); padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ink2) 8%, transparent); }
.as-setup { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 12px; }
.as-setup h3 { font: 700 18px/1.25 var(--font); }
.as-setup p { font-size: 14px; color: var(--ink2); line-height: 1.45; text-wrap: pretty; }
.as-ideas { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.as-ideas p { font-size: 13px; color: var(--ink2); padding: 0 2px 2px; }
.idea { text-align: left; font-size: 13.5px; line-height: 1.35; padding: 9px 11px; border-radius: 11px; background: color-mix(in srgb, var(--violet) 9%, transparent); }
.idea:hover { background: color-mix(in srgb, var(--violet) 16%, transparent); }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.from-user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 5px; }
.bubble.from-ai { align-self: flex-start; background: color-mix(in srgb, var(--ink2) 11%, transparent); border-bottom-left-radius: 5px; }
.chat-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--green); font-weight: 500; padding: 0 4px; }
.chat-error { font-size: 13.5px; line-height: 1.4; color: var(--red); padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--red) 11%, transparent); }
.chat-busy { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink2); padding: 4px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
.rot { animation: rot .3s var(--ease); }
.as-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px calc(8px + var(--sab)) 12px; border-top: 1px solid var(--line2); }
.as-compose textarea { flex: 1; min-width: 0; border: 0; background: none; resize: none; padding: 6px 0; font-size: 15px; line-height: 1.35; max-height: 140px; }

/* ---------- motion ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
@keyframes sheet { from { transform: translateY(40%); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fromright { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes rot { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- touch screens ---------- */
@media (pointer: coarse) {
  .kbd { display: none; }
  .nav-row { height: 42px; font-size: 16px; }
  .row { padding-block: 11px; }
  .sum, .title { font-size: 16px; }
  .chip { height: 34px; font-size: 14.5px; padding: 0 12px; border-radius: 17px; }
  .menu-item { min-height: 46px; font-size: 16px; }
  .ibtn { width: 36px; height: 36px; }
  .ibtn.tiny { width: 30px; height: 30px; }
  .gbtn { width: 38px; height: 38px; }
  .qa-in, .t-in, .notes, .sub-in, .field, .pal-in input, .as-compose textarea, .sec-in, .dp-time input { font-size: 16px; } /* 16px stops phones zooming in on focus */
  .sub { min-height: 34px; }
  .dp-day { font-size: 15px; }
  .tbtn { min-height: 40px; }
  .sec-more { opacity: 1; }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .only-wide { display: none !important; }
  .only-narrow { display: inline-grid !important; }
  .app, .app.with-ai { display: block; }
  .side, .main { position: absolute; inset: 0; transition: transform .42s var(--ease); }
  .side { border-right: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .side-top { padding: 18px 14px 10px 20px; }
  .brand { font-size: 26px; letter-spacing: -.02em; gap: 11px; }
  .brand img { width: 32px; height: 32px; border-radius: 9px; }
  .side-scroll { padding: 4px 14px 14px; }
  .main { z-index: 3; transform: translateX(100%); background: var(--bg); box-shadow: -1px 0 0 var(--line); }
  .app.show-main .main { transform: none; }
  .app.show-main .side { transform: translateX(-24%); }
  .main > .lead { display: grid; }
  .toolbar { right: 14px; }
  .col { padding: calc(64px + var(--sat)) 18px 150px; }
  .head, .phead { padding-right: 0; }
  h1, .ptitle { font-size: 28px; }
  .sum { flex-direction: column; align-items: stretch; gap: 3px; }
  .meta { max-width: 100%; justify-content: flex-start; }
  .meta:empty { display: none; }
  .fab { display: grid; place-items: center; position: absolute; right: 18px; bottom: calc(72px + var(--sab)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .16s var(--bounce); z-index: 2; }
  .fab:active { transform: scale(.9); }
  .qa { padding: 0 12px calc(12px + var(--sab)); }
  .board { padding-top: calc(64px + var(--sat)); }
  .board-head { padding-left: 18px; padding-right: 18px; }
  .lanes { padding: 4px 18px 92px; scroll-snap-type: x mandatory; scroll-padding-inline: 18px; }
  .lane, .lanes.few .lane { flex: 0 0 82%; max-width: none; scroll-snap-align: start; }
  .cal-day { min-height: 54px; align-items: center; padding: 4px 2px; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
  .assistant { position: fixed; inset: 0; z-index: 50; margin: 0; border-radius: 0; padding-top: var(--sat); animation: sheet .34s var(--ease); }
  .scrim { padding: 0; place-items: end center; }
  .modal { border-radius: 22px 22px 0 0; max-height: 94%; animation: sheet .34s var(--ease); padding-bottom: var(--sab); }
  .palette { align-self: start; margin-top: 0; border-radius: 0 0 18px 18px; padding-top: var(--sat); padding-bottom: 0; animation: fade .18s; }
  .scrim:has(.palette) { place-items: start center; }
  .settings { height: 94%; }
  .tour { padding: 22px 20px calc(20px + var(--sab)); }
  .card-editor { padding: 0 10px calc(10px + var(--sab)); }
  .pop.pop-menu .menu { padding: 8px; }
  .dp { width: 100%; max-width: 340px; padding: 14px; }
  .icon-picker, .tag-editor { width: 100%; }
  .icon-grid { grid-template-columns: repeat(7, 1fr); }
  .toast { bottom: calc(76px + var(--sab)); }
  .seg { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 761px) and (max-width: 1040px) {
  .app.with-ai { grid-template-columns: 250px minmax(0, 1fr); }
  .assistant { position: absolute; top: 44px; right: 0; bottom: 0; width: min(350px, calc(100% - 60px)); z-index: 20; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-strong, .side { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--card); }
}
