/* ============================================================================
   Project Hub — "Workspace" design system. Mobile-first, cool monochrome,
   one accent, hairline structure. Light default + dark via [data-theme].
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --ink: #0b0b0c;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #ececef;
  --border-strong: #e0e0e4;
  --accent: #3b6cf6;
  --accent-soft: rgba(59,108,246,.10);
  --accent-ink: #3b6cf6;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 9px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(11,11,12,.04);
  --shadow-soft: 0 1px 2px rgba(11,11,12,.05), 0 1px 1px rgba(11,11,12,.03);
  --shadow-pop: 0 18px 50px -28px rgba(20,20,28,.28), 0 4px 14px rgba(20,20,28,.06);
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2,.7,.2,1);
  --sidebar-w: 230px;
  --tabbar-h: 64px;
  /* deterministic muted avatar colors */
  --av-AB: #d4794e; --av-SK: #4e8fd4; --av-OM: #5aa67e; --av-RM: #8a6fc4; --av-LR: #c46f95;
}
:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1a1a1d;
  --ink: #f4f4f5;
  --muted: #9a9aa3;
  --faint: #6b6b74;
  --border: #26262b;
  --border-strong: #303036;
  --accent: #5a83ff;
  --accent-soft: rgba(90,131,255,.14);
  --accent-ink: #6f93ff;
  --green: #2bbf63;
  --amber: #eaa12f;
  --red: #f15a5a;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-soft: 0 1px 2px rgba(0,0,0,.5);
  --shadow-pop: 0 18px 50px -24px rgba(0,0,0,.7);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px; line-height: 1.5;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.03em; }
p { margin: 0; }
button { font-family: inherit; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: 0; }
.muted { color: var(--muted); }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; stroke-width: 1.6; }

/* ============================================================================
   APP SHELL
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

/* ---- Desktop sidebar (hidden on mobile) ---- */
.sidebar { display: none; }

/* ---- Mobile top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 54px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(14px); -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--ink); }
.topbar .brand .glyph {
  width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; flex: none;
}
.topbar .brand .glyph .icon { width: 16px; height: 16px; stroke-width: 2; }
.topbar .spacer { margin-left: auto; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer;
  display: inline-grid; place-items: center; transition: color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.icon-btn.active { color: var(--accent-ink); border-color: var(--accent); }

/* Mobile "More" menu (secondary nav: My Tasks / Activity / Users) */
.topmenu {
  position: fixed; top: 56px; right: 12px; z-index: 45; min-width: 222px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); padding: 6px; animation: fadeUp .16s var(--ease);
}
.topmenu[hidden] { display: none; }
.topmenu a { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 500; font-size: 14px; }
.topmenu a .icon { width: 18px; height: 18px; color: var(--muted); }
.topmenu a:hover { background: var(--surface-2); }
.topmenu a.active { background: var(--accent-soft); color: var(--accent-ink); }
.topmenu a.active .icon { color: var(--accent-ink); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 6px 16px 24px; }

/* ---- Bottom tab bar + FAB (mobile) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 6px 10px env(safe-area-inset-bottom);
  display: flex; align-items: flex-start;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(16px); -webkit-backdrop-filter: saturate(1.3) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding-top: 7px; color: var(--faint); font-size: 10.5px; font-weight: 500;
  transition: color .15s var(--ease);
}
.tabbar .tab .icon { width: 21px; height: 21px; }
.tabbar .tab.active { color: var(--accent-ink); }
.tabbar .tab.active .icon { stroke-width: 2.2; }
.tabbar .tab-gap { flex: 0 0 56px; }
.tabbar .tab .badge {
  position: absolute; transform: translate(12px,-4px);
  background: var(--red); color: #fff; font-family: var(--mono); font-size: 9px; font-weight: 600;
  min-width: 15px; height: 15px; border-radius: 999px; padding: 0 4px;
  display: grid; place-items: center; border: 1.5px solid var(--bg);
}
.fab {
  position: fixed; z-index: 41; bottom: calc(var(--tabbar-h)/2 + env(safe-area-inset-bottom) + 2px);
  left: 50%; transform: translateX(-50%);
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--ink); color: var(--bg); display: grid; place-items: center;
  box-shadow: 0 8px 22px -8px rgba(11,11,12,.5), 0 2px 6px rgba(11,11,12,.2);
  transition: transform .2s var(--ease), opacity .15s var(--ease);
}
.fab .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.fab:active { transform: translateX(-50%) scale(.92); }
:root[data-theme="dark"] .fab { box-shadow: 0 8px 22px -8px rgba(0,0,0,.7); }

/* ============================================================================
   SHARED UI
   ========================================================================== */
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  font-family: var(--mono); font-weight: 500; font-size: 10px; color: #fff; flex: none; letter-spacing: 0;
  user-select: none; background: var(--av-RM);
}
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.lg { width: 34px; height: 34px; font-size: 12px; }
.av-AB { background: var(--av-AB); } .av-SK { background: var(--av-SK); }
.av-OM { background: var(--av-OM); } .av-RM { background: var(--av-RM); filter: saturate(.7); }
.av-LR { background: var(--av-LR); }
:root[data-theme="dark"] .avatar { filter: brightness(1.05); }
.stack { display: inline-flex; align-items: center; }
.stack .avatar, .stack .av-more { margin-left: -7px; box-shadow: 0 0 0 2px var(--surface); }
.stack .avatar:first-child { margin-left: 0; }
.av-more {
  background: var(--surface-2); color: var(--muted);
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 500; flex: none;
}

.pdot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.pdot.high { background: var(--red); } .pdot.normal { background: var(--amber); } .pdot.low { background: var(--faint); }

.chip {
  display: inline-block; font-size: 11px; font-weight: 500; color: var(--muted);
  padding: 2px 8px; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap; line-height: 1.5;
}
.chip.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

.due { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.due.over { color: var(--red); } .due.today { color: var(--amber); }

.prog { height: 4px; border-radius: 100px; background: var(--border); overflow: hidden; }
.prog > span { display: block; height: 100%; background: var(--accent); border-radius: 100px; transition: width .4s var(--ease); }

.eyebrow {
  display: flex; align-items: center; gap: 9px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 22px 2px 10px;
}
.eyebrow .count { font-family: var(--mono); color: var(--faint); font-weight: 500; }
.eyebrow.over { color: var(--red); }

/* status pill (kanban + lists) */
.pill {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0;
  padding: 2px 9px; border-radius: 100px; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--border); white-space: nowrap; cursor: default;
}
.pill.open { color: var(--muted); }
.pill.in_progress { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.pill.done { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); border-color: transparent; }
[data-status-cycle] { cursor: pointer; }

/* buttons + forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--radius-sm); min-height: 40px;
  font-weight: 500; font-size: 13.5px; border: 1px solid transparent; cursor: pointer;
  background: var(--ink); color: var(--bg);
  transition: transform .12s var(--ease), opacity .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn:hover { opacity: .92; }
.btn .icon { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--border-strong); opacity: 1; }
.btn.ghost { background: none; color: var(--accent-ink); border: none; min-height: 0; padding: 4px 6px; }
.btn.danger { background: none; color: var(--red); border-color: var(--border); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; min-height: 0; font-size: 12.5px; }

label { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { margin-bottom: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.search {
  display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; color: var(--faint); margin: 14px 0;
  transition: border-color .15s var(--ease);
}
.search:focus-within { border-color: var(--accent); }
.search .icon { width: 16px; height: 16px; }
.search input { border: none; background: none; padding: 0; }
.search input:focus { box-shadow: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px 2px; }
.page-head h1 { font-size: 23px; }
.empty {
  text-align: center; color: var(--muted); padding: 40px 18px;
  border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface);
}
.empty .icon { width: 26px; height: 26px; display: block; margin: 0 auto 10px; color: var(--faint); }
.error {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red); padding: 10px 13px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px;
}

/* ============================================================================
   HOME — triage agenda
   ========================================================================== */
.home-head { padding: 14px 2px 2px; }
.home-date { font-size: 23px; }
.home-summary { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 8px; }
.home-summary b { color: var(--ink); font-weight: 500; }
.home-grid { display: block; }
.home-rail { margin-top: 24px; }

.task-row {
  display: flex; align-items: center; gap: 12px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px; min-height: 56px;
  transition: border-color .15s var(--ease), transform .12s var(--ease);
}
.task-row:active { transform: scale(.99); border-color: var(--border-strong); }
.task-row + .task-row { margin-top: 8px; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.task-title .tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row.is-done .task-title .tx { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.task-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.task-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: none; }

.check {
  width: 22px; height: 22px; border-radius: 50%; padding: 0;
  border: 1.5px solid var(--border-strong); flex: none; background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .12s var(--ease);
}
.check:active { transform: scale(.9); }
.check .icon { width: 13px; height: 13px; color: #fff; opacity: 0; stroke-width: 3; transition: opacity .15s var(--ease); }
.check.done { background: var(--green); border-color: var(--green); }
.check.done .icon { opacity: 1; }

/* right rail (desktop) */
.rail { display: flex; flex-direction: column; gap: 14px; }
.rail h3 { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.feed { display: flex; gap: 11px; padding: 9px 0; }
.feed + .feed { border-top: 1px solid var(--border); }
.feed .ft { font-size: 12.5px; line-height: 1.45; }
.feed .fm { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 3px; }
.pin { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.pin + .pin { border-top: 1px solid var(--border); }
.pin .pin-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; font-size: 13px; }
.pin .prog { width: 60px; flex: none; }
.pin .pin-pct { font-family: var(--mono); font-size: 11px; color: var(--faint); width: 30px; text-align: right; }

/* ============================================================================
   PROJECTS — stacked list
   ========================================================================== */
.proj-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.proj-row { display: block; padding: 15px 16px; color: var(--ink); transition: background .15s var(--ease); }
.proj-row + .proj-row { border-top: 1px solid var(--border); }
.proj-row:hover { background: var(--surface-2); }
.proj-top { display: flex; align-items: center; gap: 10px; }
.proj-name { font-weight: 600; font-size: 14.5px; letter-spacing: -.02em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-updated { font-family: var(--mono); font-size: 11px; color: var(--faint); flex: none; }
.proj-prog { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.proj-prog .prog { flex: 1; }
.proj-prog .pct { font-family: var(--mono); font-size: 12px; color: var(--ink); width: 34px; text-align: right; flex: none; }
.proj-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 11px; }
.proj-tasks { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ============================================================================
   FILTER CHIPS (My Tasks)
   ========================================================================== */
.filter-chips, .segmented {
  display: flex; gap: 8px; margin: 14px -16px 6px; padding: 2px 16px 8px;
  overflow-x: auto; scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar, .segmented::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; border: 1px solid var(--border); background: var(--surface); font-family: inherit;
  font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 7px 14px; border-radius: 100px;
  cursor: pointer; transition: all .15s var(--ease); white-space: nowrap;
}
.fchip:active { transform: scale(.96); }
.fchip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tfilter-empty { margin-top: 12px; }

/* ============================================================================
   PROJECT VIEW — header + segmented control + panels
   ========================================================================== */
.pv-head { padding: 12px 2px 0; }
.pv-back { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 500; padding: 4px 0; }
.pv-back .icon { width: 16px; height: 16px; }
.pv-title { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.pv-title h1 { font-size: 22px; flex: 1; min-width: 0; }
.pv-meta { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.pv-progress { display: flex; align-items: center; gap: 10px; flex: 1; }
.pv-progress .prog { flex: 1; max-width: 200px; }
.pv-pct { font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--muted); }

/* segmented control reuses .tabs[data-tabs] hook for JS */
.segmented { border-bottom: 1px solid var(--border); margin-top: 14px; }
.segmented a {
  flex: none; border: 1px solid var(--border); background: var(--surface);
  font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 7px 14px; border-radius: 100px;
  transition: all .15s var(--ease);
}
.segmented a.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabpanel { padding-top: 18px; }

/* kanban (reuses .board/.column/.tcard/.pill JS hooks) */
.board {
  display: flex; gap: 14px; margin: 0 -16px; padding: 2px 16px 8px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.board::-webkit-scrollbar { display: none; }
.column {
  flex: none; width: 84%; scroll-snap-align: start; display: flex; flex-direction: column; gap: 9px;
  min-height: 64px; padding: 3px; border-radius: var(--radius);
}
.column.dragover { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 0; }
.col-head .cdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.col-head .cdot.open { background: var(--faint); } .col-head .cdot.in_progress { background: var(--accent); } .col-head .cdot.done { background: var(--green); }
.col-head .name { font-weight: 600; font-size: 13px; }
.col-head .count {
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--faint);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px; padding: 1px 7px;
}
.tcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 13px; cursor: grab;
  transition: border-color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease);
}
.tcard:hover { border-color: var(--border-strong); }
.tcard.dragging { opacity: .5; box-shadow: var(--shadow-pop); }
.tcard .ktop { display: flex; align-items: center; gap: 8px; }
.tcard .ktitle { font-weight: 500; font-size: 13.5px; flex: 1; min-width: 0; }
.tcard .kmeta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; min-height: 22px; }
.tcard .kmeta .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tcard[data-status="done"] .ktitle { text-decoration: line-through; text-decoration-color: var(--faint); color: var(--muted); }

/* list view */
.list-group + .list-group { margin-top: 18px; }
.lrow {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.lrow + .lrow { margin-top: 7px; }
.lrow .ltitle { flex: 1; min-width: 0; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* insights */
.insight-tiles { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 15px; }
.tile .tn { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
.tile .tn.red { color: var(--red); } .tile .tn.accent { color: var(--accent-ink); }
.tile .tl { font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.track-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 5px 11px; border-radius: 100px; }
.track-pill.ok { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.track-pill.risk { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 70px; margin-top: 6px; }
.spark .bar { flex: 1; background: var(--accent-soft); border-radius: 4px 4px 0 0; position: relative; min-height: 3px; }
.spark .bar > i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 4px 4px 0 0; display: block; }
.spark-labels { display: flex; gap: 6px; margin-top: 6px; }
.spark-labels span { flex: 1; text-align: center; font-family: var(--mono); font-size: 9.5px; color: var(--faint); }

/* milestone timeline */
.mtimeline { position: relative; margin-top: 6px; padding-left: 6px; }
.mstone { position: relative; display: flex; gap: 14px; padding: 10px 0; }
.mstone::before { content: ""; position: absolute; left: 6px; top: 26px; bottom: -10px; width: 1.5px; background: var(--border); }
.mstone:last-child::before { display: none; }
.mstone .mdot { width: 13px; height: 13px; border-radius: 50%; flex: none; margin-top: 4px; border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--border-strong); background: var(--surface); z-index: 1; }
.mstone.done .mdot { background: var(--green); box-shadow: 0 0 0 1.5px var(--green); }
.mstone.in_progress .mdot { background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.mstone .mbody { flex: 1; min-width: 0; }
.mstone .mtitle { font-weight: 600; font-size: 14px; }
.mstone .mmeta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.mstone .mdate { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.mstone.upcoming .mtitle, .mstone.upcoming .mdate { color: var(--muted); }
.mstone .mctl { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }

/* files / dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 26px 18px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.dropzone .icon { width: 24px; height: 24px; display: block; margin: 0 auto 8px; color: var(--faint); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.file-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: none; }
.file-row .fname { flex: 1; min-width: 0; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .fsize { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* team */
.member-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: none; }
.member-row .mname { flex: 1; font-weight: 500; }
.role-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }

/* activity / comments timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .tm { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 3px; }
.timeline .tt { font-size: 13px; line-height: 1.4; }
.comment { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment .cbody { font-size: 13.5px; }
.comment .cm { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 3px; }

/* ============================================================================
   MY WEEK — calendar / agenda
   ========================================================================== */
.week-nav { display: flex; align-items: center; gap: 10px; padding: 14px 2px 2px; }
.week-nav h1 { font-size: 22px; flex: 1; }
.week-nav .nav-arrow { width: 36px; height: 36px; }
.week-strip { display: flex; gap: 6px; margin: 14px 0 6px; }
.week-strip .wd {
  flex: 1; text-align: center; padding: 9px 2px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.week-strip .wd.today { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.week-strip .wd.past { opacity: .55; }
.week-strip .wd .dow { font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.week-strip .wd .dnum { font-family: var(--mono); font-size: 15px; font-weight: 500; margin-top: 2px; }
.week-strip .wd .dots { display: flex; gap: 2px; justify-content: center; margin-top: 5px; height: 5px; }
.week-strip .wd .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.week-strip .wd.today .dots i { background: var(--accent); }
.overdue-banner {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 11px 13px;
  border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, transparent); border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
}
.overdue-banner .icon { width: 16px; height: 16px; }
.day-group { margin-top: 8px; }
.day-group .dhead {
  display: flex; align-items: baseline; gap: 9px; margin: 18px 2px 9px;
  font-weight: 600; font-size: 13.5px;
}
.day-group .dhead.is-today { color: var(--accent-ink); }
.day-group .dhead .dd { font-family: var(--mono); font-size: 11px; color: var(--faint); font-weight: 500; }
.day-empty { font-size: 12.5px; color: var(--faint); padding: 4px 2px; }
.ms-marker {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; font-size: 13px; margin-bottom: 8px;
}
.ms-marker .icon { width: 15px; height: 15px; }

/* ============================================================================
   INBOX
   ========================================================================== */
.notif {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.notif + .notif { margin-top: 8px; }
.notif.unread { background: var(--accent-soft); border-color: transparent; }
.notif .nicon {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.notif .nicon .icon { width: 16px; height: 16px; }
.notif .nicon.due { color: var(--red); } .notif .nicon.mention { color: var(--accent-ink); } .notif .nicon.status { color: var(--green); }
.notif .nbody { flex: 1; min-width: 0; }
.notif .ntext { font-size: 13.5px; line-height: 1.4; }
.notif .ntext b { font-weight: 600; }
.notif .nmeta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 4px; }
.notif .ndot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 6px; }

/* ============================================================================
   QUICK-ADD SHEET
   ========================================================================== */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(11,11,12,.42);
  backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 520px; background: var(--surface);
  border-radius: 18px 18px 0 0; border: 1px solid var(--border); border-bottom: none;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .26s var(--ease); box-shadow: var(--shadow-pop);
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet .grab { width: 38px; height: 4px; border-radius: 100px; background: var(--border-strong); margin: 6px auto 14px; }
.sheet h2 { font-size: 17px; margin-bottom: 14px; }
.sheet .qtitle { font-size: 16px; font-weight: 500; padding: 12px 13px; }
.sheet .qrow { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.sheet .qrow > label { flex: 1; min-width: 120px; margin: 0; }
.sheet .qactions { display: flex; gap: 10px; margin-top: 18px; }

/* ============================================================================
   TOASTS
   ========================================================================== */
.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 80;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; width: min(92vw, 380px);
}
.toast {
  background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: var(--radius);
  box-shadow: var(--shadow-pop); font-size: 13px; animation: toast-in .25s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager .disabled { opacity: .4; pointer-events: none; }

/* ============================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.stagger > * { opacity: 0; animation: fadeUp .5s var(--ease) forwards; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .09s; }
.stagger > *:nth-child(3) { animation-delay: .14s; }
.stagger > *:nth-child(4) { animation-delay: .19s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }
.stagger > *:nth-child(6) { animation-delay: .29s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stagger > * { opacity: 1 !important; }
}

/* ============================================================================
   RESPONSIVE — grows from mobile base into desktop sidebar shell
   ========================================================================== */
@media (min-width: 760px) {
  .insight-tiles { grid-template-columns: repeat(4,1fr); }
}

@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .tabbar, .fab, .topbar, .topmenu, .pv-back { display: none !important; }

  .sidebar {
    display: flex; flex-direction: column; flex: none;
    width: var(--sidebar-w); min-height: 100vh; position: sticky; top: 0;
    border-right: 1px solid var(--border); background: var(--surface); padding: 18px 14px;
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font-weight: 600; font-size: 15px; }
  .sidebar .brand .glyph { width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
  .sidebar .brand .glyph .icon { width: 16px; height: 16px; stroke-width: 2; }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav a {
    display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 500; font-size: 13.5px; transition: all .15s var(--ease);
  }
  .nav a .icon { width: 17px; height: 17px; }
  .nav a:hover { background: var(--surface-2); color: var(--ink); }
  .nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
  .nav a .nav-badge {
    margin-left: auto; background: var(--red); color: #fff; font-family: var(--mono); font-size: 9.5px; font-weight: 600;
    min-width: 16px; height: 16px; border-radius: 999px; padding: 0 4px; display: grid; place-items: center;
  }
  .nav-label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 22px 9px 9px; }
  .sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
  .duser { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .duser .um { flex: 1; min-width: 0; }
  .duser .un { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .duser .us { font-size: 11px; color: var(--faint); }
  .sidebar-tools { display: flex; gap: 8px; }
  .sidebar-tools .icon-btn { flex: 1; }

  .container { max-width: 1080px; padding: 30px 34px 60px; }

  /* Home two-column with rail */
  .home-grid { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 34px; align-items: start; }
  .home-rail { position: sticky; top: 30px; margin-top: 0; }
  .home-head { padding-top: 0; }

  /* full-bleed mobile rows realign to the padded desktop container */
  .filter-chips, .segmented { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .toast-stack { bottom: 1rem; }

  /* board becomes a 3-up grid; columns no longer snap-scroll */
  .board { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin: 0; padding: 0; overflow: visible; align-items: start; }
  .column { width: auto; min-height: 100px; background: var(--surface-2); border: 1px solid var(--border); padding: 12px; }

  /* week strip / agenda comfortable */
  .week-strip .wd .dnum { font-size: 17px; }
}

@media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
  .tcard { cursor: grab; }
}
