:root {
  --bg: #0b0b0d;
  --bg-2: #121215;
  --card: #17171b;
  --card-2: #1d1d22;
  --line: #26262d;
  --line-2: #33333c;
  --text: #ececf1;
  --muted: #8b8b96;
  --dim: #5d5d68;
  --accent: #e8b45a;
  --accent-ink: #1a1408;
  --danger: #ef6b6b;
  --ok: #4ade80;
  --radius: 10px;
  --nav-h: 52px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); min-height: 100%; }
body {
  background: transparent;
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--line-2); background: var(--card); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 34px; width: 44px; }
textarea { resize: vertical; min-height: 80px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 12px 0 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--text); font-size: 14px; }
h1 { font-size: 30px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 500; margin: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.section-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); white-space: nowrap; font-size: 13px;
}
.btn:hover { border-color: var(--line-2); background: var(--card); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--card); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: var(--bg-2);
  flex: none;
}
.icon-btn:hover, .icon-btn.active { color: var(--text); border-color: var(--line-2); }
.icon-btn.active { background: var(--card-2); color: var(--accent); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--bg-2); }
.seg button { padding: 4px 10px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--card-2); color: var(--text); }

/* ------------------------------------------------------------------ nav */
.topnav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(0,0,0,.38); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.brand-mark { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--text); border-top-color: var(--accent); }
.navlinks { display: flex; gap: 2px; }
.navlinks a { padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 13.5px; }
.navlinks a:hover { color: var(--text); }
.navlinks a.on { color: var(--text); background: var(--card); font-weight: 500; }
.navlinks a svg { display: none; }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted); font-size: 13px; background: var(--bg-2);
}
.search-btn kbd, kbd {
  font: 11px/1 ui-monospace, monospace; border: 1px solid var(--line-2); border-radius: 4px; padding: 3px 5px; color: var(--muted); background: var(--card);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; text-transform: uppercase; flex: none;
}
.avatar.xs { width: 18px; height: 18px; font-size: 9.5px; }

main.page { padding: 28px 28px 40px; max-width: 1800px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ------------------------------------------------------------- task card */
.task-list { display: flex; flex-direction: column; gap: 8px; min-height: 8px; }
.task {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px 10px 16px; display: flex; flex-direction: column; gap: 6px; user-select: none;
}
.task::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--qc, var(--line-2));
}
.task:hover { border-color: var(--line-2); }
.task.running { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(232,180,90,.25) inset; }
.task.done .task-title { text-decoration: line-through; color: var(--dim); }
.task.done { opacity: .7; }
.task.readonly { background: var(--bg-2); border-style: dashed; }
.task-title { cursor: pointer; word-break: break-word; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 24px; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center;
  color: var(--dim); flex: none;
}
.check:hover { border-color: var(--muted); color: var(--muted); }
.check.on { background: var(--qc, var(--ok)); border-color: var(--qc, var(--ok)); color: #0b0b0d; }
.check svg.i { width: 12px; height: 12px; stroke-width: 3; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 12px; color: var(--muted); max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: transparent;
}
button.chip:hover { color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--qc, var(--muted)); flex: none; }
.task-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.task.running .task-time { color: var(--text); }
.play { color: var(--muted); width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.play:hover { color: var(--accent); background: var(--card-2); }
.handle { color: var(--dim); cursor: grab; touch-action: none; padding: 4px; margin: -4px; }
.task .handle { margin-left: auto; }
.badge-rec { color: var(--dim); display: inline-flex; }
.owner-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { border-color: var(--accent) !important; }
.sortable-drag { box-shadow: 0 10px 30px rgba(0,0,0,.5); }

.add-row {
  display: flex; align-items: center; gap: 4px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  padding: 4px 4px 4px 2px; background: transparent;
}
.add-row input { border: 0; background: transparent; padding: 6px 8px; }
.add-row input:focus { background: transparent; }
.add-row .pos { display: flex; gap: 2px; }
.add-row .pos button { font-size: 12px; color: var(--muted); padding: 3px 7px; border-radius: 6px; display: inline-flex; align-items: center; gap: 3px; }
.add-row .pos button.on { background: var(--card-2); color: var(--text); }

/* -------------------------------------------------------------- home */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 28px; }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.hours-box { display: flex; align-items: center; gap: 12px; }
.hours-box .big { font-size: 26px; font-weight: 500; }
.progress { height: 5px; background: var(--card-2); border-radius: 99px; overflow: hidden; width: 140px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; }
.sec-head { display: flex; align-items: center; gap: 12px; margin: 22px 0 10px; }
.sec-head:first-child { margin-top: 0; }
.sec-head .line { flex: 1; height: 1px; background: var(--line); }
.habit-list { display: flex; flex-direction: column; gap: 6px; }
.habit-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.habit-item.done .grow { color: var(--dim); text-decoration: line-through; }
.habit-item .pending-btn { font-size: 11px; color: var(--accent); border: 1px solid rgba(232,180,90,.4); border-radius: 99px; padding: 1px 8px; }
.habit-item .auto { font-size: 11px; color: var(--muted); }
.others-block { margin-top: 26px; }
.others-block .task-list { opacity: .85; }
.empty { color: var(--dim); font-size: 13px; padding: 10px 2px; }

/* -------------------------------------------------------------- plan */
.plan-wrap { overflow-x: auto; overflow-y: hidden; margin: 0 -28px; padding: 0 28px 8px; scroll-snap-type: x proximity; }
.plan-cols { display: flex; gap: 10px; min-height: calc(100vh - 190px); }
.plan-col {
  width: 250px; flex: none; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start;
}
.plan-col.past { opacity: .62; }
.plan-col.today { border-color: rgba(232,180,90,.35); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 8px; border-bottom: 2px solid var(--line); }
.plan-col.today .col-head { border-bottom-color: var(--accent); }
.col-head .wd { font-weight: 600; }
.col-head .dn { color: var(--muted); }
.plan-col.today .col-head .dn { color: var(--accent); }
.habit-badge {
  margin-left: auto; min-width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent);
  font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.habit-badge.zero { border-color: var(--line-2); color: var(--dim); }
.plan-col .task { padding: 8px 10px 8px 14px; }
.plan-col .add-row input { padding: 5px 6px; font-size: 13px; }
.plan-col .add-row .pos button { padding: 3px 5px; }
.other-toggle { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; padding: 2px; }
.col-scroll { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 60px; margin: 0 -4px; padding: 0 4px; }
.user-group-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------ calendar */
.cal { --hour: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); overflow: hidden; display: flex; flex-direction: column; }
.cal-head { display: grid; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.cal-head > div { padding: 8px 4px; text-align: center; font-size: 12.5px; border-left: 1px solid var(--line); }
.cal-head > div:first-child { border-left: 0; }
.cal-head .today { color: var(--accent); }
.cal-head .hrs { color: var(--dim); font-size: 11px; }
.cal-body { overflow-y: auto; position: relative; flex: 1; }
.cal-grid { display: grid; position: relative; }
.cal-times { position: relative; }
.cal-times div { height: var(--hour); font-size: 10.5px; color: var(--dim); text-align: right; padding-right: 6px; transform: translateY(-6px); }
.cal-day { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% var(--hour); }
.cal-day.today { background-color: rgba(232,180,90,.06); }
.cal-day.future-shade::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; top: var(--now-top, 100%); background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255,255,255,.015) 6px 12px); pointer-events: none; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 4; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.block {
  position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; overflow: hidden; font-size: 11.5px; line-height: 1.25;
  background: color-mix(in srgb, var(--qc, #6b7280) 26%, var(--bg-2)); border-left: 3px solid var(--qc, #6b7280);
  color: var(--text); cursor: grab; z-index: 2; touch-action: pan-y; user-select: none;
}
.block.other { background: color-mix(in srgb, #6b7280 22%, var(--bg-2)); border-left-color: #6b7280; }
.block.running { background-image: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255,255,255,.06) 6px 12px); }
.block .bt { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block .bm { color: var(--muted); font-size: 10.5px; }
.block.dragging { opacity: .85; z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.5); cursor: grabbing; }
.block .rs { position: absolute; left: 0; right: 0; height: 8px; cursor: ns-resize; }
.block .rs.top { top: 0; } .block .rs.bot { bottom: 0; }
.block.pressing { outline: 2px solid var(--accent); }
.draft-block { position: absolute; left: 3px; right: 3px; background: rgba(232,180,90,.25); border: 1px dashed var(--accent); border-radius: 6px; z-index: 3; pointer-events: none; }
.days-switch { display: none; }

/* --------------------------------------------------------------- focus */
.focus-page { min-height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px; gap: 18px; }
.focus-title { font-size: 22px; max-width: 640px; }
.focus-clock { font-size: clamp(64px, 14vw, 128px); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.focus-state { letter-spacing: .14em; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.focus-notes { width: min(640px, 100%); margin-top: 18px; text-align: left; }
.focus-notes textarea { min-height: 140px; background: transparent; }
.focus-next { margin-top: 10px; color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------- quests */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); margin-bottom: 22px; }
.stats-row > div { padding: 16px 20px; border-left: 1px solid var(--line); }
.stats-row > div:first-child { border-left: 0; }
.stats-row .v { font-size: 22px; font-weight: 500; margin-top: 4px; }
.quest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.quest-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-height: 170px; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  position: relative; overflow: hidden;
}
.quest-card::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--qc); opacity: .7; }
.quest-card:hover { border-color: var(--line-2); }
.quest-card .qi { width: 32px; height: 32px; border-radius: 8px; background: var(--card-2); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.quest-card .qt { font-weight: 600; font-size: 15px; }
.quest-card .qd { color: var(--muted); font-size: 12.5px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.quest-card .qh { font-size: 26px; font-weight: 500; margin-top: auto; }
.quest-card .ql { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.quest-card.new { border-style: dashed; align-items: center; justify-content: center; color: var(--muted); background: transparent; }
.quest-card.new::after { display: none; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; }
.spark span { width: 5px; background: var(--qc); border-radius: 2px 2px 0 0; opacity: .8; min-height: 2px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; background: var(--c); }
.swatch.on { border-color: var(--text); }
.emojis { display: flex; gap: 4px; flex-wrap: wrap; }
.emojis button { width: 32px; height: 32px; border-radius: 7px; font-size: 17px; }
.emojis button.on, .emojis button:hover { background: var(--card-2); }
.note { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg-2); white-space: pre-wrap; }
.note .nm { display: flex; gap: 8px; color: var(--dim); font-size: 11px; margin-top: 6px; }
.note .nm button { color: var(--dim); font-size: 11px; }
.note .nm button:hover { color: var(--text); }

/* -------------------------------------------------------------- review */
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.panel .v { font-size: 30px; font-weight: 500; margin-top: 6px; }
.panel .v small { font-size: 13px; color: var(--muted); font-weight: 400; }
.review-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 14px; align-items: start; }
.bars { display: flex; align-items: flex-end; gap: 12px; height: 210px; padding-top: 22px; margin-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b .col { width: min(36px, 70%); border-radius: 5px 5px 2px 2px; background: #3a3a43; min-height: 3px; display: flex; flex-direction: column-reverse; overflow: hidden; }
.bars .b .col .q { background: #4a4a55; }
.bars .b.cur .col .q { background: var(--accent); }
.bars .b .col .o { background: #2b2b33; }
.bars .b .lbl { font-size: 11px; color: var(--dim); }
.bars .b .val { font-size: 11px; color: var(--muted); }
.bars .b.cur .lbl, .bars .b.cur .val { color: var(--accent); }
.hbar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr 52px; gap: 10px; align-items: center; margin: 9px 0; font-size: 13px; }
.hbar .track { height: 7px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.hbar .track div { height: 100%; background: var(--qc); border-radius: 99px; }
.hbar .name { display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.split { height: 30px; border-radius: 6px; background: var(--card-2); overflow: hidden; display: flex; margin: 12px 0; }
.split div { background: var(--accent); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.hgrid { display: grid; grid-template-columns: minmax(100px, 1fr) repeat(7, 26px) 50px; gap: 6px; align-items: center; font-size: 13px; margin: 6px 0; }
.hcell { width: 22px; height: 22px; border-radius: 5px; background: transparent; }
.hcell.done { background: var(--qc); }
.hcell.auto { background: color-mix(in srgb, var(--qc) 45%, transparent); }
.hcell.open { border: 1.5px solid var(--line-2); }

/* -------------------------------------------------------------- habits */
.habit-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.habit-row .hc { width: 10px; height: 34px; border-radius: 4px; background: var(--qc); flex: none; }
.habit-row .ht { font-weight: 500; }
.habit-week { display: flex; gap: 4px; }
.habit-week .d { width: 24px; text-align: center; font-size: 10px; color: var(--dim); }

/* -------------------------------------------------------------- modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal {
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px);
  overflow: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.title-input { font-size: 18px; border: 0; background: transparent; padding: 4px 0; }
.title-input:focus { background: transparent; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.weekday-picks { display: flex; gap: 4px; flex-wrap: wrap; }
.weekday-picks button { width: 34px; height: 30px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.weekday-picks button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--card-2); border: 1px solid var(--line-2); padding: 9px 14px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.err { border-color: var(--danger); }
.menu { position: absolute; z-index: 120; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px; min-width: 200px; box-shadow: 0 12px 30px rgba(0,0,0,.5); max-height: 320px; overflow: auto; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; text-align: left; font-size: 13px; }
.menu button:hover, .menu button.sel { background: var(--line); }
.cmd-list { margin-top: 10px; max-height: 50vh; overflow: auto; }
.cmd-list button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; text-align: left; }
.cmd-list button.sel, .cmd-list button:hover { background: var(--card-2); }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 13px; }
.shortcuts div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }

/* -------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card .brand { margin-bottom: 20px; font-size: 18px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* -------------------------------------------------------------- settings */
.settings { max-width: 760px; }
.set-group { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); margin-bottom: 22px; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-row:first-child { border-top: 0; }
.set-row .grow .muted { font-size: 12.5px; }
.set-row input, .set-row select { width: auto; min-width: 120px; }

/* ============================================================ mobile */
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .review-grid, .cards3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --nav-h: 48px; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  main.page { padding: 18px 14px 30px; }
  h1 { font-size: 24px; }
  .topnav { padding: 0 14px; gap: 10px; }
  .navlinks {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: rgba(14,14,17,.97); border-top: 1px solid var(--line);
    justify-content: space-around; padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); backdrop-filter: blur(8px);
  }
  .navlinks a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; padding: 5px 4px; flex: 1; min-width: 0; }
  .navlinks a svg { display: block; width: 20px; height: 20px; }
  .navlinks a.on { background: transparent; color: var(--accent); }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { padding: 0 8px; }
  .plan-wrap { margin: 0 -14px; padding: 0 14px 8px; scroll-snap-type: x mandatory; }
  .plan-col { width: calc(100vw - 56px); }
  .plan-cols { min-height: calc(100vh - 230px); }
  .stats-row { grid-template-columns: 1fr; }
  .stats-row > div { border-left: 0; border-top: 1px solid var(--line); }
  .stats-row > div:first-child { border-top: 0; }
  .days-switch { display: inline-flex; }
  .home-cal { display: none; }
  .task { padding: 10px 10px 10px 14px; }
  .check { width: 26px; height: 26px; }
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .grid2 { grid-template-columns: 1fr; }
  .shortcuts { grid-template-columns: 1fr; }
  .hgrid { grid-template-columns: minmax(80px, 1fr) repeat(7, 22px) 40px; gap: 4px; }
  .hcell { width: 20px; height: 20px; }
  .toast-wrap { bottom: 80px; }
  .page-head { gap: 10px; }
}

.plan-col .add-row .lbl { display: none; }
.home-cal .cal { height: 100%; }
.cal { height: 100%; }
.block .rs { touch-action: none; }
.habit-item .check:disabled { cursor: default; }
button:disabled { cursor: default; }
.plan-col .task .handle { display: none; }
.plan-col .chip { max-width: 140px; }
.plan-col .task-meta { gap: 6px; }
.seg button { white-space: nowrap; }
.set-row .grow { min-width: 200px; }
@media (max-width: 760px) {
  .topnav { backdrop-filter: none; background: var(--bg); }
  .habit-row { flex-wrap: wrap; gap: 10px 12px; }
  .habit-row .grow { min-width: calc(100% - 140px); }
  .habit-row .habit-week { order: 5; width: 100%; justify-content: space-between; padding-left: 40px; }
  .set-row .grow { min-width: 100%; }
  .set-row select { width: 100%; }
}
.quest-suggest { top: calc(100% + 4px); left: 0; right: 0; min-width: 0; }

/* Focus: distraction-free – no menu bar, notes only visible on hover/focus */
body[data-page="focus"] .topnav { display: none; }
body[data-page="focus"] { padding-bottom: 0; }
body[data-page="focus"] .focus-page { min-height: 100vh; min-height: 100dvh; position: relative; }
.focus-notes { opacity: 0; transition: opacity .15s; }
.focus-notes:hover, .focus-notes:focus-within { opacity: 1; }

/* Calendar: page itself doesn't scroll, only the time grid */
body[data-page="calendar"] { height: 100vh; height: 100dvh; overflow: hidden; }
body[data-page="calendar"] main.page {
  height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h));
  display: flex; flex-direction: column; overflow: hidden; padding-bottom: 16px;
}
body[data-page="calendar"] .page-head { flex: none; }
.cal-page-box { flex: 1; min-height: 0; }
@media (max-width: 760px) {
  body[data-page="calendar"] { padding-bottom: 0; }
  body[data-page="calendar"] main.page {
    height: calc(100vh - var(--nav-h) - 60px); height: calc(100dvh - var(--nav-h) - 60px - env(safe-area-inset-bottom));
    padding-bottom: 10px;
  }
  body[data-page="calendar"] .page-head { margin-bottom: 12px; }
}

/* ------------------------------------------------------- color picker */
.color-field { display: flex; flex-direction: column; gap: 8px; }
.swatch.custom { background: var(--c, conic-gradient(#ef4444, #facc15, #4ade80, #22d3ee, #6366f1, #e879f9, #ef4444)); position: relative; }
.swatch.custom::after { content: "+"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.8); }
.swatch.custom.on::after { content: ""; }
.cp-wrap { max-width: 280px; }
.cp { display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.cp-sv {
  position: relative; height: 150px; border-radius: 6px; cursor: crosshair; touch-action: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--h, red));
}
.cp-knob {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.4); pointer-events: none;
}
.cp-row { display: flex; align-items: center; gap: 10px; }
.cp-prev { width: 26px; height: 26px; border-radius: 50%; flex: none; border: 1px solid var(--line-2); }
.cp-hue {
  position: relative; flex: 1; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-hknob {
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: transparent; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6); pointer-events: none;
}
.cp-hex { width: 84px; flex: none; font-family: ui-monospace, monospace; font-size: 12.5px; padding: 5px 7px; }

/* --------------------------------------------------------- background */
.bg-row { align-items: flex-start; flex-wrap: wrap; }
.bg-fields { display: flex; gap: 18px; flex-wrap: wrap; }
.bg-fields > div { display: flex; flex-direction: column; gap: 6px; max-width: 290px; }
.bg-preview { margin-top: 10px; height: 54px; width: 120px; border-radius: 8px; border: 1px solid var(--line-2); }

/* ----------------------------------------------------- task duplicate */
.dup-panel { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }

/* -------------------------------------------------------------- radar */
.radar-wrap { position: relative; margin-top: 6px; }
.radar { width: 100%; height: auto; display: block; max-height: 340px; overflow: visible; }
.radar-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-area { fill: var(--accent); fill-opacity: .16; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.radar-hit { fill: transparent; cursor: pointer; }
.radar-label { fill: var(--text); font-size: 13px; }
@media (max-width: 760px) { .radar-label { font-size: 15px; } .radar-value { font-size: 13px; } }
.radar-value { fill: var(--muted); font-size: 11px; }
.radar-scale { fill: var(--dim); font-size: 10px; }
.radar-empty { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 9px; font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.4);
}

/* -------------------------------------------- plan: 1–3 days on mobile */
@media (max-width: 760px) {
  .plan-wrap { --pc: 1; scroll-padding-inline: 14px; }
  .plan-col { width: calc((100vw - 28px - (var(--pc) - 1) * 8px) / var(--pc)); }
  .plan-wrap[data-n="2"] .plan-cols, .plan-wrap[data-n="3"] .plan-cols { gap: 8px; }
  .plan-wrap[data-n="2"] .plan-col, .plan-wrap[data-n="3"] .plan-col { padding: 8px 6px; gap: 8px; }
  .plan-wrap[data-n="3"] .plan-col .task { padding: 6px 6px 6px 10px; font-size: 12.5px; }
  .plan-wrap[data-n="3"] .plan-col .add-row .pos { display: none; }
  .plan-wrap[data-n="3"] .plan-col .chip { max-width: 100%; font-size: 11px; }
  .plan-wrap[data-n="3"] .plan-col .task-meta { gap: 4px; flex-wrap: wrap; }
  .plan-wrap[data-n="3"] .col-head { gap: 4px; }
}
