:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #e9ebf0;
  --column: #e6e8ee;
  --text: #1c2030;
  --muted: #646b7d;
  --border: #d6dae3;
  --accent: #2b5fd9;
  --accent-text: #ffffff;
  --danger: #c93838;
  --ok: #23845b;
  --warn: #b86e0c;
  --shadow: 0 1px 2px rgba(20, 25, 40, .08), 0 1px 1px rgba(20, 25, 40, .04);
  --shadow-lg: 0 12px 40px rgba(20, 25, 40, .22);
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c;
    --surface: #1e2129;
    --surface-2: #272b35;
    --column: #191c23;
    --text: #e6e8ee;
    --muted: #9198a8;
    --border: #333845;
    --accent: #5b8af0;
    --accent-text: #0d1222;
    --danger: #ef6464;
    --ok: #47c08b;
    --warn: #e5a443;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1e2129;
  --surface-2: #272b35;
  --column: #191c23;
  --text: #e6e8ee;
  --muted: #9198a8;
  --border: #333845;
  --accent: #5b8af0;
  --accent-text: #0d1222;
  --danger: #ef6464;
  --ok: #47c08b;
  --warn: #e5a443;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* формы */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { resize: vertical; min-height: 90px; }
label.field { display: block; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; white-space: nowrap; line-height: 1.2;
}
button:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.primary.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.icon { padding: 4px 7px; border-color: transparent; background: transparent; color: var(--muted); }
button.icon:hover { background: var(--surface-2); color: var(--text); }

/* шапка */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); }
.brand img { width: 22px; height: 22px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.topbar nav a.active, .topbar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--accent);
}

/* страница */
.page { padding: 24px 16px; max-width: 1100px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* вход */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 18px; font-size: 18px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* список досок */
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.board-tile {
  display: block; padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); box-shadow: var(--shadow); min-height: 108px; position: relative;
}
.board-tile:hover { border-color: var(--accent); text-decoration: none; }
.board-tile h3 { font-size: 15px; margin-bottom: 6px; }
.board-tile .desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-tile .meta { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; gap: 12px; }
.board-tile.archived { opacity: .6; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; }

/* бейджи */
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.role-admin { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.badge.role-viewer { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

/* доска */
.board-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.board-head { padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--surface); }
.board-head h1 { font-size: 18px; }
.board-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.board-tools input[type=search] { width: 180px; }
.board-tools select { width: auto; max-width: 170px; }
.columns { flex: 1; display: flex; gap: 12px; padding: 16px; overflow-x: auto; align-items: flex-start; }
.column {
  flex: 0 0 286px; background: var(--column); border-radius: 10px; display: flex; flex-direction: column;
  max-height: calc(100vh - 150px); border: 1px solid var(--border);
}
.column-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px 12px; }
.column-head h3 { flex: 1; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; cursor: default; }
.column-head .count { font-size: 12px; color: var(--muted); }
.column-body { padding: 4px 8px 8px; overflow-y: auto; min-height: 40px; flex: 1; }
.column-body.drop-over { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 8px; }
.add-card { margin: 0 8px 8px; }
.add-card button.ghost { width: 100%; justify-content: flex-start; color: var(--muted); }
.add-column { flex: 0 0 260px; }

.card {
  background: var(--surface); border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; box-shadow: var(--shadow);
  border: 1px solid var(--border); cursor: pointer; user-select: none;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.card.dragging { opacity: .4; }
.card .labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #fff; }
.card .title { font-weight: 500; word-break: break-word; }
.card .meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .meta .avatar { margin-left: auto; width: 22px; height: 22px; font-size: 10px; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.soon { color: var(--warn); font-weight: 600; }
.prio { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; }
.prio-urgent { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.prio-high { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.prio-low { background: var(--surface-2); color: var(--muted); }
.drop-marker { height: 3px; background: var(--accent); border-radius: 2px; margin: -2px 0 6px; }

/* меню */
.menu { position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 180px; }
.menu button { display: flex; width: 100%; justify-content: flex-start; border: 0; background: transparent; padding: 7px 10px; }
.menu button:hover { background: var(--surface-2); }

/* модалки */
.overlay { position: fixed; inset: 0; background: rgba(10, 14, 25, .5); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; z-index: 100; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; border: 1px solid var(--border); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 16px 18px 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 18px 18px; }

.card-modal { display: grid; grid-template-columns: 1fr 230px; gap: 20px; }
.card-modal .side > * + * { margin-top: 12px; }
.title-input { font-size: 17px; font-weight: 600; border-color: transparent !important; padding-left: 6px !important; margin-left: -6px; background: transparent !important; }
.title-input:hover { border-color: var(--border) !important; }
.label-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.label-picker .chip { cursor: pointer; opacity: .35; border: 2px solid transparent; }
.label-picker .chip.on { opacity: 1; }
.section-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.comment { padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.comment + .comment { margin-top: 8px; }
.comment .who { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.attachment { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.attachment:last-child { border-bottom: 0; }
.attachment a { word-break: break-all; }
.desc-view { white-space: pre-wrap; word-break: break-word; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); min-height: 40px; }

/* таблицы */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
table.list tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* уведомления */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast .t { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 90vw; }
#toast .t.err { background: var(--danger); color: #fff; }

@media (max-width: 720px) {
  .card-modal { grid-template-columns: 1fr; }
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .brand span { display: none; }
  .userbox .name { display: none; }
  .board-tools { margin-left: 0; width: 100%; }
  .board-tools input[type=search] { flex: 1; width: auto; }
  .column { flex-basis: 82vw; max-height: none; }
  .overlay { padding: 12px 8px; }
}

/* ---------- общий экран: все доски ---------- */
.overview { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.overview-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.overview-head h1 { font-size: 18px; }
.lane { border-bottom: 1px solid var(--border); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; }
.lane-title { font-size: 15px; font-weight: 700; color: var(--text); }
.lane-summary { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.overdue-count { color: var(--danger); font-weight: 600; }
.lane-tools { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.lane-toggle { transition: transform .15s; font-size: 12px; }
.lane.collapsed .lane-toggle { transform: rotate(-90deg); }
.lane.collapsed .columns { display: none; }
.lane.collapsed .lane-head { padding-bottom: 12px; }
.columns.compact { padding: 10px 16px 16px; flex: none; }
.columns.compact .column { flex-basis: 252px; max-height: none; }
.columns.compact .add-column { flex-basis: 200px; }
.archive-list { padding: 16px; }
.column-body .more { width: 100%; justify-content: center; font-size: 12px; color: var(--accent); padding: 5px; }
.column.done .card { opacity: .78; }

/* ---------- дедлайн ---------- */
.deadline { margin-top: 8px; --lvl: var(--ok); }
.deadline.lvl-warn { --lvl: var(--warn); }
.deadline.lvl-crit, .deadline.lvl-over { --lvl: var(--danger); }
.deadline-text { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.deadline-text b { color: var(--lvl); font-weight: 600; }
.deadline-track { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.deadline-fill { height: 100%; border-radius: 3px; background: var(--lvl); }
.deadline.lvl-over .deadline-fill { background: repeating-linear-gradient(-45deg, var(--danger) 0 6px, color-mix(in srgb, var(--danger) 70%, transparent) 6px 12px); }
.deadline.done .deadline-text { margin-bottom: 0; }
.side .deadline { margin-top: 8px; }
@media (max-width: 720px) {
  .lane-tools { margin-left: 0; }
  .columns.compact .column { flex-basis: 78vw; }
}

/* ---------- переключатель видов и настройки ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; padding: 2px; background: var(--surface-2); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 5px; color: var(--muted); font-weight: 500; }
.seg button:hover { background: var(--surface); color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg.small button { padding: 3px 8px; font-size: 12px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
label.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
label.radio:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
label.radio input { margin-top: 3px; }

/* ---------- канбан: прокрутка колонки ---------- */
.column-body.scrolly { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  box-shadow: inset 0 -12px 10px -10px rgba(20, 25, 40, .18); }
.parent-line { font-size: 11px; color: var(--muted); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subcount { font-variant-numeric: tabular-nums; }
.subcount.all { color: var(--ok); font-weight: 600; }

/* ---------- окно карточки: подзадачи ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; font-size: 12px; margin-bottom: 2px; }
.crumb { border: 0; background: none; padding: 0; color: var(--accent); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: none; text-decoration: underline; }
.sub-progress { margin-bottom: 8px; }
.sublist { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.subitem { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 0; border-bottom: 1px solid var(--border); padding: 7px 10px; text-align: left; white-space: normal; justify-content: flex-start; }
.subitem:last-child { border-bottom: 0; }
.subitem .avatar { width: 22px; height: 22px; font-size: 10px; }
.subitem.done .subtitle { color: var(--muted); text-decoration: line-through; }
.subcheck { width: 16px; height: 16px; flex: none; border: 1.5px solid var(--border); border-radius: 4px; display: grid; place-items: center; font-size: 11px; color: #fff; }
.subitem.done .subcheck { background: var(--ok); border-color: var(--ok); }
.subtitle { min-width: 0; }
.due-ok { color: var(--ok); } .due-warn { color: var(--warn); } .due-crit, .due-over { color: var(--danger); font-weight: 600; }

/* ---------- альтернативные виды ---------- */
.alt-view { flex: 1; padding: 12px 16px 16px; min-width: 0; }
.alt-view.compact { flex: none; }

/* дерево */
.tree-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--column); max-height: 72vh; }
.board-page .tree-scroll { max-height: calc(100vh - 170px); }
.tree-canvas { position: relative; margin: 16px; }
.tree-edges { position: absolute; inset: 0; overflow: visible; }
.tree-edges path { fill: none; stroke: color-mix(in srgb, var(--muted) 55%, transparent); stroke-width: 1.5; }
.tnode { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow);
  cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; }
.tnode:hover, .tnode:focus-visible { border-color: var(--accent); outline: none; }
.tnode.root { background: var(--text); color: var(--bg); border-color: var(--text); cursor: default; }
.tnode.root .tnode-meta { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.tnode.done { opacity: .7; }
.tnode.done .tnode-title { text-decoration: line-through; }
.tnode-title { font-weight: 600; font-size: 13px; line-height: 1.3; flex: none; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tnode-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tnode-meta .avatar { width: 18px; height: 18px; font-size: 9px; margin-left: auto; }
.tnode-col { background: var(--surface-2); padding: 0 6px; border-radius: 4px; }
.tnode.lvl-warn .tnode-due { color: var(--warn); font-weight: 600; }
.tnode.lvl-crit .tnode-due, .tnode.lvl-over .tnode-due { color: var(--danger); font-weight: 600; }
.tnode.lvl-over { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); }
.tnode-toggle { position: absolute; right: -12px; top: 50%; transform: translateY(-50%); min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; font-size: 11px; font-weight: 700; background: var(--surface); }

/* Гант */
.gantt { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); max-height: 72vh; position: relative; }
.board-page .gantt { max-height: calc(100vh - 170px); }
.g-head { display: flex; position: sticky; top: 0; z-index: 8; background: var(--surface); border-bottom: 1px solid var(--border); width: max-content; min-width: 100%; }
.g-name { position: sticky; left: 0; z-index: 6; box-shadow: 1px 0 0 var(--border), 6px 0 8px -6px rgba(0, 0, 0, .25); flex: none; width: 280px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px; padding: 0 10px; cursor: pointer; min-width: 0; }
.g-corner { z-index: 9; cursor: default; height: 46px; }
.g-scale { position: relative; height: 46px; flex: none; }
.g-month { position: absolute; top: 0; height: 22px; padding: 3px 6px; font-size: 11px; font-weight: 600; color: var(--text); border-left: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-transform: capitalize; }
.g-day { position: absolute; top: 22px; height: 24px; display: grid; place-items: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; border-left: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.g-day.wk { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.g-day.today { color: var(--accent-text); background: var(--accent); font-weight: 700; border-radius: 4px; }
.g-body { position: relative; width: max-content; min-width: 100%; }
.g-bg { position: absolute; top: 0; bottom: 0; left: 280px; pointer-events: none; }
.g-wk { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); opacity: .7; z-index: 1; }
.g-row { display: flex; height: 36px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.g-row:hover .g-name, .g-row:hover .g-track { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.g-row:hover .g-name { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.g-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.g-title.strong { font-weight: 600; }
.g-branch { color: var(--muted); font-size: 11px; }
.g-name .avatar { width: 20px; height: 20px; font-size: 9px; }
.g-row.done .g-title { color: var(--muted); text-decoration: line-through; }
.g-track { position: relative; flex: none; }
.g-bar { position: absolute; top: 7px; height: 22px; border-radius: 5px; background: var(--lvl); --lvl: var(--ok); cursor: grab; overflow: hidden;
  display: flex; align-items: center; touch-action: none; z-index: 2; box-shadow: var(--shadow); }
.g-bar.lvl-warn { --lvl: var(--warn); } .g-bar.lvl-crit, .g-bar.lvl-over { --lvl: var(--danger); }
.g-bar.lvl-done { --lvl: color-mix(in srgb, var(--muted) 60%, var(--surface-2)); }
.g-bar.lvl-over { background: repeating-linear-gradient(-45deg, var(--danger) 0 6px, color-mix(in srgb, var(--danger) 75%, var(--surface)) 6px 12px); }
.g-bar.parent { height: 14px; top: 11px; border-radius: 3px; }
.g-bar.parent .g-bar-label { display: none; }
.g-bar.dragging { cursor: grabbing; opacity: .85; box-shadow: var(--shadow-lg); }
.g-bar-progress { position: absolute; inset: 0 auto 0 0; background: rgba(0, 0, 0, .22); }
.g-bar-label { position: relative; padding: 0 8px; font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.g-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(255, 255, 255, .25); }
.g-nodate { position: absolute; top: 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
@media (max-width: 720px) { .g-name { width: 150px; } .g-bg { left: 150px; } }

/* ---------- готовые задачи ---------- */
.done-toggle.on { border-color: var(--ok); color: var(--ok); }
.done-stub { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 16px 10px;
  border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: 13px; }

/* ---------- календарь ---------- */
.calendar { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.cal-nav { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-nav .icon { font-size: 18px; line-height: 1; padding: 2px 9px; }
.cal-title { font-size: 15px; min-width: 130px; text-align: center; }
.cal-stat { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 6px 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-wd.wk { color: color-mix(in srgb, var(--muted) 65%, transparent); }
.cal-day { min-height: 118px; padding: 4px 5px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n + 7) { border-right: 0; }
.cal-day.wk { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.cal-day.other { background: var(--column); }
.cal-day.other .cal-date { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.cal-day.drop { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 1px 3px; align-self: flex-start; border-radius: 10px; min-width: 22px; text-align: center; }
.cal-day.today .cal-date { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.cal-chip { display: flex; align-items: center; gap: 5px; width: 100%; padding: 3px 6px; border-radius: 5px; font-size: 12px; line-height: 1.25;
  justify-content: flex-start; text-align: left; border: 1px solid var(--border); background: var(--surface); --lvl: var(--ok); cursor: pointer; }
.cal-chip:hover { border-color: var(--accent); }
.cal-chip.lvl-warn { --lvl: var(--warn); }
.cal-chip.lvl-crit { --lvl: var(--danger); }
.cal-chip.lvl-over { --lvl: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.cal-chip.done { --lvl: var(--muted); opacity: .65; }
.cal-chip.done .cal-chip-title { text-decoration: line-through; }
.cal-chip.dragging { opacity: .4; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lvl); flex: none; }
.cal-chip-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ini { font-size: 10px; font-weight: 700; color: var(--muted); flex: none; }
.cal-more { border: 0; background: none; padding: 1px 6px; font-size: 11px; color: var(--accent); justify-content: flex-start; }
.cal-more:hover { background: var(--surface-2); }
@media (max-width: 720px) {
  .cal-day { min-height: 74px; padding: 2px; }
  .cal-chip { padding: 2px 3px; font-size: 10px; }
  .cal-ini, .cal-dot { display: none; }
  .cal-stat { margin-left: 0; width: 100%; }
}

/* ---------- общая доска ---------- */
.combined-board { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.combined-board .lane-head { padding-bottom: 4px; }
.combined-board .columns .column { flex-basis: 320px; }
.proj-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.proj-legend a { color: var(--text); display: inline-flex; align-items: center; gap: 5px; }
.combined-hint { flex-basis: 100%; }
.proj-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex: none; background: var(--proj, var(--muted)); }
.proj-line { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-bottom: 5px; min-width: 0; }
.proj-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-col { margin-left: auto; background: var(--surface-2); padding: 0 6px; border-radius: 4px; white-space: nowrap; }
.tnode.proj { background: var(--surface-2); border-color: color-mix(in srgb, var(--proj) 55%, var(--border)); cursor: default; }
.tnode.proj .tnode-title { display: flex; align-items: center; gap: 6px; }
.g-row.g-proj { background: var(--surface-2); height: 30px; }
.g-row.g-proj .g-name { background: var(--surface-2); cursor: default; gap: 8px; }
.cal-chip .proj-swatch { width: 7px; height: 7px; }

/* ---------- одинаковая высота колонок и аккуратная прокрутка ---------- */
.columns.uniform .column { max-height: none; }
.columns.uniform .column-body { flex: none; overflow-y: auto; overscroll-behavior: contain; }
.column-body { scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
.column-body::-webkit-scrollbar { width: 6px; }
.column-body::-webkit-scrollbar-track { background: transparent; }
.column-body::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 3px; }
.column-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.column-body::-webkit-scrollbar-button { display: none; height: 0; }
.column { min-width: 0; }
.column-body > *, .card { min-width: 0; }

/* ---------- встречи из Google Календаря ---------- */
.cal-event { display: flex; align-items: center; gap: 5px; width: 100%; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; line-height: 1.25;
  justify-content: flex-start; text-align: left; border: 1px dashed color-mix(in srgb, var(--gc) 55%, var(--border)); background: transparent;
  color: var(--text); cursor: pointer; --gc: var(--accent); }
.cal-event:hover { background: color-mix(in srgb, var(--gc) 10%, transparent); }
.cal-event.allday { border-style: solid; background: color-mix(in srgb, var(--gc) 16%, var(--surface)); font-weight: 600; }
.cal-ev-time { font-variant-numeric: tabular-nums; color: var(--gc); font-weight: 700; flex: none; }
.g-toggle.on { color: var(--accent); }
.demo-note { padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
a.btn { color: var(--text); text-decoration: none; }
a.btn:hover { background: var(--surface-2); text-decoration: none; }
@media (max-width: 720px) { .cal-event { font-size: 10px; padding: 1px 3px; } .cal-ev-time { display: none; } }

/* ---------- ИИ-агенты ---------- */
.avatar.agent { border-radius: 7px; background: var(--text); color: var(--bg); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); }
.run-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 1px 7px 1px 6px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; --rc: var(--muted); }
.run-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rc); flex: none; }
.run-running, .run-queued { --rc: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.run-running .run-dot { animation: run-pulse 1.1s ease-in-out infinite; }
.run-waiting { --rc: var(--warn); color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.run-review { --rc: #8b5cf6; color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 13%, transparent); }
.run-done { --rc: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.run-failed { --rc: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
@keyframes run-pulse { 50% { opacity: .25; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .run-running .run-dot { animation: none; } }
.agent-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.agent-question { padding: 9px 11px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); }
.agent-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.agent-steps li.now { font-weight: 600; }
.agent-steps li.now::marker { color: var(--accent); }
.agent-desc { max-width: 380px; font-size: 13px; }
.skills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
pre.token { margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; user-select: all; }

/* ---------- иконки ---------- */
.ico { flex: none; display: inline-block; vertical-align: -2px; }
.meta-i { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
button .ico { pointer-events: none; }

/* ---------- файлы ---------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; border-radius: 10px; }
.files.over { outline: 2px dashed var(--accent); outline-offset: 4px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); min-width: 0; }
.file:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.file-ext { flex: none; width: 38px; height: 44px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase;
  display: grid; place-items: end center; padding-bottom: 6px; letter-spacing: .03em; position: relative; overflow: hidden; }
.file-ext::before { content: ""; position: absolute; top: 0; right: 0; width: 11px; height: 11px; background: rgba(255, 255, 255, .35); border-bottom-left-radius: 4px; }
.file-main { flex: 1; min-width: 0; }
.file-main a { display: block; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-main a:hover { color: var(--accent); }
.file-add { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 12px; border: 1.5px dashed var(--border); border-radius: 9px;
  background: transparent; color: var(--muted); text-align: left; white-space: normal; min-height: 62px; }
.file-add:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* ---------- голос ---------- */
.mic-btn { width: 36px; height: 34px; padding: 0; border-radius: 50%; color: var(--accent); }
.mic-btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rec { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 18px; text-align: center; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); animation: run-pulse 1s ease-in-out infinite; }
.rec-time { font-size: 28px; font-variant-numeric: tabular-nums; }
.rec-bars { display: flex; align-items: center; gap: 3px; height: 44px; width: 100%; max-width: 320px; }
.rec-bars span { flex: 1; background: var(--accent); border-radius: 2px; height: 30%; transition: height .3s; opacity: .8; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rec-dot, .spinner { animation: none; } }
.voice { display: flex; align-items: center; gap: 10px; margin-top: 6px; max-width: 360px; }
.voice-play { width: 32px; height: 32px; padding: 0; border-radius: 50%; background: var(--accent); border-color: var(--accent); color: var(--accent-text); flex: none; }
.voice-play:hover { background: var(--accent); filter: brightness(1.1); }
.voice-track { position: relative; flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; }
.voice-track i { flex: 1; background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 2px; }
.voice-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; pointer-events: none; }
.voice-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.comment .transcript { margin-top: 6px; }

/* ---------- агент на карточке ---------- */
.agent-strip { margin-top: 8px; padding: 7px 8px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.agent-strip.run-waiting { background: color-mix(in srgb, var(--warn) 13%, var(--surface)); }
.agent-strip.run-review { background: color-mix(in srgb, #8b5cf6 10%, var(--surface)); }
.agent-strip-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; }
.agent-now { color: var(--text); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.agent-now.q { font-weight: 500; }
.agent-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 22%, transparent); overflow: hidden; }
.agent-track.big { height: 7px; border-radius: 4px; }
.agent-fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width .6s ease;
  background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); background-size: 60px 100%; animation: agent-shine 1.6s linear infinite; }
@keyframes agent-shine { from { background-position: -60px 0; } to { background-position: 260px 0; } }
@media (prefers-reduced-motion: reduce) { .agent-fill { animation: none; } }
.agent-foot { display: flex; justify-content: space-between; font-size: 11px; font-variant-numeric: tabular-nums; }
.card.needs-reply { border-color: var(--warn); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 35%, transparent), var(--shadow); }
.reply-btn { margin-top: 8px; width: 100%; gap: 6px; font-size: 12px; font-weight: 600; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.reply-btn:hover { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); }
.agent-progress { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.col-kind { color: var(--accent); display: inline-flex; }

/* ---------- входящие от агентов ---------- */
.inbox-btn { position: relative; gap: 6px; border-color: transparent; background: transparent; color: var(--muted); padding: 6px 9px; }
.inbox-btn:hover { background: var(--surface-2); color: var(--text); }
.inbox-btn.has { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); font-weight: 600; }
.inbox-count { min-width: 18px; height: 18px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; }
.inbox-btn.has .ico { animation: bell 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes bell { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(14deg); } 90% { transform: rotate(-12deg); } 95% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .inbox-btn.has .ico { animation: none; } }
.inbox-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.inbox-task { font-weight: 600; }
.reply-row { display: flex; gap: 8px; align-items: flex-end; }
.reply-row textarea { flex: 1; }
@media (max-width: 720px) { .inbox-label { display: none; } }

/* ---------- MCP и iCal ---------- */
.mcp-info { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.mcp-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.mcp-tool { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); }
.ical-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ical-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.ical-item:last-child { border-bottom: 0; }
.ical-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ical-add { padding: 12px; border-radius: 8px; background: var(--surface-2); }
.ical-help summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.ical-help ol { margin: 8px 0 0; padding-left: 20px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }

/* ---------- конвейер ---------- */
.stage-chip { margin: 0 10px 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px 8px; border-radius: 7px; font-size: 11.5px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.stage-chip .avatar { width: 20px; height: 20px; font-size: 9px; border-radius: 5px; }
.stage-chip.review { background: color-mix(in srgb, #8b5cf6 9%, var(--surface)); border-color: color-mix(in srgb, #8b5cf6 30%, var(--border)); }
.stage-chip.gate { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); color: var(--warn); font-weight: 600; }
.stage-back { color: var(--muted); font-size: 11px; flex-basis: 100%; }
.stage-opts { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.pipe { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; }
.pipe-arrow { display: grid; place-items: center; color: var(--muted); font-size: 18px; flex: none; }
.pipe-node { flex: 0 0 150px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; border-radius: 10px; text-align: left;
  white-space: normal; border: 1px solid var(--border); background: var(--surface); }
.pipe-node:hover { border-color: var(--accent); }
.pipe-node.work { border-top: 3px solid var(--accent); }
.pipe-node.review { border-top: 3px solid #8b5cf6; }
.pipe-node.gate { border-top: 3px solid var(--warn); }
.pipe-name { font-weight: 700; }
.pipe-who { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.pipe-who .avatar { width: 22px; height: 22px; font-size: 10px; }
.pipe-mode { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pipe-back { font-size: 11px; color: #8b5cf6; }
.agent-strip.run-gate { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.run-gate-pill { --rc: var(--warn); color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.reply-btn.gate { color: var(--warn); }
.gate-box { background: color-mix(in srgb, var(--warn) 8%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.gate-box > .row > .ico { color: var(--warn); }
.gate-ico { color: var(--warn); display: inline-flex; width: 28px; justify-content: center; }
.pipe-log { font-size: 13px; }
.pipe-log summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.pipe-log ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; }
.modal.xwide { max-width: 1180px; }
.pipe { flex-wrap: wrap; row-gap: 12px; overflow-x: visible; }
.pipe-node { flex-basis: 132px; }

/* ---------- общая доска: этапы, группы, путь ---------- */
.combined-tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.combined-board .columns .column { flex-basis: 300px; }
.stage-bar { display: flex; gap: 2px; height: 5px; margin: 0 12px 8px; border-radius: 3px; overflow: hidden; }
.stage-bar i { display: block; min-width: 4px; }
.stage-bar i.empty { background: var(--surface-2); }
.sub-group { margin-bottom: 8px; }
.sub-group.is-empty { opacity: .6; }
.sub-head { width: 100%; justify-content: flex-start; gap: 6px; padding: 4px 6px; margin-bottom: 6px; border: 0; border-radius: 6px; background: transparent;
  font-size: 12px; color: var(--muted); }
.sub-head:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text); }
.sub-caret { width: 10px; font-size: 10px; }
.sub-name { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-proj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-align: left; }
.sub-count { font-variant-numeric: tabular-nums; background: var(--surface); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.sub-group.closed .sub-head { margin-bottom: 0; }
.path { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.path i { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 30%, transparent); }
.path i.past { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.path i.now { background: var(--accent); width: 8px; height: 8px; }
.path b { font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 3px; font-variant-numeric: tabular-nums; }
.proj-line .proj-col { margin-left: 4px; }
.proj-line .path { margin-left: auto; }
.stage-map { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.stage-map-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.stage-map-col { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.stage-map-col select { font-size: 13px; padding: 5px 8px; }
.sub-group.is-empty { margin-bottom: 2px; }
.sub-group.is-empty .sub-head { padding: 1px 6px; margin-bottom: 0; font-size: 11px; }
.sub-group.is-empty .sub-name { font-weight: 500; color: var(--muted); }
body.is-dragging .sub-group.is-empty .sub-head { outline: 1px dashed var(--border); }

/* ---------- Gitea ---------- */
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.git-line { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.git-branch { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.git-pr { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.git-chip { padding: 0 6px; border-radius: 9px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; font-size: 11px; }
.pr-open { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pr-merged { color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 13%, transparent); }
.pr-closed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.rv-pending { color: var(--muted); }
.rv-changes { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.rv-approved { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.ci-pending { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ci-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.ci-fail { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.git-diff { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); }
.git-diff .add { color: var(--ok); font-weight: 600; } .git-diff .del { color: var(--danger); font-weight: 600; }
.git-line .git-diff { margin-left: auto; }
.code-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.code-box.empty-code { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.code-head .ico, .code-pr .ico { color: var(--muted); }
.code-pr a { font-weight: 600; }
.commits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.commits li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; min-width: 0; }
.commits li:last-child { border-bottom: 0; }
.commits .ico { color: var(--muted); }
.sha { color: var(--accent); }
.cm-msg { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gitea-link { display: inline-flex; align-items: center; gap: 2px; }
.integ-card { border: 1px solid var(--border); border-radius: 12px; padding: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.integ-logo { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, #609926 16%, var(--surface)); color: #609926; flex: none; }
.integ-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.integ-note { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); line-height: 1.5; }
.integ-note code, td code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.ok { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); }
.card-modal > .main, .card-modal > .side { min-width: 0; }

/* ---------- конвейер 2.0: схема и правила ---------- */
.flow > .seg { margin-bottom: 14px; }
.flow-tools { gap: 12px; }
.flow-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.flow-legend .lg { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-left: 6px; }
.lg.ok { background: var(--ok); } .lg.rem { background: #8b5cf6; } .lg.minor { background: var(--accent); } .lg.fail { background: var(--danger); }
.lg.def { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }
.flow-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--column); }
.flow-canvas { position: relative; margin: 8px; }
.flow-svg { position: absolute; inset: 0; overflow: visible; }
.edge { fill: none; stroke-width: 2; }
.edge-ok { stroke: var(--ok); } .edge-rem { stroke: #8b5cf6; } .edge-minor { stroke: var(--accent); } .edge-fail { stroke: var(--danger); }
.edge-default { stroke: var(--muted); stroke-dasharray: 5 4; opacity: .7; }
.edge-manual { stroke: var(--border); stroke-width: 2; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.arrow-ok { fill: var(--ok); } .arrow-rem { fill: #8b5cf6; } .arrow-minor { fill: var(--accent); } .arrow-fail { fill: var(--danger); }
.edge-label { position: absolute; transform: translate(-50%, -50%); padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--surface); border: 1px solid currentColor; z-index: 2; line-height: 1.5; }
.edge-label.edge-ok { color: var(--ok); } .edge-label.edge-rem { color: #8b5cf6; } .edge-label.edge-minor { color: var(--accent); } .edge-label.edge-fail { color: var(--danger); }
.edge-label:hover { background: var(--surface-2); }
.flow-node { position: absolute; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 8px 10px; text-align: left;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); white-space: normal; z-index: 1; }
.flow-node:hover { border-color: var(--accent); }
.flow-node.work { border-top: 3px solid var(--accent); } .flow-node.review { border-top: 3px solid #8b5cf6; } .flow-node.gate { border-top: 3px solid var(--warn); }
.flow-node b { font-size: 13px; line-height: 1.2; }
.flow-who { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.flow-who .avatar { width: 18px; height: 18px; font-size: 9px; border-radius: 5px; }
.flow-mode { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.flow-check { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.flow-check ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.chk-warn { color: var(--warn); } .chk-info { color: var(--muted); }
.flow-list summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.edge-sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.edge-sentence select { width: auto; flex: 1 1 160px; }
.rule { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.rule.off { opacity: .6; }
.rule-name { font-weight: 600; border-color: transparent !important; background: transparent !important; padding-left: 4px !important; }
.rule-name:hover, .rule-name:focus { border-color: var(--border) !important; }
.rule-grid { display: grid; grid-template-columns: 52px 1fr; gap: 8px 10px; align-items: start; }
.rule-kw { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); padding-top: 8px; }
.rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rule-line select { width: auto; max-width: 100%; }
.rule-line input[type=text] { flex: 1 1 200px; width: auto; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.add-link { color: var(--accent); padding: 2px 4px; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--border); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.inbox-item.notice { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.inbox-item.notice .gate-ico { color: var(--accent); }
@media (max-width: 720px) { .rule-grid { grid-template-columns: 1fr; } .rule-kw { padding-top: 0; } }

/* ---------- входящие потоки ---------- */
.intake-flow { display: flex; align-items: stretch; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.if-step { flex: 1 1 140px; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-width: 0; }
.if-ico { color: var(--accent); }
.if-arrow { align-self: center; color: var(--muted); }
.demo-sim { margin-bottom: 14px; }
.demo-sim button { display: inline-flex; align-items: center; gap: 5px; }
.intake-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.intake-cols > .stack > section, .intake-cols > section { margin: 0; }
@media (max-width: 980px) { .intake-cols { grid-template-columns: minmax(0, 1fr); } }
.intake-feed { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.intake-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; background: var(--surface); min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.src-ico.event { background: color-mix(in srgb, #e08a1e 16%, var(--surface)); color: #c2700f; }
.st-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); flex: none; }
.st-chip.st-work { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent); }
.st-chip.st-warn { background: color-mix(in srgb, #e08a1e 18%, var(--surface)); color: #b8650a; }
.st-chip.st-ok { background: color-mix(in srgb, #23845b 16%, var(--surface)); color: #23845b; }
.intake-steps { display: flex; gap: 3px; flex-wrap: wrap; }
.is-step { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.is-step.on { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }
.is-step.warn { background: color-mix(in srgb, #e08a1e 20%, var(--surface)); color: #b8650a; }
.is-step.off { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.conf { font-size: 11px; padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.conf.hi { background: color-mix(in srgb, #23845b 16%, var(--surface)); color: #23845b; }
.conf.lo { background: color-mix(in srgb, #e08a1e 20%, var(--surface)); color: #b8650a; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.kv > * { min-width: 0; overflow-wrap: anywhere; }
.triage-box, .reply-box { border: 1px dashed color-mix(in srgb, #e08a1e 60%, var(--border)); background: color-mix(in srgb, #e08a1e 7%, var(--surface)); border-radius: 8px; padding: 9px 10px; display: flex; flex-direction: column; gap: 7px; }
.reply-box.sent { border-style: solid; border-color: color-mix(in srgb, #23845b 45%, var(--border)); background: color-mix(in srgb, #23845b 6%, var(--surface)); }
.reply-box .row button, .reply-box > .row .primary { display: inline-flex; align-items: center; gap: 5px; }
.reply-text { font-size: 13px; white-space: pre-wrap; }
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 8px 0; }
.src-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.src-card.off { opacity: .6; }
.integ-logo.sm { width: 32px; height: 32px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.thr-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }
.thr-row input { width: 140px; }
.agent-badge { font-size: 10px; }
.code-block { display: block; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.origin-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; margin: 12px 0; clear: both; position: relative; }
.origin-box .section-title { margin: 2px 0 0; }
.src-badge { color: var(--accent); }
.nowrap { white-space: nowrap; }
.seg .inbox-count { margin-left: 5px; }
.card-link { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; text-align: left; }
.card-link .ellipsis { min-width: 0; }
.intake-item > .row.wrap { flex-wrap: wrap; }
@media (max-width: 720px) {
  .topbar nav { min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { padding: 6px 8px; white-space: nowrap; }
  .userbox { flex: none; }
}
.intake-cols .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.intake-cols .seg button { white-space: nowrap; }
.intake-cols .integ-card > .row { flex-wrap: wrap; }
/* входящие на уровне доски */
.sim-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.sim-group button { display: inline-flex; align-items: center; gap: 5px; }
.src-grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.src-list { display: flex; flex-wrap: wrap; gap: 4px; }
.src-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.src-pill.off { opacity: .55; }
.small-select { padding: 4px 8px; font-size: 13px; max-width: 220px; }
.intake-head { display: flex; align-items: center; gap: 6px; width: 100%; margin: 0 0 8px; padding: 6px 9px; border-radius: 8px; font-size: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--text); text-align: left; }
.intake-head .ico { color: var(--accent); flex: none; }
.intake-head.warn { border-color: color-mix(in srgb, #e08a1e 55%, var(--border)); background: color-mix(in srgb, #e08a1e 10%, var(--surface)); }
.intake-head.empty { border-style: dashed; background: transparent; color: var(--muted); }
.intake-head.empty .ico { color: var(--muted); }
.triage-tile { border: 1px dashed color-mix(in srgb, #e08a1e 65%, var(--border)); background: color-mix(in srgb, #e08a1e 7%, var(--surface)); cursor: default; display: flex; flex-direction: column; gap: 5px; }
.triage-tile .title { margin: 0; }
.src-ico.sm { width: 20px; height: 20px; border-radius: 6px; }
.danger-text { color: var(--danger, #d64545); }
.routes-table input, .routes-table select { min-width: 0; width: 100%; font-size: 13px; padding: 4px 6px; }
.routes-table td { vertical-align: top; }
.routes-table td:first-child { min-width: 180px; }
.routes-table td:nth-child(n+2) { min-width: 120px; }
.integ-card .seg, .modal-body .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.integ-card .seg button, .modal-body .seg button { white-space: nowrap; }
/* интеграции */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
@media (max-width: 720px) { .conn-grid { grid-template-columns: minmax(0, 1fr); } }
.conn-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; background: var(--surface); }
.list.compact th, .list.compact td { padding: 5px 8px; font-size: 12px; }
.danger-badge { background: color-mix(in srgb, #d64545 16%, var(--surface)); color: #d64545; }
.conn-ref { padding: 9px 11px; border-radius: 8px; background: var(--surface-2); gap: 8px; align-items: center; flex-wrap: wrap; }
.conn-ref .ico { color: var(--accent); }
.page .stack > .integ-card { margin: 0; }
.list.compact td code { white-space: nowrap; }
.list.compact .gitea-link { word-break: normal; overflow-wrap: anywhere; }
.list.compact td:nth-child(3) { white-space: nowrap; }
/* несколько репозиториев у доски */
.repo-list { display: flex; flex-direction: column; gap: 4px; }
.repo-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.repo-row .row { gap: 6px; min-width: 0; flex-wrap: wrap; }
.repo-row .mono { overflow-wrap: anywhere; }
.repos-edit select { max-width: 100%; }
.empty-code { flex-wrap: wrap; gap: 8px; }
.repo-pick { max-width: 100%; font-size: 13px; padding: 4px 6px; }
/* номера задач */
.card-top { display: flex; align-items: flex-start; gap: 6px; min-width: 0; margin-bottom: 5px; }
.card-top .labels { flex: 1; min-width: 0; margin: 0; }
.card-key { flex: none; margin-left: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; line-height: 1.4; color: var(--muted); background: transparent;
  border: 1px solid transparent; border-radius: 4px; padding: 0 4px; cursor: copy; font-variant-numeric: tabular-nums; }
.card-key:hover { border-color: var(--border); color: var(--text); }
.card-key.big { font-size: 13px; padding: 1px 6px; border-color: var(--border); margin: 0; }
.card-key.plain { margin: 0; padding: 0; font-size: 12px; color: var(--text); }
.title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-row .title-input { flex: 1; min-width: 0; }
.board-key { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }
.chip-btn { border: 0; cursor: pointer; font-family: inherit; line-height: inherit; }
.chip-btn:hover { filter: brightness(1.08); outline: 1px solid rgba(0,0,0,.15); }
/* фильтр по меткам */
.label-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.label-bar.empty { display: none; }
.label-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.label-toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lc); display: inline-block; }
.label-toggle .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.label-toggle.on { border-color: var(--lc); box-shadow: inset 0 0 0 1px var(--lc); background: color-mix(in srgb, var(--lc) 14%, var(--surface)); }
/* вид «Список» */
.list-view { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.task-list { width: 100%; }
.task-list th.sortable button { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; white-space: nowrap; }
.task-list th.on button { color: var(--accent); }
.task-list tbody tr { cursor: pointer; }
.task-list tbody tr:hover { background: var(--surface-2); }
.task-list tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.task-list tr.is-done td { opacity: .6; }
.task-list .l-title { min-width: 220px; }
.task-list .labels { margin: 0; flex-wrap: wrap; }
.task-list td.due-over { color: var(--danger, #d64545); font-weight: 500; }
.task-list td.due-soon { color: #b8650a; }
.list-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.board-tools .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.board-tools .seg button { white-space: nowrap; }
.code-foot { align-items: center; gap: 8px; margin-top: 2px; }
