/* TeamDesk — ledger teal + site amber. One signature element: the five-step status rail. */
@font-face { font-family: "Hanken"; src: url(hanken-grotesk.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #f5f7f4; --surface: #ffffff; --sunk: #eef1ed; --line: #dde3de; --line-strong: #c6cfc8;
  --ink: #18221f; --ink-2: #44514c; --muted: #6b7873;
  --brand: #0f5e56; --brand-ink: #ffffff; --brand-soft: #e3f0ed; --brand-strong: #0a4740;
  --rail: #0e3b37; --rail-ink: #d6e6e2; --rail-muted: #8fb0aa; --rail-hover: #164a45; --rail-active: #1d5b55;
  --amber: #c98a0a; --amber-soft: #fbf1db; --red: #bf3b28; --red-soft: #fbe7e3; --green: #2c7a3f; --green-soft: #e2f2e5;
  --blue: #2b62c4; --blue-soft: #e5edfb; --violet: #7a4bc4;
  --s-todo: #8a9690; --s-progress: #2b62c4; --s-waiting: #c98a0a; --s-review: #7a4bc4; --s-done: #2c7a3f;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --shadow-pop: 0 10px 30px -8px rgb(14 40 36 / 28%), 0 2px 6px rgb(14 40 36 / 10%);
  --font: "Hanken", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 236px; --topbar-h: 56px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #111816; --surface: #18211e; --sunk: #141c19; --line: #29342f; --line-strong: #39463f;
  --ink: #e6eeea; --ink-2: #b8c6c0; --muted: #87958f;
  --brand: #3fa596; --brand-ink: #06201c; --brand-soft: #173a35; --brand-strong: #5cbdae;
  --rail: #0b1513; --rail-ink: #cfe1dc; --rail-muted: #7d9993; --rail-hover: #13221f; --rail-active: #1a3430;
  --amber-soft: #3a2d0e; --red-soft: #3d1a14; --green-soft: #15301c; --blue-soft: #172743;
  --shadow-pop: 0 10px 30px -8px rgb(0 0 0 / 60%);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111816; --surface: #18211e; --sunk: #141c19; --line: #29342f; --line-strong: #39463f;
    --ink: #e6eeea; --ink-2: #b8c6c0; --muted: #87958f;
    --brand: #3fa596; --brand-ink: #06201c; --brand-soft: #173a35; --brand-strong: #5cbdae;
    --rail: #0b1513; --rail-ink: #cfe1dc; --rail-muted: #7d9993; --rail-hover: #13221f; --rail-active: #1a3430;
    --amber-soft: #3a2d0e; --red-soft: #3d1a14; --green-soft: #15301c; --blue-soft: #172743;
    --shadow-pop: 0 10px 30px -8px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 750; font-size: 17px; letter-spacing: -0.02em; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--amber); display: grid; place-items: center; color: #1b1300; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--rail-ink); font-weight: 520; }
.nav a:hover { background: var(--rail-hover); text-decoration: none; }
.nav a.active { background: var(--rail-active); color: #fff; box-shadow: inset 3px 0 0 var(--amber); }
.nav a svg { flex: none; opacity: .85; }
.nav .count { margin-left: auto; background: var(--amber); color: #1b1300; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; min-width: 20px; text-align: center; }
.nav-section { margin: 18px 10px 6px; font-size: 12px; color: var(--rail-muted); font-weight: 600; }
.nav-projects a { font-size: 14px; padding: 6px 10px; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; display: inline-block; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgb(255 255 255 / 8%); }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; color: var(--rail-ink); width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }
.me-chip:hover { background: var(--rail-hover); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.search-box { flex: 1; max-width: 520px; position: relative; }
.search-box input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); }
.search-box input:focus { background: var(--surface); border-color: var(--brand); outline: none; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.page { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.conn.offline { background: var(--red-soft); color: var(--red); }
.conn.reconnecting { background: var(--amber-soft); color: var(--amber); }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn.reconnecting i { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.mobile-only { display: none !important; }
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 35%); z-index: 55; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .topbar { padding: 0 12px; }
  .page { padding: 16px 14px 92px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); position: relative; min-height: 54px; }
  .bottom-nav a.active { color: var(--brand); font-weight: 650; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .count { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--red); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; font-weight: 700; }
  h1 { font-size: 21px; }
}

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; min-height: 36px; }
.btn:hover { background: var(--sunk); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.btn.danger.solid { background: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { padding: 4px 9px; min-height: 30px; font-size: 13px; }
.btn.icon { padding: 0; width: 36px; }
.btn.icon.sm { width: 30px; }
@media (pointer: coarse) { .btn { min-height: 42px; } .btn.sm { min-height: 36px; } .btn.icon { width: 42px; } .btn.icon.sm { width: 36px; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--red); font-weight: 550; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); padding: 8px 11px; min-height: 38px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.invalid { border-color: var(--red); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.seg { display: inline-flex; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: 13.5px; min-height: 34px; max-width: 200px; }
.filters .active-filter { border-color: var(--brand); background: var(--brand-soft); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-color: var(--brand); }
.tabs .count { background: var(--sunk); border-radius: 99px; padding: 0 7px; font-size: 12px; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; }
.panel-body { padding: 0 16px 16px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); color: inherit; cursor: pointer; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; }
.list-row:hover { background: var(--sunk); text-decoration: none; }
.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
@media (max-width: 1100px) { .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; } }

/* figures strip: one band, not five cards */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.figure { padding: 14px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; color: inherit; }
.figure:last-child { border-right: 0; }
.figure:hover { background: var(--sunk); text-decoration: none; }
.figure b { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.figure span { color: var(--muted); font-size: 13px; }
.figure.alert b { color: var(--red); }
.figure.warn b { color: var(--amber); }
@media (max-width: 600px) { .figure { border-bottom: 1px solid var(--line); } }

.meter { height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.workload { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--sunk); min-width: 80px; }
.workload i { display: block; height: 100%; }

/* ---------- status rail (signature) ---------- */
.rail { display: inline-grid; grid-template-columns: repeat(5, 1fr); gap: 3px; width: 64px; flex: none; }
.rail i { height: 5px; border-radius: 2px; background: var(--line); }
.rail[data-s="todo"] i:nth-child(-n+1) { background: var(--s-todo); }
.rail[data-s="in_progress"] i:nth-child(-n+2) { background: var(--s-progress); }
.rail[data-s="waiting"] i:nth-child(-n+3) { background: var(--s-waiting); }
.rail[data-s="in_review"] i:nth-child(-n+4) { background: var(--s-review); }
.rail[data-s="completed"] i { background: var(--s-done); }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stepper button { border: 0; background: none; padding: 0 0 4px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stepper button::before { content: ""; height: 6px; border-radius: 3px; background: var(--line); }
.stepper button.past::before { background: color-mix(in srgb, var(--sc) 55%, var(--line)); }
.stepper button.now { color: var(--ink); }
.stepper button.now::before { background: var(--sc); }
.stepper button:disabled { cursor: default; }
.stepper button:not(:disabled):hover::before { background: color-mix(in srgb, var(--sc) 75%, var(--line)); }
@media (max-width: 520px) { .stepper button span { display: none; } .stepper button.now span { display: inline; white-space: nowrap; } }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.todo { color: var(--ink-2); background: var(--sunk); }
.status.in_progress { color: var(--blue); background: var(--blue-soft); }
.status.waiting { color: var(--amber); background: var(--amber-soft); }
.status.in_review { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.status.completed { color: var(--green); background: var(--green-soft); }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.prio svg { flex: none; }
.prio.urgent { color: var(--red); } .prio.high { color: var(--amber); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 5px; background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 80%, var(--ink)); white-space: nowrap; }
.due { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.due.overdue { color: var(--red); } .due.soon { color: var(--amber); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; background: var(--sunk); color: var(--ink-2); }
.badge.red { background: var(--red); color: #fff; } .badge.amber { background: var(--amber-soft); color: var(--amber); } .badge.green { background: var(--green-soft); color: var(--green); }

/* avatars */
.avatar { position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; color: #fff; overflow: visible; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .pres { position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 8px; min-height: 8px; border-radius: 50%; border: 2px solid var(--surface); }
.pres.available { background: #2fa24f; } .pres.busy { background: var(--red); } .pres.away { background: var(--amber); } .pres.offline { background: #9aa6a1; }
.avatars { display: inline-flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-left: -7px; }

/* ---------- tasks ---------- */
.task-table { width: 100%; border-collapse: collapse; }
.task-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.task-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.task-table tr { cursor: pointer; }
.task-table tbody tr:hover { background: var(--sunk); }
.task-table .t-title { font-weight: 600; }
.task-table .t-meta { display: flex; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: 2px; flex-wrap: wrap; align-items: center; }
.group-head td { background: var(--sunk); font-weight: 650; font-size: 13px; cursor: default; }
@media (max-width: 760px) {
  .task-table thead { display: none; }
  .task-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .task-table td { padding: 0; border: 0; }
  .task-table td.c-hide { display: none; }
  .group-head { display: block !important; padding: 0 !important; }
  .group-head td { display: block; padding: 6px 8px; }
}

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.col { background: var(--sunk); border-radius: var(--r-md); padding: 8px; min-height: 160px; scroll-snap-align: start; border: 1px solid transparent; }
.col.drop { border-color: var(--brand); background: var(--brand-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 650; font-size: 14px; }
.col-head i { width: 10px; height: 10px; border-radius: 3px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 7px; }
.card:hover { border-color: var(--line-strong); }
.card.dragging { opacity: .45; }
.card .c-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.card .c-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card .c-icons { display: flex; gap: 9px; color: var(--muted); font-size: 12px; align-items: center; }
.card .c-icons span { display: inline-flex; gap: 3px; align-items: center; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.cal-dow { padding: 6px 8px; font-size: 12.5px; font-weight: 650; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--sunk); }
.cal-day { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: var(--sunk); color: var(--muted); }
.cal-day.today .cal-n { background: var(--brand); color: var(--brand-ink); }
.cal-n { font-size: 12.5px; font-weight: 650; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-item { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: var(--sunk); border-left: 3px solid var(--c); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%; }
.cal-item.done { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 4px; background: none; border: 0; text-align: left; cursor: pointer; }
@media (max-width: 760px) { .cal-day { min-height: 64px; padding: 3px; } .cal-item { font-size: 0; height: 6px; padding: 0; border-left-width: 0; background: var(--c); } .cal-dow { font-size: 11px; padding: 4px; } }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgb(10 20 18 / 40%); z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px; overflow-y: auto; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 560px; box-shadow: var(--shadow-pop); animation: rise .16s ease-out; }
.modal.wide { max-width: 760px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; gap: 12px; }
.modal-body { padding: 12px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.drawer-overlay { position: fixed; inset: 0; background: rgb(10 20 18 / 32%); z-index: 70; animation: fade .12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--surface); z-index: 71; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; flex: 1; padding: 20px; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  .drawer-body { padding: 16px 14px 40px; }
}
.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 5px; z-index: 90; min-width: 200px; max-height: 340px; overflow-y: auto; }
.menu button, .menu a { display: flex; width: 100%; gap: 9px; align-items: center; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; color: var(--ink); font-size: 14px; }
.menu button:hover, .menu a:hover, .menu .hl { background: var(--sunk); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 9px; font-weight: 550; font-size: 14px; box-shadow: var(--shadow-pop); pointer-events: auto; display: flex; gap: 12px; align-items: center; max-width: 92vw; animation: rise .16s; }
.toast.error { background: var(--red); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
@media (max-width: 900px) { .toasts { bottom: 76px; } }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { color: var(--line-strong); }
.empty h3 { color: var(--ink); }
.empty p { max-width: 380px; margin: 0; }
.empty.compact { padding: 18px 16px; }
.skel { background: linear-gradient(90deg, var(--sunk), var(--line), var(--sunk)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 14px; font-weight: 550; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.notice { background: var(--amber-soft); border-radius: 8px; padding: 10px 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - var(--topbar-h)); }
.chat-layout.with-thread { grid-template-columns: 300px 1fr 380px; }
.chat-list { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; }
.chat-list .conv { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: inherit; cursor: pointer; }
.chat-list .conv:hover { background: var(--sunk); text-decoration: none; }
.chat-list .conv.on { background: var(--brand-soft); }
.chat-list .conv .ct { font-weight: 600; font-size: 14px; }
.chat-list .conv.unread .ct { font-weight: 750; }
.chat-list .conv .cl { font-size: 13px; color: var(--muted); }
.conv-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 750; flex: none; font-size: 14px; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); min-height: 56px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px 0 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.day-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 10px 18px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.msg { display: flex; gap: 10px; padding: 3px 18px; position: relative; }
.msg:hover, .msg.hl { background: color-mix(in srgb, var(--sunk) 80%, transparent); }
.msg.hl { box-shadow: inset 3px 0 0 var(--amber); }
.msg .gutter { width: 36px; flex: none; }
.msg .m-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg .m-name { font-weight: 700; font-size: 14px; }
.msg .m-time { font-size: 12px; color: var(--muted); }
.msg .m-body { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .m-body.deleted { color: var(--muted); font-style: italic; }
.msg.pending .m-body { opacity: .6; }
.msg.failed .m-body { color: var(--red); }
.mention { background: var(--amber-soft); color: color-mix(in srgb, var(--amber) 70%, var(--ink)); font-weight: 650; border-radius: 4px; padding: 0 3px; }
.mention.me { background: var(--amber); color: #1b1300; }
.m-actions { position: absolute; right: 16px; top: -16px; display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 2px; z-index: 5; }
.msg:hover .m-actions, .msg:focus-within .m-actions, .msg.show-actions .m-actions { display: flex; }
.m-actions button { border: 0; background: none; padding: 5px 7px; border-radius: 6px; cursor: pointer; color: var(--ink-2); display: inline-flex; }
.m-actions button:hover { background: var(--sunk); }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reaction { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 1px 8px; font-size: 13px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.reaction.mine { border-color: var(--brand); background: var(--brand-soft); }
.reaction b { font-size: 12px; font-weight: 650; }
.thread-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 13px; font-weight: 650; color: var(--brand); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.task-link { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--sunk); color: var(--ink-2); margin-top: 4px; border: 0; cursor: pointer; font-weight: 600; max-width: 100%; }
.question-card { margin-top: 6px; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); border-left: 4px solid var(--amber); border-radius: 8px; padding: 8px 12px; background: var(--surface); max-width: 560px; }
.question-card.answered { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); border-left-color: var(--green); }
.answer-mark { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 1px 8px; border-radius: 99px; margin-top: 4px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-img { width: 180px; max-height: 180px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; background: var(--sunk); padding: 0; }
.att-img img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }
.att-file { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); max-width: 300px; color: inherit; cursor: pointer; text-align: left; }
.att-file:hover { border-color: var(--line-strong); text-decoration: none; }
.file-icon { width: 36px; height: 40px; border-radius: 5px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex: none; letter-spacing: .02em; }
.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.composer-box { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.composer-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.composer textarea { width: 100%; border: 0; resize: none; padding: 10px 12px 4px; background: transparent; max-height: 200px; min-height: 42px; outline: none; line-height: 1.45; }
.composer-tools { display: flex; align-items: center; gap: 2px; padding: 2px 6px 6px; }
.composer-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sunk); border-radius: 7px; padding: 3px 4px 3px 9px; font-size: 13px; font-weight: 550; max-width: 260px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px; display: inline-flex; border-radius: 4px; }
.chip.ask { background: var(--amber-soft); color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
.chip .prog { width: 48px; height: 4px; background: var(--line); border-radius: 9px; overflow: hidden; }
.chip .prog i { display: block; height: 100%; background: var(--brand); }
.thread-pane { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 1200px) { .chat-layout.with-thread { grid-template-columns: 280px 1fr; } .thread-pane { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100%); z-index: 65; box-shadow: var(--shadow-pop); } }
@media (max-width: 900px) {
  .chat-layout, .chat-layout.with-thread { grid-template-columns: 1fr; height: calc(100dvh - var(--topbar-h) - 54px - env(safe-area-inset-bottom)); }
  .chat-layout.has-conv .chat-list { display: none; }
  .chat-layout:not(.has-conv) .chat-pane { display: none; }
  .thread-pane { width: 100%; }
  .m-actions { right: 8px; }
  .msg { padding: 3px 12px; }
}
.embedded-chat .chat-scroll { max-height: 440px; min-height: 160px; }
.embedded-chat { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; background: var(--paper); }
.project-chat { height: calc(100vh - var(--topbar-h) - 210px); min-height: 420px; }
.project-chat .chat-scroll { max-height: none; }
@media (max-width: 900px) { .project-chat { height: calc(100dvh - var(--topbar-h) - 230px); } }

/* ---------- task detail ---------- */
.td-title { font-size: 22px; font-weight: 700; line-height: 1.3; }
.td-props { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; align-items: center; font-size: 14px; margin: 18px 0; }
.td-props > dt { color: var(--muted); font-weight: 550; }
.td-props > dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.td-section { margin-top: 26px; }
.td-section > h3 { margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.desc { white-space: pre-wrap; line-height: 1.6; color: var(--ink-2); }
.checklist-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 4px; border-radius: 6px; }
.checklist-item:hover { background: var(--sunk); }
.checklist-item.done span { text-decoration: line-through; color: var(--muted); }
.checklist-item .del { margin-left: auto; opacity: 0; }
.checklist-item:hover .del { opacity: 1; }
@media (pointer: coarse) { .checklist-item .del { opacity: 1; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; font-size: 13.5px; color: var(--ink-2); align-items: flex-start; }
.timeline li time { color: var(--muted); font-size: 12.5px; margin-left: auto; white-space: nowrap; padding-left: 10px; }
.review-box { border: 1px solid color-mix(in srgb, var(--violet) 35%, var(--line)); background: color-mix(in srgb, var(--violet) 7%, var(--surface)); border-radius: var(--r-md); padding: 14px; margin-top: 16px; }
.review-note { border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 8px 12px; border-radius: 0 6px 6px 0; font-size: 14px; margin-top: 12px; }

/* ---------- files ---------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.file-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit; }
.file-tile:hover { border-color: var(--line-strong); }
.file-tile .ft-prev { aspect-ratio: 4/3; background: var(--sunk); display: grid; place-items: center; overflow: hidden; }
.file-tile .ft-prev img { width: 100%; height: 100%; object-fit: cover; }
.file-tile .ft-info { padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-tile .ft-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.lightbox { position: fixed; inset: 0; background: rgb(5 10 9 / 92%); z-index: 120; display: flex; flex-direction: column; color: #fff; }
.lightbox-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.lightbox-head .btn { background: rgb(255 255 255 / 10%); border-color: transparent; color: #fff; }
.lightbox-body { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 16px 16px; }
.lightbox-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-body iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: var(--rail); color: var(--rail-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .board-sketch { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 40px 0; }
.auth-art .bs-col { display: flex; flex-direction: column; gap: 8px; }
.auth-art .bs-col b { font-size: 12px; color: var(--rail-muted); font-weight: 600; }
.auth-art .bs-card { height: 38px; border-radius: 6px; background: rgb(255 255 255 / 7%); border-left: 3px solid var(--c); }
.auth-art h2 { font-size: 34px; line-height: 1.15; color: #fff; font-weight: 700; max-width: 440px; letter-spacing: -0.02em; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

.kbd { font-size: 11px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.result-group { margin-bottom: 22px; }
.result-group h3 { margin-bottom: 8px; }
.pill-filter { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.settings-nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; }
.settings-nav a.on { background: var(--brand-soft); color: var(--brand); }
.settings-nav a:hover { text-decoration: none; background: var(--sunk); }
@media (max-width: 800px) { .settings-layout { grid-template-columns: 1fr; } .settings-nav { flex-direction: row; overflow-x: auto; position: static; } .settings-nav a { white-space: nowrap; } }
.pref-table { width: 100%; border-collapse: collapse; }
.pref-table th, .pref-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.pref-table td:not(:first-child), .pref-table th:not(:first-child) { text-align: center; width: 90px; }
.pref-table input { width: 18px; height: 18px; accent-color: var(--brand); }
code.copy { display: block; background: var(--sunk); padding: 10px 12px; border-radius: 8px; word-break: break-all; font-size: 13px; }
.emoji-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 4px; }
.emoji-pick button { font-size: 20px; padding: 4px; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.emoji-pick button:hover { background: var(--sunk); }
.install-banner { background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.chat-pane .chat-pane { min-height: 0; flex: 1; }
.btn.on { background: var(--amber-soft); color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
@media (max-width: 600px) {
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
  .filters > * { flex: none; }
  .list-row .rail, .list-row .prio { display: none; }
  .list-row .row.tiny { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
  .figure b { font-size: 24px; }
}
