/* Task Tracker — mobile-first, theme-aware. Tokens → base → shell → components → views. */

:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7d7b75;
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #e4effc;
  --s1: #2a78d6;           /* chart series 1 */
  --s2: #eb6834;           /* chart series 2 */
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e3f4e3;
  --warn-soft: #fdf0d2;
  --warn-ink: #7a5200;
  --crit: #d03b3b;
  --crit-soft: #fbe6e6;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  --r: 14px;
  --tabbar-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #242422; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #94928b;
    --line: #2c2c2a; --line-2: #45453f; --accent: #3987e5; --accent-soft: #14294a; --s1: #3987e5; --s2: #d95926;
    --good-ink: #3fc33f; --good-soft: #10300f; --warn-soft: #3a2c08; --warn-ink: #f2c14e; --crit: #e66767; --crit-soft: #3a1616;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #242422; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #94928b;
  --line: #2c2c2a; --line-2: #45453f; --accent: #3987e5; --accent-soft: #14294a; --s1: #3987e5; --s2: #d95926;
  --good-ink: #3fc33f; --good-soft: #10300f; --warn-soft: #3a2c08; --warn-ink: #f2c14e; --crit: #e66767; --crit-soft: #3a1616;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
/* 16px inputs stop iOS from zooming the page on focus */
input, select, textarea {
  font-size: 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 72px; line-height: 1.4; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.muted { color: var(--muted); }
.err { color: var(--crit); font-size: 13px; min-height: 1.2em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 550;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--crit); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px;
  cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 360px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 22px; }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in { max-width: 1000px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.top-date { margin-left: auto; color: var(--ink-2); font-size: 13px; text-align: right; }
.nav { display: none; gap: 4px; }
.nav button {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-weight: 550;
}
.nav button:hover { background: var(--surface-2); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1000px; margin: 0 auto; padding: 14px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  height: var(--tabbar-h); border: 0; background: transparent; display: grid; place-items: center; align-content: center; gap: 2px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer; padding: 0; min-width: 0;
}
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar svg.ic { width: 22px; height: 22px; }

@media (min-width: 760px) {
  .nav { display: flex; }
  .tabbar { display: none; }
  main { padding: 22px 16px 60px; }
}

/* ---------- shared components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.card h2, .sec-h h2 { font-size: 15px; font-weight: 650; }
.card .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.sec-h { display: flex; align-items: baseline; gap: 8px; margin: 20px 2px 8px; }
.sec-h .count { color: var(--muted); font-size: 13px; }
.sec-h button { margin-left: auto; }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; border: 1px dashed var(--line-2); border-radius: var(--r); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1; padding: 4px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; max-width: 100%;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.chip.carry { background: var(--warn-soft); color: var(--warn-ink); }
.chip.p-high { background: var(--crit-soft); color: var(--crit); }
.chip.p-medium { background: var(--warn-soft); color: var(--warn-ink); }

/* ---------- progress ---------- */
.progress { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meter { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ring { width: 64px; height: 64px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring.full .fill { stroke: var(--good); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.meter .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.meter .big { font-size: 17px; font-weight: 700; line-height: 1.2; }
.meter .note { font-size: 12.5px; color: var(--ink-2); }
.week-wrap { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 74px; }
.week .d { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; }
.week .stack-b { display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 2px; align-items: center; min-height: 0; }
.week .b { width: min(26px, 70%); border-radius: 4px; min-height: 3px; }
.week .b.done { background: var(--accent); }
.week .b.todo { background: transparent; border: 1.5px dashed var(--line-2); }
.week .d.is-today { color: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--s1); }
.legend i.k2 { background: var(--s2); }
.legend i.todo { background: transparent; border: 1.5px dashed var(--line-2); }
@media (max-width: 430px) { .ring { width: 54px; height: 54px; } .meter { gap: 9px; } .meter .big { font-size: 15px; } .meter .note { font-size: 12px; } }

/* ---------- quick add ---------- */
.quick { margin-top: 12px; }
.quick-row { display: flex; gap: 8px; }
.quick-row input { height: 48px; border-radius: 12px; padding-left: 14px; }
.quick-row .btn { height: 48px; min-width: 48px; border-radius: 12px; padding: 0 14px; }
.quick-hint { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--muted); align-items: center; min-height: 22px; }
.quick-hint code { background: var(--surface-2); border-radius: 5px; padding: 1px 5px; font-size: 12px; color: var(--ink-2); }

/* ---------- task list ---------- */
.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.task { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 6px; padding: 8px 8px 8px 6px; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.check {
  width: 40px; height: 40px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; border-radius: 50%; flex: none;
}
.check i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; transition: .15s; }
.check:hover i { border-color: var(--good); }
.task.is-done .check i { background: var(--good); border-color: var(--good); }
.task.is-done .check i::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.task.is-cancelled .check i { background: var(--surface-2); }
.t-main { min-width: 0; cursor: pointer; padding: 2px 0; border-radius: 8px; }
.t-title { font-weight: 550; overflow-wrap: anywhere; }
.task.is-done .t-title, .task.is-cancelled .t-title { color: var(--muted); text-decoration: line-through; font-weight: 450; }
.t-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.tid { font-variant-numeric: tabular-nums; font-weight: 600; }
.t-side { display: flex; align-items: center; gap: 2px; }
.pill {
  appearance: none; -webkit-appearance: none; width: auto; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; text-align: center; text-align-last: center; background: var(--surface-2); color: var(--ink-2);
}
.pill.st-planned { background: var(--accent-soft); color: var(--accent); }
.pill.st-ongoing { background: var(--warn-soft); color: var(--warn-ink); }
.pill.st-done { background: var(--good-soft); color: var(--good-ink); }
.pill.st-cancelled { text-decoration: line-through; }
@media (max-width: 520px) {
  .task { grid-template-columns: auto 1fr; }
  .task { padding-top: 6px; padding-bottom: 6px; }
  .t-side { grid-column: 2; justify-content: space-between; }
  .t-side .icon-btn { width: 40px; height: 30px; }
  .pill { padding: 4px 10px; font-size: 12px; }
}

/* ---------- filters ---------- */
.filters { display: grid; gap: 8px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row select { width: auto; flex: none; font-size: 14px; padding: 7px 28px 7px 10px; border-radius: 999px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button, .seg label {
  border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; white-space: nowrap; display: block;
}
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg label { padding: 0; }
.seg label span { display: block; padding: 6px 11px; border-radius: 8px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- editor sheet ---------- */
.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(640px, 100vw); max-width: 100vw;
  max-height: min(92dvh, 900px); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden;
}
.sheet::backdrop { background: rgba(0,0,0,.45); }
.sheet-in { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 15px; }
.sheet-head .saved { font-size: 12px; color: var(--muted); margin-left: auto; }
.sheet-body { padding: 14px 16px 18px; overflow-y: auto; display: grid; gap: 14px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.due-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
#f-title { font-size: 17px; font-weight: 600; }
.journal { display: grid; gap: 8px; }
.j-add { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: start; }
.j-add textarea { min-height: 44px; }
.j-add .btn { grid-column: 1 / -1; justify-self: end; }
.j-item { border-left: 3px solid var(--line-2); padding: 2px 0 2px 10px; }
.j-item .j-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.j-item .j-top button { margin-left: auto; }
.j-item .j-top button + button { margin-left: 0; }
.j-item p { white-space: pre-wrap; overflow-wrap: anywhere; }
.j-item.sys { border-left-style: dashed; }
.j-item.sys p { color: var(--muted); font-size: 13px; }
@media (max-width: 600px) {
  .sheet { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .sheet-in { height: 100dvh; max-height: 100dvh; }
  .sheet-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .sheet-body { flex: 1; }
  .j-add { grid-template-columns: 1fr; }
}

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.kpi .n { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.dash-grid { display: grid; gap: 12px; margin-top: 12px; }
.dash-grid .card + .card { margin-top: 0; }
@media (min-width: 760px) {
  .kpis { grid-template-columns: repeat(5, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid .wide { grid-column: 1 / -1; }
}
.bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; margin-top: 28px; border-bottom: 1px solid var(--line-2); position: relative; }
.bars .col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-width: 0; position: relative; }
.bars .col:hover { background: var(--surface-2); }
.bars .b { flex: 1; max-width: 18px; border-radius: 4px 4px 0 0; background: var(--s1); min-height: 0; }
.bars .b.k2 { background: var(--s2); }
.bars .ymax { position: absolute; top: -18px; left: 0; font-size: 11px; color: var(--muted); }
.xlabels { display: flex; gap: 2px; margin-top: 4px; }
.xlabels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; min-width: 0; overflow: visible; }
.hbars { display: grid; gap: 9px; margin-top: 12px; }
.hbar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar .track { height: 12px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; gap: 2px; }
.hbar .track i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hbar .track i.good { background: var(--good); }
.hbar .val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 2ch; text-align: right; }
.stuck { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.stuck li { display: flex; gap: 8px; align-items: center; padding: 7px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.stuck li:hover { background: var(--surface-2); }
.stuck li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 9px;
  border-radius: 8px; max-width: 240px; white-space: pre-line; box-shadow: var(--shadow);
}

/* ---------- settings ---------- */
.rows { display: grid; gap: 8px; margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row input[type="color"] { width: 40px; height: 40px; padding: 3px; flex: none; }
.row .n { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row.archived input[type="text"] { color: var(--muted); text-decoration: line-through; }
.form-grid { display: grid; gap: 10px; max-width: 360px; margin-top: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; display: flex; gap: 12px; align-items: center;
  box-shadow: var(--shadow); font-size: 14px; max-width: calc(100vw - 32px);
}
.toast button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 2px; }
@media (min-width: 760px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= v2: subtasks, board, calendar, burn-up, costs ================= */
.sec-h { flex-wrap: wrap; }
.sec-h .right { margin-left: auto; }
.sec-h.sub { margin: 14px 2px 6px; }
.sec-h.sub h3 { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 7px; margin: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; display: inline-block; }
.chip.ok { background: var(--good-soft); color: var(--good-ink); }
.pill.st-parked { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
.task.is-parked .t-title { color: var(--ink-2); }
.hint { font-size: 12.5px; }
.h3 { font-size: 14px; font-weight: 650; margin-top: 16px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-weight: 550; }
.scope-note { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.filter-row { align-items: center; }
.filter-row .seg { flex: none; }

/* demo mode banner: always visible while sample data is showing */
.demo-bar {
  display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 16px; font-size: 13px;
  background: var(--warn-soft); color: var(--warn-ink); border-top: 1px solid var(--line);
}
.demo-bar .link { color: inherit; }

/* closed (Done / Cancelled) task: read-only editor */
.lock-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; color: var(--ink-2); }
.is-locked input:disabled, .is-locked select:disabled, .is-locked textarea:disabled {
  background: var(--surface-2); color: var(--ink-2); border-color: var(--line); opacity: 1; -webkit-text-fill-color: var(--ink-2); cursor: not-allowed;
}
.is-locked .sub input:disabled { background: transparent; border-color: transparent; }
.is-locked .check:disabled { cursor: not-allowed; }

/* "pick one" dialog */
.ask {
  border: 0; padding: 20px; background: var(--surface); color: var(--ink); width: min(440px, calc(100vw - 32px)); border-radius: 16px;
  box-shadow: var(--shadow);
}
.ask::backdrop { background: rgba(0,0,0,.45); }
.ask h2 { font-size: 17px; overflow-wrap: anywhere; }
.ask p { margin-top: 8px; color: var(--ink-2); }
.ask-opts { display: grid; gap: 8px; margin-top: 16px; }
.ask-opts .btn { display: grid; justify-items: start; gap: 2px; text-align: left; white-space: normal; padding: 10px 14px; min-height: 52px; }
.ask-opts .btn small { font-weight: 450; color: var(--muted); font-size: 12.5px; }
.ask-opts .btn.danger { border-color: var(--crit); }
.ask-opts .btn.ghost { justify-items: center; min-height: 40px; }

/* quick-add suggestion list */
.quick { position: relative; }
.ac {
  position: absolute; left: 0; right: 0; top: 54px; z-index: 15; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: var(--shadow); padding: 4px; max-height: 300px; overflow-y: auto;
}
.ac button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; background: transparent;
  border-radius: 8px; text-align: left; cursor: pointer;
}
.ac button:hover, .ac button[aria-selected="true"] { background: var(--accent-soft); }
.ac .d { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ac .foot { font-size: 11.5px; color: var(--muted); padding: 5px 10px 3px; }

/* progress bars */
.prog { display: inline-block; width: 100%; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.prog i { display: block; height: 100%; background: var(--good); border-radius: 4px; transition: width .3s ease; }
.prog.big { height: 10px; display: block; margin: 2px 0 4px; }

/* subtasks in the editor */
.subs { display: grid; gap: 6px; }
.sub { display: flex; align-items: center; gap: 2px; }
.sub input[type="text"] { border-color: transparent; background: transparent; padding: 7px 8px; }
.sub input[type="text"]:hover, .sub input[type="text"]:focus { border-color: var(--line-2); background: var(--surface); }
.sub.is-done .check i { background: var(--good); border-color: var(--good); }
.sub.is-done .check i::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.sub.is-done input[type="text"] { color: var(--muted); text-decoration: line-through; }
.sub .icon-btn { width: 36px; height: 36px; }
details.cost { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
details.cost summary { cursor: pointer; padding: 10px 0; font-size: 13px; font-weight: 550; color: var(--ink-2); }
details.cost[open] { padding-bottom: 12px; }
details.cost .hint { margin-top: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr; } }

/* kanban board */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; margin-top: 14px; overflow-x: auto;
  padding-bottom: 10px; scroll-snap-type: x proximity; align-items: start;
}
.kcol { background: var(--surface-2); border-radius: var(--r); padding: 8px; scroll-snap-align: start; min-width: 0; border: 2px solid transparent; }
.kcol.over { border-color: var(--accent); }
.kcol header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.kcol header .pill { cursor: default; padding: 4px 10px; }
.kcol header .count, .wk-head .count { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kcards { display: grid; gap: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; cursor: grab; display: grid; gap: 8px; }
.kcard.dragging { opacity: .45; }
.kcard > div { cursor: pointer; border-radius: 6px; }
.kcard .t-title { font-size: 14px; }
.kcard .pill { justify-self: start; padding: 3px 9px; font-size: 11.5px; }
.kcard.is-done .t-title, .kcard.is-cancelled .t-title { color: var(--muted); text-decoration: line-through; font-weight: 450; }
.kempty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 8px 0; list-style: none; }
@media (max-width: 759px) { .board { grid-auto-columns: 78vw; margin-right: -16px; padding-right: 16px; } }

/* calendar */
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.cal-title { font-size: 18px; font-weight: 700; margin: 14px 2px 10px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.cal-grid { gap: 4px; }
.cal-cell {
  min-height: 64px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 5px 6px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0; overflow: hidden;
}
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.out { background: transparent; }
.cal-cell.out .num { color: var(--muted); }
.cal-cell .num { font-size: 13px; font-weight: 650; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.is-today .num { background: var(--accent); color: var(--accent-ink); }
.cal-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.ct { font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 5px; border-radius: 6px; display: inline-block; }
.ct.due { background: var(--accent-soft); color: var(--accent); }
.ct.done { background: var(--good-soft); color: var(--good-ink); }
.cal-items { display: none; }
@media (min-width: 760px) {
  .cal-cell { min-height: 108px; }
  .cal-items { display: grid; gap: 2px; font-size: 11.5px; color: var(--ink-2); min-width: 0; }
  .cal-items span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cal-items .is-done { color: var(--muted); text-decoration: line-through; }
  .cal-items .more { color: var(--muted); }
}
.cal-week { display: grid; gap: 8px; }
.wk-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; min-width: 0; }
.wk-day.is-today { border-color: var(--accent); }
.wk-head {
  width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; border: 0; background: transparent;
  padding: 5px 6px; border-radius: 8px; cursor: pointer; text-align: left;
}
.wk-head:hover { background: var(--surface-2); }
.wk-day ul { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 1px; }
.wk-item { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 8px; cursor: pointer; font-size: 13.5px; min-width: 0; }
.wk-item:hover { background: var(--surface-2); }
.wk-item span { min-width: 0; overflow-wrap: anywhere; }
.wk-item.is-done span { color: var(--muted); text-decoration: line-through; }
.wk-item.is-parked span { color: var(--muted); }
@media (min-width: 900px) {
  .cal-week { grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; gap: 6px; }
  .wk-head { flex-direction: column; gap: 0; }
  .wk-item { font-size: 12.5px; padding: 5px 4px; }
}
.week .d[data-action] { cursor: pointer; border-radius: 8px; }
.week .d[data-action]:hover { background: var(--surface-2); }

/* burn-up line chart */
.line { position: relative; height: 170px; margin-top: 28px; border-bottom: 1px solid var(--line-2); }
.line svg { width: 100%; height: 100%; display: block; overflow: visible; }
.line polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line .l1 { stroke: var(--s1); }
.line .l2 { stroke: var(--s2); }
.line .area { fill: var(--s2); opacity: .12; }
.line .ymax { position: absolute; top: -18px; left: 0; font-size: 11px; color: var(--muted); }
.line .hit { position: absolute; inset: 0; display: flex; }
.line .hit i { flex: 1; }
.line .hit i:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.legend i.ln { height: 3px; width: 14px; border-radius: 2px; vertical-align: 3px; }

/* bucket table + cost */
.table-wrap { overflow-x: auto; margin-top: 10px; }
.btable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.btable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.btable td { padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.btable .num { text-align: right; font-variant-numeric: tabular-nums; }
.btable tbody tr { cursor: pointer; }
.btable tbody tr:hover { background: var(--surface-2); }
.btable td .dot { margin-right: 7px; }
.btable td .prog { width: 90px; margin-right: 8px; }
.btable .pv { font-variant-numeric: tabular-nums; font-weight: 600; }
.kpis.inner { margin-top: 12px; }
.kpis.inner .kpi { background: var(--surface-2); border-color: transparent; }
.kpi .v.sm { font-size: 20px; }
@media (min-width: 760px) { .kpis.inner { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.costs { display: grid; gap: 12px; margin-top: 10px; }
.cost-row { display: grid; grid-template-columns: minmax(70px, 22%) 1fr; gap: 10px; align-items: center; font-size: 13px; }
.cost-row .name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-row .pair { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.cost-row .track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.cost-row .track i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.cost-row .track i.k2 { background: var(--s2); }
.cost-row .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 9ch; }
