/* ===========================================================================
   QPH PROD — дизайн-система.
   Палитра бренда хоумов: фиолетовый #1C0925 и жёлтый #FFDB10.
   Светлая тема следует продуктовому референсу: холодная почти белая оболочка,
   фиолетовый интерактив и пастельные карточки. Пастели не кодируют новые статусы:
   зелёный по-прежнему «готово», янтарный «в работе», красный «проблема»;
   Жёлтый остаётся редким фирменным акцентом, а не общей заливкой интерфейса.
   Всё завязано на CSS-переменные: тема переключается атрибутом
   <html data-theme="light|dark"> и ничего кроме токенов не меняет.
   =========================================================================== */
:root {
  /* бренд */
  --brand: #1C0925;
  --brand-deep: #12061A;
  --brand-lift: #2E1139;      /* верх градиента сайдбара */
  --yellow: #FFDB10;
  --yellow-deep: #E0BC00;

  /* поверхности */
  --bg: #F0F2F6;
  --panel: rgba(255, 255, 255, .90);
  --panel-2: #F5F6FA;         /* мягкая заливка внутри панелей (шапки таблиц, теги) */
  --field: #FCFCFE;           /* фон инпутов */
  --ink: #24242C;
  --muted: #666874;
  --line: #E3E5EC;
  --line-strong: #D5D8E2;
  --shadow: 0 1px 2px rgba(36, 36, 44, .035), 0 12px 30px -25px rgba(52, 55, 72, .24);
  --shadow-lift: 0 4px 10px rgba(36, 36, 44, .06), 0 24px 46px -26px rgba(52, 55, 72, .36);

  /* KPI нейтральные; цвет появляется только когда кодирует состояние */
  --stat-bg: linear-gradient(145deg, #F8F9FC 0%, #EEF0F5 100%);
  --stat-green-bg: linear-gradient(145deg, #E5F3ED 0%, #DCEEE6 100%);
  --stat-warn-bg: linear-gradient(145deg, #F9E8ED 0%, #F4DDE5 100%);
  --stat-ink: #2B2C35;
  --stat-muted: #6E7180;

  /* в светлой теме сайдбар — часть воздушной оболочки, как в референсе */
  --side-bg: linear-gradient(180deg, #E9EEFA 0%, #EEF0FA 54%, #F3E7F1 100%);
  --side-ink: #2E303A;
  --side-muted: #666978;
  --side-hover: rgba(96, 72, 181, .12);
  --side-line: rgba(72, 74, 91, .15);
  --side-field: rgba(255, 255, 255, .70);
  --side-field-hover: #FFFFFF;

  /* смысловые цвета — их всего три; на светлом приглушённые, контраст держим текстом */
  --accent: #513A9B;          /* интерактив: ссылки, фокус, кнопки */
  --accent-ink: #FFFFFF;
  --accent-soft: #ECE9F8;
  --green: #266C4C;           /* готово */
  --green-soft: #E2F1EA;
  --amber: #84550F;           /* в работе / нужно внимание */
  --amber-soft: #F7ECDD;
  --red: #9C405A;             /* проблема: блокер, просрочка */
  --red-soft: #F7E4EA;
  --neutral: #666874;
  --neutral-soft: #ECEEF3;
  --chart-primary: #7459BF;
  --chart-neutral: #C9CDD8;
  --toast-bg: #1C0925;
  --toast-ink: #FFFFFF;
  --idle: #DBD6E0;            /* «ничего не начато» — точки, полоски прогресса */

  --r-lg: 22px;               /* панели */
  --r-md: 13px;               /* контролы */
  --r-sm: 9px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #101317;
  --panel: rgba(24, 28, 33, .96);
  --panel-2: #20252B;
  --field: #1B2026;
  --ink: #F2F5F7;
  --muted: #98A2AD;
  --line: #2A3037;
  --line-strong: #3B444E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .42), 0 12px 28px -18px rgba(0, 0, 0, .72);
  --shadow-lift: 0 3px 9px rgba(0, 0, 0, .5), 0 22px 42px -20px rgba(0, 0, 0, .86);

  --side-bg: linear-gradient(180deg, #171B20 0%, #12161A 58%, #0E1114 100%);
  --side-ink: #E7ECF1;
  --side-muted: #87929D;
  --side-hover: rgba(83, 234, 253, .08);
  --side-line: rgba(221, 233, 242, .09);
  --side-field: rgba(255, 255, 255, .045);
  --side-field-hover: rgba(255, 255, 255, .08);

  --accent: #53EAFD;          /* главный интерактивный акцент тёмной темы */
  --accent-ink: #082126;
  --accent-soft: rgba(83, 234, 253, .14);
  --green: #62D49C;
  --green-soft: rgba(98, 212, 156, .13);
  --amber: #E2B65E;
  --amber-soft: rgba(226, 182, 94, .13);
  --red: #F17B93;
  --red-soft: rgba(241, 123, 147, .14);
  --neutral: #A5AEB8;
  --neutral-soft: rgba(232, 239, 245, .065);
  --idle: #353C44;
  --stat-bg: linear-gradient(145deg, #22282E 0%, #1A1F24 100%);
  --stat-green-bg: linear-gradient(145deg, #18342A 0%, #142B23 100%);
  --stat-warn-bg: linear-gradient(145deg, #3A2229 0%, #301B22 100%);
  --stat-ink: #F3F6F8;
  --stat-muted: #A6B0BA;
  --chart-primary: #53EAFD;
  --chart-neutral: #46515C;
  --toast-bg: #E7ECF1;
  --toast-ink: #101317;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html.modal-open, html.modal-open body { overflow: hidden; }
body {
  margin: 0; font-size: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 92% 2%, color-mix(in srgb, #C7D9FA 38%, transparent) 0, transparent 30rem),
    radial-gradient(circle at 70% -8%, color-mix(in srgb, #F1D6E8 34%, transparent) 0, transparent 27rem),
    radial-gradient(circle at 28% 88%, color-mix(in srgb, #DDD6F5 20%, transparent) 0, transparent 28rem),
    var(--bg);
  background-attachment: fixed; color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 88% -8%, rgba(83, 234, 253, .075) 0, transparent 30rem),
    radial-gradient(circle at 58% 108%, rgba(83, 234, 253, .035) 0, transparent 32rem),
    var(--bg);
}
::selection { background: var(--yellow); color: var(--brand); }
.layout { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------------- сайдбар */
.sidebar {
  width: 244px; flex-shrink: 0; background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--side-line); transition: width .18s ease;
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 18px 14px 14px; }
.logo { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; color: inherit; }
.logo-mark { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.logo .txt { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.logo .txt b { font-size: 15.5px; font-weight: 850; letter-spacing: -.25px; white-space: nowrap; }
.logo .txt span { font-size: 10.5px; color: var(--side-muted); letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }

/* кнопки-иконки в сайдбаре (свернуть меню, тема) */
.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--side-ink);
  padding: 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--side-hover); filter: none; }
.side-head .icon-btn { margin-left: auto; }

#nav { display: flex; flex-direction: column; gap: 10px; padding: 4px 10px; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 3px 11px 2px; color: var(--side-muted); font-size: 9.5px; line-height: 14px;
  font-weight: 800; letter-spacing: .75px; text-transform: uppercase;
}
#nav .nav-group-toggle {
  width: 100%; min-height: 20px; display: flex; align-items: center; justify-content: space-between;
  padding: 3px 11px 2px; border: 0; border-radius: 7px; background: transparent;
  color: var(--side-muted); box-shadow: none; cursor: pointer; text-align: left;
}
#nav .nav-group-toggle:hover { background: var(--side-hover); color: var(--side-ink); filter: none; box-shadow: none; }
#nav .nav-group-toggle:active { transform: none; }
#nav .nav-group-toggle svg { flex-shrink: 0; transition: transform .16s ease; }
.nav-group.is-collapsed .nav-group-toggle svg { transform: rotate(-90deg); }
html:not(.nav-collapsed) .nav-group.is-collapsed > a { display: none !important; }
#nav a {
  display: flex; align-items: center; gap: 10px; color: var(--side-ink); opacity: .82;
  text-decoration: none; padding: 9px 11px; border-radius: 13px; font-weight: 650; font-size: 13.5px;
  flex-shrink: 0; white-space: nowrap; position: relative;
}
#nav a svg { flex-shrink: 0; opacity: .9; }
#nav a:hover { background: var(--side-hover); opacity: 1; }
#nav a.active { background: rgba(255, 255, 255, .94); color: var(--accent); opacity: 1; font-weight: 800; box-shadow: 0 10px 24px -16px rgba(54, 48, 87, .50); }
html[data-theme="dark"] #nav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
#nav a.active svg { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 10px 14px 14px; font-size: 11px; color: var(--side-muted); border-top: 1px solid var(--side-line); flex-shrink: 0; }
.me-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.me-row select {
  flex: 1; min-width: 0; font-size: 12px; padding: 5px 24px 5px 9px; border-radius: 9px;
  background-color: var(--side-field); color: var(--side-ink); border: 1px solid var(--side-line);
  background-image: var(--chev);
}
.me-row select:hover { background-color: var(--side-field-hover); border-color: var(--side-line); }
.me-row select option { color: #1C0925; background: #fff; }
.me-auth { gap: 8px; min-width: 0; }
.me-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  flex: none; background: var(--yellow); color: var(--brand); font-size: 12px; font-weight: 850;
}
.me-identity { display: flex; flex: 1; min-width: 0; flex-direction: column; color: var(--side-ink); line-height: 1.15; }
.me-identity b, .me-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-identity b { font-size: 12.5px; }.me-identity small { margin-top: 2px; color: var(--side-muted); font-size: 10px; }
.me-logout { padding: 5px; }
/* кружок с инициалом — видим только в свёрнутом меню */
.me-mini {
  display: none; width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--yellow); color: var(--brand); font-weight: 800; font-size: 14px; padding: 0;
  align-items: center; justify-content: center;
}
html.nav-collapsed .me-mini { display: flex; }
.theme-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; justify-content: flex-start;
  background: var(--side-field); color: var(--side-ink); border: 1px solid var(--side-line);
  border-radius: 11px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.theme-btn:hover { background: var(--side-hover); filter: none; }
.foot-note { margin-top: 8px; opacity: .7; }

/* свёрнутое меню: только иконки. Класс живёт на <html> — его ставит инлайн-скрипт
   в <head> до первой отрисовки, чтобы сайдбар не «прыгал» при загрузке. */
html.nav-collapsed .sidebar { width: 66px; }
html.nav-collapsed .logo .txt,
html.nav-collapsed #nav a > span:not(#news-badge),
html.nav-collapsed .nav-label,
html.nav-collapsed .me-row,
html.nav-collapsed .foot-note,
html.nav-collapsed .theme-btn span { display: none; }
/* У кнопок-заголовков есть более специфичное правило #nav .nav-group-toggle.
   В узком меню сами заголовки не нужны: разделы остаются визуально сгруппированы отступом. */
html.nav-collapsed #nav .nav-group-toggle { display: none; }
html.nav-collapsed .side-head { flex-direction: column; gap: 8px; padding: 14px 8px 10px; }
html.nav-collapsed .side-head .icon-btn { margin-left: 0; }
html.nav-collapsed #nav { padding: 4px 8px; gap: 7px; }
html.nav-collapsed #nav a { justify-content: center; padding: 10px 0; }
html.nav-collapsed .sidebar-foot { padding: 10px 8px 14px; }
html.nav-collapsed .theme-btn { justify-content: center; padding: 8px 0; }
/* бейдж новостей в свёрнутом виде — точкой в углу иконки */
html.nav-collapsed #nav a #news-badge { position: absolute; top: 5px; right: 12px; }
html.nav-collapsed #nav a #news-badge .badge { margin: 0; }
/* счётчик непрочитанных — фирменный жёлтый остаётся редким заметным акцентом */
.badge { display: inline-block; width: 8px; height: 8px; margin-left: 7px; background: var(--yellow); border-radius: 50%; vertical-align: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

main { flex: 1; padding: 32px 38px 72px; max-width: 1420px; min-width: 0; }
.auth-locked .sidebar, .auth-locked .mobile-bar, .auth-locked .nav-overlay { display: none !important; }
.auth-locked main { max-width: none; width: 100%; min-height: 100vh; padding: 24px; display: grid; place-items: center; }
.login-shell { width: min(100%, 420px); }
.login-card {
  padding: 34px; border: 1px solid var(--line); border-radius: 26px; background: var(--panel);
  box-shadow: var(--shadow-lift); backdrop-filter: blur(16px);
}
.login-card > img { display: block; margin-bottom: 20px; }
.login-card h1 { font-size: 27px; }
.login-form { display: grid; gap: 8px; margin-top: 24px; }
.login-form label { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.login-form input { width: 100%; min-height: 44px; font-size: 15px; }
.login-form button { min-height: 44px; margin-top: 10px; }
.login-error { padding: 10px 12px; border-radius: var(--r-md); background: var(--red-soft); color: var(--red); font-size: 13px; }
.dialog-form { display: grid; gap: 8px; }.dialog-form > label { color: var(--muted); font-size: 12px; font-weight: 750; }
.dialog-form > input { min-height: 42px; }.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
h1 { font-size: 30px; line-height: 1.08; margin: 0 0 6px; font-weight: 880; letter-spacing: -.85px; }
.sub { color: var(--muted); margin: 0 0 22px; max-width: 1020px; line-height: 1.35; }
h2 { font-size: 16px; margin: 0 0 13px; font-weight: 800; letter-spacing: -.2px; }

/* --------------------------------------------------------------- карточки */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  min-height: 104px; display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--stat-bg); color: var(--stat-ink); border: 1px solid color-mix(in srgb, var(--stat-ink) 9%, transparent);
  border-radius: var(--r-lg); padding: 17px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; transition: transform .14s ease, box-shadow .14s ease;
}
/* отбивка слева по умолчанию нейтральная: цвет на карточке появляется, только если
   он что-то значит — красный «проблема» и зелёный «готово» */
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: color-mix(in srgb, var(--stat-ink) 12%, transparent); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat .n { font-size: 31px; line-height: 1; font-weight: 880; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--stat-muted); font-size: 12px; margin-top: 5px; }
.stat.green { background: var(--stat-green-bg); }
.stat.warn { background: var(--stat-warn-bg); }
.stat.warn::before { background: var(--red); }
.stat.warn .n { color: var(--red); }
.stat.green::before { background: var(--green); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.toolbar-panel { padding-block: 12px; }
.page-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin: -8px 0 12px; }
.handover-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); padding: 15px; margin: 12px 0; }
.handover-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.handover-head h3 { margin: 0; font-size: 15px; }
.handover-summary { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.handover-hint { margin: 8px 0 10px; color: var(--muted); font-size: 12px; }
.handover-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.handover-game { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 42px; padding: 8px 11px; border-bottom: 1px solid var(--line); font-size: 13px; }
.handover-game:last-child { border-bottom: 0; }
label.handover-game { cursor: pointer; }
label.handover-game:hover { background: var(--panel-2); }
.handover-game.needs-attention { background: color-mix(in srgb, var(--red-soft) 45%, var(--panel)); }
.handover-game.is-given { opacity: .56; }
.handover-game-copy { min-width: 0; overflow-wrap: anywhere; }
.handover-check { color: var(--green); font-weight: 850; text-align: center; }
.handover-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 11px; }
.capacity-panel { min-width: 0; }
.capacity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.capacity-head h2 { margin-bottom: 3px; }
.capacity-summary { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.capacity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 11px; }
.capacity-group { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.capacity-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 8px; }
.capacity-group-title b { font-size: 13px; }
.capacity-group-title span { color: var(--muted); font-size: 11.5px; }
.capacity-person { padding: 9px 0; border-top: 1px solid var(--line); }
.capacity-person-head, .capacity-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.capacity-person-head b { min-width: 0; overflow-wrap: anywhere; font-size: 12.5px; }
.capacity-meta { margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.capacity-track { height: 6px; overflow: hidden; margin-top: 6px; border-radius: 999px; background: var(--line); }
.capacity-track i { display: block; height: 100%; border-radius: inherit; background: var(--neutral); }
.capacity-track i.green { background: var(--green); }
.capacity-track i.amber { background: var(--amber); }
.capacity-track i.red { background: var(--red); }
.capacity-formats { margin-top: 5px; color: var(--muted); font-size: 10.5px; }
.capacity-empty { padding: 12px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.capacity-help { margin-top: 11px; color: var(--muted); font-size: 11.5px; }
.capacity-help > summary { cursor: pointer; font-weight: 700; }
.capacity-help[open] > summary { margin-bottom: 5px; color: var(--ink); }
.rules-panel { padding-block: 12px; }
.rules-panel > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.rules-panel[open] > summary { margin-bottom: 8px; color: var(--ink); }
.sprint-stage { margin-top: 18px; }
.sprint-stage + .sprint-stage { padding-top: 18px; border-top: 1px solid var(--line); }
.sprint-stage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sprint-stage-head h3 { display: inline; margin: 0; font-size: 14px; }
.sprint-stage-head h3 + span { margin-left: 7px; color: var(--muted); font-size: 12px; }
.sprint-stage-summary { display: flex; gap: 10px; color: var(--muted); font-size: 11.5px; }
.sprint-stage-summary .done-text { color: var(--green); }
.sprint-stage-summary .problem-text { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2 > * { min-width: 0; }
.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stats-head h2 { margin: 0; }
.stats-summary { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.stats-summary > span { color: var(--muted); }
.stats-period { margin-top: 12px; }
.eff-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.eff-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex: none; }
.eff-person { width: 150px; flex: none; }
.eff-cards { flex: 1; min-width: 120px; line-height: 1; }
.eff-score { width: 190px; flex: none; text-align: right; }
.status-board { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.status-lane { flex: 0 1 280px; min-width: 180px; }
.status-lane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 750; }
.status-lane-head b { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--neutral-soft); color: var(--neutral); text-align: center; font-size: 11px; }
.status-lane.is-empty { opacity: .5; }
.status-lane.is-empty .status-lane-head b { background: transparent; padding-inline: 0; }
.status-card-line { margin: 7px 0; font-size: 13px; line-height: 1.3; }
@media (max-width: 1000px) {
  .grid2 { grid-template-columns: 1fr; }
  .eff-row { display: grid; grid-template-columns: 32px minmax(100px, 1fr) auto; }
  .eff-person, .eff-score { width: auto; }
  .eff-cards { grid-column: 2 / -1; min-width: 0; }
}

/* --------------------------------------------------------------- таблицы */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .65px; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel-2) 74%, transparent); font-weight: 800; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
/* даты — моноширинными цифрами и компактно: иначе поля съедают половину таблицы */
input[type=date] { width: 128px; font-size: 12.5px; padding: 6px 2px 6px 8px; font-variant-numeric: tabular-nums; }
input[type=month] { width: 160px; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
/* Закрытая строка приглушена, но остаётся читаемой: на .55 текст полей падал до
   контраста 3.6:1 и не проходил WCAG AA. .72 держит 6,5:1 и выглядит так же спокойно. */
tr.is-done { opacity: .72; }
/* Таблицу прокручиваем внутри отдельной области: заголовок и действия панели остаются на месте,
   а сетки больше не расширяют всю страницу. Обёртка добавляется enhanceTables() в app.js. */
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-inline: contain; }
.table-scroll > table { min-width: max-content; }
.table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.scroll-hint { display: block; color: var(--muted); font-size: 11.5px; margin: 6px 0 0; text-align: right; }
.scroll-hint.at-end { visibility: hidden; }

/* селект-действие («+ роль», «перевести в team») — пунктирная рамка = «сюда можно добавить» */
.select-add {
  font-size: 12px; padding: 4px 22px 4px 9px; color: var(--muted);
  background-color: transparent; border: 1px dashed var(--line-strong); background-position: right 6px center;
}
.select-add:hover { border-color: var(--accent); color: var(--accent); background-color: var(--panel-2); }

/* ----------------------------------------------------------------- чипы */
/* Чип по умолчанию нейтральный. Цвет — только там, где он несёт смысл:
   зелёный = готово, янтарный = в работе, красный = проблема.
   Пассивные состояния (идея, план, готово к выпуску, архив) остаются серыми. */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.chip.status-published { background: var(--green-soft); color: var(--green); }
.chip.status-in_production, .chip.status-writing, .chip.status-factcheck, .chip.status-layout,
.chip.status-voiceover, .chip.status-editing, .chip.status-qc { background: var(--amber-soft); color: var(--amber); }
.chip.status-revisions { background: var(--red-soft); color: var(--red); }
.chip.status-ready, .chip.status-planned,
.chip.status-idea, .chip.status-archived, .chip.gray { background: var(--panel-2); color: var(--muted); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.yellow { background: var(--yellow); color: var(--brand); }

/* селект статуса в таблицах — та же логика, что у чипов */
.status-select {
  font-size: 12.5px; line-height: 16px; padding: 4px 24px 4px 11px; border-radius: 999px; font-weight: 700;
  border: 1px solid transparent; background-color: var(--panel-2); color: var(--muted);
  /* стрелка идёт сразу за текстом, а не у дальнего края ячейки */
  background-position: right 7px center; width: auto; max-width: 100%;
}
.status-select:hover { border-color: currentColor; }
/* background-COLOR, а не background: иначе шорткат затирает стрелку-фон */
/* Имя статуса всегда с приставкой status-: голый класс `layout` совпадал с классом
   каркаса страницы `.layout` (display:flex; min-height:100vh) — селект статуса «вёрстка»
   растягивался на весь экран. Приставка — та же, что у чипов, поэтому совпадений нет. */
.status-select.status-published { background-color: var(--green-soft); color: var(--green); }
.status-select.status-writing, .status-select.status-factcheck, .status-select.status-layout,
.status-select.status-voiceover, .status-select.status-editing { background-color: var(--amber-soft); color: var(--amber); }
.status-select.status-revisions { background-color: var(--red-soft); color: var(--red); }

.pipeline { display: flex; gap: 3px; flex-wrap: wrap; }
.stage-dot { width: 14px; height: 14px; border-radius: 5px; background: var(--idle); position: relative; cursor: default; }
.stage-dot.done { background: var(--green); }
.stage-dot.in_progress { background: var(--amber); }
.stage-dot.blocked { background: var(--red); }
.stage-dot.overdue { outline: 2px solid var(--red); }

.bar { height: 7px; border-radius: 4px; background: var(--idle); overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }

/* --------------------------------------------------------------- контролы */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
select, input[type=text], input[type=url], input[type=date], input[type=number], input[type=month], textarea {
  font: inherit; font-size: 13px; line-height: 18px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--field); color: var(--ink);
}
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; line-height: 1.45; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; }

/* Свои выпадающие списки. Нативный <select> Chrome рисует системный прямоугольник
   и ставит стрелку у самого края поля, поэтому appearance:none + своя стрелка.
   Переменная --chev задаёт её цвет отдельно для светлой и тёмной темы. */
:root { --chev: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.75 4.75 6 8l3.25-3.25' fill='none' stroke='%23736C7D' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
html[data-theme="dark"] { --chev: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.75 4.75 6 8l3.25-3.25' fill='none' stroke='%2398A2AD' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 26px; background-image: var(--chev);
  background-repeat: no-repeat; background-position: right 8px center; background-size: 12px;
}
select:hover { border-color: var(--muted); }
select::-ms-expand { display: none; }
/* иконка календаря у нативных дат — приглушаем, чтобы не спорила с текстом */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=month]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }
input[type=date]:hover::-webkit-calendar-picker-indicator,
input[type=month]:hover::-webkit-calendar-picker-indicator { opacity: .8; }

button {
  font: inherit; font-size: 13px; line-height: 18px; font-weight: 800; padding: 7px 15px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
button:hover { filter: brightness(1.04); box-shadow: 0 8px 18px -13px rgba(0, 0, 0, .46); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: wait; filter: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.ghost { background: color-mix(in srgb, var(--panel) 78%, transparent); color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover { background: var(--panel-2); filter: none; border-color: var(--muted); }
button.small { padding: 3px 10px; font-size: 12px; }
button.danger { background: var(--red-soft); color: var(--red); }
button.yellow { background: var(--yellow); color: var(--brand); }

/* Повторяющиеся формы: явные подписи вместо смыслов, спрятанных в placeholder/title. */
.form-grid { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(130px, .7fr) repeat(3, minmax(145px, .55fr)); gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.field input, .field select { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.create-panel > summary { cursor: pointer; list-style: none; font-size: 15px; font-weight: 800; color: var(--accent); }
.create-panel > summary::-webkit-details-marker { display: none; }
.create-panel > summary::before { content: "+"; display: inline-block; width: 20px; }
.create-panel[open] > summary::before { content: "−"; }
.create-body { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Идеи: подсказки ICE выглядят интерактивно и открываются мышью или клавиатурой. */
.ice-note { margin-top: 8px; font-size: 11.5px; }
.help-term {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink); text-decoration: underline dotted var(--muted); text-underline-offset: 3px;
  cursor: help; outline: none;
}
.help-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted);
  font-size: 10px; line-height: 1; text-decoration: none;
}
.help-pop {
  position: absolute; z-index: 20; right: 0; bottom: calc(100% + 9px); width: min(280px, 76vw);
  transform: translateY(4px); padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); background: var(--toast-bg); color: var(--toast-ink);
  box-shadow: var(--shadow-lift); font-size: 12px; font-weight: 500; line-height: 1.4;
  text-decoration: none; pointer-events: none; opacity: 0; visibility: hidden; transition: .14s ease;
}
.help-term:hover .help-pop, .help-term:focus .help-pop {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.help-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* Идеи — спокойный список вместо широкой таблицы: название остаётся главным,
   метаданные и действия занимают ровно столько места, сколько им нужно. */
.idea-section { padding-bottom: 4px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin-bottom: 3px; }
.count-label {
  min-width: 25px; padding: 2px 7px; border-radius: 999px; background: var(--panel-2);
  color: var(--muted); text-align: center; font-size: 11.5px; font-weight: 750;
}
.idea-list { border-top: 1px solid var(--line); }
.idea-row {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, auto) auto auto;
  gap: 14px; align-items: center; min-height: 66px; padding: 11px 0; border-bottom: 1px solid var(--line);
}
.idea-row:last-child { border-bottom: 0; }
.idea-copy { min-width: 0; }
.idea-title { font-size: 13.5px; font-weight: 750; overflow-wrap: anywhere; }
.idea-hypothesis { margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.idea-meta { display: flex; gap: 0; align-items: center; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.idea-meta > span + span::before { content: "·"; padding: 0 7px; color: var(--line-strong); }
.idea-status { justify-self: start; }
.idea-actions { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.empty.compact { padding: 18px 10px 22px; }

/* Генератор описаний: библиотека слева, рабочие выпуски справа. */
.desc-toolbar { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.desc-toolbar .field { min-width: min(360px, 100%); }
.desc-toolbar .field > span, .desc-add .field > span { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.desc-rules { padding-top: 11px; padding-bottom: 11px; }
.desc-rules > summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 750; }
.desc-rules[open] > summary { color: var(--ink); }
.desc-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
.desc-add { margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.desc-add textarea { margin-bottom: 8px; background: var(--panel); }
.desc-variants, .desc-episodes { border-top: 1px solid var(--line); }
.desc-variant { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.desc-variant-number { display: flex; align-items: center; justify-content: center; width: 23px; height: 23px; border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 800; }
.desc-variant textarea { min-height: 94px; font-size: 12.5px; }
.desc-variant-actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 6px; }
.desc-variant.readonly { line-height: 1.45; color: var(--muted); font-size: 12.5px; }
.desc-episode { padding: 12px 0; border-bottom: 1px solid var(--line); }
.desc-episode.historical { padding-inline: 8px; background: var(--panel-2); }
.desc-episode-head, .desc-episode-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.desc-episode-head { align-items: center; }
.desc-episode-body { margin-top: 7px; }
.desc-current { display: -webkit-box; min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.desc-current.empty-text { color: var(--amber); }
.desc-episode-actions { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 6px; }

/* Генератор озвучек: тот же спокойный рабочий визуал, что и у остальной админки. */
.voice-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.voice-compose textarea { width: 100%; font: inherit; font-size: 13px; line-height: 1.5; }
.field-label-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.voice-settings { display: grid; grid-template-columns: 180px minmax(240px, 1fr); gap: 10px; }
.voice-styles { display: flex; flex-wrap: wrap; gap: 6px; }
button.voice-style { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 10px; border-radius: var(--r-md); line-height: 1.2; }
button.voice-style small { color: var(--muted); font-size: 10px; font-weight: 600; }
button.voice-style.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); box-shadow: none; }
.voice-prompt { margin-top: 7px; color: var(--muted); background: var(--panel-2); }
.voice-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.voice-deadline { position: sticky; top: 20px; }
.voice-date { margin: 3px 0 8px; font-size: 25px; font-weight: 850; letter-spacing: -.5px; }
.voice-result-card { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.voice-result-card.ready { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.voice-result-card.error { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.voice-result-card audio { flex: 1; min-width: 180px; height: 34px; }
.voice-spinner { width: 18px; height: 18px; flex: none; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: voice-spin .8s linear infinite; }
@keyframes voice-spin { to { transform: rotate(360deg); } }
.voice-history { border-top: 1px solid var(--line); }
.voice-history-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 420px) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.voice-history-row:last-child { border-bottom: 0; }
.voice-history-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.voice-history-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-history-row audio { width: 100%; height: 32px; }
.voice-more { margin-top: 9px; }
.voice-more > summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 750; }
.voice-more[open] > summary { margin-bottom: 8px; }

/* Команда: поля редактируются на месте, но в покое выглядят как текст. */
.team-table td { padding-block: 10px; }
.team-name { width: 150px; }
.team-note { width: 220px; }
.team-actions { width: 155px; text-align: right; white-space: nowrap; opacity: .58; transition: opacity .12s ease; }
.team-row:hover .team-actions, .team-row:focus-within .team-actions { opacity: 1; }
.team-edit { width: 100%; background-color: transparent !important; border-color: transparent !important; }
.team-name .team-edit { max-width: 120px; font-weight: 700; }
.team-note .team-edit { max-width: 200px; font-size: 12px; }
.team-row:hover .team-edit { background-color: var(--field) !important; border-color: var(--line) !important; }
.team-edit:focus { background-color: var(--field) !important; border-color: var(--line-strong) !important; }
.team-roles { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.team-role-add { width: 88px; opacity: .68; }
.team-transfer { width: 122px; }
.team-remove { opacity: .42; }
.team-row:hover .team-remove, .team-row:focus-within .team-remove { opacity: 1; }
.team-add { margin-top: 9px; }
.team-add > summary { display: inline-block; cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 700; list-style: none; }
.team-add > summary::-webkit-details-marker { display: none; }
.team-add > summary::before { content: "+ "; }
.team-add[open] > summary { margin-bottom: 9px; }
.team-add[open] > summary::before { content: "− "; }
@media (max-width: 1000px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field.idea-name { grid-column: 1 / -1; }
  .idea-row { grid-template-columns: minmax(180px, 1fr) auto; gap: 7px 12px; }
  .idea-meta { grid-column: 1; }
  .idea-row.is-own .idea-status { grid-column: 2; grid-row: 1; }
  .idea-row.is-own .idea-actions { grid-column: 2; grid-row: 2; }
  .idea-row.is-team .idea-actions { grid-column: 2; grid-row: 1 / span 2; }
  .voice-layout { grid-template-columns: 1fr; }
  .voice-deadline { position: static; }
  .voice-history-row { grid-template-columns: minmax(180px, 1fr) minmax(220px, 360px) auto; }
}

/* Лента изменений: время — отдельной колонкой, старые дни можно свернуть. */
.news-group > summary { cursor: pointer; list-style: none; font-size: 15px; font-weight: 750; }
.news-group > summary::-webkit-details-marker { display: none; }
.news-group > summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--muted); }
.news-group[open] > summary::before { content: "▾"; }
.news-list { margin-top: 12px; }
.news-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.news-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.news-copy { line-height: 1.35; overflow-wrap: anywhere; }

.error-state { max-width: 560px; margin: 12vh auto 0; padding: 28px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.error-state h2 { margin-bottom: 6px; }
.error-state p { color: var(--muted); margin: 0 0 14px; }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { max-width: 380px; padding: 11px 14px; border-radius: var(--r-md); background: var(--toast-bg); color: var(--toast-ink); box-shadow: var(--shadow-lift); font-size: 13px; animation: toast-in .18s ease-out; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.mobile-bar, .nav-overlay { display: none; }

/* --------------------------------------------------- выбор месяца (свой, русский) */
.monthpick { position: relative; display: inline-block; }
.mp-btn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--field); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 6px 10px; font-weight: 700;
}
.mp-btn:hover { background: var(--panel-2); border-color: var(--muted); filter: none; }
.mp-btn svg { color: var(--muted); }
.mp-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 232px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift); padding: 10px;
}
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mp-head b { font-size: 14px; }
.mp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mp-m {
  background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 7px 0; font-size: 12.5px; font-weight: 600; text-transform: capitalize;
}
.mp-m:hover { background: var(--panel-2); filter: none; }
.mp-m.on { background: var(--yellow); color: var(--brand); }

.month-block { margin-bottom: 22px; }
/* строка-заголовок месяца: стрелка + название + сводка, кнопка выгрузки прижата вправо */
.month-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-weight: 800; font-size: 16px; margin-bottom: 8px; text-transform: capitalize; user-select: none; letter-spacing: -.2px; }
.month-title button { text-transform: none; }
.month-title.click { cursor: pointer; }
.month-title.click:hover { color: var(--accent); }
.month-summary { color: var(--muted); font-weight: 400; font-size: 12.5px; text-transform: none; }

/* ---------------------------------------------------------------- модалка */
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 16, .58); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; z-index: 50; overflow: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); width: 960px; max-width: 100%; padding: 24px 26px; box-shadow: 0 30px 70px rgba(0, 0, 0, .38); }
.modal.compact-modal { width: 460px; }
.pipeline-summary { display: grid; gap: 12px; }
.pipeline-section { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.pipeline-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.pipeline-head h3 { margin: 0 0 2px; font-size: 14px; }
.pipeline-section table { background: var(--panel); }
.compact-empty { padding: 12px 0; }
.modal h1 { font-size: 24px; margin: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-eyebrow { color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .75px; text-transform: uppercase; margin-bottom: 5px; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.card-meta > span:not(.chip) { position: relative; }
.card-meta > span:not(.chip)::before { content: "·"; position: absolute; left: -9px; color: var(--line-strong); }
.modal-close { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--ink); border-radius: 50%; padding: 0; font-size: 21px; line-height: 1; font-weight: 500; }
.modal-close:hover { background: var(--line); filter: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 4px; }
.tabs button { background: none; color: var(--muted); border-radius: 0; padding: 9px 12px; box-shadow: none; }
.tabs button:hover { background: var(--panel-2); filter: none; color: var(--ink); }
.tabs button.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 16px; font-size: 13.5px; align-items: center; }
.kv .k, .kv .k + div { min-height: 45px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv .k { display: flex; align-items: center; color: var(--muted); font-size: 12px; font-weight: 650; }
.kv .k + div { min-width: 0; }
.kv-section-title { grid-column: 1 / -1; margin-top: 17px; padding: 0 0 7px; color: var(--ink); font-size: 13px; font-weight: 800; }
.kv-section-title:first-child { margin-top: 8px; }
.card-note { background: var(--accent-soft); color: var(--accent); border-radius: var(--r-md); padding: 9px 11px; font-size: 12px; }
.card-stage-table { min-width: 820px; }
.audit-row { font-size: 12.5px; color: var(--muted); padding: 5px 0; border-bottom: 1px dashed var(--line); }
.copy-delivery-list { margin-top: 12px; border-top: 1px solid var(--line); }
.copy-delivery-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(350px, 1.25fr); align-items: center; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.copy-delivery-main { min-width: 0; }
.copy-assets { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 8px; }
.copy-asset { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; color: var(--muted); font-size: 11.5px; }

/* ------------------------------------------------------- генератор ответов */
.variation-groups { display: flex; flex-direction: column; gap: 10px; }
.vgroup .vtitle { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.vlist { display: flex; flex-wrap: wrap; gap: 5px; }
.vtag { background: var(--panel-2); padding: 3px 9px; border-radius: 7px; font-size: 12.5px; }
.vtag.canon { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.alias-suggest { background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.alias-suggest:hover { filter: brightness(.95); }

.opt-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 10px 0; font-size: 13px; }
.opt-row label { display: inline-flex; gap: 5px; align-items: center; }

.int-card { display: flex; gap: 14px; align-items: flex-start; }
.int-card .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.dot.on { background: var(--green); } .dot.ready { background: var(--neutral); } .dot.off { background: var(--idle); } .dot.err { background: var(--red); }
code { background: var(--panel-2); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12.5px; }
.nw { white-space: nowrap; }
.mt { margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
/* пустое состояние: всегда объясняет, почему пусто и что делать дальше */
.empty { color: var(--muted); padding: 26px 18px; text-align: center; }
.empty b { color: var(--ink); font-size: 14px; }
a.plain { color: var(--accent); text-decoration: none; }
a.plain:hover { text-decoration: underline; }

/* ------------------------------------ таблица состава месяца («гугл-таблица») */
table.sheet { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.sheet th { background: var(--panel-2); border: 1px solid var(--line); padding: 7px 8px; }
.sheet td { border: 1px solid var(--line); padding: 5px 8px; font-size: 13px; }
.sheet td.num { color: var(--muted); text-align: center; font-size: 11.5px; }
.sheet tr:hover td { background: var(--panel-2); }
/* Номер строки в составе месяца — ручка переноса: игры меняются датами релиза. */
/* -webkit-user-drag обязателен: без него Safari не даёт таскать произвольные элементы. */
.sheet .drag-handle { cursor: grab; user-select: none; -webkit-user-drag: element; display: block; padding: 2px 0; border-radius: 3px; }
.sheet .drag-handle:active { cursor: grabbing; }
.sheet .drag-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Выпадающий список с поиском внутри: у нативного <select> строку поиска
   не разместить, а серий под сотню — глазами нужную не найти. */
.combo { position: relative; display: inline-block; }
.combo-btn { font: inherit; font-size: 13px; line-height: 18px; padding: 6px 26px 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--field); color: var(--ink); cursor: pointer; text-align: left;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-btn::after { content: ''; position: absolute; right: 10px; top: 50%; margin-top: -2px;
  border: 4px solid transparent; border-top-color: var(--muted); pointer-events: none; }
.combo-pop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 260px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16); padding: 6px; }
.combo-q { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.combo-list { max-height: 240px; overflow-y: auto; }
.combo-opt { padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.combo-opt:hover, .combo-opt.active { background: var(--accent-soft); color: var(--accent); }
.combo-opt[aria-selected="true"] { font-weight: 700; }
.combo-empty { padding: 6px 8px; font-size: 12.5px; color: var(--muted); }
.sheet tr.dragging { opacity: .45; }
.sheet tr.drop-target td { background: var(--accent-soft); box-shadow: inset 0 2px 0 var(--accent); }
/* В «гугл-таблице» контролы прикидываются текстом: рамка и фон появляются только при
   наведении — так видно, что клетку можно менять, но таблица не рябит рамками. */
.sheet select, .sheet input[type=date] {
  border: 1px solid transparent; background-color: transparent; font: inherit; font-size: 13px;
  padding: 2px 22px 2px 5px; cursor: pointer; max-width: 100%; width: auto; border-radius: 6px;
  background-position: right 5px center; text-overflow: ellipsis;
}
/* селект-ячейка занимает всю клетку: стрелка стоит ровно у правого края колонки,
   иначе она «плавает» по середине ячейки — от ширины самого длинного пункта списка */
.sheet td > select { width: 100%; }
.sheet input[type=date] { padding-right: 5px; }
.sheet select:hover, .sheet input[type=date]:hover { border-color: var(--line-strong); background-color: var(--panel); }
.sheet select:focus, .sheet input[type=date]:focus { outline: 2px solid var(--accent); outline-offset: 0; border-radius: 6px; }

/* компактные контролы в таблице-конвейере контента */
.mini { font-size: 12px; padding: 2px 20px 2px 6px; max-width: 128px; }
input.mini, textarea.mini { padding: 2px 6px; }
.sheet td .row { flex-wrap: nowrap; }

@media (max-width: 780px) {
  .desc-layout { grid-template-columns: 1fr; }
  .desc-toolbar { align-items: stretch; }
  .desc-toolbar .field { width: 100%; min-width: 0; }
  .desc-episode-head, .desc-episode-body { flex-direction: column; }
  .desc-episode-actions { width: 100%; justify-content: flex-start; }
  .copy-delivery-row { grid-template-columns: 1fr; gap: 7px; }
  .copy-assets { grid-template-columns: 1fr; gap: 5px; }
  .copy-asset { padding: 2px 0; }
  .layout { display: block; }
  .mobile-bar {
    display: flex; position: fixed; z-index: 38; top: 0; left: 0; right: 0; height: 54px;
    align-items: center; gap: 10px; padding: 0 14px; background: color-mix(in srgb, var(--bg) 92%, transparent);
    border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
  }
  .mobile-bar > span { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-menu { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; }
  .sidebar {
    position: fixed; z-index: 45; inset: 0 auto 0 0; width: min(286px, calc(100vw - 42px)); height: 100dvh;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: 14px 0 40px rgba(0, 0, 0, .3);
  }
  html.nav-open .sidebar { transform: translateX(0); }
  .nav-overlay { position: fixed; z-index: 42; inset: 0; background: rgba(8, 12, 16, .5); }
  html.nav-open .nav-overlay { display: block; }
  /* На мобильном меню — полноценная панель, даже если на десктопе оно было свёрнуто. */
  html.nav-collapsed .sidebar { width: min(286px, calc(100vw - 42px)); }
  html.nav-collapsed .logo .txt,
  html.nav-collapsed #nav a > span:not(#news-badge),
  html.nav-collapsed .nav-label,
  html.nav-collapsed .me-row,
  html.nav-collapsed .foot-note,
  html.nav-collapsed .theme-btn span { display: flex; }
  html.nav-collapsed .nav-label, html.nav-collapsed .foot-note { display: block; }
  html.nav-collapsed #nav .nav-group-toggle { display: flex; }
  .nav-group.is-collapsed > a { display: none !important; }
  html.nav-collapsed .side-head { flex-direction: row; gap: 10px; padding: 16px 14px 12px; }
  html.nav-collapsed .side-head .icon-btn { margin-left: auto; }
  html.nav-collapsed #nav { padding: 4px 10px; gap: 10px; }
  html.nav-collapsed #nav a { justify-content: flex-start; padding: 8px 11px; }
  html.nav-collapsed #nav a #news-badge { position: static; }
  html.nav-collapsed #nav a #news-badge .badge { width: 8px; height: 8px; margin-left: 7px; }
  html.nav-collapsed .sidebar-foot { padding: 10px 14px 14px; }
  html.nav-collapsed .theme-btn { justify-content: flex-start; padding: 7px 10px; }
  html.nav-collapsed .me-mini, .me-mini { display: none; }
  main { width: 100%; max-width: none; padding: 76px 14px 50px; overflow: clip; }
  h1 { font-size: 23px; }
  .sub { margin-bottom: 16px; line-height: 1.35; }
  .panel { padding: 15px; border-radius: 15px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .n { font-size: 24px; }
  .row > select, .row > input[type=text], .row > input[type=url] { max-width: 100%; }
  .row > .chip { max-width: 100%; white-space: normal; }
  .filters > * { flex: 1 1 140px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field.idea-name, .field.idea-hypothesis { grid-column: 1 / -1; }
  button, select, input[type=text], input[type=url], input[type=date], input[type=number], input[type=month] { min-height: 36px; }
  button.small { min-height: 34px; padding-top: 6px; padding-bottom: 6px; }
  .sheet select, .sheet input[type=date], select.mini { min-height: 32px; }
  .mp-pop { position: fixed; left: 14px; right: 14px; top: 110px; width: auto; }
  .kv { grid-template-columns: 105px minmax(0, 1fr); column-gap: 10px; }
  .kv .k, .kv .k + div { min-height: 42px; }
  .kv-section-title { margin-top: 14px; }
  .modal { padding: 20px 16px; }
  .tabs { overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .news-row { grid-template-columns: 42px minmax(0, 1fr); gap: 7px; }
  .eff-row { grid-template-columns: 32px minmax(0, 1fr); }
  .eff-score { grid-column: 2; text-align: left; }
  .eff-cards { grid-column: 1 / -1; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
  .handover-head { flex-direction: column; }
  .handover-summary { justify-content: flex-start; }
  .handover-game { grid-template-columns: 20px minmax(0, 1fr); }
  .handover-game > .chip, .handover-game > .hint { grid-column: 2; justify-self: start; white-space: normal; }
  .handover-actions { justify-content: space-between; }
  .capacity-head { flex-direction: column; }
  .capacity-summary { justify-content: flex-start; }
  .capacity-grid { grid-template-columns: 1fr; }
  .sprint-stage-head { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (max-width: 430px) {
  .form-grid { grid-template-columns: 1fr; }
  .field.idea-name, .field.idea-hypothesis { grid-column: auto; }
  .idea-row { grid-template-columns: 1fr; padding-block: 13px; }
  .idea-meta, .idea-row.is-own .idea-status, .idea-row.is-own .idea-actions,
  .idea-row.is-team .idea-actions { grid-column: 1; grid-row: auto; }
  .idea-actions { justify-content: flex-start; flex-wrap: wrap; }
  .help-pop { left: 0; right: auto; width: min(270px, calc(100vw - 56px)); }
  .voice-settings { grid-template-columns: 1fr; }
  .voice-actions { flex-direction: column-reverse; }
  .voice-actions button { width: 100%; }
  .voice-result-card { align-items: stretch; flex-direction: column; }
  .voice-result-card audio { width: 100%; min-width: 0; }
  .voice-history-row { grid-template-columns: 1fr auto; }
  .voice-history-row audio { grid-column: 1 / -1; }
}
