:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f2f1ed;
  --ink: #1b1a17;
  --muted: #6c6960;
  --faint: #8d897f;
  --line: #e7e5df;
  --line-strong: #d6d3cb;
  --accent: #1f3d36;
  --accent-ink: #f7f6f3;
  --accent-soft: #e6ece9;
  --mention: #1f5a4c;
  --danger: #a8322a;
  --danger-soft: #f9ecea;
  --warn: #8f5a0a;
  --st-idle-bg: #efeee9;   --st-idle: #5c5a52;
  --st-prog-bg: #e7eef8;   --st-prog: #24508f;
  --st-block-bg: #f9e9e7;  --st-block: #a02f27;
  --st-done-bg: #e5f1ea;   --st-done: #1f6b47;
  --alert-bg: #1f3d36;     --alert-ink: #f7f6f3;
  --alert-urgent-bg: #a8322a;
  --shadow-sm: 0 1px 2px rgb(27 26 23 / 0.04);
  --shadow-lg: 0 24px 60px -16px rgb(27 26 23 / 0.28);
  --serif: "New York", ui-serif, "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --surface: #1b1b19;
    --surface-2: #242421;
    --ink: #efeee9;
    --muted: #a3a097;
    --faint: #8a877e;
    --line: #2b2b28;
    --line-strong: #3a3a36;
    --accent: #dfe9e4;
    --accent-ink: #15231f;
    --accent-soft: #24302c;
    --mention: #8fcfb9;
    --danger: #f08d84;
    --danger-soft: #331e1c;
    --warn: #e0b061;
    --st-idle-bg: #2a2a27;   --st-idle: #bdbab0;
    --st-prog-bg: #1e2b3e;   --st-prog: #9cc0f2;
    --st-block-bg: #3a2120;  --st-block: #f2a199;
    --st-done-bg: #1c3127;   --st-done: #8bd3ad;
    --alert-bg: #24403a;     --alert-ink: #eef4f1;
    --alert-urgent-bg: #8c2a23;
    --shadow-sm: none;
    --shadow-lg: 0 24px 60px -16px rgb(0 0 0 / 0.7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.spacer { flex: 1; }
.mono { font-family: var(--mono); font-size: 0.92em; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); opacity: .9; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #2a100e; } }
.btn-danger:hover { background: var(--danger); opacity: .9; }
.btn-danger-quiet { border-color: transparent; background: transparent; color: var(--danger); padding-inline: 8px; }
.btn-danger-quiet:hover { background: var(--danger-soft); }
.btn-block { width: 100%; min-height: 42px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.link-btn {
  border: 0; background: none; padding: 2px 0; color: var(--muted);
  font-size: 12.5px; font-weight: 550; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }
.link-danger:hover { color: var(--danger); }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 28px; padding: 0 8px;
  border: 1px dashed var(--line-strong); border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 550;
}
.ghost-btn:hover { border-style: solid; color: var(--ink); background: var(--surface-2); }
.ghost-btn .icon { width: 14px; height: 14px; }

/* ---------- Login ---------- */

.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; background: var(--accent);
}
.brand-mark svg { width: 100%; height: 100%; fill: var(--accent-ink); }
.brand-mark-sm { width: 26px; height: 26px; }

.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: var(--surface); }

/* The art panel keeps its colours in light and dark mode. */
.login-art {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: 40px 48px 48px;
  background: radial-gradient(120% 90% at 78% 22%, #2c5148 0%, #1f3d36 46%, #122822 100%);
  color: #f5f3ec;
}
.contours { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; fill: none; animation: contours-in 1.4s ease-out both; }
.contours path { stroke: rgb(245 243 236 / 0.09); stroke-width: 1; vector-effect: non-scaling-stroke; }
.contours .contour-major { stroke: rgb(245 243 236 / 0.2); }
@keyframes contours-in { from { opacity: 0; transform: scale(1.03); } }

.login-brand { display: flex; align-items: center; gap: 10px; font: 500 20px/1.2 var(--serif); letter-spacing: 0.005em; }
.login-brand .brand-mark { width: 30px; height: 30px; background: #f5f3ec; }
.login-brand .brand-mark svg { fill: #1f3d36; }
.login-pitch { max-width: 15em; font-size: 46px; }
.login-pitch h2 { font: 400 1em/1.08 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.login-pitch p { margin-top: 18px; max-width: 30ch; font-size: 15px; line-height: 1.5; color: rgb(245 243 236 / 0.74); }

.login-panel { display: grid; place-items: center; padding: 48px 32px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h1 { font: 400 34px/1.15 var(--serif); letter-spacing: -0.015em; }
.login-sub { margin: 6px 0 30px; color: var(--muted); }
.login-form .field + .field { margin-top: 18px; }
.login-form input:not([type=file]) { min-height: 46px; padding-inline: 14px; border-radius: 11px; font-size: 15px; }
.login-form .input-action input { padding-right: 62px; }
.login-form .input-action .link-btn { right: 14px; }
.login-form .form-error { margin-top: 14px; }
.login-form .btn-block { margin-top: 24px; min-height: 46px; border-radius: 11px; font-size: 15px; }
.login-foot { margin-top: 20px; color: var(--faint); font-size: 13px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .contours { animation: none; }
}

@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-art { padding: 24px 20px 28px; gap: 44px; }
  .login-pitch { font-size: 30px; }
  .login-pitch p { margin-top: 10px; font-size: 14px; }
  .login-panel { place-items: start center; padding: 32px 20px 40px; }
  .login-form h1 { font-size: 28px; }
  .login-sub { margin-bottom: 24px; }
}

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 12.5px; font-weight: 600; }
.field small { font-weight: 400; color: var(--faint); }
.field .hint { font-size: 12px; }
input:not([type=file]):not([type=search]), select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.file-field { padding: 6px 0; font-size: 13px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; }
.form-error:empty { display: none; }
.input-action { position: relative; display: block; }
.input-action input { padding-right: 76px; }
.input-action .link-btn { position: absolute; right: 11px; top: 50%; translate: 0 -50%; }

.search { position: relative; display: flex; align-items: center; color: var(--faint); }
.search .icon { position: absolute; left: 10px; width: 15px; height: 15px; pointer-events: none; }
.search input {
  width: 240px; max-width: 100%; height: 34px; padding: 0 12px 0 31px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; color: var(--ink);
}

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 12px 12px; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 18px; font: 500 17px/1.2 var(--serif); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--muted); font-weight: 550; text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.nav-badge {
  margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-style: normal; font-weight: 650; line-height: 18px; text-align: center;
}
.account { display: flex; align-items: center; gap: 8px; padding: 10px 4px 2px 8px; border-top: 1px solid var(--line); }
.account .icon-btn { width: 28px; height: 28px; margin-left: -4px; }
.account .icon { width: 16px; height: 16px; }
.account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.account-text strong { font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-text span { font-size: 11.5px; color: var(--faint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.main { min-width: 0; }
#alert-slot { position: sticky; top: 0; z-index: 5; }
.page { max-width: 1180px; margin: 0 auto; padding: 36px 36px 72px; }

.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 36px; background: var(--alert-bg); color: var(--alert-ink);
}
.alert p { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.alert-meta { font-size: 12px; opacity: .72; white-space: nowrap; }
.alert-urgent { background: var(--alert-urgent-bg); color: #fff; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font: 500 30px/1.15 var(--serif); letter-spacing: -0.015em; }
.page-head p { margin-top: 4px; color: var(--muted); }

.section-title { font-size: 13px; font-weight: 600; }
.section-gap { margin: 32px 0 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 12px; }

/* ---------- Stats ---------- */

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.stat { padding: 16px 20px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; font: 500 26px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat-late strong { color: var(--danger); }

/* ---------- Segmented, chips, tabs ---------- */

.segmented { display: inline-flex; padding: 2px; background: var(--surface-2); border-radius: 9px; }
.segmented button {
  padding: 4px 11px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 550;
}
.segmented button em { font-style: normal; color: var(--faint); margin-left: 3px; font-variant-numeric: tabular-nums; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px;
  color: var(--muted); font-size: 12.5px; font-weight: 550;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip em { font-style: normal; color: var(--faint); font-variant-numeric: tabular-nums; }
.chip .avatar { width: 18px; height: 18px; font-size: 8.5px; margin-left: -5px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on em { color: inherit; opacity: .7; }
.chip-late { font-style: normal; color: var(--danger); font-size: 11.5px; }
.chip.on .chip-late { color: inherit; }

.tabs { display: flex; gap: 20px; margin: 28px 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  padding: 8px 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font-weight: 550; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button em { font-style: normal; color: var(--faint); font-variant-numeric: tabular-nums; }
.tabs-tight { margin: 0 0 12px; }
.section-note { margin-bottom: 16px; color: var(--muted); }

/* ---------- Table ---------- */

.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px; text-align: left; white-space: nowrap;
  color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
}
.table td { padding: 11px 14px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.row-muted td { color: var(--faint); }
.col-task { min-width: 200px; }
.col-actions { text-align: right; }

.task-link {
  display: block; padding: 0; border: 0; background: none; text-align: left; font-weight: 560;
}
.task-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.count-note { color: var(--faint); font-size: 12px; }
.project { color: var(--muted); }
.none { color: var(--faint); }

.person { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 10px; font-weight: 650; letter-spacing: .02em;
}

.status {
  display: inline-block; width: auto; min-height: 26px; height: 26px; padding: 0 10px;
  border: 0; border-radius: 99px; font-size: 12.5px; font-weight: 570; line-height: 26px; white-space: nowrap;
}
select.status {
  appearance: none; padding-right: 24px; cursor: pointer; width: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 8px;
}
select.status:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.st-idle { background-color: var(--st-idle-bg); color: var(--st-idle); }
.st-progress { background-color: var(--st-prog-bg); color: var(--st-prog); }
.st-blocked { background-color: var(--st-block-bg); color: var(--st-block); }
.st-done { background-color: var(--st-done-bg); color: var(--st-done); }
select.status option { background: var(--surface); color: var(--ink); }

.due { display: inline-flex; flex-direction: column; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.3; }
.due small { font-size: 11.5px; font-weight: 500; }
.due-late { color: var(--danger); font-weight: 560; }
.due-soon { color: var(--warn); font-weight: 560; }

.docs { display: flex; align-items: center; gap: 6px; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 150px;
  padding: 3px 8px 3px 6px; border-radius: 7px; background: var(--surface-2);
  font-size: 12.5px; text-decoration: none;
}
.doc-chip:hover { background: var(--line); }
.doc-chip .icon { width: 14px; height: 14px; color: var(--muted); }
.doc-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Empty ---------- */

.empty {
  padding: 56px 24px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 14px;
}
.empty h2 { font: 500 19px/1.3 var(--serif); }
.empty p { margin: 4px auto 0; max-width: 42ch; color: var(--muted); }
.empty .btn { margin-top: 16px; }

/* ---------- Feed ---------- */

.feed {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.feed-row {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
}
.feed-row:last-child { border-bottom: 0; }
.feed-row:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.feed-body { flex: 1; min-width: 0; display: block; }
.feed-head { display: block; color: var(--muted); }
.feed-head strong { color: var(--ink); font-weight: 600; }
.feed-head em { color: var(--ink); font-style: normal; font-weight: 550; }
.feed-text { display: block; margin-top: 2px; overflow-wrap: anywhere; white-space: pre-wrap; }
.feed-time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.feed-task { color: var(--muted); }
.tag-off {
  padding: 0 6px; border-radius: 99px; background: var(--danger-soft); color: var(--danger);
  font-size: 11px; font-weight: 600;
}
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.history strong { color: var(--ink); font-weight: 600; }
.history time { flex: none; color: var(--faint); font-size: 12px; }
.mention { color: var(--mention); font-weight: 600; }

/* ---------- Information ---------- */

.toolbar-info { margin-top: 0; margin-bottom: 16px; }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.note {
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.note header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.note h3 { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.note-cat { color: var(--faint); font-size: 12px; }
.note-fields { margin-top: 12px; border-top: 1px solid var(--line); }
.note-fields > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.note-fields > div:last-child { border-bottom: 0; padding-bottom: 0; }
.note-fields dt { color: var(--faint); font-size: 11.5px; font-weight: 600; }
.note-fields dd { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; overflow-wrap: anywhere; }
.note-fields a { color: var(--mention); text-underline-offset: 3px; }
.dd-actions { display: inline-flex; gap: 10px; flex: none; }
.note-body { margin-top: 10px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Admin ---------- */

.composer {
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.composer-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.composer-title .icon { width: 16px; height: 16px; }
.composer-title strong { font-weight: 600; }
.composer-title span { color: var(--muted); font-size: 12.5px; }
.composer-row { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-row input { flex: 1 1 280px; width: auto; }
.composer-row select { width: 110px; flex: none; }

/* ---------- Dialogs ---------- */

dialog { padding: 0; border: 0; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgb(20 20 17 / 0.36); backdrop-filter: blur(2px); }

.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: auto;
}
.modal-sm { width: min(400px, calc(100vw - 32px)); }
.modal-form { padding: 22px 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font: 500 21px/1.25 var(--serif); }
.modal-head .icon-btn { margin: -4px -6px -4px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.modal-form > .form-error { margin-top: 12px; }
.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.confirm-body { color: var(--muted); }

.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(520px, 100vw); height: 100dvh; max-height: none; max-width: none;
  box-shadow: var(--shadow-lg); overflow-y: auto;
  border-left: 1px solid var(--line);
}
.drawer[open] { animation: slide-in .18s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } }
.drawer-inner { display: flex; flex-direction: column; gap: 22px; min-height: 100%; padding: 22px 24px; }
.drawer-head { display: flex; justify-content: space-between; gap: 16px; }
.drawer-head .project { font-size: 12.5px; }
.drawer-head h2 { font: 500 23px/1.25 var(--serif); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.drawer-inner section h3 { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.section-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-row h3 { margin: 0 !important; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px 16px; background: var(--bg); border-radius: 12px; }
.meta dt { margin-bottom: 4px; color: var(--faint); font-size: 11.5px; font-weight: 600; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.none-text { color: var(--faint); }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-list small { color: var(--faint); white-space: nowrap; }
.file-name { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; text-decoration: none; font-weight: 500; }
.file-name:hover span { text-decoration: underline; text-underline-offset: 3px; }
.file-name span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-name .icon { width: 15px; height: 15px; color: var(--muted); }
.comments { flex: 1; }
.comment-list li { display: flex; gap: 10px; padding: 9px 0; }
.comment-list li > div { min-width: 0; flex: 1; }
.comment-head { display: flex; gap: 8px; align-items: baseline; }
.comment-head strong { font-weight: 600; }
.comment-head time { color: var(--faint); font-size: 12px; }
.comment-form { position: relative; display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.comment-form textarea { flex: 1; width: auto; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }

.mention-host { position: relative; }
.mention-menu {
  position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 5;
  width: min(280px, 100%); padding: 4px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.field.mention-host .mention-menu { bottom: auto; top: 100%; margin-top: 4px; }
.mention-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: 7px; background: none; text-align: left;
}
.mention-menu button.on, .mention-menu button:hover { background: var(--surface-2); }
.mention-menu span:not(.avatar) { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mention-menu small { color: var(--faint); }

.toast {
  position: fixed; inset: auto auto 24px 50%; translate: -50% 0; margin: 0;
  max-width: min(460px, calc(100vw - 32px)); padding: 10px 16px;
  border: 0; border-radius: 10px; background: var(--ink); color: var(--bg);
  font-weight: 500; box-shadow: var(--shadow-lg);
}
.toast-error { background: var(--danger); color: #fff; }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .shell { display: block; padding-bottom: 72px; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .nav {
    position: fixed; inset: auto 0 0 0; z-index: 10; flex-direction: row; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .nav-item { flex: 1 1 0; flex-direction: column; gap: 2px; padding: 5px 2px; font-size: 11.5px; text-align: center; min-width: 0; }
  .nav-item { position: relative; }
  .nav-badge { position: absolute; top: 1px; left: calc(50% + 6px); margin: 0; }
  .nav-item.active { box-shadow: none; background: var(--surface-2); }
  .account { padding: 0; border: 0; }
  .account > .avatar, .account-text { display: none; }
  .account .icon-btn { margin-left: 0; width: 32px; height: 32px; }

  #alert-slot { position: static; }
  .alert { padding: 10px 16px; flex-wrap: wrap; }
  .alert p { flex-basis: calc(100% - 30px); }
  .alert-meta { padding-left: 28px; }
  .page { padding: 22px 16px 32px; }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .page-head h1 { font-size: 26px; }

  .stat { padding: 12px 14px; }
  .stat strong { font-size: 22px; }
  .search, .search input { width: 100%; }

  .table-wrap { overflow: visible; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 5px 0; border: 0; min-height: 32px;
  }
  .table td::before { content: attr(data-label); color: var(--faint); font-size: 12px; font-weight: 600; flex: none; }
  .table td.col-task { display: block; min-height: 0; padding-bottom: 6px; }
  .table td.col-task::before { display: none; }
  .table td.col-task .task-link { font-size: 15px; }
  .table td.col-actions::before { display: none; }
  .due { align-items: flex-end; }
  .docs { flex-wrap: wrap; justify-content: flex-end; }

  .modal-form { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-inner { padding: 18px 16px; }
  .note-grid { grid-template-columns: minmax(0, 1fr); }
  .feed-row { flex-wrap: wrap; }
  .feed-time { margin-left: 35px; order: 3; flex-basis: 100%; }
  .composer-row select { flex: 1; }
}
