/* База знаний — стили интерфейса. Написаны вручную: без сборщиков, без внешних шрифтов и CDN.
   Светлая и тёмная темы — переменными; тёмная включается по системной настройке или вручную (data-theme). */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --surface-3: #e6e9f0;
  --border: #dcdfe6;
  --border-strong: #c3c9d4;
  --text: #1a1d24;
  --text-2: #444b5a;
  --muted: #687085;
  --accent: #3b5bdb;
  --accent-hover: #2f4cc4;
  --accent-soft: #e8edff;
  --on-accent: #ffffff;
  --on-solid: #ffffff;
  --ok: #1c7c4a;
  --ok-soft: #e1f4e9;
  --warn: #9a5700;
  --warn-soft: #fff1d6;
  --danger: #c2362b;
  --danger-soft: #fde7e5;
  --info-soft: #e8f0fe;
  --shadow-sm: 0 1px 2px rgb(20 24 34 / 8%);
  --shadow: 0 4px 16px rgb(20 24 34 / 10%);
  --shadow-lg: 0 18px 50px rgb(20 24 34 / 22%);
  --overlay: rgb(15 18 26 / 48%);
  --mark: #fff0a8;
  --cat-queued: #7b869b;
  --cat-active: #3b6fe0;
  --cat-review: #9b5de0;
  --cat-done: #1c7c4a;
  --cat-cancelled: #8d94a3;
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1b2029;
    --surface-3: #252b36;
    --border: #2a313c;
    --border-strong: #3a4352;
    --text: #e8ebf1;
    --text-2: #b9c0cc;
    --muted: #8f98a8;
    --accent: #7b97ff;
    --accent-hover: #98acff;
    --accent-soft: #1f2947;
    --on-accent: #0b0e14;
    --on-solid: #0b0e14;
    --ok: #4fcf8a;
    --ok-soft: #112d1e;
    --warn: #e8a94d;
    --warn-soft: #33260f;
    --danger: #ff7b70;
    --danger-soft: #3a1815;
    --info-soft: #172338;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow: 0 4px 16px rgb(0 0 0 / 40%);
    --shadow-lg: 0 18px 50px rgb(0 0 0 / 60%);
    --overlay: rgb(0 0 0 / 62%);
    --mark: #5a4a00;
    --cat-queued: #8e99ae;
    --cat-active: #6b94ff;
    --cat-review: #b684f0;
    --cat-done: #4fcf8a;
    --cat-cancelled: #7c8493;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1b2029;
  --surface-3: #252b36;
  --border: #2a313c;
  --border-strong: #3a4352;
  --text: #e8ebf1;
  --text-2: #b9c0cc;
  --muted: #8f98a8;
  --accent: #7b97ff;
  --accent-hover: #98acff;
  --accent-soft: #1f2947;
  --on-accent: #0b0e14;
  --on-solid: #0b0e14;
  --ok: #4fcf8a;
  --ok-soft: #112d1e;
  --warn: #e8a94d;
  --warn-soft: #33260f;
  --danger: #ff7b70;
  --danger-soft: #3a1815;
  --info-soft: #172338;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow: 0 4px 16px rgb(0 0 0 / 40%);
  --shadow-lg: 0 18px 50px rgb(0 0 0 / 60%);
  --overlay: rgb(0 0 0 / 62%);
  --mark: #5a4a00;
  --cat-queued: #8e99ae;
  --cat-active: #6b94ff;
  --cat-review: #b684f0;
  --cat-done: #4fcf8a;
  --cat-cancelled: #7c8493;
  color-scheme: dark;
}

/* --- основа ------------------------------------------------------------------------------ */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }
code { font-size: .92em; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
img { max-width: 100%; }
time { white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: .86em; }
.center { text-align: center; }
.spacer { flex: 1 1 auto; }
.pad { padding: 14px; }
.mono { font-family: var(--mono); }
.offscreen { position: fixed; top: -1000px; left: 0; opacity: 0; pointer-events: none; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.hide-sm { }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.boot, .loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 16px; color: var(--muted); }
.loading { padding: 24px 16px; }

.spinner {
  display: inline-block; width: 18px; height: 18px; flex: none;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } * { scroll-behavior: auto !important; } }

.icon { flex: none; vertical-align: -0.15em; }

/* --- кнопки ------------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-solid); }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: .92em; }
.btn.lg { min-height: 44px; padding: 0 20px; font-size: 1.05em; }
.btn.block { display: flex; width: 100%; }
.btn.toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

/* --- формы ------------------------------------------------------------------------------- */

.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.textarea { resize: vertical; line-height: 1.5; min-height: 80px; }
.input.lg { min-height: 44px; font-size: 1.05em; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--muted); }
.select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a5' stroke-width='3' 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 10px center; }
.select.inline-select { min-height: 30px; padding-top: 2px; padding-bottom: 2px; width: auto; max-width: 100%; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.title-input { font-size: 1.4rem; font-weight: 650; min-height: 44px; }
.code-input { font-family: var(--mono); font-size: 13px; line-height: 1.55; tab-size: 2; white-space: pre-wrap; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-weight: 600; font-size: .92em; color: var(--text-2); }
.field-hint { color: var(--muted); font-size: .86em; }
.field-error { color: var(--danger); font-size: .92em; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.form-actions.spread { justify-content: space-between; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; }
.inline-field .select { width: auto; min-height: 32px; }
.input-group { display: flex; align-items: center; gap: 4px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.more { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 8px 12px; }
.more > summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.more[open] > summary { margin-bottom: 12px; }
.more .field { margin-bottom: 12px; }

.search-field { position: relative; flex: 1 1 220px; min-width: 160px; max-width: 420px; display: flex; align-items: center; }
.search-field > .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-field .input { padding-left: 34px; }
.search-field.big { max-width: none; }
.search-field.big .input { padding-left: 40px; }
.search-field.big > .icon { left: 12px; }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg { border: 0; background: transparent; padding: 4px 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 550; font-size: .92em; }
.seg:hover { color: var(--text); }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* --- шапка ------------------------------------------------------------------------------- */

.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: var(--topbar-h); padding: 8px 20px; max-width: 1480px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); flex: none; }
.project-select { width: auto; min-width: 150px; max-width: 240px; min-height: 34px; }
.topbar-search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 140px; }
.topbar-search > .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.topbar-search .input { padding-left: 32px; min-height: 34px; background: var(--surface-2); }
.user-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; color: var(--text); }
.user-btn:hover { background: var(--surface-3); }
.user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); min-width: 230px; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.dropdown-menu.align-right { right: 0; }
.dropdown-menu.align-left { left: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; color: var(--text); border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-item.danger { color: var(--danger); }
.menu-title { display: flex; flex-direction: column; padding: 6px 10px 8px; }
.menu-label { padding: 4px 10px; font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* --- страница ---------------------------------------------------------------------------- */

.main { padding: 22px 20px 60px; outline: none; }
.page { max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.narrow { max-width: 680px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 20px; }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); margin-bottom: 12px; font-size: .92em; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .6; }
.crumbs span:last-child { color: var(--text-2); font-weight: 550; }

.project-head { margin-bottom: 16px; }
.project-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.project-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.back-link { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; color: var(--muted); }
.back-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.prefix-pill { font-family: var(--mono); font-size: .8em; font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 6px; letter-spacing: .03em; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-soft); border: 1px solid transparent; margin-bottom: 14px; }
.callout > .icon { margin-top: 2px; }
.callout p { margin: .4em 0; }
.callout.warn { background: var(--warn-soft); color: var(--text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.warn > .icon { color: var(--warn); }
.callout.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.callout.danger > .icon { color: var(--danger); }
.callout.info > .icon { color: var(--accent); }

.empty { text-align: center; padding: 56px 20px; max-width: 520px; margin: 0 auto; color: var(--text-2); }
.empty h3 { margin: 10px 0 6px; font-size: 1.15rem; color: var(--text); }
.empty p { color: var(--muted); }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.empty.error .empty-icon { background: var(--danger-soft); color: var(--danger); }
.empty .row { margin-top: 14px; }

/* --- значки ------------------------------------------------------------------------------ */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .8em; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.muted { background: var(--surface-3); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.shelf { background: var(--surface-3); color: var(--text-2); font-weight: 550; }
.badge.access-responsible { background: var(--ok-soft); color: var(--ok); }
.badge.access-admin { background: var(--ok-soft); color: var(--ok); }
.badge.access-read { background: var(--surface-3); color: var(--text-2); }
.badge.intent-blocker { background: var(--danger-soft); color: var(--danger); }
.badge.intent-review { background: color-mix(in srgb, var(--cat-review) 18%, transparent); color: var(--cat-review); }
.badge.intent-progress { background: var(--info-soft); color: var(--cat-active); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .86em; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip .dot, .col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--cat-queued)); flex: none; }
.cat-queued { --c: var(--cat-queued); }
.cat-active { --c: var(--cat-active); }
.cat-review { --c: var(--cat-review); }
.cat-done { --c: var(--cat-done); }
.cat-cancelled { --c: var(--cat-cancelled); }
.chip[class*="cat-"] { background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 78%, var(--text)); }

.prio-low { --pc: var(--muted); }
.prio-normal { --pc: var(--cat-active); }
.prio-high { --pc: #d9730d; }
.prio-urgent { --pc: #d6382b; }
.prio-prod_fire { --pc: #d6382b; }
.prio { display: inline-flex; align-items: center; gap: 4px; color: var(--pc, var(--muted)); font-weight: 600; font-size: .9em; white-space: nowrap; }
.prio.prio-prod_fire { background: var(--danger-soft); padding: 1px 8px; border-radius: 999px; }
.type { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 600; font-size: .9em; white-space: nowrap; }
.type-defect { color: var(--danger); }
.type-epic { color: var(--cat-review); }

.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--s, 24px); height: var(--s, 24px); border-radius: 50%; font-size: calc(var(--s, 24px) * .4); font-weight: 700; color: #fff; background: hsl(var(--h, 220) 45% 46%); letter-spacing: .02em; user-select: none; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.user-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: .86em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.key { font-family: var(--mono); font-size: .88em; font-weight: 700; color: var(--text-2); white-space: nowrap; }
a.key { color: var(--accent); }
.slug { color: var(--muted); font-size: .84em; }

/* --- окна и тосты ------------------------------------------------------------------------ */

.backdrop { position: fixed; inset: 0; z-index: 80; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); outline: none; animation: pop .14s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.modal-head h2 { font-size: 1.15rem; }
.modal-body { padding: 16px 20px 20px; }
.modal-text { margin: 0 0 16px; color: var(--text-2); white-space: pre-line; }
.token-box { display: block; padding: 12px 14px; margin: 12px 0 4px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); word-break: break-all; user-select: all; font-size: .95em; }

.toasts { position: fixed; z-index: 120; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .18s; }
.toast .icon { margin-top: 2px; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .icon-btn { color: inherit; opacity: .7; width: 24px; height: 24px; }
.toast .icon-btn:hover { background: rgb(128 128 128 / 25%); color: inherit; opacity: 1; }
.toast .btn.ghost { color: inherit; border-color: rgb(128 128 128 / 45%); }
.toast-error { background: var(--danger); color: var(--on-solid); }
.toast-success { background: var(--ok); color: var(--on-solid); }

/* --- разделы (карточки) ------------------------------------------------------------------ */

.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.project-card { position: relative; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; transition: border-color .12s, box-shadow .12s, transform .12s; }
.project-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.project-card.is-dim { opacity: .75; }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-top h3 { font-size: 1.1rem; }
.pc-top h3 a { color: var(--text); }
.pc-top h3 a:hover { text-decoration: none; color: var(--accent); }
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: var(--radius); }
.pc-desc { margin: 0; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.pc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-hub { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; white-space: nowrap; cursor: pointer; }
.pc-hub .switch[aria-checked="true"] { background: var(--warn); }
.pc-links { position: relative; z-index: 1; display: flex; gap: 14px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.pc-links a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 550; font-size: .92em; }
.pc-links a:hover { color: var(--accent); text-decoration: none; }

/* --- доска ------------------------------------------------------------------------------- */

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .select { width: auto; min-width: 140px; max-width: 220px; min-height: 34px; }
.toolbar .search-field .input { min-height: 34px; }

.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 14px; }
.col { flex: 1 1 290px; min-width: 270px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 270px); min-height: 160px; }
.col.collapsed { flex: 0 0 46px; min-width: 46px; min-height: 0; background: var(--surface); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 14px; }
.col-head h2 { font-size: .86rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.col-head .count { font-size: .82em; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 0 8px; min-width: 22px; text-align: center; }
.col-head .count:empty { display: none; }
.col-body { overflow-y: auto; padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.col-empty { text-align: center; color: var(--muted); padding: 22px 8px; border: 1px dashed var(--border-strong); border-radius: 10px; font-size: .92em; }
.col-toggle { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; padding: 12px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--radius); }
.col-toggle:hover { background: var(--surface-2); color: var(--text); }
.col-name { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }

.task-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--pc, var(--border)); border-radius: 10px; color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; }
.task-card.prio-low, .task-card.prio-normal { border-left-color: var(--border-strong); }
.task-card:hover { text-decoration: none; border-color: var(--accent); border-left-color: var(--pc, var(--accent)); box-shadow: var(--shadow); transform: translateY(-1px); }
.tc-top { display: flex; align-items: center; gap: 8px; }
.tc-title { font-weight: 550; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88em; }
.tc-meta .user-chip { max-width: 55%; }

/* --- карточка задачи --------------------------------------------------------------------- */

.task-head { margin-bottom: 18px; }
.key-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.key-copy { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; padding: 2px 6px; border-radius: 6px; color: var(--muted); }
.key-copy:hover { background: var(--surface-3); color: var(--text); }
.key-copy .key { font-size: 1rem; }
.title-row { display: flex; align-items: flex-start; gap: 6px; }
.task-title { overflow-wrap: anywhere; }
.title-row .title-input { flex: 1; }
.status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.transitions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-left: 4px; padding-left: 14px; border-left: 1px solid var(--border-strong); }
.transition .hint { opacity: .6; }
.transition.to-done { border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.transition.to-done:hover { background: var(--ok-soft); }
.transition.to-cancelled { color: var(--muted); }

.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.task-main, .task-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section { padding: 16px 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 1rem; }

.kv { margin: 0; display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); align-items: center; }
.kv-row:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); font-size: .9em; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.rel-list, .link-list, .result-list, .versions { list-style: none; margin: 0; padding: 0; }
.rel-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.rel-list li:first-child { border-top: 0; }
.rel-title { color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; padding: 9px 0; border-top: 1px solid var(--border); }
.link-item:first-child { border-top: 0; padding-top: 0; }
.link-kind { grid-column: 1 / -1; font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.link-target { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.link-target .rel-title { flex: 0 1 auto; white-space: normal; }
.link-add { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; margin-top: 12px; }
.link-add .select { min-height: 32px; width: auto; max-width: 130px; }
.link-add .input { min-height: 32px; }

/* блок «Код» в карточке задачи */
.code-stages { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; font-size: .92em; }
.code-stage { display: inline-flex; align-items: center; gap: 4px; }
.code-add { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 6px; margin-top: 12px; }
.code-add .select { min-height: 32px; width: auto; max-width: 120px; }
.code-add .input { min-height: 32px; }
@media (max-width: 560px) { .code-add { grid-template-columns: 1fr 1fr; } .code-add .input { grid-column: 1 / -1; } }

/* комментарии */
.comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.comment { display: flex; gap: 12px; }
.comment.nested { margin-left: 44px; padding-left: 12px; border-left: 2px solid var(--border); }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.comment-actions { display: flex; gap: 14px; margin-top: 4px; }
.comment-form { border-top: 1px solid var(--border); padding-top: 14px; }
.comment-form .form-actions { margin-top: 10px; }
.reply-note { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 8px; background: var(--accent-soft); color: var(--accent); border-radius: 8px; font-size: .92em; }

/* история */
.history > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; color: var(--text-2); }
.history > summary::-webkit-details-marker { display: none; }
.history > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.history[open] > summary::after { transform: rotate(-135deg); }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.tl-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--border-strong); }
.tl-detail { overflow-wrap: anywhere; }

/* редактор markdown */
.md-editor { display: flex; flex-direction: column; gap: 6px; }
.md-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.md-input { min-height: 130px; }
.md-preview { min-height: 130px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

/* --- markdown и серверный HTML ----------------------------------------------------------- */

.prose { overflow-wrap: anywhere; line-height: 1.6; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin: 1.4em 0 .5em; line-height: 1.3; }
.prose h1 { font-size: 1.5rem; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.prose h2 { font-size: 1.25rem; padding-bottom: .25em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.1rem; }
.prose h4, .prose h5, .prose h6 { font-size: 1rem; }
.prose p { margin: 0 0 .8em; }
.prose ul, .prose ol { margin: 0 0 .8em; padding-left: 1.5em; }
.prose li > ul, .prose li > ol { margin: .2em 0; }
.prose li.task-item { list-style: none; margin-left: -1.2em; }
.prose li.task-item input { margin-right: 6px; accent-color: var(--accent); }
.prose code { background: var(--surface-3); padding: .1em .35em; border-radius: 5px; }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin: 0 0 1em; line-height: 1.5; }
.prose pre code { background: none; padding: 0; font-size: .88em; }
.prose blockquote { margin: 0 0 1em; padding: 2px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.prose table { border-collapse: collapse; margin: 0 0 1em; min-width: 50%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 650; }
.prose .al-center { text-align: center; }
.prose .al-right { text-align: right; }
.prose .table-wrap { overflow-x: auto; }
.prose a.task-ref { font-family: var(--mono); font-weight: 650; font-size: .92em; }
.prose img { border-radius: 6px; }

/* --- документы --------------------------------------------------------------------------- */

.docs-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.docs-tree { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 36px); overflow: hidden; display: flex; flex-direction: column; }
.tree-tools { padding: 10px; border-bottom: 1px solid var(--border); }
.tree-tools .search-field { max-width: none; }
.tree { overflow-y: auto; padding: 8px; flex: 1; }
.tree-children { margin-left: 12px; padding-left: 6px; border-left: 1px solid var(--border); }
.tree-folder, .tree-doc { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 8px; border: 0; background: transparent; color: var(--text); border-radius: 7px; text-align: left; cursor: pointer; min-height: 30px; }
.tree-folder:hover, .tree-doc:hover { background: var(--surface-2); text-decoration: none; }
.tree-folder { font-weight: 600; color: var(--text-2); }
.tree-folder .count { margin-left: auto; font-size: .8em; color: var(--muted); font-weight: 500; }
.tree-doc { color: var(--text); }
.tree-doc .icon { color: var(--muted); }
.tree-doc.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree-doc.active .icon { color: var(--accent); }
.tree-label { min-width: 0; display: flex; flex-direction: column; overflow: hidden; text-overflow: ellipsis; }
.tree-label .tree-path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.tree-toggle { display: none; margin-bottom: 10px; }

.docs-main { min-width: 0; }
.docs-view { padding: 22px 28px; min-height: 360px; }
.doc-head { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.doc-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.doc-title-row h1 { overflow-wrap: anywhere; }
.doc-title-row .title-input { flex: 1 1 320px; min-width: 0; }
.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.path { background: var(--surface-3); padding: 1px 8px; border-radius: 6px; color: var(--text-2); font-size: .85em; }
.doc-body { font-size: 15px; max-width: 880px; }
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.editor-pane { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.editor-pane .code-input { min-height: 62vh; flex: 1; }
.pane-label { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.doc-preview { padding: 10px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); min-height: 62vh; overflow: auto; max-height: 75vh; }
.conflict { margin-bottom: 14px; }
.conflict .callout { margin: 0; }
.conflict .row { margin-top: 8px; }
.plain-pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; max-height: 50vh; overflow: auto; white-space: pre-wrap; font-size: .88em; }
.versions li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.versions li:first-child { border-top: 0; }
.ver-no { font-family: var(--mono); font-weight: 700; color: var(--accent); min-width: 36px; }

/* --- поиск ------------------------------------------------------------------------------- */

.search-form { display: flex; gap: 10px; margin-bottom: 14px; }
.results { margin-top: 12px; }
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result { display: block; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.result:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-sm); }
.result-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88em; }
.result-kind { margin-left: auto; text-transform: uppercase; letter-spacing: .05em; font-size: .8em; font-weight: 650; }
.result-title { font-weight: 650; font-size: 1.02rem; margin: 3px 0; overflow-wrap: anywhere; }
.result-snippet { color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.search-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.search-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.search-kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.check.inline { display: inline-flex; align-items: center; gap: 6px; }
.check.inline input { margin-top: 0; }
.check.is-dim { opacity: .55; cursor: not-allowed; }
.search-k { display: inline-flex; align-items: center; gap: 8px; }
.search-k .input { width: 76px; min-height: 34px; }
/* режим «Векторы»: таблица кусков; узкий экран — карточками, как все таблицы (без горизонтальной прокрутки страницы) */
.table.vec-table td { vertical-align: top; }
.vec-score { white-space: nowrap; font-weight: 650; }
.vec-src, .vec-chunk { min-width: 140px; max-width: 260px; overflow-wrap: anywhere; }
.vec-frag { min-width: 260px; }
.vec-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92em; color: var(--text-2); }
.vec-text.clip { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.vec-more { margin-top: 4px; }

/* --- таблицы ----------------------------------------------------------------------------- */

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tr.current td { background: var(--accent-soft); }
.table tr.is-dim td { opacity: .6; }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.cell-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- участники раздела ------------------------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack > :empty { display: none; }
.pick-list { max-height: 240px; overflow-y: auto; margin: 10px 0 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.pick-item:first-child { border-top: 0; }
.pick-item:hover { background: var(--surface-2); }
.pick-item.on { background: var(--accent-soft); }
.pick-item input { flex: none; margin: 0; accent-color: var(--accent); }
.pick-item .user-chip { flex: 1 1 auto; }
.pick-login { flex: none; margin-left: auto; }

/* --- вход -------------------------------------------------------------------------------- */

.page-login { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 440px; padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand .logo { width: 48px; height: 48px; border-radius: 13px; }
.login-brand h1 { font-size: 1.35rem; }
.login-brand p { margin: 2px 0 0; }

/* --- адаптив ----------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .task-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-tree { position: static; max-height: 46vh; }
  .docs-layout.has-doc .docs-tree { display: none; }
  .docs-layout.has-doc.tree-open .docs-tree { display: flex; }
  .tree-toggle { display: inline-flex; }
  .docs-layout:not(.has-doc) .tree-toggle { display: none; }
  .editor-split { grid-template-columns: minmax(0, 1fr); }
  .editor-pane .code-input { min-height: 46vh; }
  .doc-preview { min-height: 0; max-height: none; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .main { padding: 14px 12px 48px; }
  .topbar-inner { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .brand-text, .user-name, .hide-sm { display: none; }
  .project-select { flex: 1 1 140px; max-width: none; }
  .topbar-search { order: 10; flex: 1 1 100%; max-width: none; }
  .spacer { flex: 0 0 0; }
  .topbar-inner > .dropdown:last-child { margin-left: auto; }
  h1 { font-size: 1.35rem; }

  .input, .select, .textarea { font-size: 16px; } /* iOS не приближает страницу при фокусе */
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar .select { flex: 1 1 130px; max-width: none; }
  .toolbar .search-field { flex: 1 1 100%; max-width: none; }

  .board { flex-direction: column; overflow: visible; align-items: stretch; }
  .col { flex: none; width: 100%; max-height: none; min-width: 0; }
  .col-body { overflow: visible; }
  .col.collapsed { flex: none; min-width: 0; }
  .col-toggle { flex-direction: row; justify-content: flex-start; padding: 12px 14px; }
  .col-name { writing-mode: horizontal-tb; transform: none; }

  .section { padding: 14px; }
  .docs-view { padding: 16px 14px; }
  .doc-body { font-size: 16px; }
  .kv-row { grid-template-columns: 96px minmax(0, 1fr); }
  .transitions { margin-left: 0; padding-left: 0; border-left: 0; }
  .comment.nested { margin-left: 20px; }
  .search-form { flex-direction: column; }
  .search-form .search-field { flex: none; } /* в колонке основа 220px стала бы высотой поля */
  .vec-src, .vec-chunk, .vec-frag { min-width: 0; max-width: none; }
  .md-hint { display: none; }

  .backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 18px 18px 0 0; max-height: 94vh; overflow-y: auto; }
  .toasts { right: 12px; left: 12px; bottom: 12px; width: auto; }

  /* таблицы превращаются в карточки */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-top: 1px solid var(--border); }
  .table tbody tr:first-child { border-top: 0; }
  .table td { padding: 3px 0; border: 0 !important; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85em; }
  .table td.actions { text-align: left; width: 100%; padding-top: 8px; }
  .table td.actions .dropdown-menu { right: auto; left: 0; }
}

@media print {
  .topbar, .toasts, .tabs, .toolbar, .docs-tree, .btn, .icon-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; }
  .docs-layout { display: block; }
}

/* --- входящие, напоминания, история работы ----------------------------------------------- */

.bell { position: relative; width: 36px; height: 36px; color: var(--text-2); }
.bell.on { background: var(--accent-soft); color: var(--accent); }
.bell.has-new { color: var(--text); }
.bell-count {
  position: absolute; top: 0; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; background: var(--danger); color: var(--on-solid); border: 2px solid var(--surface);
  font-size: 10.5px; font-weight: 700; line-height: 14px; text-align: center; pointer-events: none;
}
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .82em; font-weight: 700; }
.tab.active .tab-count { background: var(--accent); color: var(--on-accent); }
.inbox-tabs { margin-bottom: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }

.inbox-list, .feed { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }

.rcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--border-strong); }
.rcard.r-unread { border-left-color: var(--accent); }
.rcard.overdue { border-left-color: var(--danger); }
.rcard.r-read, .rcard.r-dismissed { opacity: .82; }
.r-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rem-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.02em; }
.r-meta { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.r-meta .row { gap: 6px; }
.rem-due { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: .92em; }
.rem-due.overdue { color: var(--danger); font-weight: 600; }
.entity-link { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.entity-title { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rcard .form-actions { justify-content: flex-start; margin-top: 2px; }

/* лента шагов */
.feed-day { font-size: .86em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin: 8px 0 -2px; }
.feed-day:first-child { margin-top: 0; }
.history-filters { align-items: center; }
.history-filters .input { width: auto; min-width: 150px; min-height: 34px; flex: 0 1 200px; }
.history-filters .select { flex: 0 1 220px; }
.step { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-sm); }
.step-decision { border-left-color: var(--ok); }
.step-pitfall { border-left-color: var(--danger); }
.step-progress { border-left-color: var(--cat-active); }
.step-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-bottom: 6px; }
.step-session { display: inline-flex; align-items: center; gap: 4px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-body { font-size: .98em; }
.step-meta { margin-top: 8px; }
.step-meta summary { cursor: pointer; }
.step-meta .plain-pre { max-height: 240px; overflow: auto; margin: 6px 0 0; }
.feed.compact { gap: 8px; margin-bottom: 0; }
.feed.compact .step { box-shadow: none; padding: 10px 14px; }
.session-summary { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

.inbox-toolbar .segmented { max-width: 100%; overflow-x: auto; }
.inbox-toolbar .seg { white-space: nowrap; }

@media (max-width: 760px) {
  .project-select { flex-basis: 100px; min-width: 100px; } /* место под значок «Входящие» в одной строке шапки */
  .rcard { padding: 12px; }
  .history-filters .input, .history-filters .select { flex: 1 1 140px; max-width: none; }
  .step { padding: 10px 12px; }
  .step-session { max-width: 100%; }
  .inbox-tabs { margin-bottom: 10px; }
}

/* --- груминги, вопросы и решения ---------------------------------------------------------- */

.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* список грумингов */
.g-table td.g-cell-title { min-width: 260px; }
.g-title { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
a.g-title:hover { color: var(--accent); }
.g-parent { display: inline-flex; align-items: center; gap: 6px; }

/* карточка груминга */
.g-head { margin-bottom: 14px; }
.g-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: 4px; padding-left: 14px; border-left: 1px solid var(--border-strong); }
.g-actions:empty { display: none; }
.g-notices { display: flex; flex-direction: column; }
.g-notices:empty { display: none; }
.g-notices .callout { margin-bottom: 14px; }
.g-note { white-space: pre-wrap; overflow-wrap: anywhere; margin: .4em 0 0; }
.g-sections { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.g-sections:empty { display: none; }
.g-section .section-head { flex-wrap: wrap; }
.g-add-section { display: flex; }
.g-hint { margin: 0 0 8px; }
.g-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-parts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.g-part { display: inline-flex; align-items: center; gap: 4px; }
.g-part .icon-btn { width: 22px; height: 22px; }
.g-children { display: flex; flex-direction: column; gap: 4px; }
.g-links { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.g-ver-sec { margin-bottom: 14px; }
.g-ver-sec h3 { margin-bottom: 4px; }
.g-reasons { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.g-reasons li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--warn-soft); }
.g-reasons li > .icon { color: var(--warn); margin-top: 3px; }
.g-reason-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.g-flash { animation: g-flash 1.8s ease-out; }
@keyframes g-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.g-picker { display: flex; flex-direction: column; gap: 8px; }
.g-picker-body { display: flex; flex-direction: column; gap: 6px; }
.g-person { display: block; }
.g-diff { padding: 8px 0; }
.g-diff > div { padding: 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.g-diff-sign { display: inline-block; width: 1.4em; color: var(--muted); user-select: none; }
.g-diff-add { background: var(--ok-soft); }
.g-diff-del { background: var(--danger-soft); }

/* разбиение */
.g-split input.g-ref { width: 100px; }
.g-split td { vertical-align: top; }
.g-split .select, .g-split .input { min-height: 32px; }
.g-split .g-col-title { min-width: 220px; }
.g-split .g-col-def { text-align: center; }
.g-split .g-col-def input { width: 18px; height: 18px; accent-color: var(--accent); }
.g-split td.actions { white-space: nowrap; }
.g-split tr.g-split-more td { padding: 0 14px 14px; background: var(--surface-2); }
.g-more { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.g-blocks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.is-bad { border-color: var(--danger) !important; outline: 2px solid var(--danger); outline-offset: -1px; }

/* вопросы */
.q-list { display: flex; flex-direction: column; gap: 12px; }
.q-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border-strong)); border-radius: var(--radius); }
.q-open { --c: var(--cat-active); }
.q-answered { --c: var(--cat-review); }
.q-applied, .q-defaulted, .q-decided_directly { --c: var(--cat-done); }
.q-withdrawn, .q-superseded { --c: var(--cat-cancelled); }
.q-withdrawn, .q-superseded { opacity: .75; }
.q-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-title { font-size: 1.02rem; overflow-wrap: anywhere; }
.q-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.q-text, .q-explain .prose { font-size: .96em; }
.q-label { font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 2px; }
.q-explain { padding-left: 10px; border-left: 2px solid var(--border); }
.q-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.q-options li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px; }
.q-options li.is-chosen { font-weight: 550; }
.q-mark { color: var(--ok); }
.q-default, .q-note { display: block; }
.q-answer { padding: 8px 12px; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); }
.q-answer.is-default { border-left-color: var(--warn); }
.q-answer-text { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 550; }
.q-answer-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.q-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.q-form { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.q-choose { display: flex; flex-direction: column; gap: 6px; }
.q-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 12px; text-align: left; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }
.q-opt:hover { background: var(--surface-2); }
.q-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.q-opt-dot { flex: none; width: 16px; height: 16px; margin-top: 2px; border: 2px solid var(--border-strong); border-radius: 50%; }
.q-opt.on .q-opt-dot { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 45%, transparent 50%); }
.q-own-more { padding: 6px 10px; }
.q-rows { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.q-row { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.q-row-n { flex: none; width: 22px; padding-top: 6px; text-align: right; color: var(--muted); font-weight: 650; }
.q-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.q-rec { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

/* ссылки на решения */
.g-dec { font-family: var(--mono); font-weight: 700; font-size: .88em; padding: 1px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.g-dec:hover { text-decoration: none; filter: brightness(.96); }
.g-dec.is-old { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }

/* журнал решений */
.dec-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.dec-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dec-card.is-old { border-left-color: var(--cat-cancelled); }
.dec-card.is-old .dec-title { color: var(--text-2); }
.dec-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dec-num { font-family: var(--mono); font-weight: 750; font-size: 1.05rem; padding: 1px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.dec-num:hover { text-decoration: none; filter: brightness(.96); }
.dec-card.is-old .dec-num { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.dec-title { font-size: 1.05rem; overflow-wrap: anywhere; }
.dec-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dec-chain:empty { display: none; }

@media (max-width: 760px) {
  .g-actions { margin-left: 0; padding-left: 0; border-left: 0; }
  .g-split .g-col-title { min-width: 0; }
  .g-split input.g-ref { width: 100%; }
  .q-card { padding: 12px; }
  .q-row-n { display: none; }
  .g-table td.g-cell-title { min-width: 0; }
  .g-split tr.g-split-more td { padding: 0 14px 14px; }
}
.q-opt-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.q-opt-cons { font-weight: 400; }
.q-mark { width: 16px; height: 16px; margin-top: 3px; border: 2px solid var(--border-strong); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.q-mark.on { border-color: var(--ok); background: var(--ok-soft); }
.q-mark .icon { width: 10px; height: 10px; }
.g-split .g-col-title input { min-width: 220px; }
.g-split td:nth-child(3) .select { min-width: 112px; }
.g-split td:nth-child(4) .select { min-width: 150px; }
.g-split td:nth-child(5) .input { min-width: 120px; }
.g-split td:nth-child(6) .select { min-width: 132px; }
@media (max-width: 760px) {
  .g-split .g-col-title input, .g-split td .select, .g-split td .input { min-width: 0 !important; width: 100%; }
}
@media (max-width: 760px) { .g-split .g-col-def { text-align: left; } }

/* --- уведомления во «Входящих» ------------------------------------------------------------ */

.ncard { position: relative; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--border-strong); }
.ncard.n-unread { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.ncard.n-read { opacity: .86; }
.ncard.n-hidden { border-left-style: dashed; }
.ncard.n-hidden .n-title { color: var(--muted); font-weight: 550; }
.n-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.n-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.n-title { font-weight: 650; overflow-wrap: anywhere; color: var(--text); }
a.n-title:hover { color: var(--accent); text-decoration: none; }
/* вся карточка — зона клика; вторичные ссылки и кнопки (.n-act) лежат выше */
.n-title.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.n-title.stretched:focus-visible { outline: none; }
.n-title.stretched:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.ncard .n-act { position: relative; z-index: 1; }
.n-text { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.n-meta { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; }
.n-entity { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.n-entity .key { font-family: var(--mono); font-weight: 650; color: var(--text-2); }
.n-bar { gap: 6px; }
.inbox-toolbar { align-items: center; }

/* --- работы по расписанию ----------------------------------------------------------------- */

.jobs-table td { vertical-align: top; }
.job-name { font-weight: 650; }
.job-cron { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.job-last { gap: 8px; }
.job-actions { gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.job-out { margin-top: 4px; max-width: 460px; max-height: 7.5em; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); font-size: .88em; }
.job-out.is-error { color: var(--danger); font-family: var(--mono); font-size: .82em; }
.jobs-table td:last-child { white-space: nowrap; }

.repos-table td { vertical-align: top; }
.repo-name { font-weight: 600; overflow-wrap: anywhere; }
.repo-err { margin-top: 4px; max-width: 520px; max-height: 7.5em; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--danger); font-family: var(--mono); font-size: .82em; }
.repo-services { display: flex; flex-wrap: wrap; gap: 4px; }
.badge.is-skipped { opacity: .65; text-decoration: line-through; }
.repo-admin { margin-bottom: 14px; }

.switch { position: relative; display: inline-flex; flex: none; width: 40px; height: 22px; padding: 0; border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: background .12s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 30%); transition: transform .12s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:disabled { opacity: .55; cursor: progress; }

@media (max-width: 760px) {
  .ncard { padding: 10px 12px; }
  .job-actions { flex-wrap: wrap; justify-content: flex-start; }
  .job-out { max-width: 100%; }
  .jobs-table td:last-child { white-space: normal; }
  .repo-err { max-width: 100%; }
  .inbox-toolbar { gap: 8px; }
  .inbox-toolbar .spacer { flex: 1 1 100%; }
  .n-bar { flex-wrap: wrap; }
}

/* --- правила раздела (доктрины, АР11) ------------------------------------------------------ */

.rule-list { display: flex; flex-direction: column; gap: 22px; margin-bottom: 14px; }
.rule-group-head { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.rule-group-head h2 { font-size: 1.05rem; }
.rule-group-binding .rule-group-head h2 { color: var(--danger); }
.rule-cards { display: flex; flex-direction: column; gap: 12px; }
.rule-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.rule-card.is-binding { border-left-color: var(--danger); }
.rule-card.is-old { border-left-color: var(--cat-cancelled); background: var(--surface-2); }
.rule-card.is-old .rule-title { color: var(--text-2); }
.rule-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-num { font-family: var(--mono); font-weight: 750; font-size: 1.05rem; padding: 1px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.rule-num:hover { text-decoration: none; filter: brightness(.96); }
.rule-card.is-binding .rule-num { background: var(--danger-soft); color: var(--danger); }
.rule-card.is-old .rule-num { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.rule-title { font-size: 1.05rem; overflow-wrap: anywhere; }
.rule-preview { overflow-wrap: anywhere; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rule-body { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.rule-card > .link { align-self: flex-start; }
.rule-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rule-chain:empty { display: none; }
.rule-meta { overflow-wrap: anywhere; }
.rule-aud { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rule-aud-pick { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.rule-kind { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.seg:disabled { opacity: .5; cursor: not-allowed; }
.rule-versions { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rule-ver { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.rule-ver-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rule-ver-title { overflow-wrap: anywhere; }
.rule-ver-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.rule-ver summary { cursor: pointer; color: var(--accent); }
.rule-ver details > :not(summary) { margin-top: 8px; }

@media (max-width: 760px) {
  .rule-card { padding: 12px; }
  .rule-top .spacer { flex: 1 1 100%; }
}

/* --- Вложения: карточка задачи, груминга и страница документа --- */
.att-block { position: relative; }
.att-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.att-list { list-style: none; margin: 0; padding: 0; }
.att-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.att-item:first-child { border-top: 0; padding-top: 0; }
.att-ico { display: inline-flex; color: var(--muted); }
.att-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-name { font-weight: 600; overflow-wrap: anywhere; }
.att-meta { overflow-wrap: anywhere; }
.att-actions { display: flex; align-items: center; gap: 4px; }
.att-bar { height: 6px; margin-top: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.att-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.att-failed .att-meta { color: var(--danger); }
.att-limit { white-space: nowrap; }
.att-drop-hint { display: none; position: absolute; inset: 0; z-index: 2; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-weight: 600; pointer-events: none; }
.att-over .att-drop-hint { display: flex; }
@media (max-width: 760px) {
  .att-item { grid-template-columns: auto minmax(0, 1fr); }
  .att-actions { grid-column: 2; }
}

/* --- Стенды и секреты раздела --- */
.st-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.st-card { overflow: hidden; }
.st-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.st-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.st-title h2 { font-size: 1.05rem; margin: 0; }
.st-key { padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: .85em; }
.st-url { display: inline-flex; align-items: center; gap: 4px; font-size: .86em; }
.st-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-counts { display: inline-flex; gap: 10px; font-size: .86em; color: var(--text-2); }
.st-count.ok { color: var(--ok); font-weight: 600; }
.st-count.bad { color: var(--danger); font-weight: 600; }
.st-card .table-card { border: 0; border-radius: 0; }
.st-pad { padding: 14px 16px; margin: 0; }
.st-login { overflow-wrap: anywhere; }
.st-lock { display: inline-flex; margin-left: 6px; color: var(--warn); vertical-align: middle; }
.st-holder + .st-holder { margin-top: 6px; }
.st-holder.mine strong { color: var(--accent); }
.st-row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.st-secrets { margin-bottom: 24px; }
.st-secret-note { padding: 10px 16px 0; margin: 0 0 8px; }
.st-exp.danger { color: var(--danger); font-weight: 600; }
.st-exp.warn { color: var(--warn); font-weight: 600; }
.secret-box { display: block; padding: 12px 14px; margin: 12px 0 4px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); word-break: break-all; white-space: pre-wrap; user-select: all; font-size: .95em; }
@media (max-width: 760px) {
  .st-head { padding: 10px 12px; }
  .st-row-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* --- Части карточки задачи: чеклист, риски, проверка (QA), панель полей --- */
.cl-list, .risk-list, .qa-runs, .blockers { list-style: none; margin: 0 0 10px; padding: 0; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.cl-item:first-child { border-top: 0; }
.cl-box { width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.cl-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cl-item.done .cl-text { color: var(--muted); text-decoration: line-through; }
.cl-actions { display: inline-flex; gap: 2px; flex: none; opacity: .55; }
.cl-item:hover .cl-actions, .cl-item:focus-within .cl-actions { opacity: 1; }
.cl-edit, .cl-add, .risk-add, .side-add { display: flex; align-items: center; gap: 8px; flex: 1; }
.cl-edit .input, .cl-add .input, .risk-add .input { flex: 1; min-width: 0; }
.risk-add .select { width: auto; max-width: 45%; }
.risk-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.risk-item:first-child { border-top: 0; }
.risk-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.risk-reason { overflow-wrap: anywhere; }
.risk-check { flex-basis: 100%; order: 3; }
.risk-item .icon-btn { order: 2; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.qa-prep { padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.qa-prep-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qa-prep-form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.qa-gate { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .92em; }
.qa-gate.ok { color: var(--ok); }
.qa-gate.bad { color: var(--danger); }
.qa-buttons { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.qa-run { padding: 10px 0; border-top: 1px solid var(--border); }
.qa-run:first-child { border-top: 0; }
.qa-run-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.qa-quote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.side-edit { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.chip-x { display: inline-flex; align-items: center; gap: 2px; }
.chip-x .icon-btn { padding: 2px; min-width: 0; min-height: 0; }
.input.sm { min-height: 28px; padding-top: 2px; padding-bottom: 2px; }
.blockers li { padding: 2px 0; overflow-wrap: anywhere; }
.tc-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* --- Отчёты: период, нагрузка, сроки, эпик, недельная сводка --- */
.rp-grid { display: flex; flex-direction: column; gap: 18px; }
.rp-card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rp-card-head h2 { margin: 0; font-size: 1.15rem; }
.rp-card-head p { margin: 0; }
.rp-toolbar { align-items: center; }
.rp-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: .92em; }
.rp-inline .input { min-height: 34px; width: auto; }
.rp-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rp-form .input { max-width: 260px; min-height: 34px; }
.rp-block { min-height: 20px; }
.rp-sub { margin: 18px 0 8px; font-size: .95rem; color: var(--text-2); }
.rp-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.rp-stat { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.rp-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.rp-stat-label { font-size: .86em; color: var(--text-2); margin-top: 2px; }
.rp-stat.ok .rp-stat-value { color: var(--ok); }
.rp-stat.warn .rp-stat-value { color: var(--warn); }
.rp-table td.rp-num, .rp-table th.rp-num, .rp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-table td.rp-day { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-bad { color: var(--danger); font-weight: 600; }
.rp-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.rp-cell .rp-num { min-width: 2ch; }
.rp-bar { flex: 1; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; min-width: 40px; }
.rp-bar > span { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.rp-bar.done > span { background: var(--cat-done); }
.rp-bar.created > span { background: var(--cat-active); }
.rp-bar.returned > span { background: var(--warn); }
.rp-bar.cat-queued > span { background: var(--cat-queued); }
.rp-bar.cat-active > span { background: var(--cat-active); }
.rp-bar.cat-review > span { background: var(--cat-review); }
.rp-bar.cat-done > span { background: var(--cat-done); }
.rp-bar.cat-cancelled > span { background: var(--cat-cancelled); }
.rp-statuses { display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin: 8px 0 14px; }
.rp-status-row { display: grid; grid-template-columns: minmax(130px, 200px) 1fr 3ch; align-items: center; gap: 10px; }
.rp-progress { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rp-chip { display: inline-flex; align-items: center; gap: 6px; }
.rp-list { list-style: none; margin: 0 0 10px; padding: 0; }
.rp-task { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); }
.rp-list > .rp-task:first-child, .rp-list > li:first-child > .rp-task { border-top: 0; }
.rp-task-title { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.rp-blocked { padding: 2px 0; }
.rp-nested { margin: 0 0 4px 22px; }
.rp-md { margin: 8px 0 0; padding: 14px; max-height: 520px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .88em; line-height: 1.5; }
.rp-card .table-card { margin-bottom: 4px; }
@media (max-width: 760px) {
  .rp-stats { grid-template-columns: repeat(2, 1fr); }
  .rp-status-row { grid-template-columns: 1fr 1fr 3ch; }
}
