/* ===== Токены ===== */
: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;      /* частники */
  --b2b: #6a4fb3;       /* заказы юрлиц */
  --b2c: #1f8a83;       /* заказы физлиц */
  --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;
  --key-bg: color-mix(in srgb, var(--warn-soft) 70%, var(--surface));
  --key-total: color-mix(in srgb, var(--warn-soft) 70%, var(--surface-2));
  --key-ink: var(--text);
  --total-bg: color-mix(in srgb, var(--own) 10%, var(--surface-2));
  --mark: var(--accent); --mark-ink: #fff; --scale: var(--accent); --rev: var(--accent);
}
[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;
  --b2b: #a58bf0;
  --b2c: #4fc4bb;
  --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(--mark); color: var(--mark-ink); }
.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(--mark); }
.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(--scale); 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(--mark); }
  .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(--head-bg, 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(--head-bg, 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: 480px; }
.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; }
@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(--mark); }
  .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(--head-bg, 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(--head-bg, 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(--head-bg, 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: var(--key-bg); color: var(--key-ink); font-weight: 800; }
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: var(--total-bg); 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: var(--key-total); color: var(--key-ink); }
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: var(--key-bg); color: var(--key-ink); }
td.pay-hl b, td.pay-hl { font-weight: 800; }
.pay-ip.open td.pay-hl { background: var(--key-bg); }
table.pay tfoot td { font-weight: 800; background: var(--total-bg); border-bottom: 0; padding: 10px; }
table.pay tfoot td.pay-hl { background: var(--key-total); color: var(--key-ink); }
.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; }

/* ===== ИПешники ===== */
.nav-portal { display: none !important; }
body.ip-mode .nav > a, body.ip-mode .nav > .nav-group, body.ip-mode .obj-block, body.ip-mode #objectField { display: none !important; }
body.ip-mode .nav > a.nav-portal { display: flex !important; }
.g-portal { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.g-portal .kpi-value { font-size: var(--text-xl); white-space: nowrap; }
.g-portal .drv-sub.pos { color: var(--good); } .g-portal .drv-sub.neg { color: var(--bad); }
.g-portal { grid-template-columns: 2fr 1fr 1fr; }
.g-portal .kpi-main { box-shadow: inset 0 0 0 2px var(--accent); }
.g-portal .kpi-main .kpi-label { color: var(--accent); }
.g-portal .kpi-main .kpi-value { font-size: calc(var(--text-xl) * 1.35); }
@media (max-width: 900px) { .g-portal { grid-template-columns: 1fr 1fr; } .g-portal .kpi-main { grid-column: 1 / -1; } }
@media (max-width: 520px) { .g-portal { grid-template-columns: 1fr; } }
table.portal td { white-space: nowrap; }
table.portal td:nth-child(2) { white-space: normal; min-width: 200px; }
.portal-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); margin: 6px 0 10px; }
.portal-mini > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.portal-mini span { font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.portal-mini b { font-variant-numeric: tabular-nums; }
.portal-late { margin: 8px 0 0; font-size: var(--text-sm); color: var(--text-2); }
.portal-detail .muted { margin: 4px 0 0; font-size: var(--text-sm); }
.ip-row { cursor: pointer; }
.ip-row:hover td { background: var(--surface-2); }
.ip-row.sel td { background: var(--accent-soft); }
.ip-row.sel td.pay-hl { background: var(--key-total); }
table.ip-list td { vertical-align: top; }
table.ip-list td:nth-child(2) { white-space: normal; min-width: 220px; }
table.ip-list .drv-chip { margin: 0 4px 4px 0; font-size: var(--text-xs); }
.ip-portal-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); }
.ip-portal-head h2 { margin: 0; font-size: var(--text-lg); }
.ip-portal-head:empty { display: none; }
.ip-portal { display: flex; flex-direction: column; gap: var(--s5); }
table.ipset td { vertical-align: top; }
table.ipset select { min-width: 260px; max-width: 100%; }
table.ipset select.manual { border-color: var(--own); box-shadow: inset 3px 0 0 var(--own); }
.ip-add { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.ip-add input { flex: 1 1 320px; }
.ip-comment { width: 100%; min-width: 160px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-actions .btn { min-height: 30px; padding: 4px 10px; font-size: var(--text-xs); }
.cred-box { display: grid; gap: var(--s2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); }
.cred-box > div { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.cred-box span { color: var(--text-3); font-size: var(--text-sm); }
.cred-box b { font-variant-numeric: tabular-nums; word-break: break-all; }
.cred-pass { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-lg); letter-spacing: .04em; }
#credText { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
table.ip-list td:nth-child(2) { min-width: 180px; max-width: 320px; }
table.ip-list td:nth-child(2) .drv-chip { display: inline-flex; }
table.ip-list th small { font-weight: 600; text-transform: none; letter-spacing: 0; }
@media (max-width: 520px) {
  .sidebar { gap: 2px; padding: var(--s2); }
  .sidebar .brand { display: none; }
  .nav { gap: 0; justify-content: space-between; }
  .nav a, .nav-parent { padding: 8px 6px; }
  .ghost-btn { padding: 8px 6px; }
  .nav-sub { left: auto; right: -40px; transform: none; }
}
body.ip-mode .sidebar .brand { display: flex; }
table.ipset select { width: 100%; min-width: 220px; }

/* ===== Ключевые цифры ===== */
.kpi-value { color: var(--key-ink); }
td.n, th.n, .n { font-variant-numeric: tabular-nums; }
table.inv td.inv-hl .inv-in, table.inv td.inv-hl .calc { color: var(--key-ink); }

/* ===== Расходы по выпискам ===== */
.exp-bar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.exp-upload { cursor: pointer; }
.exp-hint { font-size: var(--text-xs); flex: 1 1 260px; }
#bankResult .alert { margin: 0 var(--s4) var(--s4); }
.exp-empty h2 { margin-bottom: var(--s2); font-size: var(--text-lg); }
.exp-empty p { max-width: 70ch; }
.exp-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s5); }
@media (max-width: 1100px) { .exp-split { grid-template-columns: 1fr; } }
.exp-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.exp-cats button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 4px var(--s3); align-items: center; text-align: left; background: none; border: 0; border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; color: var(--text); font: inherit; }
.exp-cats button:hover { background: var(--surface-2); }
.exp-cats button.on { background: var(--accent-soft); }
.exp-cats button.personal { color: var(--text-3); }
.exp-cat-name { font-size: var(--text-sm); font-weight: 600; }
.exp-cat-name small { margin-left: 6px; color: var(--text-3); font-weight: 600; font-size: var(--text-xs); }
.exp-cats b { font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.exp-cat-bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.exp-cat-bar i { display: block; height: 100%; background: var(--scale); }
.exp-objs { list-style: none; margin: 0 0 var(--s3); padding: 0; }
.exp-objs li { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.exp-objs li span { display: inline-flex; align-items: center; gap: 6px; }
.exp-objs b { font-variant-numeric: tabular-nums; }
.exp-accts { display: grid; gap: 6px; margin-top: var(--s3); }
.exp-accts > div { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); font-size: var(--text-xs); background: var(--surface-2); border-radius: var(--r-sm); padding: 6px 8px; }
.exp-accts small { display: block; color: var(--text-3); word-break: break-all; }
.exp-accts .btn { min-height: 28px; padding: 3px 8px; font-size: var(--text-xs); flex-shrink: 0; }
.exp-remember { display: flex; gap: 8px; align-items: flex-start; font-size: var(--text-xs); color: var(--text-2); margin-bottom: var(--s3); }
.exp-remember input { margin-top: 2px; accent-color: var(--accent); }
table.exp-ops td { vertical-align: top; }
table.exp-ops .exp-date { white-space: nowrap; }
table.exp-ops .exp-cp { min-width: 260px; max-width: 520px; white-space: normal; }
.exp-purpose { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--text-3); line-height: 1.35; }
table.exp-ops select { max-width: 230px; font-size: var(--text-xs); }
table.exp-ops select.set { box-shadow: inset 3px 0 0 var(--own); }
table.exp-ops tr.is-personal td { color: var(--text-3); }
table.exp-ops tr.is-personal b.neg { color: var(--text-3); text-decoration: line-through; }
table.exp-ops tfoot td { font-weight: 800; background: var(--total-bg); padding: 10px; }
#expMore { margin-top: var(--s3); }
#bankResult .alert:not(.warn):not(.bad):not(.good) { background: var(--surface-2); }
.exp-root, #expBody { display: flex; flex-direction: column; gap: var(--s5); }
.exp-kpis .kpi-sub, .exp-kpis .kpi-sub span { white-space: normal; overflow: visible; text-overflow: clip; }
.exp-cats button { padding: 6px 10px; }

/* =====================================================================
   Тема «Лес»: лесной зелёный, шалфей, крафт; фон из листьев, мягкий объём
   ===================================================================== */
:root:not([data-theme='dark']) {
  --bg: #e6ebe3; --surface: #fbfaf6; --surface-2: #f3f1ea; --surface-3: #e8e5da;
  --border: #ddd8cb; --border-strong: #c7c0ad;
  --text: #1b2a22; --text-2: #4a5a50; --text-3: #75837a;
  --accent: #2f6b4f; --accent-ink: #fff; --accent-soft: #e1ece3;
  --mark: #d9b48f; --mark-ink: #1f3a2e; --scale: #3f7d5c; --rev: #1f4a3d;
  --own: #2f6b4f; --priv: #c08a55; --obj-1: #2f6b4f; --obj-2: #c08a55;
  --good: #2e7d4f; --good-soft: #e0efe3; --warn: #a2702a; --warn-soft: #f5ead4; --bad: #b4483a; --bad-soft: #f7e3de;
  --key-bg: #f3e6d4; --key-total: #e9d4b8; --key-ink: #5c3a22; --total-bg: #e8e5d8;
  --sidebar: #183a2e; --sidebar-text: #d3ded6; --sidebar-active: rgba(255, 255, 255, .13);
  --kpi-ink: #1f4a3d;
  --veil: rgba(231, 237, 228, .86); --veil-2: rgba(222, 230, 219, .93);
  --lift: inset 0 1px 0 rgba(255, 255, 255, .85), 0 1px 2px rgba(24, 58, 46, .08), 0 14px 30px -16px rgba(24, 58, 46, .38);
  --lift-hi: inset 0 1px 0 rgba(255, 255, 255, .9), 0 2px 4px rgba(24, 58, 46, .1), 0 20px 36px -16px rgba(24, 58, 46, .45);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --shadow: var(--lift);
}
:root[data-theme='dark'] {
  --bg: #0e1a15; --surface: #15241d; --surface-2: #1a2c23; --surface-3: #22362b;
  --border: #284131; --border-strong: #36533f;
  --text: #e6eee8; --text-2: #b0c1b6; --text-3: #7f9488;
  --accent: #5fae82; --accent-ink: #0c1a13; --accent-soft: #1d3529;
  --mark: #d9b48f; --mark-ink: #1b2a22; --scale: #6fbf8f; --rev: #d3e6d9;
  --own: #6fbf8f; --priv: #d9a877; --obj-1: #6fbf8f; --obj-2: #d9a877;
  --good: #6cc48d; --good-soft: #183325; --warn: #e0b565; --warn-soft: #2e2615; --bad: #ee8a7a; --bad-soft: #3a1f1a;
  --key-bg: #2e2418; --key-total: #3d2f1e; --key-ink: #f0d2ae; --total-bg: #1f3127;
  --sidebar: #0f241b; --sidebar-text: #c3d2c8; --sidebar-active: rgba(255, 255, 255, .1);
  --kpi-ink: #ecdcc4;
  --veil: rgba(10, 22, 16, .86); --veil-2: rgba(8, 18, 13, .93);
  --lift: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .35), 0 16px 32px -18px rgba(0, 0, 0, .7);
  --lift-hi: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 4px rgba(0, 0, 0, .4), 0 22px 40px -18px rgba(0, 0, 0, .8);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --shadow: var(--lift);
}

/* Фон: размытые листья под светлой (или тёмной) вуалью */
body { background: linear-gradient(180deg, var(--veil), var(--veil-2)), url('img/leaves-bg.jpg') center / cover fixed, var(--bg); }

/* Меню: тёмно-зелёное с листьями */
.sidebar {
  background: linear-gradient(180deg, rgba(20, 52, 40, .78) 0%, rgba(16, 40, 31, .9) 45%, rgba(12, 30, 23, .96) 100%), url('img/leaves-side.jpg') top center / cover, var(--sidebar);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06), 8px 0 30px -18px rgba(0, 0, 0, .55);
}
.brand-text span, .obj-title, .obj-item small, .obj-add { color: rgba(211, 222, 214, .62); }
.obj-block { border-top-color: rgba(255, 255, 255, .1); }
.brand-mark { border-radius: 12px; background: linear-gradient(145deg, #ecd3b6, #c99c70); color: #1f3a2e; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 6px 14px -6px rgba(0, 0, 0, .6); }
.nav a, .nav-parent { border-radius: 12px; }
.nav a.active, .nav-parent.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .08)); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 16px -10px rgba(0, 0, 0, .6);
}
.nav .nav-sub a.active { box-shadow: none; background: rgba(255, 255, 255, .1); }
.obj-item.active { background: rgba(255, 255, 255, .12); box-shadow: inset 3px 0 0 var(--mark); }

/* Шапка: полоса с листьями */
.topbar {
  background: linear-gradient(100deg, rgba(18, 48, 36, .94) 0%, rgba(24, 62, 46, .82) 50%, rgba(24, 62, 46, .55) 100%), url('img/leaves-band.jpg') center 40% / cover;
  border-bottom: 0; box-shadow: 0 10px 30px -18px rgba(10, 30, 22, .7); color: #f4f1ea;
}
.topbar h1 { color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.topbar .muted, .topbar #periodLine { color: rgba(240, 236, 226, .78); }
.topbar .field-inline { color: rgba(240, 236, 226, .75); }
.topbar .field-inline select { background: rgba(251, 250, 246, .95); color: #1b2a22; border-color: transparent; box-shadow: inset 0 1px 0 #fff, 0 4px 10px -6px rgba(0, 0, 0, .5); }
.topbar .demo-note { background: rgba(233, 212, 184, .92); color: #5c3a22; }

/* Карточки: светлый «картон» с мягким объёмом */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, #fff 0%), color-mix(in srgb, var(--surface) 92%, var(--surface-3)));
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: var(--lift);
}
.kpi { position: relative; overflow: hidden; isolation: isolate; }
.kpi::after {
  content: ''; position: absolute; right: -50px; bottom: -62px; width: 118px; height: 118px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .55), transparent 42%), radial-gradient(circle at 50% 50%, var(--kpi-dot, #9cc0a6) 0 60%, transparent 61%);
  box-shadow: inset -8px -10px 18px rgba(0, 0, 0, .12); opacity: .3;
}
.grid > .kpi:nth-child(4n+2) { --kpi-dot: #d9b48f; }
.grid > .kpi:nth-child(4n+3) { --kpi-dot: #2f6b4f; }
.grid > .kpi:nth-child(4n+4) { --kpi-dot: #b9a387; }
[data-theme='dark'] .kpi::after { opacity: .22; }
.kpi-value { color: var(--kpi-ink); text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
[data-theme='dark'] .kpi-value { text-shadow: none; }

/* Кнопки: объёмные */
.btn { border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 2px rgba(24, 58, 46, .12); transition: transform .12s, box-shadow .12s, background .15s; }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent)); border-color: color-mix(in srgb, var(--accent) 80%, #000);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 8px 16px -8px color-mix(in srgb, var(--accent) 70%, #000); }
[data-theme='dark'] .btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .4); }
.seg { border-radius: 12px; padding: 4px; box-shadow: inset 0 1px 3px rgba(24, 58, 46, .14); }
.seg button { border-radius: 9px; }
.seg button.on { background: linear-gradient(180deg, #fff, var(--surface)); color: var(--text); box-shadow: inset 0 1px 0 #fff, 0 3px 8px -3px rgba(24, 58, 46, .35); }
[data-theme='dark'] .seg button.on { background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 8px -3px rgba(0, 0, 0, .6); }

/* Поля ввода */
select, input[type='text'], input[type='number'], input[type='password'], input[type='search'], input[type='date'] { border-radius: 10px; box-shadow: inset 0 1px 2px rgba(24, 58, 46, .08); }

/* Шкалы и метки */
.bar, .exp-cat-bar { box-shadow: inset 0 1px 2px rgba(24, 58, 46, .15); }
.bar > i, .exp-cat-bar i { background: linear-gradient(90deg, color-mix(in srgb, var(--scale) 75%, #fff), var(--scale)); }
.badge, .score, .kind { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }

/* Таблицы: тёмно-зелёная шапка там, где она тёмная (реестр, график) — со светлым бликом */
table.inv thead th, .sch thead th { background: linear-gradient(180deg, #24513f, #183a2e); }
table.inv thead th.inv-com-h { background: linear-gradient(180deg, #8a5a36, #6b4227); }
td.pay-hl, th.pay-hl, table.inv td.inv-hl { background: linear-gradient(180deg, color-mix(in srgb, var(--key-bg) 70%, #fff), var(--key-bg)); }
[data-theme='dark'] td.pay-hl, [data-theme='dark'] th.pay-hl, [data-theme='dark'] table.inv td.inv-hl { background: var(--key-bg); }

/* Вход */
.login { background: linear-gradient(180deg, rgba(14, 36, 27, .55), rgba(10, 26, 19, .8)), url('img/leaves-bg.jpg') center / cover; }
.login-card { border-radius: 20px; box-shadow: var(--lift-hi); }

@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }
@media (max-width: 860px) {
  body { background-attachment: scroll; }
  .sidebar { background: linear-gradient(90deg, rgba(16, 42, 32, .92), rgba(16, 42, 32, .82)), url('img/leaves-side.jpg') center / cover, var(--sidebar); }
}
.kpi-value.neg { color: var(--bad); }

/* ===== Нижняя панель меню и настройки ===== */
.foot-row { display: flex; gap: 4px; }
.foot-row .ghost-btn { flex: 1 1 0; min-width: 0; }
@media (max-width: 860px) { .foot-row { gap: 0; } .foot-row .ghost-btn { flex: 0 0 auto; } }
.set-sec { display: flex; flex-direction: column; gap: var(--s3); }
.set-sec h3 { font-size: var(--text-sm); color: var(--text-2); }
.design-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s3); }
.design-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: var(--s3); border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.design-card:hover { border-color: var(--border-strong); }
.design-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.design-card small { color: var(--text-3); font-size: var(--text-xs); line-height: 1.35; }
.design-prev { display: flex; width: 100%; height: 56px; border-radius: 10px; overflow: hidden; margin-bottom: 4px; }
.design-prev i { flex: 1; }
.design-prev-forest { background: url('img/leaves-side.jpg') center / cover; padding: 8px; gap: 6px; }
.design-prev-forest i { border-radius: 6px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 4px 8px -4px rgba(0, 0, 0, .6); }
.design-prev-soft { background: #efeae3; padding: 10px; gap: 10px; }
.design-prev-soft i { border-radius: 50%; flex: 0 0 34px; height: 34px; box-shadow: 4px 4px 8px rgba(166, 152, 132, .45), -4px -4px 8px rgba(255, 255, 255, .9); }

/* =====================================================================
   Оформление «Мягкий»: слоновая кость, терракота, выпуклые элементы (soft UI)
   ===================================================================== */
:root[data-design='soft']:not([data-theme='dark']) {
  --bg: #efeae3; --surface: #f3efe9; --surface-2: #ebe6de; --surface-3: #e2dcd2;
  --border: #e0d9ce; --border-strong: #cec5b7;
  --text: #26303a; --text-2: #59616a; --text-3: #8a8e91;
  --accent: #c0654a; --accent-ink: #fff; --accent-soft: #f3e1d9;
  --mark: #c0654a; --mark-ink: #fff; --scale: #c0654a; --rev: #26303a;
  --own: #2f5a46; --priv: #d49a6a; --obj-1: #2f5a46; --obj-2: #c0654a;
  --good: #2f7a52; --good-soft: #e2ede4; --warn: #a8762c; --warn-soft: #f3e7d1; --bad: #b8432e; --bad-soft: #f6e0d9;
  --key-bg: #f4e2d9; --key-total: #ecd0c3; --key-ink: #8e3f28; --total-bg: #e7e1d7; --kpi-ink: #26303a;
  --sidebar: #efeae3; --sidebar-text: #59616a; --sidebar-active: transparent; --head-bg: #2f3a44;
  --neu: 9px 9px 20px rgba(166, 150, 128, .34), -9px -9px 20px rgba(255, 255, 255, .9);
  --neu-sm: 4px 4px 10px rgba(166, 150, 128, .32), -4px -4px 10px rgba(255, 255, 255, .9);
  --neu-in: inset 4px 4px 9px rgba(166, 150, 128, .3), inset -4px -4px 9px rgba(255, 255, 255, .85);
  --neu-acc: 6px 6px 14px rgba(192, 101, 74, .32), -5px -5px 12px rgba(255, 255, 255, .85);
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --shadow: var(--neu);
}
:root[data-design='soft'][data-theme='dark'] {
  --bg: #262d34; --surface: #29313a; --surface-2: #2e373f; --surface-3: #343e47;
  --border: #343e47; --border-strong: #46525c;
  --text: #ede7de; --text-2: #bab4ab; --text-3: #8b8f92;
  --accent: #e0866a; --accent-ink: #1d1410; --accent-soft: #3d2c26;
  --mark: #e0866a; --mark-ink: #1d1410; --scale: #e0866a; --rev: #ede7de;
  --own: #8fc1a4; --priv: #e0a77a; --obj-1: #8fc1a4; --obj-2: #e0866a;
  --good: #7cc59a; --good-soft: #1f3329; --warn: #e2b664; --warn-soft: #3a3020; --bad: #f08d78; --bad-soft: #402520;
  --key-bg: #3a2b25; --key-total: #4a342a; --key-ink: #f3bca6; --total-bg: #2f3840; --kpi-ink: #f5efe6;
  --sidebar: #262d34; --sidebar-text: #bab4ab; --sidebar-active: transparent; --head-bg: #1c2228;
  --neu: 9px 9px 20px rgba(0, 0, 0, .42), -8px -8px 18px rgba(255, 255, 255, .045);
  --neu-sm: 4px 4px 10px rgba(0, 0, 0, .4), -4px -4px 10px rgba(255, 255, 255, .045);
  --neu-in: inset 4px 4px 9px rgba(0, 0, 0, .4), inset -4px -4px 9px rgba(255, 255, 255, .04);
  --neu-acc: 6px 6px 14px rgba(0, 0, 0, .45), -4px -4px 10px rgba(255, 255, 255, .04);
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --shadow: var(--neu);
}
html[data-design='soft'] body { background: radial-gradient(1200px 600px at 70% -10%, color-mix(in srgb, var(--surface) 90%, #fff 10%), transparent 70%), var(--bg); }
html[data-design='soft'] .sidebar { background: var(--bg); box-shadow: 8px 0 24px -16px rgba(120, 104, 84, .45); }
html[data-design='soft'][data-theme='dark'] .sidebar { box-shadow: 8px 0 24px -14px rgba(0, 0, 0, .7); }
html[data-design='soft'] .brand-text strong { color: var(--text); }
html[data-design='soft'] .brand-text span, html[data-design='soft'] .obj-title, html[data-design='soft'] .obj-item small, html[data-design='soft'] .obj-add { color: var(--text-3); }
html[data-design='soft'] .brand-mark { background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent)); color: #fff; border-radius: 14px; box-shadow: var(--neu-acc); }
html[data-design='soft'] .obj-block { border-top-color: var(--border); }
html[data-design='soft'] .nav a, html[data-design='soft'] .nav-parent, html[data-design='soft'] .ghost-btn, html[data-design='soft'] .obj-item { color: var(--sidebar-text); border-radius: 14px; }
html[data-design='soft'] .nav a:hover, html[data-design='soft'] .nav-parent:hover, html[data-design='soft'] .ghost-btn:hover, html[data-design='soft'] .obj-item:hover { background: var(--bg); color: var(--text); box-shadow: var(--neu-sm); }
html[data-design='soft'] .nav a.active, html[data-design='soft'] .nav-parent.active, html[data-design='soft'] .obj-item.active { background: var(--bg); color: var(--accent); box-shadow: var(--neu-in); }
html[data-design='soft'] .nav .nav-sub a.active { background: transparent; box-shadow: none; color: var(--accent); }
html[data-design='soft'] .topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); box-shadow: none; border-bottom: 1px solid var(--border); color: var(--text); }
html[data-design='soft'] .topbar h1 { color: var(--text); text-shadow: none; font-weight: 600; letter-spacing: .01em; }
html[data-design='soft'] .topbar .muted, html[data-design='soft'] .topbar #periodLine, html[data-design='soft'] .topbar .field-inline { color: var(--text-3); }
html[data-design='soft'] .topbar .field-inline select { background: var(--bg); color: var(--text); box-shadow: var(--neu-in); }
html[data-design='soft'] .topbar .demo-note { background: var(--accent-soft); color: var(--key-ink); }
html[data-design='soft'] .card { background: var(--bg); border: 0; box-shadow: var(--neu); }
html[data-design='soft'] th { background: var(--bg); }
html[data-design='soft'] .kpi-label { letter-spacing: .12em; font-weight: 600; }
html[data-design='soft'] .kpi-value { font-weight: 600; text-shadow: none; letter-spacing: -0.01em; }
html[data-design='soft'] .kpi::after {
  right: -40px; bottom: -76px; width: 108px; height: 108px; opacity: .5; box-shadow: none;
  background: none; border: 9px solid var(--surface-3); border-top-color: var(--accent); border-right-color: var(--accent); transform: rotate(18deg);
}
html[data-design='soft'] .grid > .kpi:nth-child(4n+2)::after { border-top-color: var(--own); border-right-color: var(--own); }
html[data-design='soft'] .grid > .kpi:nth-child(4n+3)::after { border-top-color: var(--priv); border-right-color: transparent; }
html[data-design='soft'] .btn { background: var(--bg); border: 0; border-radius: 999px; box-shadow: var(--neu-sm); padding-inline: 18px; }
html[data-design='soft'] .btn:hover { color: var(--accent); background: var(--bg); }
html[data-design='soft'] .btn:active { box-shadow: var(--neu-in); transform: none; }
html[data-design='soft'] .btn.primary { background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); color: var(--accent-ink); box-shadow: var(--neu-acc); }
html[data-design='soft'] .btn.primary:hover { color: var(--accent-ink); }
html[data-design='soft'] .btn.danger { color: var(--bad); }
html[data-design='soft'] .seg { background: var(--bg); box-shadow: var(--neu-in); border-radius: 999px; padding: 5px; }
html[data-design='soft'] .seg button { border-radius: 999px; }
html[data-design='soft'] .seg button.on { background: var(--bg); color: var(--accent); box-shadow: var(--neu-sm); }
html[data-design='soft'] :is(select, input[type='text'], input[type='number'], input[type='password'], input[type='search'], input[type='date'], textarea):not(.inv-in):not(.inv-date) { background: var(--bg); border-color: transparent; border-radius: 14px; box-shadow: var(--neu-in); }
html[data-design='soft'] .bar, html[data-design='soft'] .exp-cat-bar { background: var(--bg); box-shadow: var(--neu-in); height: 8px; }
html[data-design='soft'] .bar > i, html[data-design='soft'] .exp-cat-bar i { background: var(--scale); border-radius: 99px; }
html[data-design='soft'] table.inv thead th, html[data-design='soft'] .sch thead th { background: linear-gradient(180deg, #3a4651, #26303a); }
html[data-design='soft'] table.inv thead th.inv-com-h { background: linear-gradient(180deg, #c97a60, #a8533a); }
html[data-design='soft'] td.pay-hl, html[data-design='soft'] th.pay-hl, html[data-design='soft'] table.inv td.inv-hl { background: var(--key-bg); }
html[data-design='soft'] .badge, html[data-design='soft'] .score, html[data-design='soft'] .kind { box-shadow: none; }
html[data-design='soft'] .drawer { background: var(--bg); }
html[data-design='soft'] .design-card { background: var(--bg); border-color: transparent; box-shadow: var(--neu-sm); }
html[data-design='soft'] .design-card.on { box-shadow: var(--neu-in); border-color: var(--accent); }
html[data-design='soft'] .login { background: var(--bg); }
html[data-design='soft'] .login-card { background: var(--bg); border: 0; box-shadow: var(--neu); }
html[data-design='soft'] .pay-detail-box, html[data-design='soft'] .portal-mini > div { background: var(--bg); }
@media (max-width: 860px) { html[data-design='soft'] .sidebar { background: var(--bg); box-shadow: 0 8px 20px -14px rgba(120, 104, 84, .5); } }
.foot-row .ghost-btn { padding: 10px 8px; gap: 8px; }
.set-sec .seg { align-self: flex-start; }
.foot-row .settings-btn { flex: 0 0 auto; width: auto; padding: 10px 12px; }


/* =====================================================================
   Левая панель: выдвижная (значки → при наведении названия), иконки-«капли»
   ===================================================================== */
:root { --blob-1: rgba(233, 212, 184, .2); --blob-2: rgba(181, 210, 190, .2); --blob-3: rgba(255, 255, 255, .12); --blob-ink: #eef3ee; --blob-act: #e9d4b8; --blob-act-ink: #1f3a2e; --rail: 84px; --rail-open: 260px; }
:root[data-design='soft']:not([data-theme='dark']) { --blob-1: #ecdcd2; --blob-2: #d9dacd; --blob-3: #ddd0c4; --blob-ink: #4a4540; --blob-act: #c0654a; --blob-act-ink: #fff; }
:root[data-design='soft'][data-theme='dark'] { --blob-1: #3e3530; --blob-2: #353c37; --blob-3: #3c3732; --blob-ink: #ddd6cc; --blob-act: #e0866a; --blob-act-ink: #1d1410; }

.ico { display: inline-grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; background: var(--blob-1); border-radius: 58% 42% 52% 48% / 46% 56% 44% 54%; transition: background .2s, transform .2s, border-radius .4s; }
.ico.b2 { background: var(--blob-2); border-radius: 44% 56% 40% 60% / 58% 42% 58% 42%; }
.ico.b3 { background: var(--blob-3); border-radius: 52% 48% 62% 38% / 42% 52% 48% 58%; }
.ico svg, .nav .ico svg, .ghost-btn .ico svg { width: 21px; height: 21px; fill: none; stroke: var(--blob-ink); stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 30px; height: 30px; }
.ico.sm svg, .nav .ico.sm svg { width: 17px; height: 17px; }
.nav a:hover .ico, .nav-parent:hover .ico, .ghost-btn:hover .ico { transform: rotate(-6deg) scale(1.04); }
.nav a.active .ico, .nav-parent.active .ico { background: var(--blob-act); box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .6); }
.nav a.active .ico svg, .nav-parent.active .ico svg { stroke: var(--blob-act-ink); stroke-width: 1.7; }
.nav a, .nav-parent, .ghost-btn { gap: 12px; }
.nav a > span, .nav-parent > span, .ghost-btn > span { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ico { transition: none; } .nav a:hover .ico, .nav-parent:hover .ico, .ghost-btn:hover .ico { transform: none; } }

@media (min-width: 861px) {
  .app { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .main-wrap { grid-column: 2; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh; width: var(--rail); z-index: 45;
    padding: var(--s5) 12px; overflow: hidden; transition: width .24s cubic-bezier(.2, .7, .2, 1), box-shadow .24s;
  }
  .sidebar:hover, .sidebar:focus-within { width: var(--rail-open); box-shadow: 18px 0 40px -16px rgba(10, 30, 22, .55); overflow-y: auto; }
  .brand { padding: 0 0 var(--s5) 11px; flex-wrap: nowrap; }
  .brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
  .brand-text { white-space: nowrap; }
  .nav { gap: 2px; }
  .nav a, .nav-parent { padding: 5px 11px; min-height: 48px; width: 100%; }
  .nav .nav-sub a { padding: 4px 11px 4px 26px; min-height: 40px; }
  .nav-parent .chev { margin-left: auto; }
  .sidebar-foot { display: flex; flex-direction: column; gap: 2px; }
  .ghost-btn { padding: 5px 11px; min-height: 48px; }
  .foot-row { flex-direction: row; }
  .foot-row .settings-btn { padding: 5px 11px; }
  /* свёрнуто: только значки */
  .sidebar:not(:hover):not(:focus-within) :is(.brand-text, .nav a > span, .nav-parent > span, .nav-parent .chev, .ghost-btn > span, .obj-block) { opacity: 0; pointer-events: none; }
  .sidebar:not(:hover):not(:focus-within) .nav-group .nav-sub { max-height: 0; }
  .sidebar:not(:hover):not(:focus-within) .nav-group .nav-sub a { visibility: hidden; }
  .sidebar:not(:hover):not(:focus-within) .foot-row { flex-direction: column; }
  .sidebar:not(:hover):not(:focus-within) .obj-block { max-height: 0; overflow: hidden; margin: 0; padding: 0; border: 0; }
  :is(.brand-text, .nav a > span, .nav-parent > span, .nav-parent .chev, .ghost-btn > span, .obj-block) { transition: opacity .18s ease .06s; }
}
@media (max-width: 860px) {
  .ico { width: 34px; height: 34px; }
  .ico svg, .nav .ico svg { width: 19px; height: 19px; }
  .nav a, .nav-parent { padding: 4px; }
}
@media (max-width: 520px) {
  .ico { width: 29px; height: 29px; }
  .ico svg, .nav .ico svg, .ghost-btn .ico svg { width: 17px; height: 17px; }
  .nav a, .nav-parent, .ghost-btn, .foot-row .settings-btn { padding: 3px; }
  .sidebar-foot { display: flex; }
}

/* =====================================================================
   Чат: правая выдвижная панель (в стиле левой)
   ===================================================================== */
:root { --chat-rail: 76px; --chat-open: 380px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chat {
  position: fixed; right: 0; top: 0; bottom: 0; width: var(--chat-rail); z-index: 44; display: flex; flex-direction: column;
  background: var(--sidebar); color: var(--sidebar-text); overflow: hidden;
  transition: width .24s cubic-bezier(.2, .7, .2, 1), box-shadow .24s;
}
:root:not([data-design='soft']) .chat { background: linear-gradient(180deg, rgba(20, 52, 40, .8), rgba(12, 30, 23, .96)), url('img/leaves-side.jpg') top right / cover, var(--sidebar); box-shadow: inset 1px 0 0 rgba(255, 255, 255, .06); }
html[data-design='soft'] .chat { background: var(--bg); box-shadow: -8px 0 24px -16px rgba(120, 104, 84, .45); }
.chat:hover, .chat:focus-within, .chat.open { width: var(--chat-open); box-shadow: -18px 0 40px -16px rgba(10, 30, 22, .55); }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s5) 14px var(--s3); gap: var(--s2); }
.chat-title { position: relative; background: none; border: 0; color: inherit; font: 800 var(--text-lg)/1 var(--font); letter-spacing: .06em; cursor: pointer; padding: 8px 6px; white-space: nowrap; }
:root:not([data-design='soft']) .chat-title { color: #fff; }
.chat-badge { position: absolute; top: -4px; right: -10px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--blob-act); color: var(--blob-act-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .6); letter-spacing: 0; }
.chat-x, .chat-back { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--blob-3); color: inherit; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.chat-x svg, .chat-back svg, .chat-search svg, .chat-attach svg, .chat-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-search { position: relative; margin: 0 14px var(--s3); display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 999px; background: var(--blob-3); min-height: 42px; }
.chat-search input { flex: 1; min-width: 0; background: transparent !important; border: 0 !important; box-shadow: none !important; color: inherit; padding: 8px 0; outline: none; }
.chat-search input::placeholder { color: inherit; opacity: .6; }
html[data-design='soft'] .chat-search, html[data-design='soft'] .chat-x, html[data-design='soft'] .chat-back { background: var(--bg); box-shadow: var(--neu-in); }
html[data-design='soft'] .chat-x, html[data-design='soft'] .chat-back { box-shadow: var(--neu-sm); }
.chat-sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--surface); color: var(--text); border-radius: 16px; padding: 6px; box-shadow: var(--lift-hi, 0 14px 30px -10px rgba(0, 0, 0, .4)); max-height: 320px; overflow-y: auto; }
.chat-sugg button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 6px 8px; cursor: pointer; color: inherit; font: inherit; }
.chat-sugg button:hover, .chat-sugg button.hl { background: var(--surface-2); }
.chat-sugg b { display: block; font-size: var(--text-sm); }
.chat-sugg small { color: var(--text-3); font-size: var(--text-xs); }
.ico.av { font-style: normal; font-weight: 800; font-size: 13px; color: var(--blob-ink); letter-spacing: .02em; }
.chat-sugg .ico.av { --blob-ink: var(--text); background: var(--surface-3); }
.ico.av.sm { width: 32px; height: 32px; font-size: 11px; }
.chat-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 10px var(--s4); display: flex; flex-direction: column; gap: 2px; }
.chat-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-radius: 14px; padding: 6px 8px; cursor: pointer; color: inherit; font: inherit; min-height: 54px; }
.chat-item:hover, .chat-item.on { background: rgba(255, 255, 255, .1); }
html[data-design='soft'] .chat-item:hover, html[data-design='soft'] .chat-item.on { background: var(--bg); box-shadow: var(--neu-sm); }
.chat-item .ico.av { width: 40px; height: 40px; }
.chat-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item-text b { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root:not([data-design='soft']) .chat-item-text b { color: #fff; }
.chat-item-text small { font-size: var(--text-xs); opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-text small { opacity: 1; font-weight: 700; }
.chat-item time { font-size: 11px; opacity: .6; align-self: flex-start; margin-top: 6px; }
.chat-dot { position: absolute; left: 38px; top: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--blob-act); color: var(--blob-act-ink); font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.chat-empty { font-size: var(--text-xs); opacity: .7; padding: 8px 6px; line-height: 1.45; }
.chat-conv { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-conv-head { display: flex; align-items: center; gap: 10px; padding: 0 14px var(--s3); border-bottom: 1px solid rgba(255, 255, 255, .1); }
html[data-design='soft'] .chat-conv-head { border-bottom-color: var(--border); }
.chat-with { min-width: 0; display: flex; flex-direction: column; }
.chat-with b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--text-sm); }
:root:not([data-design='soft']) .chat-with b { color: #fff; }
.chat-with small { font-size: var(--text-xs); opacity: .65; }
.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s3) 14px; display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--bg) 92%, transparent); color: var(--text); }
:root:not([data-design='soft']) .chat-msgs { background: rgba(240, 244, 238, .95); }
:root[data-theme='dark']:not([data-design='soft']) .chat-msgs { background: rgba(12, 26, 19, .92); }
.chat-day { align-self: center; font-size: 11px; color: var(--text-3); background: var(--surface-2); border-radius: 99px; padding: 2px 10px; margin: 6px 0; }
.msg { align-self: flex-start; max-width: 82%; background: var(--surface); border-radius: 16px 16px 16px 6px; padding: 7px 11px 5px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-radius: 16px 16px 6px 16px; }
html[data-design='soft'] .msg { box-shadow: var(--neu-sm); background: var(--bg); }
html[data-design='soft'] .msg.mine { background: var(--accent-soft); }
.msg p { margin: 0; font-size: var(--text-sm); line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.msg time { display: flex; justify-content: flex-end; gap: 4px; font-size: 10px; color: var(--text-3); margin-top: 2px; }
.msg-read.on { color: var(--accent); font-weight: 800; }
.msg-img { display: block; border: 0; padding: 0; background: none; cursor: zoom-in; margin: 2px 0 4px; border-radius: 12px; overflow: hidden; }
.msg-img img { display: block; max-width: 240px; max-height: 240px; border-radius: 12px; }
.msg-img .skeleton { display: block; width: 200px; height: 140px; }
.chat-full { max-width: 100%; border-radius: 12px; }
.chat-preview { position: relative; padding: 8px 14px 0; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.chat-preview img { max-height: 90px; border-radius: 10px; display: block; }
.chat-preview button { position: absolute; top: 2px; left: 110px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 14px; background: color-mix(in srgb, var(--bg) 92%, transparent); }
:root:not([data-design='soft']) .chat-form, :root:not([data-design='soft']) .chat-preview { background: rgba(240, 244, 238, .95); }
:root[data-theme='dark']:not([data-design='soft']) .chat-form, :root[data-theme='dark']:not([data-design='soft']) .chat-preview { background: rgba(12, 26, 19, .92); }
.chat-form textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; border-radius: 18px; padding: 9px 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: var(--text-sm); line-height: 1.4; }
.chat-attach, .chat-send { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; border: 0; }
.chat-attach { background: var(--surface-3); color: var(--text-2); }
.chat-send { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--accent) 80%, #000); }
.chat-send:disabled { opacity: .5; }
html[data-design='soft'] .chat-attach { background: var(--bg); box-shadow: var(--neu-sm); }
html[data-design='soft'] .chat-send { box-shadow: var(--neu-acc); }
/* свёрнуто: «Чат» и кружки собеседников */
.chat:not(:hover):not(:focus-within):not(.open) :is(.chat-x, .chat-search, .chat-item-text, .chat-item time, .chat-empty) { opacity: 0; pointer-events: none; }
.chat:not(:hover):not(:focus-within):not(.open) .chat-search { max-height: 0; min-height: 0; margin: 0; overflow: hidden; }
.chat:not(:hover):not(:focus-within):not(.open) .chat-head { justify-content: center; padding-inline: 4px; }
.chat:not(:hover):not(:focus-within):not(.open) .chat-x { display: none; }
.chat:not(:hover):not(:focus-within):not(.open) .chat-conv { display: none; }
.chat:not(:hover):not(:focus-within):not(.open) .chat-list { display: flex !important; }
.chat:not(:hover):not(:focus-within):not(.open) .chat-item { padding-inline: 8px; }
@media (min-width: 861px) {
  body.has-chat .app { grid-template-columns: var(--rail) minmax(0, 1fr) var(--chat-rail); }
}
@media (max-width: 860px) {
  .chat { top: auto; bottom: 16px; right: 16px; width: 60px; height: 60px; border-radius: 50%; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6); }
  .chat .chat-head { padding: 0; height: 60px; justify-content: center; }
  .chat .chat-title { font-size: var(--text-sm); }
  .chat:not(.open) :is(.chat-search, .chat-list, .chat-conv, .chat-x) { display: none !important; }
  .chat:hover, .chat:focus-within { width: 60px; }
  .chat.open { inset: 0; width: auto; height: auto; border-radius: 0; }
  .chat.open .chat-head { height: auto; padding: var(--s4) 14px var(--s3); justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { .chat { transition: none; } }
.chat-form textarea { height: 40px; min-height: 40px; }

/* ===== Настройки: сотрудники и доступы ===== */
.set-tabs { align-self: flex-start; margin-bottom: var(--s2); }
#drawerBody > .set-tabs { margin-bottom: var(--s4); }
.staff-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.staff-top p { max-width: 60ch; }
.staff-list { display: flex; flex-direction: column; gap: var(--s3); }
.staff-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px var(--s3); align-items: start; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
html[data-design='soft'] .staff-card { background: var(--bg); border: 0; box-shadow: var(--neu-sm); }
.staff-card.off { opacity: .6; }
.staff-card .ico.av { --blob-ink: var(--text); width: 44px; height: 44px; grid-row: span 2; background: var(--surface-3); }
.staff-main b { font-size: var(--text-base); }
.staff-main small { display: block; color: var(--text-3); font-size: var(--text-xs); margin-top: 2px; }
.staff-main small b { font-size: inherit; color: var(--text-2); }
.staff-card .user-actions { grid-column: 2; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.perm-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.perm-chip.edit { background: var(--accent-soft); color: var(--accent); }
.staff-empty { padding: var(--s6); border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text-2); }
.staff-form .perm-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); }
.staff-form .perm-head h3 { font-size: var(--text-base); }
.perm-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.perm-quick .btn { min-height: 30px; padding: 4px 10px; font-size: var(--text-xs); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: var(--s3); }
.perm-group { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s2) var(--s3) var(--s3); margin: 0; min-width: 0; }
html[data-design='soft'] .perm-group { border: 0; box-shadow: var(--neu-in); }
.perm-group legend { font-size: var(--text-xs); font-weight: 800; color: var(--text-3); padding: 0 6px; letter-spacing: .04em; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.perm-row:last-child { border-bottom: 0; }
.perm-row > span { font-size: var(--text-sm); font-weight: 600; }
.perm-row .seg button { padding: 4px 10px; }
.perm-row .seg button[data-pv='view'].on { color: var(--own); }
.perm-row .seg button[data-pv='edit'].on { color: var(--accent); }
.ro-badge { vertical-align: middle; font-size: var(--text-xs); margin-left: 8px; letter-spacing: 0; text-shadow: none; }
.perm-row .seg button[data-pv='none'].on { color: var(--text-2); }
.drawer.xwide { width: min(1120px, 100vw); }
.linkish { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.ip-subtabs { align-self: flex-start; margin-bottom: var(--s4); }
.ip-tab-box { display: flex; flex-direction: column; gap: var(--s4); }
.ip-tab-note { margin: 0; }
.ip-tab-box .card { box-shadow: none; }

/* Большие мониторы: содержимое по центру, шапка выровнена по тем же краям */
.main { margin-inline: auto; }
.topbar { padding-inline: max(var(--s8), calc((100% - 1480px) / 2 + var(--s8))); }
@media (max-width: 860px) { .topbar { padding-inline: var(--s4); } }

/* ===== Программа (PWA): связь, уведомления, установка ===== */
.net-bar { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 0; right: 0; margin-inline: auto; z-index: 80;
  display: flex; align-items: center; gap: var(--s3); width: fit-content; max-width: min(680px, calc(100vw - 32px));
  background: var(--bad-soft, #fdecea); color: var(--bad, #b8322a); border: 1px solid color-mix(in srgb, var(--bad, #b8322a) 30%, transparent);
  padding: 10px 12px 10px 16px; border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: var(--text-sm); }
.net-bar[hidden], .push-ask[hidden] { display: none; }
.net-bar span { flex: 1; } .net-bar .btn { flex: none; }
.push-ask { position: fixed; right: calc(var(--chat-rail, 0px) + 20px); bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); z-index: 75;
  display: grid; grid-template-columns: auto 1fr; gap: 14px 12px; align-items: center; width: min(380px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg, 16px);
  padding: 16px; box-shadow: 0 18px 44px rgba(0,0,0,.2);
  --blob-2: var(--accent-soft); --blob-ink: var(--accent); }
.push-ask .ico svg { stroke-width: 1.7; }
.push-ask span { display: grid; gap: 2px; } .push-ask small { color: var(--text-2); font-size: var(--text-xs); line-height: 1.4; }
.push-ask .app-btns { grid-column: 1 / -1; display: flex; gap: var(--s2); justify-content: flex-end; }
.app-how { margin: var(--s2) 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: var(--text-sm); color: var(--text-2); }
.app-ok { color: var(--good, #23824f); font-weight: 600; margin: 0 0 var(--s2); }
.app-push { margin-top: var(--s3); }
.app-btns { display: flex; gap: var(--s2); flex-wrap: wrap; }
@media (max-width: 860px) { .push-ask { right: 16px; left: 16px; width: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); } }
/* ===== Телефоны (iPhone 15 Pro / Pro Max и др.): без сдвигов вбок и «приближений» ===== */
/* Ничто не должно расширять страницу вбок — иначе iOS даёт её сдвигать и уменьшать */
html, body { overflow-x: hidden; overflow-x: clip; }
.drawer:not(.open) { visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
.drawer.open { visibility: visible; transition: transform .25s ease; }
body { padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 860px) {
  /* iOS приближает страницу, если у поля ввода шрифт меньше 16 px, и не возвращает обратно */
  input, select, textarea { font-size: 16px !important; }
  /* Верхняя панель — ниже «чёлки» и часов в окне программы */
  .sidebar { padding-top: calc(var(--s2) + env(safe-area-inset-top, 0px)); }
  /* Шторка (настройки, детали) — шапка ниже «чёлки», низ — выше полоски «Домой» */
  .drawer { width: 100vw; }
  .drawer-head { padding-top: calc(var(--s5) + env(safe-area-inset-top, 0px)); }
  .drawer-body { padding-bottom: calc(var(--s8) + env(safe-area-inset-bottom, 0px)); }
  .icon-btn#drawerClose { width: 44px; height: 44px; }
  /* Открытый чат: шапка с кнопкой «Свернуть» ниже, под большой палец, поле ввода выше полоски «Домой» */
  .chat.open { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .chat.open .chat-head { padding: 28px 16px 12px; }
  .chat.open .chat-x { width: 44px; height: 44px; }
  .chat.open .chat-x svg { width: 22px; height: 22px; }
  .chat { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(var(--s6) + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
}

/* Разделитель перед служебным пунктом «Загрузка CDS» */
.nav-sep { border: 0; border-top: 1px solid color-mix(in srgb, var(--sidebar-text) 22%, transparent); margin: 6px 10px; }
.nav-sep[hidden], body.ip-mode .nav-sep { display: none; }
@media (max-width: 860px) { .nav-sep { display: none; } }

/* ===== Чат: ответы на сообщения и смайлики ===== */
.msg { position: relative; transition: transform .15s ease; }
.msg:focus { outline: none; }
.msg:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.msg-reply { position: absolute; top: 50%; right: -38px; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer; background: var(--surface); color: var(--text-2); box-shadow: 0 2px 8px rgba(0,0,0,.14);
  opacity: 0; pointer-events: none; transition: opacity .15s; }
.msg.mine .msg-reply { right: auto; left: -38px; }
.msg-reply svg, .chat-reply > svg, .chat-emoji svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.msg:hover .msg-reply, .msg:focus-within .msg-reply, .msg:focus .msg-reply { opacity: 1; pointer-events: auto; }
.msg-reply:hover { color: var(--accent); }
.chat-msgs { padding-inline: 46px; }
@media (max-width: 860px) { .chat-msgs { padding-inline: 14px 42px; } .msg-reply { right: -36px; } .msg.mine .msg-reply { left: -36px; } }
/* Цитата внутри сообщения */
.msg-quote { display: grid; gap: 1px; width: 100%; min-width: 120px; text-align: left; margin: 0 0 5px; padding: 4px 8px; border: 0; border-left: 3px solid var(--accent);
  border-radius: 6px; background: color-mix(in srgb, var(--accent) 9%, transparent); color: inherit; font: inherit; cursor: pointer; }
.msg-quote b { font-size: var(--text-xs); color: var(--accent); }
.msg-quote span { font-size: var(--text-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.msg.flash { animation: msgFlash 1.4s ease; }
@keyframes msgFlash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 1px 2px rgba(0,0,0,.08); } }
/* Сообщение только из смайликов — крупно, без «пузыря» */
.msg.msg-emoji { background: none !important; box-shadow: none !important; padding: 0 2px; }
.msg.msg-emoji p { font-size: 40px; line-height: 1.15; }
/* Полоска «Ответ на…» над полем ввода */
.chat-reply { display: flex; align-items: center; gap: 10px; padding: 8px 12px 0 16px; color: var(--accent); }
.chat-reply > div { flex: 1; min-width: 0; display: grid; border-left: 3px solid var(--accent); padding: 2px 0 2px 9px; }
.chat-reply b { font-size: var(--text-xs); }
.chat-reply span { font-size: var(--text-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--text-2); font-size: 18px; line-height: 1; cursor: pointer; flex-shrink: 0; }
:root:not([data-design='soft']) .chat-reply { background: rgba(240, 244, 238, .95); }
:root[data-theme='dark']:not([data-design='soft']) .chat-reply { background: rgba(12, 26, 19, .92); }
html[data-design='soft'] .chat-reply { background: color-mix(in srgb, var(--bg) 92%, transparent); }
/* Кнопка и панель смайликов */
.chat-conv { position: relative; }
.chat-emoji { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--surface-3); color: var(--text-2); }
.chat-emoji svg { width: 20px; height: 20px; }
.chat-emoji.on, .chat-emoji:hover { color: var(--accent); }
html[data-design='soft'] .chat-emoji { background: var(--bg); box-shadow: var(--neu-sm); }
.chat-form { gap: 6px; }
.emoji-pop { position: absolute; left: 10px; right: 10px; bottom: 70px; z-index: 5; max-height: 300px; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.35); overflow: hidden; }
.emoji-pop[hidden] { display: none; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.emoji-tabs button { flex: none; width: 34px; height: 32px; border: 0; border-radius: 8px; background: none; font-size: 18px; cursor: pointer; opacity: .55; }
.emoji-tabs button[aria-selected='true'] { background: var(--surface-3); opacity: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.emoji-grid button { height: 38px; border: 0; border-radius: 8px; background: none; font-size: 24px; line-height: 1; cursor: pointer; padding: 0; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--surface-3); }
.chat-reply:not([hidden]) ~ .emoji-pop { bottom: 112px; }
.chat-reply[hidden] { display: none; }

/* ===== Групповые чаты ===== */
.chat-newgroup[hidden] { display: none !important; }
.chat-head { gap: 6px; }
.chat-head .chat-title { margin-right: auto; }
.ico.av.grp svg { width: 20px; height: 20px; fill: none; stroke: var(--blob-ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico.av.sm.grp svg { width: 16px; height: 16px; }
.chat-item-text small.sys { font-style: italic; }
.chat-with.link { cursor: pointer; border-radius: 10px; padding: 2px 6px; margin-left: -6px; }
.chat-with.link:hover small, .chat-with.link:focus-visible small { text-decoration: underline; }
.chat-with.link:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); }
/* Имя автора в группе и служебные сообщения */
.msg-from { display: block; font-size: var(--text-xs); font-weight: 800; margin-bottom: 2px; color: var(--accent); }
.msg-from.b2 { color: #b0613a; } .msg-from.b3 { color: #4f6fb0; }
:root[data-theme='dark'] .msg-from.b2 { color: #e39b74; } :root[data-theme='dark'] .msg-from.b3 { color: #8fb0ef; }
.chat-sys { align-self: center; max-width: 88%; text-align: center; font-size: var(--text-xs); color: var(--text-2); background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 10px; padding: 4px 10px; margin: 4px 0; }
/* Создание группы и состав */
.grp-form { display: flex; flex-direction: column; gap: var(--s4); }
.grp-form .field > span { display: block; margin-bottom: 6px; }
.mp { display: flex; flex-direction: column; gap: 8px; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }
.mp-chip { border: 0; border-radius: 999px; padding: 5px 10px; background: var(--accent-soft); color: var(--accent); font: inherit; font-size: var(--text-xs); font-weight: 700; cursor: pointer; }
.mp-search { width: 100%; }
.mp-list { max-height: 320px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px; }
.mp-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.mp-row:hover { background: var(--surface-2); }
.mp-row input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.mp-row span, .grp-member span { display: grid; min-width: 0; }
.mp-row small, .grp-member small { color: var(--text-3); font-size: var(--text-xs); }
.mp-row .ico.av, .grp-member .ico.av { --blob-ink: var(--text); }
.grp-members { display: flex; flex-direction: column; gap: 6px; }
.grp-member { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.grp-member span { flex: 1; }
.grp-danger { display: flex; gap: var(--s2); flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: var(--s4); }
#grpAddBtn { align-self: flex-start; margin-top: var(--s2); }
.mp-row .ico.av, .grp-member .ico.av { background: var(--surface-3); width: 36px; height: 36px; }

/* ===== Чат: реакции ===== */
.msg-acts { position: absolute; top: 50%; right: -38px; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.msg.mine .msg-acts { right: auto; left: -38px; }
.msg-acts .msg-reply { position: static; transform: none; opacity: 1; pointer-events: auto; }
.msg:hover .msg-acts, .msg:focus-within .msg-acts, .msg:focus .msg-acts { opacity: 1; pointer-events: auto; }
@media (max-width: 860px) { .msg-acts { right: -36px; } .msg.mine .msg-acts { left: -36px; } }
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; }
.msg-reacts:not(:empty) { margin-top: 4px; }
.react-chip { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; line-height: 1; cursor: pointer; color: var(--text-2); }
.react-chip b { font-size: 11px; font-weight: 800; }
.react-chip.mine { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); color: var(--accent); }
.msg.msg-emoji .msg-reacts { justify-content: flex-start; }
.react-bar { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 6; display: flex; gap: 2px; padding: 4px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 28px -8px rgba(0,0,0,.35); animation: rbIn .14s ease; }
.msg.mine .react-bar { left: auto; right: 0; }
.react-bar button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; font-size: 22px; line-height: 1; cursor: pointer; transition: transform .12s; }
.react-bar button:hover, .react-bar button:focus-visible { transform: scale(1.22); background: var(--surface-3); }
@keyframes rbIn { from { opacity: 0; transform: translateY(6px) scale(.95); } to { opacity: 1; transform: none; } }

/* ===== Кнопка «Excel» в шапке карточки ===== */
.card-head { flex-wrap: wrap; }
.xl-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: var(--text-xs); font-weight: 700; cursor: pointer; margin-left: auto; flex-shrink: 0; order: 99; }
.xl-btn svg { width: 16px; height: 16px; fill: none; stroke: #1f7a45; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.xl-btn:hover { color: var(--text); border-color: var(--border-strong); }
.xl-btn:disabled { opacity: .55; cursor: progress; }
html[data-design='soft'] .xl-btn { background: var(--bg); border: 0; box-shadow: var(--neu-sm); }
@media print { .xl-btn { display: none; } }
.tol-field { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-2); font-weight: 600; white-space: nowrap; }
.tol-field input { width: 64px; height: 34px; text-align: center; }
.obj-item small.stale { color: #e0a24a; font-weight: 700; }
html[data-design='soft'] .obj-item small.stale { color: #b5671f; }

/* ===== Журнал действий ===== */
.audit-tools { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.audit-tools input { flex: 1; min-width: 200px; }
.audit-list { display: flex; flex-direction: column; }
.audit-day { font-size: var(--text-xs); font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: var(--s3) 0 var(--s1); }
.audit-row { display: grid; grid-template-columns: 48px 190px 170px minmax(0, 1fr); gap: var(--s3); align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.audit-row time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.audit-who { display: grid; } .audit-who small { color: var(--text-3); font-size: var(--text-xs); }
.audit-sec { color: var(--accent); font-weight: 700; font-size: var(--text-xs); }
.audit-act { overflow-wrap: anywhere; }
.audit-note { margin-top: var(--s3); }
#auMore { margin-top: var(--s3); }
@media (max-width: 860px) { .audit-row { grid-template-columns: 44px minmax(0, 1fr); } .audit-sec, .audit-act { grid-column: 2; } }

/* ===== Чистая прибыль и сравнение периодов ===== */
.net-top { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-bottom: var(--s3); }
.net-top > div { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); }
.net-top b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.net-top small { font-size: var(--text-xs); color: var(--text-2); }
.net-top .muted { font-size: var(--text-xs); }
html[data-design='soft'] .net-top > div { background: var(--bg); box-shadow: var(--neu-in); }
.pos { color: var(--good); } .neg { color: var(--bad); } .neg-soft { color: var(--text-2); }
.net-pl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.net-pl td { padding: 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.net-pl td small { display: block; color: var(--text-3); font-size: var(--text-xs); }
.net-pl td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.net-pl tr.total td { font-weight: 800; border-bottom: 0; padding-top: 10px; }
.net-cats { margin-top: var(--s3); }
.net-cats summary { cursor: pointer; font-weight: 700; font-size: var(--text-sm); color: var(--accent); }
.np-bars { display: grid; gap: 6px; margin-top: var(--s2); }
.np-bar { display: grid; grid-template-columns: 170px 1fr 110px; gap: 8px; align-items: center; font-size: var(--text-xs); }
.np-bar i { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.np-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.net-note { margin-top: var(--s3); font-size: var(--text-xs); }
.cmp-mode { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--text-2); margin-bottom: var(--s3); }
.cmp-why { margin: 0 0 var(--s3); padding-left: 18px; display: grid; gap: 6px; font-size: var(--text-sm); }
.cmp-why li.w-down::marker { color: var(--bad); } .cmp-why li.w-up::marker { color: var(--good); }
table.cmp td.cmp-d { white-space: nowrap; }
table.cmp td.cmp-d b { font-variant-numeric: tabular-nums; }
table.cmp td.cmp-d small { display: block; font-size: 11px; }
@media (max-width: 520px) { .net-top { grid-template-columns: 1fr; } .np-bar { grid-template-columns: 110px 1fr 90px; } }
table.cmp th, table.cmp td { padding-left: 8px; padding-right: 8px; }
table.cmp th { white-space: nowrap; }
table.cmp td:first-child { padding-left: 0; }

/* ===== Документы и сроки ===== */
table.docs td { vertical-align: top; }
table.docs .badge { white-space: nowrap; }
table.docs tr.doc-expired td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
table.docs tr.doc-soon td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.nowrap { white-space: nowrap; }

/* ===== Календарь платежей ===== */
.pc-bal { display: flex; gap: 6px; margin: 6px 0 2px; }
.pc-bal input { flex: 1; min-width: 0; font-size: 20px; font-weight: 800; height: 42px; }
.pc-list { display: flex; flex-direction: column; gap: var(--s3); }
.pc-day { display: grid; gap: 6px; }
.pc-dh { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); font-size: var(--text-sm); padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.pc-dh span { font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.pc-ev { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 4px; border-radius: 10px; }
.pc-ev:hover { background: var(--surface-2); }
.pc-ic { font-size: 18px; text-align: center; }
.pc-t { display: grid; min-width: 0; } .pc-t b { font-size: var(--text-sm); } .pc-t small { font-size: var(--text-xs); color: var(--text-3); }
.pc-sum { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; min-width: 120px; }
.pc-ev.st-paid { opacity: .65; }
.pc-side { display: flex; flex-direction: column; gap: var(--s4); }
.pc-items { display: flex; flex-direction: column; gap: 6px; }
.pc-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pc-item span { display: grid; } .pc-item small { font-size: var(--text-xs); color: var(--text-3); } .pc-item.off { opacity: .55; }
.pc-days { display: grid; gap: 8px; }
.pc-days label { display: grid; grid-template-columns: 1fr auto 64px auto; gap: 6px; align-items: center; font-size: var(--text-sm); }
.pc-days label span { font-size: var(--text-xs); color: var(--text-3); }
.pc-days input { height: 34px; text-align: center; }
.pc-days .btn { justify-self: start; margin-top: 4px; }
.pc-months { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: var(--text-sm); }
.pc-months label { display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 520px) { .pc-ev { grid-template-columns: 24px minmax(0, 1fr) auto; } .pc-ev .badge { grid-column: 2; justify-self: start; } .pc-sum { grid-row: 1; grid-column: 3; min-width: 0; } .pc-days label { grid-template-columns: 1fr 56px; } .pc-days label span { display: none; } }
.dg-when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--text-sm); margin: 6px 0 10px 26px; }
.dg-prev { margin-top: var(--s3); max-height: 380px; overflow: auto; white-space: pre-wrap; }
.chat-form[hidden] { display: none !important; }
.chat-msgs.bot .msg-acts { display: none; } .chat-msgs.bot .msg { max-width: 94%; } .chat-msgs.bot .msg p { font-size: 13px; }

/* ===== Мой парк ===== */
.fl-tabs { flex-wrap: wrap; }
.fl-tools { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s4); }
.fl-tools input[type=search] { flex: 1; min-width: 180px; max-width: 320px; }
.fl-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--s4); }
.fl-car { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
html[data-design='soft'] .fl-car { background: var(--bg); border: 0; box-shadow: var(--neu-sm); }
.fl-car.off { opacity: .6; }
.fl-car header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.fl-car header small { display: block; color: var(--text-3); font-size: var(--text-xs); margin-top: 2px; }
.fl-plate { display: inline-block; font-size: 17px; font-weight: 800; letter-spacing: .04em; padding: 2px 8px; border: 2px solid var(--text); border-radius: 6px; background: var(--surface); }
.fl-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fl-facts span { display: grid; font-size: var(--text-xs); color: var(--text-3); }
.fl-facts b { font-size: var(--text-sm); color: var(--text); font-variant-numeric: tabular-nums; }
.fl-facts small { font-size: 11px; }
.fl-due { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fl-due li { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; font-size: var(--text-sm); }
.fl-due li small { grid-column: 2; color: var(--text-3); font-size: var(--text-xs); }
.fl-due li .badge { min-width: 92px; justify-content: center; text-align: center; }
.fl-due li.st-ok, .fl-due li.st-unknown { opacity: .75; }
.fl-docs { font-size: var(--text-xs); color: var(--text-2); }
.fl-docs .warn-t { color: var(--warn); font-weight: 700; } .fl-docs .neg { font-weight: 700; }
.fl-car footer { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.fl-car footer .btn { height: 32px; padding: 0 10px; font-size: var(--text-xs); }
table.fl-log td { vertical-align: top; } table.fl-log tr.fl-ip td { color: var(--text-3); }
.fl-next summary { cursor: pointer; font-size: var(--text-sm); color: var(--accent); font-weight: 700; }
.fl-next .emp-form { margin-top: 8px; }
.fl-costs h3, .fl-h3 { font-size: var(--text-sm); margin: 0 0 var(--s3); }
.fl-h3 { margin-top: var(--s5); }
.fl-odo { display: grid; gap: 4px; }
.fl-odo > div { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 8px; font-size: var(--text-sm); padding: 4px 0; border-bottom: 1px solid var(--border); }
.fl-odo .btn { height: 26px; width: 26px; padding: 0; justify-content: center; }
@media (max-width: 520px) { .fl-cars { grid-template-columns: 1fr; } .fl-facts { grid-template-columns: 1fr 1fr; } }
.fl-unknown { margin: 0; font-size: var(--text-xs); color: var(--text-3); }

/* ===================================================================
   Телефон: мягкий «приложенческий» стиль, нижняя панель и шторка
   =================================================================== */
.mbar, .msheet, .msheet-back { display: none; }
@media (max-width: 860px) {
  :root { --mbar-h: 66px; --m-radius: 22px; }
  /* отступ снизу у самого контента: последняя карточка прокручивается выше нижней панели */
  .main { padding-bottom: calc(var(--mbar-h) + 34px + env(safe-area-inset-bottom, 0px)) !important; }
  /* верхняя полоса с иконками больше не нужна — разделы в нижней панели */
  .app > .sidebar { display: none !important; }
  .chat:not(.open) { display: none !important; }

  /* Шапка — карточка с картинкой, всё по центру */
  .topbar { margin: calc(8px + env(safe-area-inset-top, 0px)) 12px 0; border-radius: 26px; padding: 18px 16px 16px !important; text-align: center;
    background-position: center center !important; background-size: cover !important; overflow: hidden; }
  .topbar-title { display: flex; flex-direction: column; align-items: center; width: 100%; }
  .topbar h1 { font-size: 24px; letter-spacing: -.01em; }
  .topbar #periodLine { font-size: 12px; max-width: 34ch; margin-inline: auto; }
  .topbar .demo-note { font-size: 11px; margin-inline: auto; }
  .topbar-controls { justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: nowrap; }
  .field-inline { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: stretch; gap: 4px; text-align: center; font-size: 10px; }
  .field-inline[hidden] { display: none; }
  .field-inline select { height: 40px; border-radius: 14px; text-align: center; text-align-last: center; padding: 0 10px; width: 100%; }
  html[data-design='soft'] .topbar { box-shadow: var(--neu); border: 0; }

  /* Карточки — крупные скругления, мягкие тени, иконки по центру */
  .main { padding-top: 14px !important; padding-left: 12px !important; padding-right: 12px !important; }
  .card, .alert { border-radius: var(--m-radius) !important; }
  .card-head { justify-content: center; text-align: center; gap: 8px; }
  .card-head h2 { width: 100%; text-align: center; }
  .card-head > .muted { width: 100%; text-align: center; }
  .card-head .emp-tools, .card-head .seg { margin-inline: auto; justify-content: center; }
  .xl-btn { margin-inline: auto; }
  .kpi { text-align: center; }
  .kpi .kpi-label { justify-content: center; gap: 8px; }
  .kpi .kpi-sub { justify-content: center; gap: 6px; flex-wrap: wrap; }
  .alert { font-size: 13px; padding: 12px 14px; }
  .ico { place-items: center; }
  .ico svg { display: block; margin: auto; }

  /* Нижняя панель */
  .mbar:not([hidden]) { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; z-index: 60;
    left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); height: var(--mbar-h); padding: 0 6px 6px;
    border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 14px 34px -14px rgba(10, 25, 20, .45); }
  html[data-design='soft'] .mbar { background: var(--bg); border: 0; box-shadow: var(--neu); }
  :root[data-theme='dark'] .mbar { background: var(--surface-2); }
  .mb-i { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px; border: 0; background: none; color: var(--text-3);
    font: inherit; font-size: 10.5px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mb-ic { display: grid; place-items: center; width: 40px; height: 30px; border-radius: 12px; transition: background .2s, color .2s; }
  .mb-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
  .mb-i.on { color: var(--accent); } .mb-i.on .mb-ic { background: var(--accent-soft); }
  .mb-i span { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mb-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10px; line-height: 18px; text-align: center; }
  .mb-menu { justify-self: center; align-self: start; width: 62px; height: 62px; margin-top: -24px; border-radius: 50%; border: 5px solid var(--bg); background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent) 75%, #000); transition: transform .25s; -webkit-tap-highlight-color: transparent; }
  .mb-menu i { display: grid; place-items: center; }
  .mb-menu svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; display: block; transition: transform .3s; }
  .mb-menu.on svg { transform: rotate(45deg); }
  html[data-design='soft'] .mb-menu { border-color: var(--bg); box-shadow: var(--neu-acc); }

  /* Шторка со всеми разделами — выезжает на половину экрана */
  .msheet-back:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 61; background: rgba(8, 18, 14, .42); backdrop-filter: blur(2px); animation: msFade .2s ease; }
  .msheet { display: flex; flex-direction: column; position: fixed; z-index: 62; left: 0; right: 0; bottom: 0; max-height: 62vh; min-height: 46vh;
    border-radius: 28px 28px 0 0; background: var(--surface); box-shadow: 0 -18px 40px -16px rgba(0, 0, 0, .35);
    padding-bottom: calc(var(--mbar-h) + 22px + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
  .msheet.open { transform: translateY(0); }
  html[data-design='soft'] .msheet { background: var(--bg); }
  .msheet-grip { display: grid; place-items: center; padding: 10px 0 2px; }
  .msheet-grip i { width: 44px; height: 5px; border-radius: 3px; background: var(--border-strong); }
  .msheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 8px; }
  .ms-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 6px 0 10px; }
  .ms-head b { font-size: 17px; }
  .ms-x { position: absolute; right: 0; top: 2px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; }
  .ms-objs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
  .ms-objs button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; }
  .ms-objs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .ms-group h4 { margin: 12px 0 8px; text-align: center; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
  .ms-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 0; }
  .ms-grid > .ms-tile { width: 25%; }
  .ms-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; padding: 8px 2px; border: 0; border-radius: 18px; background: none;
    color: var(--text); font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .ms-ic { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--surface-2); color: var(--text-2); transition: transform .15s; }
  html[data-design='soft'] .ms-ic { background: var(--bg); box-shadow: var(--neu-sm); }
  .ms-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: block; }
  .ms-tile:active .ms-ic { transform: scale(.94); }
  .ms-tile.on .ms-ic { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 18px -10px var(--accent); }
  .ms-tile.on { color: var(--accent); }
  .ms-foot { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
  .ms-act { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; }
  .ms-act i { display: grid; place-items: center; } .ms-act svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; display: block; }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .mbar { z-index: 64; }

  /* Что было прижато к низу — выше нижней панели */
  .toast { bottom: calc(var(--mbar-h) + 26px + env(safe-area-inset-bottom, 0px)) !important; }
  .push-ask { bottom: calc(var(--mbar-h) + 26px + env(safe-area-inset-bottom, 0px)) !important; }
  .chat.open { z-index: 70; }
}
@keyframes msFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .msheet, .mb-menu svg { transition: none; } }
@media (max-width: 860px) {
  .grid.g-rt { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .grid.g-rt > .kpi { padding: 14px 10px; }
  .grid.g-rt .kpi-value { font-size: 24px; }
  .grid.g-rt .kpi-label { font-size: 10px; flex-wrap: wrap; }
  .grid.g-rt .kpi-sub { font-size: 11px; }
  .grid.g-rt .badge { font-size: 9px; }
}

/* Телефон: чат и карточки — отдельным экраном, страница под ними зафиксирована */
@media (max-width: 860px) {
  body.scroll-lock { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
  body.chat-page .mbar, body.chat-page .push-ask { display: none !important; }
  .chat.open { position: fixed; inset: 0; width: 100% !important; height: 100% !important; border-radius: 0 !important; animation: chatIn .26s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
  .chat.open .chat-msgs { overscroll-behavior: contain; }
  .drawer { z-index: 66 !important; } .drawer-backdrop { z-index: 65 !important; }
}
@keyframes chatIn { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .chat.open { animation: none; } }

/* ---------- Общие мелочи для новых разделов ---------- */
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: var(--text-xs); }
.btn.warn-b { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); color: var(--warn); background: var(--warn-soft); }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); cursor: pointer; }
.chk input { width: 16px !important; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.emp-form .field.chk { flex-direction: row; align-items: center; align-self: end; padding-bottom: 8px; }
.fl-plate.sm { font-size: 13px; padding: 1px 6px; border-width: 1.5px; }
.grow { flex: 1; }
.warn-t { color: var(--warn); }

/* ---------- Выплаты ИП ---------- */
.po-hint { margin: 0 0 var(--s3); font-size: var(--text-sm); }
.po-table td { vertical-align: middle; }
.po-table tr.on td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.po-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.po-amt { width: 120px; text-align: right; font-variant-numeric: tabular-nums; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-weight: 700; }
.po-foot { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--border); }
.po-foot .field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-3); font-weight: 600; }
.po-foot .field input { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); font: inherit; color: var(--text); width: 170px; }
.po-sum { display: flex; flex-direction: column; margin-left: auto; text-align: right; font-size: var(--text-xs); color: var(--text-3); }
.po-sum b { font-size: var(--text-lg); color: var(--text); font-variant-numeric: tabular-nums; }
.po-hist { margin-top: var(--s3); font-size: var(--text-sm); color: var(--text-2); }
.po-hist summary { cursor: pointer; font-weight: 700; }
.po-hist ul { margin: var(--s2) 0 0; padding-left: 18px; }

/* ---------- Расчётный лист ---------- */
.slip-actions { display: flex; justify-content: flex-end; margin-bottom: var(--s3); }
.slip { font-size: var(--text-sm); }
.slip-h { display: flex; justify-content: space-between; gap: var(--s4); padding-bottom: var(--s3); border-bottom: 2px solid var(--text); margin-bottom: var(--s3); }
.slip-h h3 { margin: 2px 0 4px; font-size: var(--text-xl); }
.slip-h p { margin: 0; color: var(--text-2); }
.slip-h small, .slip-per small { color: var(--text-3); display: block; }
.slip-per { text-align: right; white-space: nowrap; }
.slip-kpi { display: flex; flex-wrap: wrap; gap: var(--s5); margin: var(--s3) 0 var(--s4); }
.slip-kpi span { color: var(--text-3); font-size: var(--text-xs); }
.slip-kpi b { display: block; color: var(--text); font-size: var(--text-base); font-variant-numeric: tabular-nums; }
.slip-kpi .slip-total b { font-size: var(--text-lg); color: var(--accent); }
.slip-t { width: 100%; border-collapse: collapse; }
.slip-t th, .slip-t td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.slip-t th { font-size: var(--text-xs); color: var(--text-3); }
.slip-t .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slip-t td small { display: block; color: var(--text-3); font-size: var(--text-xs); }
.slip-t tfoot td { font-weight: 800; border-top: 2px solid var(--text); border-bottom: 0; }
.slip h4 { margin: var(--s5) 0 var(--s2); }
.slip-items { list-style: none; margin: 0; padding: 0; }
.slip-items li { display: grid; grid-template-columns: 90px 1fr 2fr 120px; gap: var(--s2); padding: 5px 0; border-bottom: 1px dashed var(--border); }
.slip-items li b { text-align: right; font-variant-numeric: tabular-nums; }
.slip-f { margin-top: var(--s4); color: var(--text-3); font-size: var(--text-xs); }
.slip-list .slip-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.slip-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); text-align: left; }
.slip-chip span { font-size: var(--text-xs); color: var(--text-3); }
.slip-chip b { font-variant-numeric: tabular-nums; }
.slip-chip.new { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 640px) {
  .slip-h { flex-direction: column; } .slip-per { text-align: left; }
  .slip-t { font-size: var(--text-xs); } .slip-items li { grid-template-columns: 70px 1fr; } .slip-items li span:nth-child(3) { grid-column: 1 / -1; color: var(--text-3); }
  .po-sum { margin-left: 0; text-align: left; width: 100%; } .po-foot .btn.primary { width: 100%; }
}

/* ---------- Штрафы ---------- */
.fn-list { display: flex; flex-direction: column; gap: var(--s2); }
.fn-item { display: grid; grid-template-columns: minmax(220px, 1.3fr) 130px minmax(220px, 1.6fr) auto; gap: var(--s4); align-items: center; padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.fn-item.st-new, .fn-item.st-assigned { border-left: 3px solid var(--warn); }
.fn-item.st-deducted { border-left: 3px solid var(--good); }
.fn-top { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.fn-meta { font-size: var(--text-xs); color: var(--text-2); margin-top: 4px; }
.fn-sum { text-align: right; font-variant-numeric: tabular-nums; }
.fn-sum b { font-size: var(--text-base); } .fn-sum small { display: block; color: var(--text-3); font-size: var(--text-xs); }
.fn-who > span { font-weight: 700; } .fn-who > small { display: block; color: var(--text-3); font-size: var(--text-xs); }
.fn-sug { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.fn-sug .chip { flex-direction: column; align-items: flex-start; gap: 0; border-radius: var(--r-md); padding: 6px 10px; text-align: left; font: inherit; font-weight: 700; color: var(--text); }
.fn-sug .chip small { font-size: 11px; }
.fn-sug .chip.on, .fn-sug .chip:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.fn-bank td { vertical-align: middle; }
@media (max-width: 860px) {
  .fn-item { grid-template-columns: 1fr auto; gap: var(--s2) var(--s3); }
  .fn-who { grid-column: 1 / -1; } .fn-act { grid-column: 1 / -1; } .fn-act .btn { width: 100%; }
}

/* ---------- Дебиторка ---------- */
.rv-aging { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.rv-aging div { position: relative; padding-bottom: 10px; }
.rv-aging small { display: block; color: var(--text-3); font-size: var(--text-xs); }
.rv-aging b { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.rv-aging i { position: absolute; left: 0; bottom: 0; height: 4px; border-radius: 4px; background: var(--bad); min-width: 0; }
.rv-t tr.rv-overdue td, .rv-t tr.rv-overdue_partial td { background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
.rv-t tr.rv-paid td { color: var(--text-2); }
.rv-payers { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; max-height: 260px; overflow: auto; }
.rv-payers .chk { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.rv-payers .chk small { display: block; color: var(--text-3); font-size: var(--text-xs); }
@media (max-width: 640px) { .rv-aging { grid-template-columns: 1fr; gap: var(--s2); } }

/* ---------- Топливо ППР ---------- */
.fu-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.fu-kpis span { padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-3); }
.fu-kpis b { display: block; font-size: var(--text-lg); color: var(--text); font-variant-numeric: tabular-nums; }
.fu-kpis small { display: block; }
.fu-kpis .warn-t b { color: var(--warn); }
.fu-note { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--warn-soft); color: var(--text-2); font-size: var(--text-sm); }
.fu-t tr.fu-flag td { background: color-mix(in srgb, var(--warn-soft) 60%, transparent); }
.fu-in { width: 150px; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); font: inherit; }
.fu-up { position: relative; }
.fu-empty { max-width: 620px; padding: var(--s4) 0; }
.fu-empty h3 { margin: 0 0 var(--s2); }
.fu-last { margin-top: var(--s3); font-size: var(--text-xs); }
@media (max-width: 860px) { .fu-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fu-kpis span:last-child { grid-column: 1 / -1; } }
.po-table th, .po-table td { padding-left: 8px; padding-right: 8px; }
.po-table .po-amt { width: 104px; }
.po-ok { color: var(--good); }

/* ---------- Пробеги и заказы B2B / B2C ---------- */
.ktag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.ktag.b2b { background: color-mix(in srgb, var(--b2b) 16%, transparent); color: var(--b2b); }
.ktag.b2c { background: color-mix(in srgb, var(--b2c) 16%, transparent); color: var(--b2c); }
.ml-types { margin-top: var(--s4); }
.ml-share { min-width: 110px; }
.ml-share small { font-size: 11px; color: var(--text-3); }
.ml-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin-bottom: 3px; }
.ml-bar i { display: block; }
.ml-mix { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.ml-mix > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s3); display: flex; flex-direction: column; gap: 2px; }
.ml-mix span { font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.ml-mix b { font-size: var(--text-lg, 18px); font-variant-numeric: tabular-nums; }
.ml-mix small { font-size: 11px; color: var(--text-3); }
table.ml td, table.ml th { white-space: nowrap; }
/* Рентабельность: убыточные строки */
table.pf tr.pf-loss td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
table.pf td small.drv-sub { white-space: normal; }
.fl-facts { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }

/* ---------- Договоры с ИП (скрепка в реквизитах) ---------- */
svg.clip { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ct-box { border: 1px dashed var(--border); border-radius: var(--r-md); padding: var(--s3); background: var(--surface-2); }
.ct-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.ct-add { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.ct-add.busy { opacity: .55; pointer-events: none; }
.ct-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ct-list li { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 8px; }
.ct-ico { flex: none; font-size: 10px; font-weight: 800; letter-spacing: .03em; color: var(--accent); border: 1.5px solid currentColor; border-radius: 4px; padding: 2px 4px; }
.ct-name { flex: 1; min-width: 0; display: grid; }
.ct-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.ct-name small { font-size: 11px; color: var(--text-3); }
.ct-del.danger { color: var(--bad); border-color: var(--bad); }
.po-clip { margin-left: 6px; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 2px; font-size: 11px; font-weight: 700; vertical-align: middle; }
@media (max-width: 520px) { .ct-list li { flex-wrap: wrap; } .ct-name { flex-basis: calc(100% - 50px); } }

.login-sub { margin: calc(-1 * var(--s3)) 0 0; font-size: var(--text-sm); }

/* ---------- Команда: карточки сотрудников ---------- */
.tm-tools { display: flex; gap: var(--s3); margin-bottom: var(--s4); }
.tm-tools input { flex: 1; max-width: 420px; }
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--s4); }
.tm-card { padding: var(--s5); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.tm-card:hover, .tm-card:focus-visible { transform: translateY(-2px); }
.tm-card.me { box-shadow: inset 0 0 0 2px var(--accent); }
.tm-av { --c: var(--accent); width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex: none; overflow: hidden;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--c); font-weight: 800; font-size: 28px; letter-spacing: .02em; }
.tm-av.b1 { --c: var(--own); } .tm-av.b2 { --c: var(--accent); } .tm-av.b3 { --c: var(--good); }
.tm-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tm-av.lg { width: 112px; height: 112px; font-size: 38px; }
.tm-who { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tm-who b { font-size: var(--text-lg); line-height: 1.2; }
.tm-who .badge { margin-top: 2px; }
.tm-pos { font-size: var(--text-sm); color: var(--accent); font-weight: 700; }
.tm-duties { margin: 0; font-size: var(--text-sm); color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tm-contacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: var(--text-sm); }
.tm-contacts a { color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
.tm-contacts a:hover { color: var(--accent); }
.tm-actions { display: flex; gap: var(--s2); margin-top: auto; padding-top: var(--s2); }
.tm-bday { align-items: center; }
.tm-cake { font-size: 26px; }
.tm-full { display: flex; gap: var(--s4); align-items: center; margin-bottom: var(--s4); }
.tm-full-who h3 { margin: 0; }
.tm-full-who p { margin: 6px 0 0; color: var(--text-2); }
.tm-dl { display: grid; gap: 0; margin: 0 0 var(--s4); border-top: 1px solid var(--border); }
.tm-dl > div { display: grid; grid-template-columns: 150px 1fr; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--border); }
.tm-dl dt { color: var(--text-3); font-size: var(--text-sm); }
.tm-dl dd { margin: 0; }
.tm-dl a { color: var(--accent); text-decoration: none; }
.tm-about h4 { margin: 0 0 6px; }
.tm-about p { margin: 0 0 var(--s4); white-space: normal; }
.tm-photo-edit { display: flex; gap: var(--s4); align-items: center; margin-bottom: var(--s4); }
.tm-photo-edit > div { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.tm-photo-edit small { flex-basis: 100%; }
.tm-photo-edit label.btn { cursor: pointer; }
#chatWithBox.link { cursor: pointer; }
@media (max-width: 520px) { .tm-full { flex-direction: column; text-align: center; } .tm-dl > div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Быстрый поиск ⌘K ---------- */
.qs-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-3); font-size: var(--text-sm); cursor: pointer; min-width: 180px; }
.qs-btn:hover { color: var(--text); border-color: var(--accent); }
.qs-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.qs-btn span { flex: 1; text-align: left; }
.qs-btn[hidden] { display: none; }
.qs kbd, .qs-btn kbd { font: 600 11px/1 var(--font, inherit); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-3); }
.qs { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 14, 20, .45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.qs[hidden] { display: none; }
.qs-box { width: min(640px, 100%); max-height: 75vh; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.qs-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-strong); }
.qs-in svg { width: 20px; height: 20px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; flex: none; }
.qs-in input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--text); padding: 4px 0; min-width: 0; box-shadow: none; }
.qs-list { overflow-y: auto; padding: 6px; }
.qs-group { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 10px 10px 4px; }
.qs-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.qs-item.on { background: var(--accent-soft); }
.qs-item svg { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.qs-item.on svg { stroke: var(--accent); }
.qs-item span { display: flex; flex-direction: column; min-width: 0; }
.qs-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-item small { color: var(--text-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-empty { color: var(--text-3); padding: 18px 12px; margin: 0; }
.qs-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border-strong); color: var(--text-3); font-size: var(--text-xs); }
.qs-foot kbd { margin-right: 3px; }
@media (max-width: 860px) {
  .qs-btn { min-width: 0; flex: none; padding: 6px 10px; }
  .qs-btn span, .qs-btn kbd { display: none; }
  .qs { padding: 12px 8px; }
  .qs-box { max-height: calc(100dvh - 24px); }
  .qs-foot { display: none; }
}

/* Топливо: строки-ссылки и фильтр по водителю */
.fu-row-link { cursor: pointer; }
.fu-row-link:hover td { background: var(--surface-2); }
.fu-drvf { white-space: nowrap; }

/* Копия базы */
.bk-form { margin-top: var(--s2); }
.bk-help { margin: -6px 0 0; font-size: var(--text-xs); }
.bk-hist summary { cursor: pointer; font-size: var(--text-sm); color: var(--text-2); }
.bk-hist ul { margin: 6px 0 0; padding-left: 18px; font-size: var(--text-xs); color: var(--text-2); }

/* =====================================================================
   Оформление «Сад»: персик, баклажан, олива; карточки слоновой кости, пухлые 3D-иконки
   ===================================================================== */
:root[data-design='garden']:not([data-theme='dark']) {
  --bg: #efe3d8; --surface: #fbf6ef; --surface-2: #f6eee4; --surface-3: #eee3d6;
  --border: #e6d9cb; --border-strong: #d4c3b2;
  --text: #3b3140; --text-2: #5f5363; --text-3: #75687a;
  --accent: #6f7856; --accent-ink: #fff; --accent-soft: #e9ead9;
  --mark: #e39a72; --mark-ink: #3b3140; --scale: #6f7856; --rev: #4f4254;
  --own: #6f7856; --priv: #d9875c; --obj-1: #6f7856; --obj-2: #d9875c;
  --good: #4f7a3a; --good-soft: #e6eedb; --warn: #9a621c; --warn-soft: #f7e8d2; --bad: #b4482f; --bad-soft: #f8e1d8;
  --key-bg: #f8e3d4; --key-total: #f0d0bb; --key-ink: #7a3a1e; --total-bg: #efe6db; --kpi-ink: #4f4254;
  --sidebar: #4f4254; --sidebar-text: #e6dbe3; --sidebar-active: rgba(255, 255, 255, .12); --head-bg: #4f4254;
  --dune-1: #e8d5c6; --dune-2: #e4cfbf; --sun: rgba(244, 201, 173, .55);
  --lift: inset 0 1px 0 #fff, 0 2px 4px rgba(79, 66, 84, .06), 0 20px 36px -20px rgba(79, 66, 84, .42);
  --lift-hi: inset 0 1px 0 #fff, 0 3px 6px rgba(79, 66, 84, .08), 0 26px 44px -20px rgba(79, 66, 84, .5);
  --pop: inset 0 2px 1px rgba(255, 255, 255, .55), inset 0 -4px 7px rgba(60, 40, 30, .16), 0 7px 14px -6px rgba(79, 66, 84, .45);
  --pop-olive: linear-gradient(160deg, #949e78, #6f7856); --pop-peach: linear-gradient(160deg, #f2b998, #e08f66); --pop-cream: linear-gradient(160deg, #fffcf6, #ece2d3);
  --pop-ink: #fbf6ef; --pop-cream-ink: #6f7856;
  --font: 'Nunito', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --shadow: var(--lift);
}
:root[data-design='garden'][data-theme='dark'] {
  --bg: #241e28; --surface: #2e2733; --surface-2: #352d3a; --surface-3: #3d3443;
  --border: #41374a; --border-strong: #554a5e;
  --text: #f1e9ee; --text-2: #c9bcc6; --text-3: #9d909b;
  --accent: #a9b38a; --accent-ink: #1d1a14; --accent-soft: #343826;
  --mark: #eaa883; --mark-ink: #241e28; --scale: #a9b38a; --rev: #f1e9ee;
  --own: #a9b38a; --priv: #eaa883; --obj-1: #a9b38a; --obj-2: #eaa883;
  --good: #9cc58a; --good-soft: #263222; --warn: #e6b86a; --warn-soft: #3a2f1e; --bad: #f0957c; --bad-soft: #42251f;
  --key-bg: #3d2b25; --key-total: #4d362c; --key-ink: #f5c3a8; --total-bg: #332b38; --kpi-ink: #f6eef3;
  --sidebar: #1b161f; --sidebar-text: #d9cdd6; --sidebar-active: rgba(255, 255, 255, .1); --head-bg: #1b161f;
  --dune-1: #2a232f; --dune-2: #2c2430; --sun: rgba(234, 168, 131, .12);
  --lift: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .35), 0 16px 32px -18px rgba(0, 0, 0, .7);
  --lift-hi: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 4px rgba(0, 0, 0, .4), 0 22px 40px -18px rgba(0, 0, 0, .8);
  --pop: inset 0 2px 1px rgba(255, 255, 255, .3), inset 0 -4px 7px rgba(0, 0, 0, .25), 0 7px 14px -6px rgba(0, 0, 0, .6);
  --pop-olive: linear-gradient(160deg, #a3ad84, #7b855f); --pop-peach: linear-gradient(160deg, #eeb090, #d98a62); --pop-cream: linear-gradient(160deg, #4a4050, #3a3140);
  --pop-ink: #fbf6ef; --pop-cream-ink: #d7deb8;
  --font: 'Nunito', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --shadow: var(--lift);
}
:root[data-design='garden'] { --blob-ink: var(--pop-ink); --blob-act: #fbf6ef; --blob-act-ink: #4f4254; }

/* Фон: персик с мягкими «дюнами» и солнцем */
:root[data-design='garden'] body {
  background: radial-gradient(260px 260px at 96% -4%, var(--sun) 0 98%, transparent 100%),
    radial-gradient(900px 300px at 30% 108%, var(--dune-1) 0 98%, transparent 100%),
    radial-gradient(760px 280px at 92% 104%, var(--dune-2) 0 98%, transparent 100%), var(--bg);
  background-attachment: fixed;
}

/* Меню: баклажан, иконки — пухлые плитки */
:root[data-design='garden'] .sidebar { background: var(--sidebar); box-shadow: 10px 0 34px -20px rgba(47, 36, 52, .75); }
:root[data-design='garden'] .brand-text strong { color: #fbf6ef; }
:root[data-design='garden'] :is(.brand-text span, .obj-title, .obj-item small, .obj-add) { color: rgba(230, 219, 227, .7); }
:root[data-design='garden'] .brand-mark { background: var(--pop-peach); color: #fffaf3; border-radius: 14px; box-shadow: var(--pop); }
:root[data-design='garden'] .sidebar .ico { background: var(--pop-olive); border-radius: 13px; box-shadow: var(--pop); }
:root[data-design='garden'] .sidebar .ico.b2 { background: var(--pop-peach); border-radius: 13px; }
:root[data-design='garden'] .sidebar .ico.b3 { background: var(--pop-cream); border-radius: 13px; }
:root[data-design='garden'] .sidebar .ico.b3 svg { stroke: var(--pop-cream-ink); }
:root[data-design='garden'] .sidebar .ico.sm { border-radius: 10px; }
:root[data-design='garden'] .sidebar .ico svg { stroke-width: 1.9; }
:root[data-design='garden'] :is(.nav a, .nav-parent) { border-radius: 16px; }
:root[data-design='garden'] :is(.nav a.active, .nav-parent.active) { background: #fbf6ef; color: #4f4254; box-shadow: 0 8px 16px -10px rgba(0, 0, 0, .6); }
:root[data-design='garden'] :is(.nav a.active, .nav-parent.active) .ico { background: var(--pop-olive); box-shadow: var(--pop); }
:root[data-design='garden'] :is(.nav a.active, .nav-parent.active) .ico svg { stroke: #fbf6ef; }
:root[data-design='garden'][data-theme='dark'] :is(.nav a.active, .nav-parent.active) { background: #3d3443; color: #fbf6ef; }
:root[data-design='garden'] .nav .nav-sub a.active { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
:root[data-design='garden'] .obj-item.active { background: rgba(255, 255, 255, .12); box-shadow: inset 3px 0 0 var(--mark); }

/* Шапка: светлая, без картинки */
:root[data-design='garden'] .topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); box-shadow: none; border-bottom: 1px solid var(--border); color: var(--text); }
:root[data-design='garden'] .topbar h1 { color: var(--kpi-ink); text-shadow: none; font-weight: 900; }
:root[data-design='garden'] :is(.topbar .muted, .topbar #periodLine, .topbar .field-inline) { color: var(--text-3); }
:root[data-design='garden'] .topbar .field-inline select { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--lift); }
:root[data-design='garden'] .topbar .demo-note { background: var(--key-bg); color: var(--key-ink); }

/* Карточки: слоновая кость, «дюна» в углу KPI */
:root[data-design='garden'] .card { background: var(--surface); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); box-shadow: var(--lift); }
:root[data-design='garden'] .kpi::after { right: -30px; bottom: -44px; width: 96px; height: 70px; border-radius: 50%; background: var(--kpi-dot); box-shadow: none; opacity: .5; }
:root[data-design='garden'] .grid > .kpi { --kpi-dot: #a9b38a; }
:root[data-design='garden'] .grid > .kpi:nth-child(2n) { --kpi-dot: #f2b998; }
:root[data-design='garden'][data-theme='dark'] .kpi::after { opacity: .22; }
:root[data-design='garden'] .kpi-value { font-weight: 900; text-shadow: none; }
:root[data-design='garden'] .kpi-label { font-weight: 800; }

/* Кнопки: пухлые */
:root[data-design='garden'] .btn { border-radius: 14px; font-weight: 800; background: var(--pop-cream); border-color: transparent; color: var(--text); box-shadow: var(--pop); }
:root[data-design='garden'] .btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(60, 40, 30, .2); }
:root[data-design='garden'] .btn.primary { background: var(--pop-olive); color: #fff; border-color: transparent; box-shadow: var(--pop); }
:root[data-design='garden'][data-theme='dark'] .btn.primary { color: #1d1a14; }
:root[data-design='garden'] .btn.danger { color: var(--bad); }
:root[data-design='garden'] .seg { background: var(--surface-3); border-radius: 14px; box-shadow: inset 0 2px 3px rgba(79, 66, 84, .12); }
:root[data-design='garden'] .seg button { border-radius: 11px; }
:root[data-design='garden'] .seg button.on { background: var(--pop-cream); color: var(--text); box-shadow: var(--pop); }
:root[data-design='garden'] :is(select, input[type='text'], input[type='number'], input[type='password'], input[type='search'], input[type='date'], textarea):not(.inv-in):not(.inv-date) { border-radius: 14px; }

/* Шкалы, таблицы, метки */
:root[data-design='garden'] :is(.bar, .exp-cat-bar) { background: var(--surface-3); box-shadow: inset 0 2px 3px rgba(79, 66, 84, .15); }
:root[data-design='garden'] :is(.bar > i, .exp-cat-bar i) { background: var(--pop-olive); border-radius: 99px; }
:root[data-design='garden'] :is(table.inv thead th, .sch thead th) { background: linear-gradient(180deg, #5f5164, #4f4254); }
:root[data-design='garden'][data-theme='dark'] :is(table.inv thead th, .sch thead th) { background: linear-gradient(180deg, #2c2431, #1b161f); }
:root[data-design='garden'] table.inv thead th.inv-com-h { background: linear-gradient(180deg, #e8a17b, #cf7d52); }
:root[data-design='garden'] :is(td.pay-hl, th.pay-hl, table.inv td.inv-hl) { background: var(--key-bg); }
:root[data-design='garden'] :is(.badge, .score, .kind) { box-shadow: none; }

/* Вход и выдвижные панели */
:root[data-design='garden'] .login { background: radial-gradient(320px 320px at 90% 0%, var(--sun) 0 98%, transparent 100%), radial-gradient(1000px 360px at 30% 110%, var(--dune-1) 0 98%, transparent 100%), var(--bg); }
:root[data-design='garden'] .login-card { border-radius: 26px; background: var(--surface); box-shadow: var(--lift-hi); }
:root[data-design='garden'] .drawer { background: var(--surface); }

/* Чат: баклажановая панель, светлая лента сообщений */
:root[data-design='garden'] .chat { background: var(--sidebar); box-shadow: -10px 0 34px -20px rgba(47, 36, 52, .75); }
:root[data-design='garden'][data-theme] :is(.chat-msgs, .chat-form, .chat-preview, .chat-reply) { background: var(--bg); }
:root[data-design='garden'] .msg { background: var(--surface); box-shadow: 0 2px 6px -2px rgba(79, 66, 84, .2); }
:root[data-design='garden'] .msg.mine { background: var(--accent-soft); }
:root[data-design='garden'] .chat-send { background: var(--pop-olive); box-shadow: var(--pop); }

/* Превью в настройках */
.design-prev-garden { background: #efe3d8; padding: 9px; gap: 8px; }
.design-prev-garden i { flex: 0 0 36px; height: 36px; border-radius: 12px; box-shadow: inset 0 2px 1px rgba(255, 255, 255, .5), inset 0 -3px 5px rgba(60, 40, 30, .18), 0 5px 10px -5px rgba(79, 66, 84, .5); }

@media (max-width: 860px) {
  :root[data-design='garden'] .sidebar { background: var(--sidebar); }
  :root[data-design='garden'] .topbar { background: var(--surface); border: 0; box-shadow: var(--lift); }
  :root[data-design='garden'] .mbar { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 0; box-shadow: var(--lift-hi); }
  :root[data-design='garden'] .mb-menu { background: var(--pop-olive); border-color: var(--bg); box-shadow: var(--pop); }
  :root[data-design='garden'] .msheet { background: var(--bg); }
  :root[data-design='garden'] .ms-ic { background: var(--pop-olive); color: var(--pop-ink); box-shadow: var(--pop); border-radius: 18px; }
  :root[data-design='garden'] .ms-grid > .ms-tile:nth-child(3n+2) .ms-ic { background: var(--pop-peach); }
  :root[data-design='garden'] .ms-grid > .ms-tile:nth-child(3n) .ms-ic { background: var(--pop-cream); color: var(--pop-cream-ink); }
  :root[data-design='garden'] .ms-grid > .ms-tile.on:nth-child(n) .ms-ic { background: var(--sidebar); color: #fbf6ef; }
  :root[data-design='garden'] .ms-tile.on { color: var(--kpi-ink); font-weight: 800; }
}

/* ===== Логотип Axis «Вершина»: знак на тёмно-зелёной плашке, одинаково во всех оформлениях и темах ===== */
html .brand-mark, html[data-design] .brand-mark, :root[data-design] .brand-mark { background: #183a2e; color: #f3e6d4; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 14px -8px rgba(0, 0, 0, .55); }
.brand-mark svg { display: block; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: calc(-1 * var(--s1)); }
.login-mark { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: #183a2e; color: #f3e6d4; flex-shrink: 0; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .6); }
.login-word { font-family: Manrope, system-ui, sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -.01em; color: var(--text); }
html .ico.av.bot, html[data-design] .ico.av.bot { background: #183a2e; }
.ico.av.grp.bot svg.axis-mark { width: 22px; height: 22px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ico.av.sm.grp.bot svg.axis-mark { width: 17px; height: 17px; }
:root[data-theme='dark'] .login-mark, :root[data-theme='dark'] .brand-mark { box-shadow: inset 0 0 0 1px rgba(243, 230, 212, .14), 0 6px 14px -8px rgba(0, 0, 0, .6); }

/* ===== Что сделать сегодня ===== */
.nav a[data-route='today'] { position: relative; }
.nav-count { position: absolute; left: 30px; top: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--sidebar); pointer-events: none; }
.today-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); padding: var(--s5) var(--s6); flex-wrap: wrap; }
.today-hero .th-text small { color: var(--text-3); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; }
.today-hero h2 { margin: 4px 0 2px; font-size: var(--text-xl); letter-spacing: -.01em; }
.today-hero p { margin: 0; color: var(--text-2); }
.th-stats { display: flex; gap: var(--s2); }
.th-stat { min-width: 86px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); }
.th-stat b { font-size: var(--text-xl); line-height: 1.1; font-variant-numeric: tabular-nums; }
.th-stat span { font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.th-stat.bad b { color: var(--bad); } .th-stat.warn b { color: var(--warn); } .th-stat.good b { color: var(--good); }
.th-stat.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.today-hero.all-ok .th-stat.bad, .today-hero:not(.has-bad) .th-stat.bad { background: var(--surface-2); border-color: var(--border); }
.today-hero:not(.has-bad) .th-stat.bad b { color: var(--text-3); }
.today-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
.today-item { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.today-item::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--warn); }
.today-item.lvl-bad::before { background: var(--bad); }
.ti-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s4) var(--s4) var(--s2) var(--s5); }
.ti-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); }
.lvl-bad .ti-ico { background: var(--bad-soft); color: var(--bad); }
.ti-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ti-title h2 { margin: 0; font-size: var(--text-base); }
.ti-title p { margin: 3px 0 0; color: var(--text-2); font-size: var(--text-sm); }
.ti-list { list-style: none; margin: 0; padding: 0 var(--s4) 0 var(--s5); display: flex; flex-direction: column; }
.ti-list li { display: flex; flex-direction: column; gap: 1px; padding: 8px 0 8px 12px; border-top: 1px solid var(--border); position: relative; font-size: var(--text-sm); }
.ti-list li::before { content: ''; position: absolute; left: 0; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.ti-list li.lv-bad::before { background: var(--bad); } .ti-list li.lv-warn::before { background: var(--warn); } .ti-list li.lv-good::before { background: var(--good); }
.ti-list li small { color: var(--text-3); font-size: var(--text-xs); }
.ti-list li[role='button'] { cursor: pointer; border-radius: 6px; }
.ti-list li[role='button']:hover b { text-decoration: underline; }
.ti-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4) var(--s4) var(--s5); margin-top: auto; }
.ti-foot .btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; margin-right: -4px; }
.today-empty .card-body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--s10) var(--s5); gap: var(--s2); }
.today-empty svg { width: 56px; height: 56px; fill: none; stroke: var(--good); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.today-empty h2 { margin: 0; }
.today-ok ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.today-ok li { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--text-sm); }
.today-ok li svg { width: 16px; height: 16px; fill: none; stroke: var(--good); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) {
  .today-hero { padding: var(--s4); }
  .th-stats { width: 100%; } .th-stat { flex: 1; min-width: 0; }
  .ti-head { grid-template-columns: 36px minmax(0, 1fr); } .ti-head .badge { grid-column: 2; justify-self: start; }
  .ti-ico { width: 36px; height: 36px; }
  .ti-foot .btn { flex: 1; }
}
:root[data-design='garden'] .ti-ico { background: var(--pop-peach); color: var(--pop-ink); box-shadow: var(--pop); border-radius: 14px; }
:root[data-design='garden'] .lvl-bad .ti-ico { background: linear-gradient(160deg, #e2836a, #b4482f); }
:root[data-design='garden'] .th-stat { background: var(--surface-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
html[data-design='soft'] .th-stat, html[data-design='soft'] .ti-ico { box-shadow: var(--neu-in, none); border-color: transparent; }

/* ===== Отчёт после загрузки CDS ===== */
.up-file { display: flex; flex-direction: column; gap: var(--s3); }
.up-file-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s3); }
.up-issues { border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); background: var(--bad-soft); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.up-file:not(.has-bad) .up-issues { border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); }
.up-issues h3 { margin: 0 0 var(--s2); font-size: var(--text-base); }
.up-issues ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.up-issues li { display: flex; flex-direction: column; padding-left: 14px; position: relative; font-size: var(--text-sm); }
.up-issues li::before { content: ''; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.up-issues li.lv-bad::before { background: var(--bad); }
.up-issues li small { color: var(--text-2); font-size: var(--text-xs); }
.up-issues p { margin: var(--s2) 0 0; font-size: var(--text-xs); }
.up-obj { box-shadow: none; }
.up-obj .card-body { display: flex; flex-direction: column; gap: var(--s3); }
.up-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: var(--s2); }
.up-tile { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); min-width: 0; }
.up-tile span { font-size: var(--text-xs); color: var(--text-3); font-weight: 700; }
.up-tile b { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.up-tile small { font-size: var(--text-xs); color: var(--text-3); overflow-wrap: anywhere; }
.up-tile.good b { color: var(--good); } .up-tile.warn b { color: var(--warn); } .up-tile.bad b { color: var(--bad); }
.up-tile.bad { background: var(--bad-soft); }
.up-days { display: flex; align-items: flex-end; gap: 3px; height: 74px; padding-top: 4px; overflow-x: auto; }
.up-day { flex: 1 0 18px; max-width: 34px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.up-day i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--text-3) 35%, transparent); max-height: calc(100% - 16px); }
.up-day.new i { background: var(--accent); }
.up-day span { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; line-height: 1; }
.up-days-note { margin: -4px 0 0; font-size: var(--text-xs); }
.up-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); vertical-align: -1px; }
html[data-design='soft'] .up-tile { background: var(--bg); box-shadow: var(--neu-in, none); border-color: transparent; }

/* ===== Окно подтверждения и «Отменить» ===== */
.ask-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(10, 13, 18, .45); display: grid; place-items: center; padding: var(--s4); animation: askIn .14s ease-out; }
.ask-backdrop.out { opacity: 0; transition: opacity .14s; }
.ask { width: min(440px, 100%); background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: var(--s5) var(--s5) var(--s4); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55); border: 1px solid var(--border); animation: askUp .16s ease-out; }
.ask h2 { margin: 0 0 var(--s2); font-size: var(--text-lg); }
.ask p { margin: 0; color: var(--text-2); font-size: var(--text-sm); }
.ask-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
.ask .ask-actions .btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.ask .ask-actions .btn.danger-fill:hover { filter: brightness(1.06); }
@keyframes askIn { from { opacity: 0; } }
@keyframes askUp { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 520px) {
  .ask-backdrop { place-items: end stretch; padding: 0; }
  .ask { width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom, 0px)); }
  .ask-actions .btn { flex: 1; min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .ask-backdrop, .ask { animation: none; } }
.toast.has-undo { display: flex; align-items: center; gap: var(--s3); padding-right: 8px; }
.toast-undo { border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 800; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; }
.toast-undo:hover { background: color-mix(in srgb, var(--surface) 15%, transparent); }
[data-theme='dark'] .toast-undo, :root[data-design='garden']:not([data-theme='dark']) .toast-undo { color: var(--mark); }

/* ===== Кабинет ИП и водителя на телефоне ===== */
.pcards, .slip-cards, .ded-mobile { display: none; }
.slip-open { margin-top: var(--s3); align-self: flex-start; }
.slip-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
@media (max-width: 700px) {
  .portal-table { display: none; }
  .pcards { display: flex; flex-direction: column; gap: var(--s2); }
  .ded-mobile { display: flex; }
  .ded-mobile li small { flex-basis: 100%; color: var(--text-3); }
  .pcard { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  .pcard.open { border-color: var(--border-strong); }
  .pcard-top { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; gap: var(--s3); align-items: center; padding: 12px 12px 12px 14px; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; min-height: 58px; }
  .pc-name, .pc-pay { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .pc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pc-pay { align-items: flex-end; }
  .pc-pay b { font-size: var(--text-lg); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .pc-name small, .pc-pay small { font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .slip-items li { grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--s3); }
  .slip-items li span { grid-column: 1; } .slip-items li span:nth-child(3) { grid-column: 1; }
  .slip-items li b { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .pc-pay small.neg { color: var(--bad); }
  .pc-chev { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 2; transition: transform .15s; }
  .pcard.open .pc-chev { transform: rotate(90deg); stroke: var(--accent); }
  .pcard-body { padding: 0 14px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
  .pcs-sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 0; margin: 12px 0 0; font-size: var(--text-sm); }
  .pcs-sum dd { padding-left: var(--s3); }
  .pcs-sum dt { color: var(--text-2); } .pcs-sum dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
  .pcs-sum .pc-total { border-top: 1px solid var(--border-strong); padding-top: 6px; font-weight: 800; color: var(--text); }
  .pcard-body .pay-items { margin-top: 12px; }
  .slip-list .slip-chips { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .slip-chip { flex: 0 0 auto; scroll-snap-align: start; min-height: 52px; }
  .slip-open { width: 100%; min-height: 46px; }
  .slip-t { display: none; }
  .slip-cards { display: flex; flex-direction: column; gap: var(--s2); }
  .slip-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface-2); }
  .slip-card .sc-head { display: flex; justify-content: space-between; gap: var(--s3); }
  .slip-card small { color: var(--text-3); font-size: var(--text-xs); }
  .slip-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s3); margin: 8px 0 0; }
  .slip-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
  .slip-actions .btn { width: 100%; }
}
html[data-design='soft'] .pcard, html[data-design='soft'] .slip-card { background: var(--bg); }
:root[data-design='garden'] .pcard { border-radius: var(--r-md); box-shadow: var(--lift); border-color: transparent; }
@media (max-width: 520px) { .up-tiles { grid-template-columns: 1fr 1fr; } .up-tiles .up-tile:first-child { grid-column: 1 / -1; } .up-tile { padding: 8px 10px; } }
.bk-help ol { margin: 4px 0 6px; padding-left: 20px; }
.bk-help li { margin: 2px 0; }
.bk-dav > summary { cursor: pointer; margin: 4px 0; }
.bk-dav .field { margin-top: var(--s2); }

/* Вход с кодом из приложения (2FA) */
.tf-steps { margin: 10px 0; padding-left: 20px; display: grid; gap: 8px; }
.tf-steps .muted { display: block; font-size: 13px; }
.tf-qr { margin: 10px 0 6px; width: 200px; max-width: 100%; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }
.tf-qr svg { display: block; width: 100%; height: auto; }
.tf-key { user-select: all; word-break: break-all; letter-spacing: .04em; }
.tf-confirm { margin-top: 10px; }
.tf-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.tf-codes code { font-size: 16px; padding: 8px 10px; text-align: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); letter-spacing: .06em; user-select: all; }

/* ---------- Фильтры под заголовком: что сейчас отобрано и «Сбросить» (цвета от шапки — работает во всех оформлениях) ---------- */
.flt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--text-xs); }
.flt-bar[hidden] { display: none; }
.flt-label { opacity: .75; font-weight: 600; }
.flt-chip { padding: 2px 9px; border-radius: 99px; font-weight: 700; background: color-mix(in srgb, currentColor 13%, transparent); border: 1px solid color-mix(in srgb, currentColor 22%, transparent); max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flt-reset { background: none; border: 0; padding: 2px 4px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; opacity: .9; }
.flt-reset:hover { opacity: 1; }
@media (max-width: 860px) { .flt-bar { justify-content: center; } }

/* ---------- Мастер «Подключить объект» ---------- */
.wz-cta { margin-left: auto; }
.wz-cta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.wz-steps { list-style: none; margin: 0; padding: var(--s4) var(--s5); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); border-bottom: 1px solid var(--border); counter-reset: wz; }
.wz-steps li { position: relative; min-width: 0; }
.wz-steps button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: none; border-radius: var(--r-md); cursor: pointer; color: var(--text-2); font: inherit; font-size: var(--text-sm); font-weight: 700; text-align: left; min-width: 0; }
.wz-steps button:disabled { cursor: default; opacity: .55; }
.wz-steps button:not(:disabled):hover { background: var(--surface-2); }
.wz-steps i { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.wz-steps span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-steps li.ok i { background: var(--good-soft); color: var(--good); }
.wz-steps li.warn i { background: var(--warn-soft); color: var(--warn); }
.wz-steps li.cur button { color: var(--text); background: var(--accent-soft); }
.wz-steps li.cur i { background: var(--accent); color: var(--accent-ink); }
.wz-body { display: flex; flex-direction: column; gap: var(--s4); }
.wz-intro h2 { font-size: var(--text-lg); margin: 0 0 4px; }
.wz-intro p { margin: 0; max-width: 72ch; }
.wz-name { max-width: 420px; }
.dropzone.compact { padding: var(--s4); flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.dropzone.compact svg { width: 24px; height: 24px; }
.wz-upres:empty { display: none; }
.wz-upres { display: flex; flex-direction: column; gap: var(--s3); }
.wz-nav { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding-top: var(--s2); border-top: 1px solid var(--border); }
.wz-nav > .btn.primary, .wz-nav > #wzOpen { margin-left: auto; }
.wz-dirty { font-size: var(--text-xs); color: var(--warn); }
.wz-foot { padding: 0 var(--s5) var(--s4); text-align: right; font-size: var(--text-xs); }
.wz-sum, .wz-bulk { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; }
.wz-bulk { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.wz-rate { display: inline-flex; align-items: center; gap: 4px; }
.wz-rate input { width: 90px; }
.field-row { display: inline-flex; align-items: center; gap: 8px; }
table.wz-drv td { vertical-align: middle; }
table.wz-drv select { min-width: 110px; }
table.wz-drv input[name='rate'] { width: 84px; text-align: right; }
table.wz-drv input[name='ip'] { width: 100%; min-width: 140px; }
table.wz-drv tr.need td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.wz-drv tr.edited td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.wz-hint { display: block; font-size: var(--text-xs); color: var(--text-3); font-weight: 600; margin-top: 2px; }
.wz-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.wz-check li { display: flex; align-items: center; gap: var(--s3); padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.wz-check li > i { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; }
.wz-check li.ok > i { background: var(--good-soft); color: var(--good); }
.wz-check li.warn > i { background: var(--warn-soft); color: var(--warn); }
.wz-check li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wz-check li .btn { flex: 0 0 auto; }
@media (max-width: 860px) {
  .wz-steps { padding: var(--s3); gap: 4px; }
  .wz-steps button { flex-direction: column; gap: 4px; padding: 6px 2px; text-align: center; font-size: 11px; }
  .wz-steps span { white-space: normal; line-height: 1.15; }
  .wz-cta { margin-left: 0; width: 100%; justify-content: center; }
}
@media (max-width: 700px) {
  .wz-body .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }
  .wz-body .form-grid .field :is(input, select) { width: 100%; min-width: 0; }
  .wz-bulk select { min-width: 0; max-width: 100%; }
  /* водители — карточками: имя сверху, поля под ним */
  table.wz-drv thead { display: none; }
  table.wz-drv, table.wz-drv tbody { display: block; }
  table.wz-drv tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; background: var(--surface); }
  table.wz-drv td { display: flex; flex-direction: column; gap: 2px; padding: 0 !important; border: 0 !important; text-align: left !important; }
  table.wz-drv td::before { content: attr(data-l); font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
  table.wz-drv td:first-child { grid-column: 1 / -1; box-shadow: none !important; }
  table.wz-drv td:first-child::before { display: none; }
  table.wz-drv td:last-child { grid-column: 1 / -1; }
  table.wz-drv tr.need { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
  table.wz-drv tr.edited { border-color: var(--accent); }
  table.wz-drv select, table.wz-drv input { width: 100% !important; min-width: 0 !important; }
  .wz-nav { position: sticky; bottom: calc(var(--mbar-h, 0px) + 30px + env(safe-area-inset-bottom, 0px)); background: var(--surface); margin: 0 calc(-1 * var(--s4)); padding: 10px var(--s4); z-index: 3; }
  .wz-nav .btn { flex: 1 1 auto; justify-content: center; }
  .wz-check li { flex-wrap: wrap; }
  .wz-bulk { font-size: var(--text-xs); }
}

/* =====================================================================
   Оформление «Студия»: светло-серый фон, белые карточки, чёрное меню-капсула, один яркий акцент
   и живая анимация (появление карточек, счётчики, смена темы кругом). Акцент: лаванда / кобальт / янтарь.
   ===================================================================== */
:root[data-design='studio']:not([data-theme='dark']) {
  --bg: #edecf0; --surface: #ffffff; --surface-2: #f6f6f8; --surface-3: #efeef2;
  --border: #e7e6eb; --border-strong: #d6d5dc;
  --text: #121216; --text-2: #4f4f59; --text-3: #8b8a95;
  --mark-ink: #121216; --rev: #121216; --kpi-ink: #121216;
  --good: #1f9d55; --good-soft: #def5e7; --warn: #b7791f; --warn-soft: #fbf0dc; --bad: #e0412b; --bad-soft: #fde6e1;
  --key-ink: #121216; --total-bg: #f3f2f6;
  --sidebar: #111114; --sidebar-text: #c9c8d0; --sidebar-active: rgba(255, 255, 255, .08); --head-bg: #111114;
  --lift: 0 1px 2px rgba(18, 18, 22, .04), 0 10px 30px -18px rgba(18, 18, 22, .22);
  --lift-hi: 0 2px 4px rgba(18, 18, 22, .05), 0 24px 44px -20px rgba(18, 18, 22, .32);
  --ink-btn: #111114; --ink-btn-text: #fff; --pill: #ffffff;
  --r-sm: 12px; --r-md: 16px; --r-lg: 24px; --shadow: var(--lift);
}
:root[data-design='studio'][data-theme='dark'] {
  --bg: #0d0d10; --surface: #18181c; --surface-2: #1f1f24; --surface-3: #26262c;
  --border: #26262d; --border-strong: #34343c;
  --text: #f4f4f6; --text-2: #b9b8c2; --text-3: #85848f;
  --mark-ink: #0d0d10; --rev: #f4f4f6; --kpi-ink: #f7f7f9;
  --good: #4ad08a; --good-soft: #15291e; --warn: #f0b85a; --warn-soft: #2e2516; --bad: #ff6b55; --bad-soft: #351a16;
  --key-ink: #f4f4f6; --total-bg: #1f1f24;
  --sidebar: #000000; --sidebar-text: #b9b8c2; --sidebar-active: rgba(255, 255, 255, .08); --head-bg: #000;
  --lift: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 2px rgba(0, 0, 0, .5), 0 14px 30px -18px rgba(0, 0, 0, .8);
  --lift-hi: inset 0 1px 0 rgba(255, 255, 255, .05), 0 22px 44px -18px rgba(0, 0, 0, .9);
  --ink-btn: #f4f4f6; --ink-btn-text: #0d0d10; --pill: #1f1f24;
  --r-sm: 12px; --r-md: 16px; --r-lg: 24px; --shadow: var(--lift);
}
/* Акценты */
:root[data-design='studio'] {
  --accent: #7c5ce0; --accent-ink: #fff; --accent-soft: #ece6fd; --accent-2: #f3b6d6; --accent-hi: #d8cbfb;
  --mark: #7c5ce0; --scale: #8b6cf0; --own: #8b6cf0; --priv: #f09cc6; --obj-1: #8b6cf0; --obj-2: #f09cc6;
  --key-bg: #f1ecfe; --key-total: #e4dafd;
  --hero: linear-gradient(100deg, #c9b9f4 0%, #d9c3f2 45%, #f1c6e0 100%); --hero-ink: #1b1530;
  --font: 'Inter', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --blob-ink: #d7d6de; --blob-act: var(--accent-hi); --blob-act-ink: #1b1530;
}
:root[data-design='studio'][data-accent='cobalt'] {
  --accent: #2346f5; --accent-ink: #fff; --accent-soft: #e3e8ff; --accent-2: #c8f03a; --accent-hi: #2346f5;
  --mark: #2346f5; --scale: #2346f5; --own: #2346f5; --priv: #b9e22a; --obj-1: #2346f5; --obj-2: #b9e22a;
  --key-bg: #e8ecff; --key-total: #d6deff;
  --hero: linear-gradient(120deg, #2346f5, #3b5cff 60%, #5f7bff); --hero-ink: #fff;
  --blob-act: #2346f5; --blob-act-ink: #fff;
}
:root[data-design='studio'][data-accent='ember'] {
  --accent: #ee5f24; --accent-ink: #fff; --accent-soft: #fde7dc; --accent-2: #f9b996; --accent-hi: #ee5f24;
  --mark: #ee5f24; --scale: #ee5f24; --own: #ee5f24; --priv: #f8b38f; --obj-1: #ee5f24; --obj-2: #f8b38f;
  --key-bg: #fdeee6; --key-total: #fbdccb;
  --hero: linear-gradient(140deg, #f47a3e, #e8541a); --hero-ink: #fff;
  --font: 'Onest', 'Inter', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --blob-act: #ee5f24; --blob-act-ink: #fff;
}
:root[data-design='studio'][data-theme='dark'] { --accent-soft: color-mix(in srgb, var(--accent) 22%, #18181c); --key-bg: color-mix(in srgb, var(--accent) 16%, #18181c); --key-total: color-mix(in srgb, var(--accent) 26%, #18181c); }
:root[data-design='studio'][data-theme='dark']:not([data-accent]) , :root[data-design='studio'][data-theme='dark'][data-accent='lilac'] { --accent: #a58cff; --scale: #a58cff; --own: #a58cff; --obj-1: #a58cff; --accent-ink: #120d24; --mark: #a58cff; }

/* Фон и шрифт */
:root[data-design='studio'] body { background: var(--bg); font-feature-settings: 'cv11', 'ss01'; letter-spacing: -.005em; }

/* Меню: чёрная капсула с отступом от края */
@media (min-width: 861px) {
  :root[data-design='studio'] { --rail: 96px; }
  :root[data-design='studio'] .sidebar { top: 12px; bottom: 12px; left: 12px; height: calc(100dvh - 24px); width: 72px; border-radius: 30px; padding: 18px 10px; }
  :root[data-design='studio'] .sidebar:hover, :root[data-design='studio'] .sidebar:focus-within { width: var(--rail-open); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }
  :root[data-design='studio'] .brand { padding-left: 7px; }
  :root[data-design='studio'] :is(.nav a, .nav-parent, .ghost-btn) { padding-left: 7px; }
  :root[data-design='studio'] .main-wrap { padding-left: 4px; }
}
:root[data-design='studio'] .sidebar { background: var(--sidebar); box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .6); }
:root[data-design='studio'] .brand-text strong { color: #fff; }
:root[data-design='studio'] :is(.brand-text span, .obj-title, .obj-item small, .obj-add) { color: rgba(220, 219, 228, .55); }
:root[data-design='studio'] .obj-block { border-top-color: rgba(255, 255, 255, .08); }
:root[data-design='studio'] .ico, :root[data-design='studio'] .ico.b2, :root[data-design='studio'] .ico.b3 { background: transparent; border-radius: 50%; }
:root[data-design='studio'] .sidebar .ico svg { stroke: #d7d6de; stroke-width: 1.6; }
:root[data-design='studio'] :is(.nav a, .nav-parent, .ghost-btn, .obj-item) { border-radius: 999px; color: var(--sidebar-text); }
:root[data-design='studio'] :is(.nav a, .nav-parent, .ghost-btn):hover { background: rgba(255, 255, 255, .07); color: #fff; }
:root[data-design='studio'] :is(.nav a, .nav-parent, .ghost-btn):hover .ico { transform: none; }
:root[data-design='studio'] :is(.nav a.active, .nav-parent.active) { background: transparent; color: #fff; box-shadow: none; }
:root[data-design='studio'] :is(.nav a.active, .nav-parent.active) .ico { background: var(--blob-act); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blob-act) 22%, transparent); animation: st-pop .5s cubic-bezier(.34, 1.56, .64, 1); }
:root[data-design='studio'] :is(.nav a.active, .nav-parent.active) .ico svg { stroke: var(--blob-act-ink); stroke-width: 1.8; }
:root[data-design='studio'] :is(.nav a.active, .nav-parent.active)::before { content: ''; position: absolute; left: -10px; top: 50%; width: 5px; height: 18px; margin-top: -9px; border-radius: 0 4px 4px 0; background: var(--blob-act); animation: st-pop .5s cubic-bezier(.34, 1.56, .64, 1); }
:root[data-design='studio'] :is(.nav a, .nav-parent) { position: relative; }
:root[data-design='studio'] .nav .nav-sub a.active { background: rgba(255, 255, 255, .08); }
:root[data-design='studio'] .nav .nav-sub a.active::before { display: none; }
:root[data-design='studio'] .obj-item:hover { background: rgba(255, 255, 255, .06); }
:root[data-design='studio'] .obj-item.active { background: rgba(255, 255, 255, .1); box-shadow: inset 3px 0 0 var(--blob-act); border-radius: 14px; }
:root[data-design='studio'] .nav-sep { border-color: rgba(255, 255, 255, .08); }
:root[data-design='studio'] .nav-count { box-shadow: 0 0 0 2px var(--sidebar); }

/* Шапка: прозрачная, крупный заголовок, поля-«пилюли» */
:root[data-design='studio'] .topbar { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: none; border-bottom: 0; color: var(--text); }
:root[data-design='studio'] .topbar h1 { color: var(--text); text-shadow: none; font-weight: 700; letter-spacing: -.025em; font-size: calc(var(--text-xl) * 1.12); }
:root[data-design='studio'] :is(.topbar .muted, .topbar #periodLine, .topbar .field-inline) { color: var(--text-3); }
:root[data-design='studio'] .topbar .field-inline { text-transform: none; letter-spacing: 0; font-weight: 600; }
:root[data-design='studio'] .topbar .field-inline select, :root[data-design='studio'] .topbar :is(.search-btn, .qs-btn) { background-color: var(--pill); color: var(--text); border: 0; border-radius: 999px; box-shadow: var(--lift); }
:root[data-design='studio'] .topbar .demo-note { background: var(--accent-soft); color: var(--text); }

/* Карточки: белые, крупные скругления, без рамки */
:root[data-design='studio'] .card { background: var(--surface); border: 0; border-radius: var(--r-lg); box-shadow: var(--lift); }
:root[data-design='studio'] .card-head h2 { font-weight: 650; letter-spacing: -.01em; }
:root[data-design='studio'] .kpi::after { display: none; }
:root[data-design='studio'] .kpi-label { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
:root[data-design='studio'] .kpi-value { font-weight: 700; letter-spacing: -.035em; text-shadow: none; font-size: calc(var(--text-xl) * 1.18); color: var(--kpi-ink); }
:root[data-design='studio'] .kpi-value.neg { color: var(--bad); }
/* Первая карточка показателей — акцентная, как «Total revenue» / «Manage Quotes» */
:root[data-design='studio'] .grid > .kpi:first-child { background: var(--hero); color: var(--hero-ink); box-shadow: 0 18px 36px -20px color-mix(in srgb, var(--accent) 80%, #000); }
:root[data-design='studio'] .grid > .kpi:first-child :is(.kpi-label, .kpi-value, .kpi-sub, .muted, small, span, b) { color: var(--hero-ink); }
:root[data-design='studio'] .grid > .kpi:first-child .badge { background: rgba(255, 255, 255, .28); color: var(--hero-ink); }
:root[data-design='studio'] .grid > .kpi:first-child .bar { background: rgba(255, 255, 255, .3); }
:root[data-design='studio'] .grid > .kpi:first-child .bar > i { background: var(--hero-ink); }
:root[data-design='studio']:not([data-accent]) .grid > .kpi:first-child, :root[data-design='studio'][data-accent='lilac'] .grid > .kpi:first-child { background: url('img/studio-flower.svg') right -34px top -44px / 128px no-repeat, var(--hero); }
:root[data-design='studio'][data-accent='cobalt'] .grid > .kpi:first-child .bar > i { background: var(--accent-2); }

/* Кнопки: чёрные «пилюли», главная — чёрная, акцентная — цветом акцента */
:root[data-design='studio'] .btn { border-radius: 999px; background: var(--surface-2); border: 0; color: var(--text); box-shadow: none; font-weight: 600; padding-inline: 16px; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background .15s, box-shadow .2s; }
:root[data-design='studio'] .btn:hover { background: var(--surface-3); }
:root[data-design='studio'] .btn:active { transform: scale(.96); box-shadow: none; }
:root[data-design='studio'] .btn.primary { background: var(--ink-btn); color: var(--ink-btn-text); box-shadow: 0 10px 20px -12px rgba(0, 0, 0, .55); }
:root[data-design='studio'] .btn.primary:hover { background: color-mix(in srgb, var(--ink-btn) 86%, var(--accent)); }
:root[data-design='studio'] .btn.danger { color: var(--bad); }
:root[data-design='studio'] .seg { background: var(--surface-2); border-radius: 999px; padding: 4px; box-shadow: none; }
:root[data-design='studio'] .seg button { border-radius: 999px; padding: 6px 14px; transition: color .2s; }
:root[data-design='studio'] .seg button.on { background: var(--ink-btn); color: var(--ink-btn-text); box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .6); animation: st-pill .35s cubic-bezier(.34, 1.56, .64, 1); }
:root[data-design='studio'] :is(select, input[type='text'], input[type='number'], input[type='password'], input[type='search'], input[type='date'], textarea):not(.inv-in):not(.inv-date) { border-radius: 14px; box-shadow: none; border-color: var(--border); background-color: var(--surface); }
:root[data-design='studio'] :is(input, select, textarea):focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
:root[data-design='studio'] a { color: var(--accent); }
:root[data-design='studio'] :is(.nav a, .btn, .chat a) { color: inherit; }

/* Шкалы, таблицы, метки */
:root[data-design='studio'] :is(.bar, .exp-cat-bar) { background: var(--surface-3); box-shadow: none; height: 8px; }
:root[data-design='studio'] :is(.bar > i, .exp-cat-bar i) { background: var(--scale); border-radius: 99px; }
:root[data-design='studio'] th { background: var(--surface); color: var(--text-3); text-transform: none; letter-spacing: 0; font-weight: 600; }
:root[data-design='studio'] :is(table.inv thead th, .sch thead th) { background: var(--head-bg); color: #fff; }
:root[data-design='studio'] table.inv thead th.inv-com-h { background: var(--accent); }
:root[data-design='studio'] :is(td.pay-hl, th.pay-hl, table.inv td.inv-hl) { background: var(--key-bg); }
:root[data-design='studio'] tbody tr { transition: background .15s; }
:root[data-design='studio'] tbody tr:hover > td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
:root[data-design='studio'] :is(.badge, .score, .kind) { box-shadow: none; }
:root[data-design='studio'] .alert { border-radius: 18px; border: 0; }
:root[data-design='studio'] .skeleton { background: linear-gradient(100deg, var(--surface-3) 30%, color-mix(in srgb, var(--surface) 70%, var(--accent-soft)) 50%, var(--surface-3) 70%); background-size: 220% 100%; animation: st-shimmer 1.3s linear infinite; border-radius: var(--r-lg); }

/* «Сегодня»: акцентная шапка */
:root[data-design='studio'] .today-hero { background: var(--hero); color: var(--hero-ink); position: relative; overflow: hidden; }
:root[data-design='studio'] .today-hero :is(h2, p, small) { color: var(--hero-ink); position: relative; }
:root[data-design='studio'] .today-hero .th-text small { opacity: .75; }
:root[data-design='studio'] .today-hero :is(.th-stats, .th-text) { position: relative; z-index: 1; }
:root[data-design='studio']:not([data-accent]) .today-hero::after, :root[data-design='studio'][data-accent='lilac'] .today-hero::after { content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; background: url('img/studio-flower.svg') center / contain no-repeat; opacity: .9; animation: st-spin 40s linear infinite; pointer-events: none; }
:root[data-design='studio'] .th-stat { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 0; box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .45); }
:root[data-design='studio'] .th-stat :is(b, span) { color: var(--text); }
:root[data-design='studio'] .th-stat.bad b { color: var(--bad); }
:root[data-design='studio'] .today-item::before { width: 0; }
:root[data-design='studio'] .ti-ico { border-radius: 50%; }

/* Вход и выдвижные панели */
:root[data-design='studio'] .login { background: radial-gradient(600px 380px at 85% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--bg); }
:root[data-design='studio'] .login-card { border-radius: 28px; background: var(--surface); border: 0; box-shadow: var(--lift-hi); }
:root[data-design='studio'] .drawer { background: var(--bg); border-left: 0; border-radius: 28px 0 0 28px; box-shadow: -30px 0 60px -30px rgba(0, 0, 0, .45); }
:root[data-design='studio'] .drawer .card { background: var(--surface); }
:root[data-design='studio'] .design-card { border-radius: 20px; border-color: transparent; box-shadow: var(--lift); }
:root[data-design='studio'] .design-card.on { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }

/* Чат: чёрная капсула справа */
:root[data-design='studio'] .chat { background: var(--sidebar); box-shadow: none; }
@media (min-width: 861px) {
  :root[data-design='studio'] { --chat-rail: 84px; }
  :root[data-design='studio'] .chat { top: 12px; bottom: 12px; right: 12px; width: 60px; border-radius: 30px; }
  :root[data-design='studio'] .chat:hover, :root[data-design='studio'] .chat:focus-within, :root[data-design='studio'] .chat.open { width: var(--chat-open); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }
  :root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-item { padding-inline: 2px; justify-content: center; }
}
:root[data-design='studio'] .chat-title { color: #fff; letter-spacing: 0; }
:root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-title { font-size: 13px; padding: 8px 0; width: 100%; text-align: center; }
:root[data-design='studio'] .topbar { padding-top: var(--s5); padding-bottom: var(--s3); }
:root[data-design='studio'][data-theme] :is(.chat-msgs, .chat-form, .chat-preview, .chat-reply) { background: var(--bg); }
:root[data-design='studio'] .chat-item:hover, :root[data-design='studio'] .chat-item.on { background: rgba(255, 255, 255, .08); }
:root[data-design='studio'] .chat-search, :root[data-design='studio'] .chat-x, :root[data-design='studio'] .chat-back { background: rgba(255, 255, 255, .08); }
:root[data-design='studio'] .msg { background: var(--surface); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, .18); border-radius: 18px 18px 18px 6px; }
:root[data-design='studio'] .msg.mine { background: var(--ink-btn); color: var(--ink-btn-text); border-radius: 18px 18px 6px 18px; }
:root[data-design='studio'] .msg.mine time { color: color-mix(in srgb, var(--ink-btn-text) 60%, transparent); }
:root[data-design='studio'] .chat-send { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
:root[data-design='studio'] .chat-badge, :root[data-design='studio'] .chat-dot { background: var(--accent); color: var(--accent-ink); }

/* Превью в настройках и выбор акцента */
.design-prev-studio { background: #edecf0; padding: 8px; gap: 6px; align-items: stretch; }
.design-prev-studio i { border-radius: 12px; }
.design-prev-studio i:first-child { flex: 0 0 16px; border-radius: 99px; }
.studio-acc { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 999px; background: var(--sidebar, #111); align-self: flex-start; }
.studio-acc button { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 8px 14px; background: transparent; color: #c9c8d0; font: 600 var(--text-sm)/1 var(--font); cursor: pointer; transition: background .25s, color .25s; }
.studio-acc button i { width: 10px; height: 10px; border-radius: 50%; }
.studio-acc button.on { background: #fff; color: #111; animation: st-pill .35s cubic-bezier(.34, 1.56, .64, 1); }

@media (max-width: 860px) {
  :root[data-design='studio'] .sidebar { background: var(--sidebar); border-radius: 0 0 22px 22px; }
  :root[data-design='studio'] .topbar { background: var(--bg); }
  :root[data-design='studio'] .mbar { background: var(--sidebar); border: 0; border-radius: 999px; box-shadow: 0 18px 36px -16px rgba(0, 0, 0, .6); }
  :root[data-design='studio'] .mbar :is(a, button) { color: #d7d6de; }
  :root[data-design='studio'] .mbar .on, :root[data-design='studio'] .mbar .active { color: #fff; }
  :root[data-design='studio'] .mb-menu { background: var(--accent); color: var(--accent-ink); border-color: var(--sidebar); box-shadow: none; }
  :root[data-design='studio'] .msheet { background: var(--bg); }
  :root[data-design='studio'] .ms-ic { background: var(--surface); color: var(--text); box-shadow: var(--lift); border-radius: 50%; }
  :root[data-design='studio'] .ms-grid > .ms-tile.on:nth-child(n) .ms-ic { background: var(--ink-btn); color: var(--ink-btn-text); }
  :root[data-design='studio'] .ms-tile.on { color: var(--text); font-weight: 700; }
  :root[data-design='studio'] .drawer { border-radius: 0; }
  :root[data-design='studio'] .today-hero::after { width: 150px; height: 150px; right: -46px; top: -46px; opacity: .7; }
}

/* ---------- Движение «Студии» ---------- */
@keyframes st-in { from { opacity: 0; transform: translateY(16px) scale(.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes st-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes st-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes st-pill { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
@keyframes st-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes st-spin { to { transform: rotate(360deg); } }
@keyframes st-view { from { opacity: 0; } to { opacity: 1; } }
:root[data-design='studio'] .st-in { animation: st-in .62s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--st-i, 0) * 55ms); }
:root[data-design='studio'] .st-in :is(.bar > i, .exp-cat-bar i) { transform-origin: left center; animation: st-grow .9s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--st-i, 0) * 55ms + 180ms); }
/* Наведение: карточка показателя приподнимается (как whileHover y: -5) */
:root[data-design='studio'] :is(.kpi, .today-item, .th-stat, .pcard, .design-card) { transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s ease; }
:root[data-design='studio'] :is(.kpi, .today-item, .pcard, .design-card):hover { transform: translateY(-5px); box-shadow: var(--lift-hi); }
:root[data-design='studio'] .grid > .kpi:first-child:hover { box-shadow: 0 26px 44px -20px color-mix(in srgb, var(--accent) 85%, #000); }
/* Смена темы: новая тема раскрывается кругом от кнопки */
:root[data-design='studio']::view-transition-old(root), :root[data-design='studio']::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root[data-design='studio']::view-transition-new(root) { z-index: 2; }
@media (prefers-reduced-motion: reduce) {
  :root[data-design='studio'] :is(.st-in, .st-in .bar > i, .st-in .exp-cat-bar i, .seg button.on, .studio-acc button.on, .today-hero::after) { animation: none !important; }
  :root[data-design='studio'] :is(.nav a.active, .nav-parent.active) .ico, :root[data-design='studio'] :is(.nav a.active, .nav-parent.active)::before { animation: none; }
  :root[data-design='studio'] :is(.kpi, .today-item, .pcard, .design-card):hover { transform: none; }
}

/* ---------- «Студия»: меню-капсулы слева и подвкладки сверху (только компьютер) ---------- */
.st-rail, .st-top { display: none; }
:root[data-design='studio'] { --st-logo-bar: #fff; }
:root[data-design='studio'][data-accent='ember'] { --st-logo-bar: #111114; }
@media (min-width: 861px) {
  html.st-nav { --rail: 88px; }
  html.st-nav .sidebar { display: none; }
  html.st-nav .st-rail { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; position: fixed; left: 16px; top: 16px; bottom: 16px; width: 56px; z-index: 46; }
  html.st-nav .st-top { display: flex; justify-content: center; align-items: flex-start; position: sticky; top: 0; z-index: 22; height: 84px; box-sizing: border-box; padding: 20px 24px 0 56px; background: linear-gradient(var(--bg) 60%, color-mix(in srgb, var(--bg) 0%, transparent)); pointer-events: none; }
  html.st-nav .st-top > * { pointer-events: auto; }
  html.st-nav .topbar { position: static; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding-top: var(--s3); }
}
.st-logo { display: inline-flex; align-items: center; gap: 9px; height: 56px; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--pill); box-shadow: var(--lift); color: var(--text); text-decoration: none; white-space: nowrap; transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.st-logo:hover { transform: scale(1.04); }
.st-logo b { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.st-logo-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: inset 0 -3px 8px rgba(0, 0, 0, .18), 0 8px 16px -10px color-mix(in srgb, var(--accent) 80%, #000); }
.st-pill { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 999px; background: var(--pill); box-shadow: var(--lift); }
.st-pill button { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; transition: background .25s, color .25s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.st-pill button[hidden] { display: none; }
.st-pill button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.st-pill button:hover { color: var(--text); background: var(--surface-2); }
.st-pill button:active { transform: scale(.9); }
.st-theme button.on { background: var(--surface-3); color: var(--text); }
.st-secs button.on { background: var(--ink-btn); color: var(--ink-btn-text); box-shadow: 0 8px 16px -10px rgba(0, 0, 0, .7); }
.st-foot { margin-top: auto; }
/* разделы — ровно по центру высоты экрана, логотип и тема сверху, настройки снизу */
@media (min-width: 861px) and (min-height: 760px) {
  html.st-nav .st-secs { position: absolute; left: 0; top: 50%; transform: translateY(-50%); }
  html.st-nav .st-foot { position: absolute; left: 0; bottom: 0; }
}
@media (min-width: 861px) and (max-height: 759px) { html.st-nav .st-secs { margin: auto 0; } html.st-nav .st-foot { margin-top: 0; } }
.st-tip { position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-6px, -50%); padding: 6px 11px; border-radius: 999px; background: #111114; color: #fff; font: 600 12px/1 var(--font); font-style: normal; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .18s, transform .25s cubic-bezier(.34, 1.56, .64, 1); z-index: 2; }
[data-theme='dark'] .st-tip { background: #f4f4f6; color: #111; }
.st-pill button:hover .st-tip, .st-pill button:focus-visible .st-tip { opacity: 1; transform: translate(0, -50%); }
.st-count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--pill); }
.st-tabs-in { position: relative; display: inline-flex; flex-wrap: nowrap; height: 48px; box-sizing: border-box; align-items: center; justify-content: center; gap: 2px; padding: 5px; border-radius: 30px; background: var(--pill); box-shadow: var(--lift); min-height: 48px; }
.st-tab { position: relative; z-index: 1; padding: 9px 15px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none; transition: color .3s; will-change: transform; }
.st-tab:hover { color: var(--text); }
.st-tab.on { color: var(--ink-btn-text); }
:root[data-design='studio'] .st-tab { color: var(--text-2); } :root[data-design='studio'] .st-tab.on { color: var(--ink-btn-text); }
.st-ind { position: absolute; top: 5px; height: 38px; left: 5px; width: 0; border-radius: 999px; background: var(--ink-btn); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .7); opacity: 0; z-index: 0; }
@media (prefers-reduced-motion: reduce) { .st-tip, .st-pill button, .st-tab, .st-logo { transition: none; } }
:root[data-design='studio'] .st-logo { color: var(--text); }
:root .st-tabs-in.st-noind .st-tab.on { color: var(--text); }
.st-ghost { position: fixed; z-index: 47; display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 9px 15px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none; pointer-events: none; will-change: transform, opacity; }
.st-top.st-shift .st-tab { padding: 9px 12px; font-size: 13px; }
html.st-nav .st-top.st-shift { padding-right: calc(24px + var(--st-me-w, 0px)); }
.st-top.st-tight .st-me-who, .st-top.st-tight .st-me-chev { display: none; }
.st-top.st-tight .st-me { padding-right: 6px; }
.st-top.st-scroll .st-tabs { max-width: var(--st-room); }
.st-top.st-scroll .st-tabs-in { max-width: 100%; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
.st-top.st-scroll .st-tabs-in::-webkit-scrollbar { display: none; }
/* плашка сотрудника справа сверху */
.st-me-wrap { position: absolute; right: 20px; top: 16px; }
.st-me { display: flex; align-items: center; gap: 10px; height: 56px; max-width: 260px; padding: 6px 14px 6px 6px; border: 0; border-radius: 999px; background: var(--pill); box-shadow: var(--lift); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s; }
.st-me[hidden] { display: none; }
.st-me:hover { transform: scale(1.03); }
.st-me:active { transform: scale(.97); }
.st-me .tm-av.st-me-av { width: 44px; height: 44px; flex-shrink: 0; font-size: 15px; }
.st-me-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.st-me-who b { font-weight: 700; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-me-who small { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-me-chev { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.st-me.open .st-me-chev { transform: rotate(180deg); }
.st-me-card { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; max-height: calc(100vh - 110px); overflow: auto; padding: 18px; border-radius: 26px; background: var(--pill); box-shadow: var(--lift), 0 30px 60px -30px rgba(0, 0, 0, .45); transform-origin: top right; }
.st-me-card[hidden] { display: none; }
.st-me-head { display: flex; align-items: center; gap: 14px; }
.st-me-head h3 { margin: 0 0 3px; font-size: 17px; letter-spacing: -.01em; }
.st-me-head .tm-av.lg { width: 64px; height: 64px; font-size: 22px; flex-shrink: 0; }
.st-me-duties, .st-me-about { margin: 12px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.st-me-card .tm-dl { margin: 14px 0 0; display: grid; gap: 10px; }
.st-me-card .tm-dl > div { display: block; padding: 0; border: 0; }
.st-me-card .tm-dl dt { font-size: 11.5px; color: var(--text-3, var(--text-2)); margin-bottom: 2px; }
.st-me-card .tm-dl dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.st-me-act { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.st-me-act .btn { flex: 1; justify-content: center; text-align: center; white-space: nowrap; }


/* ===== Вход «с лампой»: тёмная комната, шнурок включает свет и показывает форму (во всех оформлениях) ===== */
#login.login { background: radial-gradient(900px 600px at 30% 40%, #17161a, #0a0a0c 70%); display: flex; align-items: center; justify-content: center; gap: clamp(24px, 6vw, 96px); overflow: hidden; color-scheme: dark; }
#login.login::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s ease;
  background: radial-gradient(520px 420px at calc(50% - 200px) 62%, rgba(255, 196, 110, .16), transparent 70%), radial-gradient(900px 700px at calc(50% - 200px) 70%, rgba(255, 170, 70, .07), transparent 70%); }
#login.login.lit::before { opacity: 1; }
.lamp-scene { position: relative; width: 240px; height: 480px; flex-shrink: 0; }
.lamp { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lamp-head { transform-origin: 120px 70px; }
.lamp-bulb { opacity: .15; transition: opacity .3s; }
.lit .lamp-bulb { opacity: 1; }
.lamp-cone { position: absolute; left: -150px; top: 74px; width: 540px; height: 370px; pointer-events: none; opacity: 0; transition: opacity .35s ease;
  clip-path: polygon(33% 0, 67% 0, 100% 100%, 0 100%); filter: blur(6px);
  background: linear-gradient(180deg, rgba(255, 214, 140, .62) 0%, rgba(255, 196, 110, .28) 45%, rgba(255, 180, 90, .06) 85%, transparent 100%); }
.lit .lamp-cone { opacity: 1; }
.lamp-anim.lit .lamp-cone, .lamp-anim.lit .lamp-bulb { animation: lamp-flicker .55s steps(1, end); }
@keyframes lamp-flicker { 0% { opacity: 0; } 18% { opacity: .7; } 30% { opacity: .1; } 46% { opacity: .9; } 58% { opacity: .35; } 70%, 100% { opacity: 1; } }
.lamp-scene.sway .lamp-head { animation: lamp-sway .9s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes lamp-sway { 0% { transform: rotate(0); } 25% { transform: rotate(2.5deg); } 55% { transform: rotate(-1.4deg); } 80% { transform: rotate(.6deg); } 100% { transform: rotate(0); } }
.lamp-cord { --pull: 0px; position: absolute; left: 176px; top: 74px; width: 28px; height: calc(150px + var(--pull)); margin-left: -14px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; display: flex; flex-direction: column; align-items: center; }
.lamp-cord.grab { cursor: grabbing; }
.lamp-cord:not(.grab) { transition: height .5s cubic-bezier(.34, 1.8, .5, 1); }
.lamp-cord i { width: 2px; flex: 1; background: linear-gradient(#5b5b62, #8a8a93); border-radius: 2px; }
.lamp-cord b { width: 14px; height: 22px; border-radius: 7px 7px 9px 9px; background: linear-gradient(160deg, #ffd27a, #c88a2c); box-shadow: 0 0 0 3px rgba(255, 210, 122, .12), 0 6px 14px -4px rgba(0, 0, 0, .7); transition: transform .2s; }
.lamp-cord:hover b, .lamp-cord:focus-visible b { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(255, 210, 122, .18), 0 0 18px rgba(255, 196, 110, .5); }
.lamp-cord:focus-visible { outline: none; }
.lamp-cord.snap { animation: cord-snap .6s cubic-bezier(.34, 1.8, .5, 1); }
@keyframes cord-snap { 0% { transform: translateY(0); } 30% { transform: translateY(-8px); } 60% { transform: translateY(3px); } 100% { transform: none; } }
.lamp-hint { position: absolute; left: 50%; bottom: -8px; transform: translateX(-30%); width: 260px; margin: 0; text-align: center; font-size: 13px; color: rgba(255, 236, 205, .55); transition: opacity .4s; animation: lamp-hint 2.4s ease-in-out infinite; }
@keyframes lamp-hint { 50% { color: rgba(255, 236, 205, .85); } }
.lit .lamp-hint { opacity: 0; }
#login .login-card { position: relative; z-index: 1; background: rgba(22, 21, 25, .82); border: 1px solid rgba(255, 255, 255, .06); color: #f3efe8; border-radius: 26px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(14px) scale(.97); filter: blur(4px); visibility: hidden; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
  transition: opacity .45s ease, transform .6s cubic-bezier(.22, 1, .36, 1), filter .45s, visibility 0s .45s, box-shadow .6s; }
#login.lit .login-card { opacity: 1; transform: none; filter: none; visibility: visible; transition-delay: .18s, .18s, .18s, 0s, .18s; box-shadow: 0 0 0 1px rgba(255, 210, 140, .12), 0 0 70px -10px rgba(255, 190, 100, .28), 0 30px 60px -30px rgba(0, 0, 0, .9); }
#login .login-card :is(h2, .login-word) { color: #fff6ea; }
#login .login-card :is(.muted, .field > span, small) { color: rgba(243, 239, 232, .62); }
#login .login-card input { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
#login .login-card input::placeholder { color: rgba(255, 255, 255, .32); }
#login .login-card input:focus { border-color: rgba(255, 210, 122, .6); outline: none; box-shadow: 0 0 0 3px rgba(255, 210, 122, .15); }
#login .login-card .btn.primary { background: linear-gradient(180deg, #ffd27a, #f0a640); color: #1b1206; border: 0; border-radius: 999px; box-shadow: 0 10px 24px -10px rgba(240, 166, 64, .8); }
#login .login-card .btn.primary:hover { filter: brightness(1.05); }
#login .login-card .error { color: #ff8a73; }
@media (max-width: 760px) {
  #login.login { flex-direction: column; justify-content: flex-start; gap: 0; padding-top: 12px; overflow-y: auto; }
  .lamp-scene { transform: scale(.62); transform-origin: top center; height: 300px; margin-bottom: -10px; }
  .lamp-hint { font-size: 18px; bottom: 40px; }
  #login.login::before { background: radial-gradient(420px 360px at 50% 30%, rgba(255, 196, 110, .16), transparent 70%); }
}
@media (prefers-reduced-motion: reduce) { .lamp-cone, .lamp-bulb, .lamp-hint, #login .login-card { transition: none; animation: none !important; } .lamp-scene.sway .lamp-head, .lamp-cord.snap { animation: none; } }

/* ===== Загрузка «в кольцо» ===== */
.hoop-court { position: relative; height: 340px; border-radius: var(--r-lg); border: 2px dashed var(--border-strong); overflow: hidden; user-select: none; -webkit-user-select: none;
  background: radial-gradient(420px 220px at 72% 30%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%), var(--surface-2); transition: border-color .2s, background-color .2s; }
.hoop-court.drag { border-color: var(--accent); background-color: var(--accent-soft); }
.hoop-court.win { animation: hoop-win .9s ease; }
@keyframes hoop-win { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 45%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.hoop-head { position: absolute; left: 18px; right: 14px; top: 14px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; pointer-events: none; z-index: 3; }
.hoop-head > div:first-child { display: flex; flex-direction: column; gap: 2px; max-width: 54%; }
.hoop-head b { font-size: var(--text-base); }
.hoop-head .muted { font-size: var(--text-xs); }
.hoop-tools { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.hoop-snd { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.hoop-snd svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hoop-score { padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--text-xs); white-space: nowrap; }
.hoop-aim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: var(--text-3); z-index: 1; }
.hoop { position: absolute; left: 68%; top: 54px; width: 120px; height: 150px; margin-left: -60px; z-index: 2; pointer-events: none; transition: transform .25s; }
.hoop-court.drag-hoop .hoop { transform: scale(1.08); }
.hoop-board { position: absolute; left: 14px; right: 14px; top: 0; height: 66px; border-radius: 10px; background: var(--surface); border: 2px solid color-mix(in srgb, var(--text) 18%, transparent); box-shadow: var(--shadow); }
.hoop-board::after { content: ''; position: absolute; left: 50%; top: 24px; width: 40px; height: 30px; margin-left: -20px; border: 2px solid color-mix(in srgb, var(--text) 25%, transparent); border-radius: 4px; }
.hoop-rim, .hoop-rim-back { position: absolute; left: 12px; right: 12px; top: 56px; height: 14px; border-radius: 50%; }
.hoop-rim-back { border: 4px solid color-mix(in srgb, var(--accent) 60%, #000); border-bottom-color: transparent; }
.hoop-rim { border: 4px solid var(--accent); border-top-color: transparent; z-index: 3; box-shadow: 0 4px 8px -4px rgba(0, 0, 0, .4); }
.hoop-net { position: absolute; left: 12px; top: 62px; width: 96px; height: 70px; fill: none; stroke: color-mix(in srgb, var(--text) 35%, transparent); stroke-width: 1.4; stroke-linecap: round; z-index: 3; transform-origin: top center; }
.hoop.swish .hoop-net { animation: hoop-net .7s cubic-bezier(.34, 1.56, .64, 1); }
.hoop.swish .hoop-rim { animation: hoop-rim .4s ease; }
@keyframes hoop-net { 0% { transform: scaleY(1); } 30% { transform: scaleY(1.28) scaleX(.86); } 60% { transform: scaleY(.92); } 100% { transform: none; } }
@keyframes hoop-rim { 30% { transform: translateY(3px); } }
.hoop-ball { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border-radius: 12px; border: 0; padding: 0; cursor: pointer; z-index: 4; touch-action: none;
  background: var(--surface); color: var(--text-3); box-shadow: 0 10px 20px -10px rgba(0, 0, 0, .5), inset 0 0 0 1.5px var(--border-strong); display: grid; place-items: center; will-change: transform; }
.hoop-ball svg { position: absolute; inset: 6px; width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.hoop-ball b { position: relative; margin-top: 8px; font-size: 16px; line-height: 1; color: var(--accent); }
.hoop-ball.loaded { cursor: grab; color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft), 0 12px 22px -10px rgba(0, 0, 0, .55), inset 0 0 0 1.5px var(--accent); }
.hoop-ball.loaded b { font-size: 9px; font-weight: 800; letter-spacing: .02em; padding: 1px 3px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); }
.hoop-ball.aim { cursor: grabbing; }
.hoop-ball:not(.fly):not(.aim) { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.hoop-ball.pop { animation: hoop-pop .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes hoop-pop { from { opacity: 0; } to { opacity: 1; } }
.hoop-ball:not(.loaded):not(.fly) { animation: hoop-bob 2.2s ease-in-out infinite; }
@keyframes hoop-bob { 50% { box-shadow: 0 0 0 7px var(--accent-soft), 0 10px 20px -10px rgba(0, 0, 0, .5), inset 0 0 0 1.5px var(--border-strong); } }
.hoop-ball.in { z-index: 2; }
.hoop-name { position: absolute; left: 20px; bottom: 50px; max-width: 40%; font-size: var(--text-xs); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.hoop-bottom { position: absolute; left: 18px; right: 14px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hoop-bottom .muted { font-size: 11px; max-width: 60%; }
.hoop-bottom .btn { margin-left: auto; }
.hoop-court .hoop-name { bottom: 82px; left: 92px; }
@media (max-width: 600px) { .hoop-court { height: 380px; } .hoop { left: 70%; top: 92px; } .hoop-head > div:first-child { max-width: 66%; } .hoop-bottom { flex-direction: column; align-items: stretch; } .hoop-bottom .muted { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .hoop-ball, .hoop-net, .hoop-rim, .hoop-court { animation: none !important; transition: none !important; } }

/* ===== «Задачи»: доска из четырёх колонок и карточка задачи слева (во всех оформлениях) ===== */
.tk-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: var(--s4); }
.tk-flt { border-radius: 999px; padding: 4px; }
.tk-flt button { border-radius: 999px; padding: 7px 14px; font-size: 13px; transition: background .25s, color .25s; }
.tk-total { margin-left: auto; color: var(--text-2); font-size: 13px; }
.tk-total b { color: var(--text); }
.tk-add { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding-inline: 18px; }
.tk-add svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tk-board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.tk-col { background: var(--surface-2); border-radius: 22px; padding: 10px; min-height: 260px; box-shadow: inset 0 0 0 1px var(--border); }
.tk-col-h { display: flex; align-items: center; gap: 8px; padding: 6px 8px 12px; font-size: 14px; }
.tk-col-n { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 1px var(--border); }
.tk-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--text-3); }
.tk-dot.work { background: #f2a33a; } .tk-dot.ops { background: #4f7cff; } .tk-dot.done { background: #2bb673; } .tk-dot.new { background: #9aa0aa; }
.tk-list { display: flex; flex-direction: column; gap: 10px; min-height: 120px; border-radius: 16px; transition: background .2s, box-shadow .2s; padding: 2px; }
.tk-dragging .tk-list { box-shadow: inset 0 0 0 2px transparent; }
.tk-list.over { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.tk-ph { height: 64px; border-radius: 16px; border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tk-empty { margin: 0; padding: 26px 8px; text-align: center; color: var(--text-3); font-size: 13px; }
.tk-card { position: relative; background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 0 0 1px var(--border); cursor: pointer; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s; outline: none; }
.tk-card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .35), 0 0 0 1px var(--border); }
.tk-card:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.tk-card[draggable='true'] { cursor: grab; }
.tk-card.dragging { opacity: .35; transform: scale(.97); }
.tk-card h3 { margin: 8px 0 12px; font-size: 14px; line-height: 1.35; font-weight: 650; letter-spacing: -.005em; overflow-wrap: anywhere; }
.tk-card.is-done h3 { text-decoration: line-through; color: var(--text-2); }
.tk-card-top { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.tk-pri, .tk-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.tk-pri svg, .tk-tag svg, .tk-chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pri-high .tk-pri, .tk-chip.pri-high { background: #fde8e6; color: #c8372d; }
.pri-mid .tk-pri, .tk-chip.pri-mid { background: #fdf1dc; color: #a86a0c; }
.pri-low .tk-pri, .tk-chip.pri-low { background: var(--surface-3); color: var(--text-2); }
[data-theme='dark'] :is(.pri-high .tk-pri, .tk-chip.pri-high) { background: rgba(232, 80, 66, .18); color: #ff8a7f; }
[data-theme='dark'] :is(.pri-mid .tk-pri, .tk-chip.pri-mid) { background: rgba(242, 163, 58, .16); color: #f5b860; }
.tk-tag { background: var(--surface-3); color: var(--text-2); font-weight: 600; }
.tk-new { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--accent-ink, #fff); font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.tk-more { margin-left: auto; width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.tk-more:hover { background: var(--surface-3); color: var(--text); }
.tk-more svg { width: 16px; height: 16px; fill: currentColor; }
.tk-card-bot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.tk-due, .tk-cnt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tk-due svg, .tk-cnt svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tk-due.soon { color: #b7770f; font-weight: 600; } .tk-due.late { color: var(--bad); font-weight: 700; }
.tk-avs { margin-left: auto; display: flex; align-items: center; }
.tk-avs > * + * { margin-left: -7px; }
.tm-av.tk-av { width: 28px; height: 28px; font-size: 10px; letter-spacing: 0; box-shadow: 0 0 0 2px var(--surface); flex-shrink: 0; }
.tm-av.tk-av.sm { width: 24px; height: 24px; font-size: 9.5px; }
.tm-av.tk-av.xs { width: 26px; height: 26px; font-size: 10px; }
.tk-more-av { font-style: normal; font-size: 10.5px; font-weight: 700; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); box-shadow: 0 0 0 2px var(--surface); }
.tk-menu { position: fixed; z-index: 80; min-width: 190px; padding: 6px; border-radius: 16px; background: var(--surface); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .4), 0 0 0 1px var(--border); display: flex; flex-direction: column; }
.tk-menu small { padding: 6px 10px 4px; color: var(--text-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.tk-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.tk-menu button:hover, .tk-menu button:focus-visible { background: var(--surface-2); outline: none; }

.tk-backdrop { position: fixed; inset: 0; z-index: 47; background: rgba(10, 13, 18, .32); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.tk-panel { position: fixed; z-index: 48; left: 12px; top: 12px; bottom: 12px; width: min(480px, calc(100vw - 24px)); display: flex; flex-direction: column; background: var(--surface); border-radius: 26px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55), 0 0 0 1px var(--border); overflow: hidden; }
.tk-panel[hidden], .tk-backdrop[hidden] { display: none; }
.tk-p-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px 20px; }
.tk-p-sp { flex: 1; }
.tk-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text); }
.tk-ibtn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background .2s, color .2s, transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.tk-ibtn:hover { color: var(--text); background: var(--surface-3); }
.tk-ibtn:active { transform: scale(.9); }
.tk-ibtn svg, .tk-send svg, .tk-pill svg, .tk-p-watch h4 svg, .tk-p-com h4 svg, .tk-fileb svg, .tk-file-chip svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tk-p-scroll { flex: 1; overflow-y: auto; padding: 4px 22px 18px; overscroll-behavior: contain; }
.tk-p-title { margin: 6px 0 10px; font-size: 22px; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
.tk-p-by { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 13px; color: var(--text-2); }
.tk-p-by b { color: var(--text); font-weight: 600; }
.tk-p-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.tk-p-meta > div { background: var(--surface-2); border-radius: 16px; padding: 10px 12px; min-width: 0; }
.tk-p-meta dt { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.tk-p-meta dd { margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tk-person > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tk-person b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-person small { color: var(--text-3); font-size: 11.5px; }
.tk-p-body { font-size: 14px; line-height: 1.55; padding: 12px 14px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--border); margin-bottom: 16px; overflow-wrap: anywhere; }
.tk-p-move { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); margin-bottom: 18px; }
.tk-p-move button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; border: 0; border-radius: 12px; background: none; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; transition: background .25s, color .25s; white-space: nowrap; }
.tk-p-move button.on { background: var(--surface); color: var(--text); box-shadow: 0 4px 10px -6px rgba(0, 0, 0, .35); }
.tk-p-watch h4, .tk-p-com h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; font-size: 13px; color: var(--text-2); font-weight: 650; }
.tk-p-watch h4 span, .tk-p-com h4 span { color: var(--text-3); }
.tk-watch-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; font-size: 13px; }
.tk-pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px 3px 3px; border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 550; }
.tk-pill.add { border: 1px dashed var(--border-strong); background: none; color: var(--text-2); padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.tk-pill.add:hover { color: var(--text); border-color: var(--text-3); }
.tk-coms { display: flex; flex-direction: column; gap: 12px; }
.tk-com { display: flex; gap: 10px; align-items: flex-start; }
.tk-com-b { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 4px 16px 16px 16px; padding: 9px 12px; }
.tk-com.mine .tk-com-b { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.tk-com-h { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.tk-com-h time { color: var(--text-3); font-size: 11.5px; }
.tk-com-b p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tk-sys { margin: 0; text-align: center; font-size: 11.5px; color: var(--text-3); }
.tk-com-empty { font-size: 13px; }
.tk-img { display: block; margin-top: 8px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; max-width: 260px; min-height: 60px; background: var(--surface-3); cursor: zoom-in; }
.tk-img img { display: block; max-width: 100%; max-height: 220px; }
.tk-img .skeleton { display: block; width: 200px; height: 120px; }
.tk-fileb { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 12px; max-width: 100%; border: 0; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.tk-fileb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tk-fileb small, .tk-file-chip small { color: var(--text-3); white-space: nowrap; }
.tk-p-form { padding: 10px 14px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.tk-p-input { display: flex; align-items: flex-end; gap: 8px; }
.tk-p-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; }
.tk-p-input textarea:focus { outline: none; border-color: var(--accent); }
.tk-attach { cursor: pointer; width: 40px; height: 40px; }
.tk-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink, #fff); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.tk-send:active { transform: scale(.88); }
.tk-send:disabled { opacity: .5; }
.tk-file-chip { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.tk-file-chip[hidden] { display: none; }
.tk-file-chip span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tk-file-chip button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.tk-form { display: flex; flex-direction: column; gap: 14px; }
.tk-form .field { display: flex; flex-direction: column; gap: 6px; }
.tk-form textarea { resize: vertical; }
.tk-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.tk-form .seg { align-self: flex-start; }
.tk-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.tk-pick { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 14px; background: var(--surface-2); cursor: pointer; border: 1px solid transparent; transition: border-color .2s, background .2s; }
.tk-pick[hidden] { display: none; }
.tk-pick:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.tk-pick input { accent-color: var(--accent); }
.tk-pick > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tk-pick b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-pick small { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 1180px) { .tk-board { grid-template-columns: repeat(4, 260px); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; } .tk-col { scroll-snap-align: start; } }
@media (max-width: 860px) {
  .tk-board { grid-template-columns: repeat(4, 84vw); gap: 10px; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .tk-total { margin-left: 0; }
  .tk-flt { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .tk-flt button { white-space: nowrap; }
  .tk-panel { left: 0; top: 0; bottom: 0; width: 100vw; border-radius: 0; z-index: 64; }
  .tk-backdrop { z-index: 63; }
  .tk-p-move { grid-template-columns: repeat(2, 1fr); }
  .tk-form-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tk-card, .tk-ibtn, .tk-send { transition: none; } }
/* «Студия»: капсулы и мягкие тени */
:root[data-design='studio'] .tk-col { background: color-mix(in srgb, var(--surface) 55%, var(--bg)); box-shadow: none; border-radius: 26px; }
:root[data-design='studio'] .tk-card { border-radius: 20px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 20px -16px rgba(0, 0, 0, .3); }
:root[data-design='studio'] .tk-add { background: var(--ink-btn); color: var(--ink-btn-text); }
:root[data-design='studio'] .tk-p-move button.on { background: var(--ink-btn); color: var(--ink-btn-text); }

/* «Студия»: свёрнутый чат — кружки с аватарами; при наведении колонка раскрывается и кружки вытягиваются в капсулы с именами */
.chat-item .ico.av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.chat-item .ico.av.has-ph { overflow: hidden; }
@media (min-width: 861px) {
  :root[data-design='studio'] .chat-list { padding: 4px 6px var(--s4); gap: 6px; }
  :root[data-design='studio'] .chat-item { min-height: 48px; padding: 4px; gap: 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); transition: background .25s, box-shadow .25s; }
  :root[data-design='studio'] .chat-item .ico.av { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 38%, #26262c); --blob-ink: #fff; color: #fff; font-size: 12.5px; letter-spacing: 0; }
  :root[data-design='studio'] .chat-item .ico.av.grp { background: rgba(255, 255, 255, .14); }
  :root[data-design='studio'] .chat-item.unread { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); }
  :root[data-design='studio'] .chat-item .chat-dot { position: absolute; left: 32px; top: 0; }
  :root[data-design='studio'] .chat-item time { margin-right: 10px; }
  :root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-item { padding: 4px; justify-content: flex-start; }
  :root[data-design='studio'] .chat-item :is(.chat-item-text, time) { transition: opacity .3s ease, transform .4s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(90ms + var(--i, 0) * 35ms); }
  :root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-item :is(.chat-item-text, time) { transform: translateX(-10px); transition-delay: 0s; transition-duration: .12s; }
}
@media (min-width: 861px) and (prefers-reduced-motion: reduce) { :root[data-design='studio'] .chat-item :is(.chat-item-text, time) { transition: none; } }

/* Студия: чат в той же светлой «капсуле», что и левая панель разделов */
:root[data-design='studio'] .chat { background: var(--pill); color: var(--text); box-shadow: var(--lift); }
:root[data-design='studio'] :is(.chat-title, .chat-item-text b, .chat-with b) { color: var(--text); }
:root[data-design='studio'] :is(.chat-item-text small, .chat-item time, .chat-with small, .chat-empty) { color: var(--text-2); opacity: 1; }
:root[data-design='studio'] .chat-item { background: transparent; color: var(--text); }
:root[data-design='studio'] .chat-item:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
:root[data-design='studio'] .chat-item.on { background: var(--ink-btn); color: var(--ink-btn-text); box-shadow: 0 8px 16px -10px rgba(0, 0, 0, .7); }
:root[data-design='studio'] .chat-item.on :is(.chat-item-text b, .chat-item-text small, time) { color: var(--ink-btn-text); }
:root[data-design='studio'] .chat-item .ico.av { background: color-mix(in srgb, var(--text) 9%, var(--pill)); color: var(--text); --blob-ink: var(--text); }
:root[data-design='studio'] .chat-item .ico.av.grp { background: color-mix(in srgb, var(--text) 9%, var(--pill)); }
:root[data-design='studio'] .chat-item.on .ico.av { background: color-mix(in srgb, var(--ink-btn-text) 16%, transparent); color: var(--ink-btn-text); }
:root[data-design='studio'] :is(.chat-search, .chat-x, .chat-back) { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
:root[data-design='studio'] .chat-search input { color: var(--text); }
:root[data-design='studio'] .chat-conv-head { border-bottom-color: var(--border); }
:root[data-design='studio'] .chat:is(:hover, :focus-within, .open) { box-shadow: var(--lift-hi, var(--lift)); }
@media (min-width: 861px) {
  :root[data-design='studio'] .chat-item:not(.on):not(:hover) { background: color-mix(in srgb, var(--text) 5%, transparent); }
  :root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-item { background: transparent; }
  :root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-item.on { background: transparent; box-shadow: none; }
  :root[data-design='studio'] .chat:not(:hover):not(:focus-within):not(.open) .chat-item.on .ico.av { background: var(--ink-btn); color: var(--ink-btn-text); }
}

/* «Команда › ИП» и «Команда › Водители» */
.pp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: var(--s4); }
.pp-search { flex: 1 1 260px; max-width: 420px; }
.pp-stat { color: var(--text-2); font-size: var(--text-sm); }
.pp-stat b { color: var(--text); }
.pp-add { margin-left: auto; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--s4); }
.pp-ip { display: flex; flex-direction: column; gap: 12px; padding: var(--s4); cursor: pointer; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s; }
.pp-ip:hover, .pp-ip:focus-visible { transform: translateY(-2px); box-shadow: var(--lift-hi, var(--shadow)); outline: none; }
.pp-ip-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pp-ip-top > div { display: flex; flex-direction: column; min-width: 0; }
.pp-ip-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-ip-top small { color: var(--text-2); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-ip-av { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: 0; background: var(--accent-soft); color: var(--accent); }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.pp-chip.ok { background: var(--good-soft, var(--surface-3)); color: var(--good); }
.pp-chip.warn { background: var(--warn-soft); color: var(--warn); }
.pp-chip .clip, .po-req .clip { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pp-ip-drv { font-size: var(--text-sm); color: var(--text-2); }
.pp-ip-drv b { color: var(--text); }
.pp-ip-ph { font-size: var(--text-xs); color: var(--text-2); }
.pp-sec { margin: var(--s3) 0 0; font-size: var(--text-base); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-files { margin-top: var(--s3); padding: 12px; border-radius: var(--r-md, 12px); background: var(--surface-2); }
.pp-files-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pp-files-h .btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pp-files-h .clip { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pp-drv { display: flex; flex-direction: column; gap: 6px; }
.pp-drv-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.pp-drv-row b { flex: 1; min-width: 0; }
.pp-drv-row small { color: var(--text-2); font-size: var(--text-xs); }
.pp-drv-add { display: flex; gap: 8px; margin-top: 4px; }
.pp-drv-add select { flex: 1; min-width: 0; }
.pp-plate { display: inline-block; padding: 2px 8px; border-radius: 6px; border: 1.5px solid var(--text); font: 700 12px/1.4 var(--mono, ui-monospace, monospace); letter-spacing: .04em; white-space: nowrap; background: var(--surface); color: var(--text); }
.pp-diff { align-items: center; }
.pp-diff .btn { margin-left: auto; flex-shrink: 0; }
.pp-seg button { white-space: nowrap; }
.pp-card { padding: 0; overflow: hidden; }
.pp-card .card-head { padding: var(--s4) var(--s4) 0; }
.pp-wrap { max-height: calc(100vh - 260px); overflow: auto; }
.pp-table { border-collapse: separate; border-spacing: 0; min-width: 1480px; }
.pp-table th { position: sticky; top: 0; z-index: 2; background: var(--surface); white-space: nowrap; font-size: var(--text-xs); }
.pp-table td { vertical-align: middle; padding: 6px 6px; border-bottom: 1px solid var(--border); }
.pp-table td.pp-sticky, .pp-table th.pp-sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 190px; box-shadow: 1px 0 0 var(--border); }
.pp-table th.pp-sticky { z-index: 3; }
.pp-table td.pp-sticky b { display: block; white-space: nowrap; }
.pp-table td.pp-sticky small { display: block; color: var(--text-2); font-size: 11px; white-space: nowrap; }
.pp-in { width: 100%; min-width: 0; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; font: inherit; font-size: var(--text-sm); color: var(--text); transition: border-color .2s, background .2s, box-shadow .3s; }
.pp-in:hover:not([disabled]) { border-color: var(--border); }
.pp-in:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.pp-in::placeholder { color: var(--text-3, var(--text-2)); opacity: .55; }
select.pp-in { cursor: pointer; min-width: 92px; }
.pp-in.w-xs { width: 80px; } .pp-in.w-s { width: 128px; } .pp-in.w-m { width: 150px; } .pp-in.w-l { width: 220px; }
.pp-yn { min-width: 68px; font-weight: 700; }
.pp-yn.yes { color: var(--good); } .pp-yn.no { color: var(--text-2); }
.pp-in.saving { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.pp-in.saved { box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 45%, transparent); }
.pp-in.err { border-color: var(--bad); }
.pp-pl { white-space: nowrap; }
tr.pp-mis td { background: color-mix(in srgb, var(--warn) 7%, transparent); }
tr.pp-mis td.pp-sticky { background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.pp-mis-box { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.pp-mis-box small { color: var(--warn); font-size: 11px; }
.pp-mis-box span { display: flex; gap: 4px; }
/* ФОТ: реквизиты только индикацией */
.po-req { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.po-st { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.po-st.ok { color: var(--good); background: var(--good-soft, var(--surface-3)); }
.po-st.warn { color: var(--warn); background: var(--warn-soft); }
.po-clip.is-ro { margin-left: 0; cursor: inherit; display: inline-flex; align-items: center; gap: 2px; }
a.po-req:hover .po-st { text-decoration: underline; }
@media (max-width: 860px) { .pp-add { margin-left: 0; } .pp-wrap { max-height: none; } }
/* «Водители › Топливные карты» */
.fc-table { min-width: 720px; }
.fc-table td:first-child, .fc-table th:first-child { padding-left: var(--s4); }
.fc-no { font: 700 14px/1.4 var(--mono, ui-monospace, monospace); letter-spacing: .04em; white-space: nowrap; }
.fc-pin { width: 110px; font-family: var(--mono, ui-monospace, monospace); letter-spacing: .12em; }
.fc-drv { width: 260px; }
.fc-hint { display: block; padding-left: 9px; font-size: 11px; color: var(--warn); }
.fc-hint.ok { color: var(--text-2); }
.fc-card { margin-top: 0; }
/* «Сегодня»: «всё верно» и подсветка места, куда перешли */
.ti-foot .ti-ack { margin-left: auto; margin-right: 8px; }
@keyframes ti-flash { 0%, 100% { box-shadow: var(--lift, var(--shadow)); } 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent), var(--lift, var(--shadow)); } }
.ti-flash { animation: ti-flash 1.1s ease 2; }
@media (prefers-reduced-motion: reduce) { .ti-flash { animation: none; outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); } }
