/* ---------------------------------------------------------------------
   IT TW — светлый рабочий интерфейс (по образцу портала «Основание»):
   белый боковой rail с навигацией, белый топбар с хлебными крошками,
   серый фон рабочей области, белые карточки с мягкой границей и
   радиусом 12px, индиго-акцент.

   Жёлтая/серая заливка категорий one_kat/two_kat сохранена по смыслу
   (это соглашение из Excel-табеля, см. excel_export.py), но в мягких
   тонах новой палитры.
   --------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --surface-3: #f1f3f8;
  --line: #e5e8ef;
  --line-soft: #eef0f5;
  --input: #dfe3eb;
  --text: #20283f;
  --text-2: #39435b;
  --text-3: #717b90;
  --text-4: #9aa2b3;
  --primary: #465adb;
  --primary-hover: #3a4cc4;
  --primary-soft: #eef1ff;
  --primary-text: #354ab8;
  --ring: #6679e5;
  --danger: #bc3d48;
  --danger-soft: #fdeeed;
  --success: #37815b;
  --success-soft: #e8f5ee;
  --warning: #a1741b;
  --warning-soft: #fff4dd;
  --band-one: #fff8e8;
  --band-one-line: #f1e3bf;
  --band-two: #f4f5f9;
  --band-two-line: #e5e8ef;
  --band-unallocated: #fdf3f1;
  --band-unallocated-line: #f3d9d4;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-pop: 0 12px 32px rgba(32, 40, 63, 0.14), 0 2px 6px rgba(32, 40, 63, 0.06);
  --font: Arial, Helvetica, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  /* Имена переменных v1 — на случай инлайновых стилей в шаблонах. */
  --font-body: var(--font);
  --font-display: var(--font);
  --font-mono: var(--mono);
  --sheet: var(--surface);
  --sheet-sunken: var(--surface-3);
  --ink: var(--text);
  --ink-muted: var(--text-3);
  --ink-faint: var(--text-4);
  --border: var(--line);
  --border-strong: var(--input);
  --accent: var(--primary);
  --accent-strong: var(--primary-hover);
  --accent-soft: var(--primary-soft);
  --accent-contrast: #fff;
}

* { box-sizing: border-box; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--primary-text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
[hidden] { display: none !important; }

.v2-icon { flex-shrink: 0; }

/* ---------------------------------------------------------------- каркас */

.v2-workspace { display: flex; min-height: 100vh; }

.v2-rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  z-index: 20;
  overflow-y: auto;
}

.v2-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text);
  text-decoration: none;
}
.v2-brand small { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0; color: #82899b; }
.v2-brand__mark {
  background: var(--primary);
  color: #fff;
  border-radius: 11px;
  padding: 9px;
  display: flex;
}

.v2-nav-caption {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #959bac;
  margin: 36px 12px 12px;
}
.v2-nav-caption + .v2-nav-item { margin-top: 0; }
.v2-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin-top: 2px;
  border-radius: 8px;
  color: #6e7790;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}
.v2-nav-item:hover { background: var(--surface-2); color: var(--text-2); }
.v2-nav-item.is-active { background: #edf0fe; color: #4056cf; font-weight: 600; }

.tab-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}


.v2-profile {
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
}
.v2-profile small {
  display: block;
  font-size: 12px;
  color: #818b9e;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-avatar {
  background: #eff1f8;
  color: #4c5f88;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.v2-signout {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 0 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #94a0b2;
  font-size: 12px;
}
.v2-signout:hover { color: var(--danger); }

.v2-main { margin-left: 232px; width: calc(100% - 232px); min-width: 0; }

.v2-topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 38px;
  font-size: 13px;
  color: #7a8499;
  position: sticky;
  top: 0;
  z-index: 15;
}
.v2-crumbs, .v2-topbar__right { display: flex; align-items: center; gap: 10px; }
.v2-period { display: inline-flex; align-items: center; gap: 8px; }
.v2-period::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #5e71df; }

.v2-sync-status, .masthead__sync-status {
  padding: 0 38px;
  font-size: 13px;
  color: var(--text-3);
}
.v2-sync-status:not(:empty), .masthead__sync-status:not(:empty) { padding-top: 10px; }

.v2-content { padding: 30px 38px 48px; max-width: 1800px; margin: 0 auto; }
.container { max-width: none; margin: 0; }

.v2-page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 26px;
}
.v2-eyebrow { font-size: 11px; letter-spacing: 1.6px; color: #8a94a9; margin-bottom: 7px; }
.v2-page-heading h1 { font-size: 30px; letter-spacing: -1px; font-weight: 700; line-height: 1.2; }
.v2-page-heading p { color: #7d879b; font-size: 15px; margin-top: 8px; max-width: 760px; }

/* --------------------------------------------------------------- карточки */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin: 0 0 22px;
}
.panel--wide { width: auto; }
.panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}
.panel-row > .panel { margin: 0; }
.panel h2 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 14px;
}
.panel h2 .muted { font-size: 14px; font-weight: 400 !important; }
.panel h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8a95aa;
  margin: 24px 0 12px;
}
.panel h3:first-child, .panel h2 + h3 { margin-top: 4px; }
.panel > p.muted { margin-bottom: 18px; line-height: 1.6; }
.muted { color: #8791a4; font-size: 13px; }
.help-text {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.8;
  max-width: 76ch;
  color: var(--text-2);
}

/* ------------------------------------------------------------------ формы */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); line-height: 1.4; }
.field small { font-size: 12px; color: #8a95a8; line-height: 1.5; }

input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { line-height: 1.6; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a3abbb; }
input:hover, select:hover, textarea:hover { border-color: #cbd1dd; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(102, 121, 229, 0.18);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.field input, .field select, .field textarea { width: 100%; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23717b90' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar label.muted { display: flex; align-items: center; gap: 7px; }

/* ----------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--surface-2); border-color: #cbd1dd; }
.btn:disabled { opacity: 0.5; }
.btn--small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-3); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text-2); }
.btn--ghost.is-active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.btn--danger { color: var(--danger); border-color: #efc9cc; }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* -------------------------------------------------------- статусы, алерты */

.status { min-height: 18px; font-size: 13px; color: var(--text-3); line-height: 1.6; white-space: pre-wrap; }
.status--error { color: var(--danger); }
.status--ok { color: var(--success); }

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 13px 15px;
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
}
.alert--ok { background: #edf7f0; color: #448161; }
.alert--error { background: #fceeed; color: #aa5d57; }

/* ---------------------------------------------------------------- таблицы */

table.mapping-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
table.mapping-table th {
  background: var(--surface-2);
  color: #8791a5;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 11px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.mapping-table th:first-child { border-top-left-radius: var(--radius); }
table.mapping-table th:last-child { border-top-right-radius: var(--radius); }
table.mapping-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: middle;
}
table.mapping-table tr:last-child td { border-bottom: none; }
table.mapping-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.mapping-table td input[type="text"], table.mapping-table td input[type="number"] { min-height: 34px; padding: 5px 9px; }

/* -------------------------------------------------- вкладки месяцев, переключатели */

.month-tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.month-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 9px;
  overflow-x: auto;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.month-tabs button, .metric-switch button {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 7px;
  white-space: nowrap;
}
.month-tabs button:hover, .metric-switch button:hover { color: var(--text); }
.month-tabs button.is-active, .metric-switch button.is-active {
  background: var(--surface);
  color: var(--primary-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(32, 40, 63, 0.1);
}
.metric-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 9px;
  margin-left: auto;
}
.month-tabs::-webkit-scrollbar { height: 6px; }
.month-tabs::-webkit-scrollbar-thumb { background: var(--input); border-radius: 999px; }
.month-status { font-size: 13px; color: var(--text-3); padding: 0 0 12px; white-space: pre-wrap; }

.co-filter-row { margin: 0 0 14px; }
.co-filter-input {
  width: 100%;
  max-width: 440px;
  padding-left: 38px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa3b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* ---------------------------------------------------------- таблица отчёта
   Шапка (ФИО) прилипает сверху, «№ / ЦО / Итого» — слева: «замороженный
   угол», как в v1, но в светлой палитре. */

.report-container {
  overflow: auto;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
table.report-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.report-table th, table.report-table td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
  background-clip: padding-box;
}
table.report-table th:last-child, table.report-table td:last-child { border-right: none; }
table.report-table th {
  background: var(--surface-2);
  color: #8791a5;
  font-size: 12px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}
table.report-table th:nth-child(n+4) {
  white-space: normal;
  min-width: 70px;
  max-width: 96px;
  text-align: center;
  line-height: 1.3;
}
table.report-table th:nth-child(1), table.report-table td:nth-child(1) {
  position: sticky; left: 0; z-index: 1; width: 46px; min-width: 46px; text-align: center; color: var(--text-4);
}
table.report-table th:nth-child(2), table.report-table td:nth-child(2) {
  position: sticky; left: 46px; z-index: 1; width: 230px; min-width: 230px; max-width: 230px; white-space: normal;
}
table.report-table th:nth-child(3), table.report-table td:nth-child(3) {
  position: sticky; left: 276px; z-index: 1; width: 96px; min-width: 96px; max-width: 96px;
  text-align: right; border-right: 1px solid var(--line);
  box-shadow: 4px 0 8px -6px rgba(32, 40, 63, 0.18);
}
table.report-table th:nth-child(1), table.report-table th:nth-child(2), table.report-table th:nth-child(3) { z-index: 3; }

tr.row-co td { background: var(--surface); color: var(--text-2); }
tr.row-co:hover td { background: #f8faff; }
tr.row-one_kat td { background: var(--band-one); border-bottom-color: var(--band-one-line); font-weight: 700; color: var(--text); }
tr.row-two_kat td { background: var(--band-two); border-bottom-color: var(--band-two-line); font-weight: 600; color: var(--text); }
tr.row-unallocated td {
  background: var(--band-unallocated);
  border-bottom-color: var(--band-unallocated-line);
  color: #9a4c45;
  font-weight: 600;
}
tr.row-unallocated_co td { background: var(--band-unallocated); color: var(--text-3); }
tr.row-summary-total td { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; border-bottom: none; }
tr.row-excess td { background: var(--danger-soft); color: var(--danger); font-weight: 600; font-style: italic; }
td.pct { text-align: right; }
td.row-total { font-size: 12px; line-height: 1.35; white-space: normal; }

td.pct.cell-detail { cursor: help; text-decoration: underline dotted #b3bacb; text-underline-offset: 3px; }
td.pct.cell-detail:hover { background: var(--primary-soft) !important; }
td.pct.cell-has-manual { position: relative; }
td.pct.cell-has-manual::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface);
}
td.pct.cell-editable { outline: 1px dashed #c6cde0; outline-offset: -3px; }
td.pct.cell-editable:hover { background: var(--primary-soft); cursor: text; }
.manual-hours-input {
  width: 100%;
  min-height: 0 !important;
  padding: 2px 5px !important;
  text-align: right;
  font-size: inherit !important;
  border-color: var(--ring) !important;
}

/* ------------------------------------------------------ попап детализации */

.task-popover {
  position: fixed;
  z-index: 60;
  width: 400px;
  max-width: calc(100vw - 24px);
  max-height: 62vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-2);
}
.task-popover__title { font-size: 15px; font-weight: 700; color: var(--text); }
.task-popover__subtitle { color: var(--text-3); margin: 2px 0 10px; font-size: 13px; }
.task-popover__note, .task-popover__hint {
  background: #f3f5fc;
  color: #6b7aa0;
  border-radius: var(--radius);
  padding: 9px 11px;
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
}
.task-popover__total { font-weight: 700; color: var(--text); margin: 0 0 6px; }
.task-popover__breakdown { margin: 0 0 10px !important; padding: 0 0 8px !important; border-bottom: 1px solid var(--line-soft); }
.task-popover__breakdown li { padding: 1px 0 !important; border-top: none !important; font-size: 12.5px; color: var(--text-3); }
.task-popover ul { list-style: none; margin: 0; padding: 0; }
.task-popover li { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.task-popover li:first-child { border-top: none; }
.task-popover__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.task-popover__task-check { margin: 0; }
.task-popover__badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-3);
}
.task-popover__badge--bitrix { background: #e7f0ff; color: #2f5fb3; }
.task-popover__badge--redmine { background: #fdeeed; color: #a2453d; }
.task-popover__badge--manual { background: var(--warning-soft); color: var(--warning); }
.task-popover__desc { margin: 4px 0 0; line-height: 1.45; }
.task-popover__empty { color: var(--text-4); font-style: italic; }
.task-popover__reassign {
  background: #f6f8ff;
  border: 1px solid #dde5fc;
  border-radius: var(--radius);
  padding: 10px;
  margin: 0 0 10px;
}
.task-popover__reassign-title { font-size: 12.5px; font-weight: 700; margin: 0 0 7px; color: #445788; }
.task-popover__reassign-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-popover__reassign-select { flex: 1 1 160px; min-width: 0; min-height: 32px !important; padding: 4px 30px 4px 8px !important; font-size: 12.5px !important; }
.task-popover__reassign-row .btn { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.task-popover__reassign-status { margin: 6px 0 0; font-size: 12px; color: var(--text-3); min-height: 14px; }
.task-popover__reassign-remove { margin-top: 6px; }

/* ------------------------------------------------------------ выбор ЦО */

.co-picker { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.co-picker__toolbar { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.co-picker__search { flex: 1; }
.co-picker__count { flex-shrink: 0; font-size: 12.5px; white-space: nowrap; }
.co-picker__list { max-height: 420px; overflow-y: auto; padding: 6px; }
.co-picker__one-kat { margin: 8px 4px; }
.co-picker__one-kat-title { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #8a95aa; padding: 6px 8px; }
.co-picker__two-kat { margin: 2px 0 8px; }
.co-picker__two-kat-title { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 8px 2px 14px; }
.co-picker__item { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 26px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.co-picker__item:hover { background: #f8faff; }
.co-picker__item-name { flex: 1; min-width: 0; }
.co-picker__item-ruk { flex-shrink: 0; font-size: 12px; color: var(--text-4); }

.co-access-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--primary-soft);
  color: var(--primary-text);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  margin: 2px 4px 2px 0;
  font-size: 12.5px;
}
.co-access-chip button { border: 0; background: none; color: #7d8dc9; font-size: 15px; line-height: 1; padding: 2px 6px; }
.co-access-chip button:hover { color: var(--danger); }

/* ------------------------------------------------ модальные окна = панель справа */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  background: rgba(32, 40, 63, 0.32);
  animation: v2-fade 140ms ease-out;
}
.modal-panel {
  width: 560px;
  max-width: 96vw;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(32, 40, 63, 0.12);
  padding: 28px 32px;
  animation: v2-slide 180ms ease-out;
  scrollbar-width: thin;
}
.modal-panel h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.modal-panel .co-picker__list { max-height: calc(100vh - 260px); }
@keyframes v2-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes v2-slide { from { transform: translateX(28px); opacity: 0.6; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------ маппинг */

.mapping-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 8px; }
.mapping-column h3 { margin: 0 0 10px !important; }
.mapping-column input { width: 100%; margin-bottom: 10px; }
.mapping-list { max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.mapping-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
}
.mapping-item:last-child { border-bottom: none; }
.mapping-item:hover { background: #f8faff; }
.mapping-item.selected { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.mapping-item.linked { color: var(--text-4); }
.mapping-item .badge { font-size: 11.5px; color: var(--text-4); white-space: nowrap; flex-shrink: 0; }
.mapping-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  background: #f3f5fc;
  border-radius: var(--radius-lg);
}
.mapping-picker__pair { font-size: 14px; color: var(--text-3); }
.mapping-picker__pair strong { color: var(--text); }
.mapping-picker input[type="text"] { flex: 1; min-width: 220px; }
#mapping_table_container, #employees_table_container, #alias_table_container, #users_table_wrap { overflow-x: auto; }

/* -------------------------------------------------- производственный календарь */

.calendar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 6px; }
.calendar-cell { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 10px 12px; }
.calendar-cell label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #8a95aa; margin-bottom: 6px; }
.calendar-cell input { width: 100%; min-height: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.calendar-cell input.has-value { border-color: #b9c3f3; background: #fbfcff; }

/* ------------------------------------------------------------------ план */

.plan-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 18px; }
.plan-select { min-width: 170px; }
.plan-toolbar .metric-switch { margin-left: 0; }
.plan-toolbar .co-filter-input { max-width: 380px; }

.plan-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 0;
  margin-bottom: 18px;
}
.plan-card { padding: 0 22px; border-right: 1px solid var(--line-soft); }
.plan-card:last-child { border-right: none; }
.plan-card__label { font-size: 13px; color: #7b8498; }
.plan-card__value { font-size: 22px; font-weight: 600; letter-spacing: -0.6px; margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

.plan-table-wrap, .plan-matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.plan-table-wrap > p.muted { padding: 40px 20px; text-align: center; }
table.plan-table td { vertical-align: top; }
.plan-row { cursor: pointer; }
.plan-row:hover td { background: #f8faff; }
.plan-row--mine td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.plan-title { min-width: 280px; max-width: 520px; }
.plan-title > div:first-child { font-weight: 500; color: #37435d; line-height: 1.5; }
.plan-title__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; font-size: 12px; }
.plan-issue { font-size: 12px; font-weight: 600; text-decoration: none; }
.plan-issue:hover { text-decoration: underline; }
.plan-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}
.plan-fact--over { color: var(--danger); font-weight: 700; }
.plan-total--ok { color: var(--success); font-weight: 600; }

.plan-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.plan-status--draft { background: #f0f2f7; color: #7b859b; }
.plan-status--manager_review, .plan-status--up_review { background: var(--warning-soft); color: var(--warning); }
.plan-status--approved { background: var(--success-soft); color: var(--success); }
.plan-status--approved::before { content: "✓"; font-weight: 700; }
.plan-status--returned { background: #fdeeed; color: #b26159; }
.plan-status--rejected { background: #f5e4e5; color: var(--danger); text-decoration: line-through; }

.plan-load { position: relative; min-width: 160px; height: 22px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.plan-load__bar { height: 100%; border-radius: 6px; }
.plan-load__bar--ok { background: #cfe8da; }
.plan-load__bar--high { background: #f6e0b0; }
.plan-load__bar--over { background: #f3c7c7; }
.plan-load__label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-2); }

.plan-coverage {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(200px, 1fr) minmax(260px, 1.4fr);
  gap: 20px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.plan-coverage > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-coverage label { font-size: 12px; font-weight: 600; color: var(--text-3); }
.plan-coverage__row { display: flex; gap: 8px; align-items: center; }
.plan-coverage__recs { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-rec {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.plan-rec:hover { border-color: var(--ring); }
@media (max-width: 900px) { .plan-coverage { grid-template-columns: 1fr; } }

.plan-modal .modal-panel, .plan-modal__panel { width: 760px; padding: 0; display: flex; flex-direction: column; }
.plan-modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 32px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.plan-modal__panel > *:not(.plan-modal__head):not(.plan-modal__actions) { margin-left: 32px; margin-right: 32px; }
.plan-modal__panel > .plan-form { margin-top: 24px; }
.plan-modal__panel > .alert { margin-top: 18px; }
.plan-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.plan-form__wide { grid-column: 1 / -1; }
.plan-field textarea { min-height: 84px; }
.plan-hint { margin-top: 2px; }
.plan-months { margin-top: 4px; }
.plan-months__grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.plan-months__cell { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-3); }
.plan-months__cell input { width: 100px; }
.plan-calc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 16px !important;
  padding: 14px 16px;
  background: #eaf0fe;
  border-radius: var(--radius);
  color: #506595;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.plan-fact { margin-top: 14px !important; padding: 12px 16px; background: var(--surface-2); border-radius: var(--radius); }
.plan-signatures, .plan-effect, .plan-decision { margin-top: 24px !important; }
.plan-signatures h3, .plan-effect h3, .plan-decision h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8a95aa;
  margin-bottom: 12px;
}
.plan-signatures__table { width: 100%; border-collapse: collapse; font-size: 14px; }
.plan-signatures__table th { text-align: left; font-weight: 500; color: var(--text-3); padding: 7px 14px 7px 0; width: 230px; }
.plan-signatures__table td { padding: 7px 14px 7px 0; color: var(--text-2); border-bottom: 1px solid var(--line-soft); }
.plan-signatures__table tr:last-child td { border-bottom: none; }
.plan-effect { padding: 18px 20px; border: 1px solid #e0e5ee; border-radius: 10px; }
.plan-effect p { font-size: 15px; line-height: 1.8; margin-top: 10px; white-space: pre-wrap; }
.plan-decision { padding: 22px; background: #f6f8ff; border: 1px solid #bccbff; border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 4px; }
.plan-decision h3 { color: #445788; }
.plan-decision > p.muted { margin-bottom: 12px; line-height: 1.6; }
.plan-decision textarea { width: 100%; min-height: 130px; }
.plan-decision .toolbar { margin: 0; }
.plan-ai__card { margin-top: 12px; padding: 18px; background: #fff; border: 1px solid #dce3ef; border-radius: 10px; font-size: 14px; line-height: 1.65; }
.plan-ai__card p { margin: 8px 0; }
.plan-ai__card ul { margin: 6px 0 12px 18px; padding: 0; }
.plan-ai__head { display: flex; align-items: center; gap: 10px; }
.plan-history { margin-top: 22px !important; font-size: 14px; }
.plan-history summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--text-2); }
.plan-history ul { list-style: none; padding: 0; margin: 8px 0 0; }
.plan-history li { position: relative; padding: 0 0 16px 20px; color: var(--text-2); }
.plan-history li::before { content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: #8998d5; }
.plan-history__comment { margin-top: 6px; padding: 10px 12px; background: #f5f7fb; border-radius: 7px; color: var(--text-3); white-space: pre-wrap; }
.plan-modal__panel > .status { margin-top: 12px; }
.plan-modal__actions {
  position: sticky;
  bottom: 0;
  margin: auto 0 0 !important;
  padding: 16px 32px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -5px 15px rgba(41, 56, 85, 0.04);
  flex-wrap: wrap;
}
.plan-inline-input { width: 100%; min-width: 120px; min-height: 34px !important; padding: 5px 9px !important; }
.plan-inline-input--num { min-width: 64px; width: 76px; text-align: right; }
table.plan-matrix th { white-space: nowrap; }
table.plan-matrix td, table.plan-matrix th { padding: 6px 8px; }

/* ------------------------------------------------------------------ вход */

.v2-login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.v2-login-card {
  width: min(460px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.v2-login-card h1 { font-size: 24px; letter-spacing: -0.5px; margin: 30px 0 8px; }
.v2-login-card > p { color: #6f7b92; margin-bottom: 24px; }
.v2-login-card .btn { margin-top: 8px; min-height: 44px; }

/* -------------------------------------------------------------- адаптив */

@media (max-width: 1100px) {
  .v2-rail { width: 200px; padding: 24px 12px 18px; }
  .v2-main { margin-left: 200px; width: calc(100% - 200px); }
  .v2-content { padding: 24px 20px 40px; }
  .v2-topbar, .v2-sync-status, .masthead__sync-status { padding-left: 20px; padding-right: 20px; }
  .panel-row { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .v2-workspace { display: block; }
  .v2-rail {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 14px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .v2-rail .v2-brand { flex: 1 0 100%; margin-bottom: 6px; }
  .v2-nav-caption, .v2-profile { display: none; }
  .v2-nav-item { padding: 7px 11px; font-size: 13px; }
  .v2-rail form { margin-left: auto; }
  .v2-signout { margin: 0; }
  .v2-main { margin: 0; width: 100%; }
  .v2-topbar { height: 52px; }
  .v2-page-heading h1 { font-size: 25px; }
  .panel { padding: 20px; }
  .plan-form, .mapping-columns { grid-template-columns: 1fr; }
  .modal-panel, .plan-modal__panel { width: 100vw; max-width: 100vw; }
  table.report-table th:nth-child(2), table.report-table td:nth-child(2) { width: 150px; min-width: 150px; max-width: 150px; }
  table.report-table th:nth-child(3), table.report-table td:nth-child(3) { left: 196px; }
}

/* Всплывающее уведомление об успешном действии в плане. */
.plan-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  padding: 11px 16px;
  border-radius: 8px;
  background: #2f3a52;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.plan-toast.is-visible { opacity: 1; transform: none; }
.plan-card__sub { font-size: 12px; color: var(--warning); margin-top: 2px; }
.metric-switch .tab-badge { margin-left: 6px; }
table.plan-table th, table.plan-table td { padding-left: 12px; padding-right: 12px; }
.plan-title { min-width: 240px; }

.month-tabs:empty, .plan-summary:empty { display: none; }
.plan-decision + .plan-field { margin-top: 18px; }
.plan-decision .btn--ghost { border-color: #bccbff; background: #fff; color: var(--primary-text); }
.plan-decision .btn--ghost:hover { background: var(--primary-soft); }
.v2-crumbs, .v2-period { white-space: nowrap; }
.v2-crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .v2-period { display: none; } }

/* ------------------------------------------------ свёрнутое боковое меню */

.v2-rail-spacer { margin-top: auto; }
.v2-page-heading p:empty { display: none; }
.v2-rail, .v2-main { transition: width 160ms ease, margin-left 160ms ease, padding 160ms ease; }
.v2-rail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-3);
}
.v2-rail-toggle:hover { background: var(--surface-2); color: var(--text); }

.rail-collapsed .v2-rail { width: 72px; padding: 24px 12px 18px; overflow-x: hidden; }
.rail-collapsed .v2-main { margin-left: 72px; width: calc(100% - 72px); }
.rail-collapsed .v2-brand__text,
.rail-collapsed .v2-nav-label,
.rail-collapsed .v2-profile__text,
.rail-collapsed .v2-signout span { display: none; }
.rail-collapsed .v2-brand { justify-content: center; }
.rail-collapsed .v2-nav-caption { height: 1px; margin: 22px 6px 14px; overflow: hidden; color: transparent; background: var(--line-soft); }
.rail-collapsed .v2-nav-item { justify-content: center; padding: 11px 0; position: relative; }
.rail-collapsed .v2-nav-item .tab-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 17px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 16px;
}
.rail-collapsed .v2-profile { justify-content: center; }
.rail-collapsed .v2-signout { margin: 12px 0 0; width: 100%; justify-content: center; }

@media (max-width: 760px) {
  .v2-rail-toggle { display: none; }
  .rail-collapsed .v2-rail { width: 100%; padding: 14px; }
  .rail-collapsed .v2-main { margin-left: 0; width: 100%; }
  .rail-collapsed .v2-nav-label, .rail-collapsed .v2-brand__text { display: inline; }
}
.v2-crumbs { margin-right: auto; }

/* Матрица «сотрудник × направление»: шапка с направлениями и столбец с
   фамилиями закреплены при прокрутке. */
.plan-matrix-wrap { max-height: 70vh; overflow: auto; }
table.plan-matrix { border-collapse: separate; border-spacing: 0; }
table.plan-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); box-shadow: inset 0 -1px 0 var(--line); }
table.plan-matrix th:first-child, table.plan-matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--line); }
table.plan-matrix thead th:first-child { z-index: 3; background: var(--surface-2); }

.plan-card__value { white-space: normal; overflow-wrap: anywhere; }
table.plan-table tfoot td { font-weight: 700; color: var(--text); background: var(--surface-2); border-top: 1px solid var(--line); }
.plan-issue-check { font-size: 13px; }
.plan-issue-check.is-loading { color: var(--text-3); }
.plan-issue-check.is-loading::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: plan-spin 700ms linear infinite;
}
.plan-issue-check.is-ok { color: var(--success); }
.plan-issue-check.is-ok .plan-issue { color: var(--success); }
.plan-issue-check.is-error { color: var(--danger); }
@keyframes plan-spin { to { transform: rotate(360deg); } }

/* Колонки сетки не должны распирать страницу шире окна — широкие таблицы
   прокручиваются внутри карточки. */
.panel-row > .panel { min-width: 0; }
#ps_directions, #ps_work_types, #ps_rates, #plan_capacity_wrap, #calendar_grid { overflow-x: auto; }

/* ---------------------------------------------------------- аналитика */
.an-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 18px; }
.an-toolbar label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-3); }
.an-note { margin: 0 0 18px; padding: 10px 14px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); font-size: 14px; }
.an-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 40px; margin-top: 22px; }
.an-two > div { min-width: 0; }
.an-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: 0; flex: none; }
.an-dot--line { height: 3px; width: 14px; border-radius: 2px; vertical-align: 3px; }

.an-split__bar { display: flex; height: 44px; border-radius: 10px; overflow: hidden; gap: 2px; background: var(--surface); }
.an-split__seg { display: flex; align-items: center; justify-content: center; min-width: 3px; color: #fff; font-weight: 700; font-size: 14px; }
.an-split__seg span { text-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.an-split__legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-top: 18px; }
.an-big__label { display: flex; align-items: center; font-size: 13px; color: var(--text-3); }
.an-big__value { font-size: 28px; font-weight: 700; letter-spacing: -0.8px; margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.an-big__sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

.an-hbars { display: flex; flex-direction: column; gap: 9px; }
.an-hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.an-hbar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.an-hbar__track { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.an-hbar__fill { height: 100%; border-radius: 999px; }
.an-hbar__value { font-size: 13px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.an-cols { width: 100%; max-height: 260px; display: block; }
.an-cols__label { font-size: 12px; fill: var(--text-3); }
.an-cols__value { font-size: 11px; font-weight: 600; fill: var(--text-2); }
.an-cols__marker { stroke: #e0913a; stroke-width: 3; stroke-linecap: round; }
.an-cols__legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text-3); margin-top: 8px; }
.an-cols__legend > span { display: inline-flex; align-items: center; }

.an-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.an-tile { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; background: var(--surface-2); }
.an-tile__label { font-size: 13px; color: var(--text-3); }
.an-tile__value { font-size: 24px; font-weight: 700; letter-spacing: -0.6px; margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.an-tile__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.an-tile--warn { border-color: #f1ddb0; background: var(--warning-soft); }
.an-tile--bad { border-color: #f1c9cc; background: var(--danger-soft); }
.an-tile--bad .an-tile__value { color: var(--danger); }

.an-details { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.an-details summary { cursor: pointer; font-weight: 600; color: var(--primary-text); font-size: 14px; }
.an-details[open] summary { margin-bottom: 12px; }
.an-details .co-filter-input { margin-bottom: 12px; }
.an-people { font-size: 12px; max-width: 380px; }
.an-zero { margin-top: 10px; font-size: 13px; }
.an-strong { font-weight: 700; }
.an-bad { color: var(--danger); font-weight: 600; }
.an-warn { color: var(--warning); font-weight: 600; }
.an-fc-how { font-size: 13px; margin-top: 10px; }
@media (max-width: 820px) {
  .an-two { grid-template-columns: 1fr; }
  .an-hbar { grid-template-columns: 1fr auto; }
  .an-hbar__track { grid-column: 1 / -1; grid-row: 2; }
}
.an-unalloc { margin-top: 14px; font-size: 13px; }

/* ---------------------------------------------------------- «Сменить» связку */
.relink-modal { width: 560px; max-width: calc(100vw - 32px); }
.relink-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.relink-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface-2); cursor: pointer; font: inherit; text-align: left;
}
.relink-choice:hover { border-color: var(--ring); background: var(--primary-soft); }
.relink-choice strong { font-size: 16px; color: var(--text); }
.relink-choice span { font-size: 13px; color: var(--text-3); }
.relink-list { margin-top: 10px; max-height: 300px; }
.relink-modal .co-filter-input { width: 100%; }
@media (max-width: 560px) { .relink-choices { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------- администрирование */
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 22px; margin-bottom: 22px; align-items: start; }
.adm-grid > .adm-card { margin: 0; }
.adm-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin: 0 0 22px; overflow: hidden; }
.adm-card__head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line-soft); }
.adm-card__icon { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.adm-card__icon--danger { background: var(--danger-soft); color: var(--danger); }
.adm-card__icon--green { background: var(--success-soft); color: var(--success); }
.adm-card__icon--amber { background: var(--warning-soft); color: var(--warning); }
.adm-card__title { flex: 1; min-width: 0; }
.adm-card__title h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.adm-card__title p { margin: 3px 0 0; font-size: 13px; color: var(--text-3); line-height: 1.5; }
.adm-card__body { padding: 20px 24px 6px; }
.adm-card__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line-soft); background: var(--surface-2); }
.adm-card__foot .status { flex: 1 1 200px; margin: 0; }
.adm-card__foot .spacer { flex: 1; }
.adm-card .grid { gap: 2px 16px; }
.adm-note { font-size: 13px; color: var(--text-3); line-height: 1.6; margin: 0 0 16px; }
.adm-note code { font-size: 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-3); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill--ok { background: var(--success-soft); color: var(--success); }
.pill--err { background: var(--danger-soft); color: var(--danger); }
.pill--warn { background: var(--warning-soft); color: var(--warning); }
.pill--wait::before { animation: pill-pulse 1s ease-in-out infinite; }
@keyframes pill-pulse { 50% { opacity: .2; } }

.adm-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 22px; background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.adm-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-3); text-decoration: none; white-space: nowrap; }
.adm-tabs a:hover { color: var(--text); }
.adm-tabs a.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(32, 40, 63, .08); }
.adm-tabs .v2-icon { width: 16px; height: 16px; }

.adm-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 0 0 18px; }
.adm-role { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.adm-role strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.adm-role span { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.adm-searchbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.adm-searchbar .co-filter-input { max-width: 320px; margin: 0; }
.adm-count { font-size: 13px; color: var(--text-3); }

.adm-danger { border-color: #f1c9cc; }
.adm-danger .adm-card__head { background: #fffafa; }
.sql-editor { width: 100%; min-height: 150px; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; padding: 12px 14px; border: 1px solid var(--input); border-radius: var(--radius); background: #fbfcfe; color: var(--text); resize: vertical; }
.sql-editor:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--primary-soft); }
.sql-confirm { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); margin: 12px 0 0; }
.sql-examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.sql-examples button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.sql-examples button:hover { border-color: var(--ring); color: var(--primary-text); }

.cal-summary { display: flex; flex-wrap: wrap; gap: 18px; margin: 0 0 14px; font-size: 13px; color: var(--text-3); }
.cal-summary strong { color: var(--text); font-size: 15px; }
.calendar-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 900px) { .calendar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .adm-grid { grid-template-columns: 1fr; } }
.adm-card__head { flex-wrap: wrap; }
.adm-card__title { min-width: 220px; }
@media (max-width: 720px) { .adm-card__head, .adm-card__body, .adm-card__foot { padding-left: 16px; padding-right: 16px; } }
.apikey-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.apikey-form .field { margin: 0; }
.apikey-reveal { border: 1px solid #bfe0cd; background: var(--success-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 13px; color: var(--text); }
.apikey-reveal__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.apikey-reveal code { font-size: 13px; background: var(--surface); padding: 6px 10px; border-radius: 6px; word-break: break-all; flex: 1 1 260px; }
@media (max-width: 720px) { .apikey-form { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------- карточка работы: эффект ₽ и обсуждение */
.plan-amount { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; align-items: end; }
.plan-amount .plan-form__wide { grid-column: 1 / -1; margin: -6px 0 10px; }
.plan-amount-kind { margin: 0; }
.plan-effect__amount { font-weight: 600; color: var(--success) !important; margin-top: 10px !important; line-height: 1.5 !important; }
.plan-discussion { margin-top: 24px; padding: 18px 20px; border: 1px solid #e0e5ee; border-radius: 10px; display: flex; flex-direction: column; gap: 10px; }
.plan-discussion h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #8a95aa; }
.plan-discussion textarea { width: 100%; }
.plan-discussion .toolbar { margin: 0; }
.plan-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.plan-thread__msg { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 14px; white-space: pre-wrap; }
.plan-thread__msg.is-return { background: #fdf3f1; border-color: #f3d9d4; }
.plan-thread__meta { font-size: 13px; margin-bottom: 4px; white-space: normal; }
@media (max-width: 560px) { .plan-amount { grid-template-columns: 1fr; } }

/* фильтр сотрудника в отчёте по факту */
.co-filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.co-filter-row .co-filter-input { flex: 1 1 280px; }
.employee-filter { flex: 0 1 280px; min-width: 200px; }
.employee-filter.is-active { border-color: var(--ring); background-color: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.plan-id { font-weight: 600; color: var(--primary-text); text-decoration: none; white-space: nowrap; }
.plan-id:hover { text-decoration: underline; }
.plan-copy-link { margin-left: auto; }

/* отпуск в форме работы */
.plan-vacation-toggle { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed var(--input); border-radius: 10px; cursor: pointer; font-size: 14px; margin-bottom: 6px; }
.plan-vacation-toggle input { width: 18px; height: 18px; margin: 0; }
.plan-vacation { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 14px 16px 0; border-radius: 10px; background: var(--primary-soft); }
.plan-vacation input[type="date"] { width: 100%; }

/* выбор периода (отпуск) */
.range-picker { position: relative; }
.range-picker__field { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 1px solid var(--input); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.range-picker__field:hover:not(:disabled) { border-color: var(--ring); }
.range-picker__field:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--primary-soft); }
.range-picker__field:disabled { background: var(--surface-3); cursor: default; }
.range-picker__icon { font-size: 15px; filter: grayscale(1); opacity: .7; }
.range-picker__pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 300px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
.range-picker__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.range-picker__head strong { font-size: 15px; color: var(--text); }
.range-picker__nav { width: 32px; height: 32px; border: none; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 20px; line-height: 1; cursor: pointer; }
.range-picker__nav:hover { background: var(--surface-3); }
.range-picker__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.range-picker__dow { font-size: 11px; font-weight: 600; text-align: center; color: var(--text-3); padding: 4px 0; }
.range-picker__dow.is-weekend { color: #c07a7a; }
.range-picker__day { height: 34px; border: none; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.range-picker__day:hover { background: var(--primary-soft); }
.range-picker__day.is-weekend { color: #b25d5d; }
.range-picker__day.is-other { color: var(--text-4); }
.range-picker__day.is-today { box-shadow: inset 0 0 0 1px var(--ring); }
.range-picker__day.in-range { background: var(--primary-soft); border-radius: 0; color: var(--primary-text); }
.range-picker__day.is-start, .range-picker__day.is-end { background: var(--primary); color: #fff; font-weight: 600; }
.range-picker__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; }
.range-picker__link { border: none; background: none; color: var(--primary-text); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }
.plan-return-dialog { z-index: 1200; }
.plan-return-dialog__panel { width: 520px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 12px; }
.plan-return-dialog__panel h3 { margin: 0; font-size: 18px; }
.plan-return-dialog__panel textarea { width: 100%; }
.plan-return-dialog__panel .toolbar { margin: 0; }
.modal-overlay.plan-return-dialog { justify-content: center; align-items: center; padding: 16px; }
.plan-return-dialog .plan-return-dialog__panel { height: auto; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); padding: 24px; animation: v2-fade 140ms ease-out; }

/* Telegram: индикатор в «Доступе» */
.tg-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; }
.tg-dot--on { background: #2fb36b; box-shadow: 0 0 0 3px rgba(47, 179, 107, .18); }
.tg-dot--off { background: #e05a5a; box-shadow: 0 0 0 3px rgba(224, 90, 90, .14); }

/* Telegram: плашка подключения */
.tg-banner { position: fixed; inset: 0; z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(32, 40, 63, .38); animation: v2-fade 160ms ease-out; }
.tg-banner__card { width: 460px; max-width: 100%; background: var(--surface); border-radius: 22px; padding: 26px 30px 22px; text-align: center; box-shadow: 0 24px 60px rgba(32, 40, 63, .22); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tg-banner__mascot { margin: -6px 0 2px; }
.tg-banner__mascot svg { display: block; max-width: 100%; height: auto; animation: tg-float 3.2s ease-in-out infinite; }
@keyframes tg-float { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .tg-banner__mascot svg { animation: none; } }
.tg-banner__card h2 { margin: 0; font-size: 22px; letter-spacing: -0.4px; color: var(--text); }
.tg-banner__lead { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-3); max-width: 38ch; }
.tg-banner__go { width: 100%; justify-content: center; min-height: 46px; font-size: 15px; background: #229ed9; border-color: #229ed9; margin-top: 4px; text-decoration: none; }
.tg-banner__go:hover { background: #1b8bc0; border-color: #1b8bc0; }
.tg-banner__manual { font-size: 13px; color: var(--text-3); }
.tg-banner__code { margin-left: 4px; padding: 3px 9px; border: 1px dashed var(--ring); border-radius: 7px; background: var(--primary-soft); color: var(--primary-text); font: inherit; font-family: var(--font-mono); font-weight: 700; letter-spacing: 1.5px; cursor: pointer; }
.tg-banner__status { margin: 0; min-height: 18px; font-size: 13px; color: var(--success); }
.tg-banner__later { border: none; background: none; color: var(--text-3); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 8px; }
.tg-banner__later:hover { color: var(--text); }
.tg-banner__card.is-done { box-shadow: 0 0 0 3px rgba(47, 179, 107, .35), 0 24px 60px rgba(32, 40, 63, .22); }

/* подменю раздела в левом меню */
.v2-subnav { display: flex; flex-direction: column; margin: 2px 0 6px 31px; padding-left: 12px; border-left: 1px solid var(--line); }
.v2-subnav__item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 7px; font-size: 13px; color: #6e7790; text-decoration: none; }
.v2-subnav__item:hover { background: var(--surface-2); color: var(--text-2); }
.v2-subnav__item.is-active { color: var(--primary-text); font-weight: 600; background: var(--primary-soft); }
.rail-collapsed .v2-subnav { display: none; }

/* ------------------------------------------------------------------ платёжный календарь */
.plan-toast--error { background: var(--danger); }
.pay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.pay-head__right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pay-today { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pay-month { display: inline-flex; align-items: center; gap: 8px; }
.pay-month b { min-width: 120px; text-align: center; font-size: 15px; color: var(--text); }
.pay-empty { padding: 10px 0 14px; }
.pay-empty-state { padding: 60px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.pay-empty-state h3 { margin: 0 0 6px; }

.pay-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--line); gap: 1px; }
.pay-grid__dow { background: var(--surface-2); padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.pay-grid__cell { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pay-grid__cell--empty { background: var(--surface-2); }
.pay-grid__cell.is-weekend { background: #fcfcfe; }
.pay-grid__day { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 2px 4px; align-self: flex-start; border-radius: 6px; }
.pay-grid__cell.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.pay-grid__cell.is-today .pay-grid__day { background: var(--primary); color: #fff; }
.pay-chip { display: grid; grid-template-columns: 1fr auto; gap: 0 6px; padding: 5px 7px; border-radius: 6px; font-size: 12px; line-height: 1.35; text-decoration: none; color: var(--text-2); border-left: 3px solid var(--text-4); background: var(--surface-3); }
.pay-chip:hover { filter: brightness(.97); }
.pay-chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; min-width: 0; }
.pay-chip__sum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-chip__st { grid-column: 1 / -1; font-size: 11px; opacity: .85; }
.pay-chip--planned { border-left-color: #8c96ad; }
.pay-chip--requested { border-left-color: var(--primary); background: var(--primary-soft); }
.pay-chip--paid { border-left-color: var(--success); background: var(--success-soft); }
.pay-chip--overdue { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.pay-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.pay-st, .pay-ob { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pay-st--requested, .pay-ob--change { background: var(--primary-soft); color: var(--primary-text); }
.pay-st--paid, .pay-ob--active { background: var(--success-soft); color: var(--success); }
.pay-st--overdue, .pay-ob--rejected { background: var(--danger-soft); color: var(--danger); }
.pay-st--cancelled, .pay-ob--off { background: var(--surface-3); color: var(--text-4); text-decoration: line-through; }
.pay-ob--off { text-decoration: none; }
.pay-ob--pending, .pay-ob--returned { background: var(--warning-soft); color: var(--warning); }

.pay-table td { vertical-align: top; }
.pay-table .pay-actions { white-space: nowrap; text-align: right; }
.pay-actions .btn + .btn { margin-left: 6px; }
.pay-small { font-size: 12px; }
.pay-strong { font-weight: 600; color: var(--text); }
.pay-link { color: var(--primary-text); font-weight: 600; text-decoration: none; }
.pay-link:hover { text-decoration: underline; }
.pay-name { min-width: 220px; }
.pay-flag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--danger-soft); color: var(--danger); }
.pay-flag--muted { background: var(--surface-3); color: var(--text-3); }
.pay-warn-text { color: var(--warning); margin-top: 4px; }
.pay-tr--cancelled td { color: var(--text-4); }
.pay-tr--overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.pay-row--muted td { color: var(--text-4); }

.pay-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 18px; }
.pay-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.pay-card__head h2 { margin: 0; font-size: 16px; }
.pay-card__body { padding: 18px 20px; }
.pay-cardhead { display: flex; gap: 8px; margin-bottom: 14px; }
.pay-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; background: var(--surface-3); color: var(--text-2); font-size: 14px; }
.pay-banner--warn { background: var(--warning-soft); color: #7a5713; }
.pay-banner--bad { background: var(--danger-soft); color: var(--danger); }
.pay-dl { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.pay-dl dt { color: var(--text-3); }
.pay-dl dd { margin: 0; color: var(--text); }
.pay-desc { margin: 14px 0 0; white-space: pre-wrap; color: var(--text-2); font-size: 14px; }
.pay-subtitle { margin: 16px 0 8px; font-size: 13px; }
.pay-pending { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); background: var(--warning-soft); }
.pay-pending .pay-strong { margin-bottom: 8px; }

.pay-bars { display: flex; flex-direction: column; gap: 8px; }
.pay-bar { display: grid; grid-template-columns: minmax(140px, 260px) 1fr 110px; align-items: center; gap: 12px; font-size: 14px; }
.pay-bar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-bar__track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.pay-bar__fill { height: 100%; background: var(--primary); border-radius: 4px; }
.pay-bar__value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

.pay-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin-bottom: 14px; }
.pay-form__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pay-form__wide { grid-column: 1 / -1; }
.pay-field { display: flex; flex-direction: column; gap: 5px; }
.pay-field[hidden] { display: none; }
.pay-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.pay-input { width: 100%; box-sizing: border-box; min-height: 38px; padding: 8px 11px; border: 1px solid var(--input); border-radius: var(--radius); background: var(--surface); font: inherit; font-size: 14px; color: var(--text); }
textarea.pay-input { resize: vertical; }
.pay-input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(102, 121, 229, .15); }
.pay-input:disabled { background: var(--surface-3); color: var(--text-3); }
.pay-field.has-error .pay-input, .pay-field.has-error .pay-alloc { border-color: var(--danger); }
.pay-field__err { font-size: 12px; color: var(--danger); }
.pay-field__err:empty { display: none; }
.pay-hint { margin: 4px 0 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary-text); font-size: 14px; font-weight: 500; }
.pay-hint:empty { display: none; }
.pay-hint--warn { background: var(--warning-soft); color: #7a5713; }
.pay-terms { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.pay-terms h3 { margin: 0 0 12px; font-size: 14px; }
.pay-decision { margin: 0 0 18px; padding: 16px; border: 1px solid #f1ddb0; border-radius: var(--radius-lg); background: #fffbf1; }
.pay-card .pay-decision { margin: 18px 0 0; }

.pay-alloc { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.pay-alloc .metric-switch { align-self: flex-start; margin-bottom: 4px; }
.pay-alloc__row { display: grid; grid-template-columns: 1fr 120px 18px auto; gap: 8px; align-items: center; }
.pay-alloc__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pay-alloc__sum { font-size: 13px; font-weight: 600; }
.pay-alloc__sum.is-ok { color: var(--success); }
.pay-alloc__sum.is-bad { color: var(--warning); }

.pay-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.pay-history li { padding-left: 14px; border-left: 2px solid var(--line); }
.pay-history__meta { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }

@media (max-width: 760px) {
  .pay-grid { grid-template-columns: 1fr; }
  .pay-grid__dow, .pay-grid__cell--empty { display: none; }
  .pay-grid__cell { min-height: 0; }
  .pay-grid__cell:not(:has(.pay-chip)):not(.is-today) { display: none; }
  .pay-form__grid, .pay-form__grid--3 { grid-template-columns: 1fr; }
  .pay-dl { grid-template-columns: 1fr; gap: 2px; }
  .pay-dl dd { margin-bottom: 8px; }
  .pay-bar { grid-template-columns: 1fr 90px; }
  .pay-bar__track { grid-column: 1 / -1; grid-row: 2; }
  .pay-alloc__row { grid-template-columns: 1fr 90px 18px; }
  .pay-alloc__row .btn { grid-column: 1 / -1; justify-self: start; }
}

.ap-table td.ap-co { white-space: nowrap; font-weight: 500; }
.ap-cell { white-space: nowrap; line-height: 1.35; }
.ap-plan { color: var(--text); }
.ap-fact { color: var(--text-3); font-size: 12px; }
.ap-cell--bad { background: var(--warning-soft); }
.ap-cell--bad .ap-fact { color: var(--warning); font-weight: 600; }
.ap-cell--total { background: var(--surface-2); font-weight: 600; }
th.ap-current { color: var(--primary-text); }
.pay-table td.pay-terms-cell { min-width: 150px; }
.pay-alloc .metric-switch, .pay-field .metric-switch { margin-left: 0; }

/* системный выбор дат (static/pickers.js) */
.range-picker__icon { display: inline-flex; color: var(--text-3); filter: none; opacity: 1; }
.range-picker__field .muted { color: var(--text-4); }
.range-picker--compact { display: inline-block; }
.range-picker--compact .range-picker__field { width: auto; min-width: 170px; min-height: 38px; font-size: 14px; }
.range-picker__day:disabled, .range-picker__month:disabled { color: var(--text-4); background: transparent; cursor: default; opacity: .45; }
.range-picker__months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.range-picker__month { height: 40px; border: none; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.range-picker__month:hover:not(:disabled) { background: var(--primary-soft); }
.range-picker__month.is-today { box-shadow: inset 0 0 0 1px var(--ring); }
.range-picker__month.in-range { background: var(--primary-soft); color: var(--primary-text); border-radius: 0; }
.range-picker__month.is-start, .range-picker__month.is-end { background: var(--primary); color: #fff; font-weight: 600; }
.range-picker__links { display: inline-flex; gap: 4px; }
.pay-field .range-picker__field { min-height: 38px; font-size: 14px; }
.pay-field.has-error .range-picker__field { border-color: var(--danger); }
a.btn, a.btn:hover { text-decoration: none; }
.btn .v2-icon, .btn svg { flex: none; }
.an-toolbar__label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-3); }

/* платёжный календарь: исполнитель, описание категории */
.pay-exec { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pay-input--inline { width: auto; min-width: 190px; min-height: 32px; padding: 4px 10px; }
.pay-cathint { padding: 8px 12px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.pay-readonly { min-height: 38px; display: flex; align-items: center; padding: 8px 11px; border: 1px dashed var(--input); border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.pc-desc { width: 100%; min-width: 200px; resize: vertical; font-size: 13px; }
.pc-desc-cell { min-width: 220px; }

/* API-ключи: список инструкций для агентов */
.apidocs { margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); }
.apidocs__title { margin: 0 0 10px; font-size: 14px; }
.apidocs__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.apidocs__row:first-child { border-top: none; padding-top: 0; }
.apidocs__desc { font-size: 13px; margin: 2px 0 4px; }
.apidocs__actions { display: flex; gap: 8px; flex-shrink: 0; }
.apidocs__row code { font-size: 12px; }
