/* Tasklet — layout concept borrowed from DevHub (sidebar, dense task table, side panel), own palette. */

:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --surface-3: #e6e8ee;
  --line: #e4e6ec;
  --line-strong: #cfd3dc;
  --text: #1b1e26;
  --text-2: #4a5160;
  --muted: #6b7282;
  --accent: #5b5bd6;
  --accent-hover: #4b4bc4;
  --accent-soft: #ececfc;
  --accent-text: #4343b8;
  --danger: #c93a4b;
  --danger-soft: #fbeaec;

  --st-backlog: #646b7a;   --st-backlog-bg: #eef0f3;
  --st-todo: #2c5fbd;      --st-todo-bg: #e8f0fd;
  --st-in_progress: #8f5a06; --st-in_progress-bg: #fcf3e2;
  --st-done: #1a7149;      --st-done-bg: #e5f5ed;
  --st-cancelled: #686e7a; --st-cancelled-bg: #f1f2f4;
  --p-urgent: #c6334a; --p-high: #9c4f10; --p-medium: #646b7a; --p-low: #686e7a;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(20 24 36 / 0.05);
  --shadow-lg: 0 8px 24px rgb(20 24 36 / 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --row: 36px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121318;
    --surface: #181a20;
    --surface-2: #20232b;
    --surface-3: #2a2e38;
    --line: #2a2d36;
    --line-strong: #3a3e4a;
    --text: #e6e8ee;
    --text-2: #b8bdc8;
    --muted: #8e95a3;
    --accent: #7c7cf0;
    --accent-hover: #9090f5;
    --accent-soft: #272a4a;
    --accent-text: #a5a5ff;
    --danger: #f06b7b;
    --danger-soft: #3a1f25;
    --st-backlog: #9aa1ae;   --st-backlog-bg: #262931;
    --p-urgent: #f0677a; --p-high: #ec9a55; --p-medium: #a3aab7; --p-low: #858b97;
    --st-todo: #73a5f5;      --st-todo-bg: #1c2a42;
    --st-in_progress: #e6aa45; --st-in_progress-bg: #362a14;
    --st-done: #4cc28c;      --st-done-bg: #15322a;
    --st-cancelled: #7d828d; --st-cancelled-bg: #23252b;
    --shadow: none;
    --shadow-lg: 0 8px 24px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

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

html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }

input, textarea, select, button { font: inherit; color: inherit; }
input, textarea, select {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 32px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-2); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
button.small { min-height: 26px; padding: 0 8px; font-size: 12px; }
button:disabled { opacity: 0.6; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent-text); font-size: 12px; }
.link-btn:hover { background: none; text-decoration: underline; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, .key { font-family: var(--mono); }
.key { font-size: 11px; letter-spacing: 0.02em; color: var(--muted); white-space: nowrap; }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 0; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); padding: 2px 6px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 13px; }
.search input { width: 100%; background: var(--surface-2); border-color: transparent; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { margin: 12px 8px 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.nav-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text-2); }
.nav-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.nav-key { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.nav-project.open > .nav-link { color: var(--text); font-weight: 600; }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 12px; padding-left: 8px; border-left: 1px solid var(--line); }

.view { min-width: 0; }
.view[aria-busy="true"] { opacity: 0.6; transition: opacity 0.2s 0.15s; }
.page { padding: 24px 32px 48px; max-width: 1180px; }
.page-wide { max-width: none; }

.page-header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-header-text { flex: 1; min-width: 0; }
.overline { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-text); margin-bottom: 6px; }
.page-header h1 { font-size: 24px; font-weight: 650; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; }
.section-title { font-size: 15px; margin: 32px 0 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

/* ---------- pills & chips ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 0;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status-backlog { color: var(--st-backlog); }
.status-todo { color: var(--st-todo); }
.status-in_progress { color: var(--st-in_progress); }
.status-done { color: var(--st-done); }
.status-cancelled { color: var(--st-cancelled); }
.pill.status-backlog { background: var(--st-backlog-bg); }
.pill.status-todo { background: var(--st-todo-bg); }
.pill.status-in_progress { background: var(--st-in_progress-bg); }
.pill.status-done { background: var(--st-done-bg); }
.pill.status-cancelled { background: var(--st-cancelled-bg); }
.pill.prio-urgent { color: var(--p-urgent); background: var(--danger-soft); }
.pill.prio-high { color: var(--p-high); background: var(--surface-2); }
.pill.prio-medium { color: var(--p-medium); background: var(--surface-2); }
.pill.prio-low { color: var(--p-low); background: var(--surface-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Invisible editor: a native select that looks like a pill until hovered. */
select.pill-select {
  appearance: none;
  min-height: 0;
  padding: 0 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}
select.pill-select:hover { border-color: var(--line-strong); }
select.pill-select:disabled { opacity: 0.6; }
select.pill-select option { color: var(--text); background: var(--surface); }
.flash-error { animation: flash 0.4s; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--danger-soft); } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
}
.chip.removable button { min-height: 0; height: 16px; padding: 0 2px; border: 0; background: none; color: var(--muted); }
.chip.removable button:hover { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ---------- projects ---------- */

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.project-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}
.project-card:hover { border-color: var(--accent); text-decoration: none; }
.project-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; font-size: 15px; }
.stat-row { display: flex; gap: 16px; margin: 10px 0 6px; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stat b { color: var(--text); font-size: 14px; }
.project-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- tasks table ---------- */

.tasks-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.tasks-layout.with-panel { grid-template-columns: minmax(0, 1fr) minmax(420px, 46%); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: var(--radius-sm); }
.segmented button { min-height: 26px; padding: 0 10px; border: 0; background: transparent; color: var(--text-2); font-size: 12px; }
.segmented button:hover { background: var(--surface-3); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }
.segmented .count { font-size: 10px; color: var(--muted); }
.toolbar-select { min-height: 30px; font-size: 12px; }
.toolbar-search { width: 240px; min-height: 30px; font-size: 12px; }

.create-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.create-row input { flex: 1; border: 0; background: transparent; min-height: var(--row); }
.create-row input:focus-visible { outline: none; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.task-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 720px; }
.task-table th {
  height: 35px;
  padding: 0 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.task-table th.sortable button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.task-table th.sortable button:hover, .task-table th.sorted { color: var(--text); }
.task-table th.sortable button:focus-visible { outline: 2px solid var(--accent); border-radius: 3px; }
.sort-arrow { font-size: 11px; width: 10px; }
.task-table td { height: var(--row); padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-table tbody tr { cursor: pointer; }
.task-table tbody tr:hover { background: var(--surface-2); }
.task-table tbody tr.selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.task-table tbody tr:last-child td { border-bottom: 0; }
.task-table th:nth-child(1) { width: 92px; }
.task-table th:nth-child(3) { width: 128px; }
.task-table th:nth-child(4) { width: 116px; }
.task-table th:nth-child(5) { width: 150px; }
.task-table th:nth-child(6) { width: 150px; }
.task-table th:nth-child(7) { width: 104px; }
.col-title { font-weight: 500; }
.task-link { color: var(--text); }
.task-link:hover { color: var(--accent-text); }
.task-link.closed { color: var(--muted); }
.parent-ref { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-right: 6px; font-weight: 400; }
.col-labels .chip { margin-right: 4px; }
.col-updated { font-size: 12px; }

.with-panel .task-table th:nth-child(6), .with-panel .task-table td:nth-child(6),
.with-panel .task-table th:nth-child(7), .with-panel .task-table td:nth-child(7) { display: none; }
.with-panel .task-table { min-width: 520px; }

.side-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* ---------- task card ---------- */

.task-detail { container-type: inline-size; }
.td-panel { padding: 12px 20px 24px; }
.td-page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 28px 32px; }
.page-task .overline a { color: inherit; }

.td-bar { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.td-title {
  display: block;
  width: 100%;
  margin: 6px 0 4px;
  padding: 4px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.3;
  resize: none;
  overflow: hidden;
}
.td-title:hover { border-color: var(--line); }
.td-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }

.td-body { display: flex; flex-direction: column-reverse; gap: 20px; }
@container (min-width: 700px) {
  .td-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 28px; }
}

.td-section { padding: 14px 0; border-top: 1px solid var(--line); }
.td-section:first-child { border-top: 0; padding-top: 0; }
.td-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.td-section-head h2 { font-size: 13px; font-weight: 600; flex: 1; }

.td-props { background: var(--surface-2); border-radius: var(--radius); padding: 6px 12px 12px; }
.prop { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; min-height: 38px; gap: 8px; border-bottom: 1px solid var(--line); }
.prop:last-of-type { border-bottom: 0; }
.prop-label { font-size: 12px; color: var(--muted); }
.prop-value { min-width: 0; font-size: 13px; padding: 4px 0; }
.prop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding-top: 10px; }
.ghost-input { width: 100%; min-height: 28px; padding: 2px 6px; border-color: transparent; background: transparent; }
.ghost-input:hover { border-color: var(--line-strong); }
.parent-field { display: flex; align-items: center; gap: 4px; }
.chip-input { width: 90px; flex: 1; font-size: 12px; }

.ref-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; }
.ref-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; color: var(--text); border-bottom: 1px solid var(--line); }
.ref-row:last-child { border-bottom: 0; }
.ref-row:hover { background: var(--surface-2); text-decoration: none; }
.ref-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-title.closed { color: var(--muted); text-decoration: line-through; }
.ref-add input { width: 100%; border-style: dashed; background: transparent; }

.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.card.wide { max-width: none; }
.check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.check input { min-height: 0; margin: 0; }
.admin-table { margin-top: 0; }
.admin-table th, .admin-table td { white-space: nowrap; }
.matrix-cell { text-align: center !important; width: 64px; font-family: var(--mono); font-size: 11px; }
.matrix-cell input { min-height: 0; width: 16px; height: 16px; margin: 0; cursor: pointer; }
.disabled-row td { opacity: 0.55; }
.disabled-row td.actions { opacity: 1; }

.type-badge { display: inline-block; vertical-align: middle; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; }
.type-mcp { background: var(--st-todo-bg); color: var(--st-todo); }
.type-plugin { background: var(--st-done-bg); color: var(--st-done); }
.package-card p { margin: 6px 0 10px; }
.install-actions { flex-direction: column; align-items: flex-end; gap: 6px; }
.install-prompt { margin-bottom: 16px; }
.install-prompt p { margin: 0; }
.prompt-text { margin: 0; max-height: 320px; overflow: auto; white-space: pre-wrap; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; }
.package-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.package-readme { margin-bottom: 0; }
.package-readme .md { font-size: 14px; line-height: 1.6; }
.command-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.command-list code { font-size: 12px; }
@media (max-width: 900px) { .package-body { grid-template-columns: minmax(0, 1fr); } }

.comment-head { margin-bottom: 2px; }

/* ---------- markdown ---------- */

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; } .md h4 { font-size: 14px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 2px 0; }
.md li.task-item { list-style: none; margin-left: -20px; }
.md li.task-item > input { min-height: 0; margin: 0 6px 0 0; padding: 0; vertical-align: -2px; }
.md code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line-strong); padding-left: 12px; color: var(--text-2); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 10px; }
.md th { background: var(--surface-2); text-align: left; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md a.ref { font-family: var(--mono); font-size: 0.9em; }

.md-editor { display: flex; flex-direction: column; gap: 6px; }
.tabs { display: flex; gap: 4px; }
.tabs .tab { min-height: 26px; padding: 0 10px; font-size: 12px; border: 0; background: transparent; color: var(--muted); }
.tabs .tab.active { background: var(--surface-2); color: var(--text); }
.md-input { width: 100%; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.md-preview { min-height: 80px; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.md-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.md-actions .muted { margin-right: auto; }

/* ---------- wiki ---------- */

a.button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}
a.button:hover { background: var(--surface-2); text-decoration: none; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
a.button.primary:hover { background: var(--accent-hover); }

.wiki-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.wiki-tree { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.wiki-tree-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.wiki-tree ul { list-style: none; margin: 0; padding: 0; }
.tree-link { display: block; padding: 5px 8px 5px calc(8px + var(--depth) * 14px); border-radius: var(--radius-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.tree-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }

.wiki-content { min-width: 0; }
.wiki-page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 32px 28px; max-width: 900px; }
.wiki-page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.wiki-page-head h1 { font-size: 24px; font-weight: 650; }
.wiki-page .md { font-size: 15px; line-height: 1.65; }
.wiki-children { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.wiki-children h2 { font-size: 13px; margin-bottom: 6px; }
.wiki-children ul { margin: 0; padding-left: 18px; }
.wiki-page-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.wiki-title-input { width: 100%; font-size: 22px; font-weight: 650; margin: 4px 0 10px; border-color: transparent; padding-left: 0; }
.wiki-title-input:hover { border-color: var(--line); }
.wiki-parent { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

/* ---------- search ---------- */

.search-bar { display: flex; gap: 8px; margin-bottom: 20px; }
.search-big { flex: 1; min-height: 40px; font-size: 15px; }
.search-results { display: flex; flex-direction: column; gap: 24px; }
.hit-group h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.hit {
  display: block;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
}
.hit:hover { border-color: var(--accent); text-decoration: none; }
.hit-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.hit-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-kind { flex: none; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; }
.kind-task { background: var(--st-todo-bg); color: var(--st-todo); }
.kind-wiki { background: var(--st-done-bg); color: var(--st-done); }
.hit-snippet { margin: 4px 0 0; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.hit-snippet mark { background: var(--st-in_progress-bg); color: var(--text); border-radius: 2px; padding: 0 1px; }

/* ---------- users & auth ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: hsl(var(--hue) 55% 88%);
  color: hsl(var(--hue) 45% 28%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }
@media (prefers-color-scheme: dark) {
  .avatar { background: hsl(var(--hue) 35% 28%); color: hsl(var(--hue) 70% 85%); }
}
.user-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.user-label > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-label.big { gap: 12px; }
.user-label.big .avatar { width: 36px; height: 36px; font-size: 13px; }

.sidebar .account { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.account-user { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; }
.account-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.account-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-links { display: flex; flex-direction: column; gap: 2px; }
.account-links button { justify-content: flex-start; padding: 0 8px; min-height: 30px; font-size: 14px; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 28px 28px 24px; }
.auth-card .brand { padding: 0; margin-bottom: 20px; }
.auth-card h1 { font-size: 20px; }
.auth-card .subtitle { margin: 6px 0 18px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.field input { font-size: 14px; }
.form-error { margin: 0; min-height: 1em; color: var(--danger); font-size: 13px; }
.form-error:empty { display: none; }
button.wide { width: 100%; justify-content: center; min-height: 36px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; max-width: 820px; }
.section-title.first { margin-top: 0; }
.stack-form { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.stack-form button { align-self: flex-start; }
.plain-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
.plain-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.plain-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.plain-table td.actions { text-align: right; white-space: nowrap; }
.plain-table tr:last-child td { border-bottom: 0; }
.token-issued { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 14px; border: 1px solid var(--st-in_progress); background: var(--st-in_progress-bg); border-radius: var(--radius); }
.token-issued .ghost { align-self: flex-start; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; }
code { font-family: var(--mono); font-size: 0.9em; }

.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.col-assignee { font-size: 13px; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .tasks-layout.with-panel { grid-template-columns: minmax(0, 1fr); }
  .side-panel { position: static; max-height: none; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .search { flex: 1; }
  .nav { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .nav-heading { display: none; }
  .nav-sub { flex-direction: row; margin: 0; border: 0; }
  .page { padding: 16px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .toolbar-search { width: 100%; }
  .wiki-layout { grid-template-columns: minmax(0, 1fr); }
  .wiki-tree { position: static; max-height: none; }
  .wiki-page { padding: 16px; }
  .wiki-page-head { flex-direction: column; }
  input, textarea, select { font-size: 16px; }
}
