/* Шрифт и плашки — по брендбуку клиентского кабинета: тональные поверхности без обводок, акцент — красный */
@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 {
  --red: #e84534;
  --red-hover: #d43a2a;
  --red-soft: #fde6e3;
  --ink: #090909;
  --ink-2: #1a1a1a;

  --bg: #ecedee;
  --surface: #ffffff;
  --surface-2: #f3f4f5;
  --surface-3: #e3e5e7;
  --line: #ecedef;
  --text: #090909;
  --text-2: #5c6166;
  --text-3: #9a9fa4;
  --accent: var(--red);
  --accent-soft: var(--red-soft);
  --link: #d43a2a;
  --good: #1f8a52;
  --good-soft: #e2f3e9;
  --bad: #d43a2a;
  --bad-soft: #fde6e3;
  --warn: #a8641b;
  --warn-soft: #fbf0e2;
  --chart-bar: #dcdfe2;
  --chart-ink: #090909;
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090909;
    --surface: #161616;
    --surface-2: #1f1f1f;
    --surface-3: #2b2b2b;
    --line: #242424;
    --text: #f2f2f2;
    --text-2: #b3b3b3;
    --text-3: #7a7a7a;
    --ink: #000000;
    --red-soft: #3a1915;
    --accent-soft: #3a1915;
    --link: #ff7b6c;
    --good: #5fd08f;
    --good-soft: #142b1d;
    --bad: #ff7b6c;
    --bad-soft: #3a1915;
    --warn: #f0b069;
    --warn-soft: #33261a;
    --chart-bar: #2e2e2e;
    --chart-ink: #d6d6d6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090909;
  --surface: #161616;
  --surface-2: #1f1f1f;
  --surface-3: #2b2b2b;
  --line: #242424;
  --text: #f2f2f2;
  --text-2: #b3b3b3;
  --text-3: #7a7a7a;
  --ink: #000000;
  --red-soft: #3a1915;
  --accent-soft: #3a1915;
  --link: #ff7b6c;
  --good: #5fd08f;
  --good-soft: #142b1d;
  --bad: #ff7b6c;
  --bad-soft: #3a1915;
  --warn: #f0b069;
  --warn-soft: #33261a;
  --chart-bar: #2e2e2e;
  --chart-ink: #d6d6d6;
  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; }
button { font: inherit; color: inherit; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.loading { padding: 80px; text-align: center; color: var(--text-3); }
.pre { white-space: pre-line; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  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; flex: none; }
.logo-mark svg { width: 18px; height: 18px; }
.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: 120px; white-space: normal; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 999px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 15px; 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: 12px; flex: none; color: var(--text); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.who-chip .nm { font-size: 13px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-chip .rl { font-size: 11px; color: var(--text-3); display: block; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); position: relative; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg, .btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn .pip { position: absolute; top: 4px; right: 4px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; }
.bell { background: var(--surface); width: 40px; height: 40px; }
.project-pick { height: 40px; border: 0; border-radius: 999px; padding: 0 34px 0 16px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9fa4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px; color: var(--text); font: 500 14px 'Gilroy', sans-serif; appearance: none; cursor: pointer; max-width: 220px; }

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

/* ---------- Заголовок страницы ---------- */
.page-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin: 6px 0 22px; }
.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: 40px; line-height: 1.05; font-weight: 500; letter-spacing: -0.025em; }
.h1 .sub { display: block; color: var(--text-3); }
.lead { margin: 10px 0 0; color: var(--text-2); max-width: 600px; font-size: 15px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Плитки-показатели ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tile { background: var(--surface); border-radius: var(--radius-md); padding: 18px 18px 16px; min-height: 148px; display: flex; flex-direction: column; position: relative; min-width: 0; }
a.tile { color: inherit; }
a.tile:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 80%, var(--surface-3)); }
.tile .t-label { font-size: 13px; color: var(--text-2); font-weight: 500; padding-right: 34px; }
.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; flex-wrap: wrap; }
.tile .t-ico { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.tile .t-ico svg { width: 15px; height: 15px; }
.tile.dark { background: var(--ink); 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.dark .t-ico { background: #fff; color: var(--ink); }
.tile.red { background: var(--accent); color: #fff; }
.tile.red .t-label, .tile.red .t-foot, .tile.red .t-value small { color: rgba(255, 255, 255, 0.82); }
.tile.red .t-ico { background: #fff; color: var(--accent); }
.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.three { grid-template-columns: repeat(3, 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.dark { background: var(--ink); color: #fff; }
.card.dark .card-head .hint, .card.dark .muted { color: rgba(255, 255, 255, 0.6); }
.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; flex-wrap: wrap; justify-content: flex-end; }
.chart-wrap { position: relative; height: 240px; }
.chart-wrap.tall { height: 300px; }
.chart-wrap.short { height: 180px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 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, .drawer .btn { background: var(--surface-2); }
.card .btn:hover, .modal .btn:hover, .drawer .btn:hover { background: var(--surface-3); }
.btn.primary, .card .btn.primary, .modal .btn.primary, .drawer .btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--red-hover); }
.btn.dark, .card .btn.dark, .drawer .btn.dark { background: var(--text); color: var(--surface); }
.btn.good, .drawer .btn.good, .card .btn.good { background: var(--good-soft); color: var(--good); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost, .card .btn.ghost, .drawer .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; min-width: 0;
}
.input:focus { box-shadow: 0 0 0 2px var(--accent); background: var(--surface); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 70px; line-height: 1.4; }
select.input { appearance: auto; }
.input.sm { height: 36px; font-size: 14px; border-radius: 12px; padding: 0 10px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label, .field .lbl { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:checked) { background: var(--text); color: var(--surface); }

/* ---------- Переключатели и фильтры ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; gap: 2px; padding: 4px; background: var(--surface); border-radius: 999px; flex-wrap: wrap; }
.card .seg, .drawer .seg { background: var(--surface-2); }
.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); }
.filter { height: 40px; border: 0; border-radius: 999px; padding: 0 30px 0 14px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9fa4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 13px; color: var(--text); font: 500 13px 'Gilroy', sans-serif; appearance: none; cursor: pointer; max-width: 210px; }
.filter.on { background-color: var(--text); color: var(--surface); }
.month-nav { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border-radius: 999px; padding: 4px; }
.month-nav .m { font-weight: 600; font-size: 14px; padding: 0 10px; min-width: 128px; text-align: center; }
.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; }

/* ---------- Значки ---------- */
.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.accent { background: var(--accent); color: #fff; }
.badge.dark { background: var(--text); color: var(--surface); }
.badge .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge.sm { height: 20px; font-size: 11px; padding: 0 8px; }
.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, .tile.red .delta.good { color: #8ff0b8; }
.tile.dark .delta.bad { color: #ff9c8f; }
.tile.red .delta.bad { color: #fff; }

/* ---------- Таблицы ---------- */
.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: 11px 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 tr.link { cursor: pointer; }
table.data tr.link:hover td { background: var(--surface-2); }
table.data tfoot td { font-weight: 600; }
table.data input.input { height: 34px; border-radius: 10px; padding: 0 8px; font-size: 14px; }
table.data td.name { min-width: 200px; }
td.name .t { display: block; color: var(--text); max-width: 380px; 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); }

/* ---------- Счётчики над доской ---------- */
.counters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.counter { background: var(--surface); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.counter b { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin-left: auto; font-variant-numeric: tabular-nums; }
.counter span { font-size: 13px; color: var(--text-2); font-weight: 500; line-height: 1.2; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.planned { background: var(--text-3); }
.dot.doing { background: var(--text); }
.dot.review { background: var(--accent); }
.dot.done { background: var(--good); }
.dot.published { background: transparent; box-shadow: inset 0 0 0 2px var(--text); }

/* ---------- Канбан ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--radius-md); padding: 10px; min-height: 200px; transition: background 0.15s; }
:root[data-theme="dark"] .col { background: var(--surface); }
.col.drop { background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-size: 13px; font-weight: 600; }
.col-head .count { margin-left: auto; color: var(--text-3); font-weight: 500; }
.col-add { width: 100%; justify-content: flex-start; color: var(--text-3); height: 34px; background: transparent !important; }
.col-add:hover { color: var(--text); }
.tcard { background: var(--surface); border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: pointer; position: relative; }
:root[data-theme="dark"] .tcard { background: var(--surface-2); }
.tcard:hover { box-shadow: 0 0 0 2px var(--surface-3); }
.tcard.dragging { opacity: 0.4; }
.tcard.overdue { background: color-mix(in srgb, var(--surface) 70%, var(--red-soft)); }
.tcard .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: 8px; 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 .meta { display: inline-flex; gap: 3px; align-items: center; }
.tcard .tc-foot svg { width: 13px; height: 13px; }
.tcard .tc-foot .avatar { margin-left: auto; }
.type-chip { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.type-chip.reels { color: var(--accent); }
.empty-col { font-size: 13px; color: var(--text-3); padding: 6px; }

/* ---------- Календарь ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .wd { font-size: 12px; color: var(--text-3); padding: 0 6px 4px; font-weight: 500; }
.cal .day { background: var(--surface); border-radius: 14px; min-height: 120px; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal .day.out { background: transparent; }
.cal .day.out .dn { color: var(--text-3); opacity: 0.5; }
.cal .day.today .dn { background: var(--accent); color: #fff; }
.cal .dn { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.cal .day .add { opacity: 0; margin-left: auto; width: 24px; height: 24px; }
.cal .day:hover .add { opacity: 1; }
.cal .dh { display: flex; align-items: center; }
.pill { display: block; text-align: left; border: 0; width: 100%; background: var(--surface-2); border-radius: 9px; padding: 5px 7px; font-size: 12px; line-height: 1.25; cursor: pointer; color: var(--text); overflow: hidden; }
.pill:hover { background: var(--surface-3); }
.pill .pt { display: flex; gap: 5px; align-items: center; font-size: 10px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.pill .pn { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill.published { background: var(--text); color: var(--surface); }
.pill.published .pt { color: color-mix(in srgb, var(--surface) 65%, transparent); }
.pill.rework { background: var(--red-soft); }

/* ---------- Списки и строки ---------- */
.list { display: grid; gap: 4px; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; min-width: 0; }
a.li { color: inherit; }
a.li:hover, button.li:hover { text-decoration: none; background: var(--surface-3); }
button.li { border: 0; width: 100%; text-align: left; cursor: pointer; }
.li .grow { flex: 1; min-width: 0; }
.li .grow .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .date { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.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); min-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); }
.hbar.pos .hb-track i { background: var(--good); }
.hbar.neg .hb-track i { background: var(--accent); }

/* ---------- Воронка ---------- */
.funnel { display: grid; gap: 8px; }
.fstep { display: grid; grid-template-columns: 130px minmax(0, 1fr) 90px; gap: 12px; align-items: center; }
.fstep .fl { font-size: 13px; color: var(--text-2); }
.fstep .ft { height: 40px; border-radius: 12px; background: var(--surface-2); position: relative; overflow: hidden; }
.fstep .ft i { position: absolute; inset: 0 auto 0 0; border-radius: 12px; background: var(--text); }
.fstep:last-child .ft i { background: var(--accent); }
.fstep .ft b { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; font-weight: 600; color: #fff; mix-blend-mode: difference; }
.fstep .fc { font-size: 12px; color: var(--text-3); text-align: right; }

/* ---------- Сегменты ---------- */
.seg-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.seg-card { background: var(--surface); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; color: inherit; min-width: 0; }
a.seg-card:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 80%, var(--surface-3)); }
.seg-card .sc-top { display: flex; align-items: flex-start; gap: 12px; }
.seg-card .sc-share { font-size: 40px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; margin-left: auto; }
.seg-card .sc-share small { font-size: 18px; color: var(--text-3); }
.seg-card h3 { font-size: 19px; font-weight: 600; line-height: 1.2; }
.seg-card .sc-brief { font-size: 14px; color: var(--text-2); }
.seg-card .sc-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; margin-top: 5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.quote { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: 14px; font-style: italic; }
.bullets { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.bullets li { display: flex; gap: 8px; font-size: 14px; }
.bullets li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 8px; }
.bullets.ink li::before { background: var(--text); }

/* ---------- Раскадровка ---------- */
.scenes td { vertical-align: top; }
.scenes textarea.input { min-height: 54px; font-size: 13px; padding: 8px 10px; border-radius: 10px; }
.scenes .num { width: 34px; color: var(--text-3); font-weight: 600; padding-top: 18px; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.steps button { border: 0; background: var(--surface-2); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.steps button.past { color: var(--text); }
.steps button.on { background: var(--text); color: var(--surface); }
.steps button:disabled { cursor: default; }

/* ---------- Панель-выезжалка ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(9, 9, 9, 0.45); z-index: 90; display: flex; justify-content: flex-end; }
.drawer { width: min(720px, 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: 12px; margin-bottom: 18px; }
.drawer-head h2 { font-size: 24px; font-weight: 500; letter-spacing: -0.015em; flex: 1; line-height: 1.15; }
.drawer .sect { margin-top: 22px; }
.drawer .sect h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-2); }
.approval-box { background: var(--surface-2); border-radius: 18px; padding: 14px; display: grid; gap: 10px; }
.approval-box.done { background: var(--good-soft); color: var(--good); }
.approval-box.rework { background: var(--bad-soft); }

/* ---------- Комментарии ---------- */
.comments { display: grid; gap: 8px; }
.cmt { display: flex; gap: 10px; }
.cmt .cb { background: var(--surface-2); border-radius: 4px 16px 16px 16px; padding: 9px 12px; font-size: 14px; flex: 1; min-width: 0; }
.cmt.internal .cb { background: var(--warn-soft); }
.cmt .cm { font-size: 12px; color: var(--text-3); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; }
.cmt .cm b { color: var(--text); font-weight: 600; }
.cmt .cm .icon-btn { width: 22px; height: 22px; margin-left: auto; opacity: 0; }
.cmt:hover .cm .icon-btn { opacity: 1; }
.cmt-form { display: grid; gap: 8px; margin-top: 10px; }
.cmt-form .row-end { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

/* ---------- Файлы ---------- */
.files { display: grid; gap: 4px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 12px; font-size: 14px; }
.file a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file .faint { font-size: 12px; }
.upload { display: inline-flex; }
.upload input { display: none; }

/* ---------- История ---------- */
.hist { display: grid; gap: 2px; font-size: 13px; }
.hist div { display: flex; gap: 10px; padding: 5px 0; color: var(--text-2); }
.hist time { color: var(--text-3); white-space: nowrap; min-width: 110px; }

/* ---------- Отчёт ---------- */
.report { display: grid; gap: 12px; }
.report-cover { background: var(--ink); color: #fff; border-radius: 30px; padding: 34px; display: grid; gap: 26px; }
.report-cover .rc-top { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.6); font-size: 14px; }
.report-cover h1 { font-size: 52px; line-height: 1; font-weight: 500; letter-spacing: -0.03em; }
.report-cover h1 span { color: var(--red); }
.report-cover .rc-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.report-cover .rc-num { background: rgba(255, 255, 255, 0.07); border-radius: 18px; padding: 16px; }
.report-cover .rc-num:first-child { background: var(--red); }
.report-cover .rc-num .l { font-size: 13px; color: rgba(255, 255, 255, 0.72); }
.report-cover .rc-num .v { font-size: 34px; font-weight: 500; letter-spacing: -0.02em; margin-top: 14px; white-space: nowrap; }
.report-cover .rc-num .delta.good { color: #8ff0b8; }
.report-cover .rc-num .delta.bad { color: #ffb0a6; }
.report-cover .rc-num:first-child .delta { color: #fff; }
.rnum { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px; }
.pf { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px 70px; gap: 10px; align-items: center; font-size: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.pf:first-child { border-top: 0; }
.pf.head { font-size: 12px; color: var(--text-3); padding-top: 0; }
.pf .n { text-align: right; font-variant-numeric: tabular-nums; }
.pubcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.pubcard .pc-stats { font-size: 12px; color: var(--text-3); grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; }
.pubcard .pc-note { grid-column: 1 / -1; font-size: 14px; color: var(--text-2); }
.pubcard textarea { grid-column: 1 / -1; }
.big-text { font-size: 16px; line-height: 1.55; white-space: pre-line; }

/* ---------- Доступы ---------- */
.creds { background: var(--ink); color: #fff; border-radius: 18px; padding: 18px; font-size: 14px; line-height: 1.7; margin-bottom: 14px; word-break: break-all; }
.creds .k { color: rgba(255, 255, 255, 0.55); display: inline-block; width: 72px; }
.creds .warn { color: #ffb0a6; font-size: 12px; margin-top: 8px; line-height: 1.4; word-break: normal; }

/* ---------- Пусто ---------- */
.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(9, 9, 9, 0.45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { background: var(--surface); border-radius: 26px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { max-width: 760px; }
.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; flex-wrap: wrap; }
.popover { position: fixed; z-index: 95; background: var(--surface); border-radius: 20px; box-shadow: 0 20px 60px rgba(9, 9, 9, 0.18); width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 10px; }
.popover .ph { display: flex; align-items: center; padding: 6px 8px 10px; font-weight: 600; }
.notif { display: block; padding: 10px; border-radius: 12px; font-size: 14px; color: var(--text); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: var(--accent-soft); }
.notif .nd { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.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; }
.notice { background: var(--surface); border-radius: 18px; padding: 14px 16px; font-size: 14px; color: var(--text-2); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.notice b { color: var(--text); }
.notice code { background: var(--surface-2); padding: 2px 8px; border-radius: 8px; font-size: 13px; }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; padding: 12px; gap: 12px; }
.auth-side { background: var(--ink); color: #fff; border-radius: 30px; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; overflow: hidden; }
.auth-side .logo { color: #fff; }
.auth-side .logo small { color: rgba(255, 255, 255, 0.5); border-color: rgba(255, 255, 255, 0.2); }
.auth-side h1 { font-size: 50px; line-height: 1.02; font-weight: 500; letter-spacing: -0.03em; max-width: 580px; }
.auth-side h1 span { color: var(--red); }
.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: 580px; }
.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: 18px; font-weight: 600; color: #fff; margin-bottom: 4px; }
.auth-points div:first-child { background: var(--red); 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: var(--surface); height: 50px; }
.auth-form .btn { height: 50px; width: 100%; font-size: 15px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1180px) {
  .top { flex-wrap: wrap; row-gap: 10px; }
  .top::after { content: ''; flex-basis: 100%; order: 2; }
  .top .tabs { order: 3; max-width: 100%; }
}
@media (max-width: 1180px) {
  .tiles.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row, .row.even, .row.wide, .row.three { grid-template-columns: minmax(0, 1fr); }
  .h1 { font-size: 38px; }
  .counters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-cover .rc-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .top .tabs { order: 3; width: 100%; }
  .who-chip .nm, .who-chip .rl { display: none; }
  .project-pick { max-width: 150px; }
  .main { padding: 10px 16px 48px; }
  .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; }
  .board { grid-template-columns: repeat(5, 82vw); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; }
  .board .col { scroll-snap-align: start; }
  .cal { grid-template-columns: minmax(0, 1fr); }
  .cal .wd, .cal .day.out, .cal .day.blank { display: none; }
  .cal .day { min-height: 0; }
  .cal .day .add { opacity: 1; }
  .seg-cards { grid-template-columns: minmax(0, 1fr); }
  .drawer { border-radius: 0; padding: 18px 16px 40px; }
  .fields, .fields.three { grid-template-columns: minmax(0, 1fr); }
  .report-cover { padding: 22px; border-radius: 24px; }
  .report-cover h1 { font-size: 36px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 520px) {
  .h1 { font-size: 32px; }
  .tiles.five, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 118px; padding: 14px; }
  .tile .t-value { font-size: 30px; }
  .tile .t-value small { font-size: 15px; }
  .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logo .txt, .logo small { display: none; }
  .fstep { grid-template-columns: 90px minmax(0, 1fr) 64px; gap: 8px; }
  .report-cover .rc-num .v { font-size: 24px; }
  .pf { grid-template-columns: minmax(0, 1fr) 64px 64px 48px; font-size: 13px; }
}

/* ---------- Печать / PDF ---------- */
.pdf-mode .no-pdf { display: none !important; }
@media print {
  .top, .no-pdf { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card { break-inside: avoid; }
}
.only-pdf { display: none; }
.pdf-mode .only-pdf { display: block; }
.li > svg, .file > svg, a.li svg { width: 18px; height: 18px; flex: none; color: var(--text-3); }
.avatar svg { width: 15px; height: 15px; }
.notice svg { width: 16px; height: 16px; }
.approval-box .btn:not(.primary) { background: var(--surface); }

/* ---------- Доработка дизайна ---------- */
.logo.compact .txt { display: none; }
@media (max-width: 1500px) { .who-chip .nm, .who-chip .rl { display: none; } }

/* Счётчики — ссылки и кнопки-фильтры */
a.counter, button.counter { color: inherit; border: 0; font: inherit; text-align: left; cursor: pointer; }
a.counter:hover, button.counter:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 80%, var(--surface-3)); }
button.counter.on { background: var(--text); color: var(--surface); }
button.counter.on span { color: inherit; opacity: 0.75; }
button.counter.on .dot { box-shadow: 0 0 0 2px var(--surface); }
.counters { margin-bottom: 12px; }

/* Результат месяца на сводке — та же подача, что у обложки отчёта */
.report-cover.hero { padding: 26px 28px; gap: 20px; border-radius: var(--radius); }
.report-cover .rc-top { justify-content: space-between; }
.hero-link { color: rgba(255, 255, 255, 0.7); display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.hero-link:hover { color: #fff; text-decoration: none; }
.hero-link svg { width: 14px; height: 14px; }
a.rc-num { color: #fff; transition: background 0.15s; }
a.rc-num:hover { text-decoration: none; background: rgba(255, 255, 255, 0.12); }
a.rc-num:first-child:hover { background: var(--red-hover); }
.report-cover .rc-num .delta { display: inline-block; margin-top: 6px; }
.report-cover .rc-num .delta.flat { color: rgba(255, 255, 255, 0.5); }
.hero-foot { display: flex; gap: 8px 28px; flex-wrap: wrap; font-size: 14px; color: rgba(255, 255, 255, 0.6); }
.hero-foot b { color: #fff; font-weight: 600; }

/* Плашка «ждёт согласования» для клиента */
.notice.accent { background: var(--accent); color: #fff; text-decoration: none; }
.notice.accent b { color: #fff; font-size: 15px; }
.notice.accent .go { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.notice.accent .go svg { width: 15px; height: 15px; }
.notice.accent:hover { background: var(--red-hover); }

/* Карточки проектов */
.project-card { min-height: 0; }
.pc-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pc-nums div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.pc-nums span { display: block; font-size: 12px; color: var(--text-3); }
.pc-nums b { display: block; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; }

/* Доска: колонка «Опубликовано» тише, карточки плотнее */
.col[data-col="published"] .tcard { background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.tcard .tc-top { margin-bottom: 6px; }
.tcard .tc-foot { margin-top: 8px; }
.badge .dot { width: 7px; height: 7px; }

@media (max-width: 860px) {
  .report-cover.hero { padding: 18px; }
  .counters { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .h1 { font-size: 32px; }
}
@media (max-width: 520px) {
  .h1 { font-size: 28px; }
  .pc-nums b { font-size: 20px; }
}

/* Тёмная тема: чёрная панель не должна сливаться с фоном */
:root[data-theme="dark"] .report-cover, :root[data-theme="dark"] .card.dark, :root[data-theme="dark"] .tile.dark { background: var(--surface); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .report-cover, :root:not([data-theme="light"]) .card.dark, :root:not([data-theme="light"]) .tile.dark { background: var(--surface); }
}

/* Шапка на телефоне: одна строка — знак, проект, колокольчик, профиль */
@media (max-width: 520px) {
  .top { flex-wrap: wrap; }
  .project-pick { flex: 1 1 0; min-width: 0; max-width: none; }
  .top-right { margin-left: 0; gap: 6px; }
  .who-chip #theme { display: none; }
}
@media (max-width: 860px) {
  .toolbar .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .toolbar .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; }
}

/* iPhone увеличивает страницу при фокусе на поле с текстом мельче 16px — на телефоне все поля 16px */
@media (max-width: 860px) {
  input, select, textarea, .input, .input.sm, .filter, .project-pick, .daterange input,
  table.data input.input, .scenes textarea.input { font-size: 16px; }
}

/* Контент-план на телефоне: дни квадратными плитками, по два в ряд */
@media (max-width: 860px) {
  .cal { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* Квадрат — минимальный размер: если публикаций много, плитка вытягивается вниз */
  .cal .day { aspect-ratio: 1; min-height: auto; padding: 10px; border-radius: 18px; }
  .cal .dh { margin-bottom: 4px; }
  .cal .dn { width: 28px; height: 28px; font-size: 14px; }
  .cal .mobile-wd { margin-left: 4px; }
  .cal .pill { padding: 6px 8px; }
}

/* Сводка на телефоне: при нечётном числе плашек первая («Задачи в работе») — на всю ширину, остальные парами */
@media (max-width: 860px) {
  .counters.work > .counter:first-child:nth-last-child(2n + 1) { grid-column: 1 / -1; }
}

/* Safari на iPhone даёт полям даты свою минимальную ширину — убираем, чтобы поле не вылезало за экран */
input[type="date"].input, input[type="datetime-local"].input, input[type="time"].input {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; line-height: 44px;
}
input[type="date"].input::-webkit-date-and-time-value, input[type="datetime-local"].input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.field, .fields > * { min-width: 0; }
.modal, .drawer { overflow-x: hidden; }
input[type="date"].input.sm, input[type="datetime-local"].input.sm { line-height: 36px; }

/* Поле комментария в согласовании — белое на серой плашке, чтобы его было видно */
.approval-box textarea.input { background: var(--surface); }
.approval-box .lbl { color: var(--text-2); font-weight: 500; margin-bottom: -4px; }
.approval-box textarea.input.need { box-shadow: 0 0 0 2px var(--accent); }
.note-hint { font-size: 13px; color: var(--bad); font-weight: 500; }
