:root {
  color-scheme: dark;
  --page: #0e0f12;
  --surface: #16171b;
  --surface-2: #1c1d22;
  --surface-3: #24252b;
  --grid: #24252b;
  --grid-strong: #33343b;
  --ink: #ececf1;
  --ink-2: #a3a3ad;
  --muted: #6e6f7a;
  --border: rgba(255, 255, 255, 0.08);
  --blue: #5b8def;
  --green: #3fa66b;
  --red: #e5534b;
  --amber: #e0a030;
  --teal: #2fbfa3;
  --on-ink: #111; /* текст на кнопках цвета --ink */
  --red-text: #ff8a82;
  --green-text: #6fd39a;
  --shade: rgba(255, 255, 255, 0.018);
  --tip-bg: #26272d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --left: 340px;
  --row-task: 56px;
  --row-stage: 36px;
  --row-group: 38px;
  --head: 64px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--page);
}

/* Светлая тема: переключатель в шапке, выбор хранится в браузере */
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-3: #e5e7ec;
  --grid: #eceef2;
  --grid-strong: #d6d9e0;
  --ink: #1b1c21;
  --ink-2: #565a64;
  --muted: #8a8e98;
  --border: rgba(0, 0, 0, 0.1);
  --blue: #3d6fd9;
  --green: #2f9560;
  --red: #d8443c;
  --amber: #c98a12;
  --teal: #16977f;
  --on-ink: #fff;
  --red-text: #c9372f;
  --green-text: #23824f;
  --shade: rgba(0, 0, 0, 0.025);
  --tip-bg: #ffffff;
  --shadow: 0 10px 30px rgba(20, 22, 30, 0.16);
}

* { box-sizing: border-box; }
body { margin: 0; padding: 0 32px 40px; max-width: 1720px; margin-inline: auto; }
a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h1 span { color: var(--ink-2); font-weight: 400; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Шапка */
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 28px 0 18px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.meta { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.meta b { color: var(--ink); }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tabs button { border: 0; background: none; padding: 8px 16px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-size: 15px; }
.tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--ink); }
.tabs .count { color: var(--muted); font-size: 12px; margin-left: 4px; }
.banner { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface); box-shadow: inset 3px 0 0 var(--amber), 0 0 0 1px var(--border); }

/* Панель управления */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.spacer { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; width: 320px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; outline: none; }
.segmented { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.btn { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 500; }
.btn-primary:hover { background: var(--ink); opacity: 0.88; }
.btn-small { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 999px; }
.btn:disabled { color: var(--muted); cursor: progress; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background 0.15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-2); transition: transform 0.15s; }
.switch input:checked + .switch-ui { background: var(--ink); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); background: var(--on-ink); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--blue); outline-offset: 2px; }
body[data-view="team"] .tasks-only { display: none; }

/* Таблица с временной шкалой. Вертикально листается вся страница; шапка шкалы прилипает к верху экрана,
   горизонтальная прокрутка — у таблицы и шапки общая (app.js, syncScroll). */
.col-resizer { position: absolute; top: 0; z-index: 9; width: 11px; margin-left: -5px; cursor: col-resize; touch-action: none; }
.col-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 1px; background: transparent; transition: background 0.15s, box-shadow 0.15s; }
.col-resizer:hover::after, .col-resizer:focus-visible::after, .col-resizer.dragging::after { background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.col-resizer:focus-visible { outline: none; }
body.col-resizing { cursor: col-resize; user-select: none; }
.board-head { position: sticky; top: 0; z-index: 8; background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; border-radius: 14px 14px 0 0; overflow: hidden; }
.board-head:empty { display: none; }
main { position: relative; }
.board { position: relative; overflow-x: auto; overflow-y: hidden; background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 14px 14px; scrollbar-width: none; }
.board::-webkit-scrollbar { display: none; }
/* Мышь и трекпад: вбок таблицу двигает app.js (колесо) или полоса прокрутки шкалы, см. sideways в app.js */
@media (hover: hover) and (pointer: fine) { .board { overflow-x: hidden; } }
.board.scrolling { pointer-events: none; }
.board-head:empty + .board { border-top: 1px solid var(--border); border-radius: 14px; }
.grid { position: relative; min-width: 100%; }
.empty { padding: 48px; text-align: center; color: var(--ink-2); }

.head { display: flex; background: var(--surface-2); border-bottom: 1px solid var(--grid-strong); }
.head-viewport { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.head-left { flex: none; width: var(--left); display: flex; align-items: flex-end; justify-content: space-between; padding: 0 16px 12px; background: var(--surface-2); border-right: 1px solid var(--grid-strong); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.head-track { position: relative; height: var(--head); }
.head-row { position: absolute; left: 0; right: 0; height: 32px; }
.head-row.top-row { top: 0; }
.head-row.bottom-row { top: 32px; border-top: 1px solid var(--grid); }
.head-cell { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 8px; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; border-left: 1px solid var(--grid); }
.top-row .head-cell { color: var(--ink); font-weight: 600; font-size: 13px; }
.head-cell.today-cell { background: var(--ink); color: var(--on-ink); font-weight: 600; }

.bg { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 0; }
.bg-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.bg-line.strong { background: var(--grid-strong); }
.bg-shade { position: absolute; top: 0; bottom: 0; background: var(--shade); }
.today-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); z-index: 3; pointer-events: none; }

.row { position: relative; display: flex; border-bottom: 1px solid var(--grid); }
.row > .left { position: sticky; left: 0; z-index: 4; flex: none; width: var(--left); background: var(--surface); border-right: 1px solid var(--grid-strong); display: flex; align-items: center; min-width: 0; }
.row > .track { position: relative; flex: none; z-index: 1; }
.row:hover > .left, .row:hover { background-color: color-mix(in srgb, var(--surface) 95%, var(--ink)); }
.row-group { height: var(--row-group); background: var(--surface-2); }
.row-group > .left { background: var(--surface-2); padding: 0 16px; gap: 8px; font-weight: 600; }
.row-group .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.row-task { height: var(--row-task); }
.row-task > .left { padding: 0 12px 0 0; box-shadow: inset 3px 0 0 var(--accent-line, transparent); }
.row-stage { height: var(--row-stage); }
.row-stage > .left { padding: 0 14px 0 36px; gap: 8px; font-size: 13px; color: var(--ink-2); }
.row-stage .stage-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.row-stage .stage-who { flex: none; max-width: 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; text-align: right; }
.row-stage .stage-nodates, .row-issue .stage-nodates { font-size: 11px; color: var(--muted); padding: 0 8px; position: absolute; top: 50%; transform: translateY(-50%); white-space: nowrap; }
/* Вкладка «Задачи»: раздел, подгруппа (статус команды, закрытые в спринте), задача спринта, возврат */
.row-section > .left { padding-left: 0; gap: 6px; }
.row-section .caret { width: 32px; }
.row-sub { height: 32px; }
.row-sub > .left { padding: 0 16px 0 14px; gap: 8px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.row-sub .caret { width: 24px; margin-right: -4px; }
.row-sub .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.caret-space { flex: none; width: 20px; }
.row-issue { height: 48px; }
.row-issue .task-name { font-size: 13px; }
.row-issue.nested > .left { padding-left: 22px; }
.row-return.nested > .left { padding-left: 58px; }
.row-return > .left { padding-left: 46px; }
.row-return .stage-name { color: var(--ink-2); }
.returns-badge { flex: none; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 11px; line-height: 16px; }
.returns-badge.open { background: rgba(224, 160, 48, 0.18); color: var(--amber); font-weight: 600; }
.lg-return { display: inline-block; width: 16px; text-align: center; color: var(--amber); }
.timing-wrap { overflow-x: auto; }
table.timing { width: 100%; border-collapse: collapse; font-size: 13px; }
table.timing th { text-align: left; font-weight: 500; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 8px 6px 0; }
table.timing td { padding: 8px 8px 8px 0; border-top: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
table.timing td:first-child { white-space: normal; min-width: 0; width: 40%; overflow-wrap: anywhere; }
table.timing tfoot td { font-weight: 500; }
table.timing .muted { color: var(--muted); }
table.flow-table td:first-child { width: 42%; }
table.flow-table td:nth-child(2) { white-space: normal; }
table.flow-table .sq { display: inline-block; vertical-align: middle; margin-right: 4px; }
.timing-who { margin-top: 2px; font-size: 12px; color: var(--ink-2); }
.timing-state { margin-left: 4px; font-size: 11px; font-weight: 600; }
.timing-state.run { color: var(--blue); }
.timing-state.wait { color: var(--red); }
.timing-state.test { color: var(--amber); }
table.timing th { cursor: help; vertical-align: bottom; white-space: normal; line-height: 1.3; }
table.timing td:not(:first-child), table.timing th:not(:first-child) { text-align: right; padding-right: 0; padding-left: 8px; }
.link-button { border: 0; background: none; padding: 0; font: inherit; color: var(--link, var(--blue)); cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }

.caret { flex: none; width: 36px; height: 100%; border: 0; background: none; cursor: pointer; color: var(--ink-2); display: flex; align-items: center; justify-content: center; }
.caret::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
.caret[aria-expanded="true"]::before { transform: rotate(45deg); margin-top: -4px; }
.caret:disabled { visibility: hidden; }
.task-text { min-width: 0; flex: 1; }
.task-name { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-name:hover { text-decoration: underline; text-decoration-color: var(--muted); }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.task-meta > span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* Метки состояния */
.sq { flex: none; width: 9px; height: 9px; border-radius: 2px; background: var(--muted); }
.sq.done { background: var(--green); }
.sq.todo { background: var(--muted); }
.sq.in_work { background: var(--blue); }
.sq.testing { background: var(--amber); }
.sq.publication { background: var(--green); }
.sq.planned { background: none; border: 1.5px dashed var(--ink-2); }
.sq.postponed { background: var(--amber); }
.sq.nodates { background: var(--muted); }
.sq.free { background: none; border: 1.5px dashed var(--teal); }

/* Полосы */
.bar { position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 5px; background: var(--blue); overflow: hidden; cursor: default; }
.row-stage .bar { height: 10px; margin-top: -5px; border-radius: 4px; }
.bar.done { background: var(--green); }
.bar.todo { background: var(--muted); }
.bar.flow { border-radius: 0; }
.bar.flow.first { border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.bar.flow.last { border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.bar.flow:not(.last) { box-shadow: inset -1px 0 0 var(--surface); }
/* Публикация — сплошные цвета без штриховки: бирюзовый → мягкий зелёный → насыщенный зелёный */
.bar.flow.pub-ready, .sq.pub-ready, .lg-pub-ready { background: var(--teal); }
.bar.flow.pub-test, .sq.pub-test, .lg-pub-test { background: color-mix(in srgb, var(--green) 65%, #fff); }
.bar.flow.pub-all, .sq.pub-all, .lg-pub-all { background: color-mix(in srgb, var(--green) 85%, #000); }
.flow-label { position: absolute; inset: 0; padding: 0 6px; font-size: 10.5px; line-height: 16px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 2px rgba(0, 0, 0, 0.35); pointer-events: none; }
.plan-rest { --c: var(--blue); position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 0 5px 5px 0; background: color-mix(in srgb, var(--c) 16%, transparent); outline: 1px dashed color-mix(in srgb, var(--c) 70%, transparent); outline-offset: -1px; }
.plan-rest.testing { --c: var(--amber); }
.plan-rest.todo { --c: var(--muted); }
.plan-rest.pub-ready { --c: var(--teal); }
.plan-rest.pub-test, .plan-rest.pub-all { --c: var(--green); }
.plan-rest .flow-label { color: var(--c); text-shadow: none; }
.bar.flow.pub-test .flow-label { color: #14432a; text-shadow: none; }
.lg-rest { background: color-mix(in srgb, var(--blue) 16%, transparent); outline: 1px dashed var(--blue); outline-offset: -1px; }
.fix-line { position: absolute; top: 50%; margin-top: 11px; height: 4px; border-radius: 2px; background: var(--red); }
.due-tick { position: absolute; top: 50%; height: 26px; margin-top: -13px; width: 2px; margin-left: -1px; background: var(--ink-2); border-radius: 1px; }
.due-tick.overdue { background: var(--red); }
.bar.testing { background: var(--amber); }
.bar.publication { background: var(--green); }
.bar.planned { background: none; box-shadow: inset 0 0 0 1.5px var(--ink-2); background-image: none; border: 0; }
.bar.planned { outline: 1.5px dashed var(--ink-2); outline-offset: -1.5px; box-shadow: none; }
.bar.open { background: linear-gradient(90deg, var(--blue), rgba(91, 141, 239, 0.15)); }
.bar.done.open { background: var(--green); }
.bar.testing.open { background: linear-gradient(90deg, var(--amber), rgba(224, 160, 48, 0.15)); }
.bar.publication.open { background: linear-gradient(90deg, var(--green), rgba(63, 166, 107, 0.15)); }
.bar .late { position: absolute; top: 0; bottom: 0; right: 0; background: var(--red); }
.bar.planned .late { background: rgba(229, 83, 75, 0.35); }
.bar.done .late { background: repeating-linear-gradient(135deg, var(--red) 0 4px, transparent 4px 8px); }
.pin { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; transform: rotate(45deg); background: var(--blue); border-radius: 2px; }
.row-stage .pin { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; }
.pin.done { background: var(--green); }
.pin.testing { background: var(--amber); }
.pin.publication { background: var(--green); }
.pin.planned { background: none; outline: 1.5px dashed var(--ink-2); }
/* Красный отражает срок, не меняя фазу проекта и его группу. */
.bar.deadline-overdue, .pin.deadline-overdue { background: var(--red); outline: none; box-shadow: none; }
.bar.overdue-continuation { background: rgba(229, 83, 75, 0.08); border: 1.5px dashed rgba(229, 83, 75, 0.65); border-radius: 0 5px 5px 0; box-shadow: none; }

/* Команда */
.row-person { height: var(--row-task); }
.row-person > .left { padding: 0 14px 0 0; gap: 10px; }
.row-person .caret { margin-right: -6px; }
.row-person .lane-bar { top: 50%; margin-top: -11px; }
.stage-link { display: block; border: 0; background: none; padding: 0; font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.stage-link:hover { text-decoration: underline; text-decoration-color: var(--muted); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person-status { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.person-status.free { color: var(--teal); font-weight: 500; }
.lane-bar { position: absolute; height: 22px; border-radius: 5px; background: rgba(91, 141, 239, 0.22); box-shadow: inset 2px 0 0 var(--blue); overflow: hidden; cursor: pointer; display: flex; align-items: center; }
.lane-bar span { position: relative; z-index: 1; padding: 0 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-bar .late { position: absolute; top: 0; bottom: 0; right: 0; background: rgba(229, 83, 75, 0.35); }
.lane-bar.future { background: none; outline: 1.5px dashed var(--ink-2); outline-offset: -1.5px; box-shadow: none; color: var(--ink-2); }
.lane-bar.free { background: rgba(47, 191, 163, 0.1); outline: 1.5px dashed var(--teal); outline-offset: -1.5px; box-shadow: none; color: var(--teal); cursor: default; font-weight: 500; }
.lane-bar { color: inherit; text-decoration: none; }
.lane-bar.deadline-overdue { background: rgba(229, 83, 75, 0.35); box-shadow: inset 2px 0 0 var(--red); }
.lane-bar:not(.free):hover { filter: brightness(1.25); }

/* Легенда */
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-size: 13px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 30px; height: 12px; border-radius: 4px; flex: none; }
.legend-note { flex-basis: 100%; color: var(--muted); font-size: 12px; max-width: 900px; }
.legend-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.legend-head { width: 64px; flex: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.legend-row .legend-note { flex-basis: auto; margin-left: auto; }
.lg-blue { background: var(--blue); }
.lg-todo { background: var(--muted); }
.lg-fix { height: 4px !important; background: var(--red); }
.lg-due { width: 2px !important; height: 16px !important; background: var(--ink-2); border-radius: 0 !important; }
.lg-deadline-overdue { background: var(--red); }
.lg-testing { background: var(--amber); }
.lg-publication { background: var(--green); }
.lg-dashed { outline: 1.5px dashed var(--ink-2); outline-offset: -1.5px; }
.lg-green { background: var(--green); }
.lg-late { background: linear-gradient(90deg, var(--blue) 55%, var(--red) 55%); }
.lg-donelate { background: linear-gradient(90deg, var(--green) 55%, transparent 55%), repeating-linear-gradient(135deg, var(--red) 0 4px, var(--green) 4px 8px); }
.lg-pin { width: 11px !important; height: 11px !important; transform: rotate(45deg); background: var(--blue); border-radius: 2px !important; margin: 0 9px; }
.lg-today { width: 2px !important; height: 16px !important; background: var(--ink); border-radius: 0 !important; }
.lg-work { background: rgba(91, 141, 239, 0.22); box-shadow: inset 2px 0 0 var(--blue); }
.card-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.card-list li { margin-bottom: 3px; }
.card-list a { color: var(--ink); }
[hidden] { display: none !important; }
.lg-free { background: rgba(47, 191, 163, 0.1); outline: 1.5px dashed var(--teal); outline-offset: -1.5px; }

/* Подсказка */
.tip { position: fixed; z-index: 30; max-width: 340px; padding: 10px 12px; border-radius: 10px; background: var(--tip-bg); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }
.tip b { display: block; font-size: 13px; margin-bottom: 6px; }
.tip dl { display: grid; grid-template-columns: max-content auto; gap: 3px 10px; margin: 0; }
.tip dt { color: var(--muted); }
.tip dd { margin: 0; }
.tip ul { margin: 6px 0 0; padding-left: 16px; color: var(--ink-2); }
.tip.project-summary { width: min(480px, calc(100vw - 16px)); max-width: 480px; max-height: min(420px, calc(100vh - 16px)); overflow-y: auto; pointer-events: auto; }
.tip .tip-tasks { list-style: none; padding: 0; margin-top: 8px; }
.tip-tasks li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--border); }
.tip-task-name { min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.tip-task-status { flex: none; max-width: 44%; text-align: right; color: var(--ink-2); }
.tip-empty { margin-top: 8px; color: var(--ink-2); }

/* Боковая карточка */
.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); }
.drawer { position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border); padding: 24px 26px 40px; }
.drawer-close { position: absolute; top: 18px; right: 18px; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12px; }
.pill.todo { background: var(--surface-3); color: var(--ink-2); }
.pill.testing { background: rgba(224, 160, 48, 0.16); color: var(--amber); }
.pill.publication { background: rgba(63, 166, 107, 0.16); color: var(--green-text); }
.drawer h2 { margin: 14px 46px 4px 0; line-height: 1.25; }
.drawer .sub { color: var(--ink-2); font-size: 13px; }
.drawer section { margin-top: 26px; }
.drawer h3 { margin-bottom: 10px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.field { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.field-value { margin-top: 4px; overflow-wrap: anywhere; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
s { color: var(--muted); }
.stage-card { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; }
.stage-card .check { width: 16px; height: 16px; margin-top: 2px; border-radius: 4px; border: 1.5px solid var(--muted); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.stage-card .check.on { background: var(--green); border-color: var(--green); color: #0b1a10; font-weight: 700; }
.stage-card .title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.stage-card .title s, .stage-card .title b { font-weight: 500; }
.stage-card .key { font-size: 12px; color: var(--muted); }
.stage-card .line { grid-column: 2; font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.tone-red { color: var(--red-text); }
.tone-amber { color: var(--amber); }
.tone-green { color: var(--green-text); }
.tone-teal { color: var(--teal); }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; font-size: 13px; }
.history li.bad { box-shadow: inset 3px 0 0 var(--red); }
.history li.ok { box-shadow: inset 3px 0 0 var(--muted); }
.history .when { color: var(--muted); font-size: 12px; margin-top: 3px; }
.summary-line { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 13px; }
.note { padding: 12px; border-radius: 10px; border: 1px dashed var(--grid-strong); color: var(--ink-2); font-size: 13px; }
.project-item { display: block; color: inherit; text-decoration: none; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.project-item:hover { border-color: var(--grid-strong); }
.project-item .sub { margin-top: 3px; }

footer { margin-top: 28px; color: var(--ink-2); font-size: 13px; }
footer summary { cursor: pointer; font-weight: 500; }
dl.method { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 10px 0 0; max-width: 1000px; }
dl.method dt { color: var(--ink); font-weight: 500; }
dl.method dd { margin: 0; }

@media (max-width: 800px) {
  body { padding: 0 12px 32px; }
  :root { --left: 180px; }
  h1 { font-size: 20px; }
  .search { width: 100%; }
  .spacer { display: none; }
  .filters { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filters button { flex: none; }
  .row-stage > .left { padding-left: 14px; }
  .row-stage .stage-who { display: none; }
  .caret { width: 28px; }
  .fields { grid-template-columns: 1fr; }
  dl.method { grid-template-columns: 1fr; }
}

/* Телефон: шапка, панель и сводка ужаты, чтобы диаграмма начиналась на первом экране */
@media (max-width: 800px) {
  body { padding: 0 10px 24px; }
  .top { padding: 12px 0 8px; gap: 8px; }
  h1 { font-size: 17px; }
  .meta { margin-top: 2px; font-size: 11px; gap: 2px 6px; }
  #today-label, #today-label + span { display: none; }
  .tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding: 3px; border-radius: 10px; }
  .tabs button { flex: 1 0 auto; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .toolbar { gap: 6px; margin-bottom: 8px; }
  .search { height: 36px; }
  .segmented { padding: 2px; border-radius: 8px; }
  .segmented button { padding: 4px 8px; font-size: 12px; }
  .switch { font-size: 12px; gap: 6px; }
  .btn { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
  #expand-all, #new-task { display: none; }
  .top-right { width: 100%; gap: 6px; }
  #theme { height: 34px; width: 34px; padding: 0; justify-content: center; font-size: 15px; flex: none; }
  .theme-label { display: none; }
  .top-right .tabs { flex: 1; }
  .toolbar .search { flex: 1 1 55%; width: auto; min-width: 0; }
  #to-today { order: 1; height: 36px; }
  .toolbar .segmented, .toolbar .switch { order: 2; }
  .legend { gap: 6px 14px; font-size: 12px; }
}
