/* ListBender */
:root {
  --bg: #f6f5f1; --panel: #ffffff; --side: #efeee8; --ink: #1d2320; --ink2: #56605b; --ink3: #8a938e; --line: #e2e0d8;
  --accent: #2f7d5b; --accent-ink: #ffffff; --accent-soft: #dcefe5; --hover: rgba(29, 35, 32, .05); --danger: #b3412f; --late: #b3412f;
  --star: #d9a21b; --sun: #c98a12; --plan: #2f6db3; --shadow: 0 10px 30px rgba(20, 30, 25, .12), 0 2px 6px rgba(20, 30, 25, .06);
  --r: 10px; --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; --display: 'Fraunces', Georgia, serif;
  --c-green: #2f7d5b; --c-blue: #2f6db3; --c-purple: #7a4fb5; --c-red: #c4473a; --c-orange: #d27a2c; --c-yellow: #c9a227; --c-teal: #22848a; --c-gray: #7c8580;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151917; --panel: #1c211e; --side: #111412; --ink: #e8ece9; --ink2: #a9b3ad; --ink3: #77817b; --line: #2b322e;
    --accent: #4fae84; --accent-ink: #0d1a14; --accent-soft: #1f3a2d; --hover: rgba(232, 236, 233, .06); --danger: #e0715f; --late: #e0715f;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151917; --panel: #1c211e; --side: #111412; --ink: #e8ece9; --ink2: #a9b3ad; --ink3: #77817b; --line: #2b322e;
  --accent: #4fae84; --accent-ink: #0d1a14; --accent-soft: #1f3a2d; --hover: rgba(232, 236, 233, .06); --danger: #e0715f; --late: #e0715f;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100vh; font: 600 22px var(--display); color: var(--ink3); }
.muted { color: var(--ink3); }
.c-green { background: var(--c-green); } .c-blue { background: var(--c-blue); } .c-purple { background: var(--c-purple); } .c-red { background: var(--c-red); }
.c-orange { background: var(--c-orange); } .c-yellow { background: var(--c-yellow); } .c-teal { background: var(--c-teal); } .c-gray { background: var(--c-gray); }

/* ---------- Buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 18px; border-radius: var(--r); border: 1px solid transparent; font-weight: 600; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-google { width: 100%; background: var(--panel); border-color: var(--line); color: var(--ink); }
.btn-google:hover { background: var(--hover); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); min-height: 38px; padding: 0 12px; font-weight: 500; }
.btn-ghost:hover { background: var(--hover); }
.btn-dangerfill { background: var(--danger); color: #fff; }
.btn-danger { background: transparent; border-color: transparent; color: var(--danger); min-height: 38px; padding: 0 12px; font-weight: 500; margin-left: auto; }
.btn-danger:hover { background: var(--hover); }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--ink2); font-size: 18px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink2); }
.field input, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input:disabled { opacity: .5; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.small { font-size: 13px; } .right { justify-self: end; }
.hint { margin: -8px 0 0; font-size: 13px; color: var(--ink3); }
.form-err { margin: 0; min-height: 0; color: var(--danger); font-size: 14px; font-weight: 500; }
.form-err:empty { display: none; }

/* ---------- Sign-in ---------- */
.auth { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 32px 16px; }
.auth-card { width: min(400px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px 24px; box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 20px var(--display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.auth h1 { font: 700 28px/1.15 var(--display); margin: 22px 0 6px; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 4px; color: var(--ink2); }
.auth .btn-google { margin-top: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink3); font-size: 13px; margin: 16px 0 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form { display: grid; gap: 14px; margin-top: 18px; }
.auth-foot { margin: 20px 0 0; text-align: center; color: var(--ink2); font-size: 14px; }
.auth-tag { margin: 0; color: var(--ink3); font: 600 15px var(--display); }
.done-note { margin: 18px 0 0; padding: 14px; background: var(--accent-soft); border-radius: var(--r); }

/* ---------- Shell ---------- */
[hidden] { display: none !important; }
.shell { display: grid; grid-template-columns: 272px 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 10px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 12px; }
.side-close { display: none; }
.side .brand { font-size: 18px; }
.search { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; padding: 0 10px; min-height: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--ink3); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 38px; color: var(--ink); }
.side-scroll { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.side-smart { display: grid; gap: 1px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.side-lists, .side-tags { display: grid; gap: 1px; align-content: start; }
.side-tags { margin-top: 10px; }
.side-label { font-size: 12px; font-weight: 700; color: var(--ink3); letter-spacing: .05em; text-transform: uppercase; padding: 8px 10px 4px; }
.side-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--ink); text-decoration: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.side-item:hover { background: var(--hover); }
.side-item.on { background: var(--accent-soft); font-weight: 600; }
.side-item.in-group { padding-left: 32px; }
.side-item.drop-on { background: var(--accent); color: var(--accent-ink); }
.side-item.dragging { opacity: .4; }
.side-item.grp { font-weight: 600; color: var(--ink2); padding-left: 4px; cursor: default; }
.side-item.grp .twist { width: 24px; height: 28px; }
.side-item.grp .g-more { width: 32px; height: 32px; opacity: 0; font-size: 16px; }
.side-item.grp:hover .g-more, .side-item.grp:focus-within .g-more { opacity: 1; }
.grp-empty { font-size: 13px; color: var(--ink3); padding: 6px 10px 8px 32px; }
.s-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.s-icon svg, .h-icon svg, .t-meta svg, .d-line svg, .pv-bit svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.s-icon svg { width: 19px; height: 19px; }
.s-myday .s-icon, .h-icon.s-myday { color: var(--sun); }
.s-important .s-icon, .h-icon.s-important { color: var(--star); }
.s-planned .s-icon, .h-icon.s-planned { color: var(--plan); }
.s-all .s-icon, .h-icon.s-all { color: var(--accent); }
.s-done .s-icon, .h-icon.s-done { color: var(--ink2); }
.hash { width: 20px; text-align: center; color: var(--ink3); font-weight: 700; }
.dot { width: 12px; height: 12px; border-radius: 4px; flex: none; display: inline-block; }
.dot.big { width: 16px; height: 16px; border-radius: 5px; }
.side-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; font-weight: 500; }
.side-item.drop-on .count { color: inherit; }
.side-adds { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.side-add { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); font-weight: 600; text-align: left; }
.side-add:hover { background: var(--hover); }
.side-group svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.plus { width: 20px; text-align: center; font-size: 20px; line-height: 1; }
.side-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 6px 0; border-top: 1px solid var(--line); margin-top: 6px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink3); }
.sync i { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); }
.sync.waiting i { background: var(--c-orange); }
.me { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.scrim { display: none; }

/* ---------- Main ---------- */
.main { position: relative; overflow-y: auto; padding: 26px clamp(16px, 4vw, 48px) 96px; min-width: 0; }
.main-head, .add, .add-preview, .view-body, .view-sub { max-width: 780px; }
.main-head { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.h-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.h-icon svg { width: 28px; height: 28px; }
.menu-btn { display: none; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; font-size: 20px; color: var(--ink2); flex: none; }
.list-title { flex: 1; min-width: 0; margin: 0; font: 700 30px/1.2 var(--display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.list-title[tabindex] { cursor: text; }
.list-title-input { flex: 1; min-width: 0; font: 700 30px/1.2 var(--display); letter-spacing: -.02em; border: 0; border-bottom: 2px solid var(--accent); background: transparent; padding: 0; outline: none; }
.sort-chip { font-size: 12.5px; font-weight: 600; color: var(--ink2); background: var(--hover); padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.view-sub { margin: 2px 0 0 40px; color: var(--ink2); }

.add { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; padding: 0 14px; min-height: 52px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-plus { color: var(--accent); font-size: 22px; line-height: 1; width: 22px; text-align: center; flex: none; }
.add input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 50px; }
.add-preview { min-height: 12px; padding: 6px 4px 4px; }
.add-preview:empty { min-height: 12px; padding: 0; }
.pv { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pv-bit { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); font-size: 13px; font-weight: 600; }
.pv-bit svg { width: 15px; height: 15px; }
.pv-x { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--ink3); }
.pv-x:hover { background: var(--hover); color: var(--ink); }
.pv-off { font-size: 13px; color: var(--ink3); }
.pv-on { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px; }

.sec { display: flex; align-items: center; gap: 8px; margin: 22px 0 6px; font: 700 13px var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--ink2); }
.sec a { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.sec a:hover { color: var(--ink); }
.sec.late { color: var(--late); }
.sec.day { text-transform: none; letter-spacing: 0; font-size: 14px; }

.tasks { list-style: none; margin: 0; padding: 0; }
.task { --depth: 0; position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; margin-bottom: 2px; padding: 4px 6px 4px calc(4px + var(--depth) * 28px); border-radius: 10px; cursor: pointer; background: var(--panel); border: 1px solid transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
.task.d1 { --depth: 1; } .task.d2 { --depth: 2; } .task.d3 { --depth: 3; } .task.d4 { --depth: 4; } .task.d5 { --depth: 5; } .task.d6 { --depth: 6; } .task.d7 { --depth: 7; } .task.d8 { --depth: 8; }
.task:hover { border-color: var(--line); }
.task:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.task.on { background: var(--accent-soft); }
.task.dragging { opacity: .35; }
.twist, .twist-sp { width: 22px; flex: none; }
.twist { height: 28px; border: 0; background: transparent; color: var(--ink3); border-radius: 6px; font-size: 12px; padding: 0; }
.twist:hover { background: var(--hover); color: var(--ink); }
.check { width: 24px; height: 24px; flex: none; border: 2px solid var(--ink3); border-radius: 7px; background: transparent; display: grid; place-items: center; padding: 0; position: relative; }
.check::after { content: ''; position: absolute; inset: -10px; }
.check svg { width: 14px; height: 14px; fill: none; stroke: var(--accent-ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.check:hover { border-color: var(--accent); }
.check:hover svg { opacity: .5; stroke: var(--accent); }
.is-done .check, .check.on, .check[aria-checked=true] { background: var(--accent); border-color: var(--accent); }
.is-done .check svg, .check.on svg, .check[aria-checked=true] svg { opacity: 1; stroke: var(--accent-ink); }
.check.sm { width: 20px; height: 20px; border-radius: 6px; }
.t-body { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 6px 0; }
.t-title { overflow-wrap: anywhere; }
.is-done .t-title { color: var(--ink3); text-decoration: line-through; }
.t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--ink2); }
.t-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.t-meta svg { width: 14px; height: 14px; }
.m-due.late { color: var(--late); font-weight: 600; }
.m-due.today { color: var(--plan); font-weight: 600; }
.m-myday { color: var(--sun); }
.tag { color: var(--accent); font-weight: 600; border-radius: 4px; }
.tag:hover { text-decoration: underline; }
mark { background: #f3e19a; color: inherit; border-radius: 3px; padding: 0 1px; }
.star { width: 40px; height: 40px; flex: none; border: 0; background: transparent; color: var(--ink3); border-radius: 8px; display: grid; place-items: center; padding: 0; }
.star svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; opacity: .45; }
.star:hover svg { opacity: 1; }
.star.on { color: var(--star); }
.star.on svg { fill: currentColor; opacity: 1; }
.add-myday { color: var(--accent); font-size: 22px; }
.is-heading { background: transparent; padding-top: 16px; min-height: 44px; }
.is-heading .t-title { font: 700 13px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.loading, .empty-note { color: var(--ink3); padding: 16px 6px; list-style: none; }
.done-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 20px 0 6px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--hover); color: var(--ink2); font-weight: 600; }
.tasks.done .task { background: transparent; }

/* Sharing, reminders, people */
.shared { display: inline-grid; color: var(--ink3); }
.shared svg, .people-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.share-btn { min-height: 36px; }
.people-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink2); font-weight: 600; font-size: 13px; }
.people-btn:hover { border-color: var(--accent); }
.m-rem { color: var(--ink2); }
.m-who { color: var(--ink2); }
.m-who.me { color: var(--accent); font-weight: 600; }
.av { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); font-size: 10.5px; font-weight: 700; }
.av.big { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; flex: none; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li { display: flex; align-items: center; gap: 10px; }
.pp { flex: 1; min-width: 0; display: grid; }
.pp span { font-size: 13px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.d-rem { flex: 1; }

/* Import */
.imp { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.imp h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; }
.imp p { margin: 0; font-size: 14px; color: var(--ink2); line-height: 1.55; }
.imp a { color: var(--accent); font-weight: 600; }
.imp .btn { justify-self: start; margin-top: 4px; }
.imp-logo { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; color: #fff; font-size: 11px; font-weight: 800; }
.imp-logo.ms { background: #2564cf; } .imp-logo.gt { background: #1a73e8; } .imp-logo.td { background: #e44332; } .imp-logo.tt { background: #4772fa; } .imp-logo.lb { background: var(--accent); }
.imp-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); font-size: 12px; font-weight: 700; margin-right: 2px; }
.imp-pick { padding-top: 6px; }
.imp-pick input { display: none; }
.imp-pick .btn-primary { width: auto; }
.imp-paste { padding-top: 4px; }
.imp-paste summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 32px; display: flex; align-items: center; }
.imp-paste[open] { display: grid; gap: 8px; }
.imp-paste input:not([type]), .imp-paste textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.imp-paste .btn { justify-self: start; }
.imp-dates, .imp-opt, .imp-all label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.imp-lists { list-style: none; margin: 0; padding: 0; max-height: 42vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.imp-lists li + li { border-top: 1px solid var(--line); }
.imp-lists label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; }
.il-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.imp-lists input, .imp-opt input, .imp-all input, .imp-dates input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* Drag */
.is-dragging, .is-dragging * { cursor: grabbing !important; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; max-width: 320px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop-line { position: fixed; z-index: 79; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; display: none; }
.drop-line::before { content: ''; position: absolute; left: -5px; top: -3px; width: 9px; height: 9px; border-radius: 3px; background: var(--accent); }

/* ---------- Task details ---------- */
.detail { display: none; }
.detail-open .detail { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; position: fixed; right: 12px; top: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); padding: 10px 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow-y: auto; z-index: 20; }
@media (min-width: 1240px) { .detail-open .main { padding-right: 420px; } }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.d-where { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); font-weight: 600; min-width: 0; }
.d-parent { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 6px 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-titlerow { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.d-titlerow .check { margin-top: 10px; }
.d-title { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; font: 600 18px/1.35 var(--font); padding: 8px 0; outline: none; overflow: hidden; }
.d-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; }
.d-sublist { display: grid; }
.d-sub { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.d-sub + .d-sub { border-top: 1px solid var(--line); }
.d-sub-title { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 8px 0; overflow-wrap: anywhere; }
.d-sub.is-done .d-sub-title { color: var(--ink3); text-decoration: line-through; }
.d-subadd { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.d-subadd .add-plus { font-size: 20px; width: 20px; }
.d-subadd input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 42px; }
.d-line { display: flex; align-items: center; gap: 10px; min-height: 46px; width: 100%; border: 0; background: none; text-align: left; padding: 0; color: var(--ink); }
.d-line svg { width: 19px; height: 19px; flex: none; color: var(--ink2); }
.d-myday.on, .d-myday.on svg { color: var(--sun); font-weight: 600; }
.d-x { margin-left: auto; color: var(--ink3); padding: 6px; }
.d-lbl { width: 56px; flex: none; color: var(--ink2); font-size: 14px; }
.d-line input, .d-line select, .d-custom input, .d-custom select { width: 0; min-height: 38px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 0; }
.d-date { flex: 1.3; } .d-time { flex: 1; min-width: 104px; } .d-repeat, .d-list { flex: 1; }
.d-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 10px 29px; }
.chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 13px; font-weight: 500; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.d-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 0 10px 29px; }
.d-custom .d-n { width: 64px; flex: none; } .d-custom select { width: auto; }
.d-days { display: flex; gap: 4px; width: 100%; }
.dday { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); font-weight: 600; font-size: 13px; }
.dday.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.d-hint { margin: -4px 0 10px 29px; font-size: 12.5px; color: var(--ink2); }
.d-notes { width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); resize: vertical; outline: none; }
.d-notes:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.d-foot { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.d-created { flex: 1; font-size: 12.5px; color: var(--ink3); }
.d-del svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.d-del:hover { color: var(--danger); }

/* ---------- Menus, dialogs, toasts ---------- */
.menu { position: fixed; z-index: 50; min-width: 220px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.menu button[role=menuitem] { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.menu button[role=menuitem]:hover, .menu button[role=menuitem]:focus-visible { background: var(--hover); outline: none; }
.menu .tick { width: 14px; color: var(--accent); font-weight: 700; }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-head { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink3); padding: 8px 12px 4px; }
.menu-who { display: grid; padding: 8px 12px; }
.menu-who span { font-size: 13px; color: var(--ink2); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
.sw { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.sw.on { border-color: var(--ink); }
.dlg-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(15, 20, 18, .45); }
.dlg { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 22px 18px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.dlg h2 { margin: 0; font: 700 22px var(--display); }
.dlg-body { display: grid; gap: 12px; }
.dlg-body p { margin: 0; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-btns .btn-primary { width: auto; }
.set { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.set h3 { margin: 0; font-size: 14px; }
.set input { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 0; }
.set-row { display: flex; gap: 8px; align-items: center; }
.set-row input { flex: 1; }
.set-row .hint { flex: 1; margin: 0; }
.set.danger { border-bottom: 0; }
.btn.danger { color: var(--danger); justify-self: start; }
.set-msg { min-height: 20px; font-weight: 600; color: var(--accent); }
.ver { text-align: right; }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
kbd { font: 600 12px var(--font); padding: 3px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--bg); white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 16px; padding: 10px 12px 10px 18px; min-height: 48px; background: var(--ink); color: var(--bg); border-radius: 12px; box-shadow: var(--shadow); transition: .2s; z-index: 90; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-undo { border: 0; background: transparent; color: var(--accent-soft); font-weight: 700; min-height: 36px; padding: 0 8px; border-radius: 8px; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(310px, 86vw); z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); padding-top: max(14px, env(safe-area-inset-top)); }
  .side-open .side { transform: none; }
  .side-close { display: grid; }
  .side-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 20, 18, .35); }
  .menu-btn { display: grid; place-items: center; margin-left: -8px; }
  .main { padding: max(12px, env(safe-area-inset-top)) 12px 96px; }
  .list-title, .list-title-input { font-size: 25px; }
  .h-icon { display: none; }
  .view-sub { margin-left: 40px; }
  .task { padding-right: 2px; }
  .detail-open .detail { top: auto; right: 0; left: 0; bottom: 0; width: auto; max-height: 88vh; border-radius: 18px 18px 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .set-row { flex-wrap: wrap; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) mark { background: #6b5a17; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
