/* Шрифт агентства (как на boldyrevv.ru) */
@font-face { font-family: 'Gilroy'; src: url('/fonts/Gilroy-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Gilroy'; src: url('/fonts/Gilroy-Medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Gilroy'; src: url('/fonts/Gilroy-Semibold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Gilroy'; src: url('/fonts/Gilroy-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }

:root {
  /* Палитра boldyrevv.ru: оранжевый акцент, графит, серые плашки без обводок */
  --orange: #fc542e;
  --orange-hover: #e8441f;
  --orange-soft: #ffe8e1;
  --navy: #14191e;
  --navy-2: #1e252c;

  --bg: #ebedef;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e4e7ea;
  --line: #eceef0;
  --text: #12181e;
  --text-2: #5b646d;
  --text-3: #9aa1a8;
  --accent: var(--orange);
  --accent-ink: #ffffff;
  --accent-soft: var(--orange-soft);
  --link: #e2431f;
  --good: #1f8a52;
  --good-soft: #e3f3ea;
  --bad: #e2431f;
  --bad-soft: #ffe8e1;
  --warn: #b5541c;
  --warn-soft: #fff0e6;
  --chart-bar: #dfe2e6;
  --chart-ink: #14191e;
  --chart-line: var(--orange);
  --border: #eceef0;
  --radius: 24px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a929a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --radius-md: 18px;
  --radius-sm: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419;
    --surface: #182029;
    --surface-2: #1f2933;
    --surface-3: #2a3540;
    --line: #232d37;
    --text: #f1f2f3;
    --text-2: #b0b6bc;
    --text-3: #77808a;
    --navy: #0a0e12;
    --orange-soft: #3a2119;
    --accent-soft: #3a2119;
    --link: #ff8562;
    --good: #5fd08f;
    --good-soft: #17301f;
    --bad: #ff8562;
    --bad-soft: #3a2119;
    --warn: #ffab70;
    --warn-soft: #33241a;
    --chart-bar: #2d3843;
    --chart-ink: #c9ced3;
    --border: #232d37;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #182029;
  --surface-2: #1f2933;
  --surface-3: #2a3540;
  --line: #232d37;
  --text: #f1f2f3;
  --text-2: #b0b6bc;
  --text-3: #77808a;
  --navy: #0a0e12;
  --orange-soft: #3a2119;
  --accent-soft: #3a2119;
  --link: #ff8562;
  --good: #5fd08f;
  --good-soft: #17301f;
  --bad: #ff8562;
  --bad-soft: #3a2119;
  --warn: #ffab70;
  --warn-soft: #33241a;
  --chart-bar: #2d3843;
  --chart-ink: #c9ced3;
  --border: #232d37;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 'Gilroy', 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code { font-size: 13px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
button { font: inherit; color: inherit; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.loading { padding: 80px; text-align: center; color: var(--text-3); }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.logo small { font-weight: 500; font-size: 12px; color: var(--text-3); padding-left: 12px; border-left: 1px solid var(--surface-3); line-height: 1.15; max-width: 72px; white-space: normal; }
.logo-img { height: 32px; width: auto; display: block; }
.logo-img.on-dark { display: none; }
:root[data-theme="dark"] .logo-img.on-light { display: none; }
:root[data-theme="dark"] .logo-img.on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .logo-img.on-light { display: none; }
  :root:not([data-theme]) .logo-img.on-dark { display: block; }
}
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 16px; border-radius: 999px; color: var(--text-2); font-weight: 500; white-space: nowrap; font-size: 14px; }
.tabs a:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.tabs a.on { background: var(--text); color: var(--surface); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; background: var(--surface); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.who-chip .nm { font-size: 13px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg, .btn svg { width: 16px; height: 16px; flex: none; }
.client-pick { height: 40px; border: 0; border-radius: 999px; padding: 0 34px 0 16px; background: var(--surface) var(--chevron) no-repeat right 12px center / 15px; color: var(--text); font: 500 14px 'Gilroy', sans-serif; appearance: none; cursor: pointer; max-width: 220px; }

.main { max-width: 1320px; margin: 0 auto; padding: 18px 28px 64px; }

/* ---------- Заголовок страницы ---------- */
.page-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin: 10px 0 26px; }
.page-head .title { flex: 1; min-width: 260px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 14px; margin-bottom: 14px; }
.crumb:hover { color: var(--text); text-decoration: none; }
.h1 { font-size: 46px; line-height: 1.04; font-weight: 500; letter-spacing: -0.025em; }
.h1 .sub { display: block; color: var(--text-3); }
.lead { margin: 14px 0 0; color: var(--text-2); max-width: 560px; font-size: 15px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subtabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 999px; margin-bottom: 18px; }
.subtabs a { padding: 8px 18px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 14px; }
.subtabs a:hover { text-decoration: none; color: var(--text); }
.subtabs a.on { background: var(--accent); color: #fff; }

/* ---------- Плитки-показатели ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border-radius: var(--radius-md); padding: 18px 18px 16px; min-height: 148px; display: flex; flex-direction: column; position: relative; }
.tile .t-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.tile .t-value { font-size: 44px; line-height: 1; font-weight: 500; letter-spacing: -0.03em; margin-top: auto; padding-top: 18px; white-space: nowrap; }
.tile .t-value small { font-size: 20px; letter-spacing: 0; margin-left: 2px; color: var(--text-3); }
.tile .t-foot { font-size: 12px; color: var(--text-3); margin-top: 8px; display: flex; gap: 8px; align-items: center; min-height: 18px; overflow: hidden; }
.tile .t-foot span.cut { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.dark { background: var(--navy); color: #fff; }
.tile.dark .t-label { color: rgba(255, 255, 255, 0.7); }
.tile.dark .t-foot, .tile.dark .t-value small { color: rgba(255, 255, 255, 0.55); }
.tile.soft { background: color-mix(in srgb, var(--surface) 55%, var(--surface-3)); }
.meter { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.tile.dark .meter { background: rgba(255, 255, 255, 0.14); }

/* ---------- Карточки и сетки ---------- */
.stack { display: grid; gap: 12px; }
.row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.row.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.section-title { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin: 34px 0 4px; }
.section-sub { color: var(--text-3); font-size: 14px; margin: 0 0 16px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.card.flat { background: color-mix(in srgb, var(--surface) 60%, var(--bg)); }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head .hint { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.card-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { color: var(--text-2); }
.chart-wrap { position: relative; height: 230px; }
.chart-wrap.tall { height: 290px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 14px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.card .btn, .modal .btn { background: var(--surface-2); }
.card .btn:hover, .modal .btn:hover { background: var(--surface-3); }
.btn.primary, .card .btn.primary, .modal .btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--orange-hover); }
.btn.dark, .card .btn.dark { background: var(--text); color: var(--surface); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost, .card .btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.45; cursor: default; }
.input {
  width: 100%; height: 44px; border-radius: 14px; border: 0; padding: 0 14px;
  background: var(--surface-2); color: var(--text); font: 400 15px 'Gilroy', sans-serif; outline: none;
}
.input:focus { box-shadow: 0 0 0 2px var(--accent); background-color: var(--surface); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 70px; line-height: 1.4; }
/* Выпадающие списки: плоская серая плашка и тонкий уголок справа, как у Яндекса */
select.input {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 42px; text-overflow: ellipsis; white-space: nowrap;
  background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 14px center; background-size: 16px;
}
select.input::-ms-expand { display: none; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form .input { height: 40px; }

/* ---------- Период ---------- */
.period { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; gap: 2px; padding: 4px; background: var(--surface); border-radius: 999px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--text); color: var(--surface); }
.daterange { display: flex; gap: 6px; align-items: center; background: var(--surface); border-radius: 999px; padding: 4px 12px; }
.daterange input { border: 0; background: transparent; color: var(--text); font: 500 13px 'Gilroy', sans-serif; height: 30px; min-width: 0; }
.drag-hint { margin-left: auto; }

/* ---------- Значки и изменения ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.warning { background: var(--warn-soft); color: var(--warn); }
.badge.critical { background: var(--bad-soft); color: var(--bad); }
.badge.demo { background: var(--orange-soft); color: var(--link); }
.badge.accent { background: var(--accent); color: #fff; }
.delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--text-3); font-weight: 500; }
.tile.dark .delta.good { color: #7be0a6; }
.tile.dark .delta.bad { color: #ff9c80; }
.mini-delta { display: block; font-size: 11px; margin-top: 2px; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); padding: 8px 10px; white-space: nowrap; }
table.data td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
table.data .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data .arrow { margin-left: 4px; font-size: 9px; }
table.data tr.link { cursor: pointer; }
table.data tr.link:hover td { background: var(--surface-2); }
table.data tr.sel td { background: var(--orange-soft); }
table.data tfoot td { font-weight: 600; }
td.name .t { display: block; color: var(--text); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.name .sub, .sub-line { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 6px; max-width: 220px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.progress-cell { min-width: 160px; }
.progress-cell .bar { max-width: 160px; }

/* ---------- Прогресс-полукруг ---------- */
.gauge { display: grid; place-items: center; padding: 6px 0 0; }
.gauge svg { width: 100%; max-width: 240px; }
.gauge .g-val { font-size: 40px; font-weight: 500; letter-spacing: -0.03em; fill: var(--text); }
.gauge .g-cap { font-size: 11px; fill: var(--text-3); }
.gauge-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 6px; gap: 10px; }

/* ---------- Этапы (колонки) ---------- */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.col { background: var(--surface-2); border-radius: var(--radius-md); padding: 12px; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-size: 13px; font-weight: 600; }
.col-head .count { margin-left: auto; color: var(--text-3); font-weight: 500; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.col-head .dot.doing { background: var(--accent); }
.col-head .dot.done { background: var(--good); }
.stage { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.stage:last-child { margin-bottom: 0; }
.stage .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; border: 0; padding: 0; margin-top: 1px; color: transparent; }
.stage .tick svg { width: 13px; height: 13px; }
.stage.doing .tick { background: var(--orange-soft); color: var(--accent); }
.stage.done .tick { background: var(--navy); color: #fff; }
button.tick { cursor: pointer; }
button.tick:hover { box-shadow: 0 0 0 2px var(--accent); }
.stage .s-body { min-width: 0; flex: 1; }
.stage .s-title { font-weight: 500; font-size: 14px; line-height: 1.3; }
.stage.done .s-title { color: var(--text-2); }
.stage .s-note { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.stage .s-date { font-size: 11px; color: var(--text-3); margin-top: 6px; font-weight: 500; }
.stage.doing .s-date { color: var(--link); }
.stage .s-del { opacity: 0; flex: none; }
.stage:hover .s-del { opacity: 1; }
.col .empty-col { font-size: 13px; color: var(--text-3); padding: 6px; }

/* ---------- Лента ---------- */
.feed { display: grid; gap: 4px; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.feed-item .f-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; }
.feed-item .f-text { flex: 1; font-size: 14px; }
.feed-item .f-date { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.feed-item .icon-btn { width: 24px; height: 24px; opacity: 0; }
.feed-item:hover .icon-btn { opacity: 1; }
.insights .feed-item .f-dot { background: var(--navy); }
.empty-note { color: var(--text-3); font-size: 14px; padding: 6px 2px; }

/* ---------- Горизонтальные полосы ---------- */
.hbars { display: grid; gap: 12px; }
.hbar .hb-top { display: flex; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.hbar .hb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar .hb-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar .hb-share { color: var(--text-3); width: 38px; text-align: right; }
.hbar .hb-track { height: 10px; border-radius: 6px; background: var(--surface-2); }
.hbar .hb-track i { display: block; height: 100%; border-radius: 6px; background: var(--chart-ink); }
.hbar:first-child .hb-track i { background: var(--accent); }

/* ---------- Кольцо ---------- */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut .d-val { font-size: 22px; font-weight: 600; fill: var(--text); }
.donut .d-cap { font-size: 7px; fill: var(--text-3); }
.donut-legend { display: grid; gap: 8px; font-size: 13px; flex: 1; min-width: 160px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.donut-legend span { flex: 1; color: var(--text-2); }
.donut-legend b { font-weight: 600; }

/* ---------- Тепловая карта ---------- */
.heat { display: grid; grid-template-columns: 92px repeat(7, minmax(0, 1fr)); gap: 6px; align-items: center; }
.heat .h-col { text-align: center; font-size: 12px; color: var(--text-3); padding-bottom: 2px; }
.heat .h-row { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.heat .h-cell { height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--text-3); font-variant-numeric: tabular-nums; }
.heat .h-cell.l1 { background: var(--surface-3); color: var(--text-2); }
.heat .h-cell.l2 { background: var(--navy); color: #fff; }
.heat .h-cell.l3 { background: var(--accent); color: #fff; }
.heat .h-cell.none { background: transparent; }

/* ---------- Сигналы ---------- */
.alerts { display: grid; gap: 6px; }
.alert { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.alert .who { font-weight: 600; color: var(--text); }

/* ---------- Доступ клиента ---------- */
.access { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.access code { background: var(--surface-2); }
.creds { background: var(--navy); color: #fff; border-radius: 18px; padding: 18px; font-size: 14px; line-height: 1.7; margin-bottom: 14px; }
.creds b { color: #fff; }
.creds .k { color: rgba(255, 255, 255, 0.55); display: inline-block; width: 72px; }
.creds .warn { color: #ffb39e; font-size: 12px; margin-top: 8px; line-height: 1.4; }

/* ---------- Пусто ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty h2 { font-size: 24px; font-weight: 500; }
.empty p { color: var(--text-2); max-width: 520px; margin: 10px auto 22px; }
.empty .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Окна ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { background: var(--surface); border-radius: 26px; width: 100%; max-width: 500px; max-height: calc(100vh - 32px); overflow: auto; }
.modal-head { display: flex; align-items: center; padding: 22px 24px 6px; }
.modal-head h2 { font-size: 20px; font-weight: 600; flex: 1; }
.modal-body { padding: 12px 24px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 24px 22px; }
details.help { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; color: var(--text-2); }
details.help summary { cursor: pointer; font-weight: 500; color: var(--text); }
details.help .input { background-color: var(--surface); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 12px 20px; border-radius: 999px; font-size: 14px; z-index: 200; max-width: calc(100vw - 32px); }
.toast.error { background: var(--bad); color: #fff; }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; padding: 12px; gap: 12px; }
.auth-side { background: var(--navy); color: #fff; border-radius: 30px; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; overflow: hidden; position: relative; }
.auth-side .logo { color: #fff; }
.auth-side h1 { font-size: 50px; line-height: 1.02; font-weight: 500; letter-spacing: -0.03em; max-width: 560px; }
.auth-side h1 span { color: var(--orange); }
.auth-side p { color: rgba(255, 255, 255, 0.65); max-width: 470px; font-size: 16px; margin: 18px 0 0; }
.auth-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; }
.auth-points div { background: rgba(255, 255, 255, 0.07); border-radius: 18px; padding: 16px; font-size: 14px; color: rgba(255, 255, 255, 0.8); }
.auth-points b { display: block; font-size: 28px; font-weight: 500; color: #fff; margin-bottom: 4px; }
.auth-points div:first-child { background: var(--orange); color: #fff; }
.auth-form { display: grid; place-items: center; padding: 24px; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 34px; font-weight: 500; letter-spacing: -0.02em; }
.auth-form .lead { margin: 8px 0 26px; }
.auth-form .input { background-color: var(--surface); height: 50px; }
.auth-form .btn { height: 50px; width: 100%; font-size: 15px; }


/* ---------- Доска задач ---------- */
.tiles-sm .tile { min-height: 118px; }
.tiles-sm .tile .t-value { font-size: 38px; }
.quick-add { display: flex; gap: 8px; margin: 12px 0; background: var(--surface); border-radius: var(--radius-md); padding: 8px; }
.quick-add .input { height: 44px; background-color: var(--surface-2); }
.quick-add .input[name=title] { flex: 1; min-width: 0; }
.quick-add select.input { width: 210px; }
.quick-add input[type=date] { width: 160px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .client-pick.on { background-color: var(--text); color: var(--surface); }
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: color-mix(in srgb, var(--surface) 45%, var(--bg)); border-radius: var(--radius-md); padding: 10px; min-height: 220px; transition: background 0.15s; }
.kcol.drop { background: var(--orange-soft); }
.kcol .col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-size: 13px; font-weight: 600; }
.kcol .col-head .count { margin-left: auto; color: var(--text-3); font-weight: 500; }
.col-head .dot.backlog { background: var(--surface-3); }
.col-head .dot.todo { background: var(--text-3); }
.col-add { width: 100%; justify-content: flex-start; color: var(--text-3); }
.col-add:hover { color: var(--text); }
.tcard { background: var(--surface); border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: grab; position: relative; }
.tcard:hover { box-shadow: 0 0 0 2px var(--surface-3); }
.tcard.dragging { opacity: 0.4; }
.tcard.pr-high { box-shadow: inset 3px 0 0 var(--accent); }
.tcard.pr-high:hover { box-shadow: inset 3px 0 0 var(--accent), 0 0 0 2px var(--surface-3); }
.tcard.overdue { background: color-mix(in srgb, var(--surface) 72%, var(--bad-soft)); }
.kcol[data-col="done"] .tcard { opacity: 0.7; }
.kcol[data-col="done"] .tc-title { text-decoration: line-through; text-decoration-color: var(--text-3); }
.tc-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tcard .tc-title { font-weight: 500; font-size: 14px; line-height: 1.3; }
.tcard .tc-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.tcard .tc-foot .due { font-weight: 500; }
.tcard .tc-foot .due.late { color: var(--bad); }
.tcard .tc-foot .due.today { color: var(--warn); }
.tcard .tc-foot .meta { display: inline-flex; gap: 4px; align-items: center; }
.tcard .tc-foot svg { width: 13px; height: 13px; }
.proj-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-chip.none { background: var(--surface-2); color: var(--text-3); }
a.proj-chip:hover { text-decoration: none; filter: brightness(0.95); }
/* Цвета проектов: мягкая заливка и насыщенный текст того же оттенка, сами подстраиваются под тёмную тему */
.proj-chip[class*=" pc"] { background: color-mix(in srgb, var(--pc) 16%, var(--surface)); color: color-mix(in srgb, var(--pc) 80%, var(--text)); }
.pc0 { --pc: #6b8e23; }
.pc1 { --pc: #2f7bf5; }
.pc2 { --pc: #1f9a5b; }
.pc3 { --pc: #8b5cf6; }
.pc4 { --pc: #d4930d; }
.pc5 { --pc: #e0457b; }
.pc6 { --pc: #0e9aa7; }
.pc7 { --pc: #64748b; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--pc); cursor: pointer; position: relative; display: grid; place-items: center; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--pc); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 4px; }
.badge.sm { height: 20px; padding: 0 8px; font-size: 11px; }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 11px; margin-left: 4px; }
.subtabs a.on .count-pill { background: rgba(255, 255, 255, 0.25); color: #fff; }

.drawer-back { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.45); z-index: 90; display: flex; justify-content: flex-end; }
.drawer { width: min(640px, 100%); height: 100%; background: var(--surface); overflow-y: auto; padding: 22px 26px 40px; border-radius: 26px 0 0 26px; }
.drawer-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.drawer-head h2 { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.drawer .btn { background: var(--surface-2); }
.drawer .btn.primary { background: var(--accent); color: #fff; }
.drawer .btn.dark { background: var(--text); color: var(--surface); }
.btn.good, .drawer .btn.good { background: var(--good-soft); color: var(--good); }
.sect { margin-top: 26px; }
.sect h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.pre { white-space: pre-wrap; }
.history { display: grid; gap: 6px; font-size: 13px; }
.history div { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.modal.wide { max-width: 620px; }
.inline-form textarea.input { min-height: 44px; flex: 1; }

@media (max-width: 860px) {
  .quick-add { flex-wrap: wrap; }
  .quick-add .input[name=title] { flex-basis: 100%; }
  .quick-add select.input, .quick-add input[type=date] { flex: 1; width: auto; }
  .board { grid-template-columns: repeat(4, 80vw); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; }
  .kcol { scroll-snap-align: start; }
  .drawer { border-radius: 0; padding: 18px 16px 40px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
}

.alert.task-line { color: var(--text); }
.alert.task-line:hover { text-decoration: none; background: var(--surface-3); }

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row, .row.even, .row.wide { grid-template-columns: minmax(0, 1fr); }
  .h1 { font-size: 38px; }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .top .tabs { order: 3; width: 100%; }
  .who-chip .nm { display: none; }
  .client-pick { max-width: 150px; }
  .main { padding: 10px 16px 48px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { padding: 28px 22px; gap: 26px; }
  .auth-side h1 { font-size: 34px; }
  .auth-points { display: none; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .card { padding: 18px 16px; }
}
@media (max-width: 520px) {
  .h1 { font-size: 32px; }
  .tile { min-height: 124px; padding: 14px; }
  .tile .t-value { font-size: 32px; }
  .heat { grid-template-columns: 64px repeat(7, minmax(0, 1fr)); gap: 4px; }
  .heat .h-cell { height: 34px; border-radius: 9px; font-size: 12px; }
  .heat .h-row { font-size: 11px; }
  .logo .txt { display: none; }
  .delta .dl { display: none; }
}

/* Длинные ссылки и токены в подсказках переносятся, а не раздвигают страницу на телефоне */
code { overflow-wrap: anywhere; }

/* ---------- Телефон ---------- */
@media (max-width: 860px) {
  /* iOS приближает страницу, когда фокус попадает в поле со шрифтом меньше 16px — поэтому на телефоне 16px */
  .input, select, textarea, input, .client-pick { font-size: 16px; }
  /* Поля даты в iOS имеют свою минимальную ширину и вылезают за экран — снимаем её */
  input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
  input[type=date]::-webkit-date-and-time-value { text-align: left; }

  /* Период: кнопки в одну строку с прокруткой, как меню; выбор дат — плашка на всю ширину */
  .period { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .period .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; display: flex; }
  .period .seg::-webkit-scrollbar { display: none; }
  .period .seg button { white-space: nowrap; flex: none; font-size: 14px; }
  .daterange { width: 100%; padding: 6px 16px; }
  .daterange input { flex: 1; width: 100%; height: 34px; font-size: 16px; }

  /* Фильтры задач: проект на всю ширину, приоритет и срок — две колонки под ним */
  .task-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-filters .client-pick { max-width: none; width: 100%; }
  .task-filters [data-f=client], .task-filters [data-reset], .task-filters .drag-hint { grid-column: 1 / -1; }
  .task-filters .drag-hint { margin-left: 0; }

  /* Строка быстрого добавления: дата и кнопка делят ширину и не вылезают */
  .quick-add select.input { flex-basis: 100%; }
  .quick-add input[type=date] { flex: 1 1 0; min-width: 0; }
}
