/* TrueTask: "runs true" design system — neumorphic (soft UI). Indigo primary, ember orange
   secondary, near-black neutral chrome. Surfaces sit flush with the page and read as raised or
   pressed through a paired soft-light / soft-shadow duo instead of borders. */
:root {
  --ink: #1C1A27;
  --ink-2: #3E3C47;
  --ink-3: #605F68;
  --paper: #E7ECF2;
  --panel: #E7ECF2;
  --line: #CBD5E1;
  --line-soft: #DDE4EC;
  --text: #1C1A27;
  --muted: #5E6B7D;
  --level: #FB8D1A;
  --level-deep: #D57816;
  --blue: #573CFA;
  --violet: #7963FB;
  --green: #02864A;
  --red: #E8083E;
  --amber: #E27F17;
  --slate: #8A97A8;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --shadow-float: 0 20px 50px rgba(27, 42, 65, .22), 0 4px 14px rgba(27, 42, 65, .10);
  --side-w: 248px;
  /* neumorphic shadow duo: a cool shadow + a soft highlight, both relative to --panel */
  --neu-d: rgba(163, 177, 198, .5);
  --neu-l: rgba(255, 255, 255, .85);
  --neu-out: 8px 8px 16px var(--neu-d), -8px -8px 16px var(--neu-l);
  --neu-out-sm: 5px 5px 10px var(--neu-d), -5px -5px 10px var(--neu-l);
  --neu-in: inset 4px 4px 8px var(--neu-d), inset -4px -4px 8px var(--neu-l);
  --neu-in-lg: inset 7px 7px 14px var(--neu-d), inset -7px -7px 14px var(--neu-l);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161C27; --panel: #161C27; --line: #2B3647; --line-soft: #212A38;
    --text: #E7ECF3; --muted: #94A2B8;
    --shadow-float: 0 20px 50px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .3);
    --neu-d: rgba(0, 0, 0, .55); --neu-l: rgba(79, 96, 122, .45);
  }
}
:root[data-theme="dark"] {
  --paper: #161C27; --panel: #161C27; --line: #2B3647; --line-soft: #212A38;
  --text: #E7ECF3; --muted: #94A2B8;
  --shadow-float: 0 20px 50px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .3);
  --neu-d: rgba(0, 0, 0, .55); --neu-l: rgba(79, 96, 122, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--paper); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 .7em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--level); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-md);
  border: none; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: var(--neu-out-sm);
  transition: background-color .15s, box-shadow .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); box-shadow: var(--neu-in); }
.btn:hover { background: var(--ink-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--panel); color: var(--text); }
.btn.ghost:hover { background: var(--panel); box-shadow: var(--neu-out); }
.btn.level { background: var(--level); color: var(--ink); }
.btn.level:hover { background: #FFA94D; }
.btn.danger { background: var(--red); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-md);
  border: 0; background: transparent; cursor: pointer; color: var(--muted); transition: box-shadow .15s, color .15s;
}
.icon-btn:hover { background: var(--panel); box-shadow: var(--neu-out-sm); color: var(--text); }
.icon-btn:active { box-shadow: var(--neu-in); }
.icon-btn svg { width: 18px; height: 18px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); cursor: pointer; font-weight: 700; }
.link-btn.danger { color: var(--red); }

label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px; border: none; border-radius: var(--r-md);
  background: var(--panel); box-shadow: var(--neu-in); transition: box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; box-shadow: var(--neu-in), 0 0 0 3px rgba(251, 141, 26, .55); }
.input.bare { box-shadow: none; background: transparent; }
.input.bare:hover { background: var(--line-soft); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--ink); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--panel); box-shadow: var(--neu-in); cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 1px 1px 3px rgba(27, 42, 65, .35); transition: .2s; }
.switch input:checked + span { background: var(--green); box-shadow: inset 2px 2px 5px rgba(0, 0, 0, .25); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--level); outline-offset: 2px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-todo { color: #56657A; background: #E9EDF2; }
.st-in_progress { color: #2259BE; background: #E3ECFC; }
.st-review { color: #6D3FD8; background: #EEE7FE; }
.st-done { color: #237A52; background: #E1F3EA; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; }
.prio::before { content: ""; width: 12px; height: 3px; border-radius: 2px; background: currentColor; box-shadow: 0 -4px 0 0 currentColor, 0 4px 0 0 currentColor; }
.p-low { color: var(--slate); }
.p-low::before { box-shadow: none; }
.p-medium { color: var(--blue); }
.p-medium::before { box-shadow: 0 -4px 0 0 currentColor; }
.p-high { color: var(--amber); }
.p-urgent { color: var(--red); }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.health::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.h-on_track { color: var(--green); }
.h-at_risk { color: var(--amber); }
.h-off_track { color: var(--red); }
.h-achieved { color: var(--violet); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--line-soft); font-size: 12.5px; color: var(--muted); }
.tag.ai { background: #FFE7C2; color: #7A4100; font-weight: 700; }
.late { color: var(--red); font-weight: 700; }
.mention { background: #FFE3C2; border-radius: 3px; padding: 0 2px; font-weight: 700; color: var(--ink); }

/* ---------- avatars ---------- */
.av { border-radius: 50%; flex: none; background: var(--line-soft); vertical-align: middle; object-fit: cover; }
.av.av-none { display: inline-block; border: 1.5px dashed var(--slate); background: transparent; }
.av-stack { display: flex; }
.av-stack .av { box-shadow: 0 0 0 2px var(--panel); }
.av-stack .av + .av { margin-left: -8px; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- signature: the level vial ---------- */
.vial {
  position: relative; height: 16px; min-width: 90px; border-radius: 99px; overflow: hidden;
  background: var(--panel); box-shadow: var(--neu-in);
}
.vial::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 15px); width: 30px; z-index: 2; pointer-events: none;
  border-left: 1.5px solid rgba(27, 42, 65, .4); border-right: 1.5px solid rgba(27, 42, 65, .4);
}
.vial-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p); background: linear-gradient(#FDB15C, #FB8D1A); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.vial-bubble {
  position: absolute; top: 2px; bottom: 2px; width: 24px; border-radius: 99px; z-index: 1;
  left: clamp(2px, calc(var(--p) - 12px), calc(100% - 26px));
  background: radial-gradient(ellipse at 38% 30%, #fff 0 30%, rgba(255, 255, 255, .75) 55%, rgba(255, 255, 255, .35));
  box-shadow: 0 0 0 1px rgba(27, 42, 65, .2), inset 0 -1px 2px rgba(27, 42, 65, .15);
  transition: left .6s cubic-bezier(.2, .8, .2, 1);
}
.vial.lg { height: 22px; }
.vial.lg .vial-bubble { width: 34px; left: clamp(2px, calc(var(--p) - 17px), calc(100% - 36px)); }
.vial-wrap { display: flex; align-items: center; gap: 10px; }
.vial-wrap .vial { flex: 1; }
.vial-wrap b { font-family: var(--font-display); font-size: 14px; min-width: 38px; text-align: right; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--ink); color: #C9D3E0; padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-family: var(--font-display); font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.nav a, .side-projects a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-md);
  color: #C9D3E0; font-weight: 700; font-size: 14.5px; transition: box-shadow .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover, .side-projects a:hover { color: #fff; text-decoration: none; box-shadow: 4px 4px 10px rgba(8, 13, 22, .5), -4px -4px 10px rgba(54, 70, 96, .35); }
.nav a.active, .side-projects a.active { color: #fff; box-shadow: inset 3px 3px 7px rgba(8, 13, 22, .55), inset -3px -3px 7px rgba(54, 70, 96, .3); }
.nav a.active::before, .side-projects a.active::before {
  content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--level);
}
.nav .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--level); color: var(--ink); font-size: 12px; display: grid; place-items: center; }
.nav-group-label { padding: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6B7A93; }
.nav-group-label:first-child { padding-top: 2px; }
.side-h { display: flex; align-items: center; justify-content: space-between; margin: 20px 10px 6px; font-size: 13px; color: #8FA0B8; font-weight: 700; }
.side-h a { color: #8FA0B8; font-size: 18px; line-height: 1; padding: 0 4px; }
.side-projects a { font-weight: 400; font-size: 14px; padding: 6px 10px; }
.side-projects .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.side-projects a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-card { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md); color: #fff; transition: box-shadow .15s; }
.me-card:hover { text-decoration: none; box-shadow: 4px 4px 10px rgba(8, 13, 22, .5), -4px -4px 10px rgba(54, 70, 96, .35); }
.me-card small { display: block; color: #8FA0B8; font-size: 12.5px; }
.me-card .vial { height: 9px; min-width: 0; margin-top: 4px; background: #2C3E5A; box-shadow: inset 2px 2px 4px rgba(8, 13, 22, .5); }
.me-card .vial::after { display: none; }
.me-card .vial-bubble { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 24px;
  background: rgba(231, 236, 242, .92); backdrop-filter: blur(8px); box-shadow: 0 4px 10px -6px rgba(27, 42, 65, .18);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search svg { position: absolute; left: 11px; top: 10px; width: 17px; height: 17px; color: var(--muted); }
.search .input { padding-left: 36px; background: var(--panel); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-float); padding: 6px; max-height: 420px; overflow: auto; z-index: 40; }
.search-results h4 { font-size: 12.5px; color: var(--muted); padding: 8px 10px 4px; font-family: var(--font-body); }
.search-results a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--r-md); color: var(--text); }
.search-results a:hover, .search-results a:focus { background: var(--paper); text-decoration: none; }
.timer-pill { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; max-width: 320px; }
.timer-pill .tick { width: 8px; height: 8px; border-radius: 50%; background: var(--level); animation: pulse 1.6s infinite; }
.timer-pill span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-pill button { border: 0; border-radius: 99px; background: rgba(255, 255, 255, .15); color: #fff; height: 24px; padding: 0 10px; cursor: pointer; font-weight: 700; font-size: 12px; }
@keyframes pulse { 50% { opacity: .35; } }

.view { padding: 26px 28px 60px; min-width: 0; }
.view:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.panel { background: var(--panel); border: none; border-radius: var(--r-lg); box-shadow: var(--neu-out); transition: box-shadow .15s, transform .15s; }
.panel.pad { padding: 18px 20px; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-h h2, .panel-h h3 { flex: 1; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.loading { padding: 40px; color: var(--muted); }
.error-box { padding: 18px; border-radius: var(--r-lg); background: #FDE3E9; color: #8E1030; border: 1px solid #F5B8C8; }

/* ---------- KPI strip (boss + home) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 14px 18px; background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--neu-out-sm); }
.kpi b { display: block; font-family: var(--font-display); font-size: 28px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.alert b { color: var(--red); }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .home-grid { grid-template-columns: 1fr; } }
.task-line { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line-soft); cursor: pointer; }
.task-line:hover { background: #F7F9FB; }
.task-line .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-line .proj { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.group-label { padding: 12px 18px 6px; font-weight: 700; font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; }
.group-label.alert { color: var(--red); }
.points-card { padding: 20px; }
.points-card .big { font-family: var(--font-display); font-size: 46px; font-weight: 750; line-height: 1; letter-spacing: -.03em; }
.feed-item { display: flex; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.feed-item time { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- projects ---------- */
.proj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.proj-card { display: block; padding: 18px; color: var(--text); border-top: 4px solid var(--c); background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--neu-out-sm); transition: transform .15s, box-shadow .15s; }
.proj-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--neu-out); }
.proj-card h3 { font-size: 18px; margin-bottom: 4px; }
.proj-card p { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.proj-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); }

.proj-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.proj-head .mark { width: 14px; height: 40px; border-radius: 4px; background: var(--c); flex: none; margin-top: 2px; }
.proj-head .info { flex: 1; min-width: 240px; }
.proj-head .facts { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.proj-head .facts b { color: var(--text); }
.proj-progress { width: 260px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 700; font-size: 14px; border-radius: var(--r-md); white-space: nowrap; transition: box-shadow .15s, color .15s; }
.tabs a:hover { color: var(--text); text-decoration: none; box-shadow: var(--neu-out-sm); }
.tabs a.active { color: var(--text); box-shadow: var(--neu-in); }
.tabs .sep { width: 1px; background: var(--line); margin: 8px 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; height: 34px; }
.toolbar .search-mini { width: 220px; }

/* list view */
.tgroup { margin-bottom: 18px; }
.tgroup-h { display: flex; align-items: center; gap: 9px; padding: 6px 4px; font-size: 15px; }
.tgroup-h .count { color: var(--muted); font-weight: 400; font-family: var(--font-body); font-size: 13px; }
.tlist-table { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--neu-out-sm); overflow-x: auto; }
.trow { display: grid; grid-template-columns: minmax(300px, 1fr) 48px 96px 92px repeat(var(--cf, 0), 130px); align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-top: 1px solid var(--line-soft); cursor: pointer; min-width: fit-content; }
.trow:first-child { border-top: 0; }
.trow:hover { background: #F7F9FB; }
.trow.thead { cursor: default; min-height: 34px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: #FAFBFC; }
.trow .t-title { display: flex; align-items: center; gap: 8px; align-self: stretch; padding-left: calc(var(--depth, 0) * 22px); min-width: 0; }
/* one faint guide line per nesting level, lined up under the parent's chevron */
.trow .t-title, .sub-row { background: repeating-linear-gradient(to right, transparent 0 9px, var(--line) 9px 10px, transparent 10px 22px) no-repeat; background-size: calc(var(--depth, 0) * 22px) 100%; }
.trow .t-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow.is-done .name { color: var(--muted); text-decoration: line-through; }
.trow .cf { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-pill { font-size: 12px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.blocked-ico { color: var(--amber); font-size: 13px; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--slate); background: var(--panel); cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 12px; padding: 0; }
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); }
.check:disabled { cursor: not-allowed; opacity: .45; }
.check:disabled:hover { border-color: var(--slate); }
select.input:disabled { cursor: not-allowed; opacity: .6; }
.quick-add { display: flex; padding: 6px 14px; border-top: 1px solid var(--line-soft); }
.quick-add .input { box-shadow: none; background: transparent; height: 34px; }
.quick-add .input:focus { background: var(--panel); box-shadow: var(--neu-in); }

/* board view */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--panel); box-shadow: var(--neu-in-lg); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 260px); }
.col > header { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-family: var(--font-display); font-weight: 650; }
.col > header .count { color: var(--muted); font-family: var(--font-body); font-weight: 400; font-size: 13px; }
.col-body { flex: 1; overflow-y: auto; min-height: 60px; display: flex; flex-direction: column; gap: 8px; padding: 2px; border-radius: var(--r-md); }
.col-body.drag-over { background: rgba(251, 141, 26, .18); outline: 2px dashed var(--level-deep); }
.card { background: var(--panel); border: none; border-radius: var(--r-md); padding: 11px 12px; cursor: grab; box-shadow: var(--neu-out-sm); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--neu-out); }
.card.sub { margin-left: 16px; width: calc(100% - 16px); }
.sub-of { font-size: 11.5px; color: var(--muted); font-weight: 700; margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.dragging { opacity: .6; box-shadow: var(--neu-in); }
.card h4 { font-family: var(--font-body); font-size: 14.5px; font-weight: 700; margin: 6px 0 9px; line-height: 1.35; }
.card .card-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.card .card-meta .av { margin-left: auto; }
.drop-ghost { height: 48px; border-radius: var(--r-md); border: 2px dashed var(--level-deep); background: rgba(251, 141, 26, .12); }
.add-card { margin-top: 8px; border: 0; background: transparent; text-align: left; padding: 8px; border-radius: var(--r-md); color: var(--muted); font-weight: 700; cursor: pointer; transition: box-shadow .15s; }
.add-card:hover { box-shadow: var(--neu-out-sm); color: var(--ink); }

/* calendar view */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-head h3 { min-width: 170px; font-size: 19px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--neu-out-sm); }
.cal .dow { background: #FAFBFC; padding: 7px 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cal .day { background: var(--panel); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; cursor: cell; }
.cal .day.other { background: #F6F8FA; }
.cal .day.other .num { color: #A9B4C2; }
.cal .day.weekend { background: #FBFCFD; }
.cal .day.today .num { background: var(--ink); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal .day.drag-over { background: #FFEACC; }
.cal .num { align-self: flex-start; font-size: 13px; font-weight: 700; }
.cal-chip { display: block; font-size: 12.5px; padding: 3px 7px; border-radius: 4px; background: var(--line-soft); border-left: 3px solid var(--slate); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; }
.cal-chip.st-in_progress { border-left-color: var(--blue); }
.cal-chip.st-review { border-left-color: var(--violet); }
.cal-chip.st-done { border-left-color: var(--green); text-decoration: line-through; color: var(--muted); }
.cal-chip.overdue { background: #FDE3E9; }
.cal .more { font-size: 12px; color: var(--muted); padding-left: 4px; }

/* timeline / gantt */
.gantt { display: grid; grid-template-columns: 280px minmax(0, 1fr); background: var(--panel); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--neu-out-sm); }
.g-left { border-right: 1px solid var(--line); }
.g-left .g-row { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-top: 1px solid var(--line-soft); cursor: pointer; font-size: 14px; }
.g-left .g-row:hover { background: #F7F9FB; }
.g-left .g-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-left .g-row { padding-left: calc(8px + var(--depth, 0) * 16px); }
.g-left .g-row.sub { color: var(--muted); font-size: 13.5px; }
.g-left .g-row.undated span { font-style: italic; }
.g-left .g-headpad { height: 56px; display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: #FAFBFC; }
.g-scroll { overflow-x: auto; position: relative; }
.g-canvas { position: relative; }
.g-months, .g-days { display: flex; height: 28px; background: #FAFBFC; }
.g-months div { flex: none; font-size: 12.5px; font-weight: 700; padding: 6px 8px; border-left: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; }
.g-days div { flex: none; text-align: center; font-size: 11px; color: var(--muted); line-height: 28px; border-left: 1px solid var(--line-soft); }
.g-days div.we { background: #F1F4F7; }
.g-body { position: relative; }
.g-body .g-row { height: 38px; border-top: 1px solid var(--line-soft); position: relative; }
.g-grid-we { position: absolute; top: 0; bottom: 0; background: rgba(214, 222, 230, .25); pointer-events: none; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--level-deep); z-index: 3; pointer-events: none; }
.g-today::before { content: "Today"; position: absolute; top: -1px; left: 4px; font-size: 11px; font-weight: 700; color: #7A4100; background: #FFE3C2; padding: 0 5px; border-radius: 3px; }
.bar { position: absolute; top: 7px; height: 24px; border-radius: 6px; background: var(--slate); color: #fff; font-size: 12px; font-weight: 700; padding: 0 8px; line-height: 24px; white-space: nowrap; overflow: hidden; cursor: grab; z-index: 2; touch-action: none; user-select: none; }
.bar.st-in_progress { background: var(--blue); }
.bar.st-review { background: var(--violet); }
.bar.st-done { background: var(--green); opacity: .75; }
.bar.overdue { box-shadow: 0 0 0 2px var(--red); }
.bar.sub { top: 11px; height: 16px; line-height: 16px; font-size: 11px; opacity: .85; }
.bar .grip { position: absolute; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize; background: rgba(255, 255, 255, .25); }
.bar.dragging { opacity: .8; cursor: grabbing; box-shadow: 0 4px 14px rgba(27, 42, 65, .3); }
.g-links { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: visible; }
.g-links path { fill: none; stroke: #7C8BA0; stroke-width: 1.5; }
.unscheduled { margin-top: 14px; }

/* ---------- drawer (task detail) ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(27, 42, 65, .25); display: flex; justify-content: flex-end; }
.drawer { width: min(680px, 100%); height: 100%; background: var(--panel); box-shadow: var(--shadow-float); display: flex; flex-direction: column; animation: slideIn .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 24px 40px; }
.drawer .title-input { width: 100%; border: none; border-radius: var(--r-md); padding: 4px 6px; margin-left: -7px; font-family: var(--font-display); font-size: 24px; font-weight: 700; background: transparent; transition: box-shadow .15s; }
.drawer .title-input:hover { box-shadow: var(--neu-in); }
.drawer .title-input:focus { outline: none; box-shadow: var(--neu-in); }
.props { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; align-items: center; margin: 16px 0 20px; }
.props > dt { color: var(--muted); font-size: 13.5px; font-weight: 700; }
.props > dd { margin: 0; }
.props .input { height: 34px; }
.section { margin-top: 24px; }
.section > h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section > h3 .spacer { flex: 1; }
.sub-row { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 5px 0 5px calc(var(--depth, 0) * 22px); border-bottom: 1px solid var(--line-soft); }
.sub-row .t { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-row .t:hover { color: var(--blue); }
.sub-row .due { min-width: 52px; text-align: right; }
.sub-row .row-act { margin-left: 0; }
.sub-inline .input, .trow.sub-add .input { height: 32px; }
.sub-row.done .t { text-decoration: line-through; color: var(--muted); }
.dep-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }

/* ---------- nested subtasks ---------- */
.twisty { flex: none; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s; }
.twisty svg { width: 14px; height: 14px; stroke-width: 2.4; transition: transform .15s; }
.twisty.open svg { transform: rotate(90deg); }
.twisty:hover { background: var(--line-soft); color: var(--text); }
.twisty-pad { flex: none; width: 20px; }
.row-act { flex: none; margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .12s, box-shadow .15s, color .15s; }
.row-act svg { width: 15px; height: 15px; }
.trow:hover .row-act, .sub-row:hover .row-act, .row-act:focus-visible { opacity: 1; }
.row-act:hover { color: var(--text); box-shadow: var(--neu-out-sm); }
@media (hover: none) { .row-act { opacity: .75; } }
.in-parent { flex: 0 1 auto; min-width: 0; max-width: 220px; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.in-parent svg, .sub-of svg { width: 13px; height: 13px; flex: none; }
.sub-of svg { vertical-align: -2px; margin-right: 4px; }
.lvl { display: inline-block; padding: 0 6px; margin-right: 5px; border-radius: 99px; background: var(--line-soft); color: var(--muted); font-size: 10.5px; font-weight: 700; line-height: 17px; flex: none; }
.trow.sub-add { cursor: default; }
.trow.sub-add .t-title { grid-column: 1 / -1; }
.sub-add-ico { flex: none; width: 20px; display: grid; place-items: center; color: var(--level-deep); }
.sub-add-ico svg { width: 16px; height: 16px; }
.list-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.list-tools .muted { margin-left: 4px; }

.drawer-top .crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.crumbs .crumb { flex: 0 1 auto; min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.crumb-sep { flex: none; color: var(--muted); }
.task-eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.task-eyebrow .btn { margin-left: auto; letter-spacing: 0; text-transform: none; }
.lvl-dots { display: inline-flex; align-items: center; gap: 3px; }
.lvl-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.lvl-dots i.on { background: var(--level); }
.sub-progress { height: 6px; margin: -2px 0 8px; border-radius: 99px; background: var(--panel); box-shadow: var(--neu-in); overflow: hidden; }
.sub-progress i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .4s; }
.nest-limit { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); box-shadow: var(--neu-in); color: var(--muted); font-size: 14px; }
.nest-limit svg { width: 20px; height: 20px; flex: none; color: var(--level-deep); }

.move-list { margin-top: 10px; max-height: min(52vh, 420px); overflow-y: auto; padding: 4px; border-radius: var(--r-md); box-shadow: var(--neu-in); }
.move-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px 8px calc(10px + var(--depth, 0) * 20px); border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; font-size: 14px; cursor: pointer; }
.move-opt .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-opt .why { flex: none; font-size: 12px; color: var(--muted); }
.move-opt .lvl { margin-right: 0; }
.move-opt:hover:not(:disabled) { background: var(--line-soft); }
.move-opt:disabled { cursor: not-allowed; opacity: .5; }
.move-opt.on, .move-opt.on:hover { background: var(--blue); color: #fff; }
.move-opt.on .lvl { background: rgba(255, 255, 255, .22); color: #fff; }
.move-opt.root { font-weight: 700; margin-bottom: 4px; }
.move-opt.root svg { width: 16px; height: 16px; flex: none; }
.move-hint { margin: 10px 0 0; min-height: 1.5em; }
.ai-box { border: 1px solid #F3C78A; background: #FFF3E6; border-radius: var(--r-lg); padding: 14px 16px; }
.ai-box .src { font-size: 12px; color: #7A4100; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .bubble { flex: 1; min-width: 0; }
.comment .who { font-size: 13.5px; }
.comment .who time { color: var(--muted); margin-left: 6px; font-size: 12.5px; }
.comment .body { margin-top: 3px; overflow-wrap: anywhere; }
.comment .body p:last-child { margin-bottom: 0; }
.comment.system .body { color: var(--muted); font-size: 14px; }
.bot-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--level); flex: none; }
.bot-av svg { width: 16px; height: 16px; }
.composer { position: relative; margin-top: 10px; }
.mention-pop { position: absolute; bottom: calc(100% + 4px); left: 0; width: 260px; background: var(--panel); border-radius: var(--r-md); box-shadow: var(--shadow-float); padding: 4px; z-index: 5; }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.mention-pop button:hover, .mention-pop button.on { background: var(--paper); }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(27, 42, 65, .35); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { width: min(520px, 100%); background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-float); animation: pop .18s ease-out; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(860px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal > header { display: flex; align-items: center; padding: 16px 20px 10px; }
.modal > header h2 { flex: 1; }
.modal-body { padding: 6px 20px 20px; overflow-y: auto; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-md); font-weight: 700; box-shadow: var(--shadow-float); animation: pop .2s; }
.toast.err { background: var(--red); }
.toast.points { background: var(--level); color: var(--ink); }

/* ---------- resources ---------- */
.dropzone { display: block; border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: var(--panel); box-shadow: var(--neu-in-lg); }
.dropzone:hover, .dropzone.drag-over { border-color: var(--level-deep); background: #FFF3E6; }
.res-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line-soft); }
.res-row .ico { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--panel); box-shadow: var(--neu-out-sm); color: var(--ink-3); flex: none; font-size: 12px; font-weight: 700; }
.res-row .ico svg { width: 18px; height: 18px; }
.res-row .grow { flex: 1; min-width: 0; }
.res-row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-editor textarea { min-height: 380px; font-size: 14.5px; }
.md-preview { border-radius: var(--r-md); padding: 14px 18px; min-height: 380px; overflow-y: auto; background: var(--panel); box-shadow: var(--neu-in); }
.md h3, .md h4, .md h5 { margin: 1em 0 .4em; }
.md ul, .md ol { margin: .3em 0 .8em; padding-left: 1.3em; }
.md li { margin: .15em 0; }
.md code { background: var(--line-soft); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.md > :first-child { margin-top: 0; }

/* ---------- automation / forms ---------- */
.bundle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.bundle { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.bundle p { color: var(--muted); font-size: 13.5px; margin: 0; flex: 1; }
.rule { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.rule .sentence { flex: 1; }
.rule .sentence b { font-weight: 700; }
.rule .sentence .then { color: var(--muted); margin-top: 3px; font-size: 14px; }
.builder-row { display: grid; grid-template-columns: 1fr 1fr 1fr 34px; gap: 8px; margin-bottom: 8px; }
.builder-row.act { grid-template-columns: 1fr 1.2fr 34px; }
.builder-row.fld { grid-template-columns: 1.6fr 1fr 1.2fr 1.2fr 70px 34px; align-items: center; }
@media (max-width: 760px) { .builder-row, .builder-row.act, .builder-row.fld { grid-template-columns: 1fr; } }

/* ---------- AI chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 290px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); box-shadow: var(--neu-out-sm); border-bottom-left-radius: 4px; }
.msg.assistant .md p:last-child { margin-bottom: 0; }
.chat-form { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line-soft); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.suggestions button { border: none; background: var(--panel); box-shadow: var(--neu-out-sm); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; transition: box-shadow .15s; }
.suggestions button:hover { box-shadow: var(--neu-out); }
.sugg-tasks { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.sugg-tasks label { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-size: 14px; }

/* ---------- workload ---------- */
.wl { background: var(--panel); border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--neu-out-sm); }
.wl-row { display: grid; grid-template-columns: 240px repeat(var(--w), minmax(110px, 1fr)); border-top: 1px solid var(--line-soft); min-width: fit-content; }
.wl-row.head { border-top: 0; background: #FAFBFC; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.wl-row.head > div { padding: 9px 12px; }
.wl-who { padding: 12px; display: flex; gap: 10px; align-items: center; border-right: 1px solid var(--line-soft); }
.wl-who small { display: block; color: var(--muted); font-size: 12.5px; }
.wl-cell { padding: 10px 12px; border-right: 1px solid var(--line-soft); font-size: 13px; }
.wl-cell .meter { height: 8px; border-radius: 99px; background: var(--panel); box-shadow: var(--neu-in); overflow: hidden; margin: 6px 0 4px; }
.wl-cell .meter i { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.wl-cell.warn .meter i { background: var(--amber); }
.wl-cell.over .meter i { background: var(--red); }
.wl-cell.over b { color: var(--red); }
.wl-lane { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px 62px; min-height: 30px; }
.wl-lane.drag-over { background: #FFF3E6; outline: 2px dashed var(--level-deep); outline-offset: -4px; }
.wl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: none; background: var(--panel); box-shadow: var(--neu-out-sm); font-size: 12.5px; cursor: grab; max-width: 280px; }
.wl-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-chip i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.wl-chip.overdue { background: #FDE9EE; }
.wl-chip.dragging { opacity: .45; }
.burn { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--red); font-weight: 700; }

/* ---------- goals & portfolios ---------- */
.goal { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; padding: 16px 20px; border-top: 1px solid var(--line-soft); }
.goal:first-child { border-top: 0; }
.goal h3 { font-size: 17px; }
.goal .linked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.goal.child { padding-left: 48px; background: #FBFCFD; }
@media (max-width: 760px) { .goal { grid-template-columns: 1fr; } }
.pchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--panel); box-shadow: var(--neu-out-sm); font-size: 12.5px; color: var(--text); }
.pchip i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 10px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ptable td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tr.click { cursor: pointer; }
.ptable tr.click:hover td { background: #F7F9FB; }
.table-wrap { overflow-x: auto; }

/* ---------- dashboards & charts ---------- */
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.widget.wide { grid-column: span 2; }
@media (max-width: 800px) { .widget.wide { grid-column: auto; } }
.widget .panel-h h3 { font-size: 15px; }
.widget-body { padding: 14px 16px 16px; min-height: 240px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font-body); fill: var(--muted); font-size: 12px; }
.chart .val { fill: var(--ink); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap svg { width: 170px; flex: none; }

/* ---------- people ---------- */
.lb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 160px 90px 110px; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-soft); }
.lb-row .rank { font-family: var(--font-display); font-size: 20px; font-weight: 750; color: var(--muted); text-align: center; }
.lb-row.top .rank { color: var(--text); }
.lb-row .score { font-family: var(--font-display); font-size: 20px; font-weight: 700; text-align: right; }
@media (max-width: 760px) { .lb-row { grid-template-columns: 34px 1fr 70px; } .lb-row .hide-sm { display: none; } }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.podium .panel { padding: 18px; text-align: center; }
.podium .panel.first { box-shadow: var(--neu-out), 0 0 0 2px var(--level-deep); }
.podium .score { font-family: var(--font-display); font-size: 30px; font-weight: 750; }
.profile-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.profile-head .av { width: 120px; height: 120px; box-shadow: 0 0 0 6px var(--panel), var(--neu-out); }
.skills { display: flex; flex-wrap: wrap; gap: 6px; }
.archetypes { display: flex; flex-wrap: wrap; gap: 6px; }
.archetypes button { border: none; background: var(--panel); box-shadow: var(--neu-out-sm); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; font-weight: 700; transition: box-shadow .15s; }
.archetypes button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: var(--neu-in); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: var(--neu-out-sm); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: var(--neu-in), 0 0 0 2px var(--ink); }
.avatar-builder { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: start; }
.ab-stage { display: grid; gap: 10px; justify-items: center; }
.ab-frame { position: relative; width: 180px; height: 180px; }
.avatar-builder .preview { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; background: var(--panel); box-shadow: var(--neu-out); }
.ab-loading { position: absolute; inset: 0; border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: 8px;
  background: rgba(28, 26, 39, .55); color: #fff; font-weight: 700; font-size: 13.5px; backdrop-filter: blur(2px); }
.ab-loading[hidden] { display: none; }
.ab-loading span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: var(--level); animation: ab-spin .8s linear infinite; }
@keyframes ab-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ab-loading span { animation-duration: 2.4s; } }
.ab-history { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 180px; }
.ab-history[hidden] { display: none; }
.ab-history button { padding: 0; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: var(--neu-out-sm); cursor: pointer; overflow: hidden; background: var(--panel); }
.ab-history button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.ab-history img { width: 100%; height: 100%; object-fit: cover; display: block; }
[data-status][data-kind="err"] { color: var(--red); }
[data-status][data-kind="warn"] { color: var(--amber); }
.ab-group { display: grid; gap: 6px; }
.ab-label { font-weight: 700; }
:root[data-theme="dark"] .ab-history button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }
@media (max-width: 560px) { .avatar-builder { grid-template-columns: 1fr; justify-items: stretch; } }

/* ---------- auth page ---------- */
.auth { display: grid; grid-template-columns: minmax(340px, 5fr) 6fr; min-height: 100vh; background: var(--paper); }
.auth-brand { background: var(--ink); color: #E7ECF3; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-brand .brand { padding: 0; font-size: 24px; }
.auth-brand h1 { font-size: clamp(38px, 4.4vw, 62px); line-height: 1.02; letter-spacing: -.035em; color: #fff; margin-top: auto; max-width: 11ch; }
.auth-brand p { color: #A9B7CA; font-size: 17px; max-width: 38ch; margin-top: 18px; }
.plumb { position: absolute; top: 0; right: 14%; width: 2px; height: 38%; background: linear-gradient(#FB8D1A00, #FB8D1A); }
.plumb::after { content: ""; position: absolute; left: -13px; bottom: -34px; width: 28px; height: 36px; background: var(--level); clip-path: polygon(50% 100%, 0 35%, 22% 0, 78% 0, 100% 35%); animation: sway 5s ease-in-out infinite; transform-origin: 14px -300px; }
@keyframes sway { 50% { transform: rotate(1.4deg); } }
.auth-brand .vial { margin-top: 34px; max-width: 360px; background: #2C3E5A; box-shadow: inset 3px 3px 6px rgba(8, 13, 22, .5); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(560px, 100%); }
.auth-card .switcher { display: flex; gap: 4px; padding: 5px; background: var(--panel); box-shadow: var(--neu-in); border-radius: var(--r-md); margin: 18px 0 22px; }
.auth-card .switcher button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--muted); transition: box-shadow .15s, color .15s; }
.auth-card .switcher button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--neu-out-sm); }
.demo-note { margin-top: 18px; padding: 12px 14px; border-radius: var(--r-md); background: #FFF0DD; font-size: 13.5px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 30px 26px; min-height: 260px; }
  .auth-brand h1 { font-size: 38px; margin-top: 40px; }
}

/* public form page */
.public-wrap { max-width: 640px; margin: 0 auto; padding: 48px 20px; }
.public-wrap .panel { padding: 26px 28px; border-top: 5px solid var(--c, var(--ink)); }
.public-wrap .sub-row .check { cursor: default; flex: none; }
.public-wrap .sub-row .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.public-wrap .sub-row.done .name { text-decoration: line-through; color: var(--muted); }
@media (max-width: 520px) {
  .public-wrap { padding: 24px 16px; }
  .public-wrap .panel { padding: 20px 18px; }
  .public-wrap .props { grid-template-columns: 100px minmax(0, 1fr); }
}
.icon-btn.shared { color: var(--green); }

/* ---------- responsive shell ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; z-index: 70; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-float); }
  .menu-btn { display: inline-grid; }
  .topbar > .spacer { display: none; }
  .view { padding: 20px 16px 50px; }
  .topbar { padding: 0 14px; }
  .proj-progress { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- dark theme: component-level overrides for hardcoded light surfaces ---------- */
:root:not([data-theme]) { color-scheme: light dark; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar { background: rgba(22, 28, 39, .88); }
  :root:not([data-theme="light"]) .trow.thead, :root:not([data-theme="light"]) .g-headpad,
  :root:not([data-theme="light"]) .g-months, :root:not([data-theme="light"]) .g-days,
  :root:not([data-theme="light"]) .cal .dow, :root:not([data-theme="light"]) .wl-row.head,
  :root:not([data-theme="light"]) .ptable th { background: #121722; }
  :root:not([data-theme="light"]) .task-line:hover, :root:not([data-theme="light"]) .trow:hover,
  :root:not([data-theme="light"]) .ptable tr.click:hover td, :root:not([data-theme="light"]) .goal.child { background: #1B2230; }
  :root:not([data-theme="light"]) .cal .day.other { background: #10141D; }
  :root:not([data-theme="light"]) .cal .day.weekend, :root:not([data-theme="light"]) .g-days div.we { background: #121722; }
  :root:not([data-theme="light"]) .cal .day.drag-over, :root:not([data-theme="light"]) .dropzone:hover,
  :root:not([data-theme="light"]) .dropzone.drag-over, :root:not([data-theme="light"]) .wl-lane.drag-over { background: #3A3013; }
  :root:not([data-theme="light"]) .st-todo { color: #AEB9C9; background: #2A3240; }
  :root:not([data-theme="light"]) .st-in_progress { color: #8FB3FF; background: #1E2E4D; }
  :root:not([data-theme="light"]) .st-review { color: #C7A9FF; background: #2C2347; }
  :root:not([data-theme="light"]) .st-done { color: #7FD9A8; background: #163826; }
  :root:not([data-theme="light"]) .ai-box { background: #3A2410; border-color: #6B4420; }
  :root:not([data-theme="light"]) .ai-box .src { color: #F2B877; }
  :root:not([data-theme="light"]) .tag.ai, :root:not([data-theme="light"]) .mention,
  :root:not([data-theme="light"]) .g-today::before, :root:not([data-theme="light"]) .demo-note { background: #3D2712; color: #F2B877; }
  :root:not([data-theme="light"]) .error-box { background: #3A1420; color: #FF8FA8; border-color: #5C1D2E; }
  :root:not([data-theme="light"]) .wl-chip.overdue, :root:not([data-theme="light"]) .cal-chip.overdue { background: #351018; }
}
:root[data-theme="dark"] .topbar { background: rgba(22, 28, 39, .88); }
:root[data-theme="dark"] .trow.thead, :root[data-theme="dark"] .g-headpad,
:root[data-theme="dark"] .g-months, :root[data-theme="dark"] .g-days,
:root[data-theme="dark"] .cal .dow, :root[data-theme="dark"] .wl-row.head,
:root[data-theme="dark"] .ptable th { background: #121722; }
:root[data-theme="dark"] .task-line:hover, :root[data-theme="dark"] .trow:hover,
:root[data-theme="dark"] .ptable tr.click:hover td, :root[data-theme="dark"] .goal.child { background: #1B2230; }
:root[data-theme="dark"] .cal .day.other { background: #10141D; }
:root[data-theme="dark"] .cal .day.weekend, :root[data-theme="dark"] .g-days div.we { background: #121722; }
:root[data-theme="dark"] .cal .day.drag-over, :root[data-theme="dark"] .dropzone:hover,
:root[data-theme="dark"] .dropzone.drag-over, :root[data-theme="dark"] .wl-lane.drag-over { background: #3A3013; }
:root[data-theme="dark"] .st-todo { color: #AEB9C9; background: #2A3240; }
:root[data-theme="dark"] .st-in_progress { color: #8FB3FF; background: #1E2E4D; }
:root[data-theme="dark"] .st-review { color: #C7A9FF; background: #2C2347; }
:root[data-theme="dark"] .st-done { color: #7FD9A8; background: #163826; }
:root[data-theme="dark"] .ai-box { background: #3A2410; border-color: #6B4420; }
:root[data-theme="dark"] .ai-box .src { color: #F2B877; }
:root[data-theme="dark"] .tag.ai, :root[data-theme="dark"] .mention,
:root[data-theme="dark"] .g-today::before, :root[data-theme="dark"] .demo-note { background: #3D2712; color: #F2B877; }
:root[data-theme="dark"] .error-box { background: #3A1420; color: #FF8FA8; border-color: #5C1D2E; }
:root[data-theme="dark"] .wl-chip.overdue, :root[data-theme="dark"] .cal-chip.overdue { background: #351018; }

/* --ink doubles as both a fixed-navy surface color and a text color; on dark surfaces it stays
   readable (white-on-navy), but as TEXT against the now-dark page/panel backgrounds it goes
   invisible, so those specific spots need to repoint at --text in dark mode. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lb-row.top .rank { color: var(--text); }
  :root:not([data-theme="light"]) .suggestions button:hover { color: var(--text); }
}
:root[data-theme="dark"] .lb-row.top .rank { color: var(--text); }
:root[data-theme="dark"] .suggestions button:hover { color: var(--text); }
