/* ============================================================
   GPS — базовые стили веб-системы учёта
   Источник цветов: brandbook/logo/GPS_номера корп_цветов.jpg
   Шрифты: brandbook/fonts (Arsenal — заголовки, Wix Madefor Display — интерфейс)
   ============================================================ */

@font-face {
  font-family: "Arsenal";
  src: url("../fonts/Arsenal-Regular.f51e45031457.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Arsenal";
  src: url("../fonts/Arsenal-Bold.55b0cc8db73f.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Wix Madefor Display";
  src: url("../fonts/WixMadeforDisplay-VariableFont_wght.cab86c06fcb5.ttf") format("truetype-variations");
  font-weight: 400 800; font-style: normal; font-display: swap;
}

/* ---------- Токены ---------- */
:root {
  /* фирменные */
  --brand-50:  #F0F6F3;
  --brand-100: #E3F0EA;
  --brand-200: #BFDCCE;
  --brand-500: #357F63;   /* зелёный логотипа — кнопки, ссылки, активное */
  --brand-600: #2C6B53;
  --brand-700: #1F4938;   /* фон — верх боковой панели */
  --brand-900: #122C22;   /* фон — низ боковой панели */
  --accent:     #F0B411;  /* жёлтый — «требует внимания», маркер активного пункта */
  --accent-100: #FCF1CF;
  --accent-ink: #6E5100;

  /* текст (с зелёным подтоном, не чистый серый) */
  --ink:   #14211B;
  --ink-2: #54665D;
  --ink-3: #8A9A91;
  --ink-on-dark: #FFFFFF;
  --ink-on-dark-2: rgba(255,255,255,.62);

  /* поверхности */
  --bg:      #F4F7F5;   /* фон страницы */
  --surface: #FFFFFF;   /* карточки, таблицы */
  --panel:   #EDF2EF;   /* мягкие панели, как серые карточки в презентации */
  --line:    #DCE4DF;
  --line-2:  #EAF0EC;

  /* статусы (отдельно от акцента) */
  --ok: #357F63;      --ok-100: #E3F0EA;
  --warn: #F0B411;    --warn-100: #FCF1CF;  --warn-ink: #6E5100;
  --bad: #C4433A;     --bad-100: #F9E4E2;
  --info: #3E6E9A;    --info-100: #E4EEF6;
  --neutral: #8A9A91; --neutral-100: #EEF1EF;

  /* размеры */
  --sidebar-w: 236px;
  --topbar-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(18,44,34,.06);
  --shadow: 0 6px 18px -8px rgba(18,44,34,.18);

  --font-ui: "Wix Madefor Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Arsenal", "Trebuchet MS", system-ui, sans-serif;

  color-scheme: light;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 30px; letter-spacing: -.01em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* ---------- Каркас ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100%; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color: var(--ink-on-dark);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
}
.brand { display: block; padding: 4px 10px 18px; }
.brand img { width: 150px; height: auto; display: block; }
.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.nav-label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-on-dark-2); padding: 0 10px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-on-dark); font-weight: 500; font-size: 14px;
  position: relative; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav-item svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.nav-item.active { background: rgba(255,255,255,.12); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--ink-on-dark-2); font-variant-numeric: tabular-nums; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--brand-900);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.sidebar-foot .who { line-height: 1.25; font-size: 13px; }
.sidebar-foot .who small { display: block; color: var(--ink-on-dark-2); font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  position: sticky; top: 0; z-index: 5;
}
.topbar .search { flex: 1; max-width: 420px; }
.topbar .spacer { flex: 1; }
.sync-badge { font-size: 12px; color: var(--ink-2); white-space: nowrap; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--ok-100); text-decoration: none; }
.sync-badge.bad { background: var(--bad-100); color: var(--bad); font-weight: 600; }
a.sync-badge:hover { text-decoration: underline; }
pre.log { white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 480px; overflow: auto; background: var(--panel); padding: 10px 12px; border-radius: 6px; margin: 0; }
.page { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .meta { font-size: 13px; color: var(--ink-3); }

/* ---------- Пилюля-ярлык (как в презентации) ---------- */
.eyebrow {
  display: inline-block; background: var(--brand-700); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 10px; border-radius: var(--radius-pill); margin-bottom: 8px;
}
/* Ссылка в пилюле — кнопка «назад» в реестр: белая, со стрелкой, у левого края */
.eyebrow a {
  display: inline-flex; align-items: center; gap: 4px;
  margin: -3px 6px -3px -10px; padding: 3px 10px 3px 8px;
  background: var(--surface); color: var(--brand-700); border-radius: var(--radius-pill);
  border: 1px solid var(--brand-700); text-decoration: none; letter-spacing: .02em;
}
.eyebrow a::before { content: "←"; font-size: 13px; line-height: 1; }
.eyebrow a:hover { background: var(--brand-50); text-decoration: none; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  color: var(--ink); background: var(--surface); border-color: var(--line);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--brand-50); border-color: var(--brand-200); text-decoration: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.btn-primary { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-500); }
.btn-ghost:hover { background: var(--brand-50); border-color: transparent; }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--line); }
.btn-danger:hover { background: var(--bad-100); border-color: var(--bad); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, .select, textarea.input {
  height: 36px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; width: 100%;
}
textarea.input { height: auto; padding: 8px 12px; resize: vertical; }
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.input.num { text-align: right; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--ink-3); fill: none; stroke-width: 2; stroke-linecap: round; }
.input-wrap .input { padding-left: 34px; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2354665D' stroke-width='2.5' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-500); margin: 0; }

/* сегментированный переключатель (год) */
.seg { display: inline-flex; background: var(--panel); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 13px;
  padding: 5px 12px; border-radius: 6px; color: var(--ink-2); cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* фильтры-чипы */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--brand-200); color: var(--ink); }
.chip.on { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.chip .n { font-variant-numeric: tabular-nums; opacity: .75; }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h2 { font-size: 17px; }
.card-body { padding: 18px; }
.panel { background: var(--panel); border-radius: var(--radius); }

/* ---------- Плитки показателей ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.kpi .value { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .value small { font-size: 16px; color: var(--ink-3); font-weight: 400; margin-left: 2px; }
.kpi .sub { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* дельта / маленький бейдж */
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up   { background: var(--ok-100); color: var(--ok); }
.delta.warn { background: var(--warn-100); color: var(--warn-ink); }
.delta.down { background: var(--bad-100); color: var(--bad); }

/* ---------- Статусы ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; color: var(--ink); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); flex: none; }
.status.ok::before      { background: var(--ok); }
.status.info::before    { background: var(--info); }
.status.warn::before    { background: var(--warn); }
.status.bad::before     { background: var(--bad); }
.status.done::before    { background: var(--brand-700); }
.status.neutral         { color: var(--ink-2); }

/* залитый вариант — для важных состояний */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.ok   { background: var(--ok-100);   color: var(--ok); }
.tag.warn { background: var(--warn-100); color: var(--warn-ink); }
.tag.bad  { background: var(--bad-100);  color: var(--bad); }
.tag.info { background: var(--info-100); color: var(--info); }
.tag.neutral { background: var(--neutral-100); color: var(--ink-2); }

/* ---------- Таблица ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface);
  white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--brand-50); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.date { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
.table .id { font-weight: 600; color: var(--brand-500); white-space: nowrap; }
.table td.person { white-space: nowrap; }
.table tr.group-row td { background: var(--brand-50); border-top: 1px solid var(--line); }
.table tfoot tr.total-row td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 600; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: 12.5px; white-space: nowrap; }
.table-compact th.group { text-align: center; border-left: 1px solid var(--line-2); }
.table-compact th.sub { font-weight: 500; color: var(--ink-3); text-transform: none; letter-spacing: 0; }
.table-compact .input { width: 110px; padding: 4px 6px; font-size: 12.5px; }
.table tr.total td { font-weight: 600; border-top: 2px solid var(--line); background: var(--brand-50); }
.table .primary { font-weight: 500; }
.table .secondary { color: var(--ink-3); font-size: 12px; }
.table .empty { color: var(--ink-3); }

/* ---------- Список «Требует внимания» ---------- */
.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attn li { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid rgba(20,33,27,.08); }
.attn li:last-child { border-bottom: 0; padding-bottom: 0; }
.attn li:first-child { padding-top: 0; }
.attn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 5px; box-shadow: 0 0 0 3px rgba(240,180,17,.22); }
.attn .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(196,67,58,.18); }
.attn .dot.info { background: var(--info); box-shadow: 0 0 0 3px rgba(62,110,154,.18); }
.attn .t { font-weight: 600; }
.attn .d { font-size: 12.5px; color: var(--ink-2); }
.attn .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.attn .amt small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }

/* ---------- График ---------- */
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--brand-500); vertical-align: -2px; margin-right: 6px; }
.legend i.plan { background: repeating-linear-gradient(135deg, var(--brand-500) 0 2px, transparent 2px 5px); border: 1px solid var(--brand-500); }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--line-2); }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font-ui); }
.chart .bar { fill: var(--brand-500); }
.chart .bar.plan { fill: url(#hatch); stroke: var(--brand-500); stroke-width: 1; }
.chart .bar:hover, .chart .bar.plan:hover { fill: var(--brand-600); }
.chart .lbl { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--font-ui); }
.tip {
  position: fixed; pointer-events: none; z-index: 20;
  background: var(--brand-900); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px;
  box-shadow: var(--shadow); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
.tip b { font-variant-numeric: tabular-nums; }

/* ---------- Сообщения ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid transparent; }
.alert.ok   { background: var(--ok-100);   border-color: var(--brand-200); color: var(--brand-700); }
.alert.warn { background: var(--warn-100); border-color: #EBD48A; color: var(--warn-ink); }
.alert.bad  { background: var(--bad-100);  border-color: #EBB5B0; color: #7D2A24; }

/* ---------- Сетки ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.demo-note { font-size: 12px; color: var(--ink-3); text-align: center; padding-top: 8px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .page, .topbar { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Дополнения приложения (сессия 1) ---------- */
.nav-item.soon { opacity: .45; cursor: default; }
.nav-item.soon:hover { background: transparent; }
.messages { display: flex; flex-direction: column; gap: 8px; }

/* пустое состояние */
.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty-state img { width: 72px; opacity: .35; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 4px; }
.kpi .value.pending { color: var(--ink-3); font-weight: 400; }
.kpi .breakdown { gap: 4px 12px; font-size: 12.5px; }
.kpi .breakdown b { font-weight: 600; color: var(--ink); }

/* вход */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, var(--brand-700) 0%, var(--brand-900) 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px;
  padding: 32px 32px 28px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 18px;
}
.login-card .logo { width: 190px; height: auto; margin: 0 auto 4px; display: block; }
.login-card h1 { font-size: 22px; text-align: center; }
.login-card .hint { font-size: 13px; color: var(--ink-2); text-align: center; margin: -8px 0 0; }
.login-card .btn { height: 40px; justify-content: center; }
.login-foot { color: var(--ink-on-dark-2); font-size: 12px; text-align: center; margin-top: 16px; }

/* ---------- Экран «Проекты» (сессия 6) ---------- */
h1 .code { color: var(--brand-500); margin-right: 6px; }
.head-status { margin-top: 8px; gap: 12px; align-items: center; }

/* панель фильтров */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 14px; }
.filters .input-wrap { flex: 1 1 240px; }
.filters .select { width: auto; min-width: 150px; max-width: 240px; }
.filters .check { white-space: nowrap; }
.filters #grid-count { margin-left: auto; font-size: 13px; }

/* вкладки карточки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; }
.tab {
  border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2);
  padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand-500); border-bottom-color: var(--brand-500); }
.tab.soon { color: var(--ink-3); cursor: default; font-weight: 500; }
.tab-pane[hidden] { display: none; }
.htmx-request.tab-pane { opacity: .5; }

/* свойства объекта: подпись — значение */
.props { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.props dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.props dd { margin: 0; }
.props dd.num { font-variant-numeric: tabular-nums; }
.props dd.pre { white-space: pre-wrap; }

/* формы */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .contents { display: contents; }
.form-grid .checks { justify-content: center; gap: 10px; }
.field .help { font-size: 12px; color: var(--ink-3); }
.field .error { font-size: 12.5px; color: var(--bad); }
.field .req { color: var(--bad); }
.field.has-error .input, .field.has-error .select { border-color: var(--bad); }
textarea.input { height: auto; padding: 8px 12px; min-height: 72px; resize: vertical; }
.form-actions { margin-top: 4px; gap: 10px; }

/* Tabulator — один в один как .table (шапка, строки, линии), свои значки сортировки */
.grid-card { overflow: hidden; }
.tabulator { background: var(--surface); border: 0; border-radius: 0; font-family: var(--font-ui); font-size: 13.5px; color: var(--ink); }
.tabulator .tabulator-tableholder { background: var(--surface); }
.tabulator .tabulator-header {
  background: var(--surface); border-top: 0; border-bottom: 1px solid var(--line); box-shadow: none; font-weight: 600;
}
.tabulator .tabulator-header .tabulator-col {
  background: var(--surface); border-right: 0; border-bottom: 0; height: 40px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 0 12px; height: 40px; display: flex; align-items: center; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title { padding: 0; white-space: nowrap; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title { padding-right: 0; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--brand-50); color: var(--ink); }
/* стандартную стрелку прячем, рисуем свой значок: серый ⇅ всегда, зелёный ↑/↓ у активной */
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter { position: static; display: block; width: 14px; height: 14px; flex: 0 0 14px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { display: none; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-sorter::after {
  content: ""; display: block; width: 14px; height: 14px; opacity: .45;
  background: currentColor; -webkit-mask: var(--sort-icon) center / contain no-repeat; mask: var(--sort-icon) center / contain no-repeat;
  --sort-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 2v12M2 11l3 3 3-3M11 14V2M8 5l3-3 3 3' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-sorter::after,
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-sorter::after {
  opacity: 1; background: var(--brand-500);
  --sort-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 14V2M4 6l4-4 4 4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-sorter::after { transform: rotate(180deg); }
/* ручка изменения ширины — невидима, но работает */
.tabulator .tabulator-header .tabulator-col .tabulator-col-resize-handle { width: 6px; }
.tabulator .tabulator-header .tabulator-col.tabulator-moving { background: var(--brand-50); border: 0; }
/* строки */
.tabulator-row { background: var(--surface); border-bottom: 1px solid var(--line-2); min-height: 40px; cursor: pointer; }
.tabulator-row.tabulator-row-even { background: var(--surface); }
.tabulator-row:hover, .tabulator-row.tabulator-row-even:hover { background: var(--brand-50); }
.tabulator-row .tabulator-cell { padding: 10px 12px; border-right: 0; font-variant-numeric: tabular-nums; }
.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left, .tabulator .tabulator-header .tabulator-col.tabulator-frozen.tabulator-frozen-left,
.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-right, .tabulator .tabulator-header .tabulator-col.tabulator-frozen.tabulator-frozen-right {
  background: var(--surface); border-left: 0; border-right: 1px solid var(--line-2); box-shadow: none;
}
.tabulator-row:hover .tabulator-cell.tabulator-frozen { background: var(--brand-50); }
.tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents { color: var(--ink-3); font-size: 14px; background: transparent; }
.tabulator .tabulator-footer { background: var(--surface); border-top: 1px solid var(--line); }
.tabulator .id { font-weight: 600; color: var(--brand-500); }
/* загрузка: лёгкая белая пелена и кружок вместо рамки «Loading» */
@keyframes gps-spin { to { transform: rotate(360deg); } }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--brand-500); animation: gps-spin .8s linear infinite;
}
.tabulator .tabulator-alert { background: rgba(255,255,255,.65); display: flex; align-items: center; justify-content: center; }
.tabulator .tabulator-alert .tabulator-alert-msg {
  width: 28px; height: 28px; padding: 0; margin: 0 auto; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--brand-500); background: transparent; color: transparent; font-size: 0;
  animation: gps-spin .8s linear infinite;
}
.tabulator .tabulator-alert .tabulator-alert-msg.tabulator-alert-state-msg,
.tabulator .tabulator-alert .tabulator-alert-msg.tabulator-alert-state-error { border-color: var(--line); border-top-color: var(--brand-500); }

/* ---------- Экраны «Компании», «Люди», «Юрлица» (сессия 7) ---------- */

/* простые списки в карточках и дерево холдинга */
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
ul.tree, ul.tree ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
ul.tree ul { margin: 4px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line-2); }
ul.tree li { padding: 3px 0; }
ul.tree a { color: var(--brand-500); text-decoration: none; }
ul.tree a:hover { text-decoration: underline; }

/* inline-формсет таблицей: поля впритык к ячейкам */
.table.formset td { padding: 6px 8px; vertical-align: top; }
.table.formset .input, .table.formset .select { min-width: 120px; }
.table.formset td .error { font-size: 12px; color: var(--bad); margin-top: 4px; }
.table.formset tr.has-error td { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.table.formset + .btn { margin-top: 10px; }

/* ---- матрица «Ждём оплаты» (сессия 9) ---- */
.table.matrix th.current, .table.matrix td.current { background: var(--brand-50); }
.table.matrix th.past { color: var(--ink-3); }
.table.matrix td.num a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--line); }
.table.matrix td.num a:hover { color: var(--brand-500); border-bottom-color: var(--brand-500); }
.table.matrix td.num a.overdue { color: var(--bad); font-weight: 600; }
.table.matrix td.num a.partial { color: var(--warn-ink); }
.table.matrix tfoot th { text-align: right; border-top: 2px solid var(--line); }
.table.matrix tfoot th:first-child { text-align: left; }

/* ---------- Как начать (/help/) ---------- */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.help-grid .card-body p { margin: 0 0 10px; line-height: 1.5; }
.help-grid .card-body ol { margin: 0 0 10px; padding-left: 20px; line-height: 1.55; }
.help-grid .card-body ol li { margin-bottom: 6px; }
.help-grid .table td { vertical-align: top; padding: 8px 10px; }
.help-grid .table td:first-child { white-space: nowrap; font-weight: 600; }
@media (max-width: 1100px) { .help-grid { grid-template-columns: 1fr; } }

/* ---------- «Дела» на Обзоре ---------- */
.todo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; padding: 4px 18px 16px; }
.todo-group { padding: 12px 0; border-bottom: 1px solid rgba(20,33,27,.08); }
.todo-group h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; color: var(--ink-2); }
.todo-group h3 .n, .card-head h2 .n {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: var(--radius-pill);
  background: var(--brand-50); color: var(--brand-700); font-size: 12px; font-weight: 600; text-align: center; line-height: 20px;
}
.todo .attn li > div { min-width: 0; }
.todo .attn .amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.todo .attn li.more .d { padding-top: 2px; }
.select-sm { height: 30px; padding: 0 28px 0 10px; font-size: 13px; }
@media (max-width: 900px) { .todo-grid { grid-template-columns: 1fr; } }
