/* Tutagora HQ. Light, Inter, one accent (blue), Lucide icons. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --subtle: #f3f4f6;
  --hover: #f1f3f6;
  --line: #e6e8ec;
  --line-strong: #d5d9e0;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #2b59f0;
  --accent-ink: #1d43c9;
  --accent-soft: #edf1fe;
  --danger: #d92d20;
  --danger-soft: #fef1f0;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fffaeb;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-pop: 0 12px 32px rgba(17, 24, 39, .12), 0 2px 6px rgba(17, 24, 39, .06);
  --sb-w: 264px;
  --panel-w: 420px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

.i { width: 16px; height: 16px; flex: none; stroke-width: 1.75; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Frame ---------------------------------------------------------------- */

.frame { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
.frame.has-panel { grid-template-columns: var(--sb-w) minmax(0, 1fr) var(--panel-w); }

.sb {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px 12px; gap: 4px;
  scrollbar-width: thin;
}
.sb-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 10px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-mark { width: 28px; height: 28px; display: block; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.sb-head .sb-close { display: none; }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn.sm .i { width: 14px; height: 14px; }
.dot-count {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 650; line-height: 16px; text-align: center;
}
.bell .dot-count { position: absolute; top: 2px; right: 1px; }

.sb-search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin: 0 2px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--subtle); color: var(--faint);
}
.sb-search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.sb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.sb-search input::placeholder { color: var(--faint); }
.sb-search input::-webkit-search-cancel-button { display: none; }
kbd {
  font: 500 10.5px/1 "Inter", sans-serif; color: var(--faint); border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; background: var(--surface); white-space: nowrap;
}

.sb-nav { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; }
.sb-row {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500;
}
.sb-row .sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-row .ai + .chip, .sb-row .sb-text + .ai { margin-left: 0; }
.sb-row .i { color: var(--faint); }
.sb-row:hover { background: var(--hover); color: var(--text); }
.sb-row.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.sb-row.is-active .i { color: var(--accent); }
.sb-row.is-unread { color: var(--text); font-weight: 650; }
.sb-row.is-unread .i { color: var(--text-2); }
.sb-row.ch, .sb-row.dm { min-height: 30px; padding: 4px 10px; font-weight: 450; }
.sb-row.ch.is-unread, .sb-row.dm.is-unread { font-weight: 650; }
.chip {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--subtle); color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center;
}
.chip.unread { background: var(--accent); color: #fff; }
.sb-row.is-active .chip { background: #fff; color: var(--accent-ink); }
.sb-row.is-active .chip.unread { background: var(--accent); color: #fff; }

.sb-section { padding: 8px 0 6px; border-top: 1px solid var(--line); }
.sb-label {
  display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 6px;
  color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
}
.sb-empty { padding: 2px 10px 6px; color: var(--faint); font-size: 12.5px; }

.sb-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.me { position: relative; }
.me summary {
  list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.me summary::-webkit-details-marker { display: none; }
.me summary:hover { background: var(--hover); }
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.me-text strong { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }
.me-caret { color: var(--faint); }
.me-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 30;
}
.me-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; color: var(--text-2); text-align: left;
}
.me-menu button:hover { background: var(--hover); color: var(--text); }

.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; }

/* Avatars and marks ---------------------------------------------------- */

.av {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px; font-size: 12px; font-weight: 650; letter-spacing: .02em;
}
.av-xs { width: 20px; height: 20px; border-radius: 6px; font-size: 9.5px; }
.av-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.av-lg { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.av .i { width: 60%; height: 60%; }
.av.t0 { background: #e8eefc; color: #2c4fb8; }
.av.t1 { background: #e7f6ef; color: #19744c; }
.av.t2 { background: #fdeee6; color: #a24718; }
.av.t3 { background: #f1eafd; color: #6236b8; }
.av.t4 { background: #fdf4dd; color: #8a5a00; }
.av.t5 { background: #e6f4f7; color: #1b6578; }
.av-ai { background: #111827; color: #fff; }
.sb-row .av-xs .i, .av-xs .i { width: 13px; height: 13px; color: #fff; }
.ai {
  display: inline-flex; align-items: center; height: 17px; padding: 0 5px; border-radius: 5px;
  background: #111827; color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; flex: none;
}
.sb-row .ai { margin-left: 0; }

/* Page structure -------------------------------------------------------- */

.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 40px 64px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; font-weight: 650; }
.lede { margin-top: 6px; color: var(--muted); font-size: 15px; max-width: 640px; }
.lede strong { color: var(--text); font-weight: 600; }
.eyebrow { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.eyebrow a:hover { color: var(--accent-ink); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14.5px; font-weight: 650; flex: 1; }
.card-head .count { color: var(--muted); font-weight: 500; font-size: 13px; }
.card-head a.more { color: var(--muted); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.card-head a.more:hover { color: var(--accent-ink); }
.card-body { padding: 16px 18px; }
.empty { padding: 22px 18px; color: var(--muted); font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.empty .i { color: var(--faint); }

/* Buttons and forms ----------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
}
.btn:hover { background: var(--hover); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.block { width: 100%; height: 42px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); outline: 0;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input {
  appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.inline-form { display: inline; }

/* Flash and toast -------------------------------------------------------- */

.flash {
  display: flex; align-items: center; gap: 10px; margin: 16px 40px 0; padding: 10px 12px 10px 14px; border-radius: 10px;
  background: var(--ok-soft); color: var(--ok); border: 1px solid #c9ecd6; font-weight: 500;
}
.flash span { flex: 1; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #fbd4cf; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); font-weight: 500;
}

/* Pills ------------------------------------------------------------------ */

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--subtle); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.pill.todo { color: var(--muted); }
.pill.doing { background: var(--accent-soft); color: var(--accent-ink); }
.pill.waiting { background: var(--warn-soft); color: var(--warn); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.h-good { background: var(--ok-soft); color: var(--ok); }
.pill.h-attn { background: var(--warn-soft); color: var(--warn); }
.pill.h-bad { background: var(--danger-soft); color: var(--danger); }
.pill.h-none { color: var(--muted); }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; color: var(--muted); }
.prio.urgent { color: var(--danger); }
.prio.high { color: var(--warn); }
.due { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.due.late { color: var(--danger); font-weight: 600; }

/* Task rows ---------------------------------------------------------------- */

.tlist { list-style: none; margin: 0; padding: 0; }
.trow {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 11px 18px; border-top: 1px solid var(--line);
}
.tlist .trow:first-child { border-top: 0; }
.trow:hover { background: #fafbfc; }
.trow .tmain { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trow .ttitle { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .ttitle:hover { color: var(--accent-ink); }
.trow .tsub { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; min-width: 0; flex-wrap: wrap; }
.trow .tmeta { display: flex; align-items: center; gap: 12px; }
.trow.is-done .ttitle { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.check {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: transparent;
}
.check:hover { border-color: var(--ok); color: var(--ok); }
.check .i { width: 12px; height: 12px; stroke-width: 3; }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.check.doing { border-color: var(--accent); }
.check.waiting { border-style: dashed; border-color: var(--warn); }
.who { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tag .i { width: 13px; height: 13px; }

.group-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.group-head h3 { font-size: 13px; font-weight: 650; flex: 1; display: flex; align-items: center; gap: 8px; }
.group-head .count { color: var(--muted); font-size: 12.5px; }
.card + .card { margin-top: 16px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: -1px; color: var(--muted);
  font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .chip { margin-left: 0; }

/* Home --------------------------------------------------------------------- */

.needs { list-style: none; margin: 0; padding: 0; }
.needs li { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.needs li:first-child { border-top: 0; }
.needs li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-top: 7px; }
.needs .from { display: block; font-size: 12px; color: var(--muted); font-weight: 550; margin-bottom: 2px; }
.needs .from a:hover { color: var(--accent-ink); }
.needs p { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pcard {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-height: 150px;
}
.pcard:hover { border-color: var(--line-strong); color: inherit; box-shadow: 0 4px 14px rgba(17, 24, 39, .06); }
.pcard-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pcard h3 { font-size: 14.5px; font-weight: 650; }
.pcard .stage { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-foot { margin-top: auto; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.pcard-foot span { display: inline-flex; align-items: center; gap: 5px; }
.pcard-foot .needs-n { color: var(--warn); font-weight: 600; }

.mention-list { list-style: none; margin: 0; padding: 0; }
.mention-list li { border-top: 1px solid var(--line); }
.mention-list li:first-child { border-top: 0; }
.mention-list a { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 12px 18px; }
.mention-list a:hover { background: #fafbfc; color: inherit; }
.mention-list .mhead { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.mention-list .mhead strong { color: var(--text); font-weight: 600; font-size: 13px; }
.mention-list .mbody { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mention-list li.unseen a { background: var(--accent-soft); }

/* Project page ------------------------------------------------------------- */

.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.status-list { list-style: none; margin: 0; padding: 4px 0; }
.status-list li { padding: 9px 18px; color: var(--text-2); border-top: 1px solid var(--line); font-size: 13.5px; }
.status-list li:first-child { border-top: 0; }
.status-card.needs-you { border-color: #f3d9a6; }
.status-card.needs-you .card-head { background: var(--warn-soft); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

/* Chat ----------------------------------------------------------------------- */

body.is-chat .main { height: 100vh; overflow: hidden; }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--surface); }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line);
  background: var(--surface); min-height: 60px;
}
.chat-head h1 { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.chat-head h1 .i { color: var(--muted); }
.chat-head .topic { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-head .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head .actions { display: flex; gap: 6px; align-items: center; }

.stream { flex: 1; overflow-y: auto; padding: 16px 0 8px; scroll-behavior: auto; }
.stream-start { padding: 24px 24px 16px; }
.stream-start h2 { font-size: 20px; font-weight: 650; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.stream-start p { color: var(--muted); }
.day { display: flex; align-items: center; gap: 12px; padding: 10px 24px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.new-line { display: flex; align-items: center; gap: 10px; padding: 4px 24px; color: var(--danger); font-size: 11.5px; font-weight: 650; }
.new-line::before { content: ""; flex: 1; height: 1px; background: #f6b8b1; }

.msg { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 6px 24px; }
.msg:hover { background: #f9fafb; }
.msg.is-hl { background: var(--warn-soft); }
.msg .m-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg .m-name { font-weight: 650; }
.msg .m-time { color: var(--faint); font-size: 12px; }
.msg .m-edited { color: var(--faint); font-size: 12px; }
.msg .m-body { color: var(--text); overflow-wrap: anywhere; }
.msg .m-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.msg .m-body code { font: 12.5px ui-monospace, "SF Mono", Menlo, monospace; background: var(--subtle); padding: 1px 5px; border-radius: 5px; }
.mention { color: var(--accent-ink); background: var(--accent-soft); padding: 0 3px; border-radius: 4px; font-weight: 550; }
.msg.is-deleted .m-body { color: var(--faint); font-style: italic; }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg.compact .m-head { display: none; }
.msg.compact .m-avatar { visibility: hidden; height: 0; }
.msg-actions {
  position: absolute; top: -14px; right: 24px; display: none; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-pop);
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.msg-actions .icon-btn { width: 28px; height: 28px; }
.m-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.m-file {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); max-width: 320px;
}
.m-file:hover { border-color: var(--line-strong); color: inherit; }
.m-file .i { color: var(--accent); width: 20px; height: 20px; }
.m-file span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.m-file strong { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.m-file small { color: var(--muted); font-size: 12px; }
.m-img { display: block; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; max-width: 360px; }
.m-img img { display: block; max-width: 100%; max-height: 260px; object-fit: cover; }
.m-replies {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 8px 4px 4px; border-radius: 8px;
  color: var(--accent-ink); font-size: 12.5px; font-weight: 600; border: 1px solid transparent; background: none; cursor: pointer;
}
.m-replies:hover { background: var(--surface); border-color: var(--line); }
.m-replies .faces { display: inline-flex; gap: 2px; }
.m-replies .last { color: var(--muted); font-weight: 500; }
.m-task {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface); font-size: 13px; max-width: 100%;
}
.m-task:hover { border-color: var(--line-strong); color: inherit; }
.m-task .i { color: var(--accent); }
.m-task strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.kind-task .m-body { color: var(--muted); }

.edit-box textarea { width: 100%; min-height: 60px; }
.edit-box .row { margin-top: 6px; justify-content: flex-end; }

.composer { padding: 12px 24px 18px; background: var(--surface); }
.composer-box {
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  display: block; width: 100%; min-height: 44px; max-height: 240px; padding: 12px 14px 4px; border: 0; outline: 0;
  resize: none; background: transparent; line-height: 1.5;
}
.composer-bar { display: flex; align-items: center; gap: 4px; padding: 4px 6px 6px 8px; }
.composer-bar .hint { margin-left: 6px; flex: 1; }
.send {
  width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.send:hover { background: var(--accent-ink); }
.send:disabled { background: var(--line-strong); cursor: default; }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 6px; }
.pending-files .pill { background: var(--subtle); }
.join-bar { padding: 16px 24px 20px; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); background: #fafbfc; }
.join-bar p { flex: 1; color: var(--muted); }

/* Side panel ------------------------------------------------------------------ */

.panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-left: 1px solid var(--line); display: flex; flex-direction: column;
}
.panel-body { display: flex; flex-direction: column; min-height: 100%; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); min-height: 60px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.panel-head h2 { font-size: 15px; font-weight: 650; flex: 1; min-width: 0; }
.panel-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 500; display: block; }
.panel-section { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel .msg { padding-left: 20px; padding-right: 20px; }
.panel .msg-actions { right: 16px; }
.panel .composer { padding: 12px 16px 16px; margin-top: auto; position: sticky; bottom: 0; }
.thread-count { display: flex; align-items: center; gap: 10px; padding: 8px 20px; color: var(--muted); font-size: 12px; font-weight: 600; }
.thread-count::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Task detail -------------------------------------------------------------------- */

.task-title-input {
  width: 100%; border: 0; outline: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; padding: 4px 0; background: transparent;
  border-bottom: 1px solid transparent;
}
.task-title-input:focus { border-bottom-color: var(--accent); }
.props { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; align-items: center; margin: 14px 0 4px; }
.props .label { color: var(--muted); font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.props .input { min-height: 34px; padding-top: 5px; padding-bottom: 5px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 4px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg input:checked + label { background: var(--text); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); }
.byline { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.source-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-top: 12px; }
.source-link:hover { border-color: var(--line-strong); color: inherit; }
.source-link .i { color: var(--accent); }
.source-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.comments { list-style: none; margin: 0; padding: 0; }
.comments li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 10px 0; }
.comments .c-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.comments .c-head strong { font-weight: 600; }
.comments .c-head time { color: var(--faint); font-size: 12px; }
.comments .c-body { color: var(--text-2); overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.history li { display: flex; gap: 8px; padding: 5px 0; align-items: baseline; }
.history li::before { content: ""; flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); transform: translateY(-2px); }
.history strong { color: var(--text-2); font-weight: 600; }
.history time { margin-left: auto; white-space: nowrap; color: var(--faint); }
.section-title { font-size: 12.5px; font-weight: 650; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

/* Tables ------------------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .person strong { font-weight: 600; display: block; }
.table .person small { color: var(--muted); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.token-box {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #111827; color: #fff;
  font: 13px ui-monospace, "SF Mono", Menlo, monospace; overflow-wrap: anywhere; margin-top: 10px;
}
.token-box code { flex: 1; user-select: all; }

/* Search ------------------------------------------------------------------------- */

.result { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.result:first-child { border-top: 0; }
.result:hover { background: #fafbfc; color: inherit; }
.result .r-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.result .r-head strong { color: var(--text); font-weight: 600; font-size: 13px; }
.result .r-body { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Channel browser ---------------------------------------------------------------- */

.ch-list { list-style: none; margin: 0; padding: 0; }
.ch-list li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.ch-list li:first-child { border-top: 0; }
.ch-list .ch-name { flex: 1; min-width: 0; }
.ch-list .ch-name a { font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.ch-list .ch-name small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialog ---------------------------------------------------------------------------- */

dialog {
  border: 0; padding: 0; border-radius: 16px; box-shadow: var(--shadow-pop); width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); color: var(--text);
}
dialog::backdrop { background: rgba(17, 24, 39, .35); }
.dialog-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { flex: 1; font-size: 16px; font-weight: 650; }
.dialog-body { padding: 18px 20px 6px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }

/* Sign in ------------------------------------------------------------------------------ */

.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 32px;
}
.auth-card .brand { margin-bottom: 28px; }
.auth-card h1 { font-size: 22px; font-weight: 650; margin-bottom: 6px; }
.auth-card > p, .auth-card .muted { margin-bottom: 22px; }
.auth-card .btn { margin-top: 4px; }
.code-input { letter-spacing: .5em; font-size: 22px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; height: 52px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--accent-ink); font-weight: 550; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }

/* Narrow screens ------------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .frame.has-panel { grid-template-columns: var(--sb-w) minmax(0, 1fr); }
  .frame.has-panel .panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--panel-w), 100vw); z-index: 40; box-shadow: var(--shadow-pop);
  }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .frame, .frame.has-panel { grid-template-columns: minmax(0, 1fr); }
  .sb {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: 100%;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop);
  }
  body.sb-open .sb { transform: none; }
  body.sb-open .scrim { display: block; position: fixed; inset: 0; background: rgba(17, 24, 39, .35); z-index: 55; }
  .sb-head .sb-close { display: inline-flex; }
  .sb-search kbd { display: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 8px 0 6px; background: var(--surface);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  }
  .mobile-title { flex: 1; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.is-chat .main { height: 100dvh; }
  .page { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head h1 { font-size: 21px; }
  .flash { margin: 12px 16px 0; }
  .chat-head { padding: 10px 16px; min-height: 52px; }
  .chat-head .topic { display: none; }
  .msg { padding-left: 16px; padding-right: 16px; }
  .msg-actions { right: 12px; }
  .day, .new-line, .stream-start { padding-left: 16px; padding-right: 16px; }
  .composer { padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
  .composer-bar .hint { display: none; }
  .trow { grid-template-columns: 22px minmax(0, 1fr); padding: 11px 14px; }
  .trow .tmeta { grid-column: 2; flex-wrap: wrap; gap: 10px; }
  .status-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .panel, .frame.has-panel .panel { position: fixed; inset: 0; width: 100%; z-index: 70; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .table td, .table th { padding-left: 14px; padding-right: 14px; }
  .props { grid-template-columns: 92px minmax(0, 1fr); }
}

/* Small additions -------------------------------------------------------------------- */
.section-gap { margin-top: 28px; }
.section-gap-sm { margin-top: 12px; }
.home-projects { margin-top: 12px; }
.h2 { font-size: 17px; font-weight: 650; }
.tabs-end { margin-left: auto; }
.project-meta { margin-top: 12px; gap: 12px; }
.guest-row { justify-content: space-between; margin-bottom: 6px; }
.comment-actions { justify-content: flex-end; margin-top: 8px; }
.search-page-form { margin-bottom: 8px; }
.add-grid { display: grid; grid-template-columns: 1.1fr 1.3fr 1.1fr .8fr auto; gap: 0 12px; align-items: end; }
.add-btn .btn { height: 38px; }
.token-row { gap: 8px; margin: 2px 0; }
.token-row code { font: 12px ui-monospace, Menlo, monospace; }
.card + .card, .card + section.card { margin-top: 16px; }
@media (max-width: 1180px) { .add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .add-grid { grid-template-columns: minmax(0, 1fr); } .hide-sm { display: none; } }

.page-head.inline { flex-direction: row; align-items: flex-end; }
.send { margin-left: auto; }
.chat-menu { display: none; margin-left: -6px; }
@media (max-width: 860px) {
  body.is-chat .mobile-bar { display: none; }
  .chat-menu { display: inline-flex; }
}
.thread { flex: 1; display: flex; flex-direction: column; }
.thread [data-thread-rootmsg] { padding-top: 10px; }
.panel .composer-bar .hint { display: none; }
.props .seg { justify-self: start; }
.eyebrow a { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 860px) {
  .props { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .props .label { margin-top: 8px; }
}
.retired { border-top: 1px solid var(--line); }
.retired summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 18px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.retired summary::-webkit-details-marker { display: none; }
.retired[open] summary .i { transform: rotate(90deg); }
.retired ul { list-style: none; margin: 0; padding: 0 18px 14px 42px; color: var(--text-2); font-size: 13px; }
.retired li { padding: 3px 0; }
@media (max-width: 860px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td, .table td:nth-child(3) { display: block; padding: 4px 0; border: 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
  .table .actions { justify-content: flex-start; }
  .table select.input { width: auto; min-width: 140px; }
}
.status-grid > .card, .grid-2 .card + .card { margin-top: 0; }
@media (max-width: 860px) { .pcard { min-height: 0; } }
