/* ===== Токены ===== */
:root {
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.79rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.92rem + 0.1vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.875rem);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;

  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Светлая тема: холодный графит + янтарный акцент */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #eef0f3;
  --border: #e2e5ea;
  --border-strong: #cfd4db;
  --text: #15191f;
  --text-2: #4a525e;
  --text-3: #7a828e;
  --accent: #c2630a;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e3;
  --own: #1f5f8b;       /* наши авто */
  --priv: #d08a2c;      /* частники */
  --good: #23824f;
  --good-soft: #e3f3ea;
  --warn: #a86a00;
  --warn-soft: #fbf1db;
  --bad: #b8322a;
  --bad-soft: #f9e3e1;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sidebar: #12161c;
  --sidebar-text: #c9ced6;
  --sidebar-active: #1f252e;
}
[data-theme='dark'] {
  --bg: #0d1015;
  --surface: #151a21;
  --surface-2: #1a2029;
  --surface-3: #212833;
  --border: #262e3a;
  --border-strong: #354050;
  --text: #e8ebf0;
  --text-2: #b0b8c4;
  --text-3: #7f8896;
  --accent: #f0913a;
  --accent-ink: #1a1007;
  --accent-soft: #2d2014;
  --own: #5ea8dc;
  --priv: #e8a74e;
  --good: #4cc282;
  --good-soft: #15291f;
  --warn: #e3b14a;
  --warn-soft: #2b2414;
  --bad: #ef6b62;
  --bad-soft: #2f1817;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --sidebar: #0a0d11;
  --sidebar-text: #aeb6c2;
  --sidebar-active: #18202a;
}

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
svg { flex-shrink: 0; }
.muted { color: var(--text-3); font-size: var(--text-sm); }
.num, td.n, th.n { font-variant-numeric: tabular-nums lining-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ===== Каркас ===== */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: var(--s5) var(--s3);
  position: sticky; top: 0; height: 100dvh;
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s6); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: var(--text-base); }
.brand-text span { font-size: var(--text-xs); color: #8a93a0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: var(--s3);
  padding: 10px var(--s3); border-radius: var(--r-md);
  color: var(--sidebar-text); text-decoration: none; font-size: var(--text-sm); font-weight: 600;
  transition: background .15s, color .15s;
}
.nav a svg, .ghost-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--sidebar-active); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { margin-top: auto; }
.ghost-btn { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 10px var(--s3); background: none; border: 0; border-radius: var(--r-md); color: var(--sidebar-text); cursor: pointer; font-size: var(--text-sm); font-weight: 600; }
.ghost-btn:hover { background: var(--sidebar-active); color: #fff; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s4) var(--s8); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: var(--text-xl); }
.topbar-controls { display: flex; gap: var(--s3); flex-wrap: wrap; }
.field-inline { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
select, input[type='text'], input[type='number'], input[type='password'] {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 7px 10px; font-size: var(--text-sm); min-height: 36px;
}
.field-inline select { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text); min-width: 140px; }
.main { padding: var(--s6) var(--s8) var(--s10); display: flex; flex-direction: column; gap: var(--s5); max-width: 1480px; width: 100%; }

/* ===== Карточки ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5) 0; flex-wrap: wrap; }
.card-head h2 { font-size: var(--text-base); }
.card-head .muted { font-size: var(--text-xs); }
.card-body { padding: var(--s4) var(--s5) var(--s5); }
.grid { display: grid; gap: var(--s5); }
.g-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1640px) { .g-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); } .g-kpi > .kpi { grid-column: span 2; } .g-kpi > .kpi:nth-child(n+4) { grid-column: span 3; } }
@media (max-width: 1180px) { .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-kpi > .kpi, .g-kpi > .kpi:nth-child(n+4) { grid-column: auto; } .g-kpi .kpi-shifts { grid-column: span 2; } }
@media (max-width: 520px) { .g-kpi { grid-template-columns: 1fr; } .g-kpi > .kpi, .g-kpi .kpi-shifts { grid-column: auto; } }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-half { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* KPI */
.kpi { padding: var(--s4) var(--s5) var(--s5); display: flex; flex-direction: column; gap: var(--s2); }
.kpi-label { font-size: var(--text-xs); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; gap: var(--s2); }
.kpi-value { font-size: var(--text-xl); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-sub { font-size: var(--text-sm); color: var(--text-2); display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.kpi-sub b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: var(--s1); }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s ease; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: var(--text-xs); font-weight: 700; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--surface-3); color: var(--text-2); }

.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }

/* Таблицы */
.table-wrap { overflow-x: auto; overscroll-behavior: contain; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-size: var(--text-xs); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.n, th.n { text-align: right; }
tr.total td { font-weight: 800; border-top: 2px solid var(--border-strong); border-bottom: 0; background: var(--surface-2); }
tr.sub td:first-child { padding-left: 24px; color: var(--text-2); }
tr.strong td { font-weight: 700; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.own { background: var(--own); }
.dot.priv { background: var(--priv); }
.daily-table th { position: sticky; top: 0; z-index: 2; }
.daily-table thead tr.groups th { text-align: center; color: var(--text-2); border-bottom: 0; padding-bottom: 0; }
.daily-table .wd-weekend { color: var(--accent); font-weight: 700; }
.inline-input { width: 100px; text-align: right; padding: 4px 8px; min-height: 30px; font-variant-numeric: tabular-nums; }

/* Метрики */
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.metric { padding: var(--s3) 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--text-sm); }
.metric:nth-child(odd) { padding-right: var(--s4); }
.metric:nth-child(even) { padding-left: var(--s4); border-left: 1px solid var(--border); }
.metric span { color: var(--text-2); }
.metric b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Наш vs частник */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.split-col { border-radius: var(--r-md); padding: var(--s4); background: var(--surface-2); border: 1px solid var(--border); }
.split-col h3 { font-size: var(--text-sm); margin-bottom: var(--s3); display: flex; align-items: center; }
.split-col dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px var(--s3); font-size: var(--text-sm); }
.split-col dt { color: var(--text-2); }
.split-col dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.share-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin: var(--s2) 0 var(--s4); background: var(--surface-3); }
.share-bar i { display: block; height: 100%; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: 8px 14px; min-height: 36px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--text-sm); font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 4px; font-size: var(--text-xs); font-weight: 700; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Telegram */
.tg { white-space: pre-wrap; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: var(--text-xs); line-height: 1.6; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); max-height: 360px; overflow: auto; overscroll-behavior: contain; margin: 0; }

/* Загрузка */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg); padding: var(--s10) var(--s6);
  display: flex; flex-direction: column; align-items: center; gap: var(--s3); text-align: center;
  background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: var(--text-lg); }
.dropzone input { display: none; }
.result { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.result div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.result span { display: block; font-size: var(--text-xs); color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.result b { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); font-size: var(--text-sm); }
.alert.warn { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.bad { background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.good { background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); }
.alert svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; margin-top: 2px; }
.alert a { color: inherit; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-xs); font-weight: 700; color: var(--text-2); }
.field input, .field select { font-weight: 500; color: var(--text); }
.field small { font-weight: 500; color: var(--text-3); }
.form-actions { display: flex; gap: var(--s3); justify-content: flex-end; margin-top: var(--s4); flex-wrap: wrap; }
.drv-input { width: 84px; text-align: right; padding: 4px 8px; min-height: 32px; }
.drv-select { padding: 4px 8px; min-height: 32px; }
.drv-ip { width: 260px; padding: 4px 8px; min-height: 32px; }
tr.need td { background: var(--warn-soft); }

/* Пустое состояние / скелетон */
.empty { padding: var(--s10) var(--s6); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.empty svg { width: 44px; height: 44px; fill: none; stroke: var(--text-3); stroke-width: 1.5; }
.empty h2 { font-size: var(--text-lg); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-lg); }
@keyframes sk { to { background-position: -200% 0; } }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 13, 18, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--surface); z-index: 50; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); padding: var(--s5); border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: var(--text-lg); }
.drawer-body { overflow: auto; overscroll-behavior: contain; padding: var(--s4) var(--s5) var(--s8); display: flex; flex-direction: column; gap: var(--s4); }
.route-group { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.route-head { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s3); background: var(--surface-2); font-size: var(--text-sm); flex-wrap: wrap; }
.route-head b { font-variant-numeric: tabular-nums; }
.status { font-size: var(--text-xs); font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.status.ok { background: var(--good-soft); color: var(--good); }
.status.part { background: var(--warn-soft); color: var(--warn); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.none { background: var(--surface-3); color: var(--text-3); }

/* Логин / тост */
.login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 60; padding: var(--s4); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s8); width: min(380px, 100%); display: flex; flex-direction: column; gap: var(--s4); box-shadow: var(--shadow); }
.error { color: var(--bad); font-size: var(--text-sm); }
.toast { position: fixed; bottom: var(--s6); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: var(--r-md); font-size: var(--text-sm); font-weight: 600; z-index: 70; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

.row-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.legend { display: flex; gap: var(--s4); font-size: var(--text-xs); color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ===== Адаптив ===== */
@media (max-width: 1180px) {
  .g-main, .g-half { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: var(--s2) var(--s3); z-index: 30; gap: var(--s2); }
  .brand { padding: 0; }
  .brand-text { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: center; }
  .nav a { padding: 8px 10px; }
  .nav a span { display: none; }
  .nav a.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .sidebar-foot { margin: 0; }
  .ghost-btn span { display: none; }
  .ghost-btn { width: auto; }
  .topbar { position: static; padding: var(--s4); }
  .main { padding: var(--s4) var(--s4) var(--s8); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .result { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
  .metric:nth-child(even) { padding-left: 0; border-left: 0; }
  .metric:nth-child(odd) { padding-right: 0; }
  .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field-inline select { min-width: 0; }
  .topbar-controls { width: 100%; }
  .field-inline { flex: 1; }
  .field-inline select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.drawer-body > * { flex-shrink: 0; }
.split-col dt { white-space: nowrap; }
.drawer { width: min(880px, 100vw); }
.seg { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 520px) { .chart-box { height: 260px; } .seg button { padding: 5px 9px; } }
a.btn { text-decoration: none; color: var(--text); }
a.btn.primary { color: var(--accent-ink); }
.split-col dd { white-space: nowrap; }
.split-col dl { grid-template-columns: minmax(0, 1fr) auto; }
.split-col { padding: var(--s3); }

.kpi-label > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpi-sub { flex-wrap: nowrap; }
.kpi-sub > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpi-sub b { white-space: nowrap; }
.kpi .bar { margin-top: auto; }

/* ===== Список объектов в боковой панели ===== */
.obj-block { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid #232a34; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.obj-title { font-size: var(--text-xs); font-weight: 700; color: #7f8896; text-transform: uppercase; letter-spacing: .05em; padding: 0 var(--s3) var(--s2); }
.obj-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overscroll-behavior: contain; max-height: 40vh; }
.obj-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 8px var(--s3); border: 0; border-radius: var(--r-md); background: none; color: var(--sidebar-text); cursor: pointer; font-size: var(--text-sm); font-weight: 600; }
.obj-item small { font-size: var(--text-xs); font-weight: 500; color: #7f8896; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-item:hover { background: var(--sidebar-active); color: #fff; }
.obj-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--own); }
.obj-item .obj-name { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.obj-item .obj-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.obj-add { font-size: var(--text-xs); color: #8a93a0; text-decoration: none; padding: 6px var(--s3); font-weight: 600; }
.obj-add:hover { color: #fff; }

/* ===== Общие данные ===== */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--text-sm); font-weight: 600; cursor: pointer; user-select: none; }
.chip input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.chip.off { opacity: .55; }
.chip small { color: var(--text-3); font-weight: 500; }
.obj-cell { display: flex; align-items: center; gap: 8px; }
.share-mini { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.share-mini i { display: block; height: 100%; }
tr.off td { opacity: .5; }

@media (max-width: 860px) {
  .obj-block { display: none; }
}
.upload-target { margin-top: var(--s4); max-width: 520px; }

/* Telegram: текст заполняет карточку целиком, без внутренней прокрутки */
.tg-card { display: flex; flex-direction: column; }
.tg-card > .card-body { flex: 1; display: flex; flex-direction: column; }
.tg-card .tg { flex: 1; max-height: none; overflow: visible; font-size: var(--text-sm); }

/* ===== График водителей ===== */
.sch-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); font-size: var(--text-sm); color: var(--text-2); }
.sch-legend > span { display: inline-flex; align-items: center; }
.sch-legend .muted { flex-basis: 100%; font-size: var(--text-xs); }
i.k { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 6px; margin-right: 8px; border-radius: var(--r-sm); font-style: normal; font-weight: 800; font-size: var(--text-sm); background: var(--surface-3); color: var(--text); }
.sch-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--text-xs); color: var(--text-3); font-weight: 600; }
.sch-tools > span { margin-right: var(--s2); }
.sch-tools input[type='number'] { width: 72px; }
.sch-tools .btn { min-height: 32px; padding: 6px 12px; }
.sch-tools .chip { padding: 5px 10px; }

table.sch { width: auto; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.sch th, .sch td { padding: 0; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sch thead th { background: var(--sidebar); color: #fff; text-transform: none; letter-spacing: 0; font-size: var(--text-xs); font-weight: 700; padding: 6px 4px; border-bottom: 0; line-height: 1.25; }
.sch thead th.we { background: var(--sidebar-active); }
.sch thead th.today { box-shadow: inset 0 -3px 0 var(--accent); }
.sch th.sch-day { min-width: 46px; }
.sch th.sch-day small { display: block; color: var(--sidebar-text); font-weight: 600; }
.sch .sch-no { position: sticky; left: 0; z-index: 2; width: 40px; min-width: 40px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sch .sch-name { position: sticky; left: 40px; z-index: 2; min-width: 236px; max-width: 236px; text-align: left; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sch .sch-name small { margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.sch .sch-name small.own { color: var(--own); }
.sch .sch-name small.priv { color: var(--priv); }
.sch .sch-fact { position: sticky; left: 276px; z-index: 2; min-width: 58px; font-weight: 800; font-variant-numeric: tabular-nums; border-right: 2px solid var(--border-strong); }
.sch tbody .sch-no, .sch tbody .sch-name, .sch tbody .sch-fact { background: var(--surface); }
.sch thead .sch-no, .sch thead .sch-name, .sch thead .sch-fact { z-index: 3; background: var(--sidebar); }
.sch thead .sch-name { padding: 6px 10px; }
.sch tbody tr:hover .sch-no, .sch tbody tr:hover .sch-name, .sch tbody tr:hover .sch-fact { background: var(--surface-2); }
.sch td.sch-c { height: 32px; cursor: pointer; font-weight: 700; color: var(--text-2); }
.sch td.we { background: var(--surface-3); }
.sch td.sch-c:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.sch td.sch-c:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.sch td.st-a { color: var(--text); }
.sch td.st-an { color: var(--own); }
.sch td.st-cds { color: var(--accent); }
.sch td.st-n, i.k.st-n { background: var(--bad-soft); color: var(--bad); }
.sch td.st-p, i.k.st-p { background: var(--warn-soft); color: var(--warn); }
.sch td.st-r, i.k.st-r { background: var(--good-soft); color: var(--good); }
i.k.st-an { color: var(--own); }
i.k.st-cds { color: var(--accent); }
.sch td.sch-empty { padding: var(--s5); color: var(--text-3); text-align: left; }
.sch tfoot th { position: sticky; left: 0; z-index: 2; text-align: right; padding: 0 12px; font-size: var(--text-sm); font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text-2); background: var(--surface-2); border-right: 2px solid var(--border-strong); }
.sch tfoot td { height: 30px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); }
.sch tfoot tr.sch-plan th, .sch tfoot tr.sch-plan td { background: var(--warn-soft); }
.sch tfoot tr.sch-plan th { color: var(--warn); }
.sch tfoot input { width: 42px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; text-align: center; font-weight: 800; -moz-appearance: textfield; }
.sch tfoot input::-webkit-outer-spin-button, .sch tfoot input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sch tfoot input:hover, .sch tfoot input:focus { border-color: var(--border-strong); background: var(--surface); }
.sch tfoot input::placeholder { color: var(--text-3); font-weight: 600; }
.sch tfoot tr.sch-def td.bad { background: var(--bad-soft); color: var(--bad); }
.sch tfoot tr.sch-def th, .sch tfoot tr.sch-def td { border-bottom: 0; }

.sch-menu { position: fixed; z-index: 60; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(16, 24, 40, .18); display: flex; flex-direction: column; gap: 2px; }
.sch-menu-head { padding: 4px 8px 6px; font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.sch-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.sch-menu button { display: flex; align-items: center; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.sch-menu button:hover, .sch-menu button:focus-visible { background: var(--surface-2); outline: none; }
.sch-menu button.cur { background: var(--accent-soft); }

/* ===== Сотрудники ===== */
.g-emp { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.g-emp .kpi-label > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-emp .kpi-sub .neg { color: var(--bad); font-weight: 700; }
.g-emp .kpi-sub .pos { color: var(--good); font-weight: 700; }
.g-emp .kpi-sub a { color: var(--accent); font-weight: 700; text-decoration: none; }
.emp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.emp-tools input[type='search'] { width: 240px; max-width: 100%; }
input[type='search'], input[type='date'], input[type='tel'], textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 7px 10px; font: inherit; font-size: var(--text-sm); min-height: 36px; color: var(--text);
}
textarea { resize: vertical; min-height: 72px; }
table.emp td { vertical-align: middle; }
.emp-row { cursor: pointer; }
.emp-row:hover td { background: var(--surface-2); }
.emp-row.fired td { color: var(--text-3); }
.emp-row.fired b { text-decoration: line-through; text-decoration-color: var(--text-3); }
.emp-phone { display: block; color: var(--text-3); font-size: var(--text-xs); }
.sched { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.emp-empty { padding: var(--s6) 0; max-width: 60ch; }
.emp-empty h3 { margin: 0 0 var(--s2); font-size: var(--text-lg); }
.drawer.narrow { width: min(560px, 100vw); }
.emp-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.emp-form .span2 { grid-column: 1 / -1; }
.emp-form .field textarea, .emp-form .field input, .emp-form .field select { width: 100%; font-weight: 500; color: var(--text); }
.emp-form .form-actions { margin-top: 0; }
.emp-form .grow { flex: 1; }
.emp-form .error { margin: 0; color: var(--bad); font-weight: 600; font-size: var(--text-sm); }
.emp-form .muted { margin: 0; font-size: var(--text-sm); }
.sched-pick { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.sched-pick .chip { padding: 6px 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sched-pick .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sched-pick input { flex: 1 1 180px; min-width: 0; }
@media (max-width: 520px) { .emp-form { grid-template-columns: 1fr; } }

/* ===== Календарь рабочих дней ===== */
.cal-head { align-items: flex-end; }
.cal-head h2 + .muted { margin: 4px 0 0; font-size: var(--text-sm); }
.cal-total { font-size: var(--text-sm); color: var(--text-2); }
.cal-total b { color: var(--text); font-variant-numeric: tabular-nums; }
.cal-total b.pos { color: var(--good); } .cal-total b.neg { color: var(--bad); }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.cal-day {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 14px 16px 12px; border-radius: var(--r-md); cursor: pointer; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--own) calc(var(--heat) + 8%), var(--border));
  background: color-mix(in srgb, var(--own) var(--heat), var(--surface));
  transition: transform .12s ease, box-shadow .12s ease;
}
.cal-day:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cal-day.sel { box-shadow: 0 0 0 2px var(--own); border-color: var(--own); }
.cal-day.idle { background: var(--surface-2); color: var(--text-3); }
.cal-wd { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.cal-day.we .cal-wd { color: var(--accent); }
.cal-date { font-size: var(--text-lg); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-bottom: 6px; }
.cal-trips { font-size: var(--text-xs); color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cal-rev { font-size: var(--text-sm); font-weight: 800; font-variant-numeric: tabular-nums; }
.cal-profit { font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .cal-day { transition: none; } .cal-day:hover { transform: none; } }

.cal-body { display: flex; flex-direction: column; gap: var(--s4); }
#calSlot:empty { display: none; }
.cal-detail { border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); padding: var(--s5); display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.cal-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.cal-detail-head h3 { margin: 0; font-size: var(--text-lg); }
.cal-detail-head .muted { margin: 4px 0 0; font-size: var(--text-sm); }
.cal-detail .row-actions { display: flex; gap: var(--s2); align-items: center; }
.day-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); }
.day-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.day-group h4, .cal-routes h4 { margin: 0; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.dm { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px var(--s3); font-size: var(--text-sm); }
.dm > span { color: var(--text-2); }
.dm > b { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.dm > small { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--text-3); }
.dm > small.pos { color: var(--good); } .dm > small.neg { color: var(--bad); }
.dm.big > b { font-size: var(--text-lg); font-weight: 800; }
.dm .inline-input { justify-self: end; }
.cal-routes { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.cal-routes table { background: var(--surface); }
.cal-routes .muted { margin: 0; font-size: var(--text-xs); }

/* ===== Меню «Сотрудники» ===== */
.nav-group { display: flex; flex-direction: column; position: relative; }
.nav-parent { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 10px var(--s3); border: 0; border-radius: var(--r-md); background: none; color: var(--sidebar-text); font-size: var(--text-sm); font-weight: 600; cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.nav-parent svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-parent span { flex: 1; }
.nav-parent .chev { width: 16px; height: 16px; transition: transform .2s ease; opacity: .7; }
.nav-group.open .nav-parent .chev { transform: rotate(180deg); }
.nav-parent:hover, .nav-parent.active { background: var(--sidebar-active); color: #fff; }
.nav-sub { display: flex; flex-direction: column; gap: 2px; overflow: hidden; max-height: 0; transition: max-height .22s ease; }
.nav-sub > a:first-child { margin-top: 2px; }
.nav-group.open .nav-sub { max-height: 120px; }
.nav-group:not(.open) .nav-sub a { visibility: hidden; }
.nav .nav-sub a { padding: 8px var(--s2) 8px 14px; font-size: var(--text-sm); white-space: nowrap; }
.nav .nav-sub a i { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-style: normal; font-size: 11px; font-weight: 800; background: var(--sidebar-active); color: var(--sidebar-text); }
.nav .nav-sub a.active i { background: var(--accent); color: #fff; }
@media (max-width: 860px) {
  .nav-group { position: relative; }
  .nav-parent { width: auto; padding: 8px 10px; }
  .nav-parent span, .nav-parent .chev { display: none; }
  .nav-parent.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .nav-sub { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); min-width: 200px; max-height: none; background: var(--sidebar); border: 1px solid var(--sidebar-active); border-radius: var(--r-md); padding: 6px; box-shadow: 0 12px 28px rgba(0, 0, 0, .35); z-index: 40; display: none; }
  .nav-group.open .nav-sub { display: flex; max-height: none; }
  .nav-group:not(.open) .nav-sub a { visibility: visible; }
  .nav .nav-sub a { padding: 8px 10px; }
  .nav .nav-sub a span { display: inline; }
  .nav .nav-sub a.active { box-shadow: none; }
}

/* ===== Водители ===== */
.drv-note { margin: 0 0 var(--s4); font-size: var(--text-xs); max-width: 90ch; }
table.drv td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; white-space: normal; }
table.drv td:first-child { white-space: nowrap; }
.drv-sub { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--text-3); font-weight: 500; }
small.cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }
small.cat.own { color: var(--own); } small.cat.priv { color: var(--priv); }
.plate { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; margin: 0 6px 6px 0; border: 1.5px solid var(--text); border-radius: 5px; font-weight: 800; font-size: var(--text-sm); letter-spacing: .04em; font-variant-numeric: tabular-nums; background: var(--surface); white-space: nowrap; }
.plate small { font-weight: 700; color: var(--text-3); letter-spacing: 0; }
.plate.minor { border-color: var(--border-strong); color: var(--text-2); font-weight: 700; }
.drv-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; margin: 0 6px 6px 0; border-radius: 99px; background: var(--surface-3); font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.drv-chip small { color: var(--text-3); }
.drv-chip.minor { font-weight: 600; color: var(--text-2); }
.drv-sub.nowrap { white-space: nowrap; }
.drv-shifts { font-size: var(--text-lg); font-weight: 800; }
.drv-obj-h { min-width: 260px; }
.drv-obj { min-width: 260px; }
.obj-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.obj-bar i { display: block; height: 100%; }
.obj-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: var(--text-xs); color: var(--text-2); }
.obj-legend b { color: var(--text); }
.obj-legend small { color: var(--text-3); }

/* ===== Рейтинг водителей ===== */
.g-rt { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.kpi-sub b.neg { color: var(--bad); }
.st-bar { display: flex; gap: 2px; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.st-bar i { display: block; min-width: 3px; }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: var(--text-sm); color: var(--text-2); }
.st-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.st-legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.st-legend small { color: var(--text-3); }
table.rt td { vertical-align: top; white-space: normal; }
table.rt td.n { white-space: nowrap; }
.rt-row { cursor: pointer; }
.rt-row:hover td { background: var(--surface-2); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable.on { color: var(--text); }
.score { display: inline-grid; place-items: center; min-width: 42px; height: 28px; padding: 0 8px; border-radius: 8px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score.good { background: var(--good-soft); color: var(--good); }
.score.warn { background: var(--warn-soft); color: var(--warn); }
.score.bad { background: var(--bad-soft); color: var(--bad); }
.score.neutral { background: var(--surface-3); color: var(--text-3); }
.warn-t { color: var(--warn); font-weight: 700; }
.rt-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--s3); }
.rt-sum > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s3); display: flex; flex-direction: column; gap: 4px; }
.rt-sum span { font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.rt-sum b { font-size: var(--text-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
.rt-block { display: flex; flex-direction: column; gap: var(--s2); }
.rt-block h4 { margin: 0; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.rt-block .muted { margin: 0; font-size: var(--text-sm); }
.rt-moves { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rt-moves li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--text-sm); }
.rt-moves li span { color: var(--text-2); }

/* ===== Реестр счетов ===== */
.inv-help { margin: 4px 0 0; font-size: var(--text-xs); max-width: 70ch; }
.inv-rates { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.inv-rates input { width: 78px; }
.inv-rates label + input { margin-right: var(--s3); }
table.inv { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
table.inv th, table.inv td { border-bottom: 1px solid var(--border); padding: 0; }
table.inv thead th { padding: 8px 10px; background: var(--sidebar); color: #fff; text-transform: none; letter-spacing: 0; font-size: var(--text-xs); border-bottom: 0; }
table.inv thead tr.inv-mrow th { background: none; padding: 0; }
table.inv thead tr.inv-mrow th.inv-month { background: var(--sidebar); color: #fff; text-align: center; padding: 6px 10px; border-radius: 6px 6px 0 0; font-size: var(--text-sm); }
table.inv thead th.inv-gap { background: none; }
table.inv thead th.inv-com-h { background: color-mix(in srgb, var(--accent) 80%, #000); }
table.inv thead th.inv-hl { background: color-mix(in srgb, var(--sidebar) 70%, #000); }
table.inv td.inv-code, table.inv td.inv-name { padding: 8px 12px; text-align: center; background: var(--surface-2); white-space: nowrap; }
table.inv td.inv-name { font-weight: 600; }
table.inv td.inv-period { padding: 8px 12px; white-space: nowrap; text-align: center; font-weight: 600; }
.inv-note { display: block; font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.inv-note.open { color: var(--warn); }
table.inv td.inv-hl { background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface)); }
table.inv .inv-in { width: 100%; min-width: 72px; height: 36px; min-height: 0; padding: 0 6px; border: 1px solid transparent; border-radius: 0; background: transparent; text-align: right; font: inherit; font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--text); }
table.inv .inv-in.strong { font-weight: 800; }
.inv-in.calc { color: var(--text); }
.inv-in.zero { color: var(--text-3); }
table.inv .inv-in:hover { border-color: var(--border-strong); }
table.inv .inv-in:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
table.inv .inv-in.ov, table.inv .inv-date.ov { background: color-mix(in srgb, var(--own) 12%, transparent); box-shadow: inset 3px 0 0 var(--own); }
.inv-date { border: 1px solid transparent; background: transparent; height: 36px; padding: 0 10px; font: inherit; font-size: var(--text-sm); color: var(--text); }
.inv-date:hover { border-color: var(--border-strong); }
table.inv tfoot td { padding: 10px 7px; font-weight: 800; background: color-mix(in srgb, var(--own) 10%, var(--surface-2)); text-align: right; white-space: nowrap; border-bottom: 0; }
table.inv tfoot td:first-child { text-align: left; }
table.inv tfoot td.inv-hl { background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface-2)); }
table.inv-total { min-width: 640px; }
.g-inv { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.g-inv .kpi-value { font-size: var(--text-xl); white-space: nowrap; }
table.inv td.inv-code { padding: 8px; }
table.inv td.inv-name { white-space: normal; min-width: 80px; max-width: 120px; line-height: 1.3; }
table.inv td.inv-code, table.inv td.inv-name { border-right: 1px solid var(--border); }
table.inv td.inv-period { padding: 8px 10px; }
table.inv { width: 100%; }
table.inv thead th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
table.inv thead tr.inv-mrow th { white-space: nowrap; }
table.inv td.inv-code { min-width: 0; width: 96px; max-width: 110px; white-space: normal; border-right: 1px solid var(--border); }
table.inv td.inv-code b { display: block; font-size: var(--text-lg); font-weight: 800; }
table.inv td.inv-code small { display: block; font-size: var(--text-xs); color: var(--text-2); font-weight: 600; line-height: 1.3; }

/* ===== ФОТ труда ===== */
.pay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.pay-hint { font-size: var(--text-xs); flex: 1 1 320px; }
.kpi-value.neg { color: var(--bad); }
table.pay { font-variant-numeric: tabular-nums; }
table.pay td, table.pay th { white-space: nowrap; }
.pay-ip { cursor: pointer; }
.pay-ip:hover td { background: var(--surface-2); }
.pay-ip.open td { background: var(--surface-2); border-bottom-color: transparent; }
.pay-ip.noip b { color: var(--bad); }
.pay-chev { width: 28px; padding-right: 0 !important; }
.pay-chev svg { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; display: block; }
.pay-ip.open .pay-chev svg { transform: rotate(90deg); stroke: var(--accent); }
td.pay-hl, th.pay-hl { background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface)); }
.pay-ip.open td.pay-hl { background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface-2)); }
table.pay tfoot td { font-weight: 800; background: color-mix(in srgb, var(--own) 10%, var(--surface-2)); border-bottom: 0; padding: 10px; }
table.pay tfoot td.pay-hl { background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface-2)); }
.pay-detail-box { width: 0; min-width: 100%; }
tr.pay-detail > td { background: var(--surface-2); padding: 4px 10px 16px; border-bottom: 2px solid var(--border-strong); }
table.pay-drv { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
table.pay-drv td { white-space: nowrap; }
table.pay-drv th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
table.pay-drv td:first-child { white-space: normal; min-width: 180px; }
table.pay-drv td { vertical-align: top; }
table.pay-drv th small { color: var(--text-3); }
.pay-items { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); color: var(--text-2); }
.pay-items li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kind { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: var(--text-xs); font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.kind.k-fuel { background: var(--warn-soft); color: var(--warn); }
.kind.k-claims { background: var(--bad-soft); color: var(--bad); }
.kind.k-bonus { background: var(--good-soft); color: var(--good); }
.kind.k-branding, .kind.k-uniform { background: color-mix(in srgb, var(--own) 14%, var(--surface)); color: var(--own); }
table.pay-ded td { vertical-align: top; }
table.pay-ded .pay-comment { white-space: normal; min-width: 160px; color: var(--text-2); }
table.pay-ded .btn { min-height: 30px; padding: 4px 10px; font-size: var(--text-xs); }
.card-head .row-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }

.sp-calc { font-size: var(--text-lg); font-weight: 800; padding: 6px 0; font-variant-numeric: tabular-nums; }
table.sp td { white-space: nowrap; }
table.sp td:nth-child(3) { white-space: normal; }
