/* Финансовый учёт - стили интерфейса */
:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f8;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --text: #0f1b2d;
  --text-2: #475467;
  --muted: #8a94a6;
  --primary: #1f5fae;
  --primary-strong: #174a8b;
  --primary-soft: #e9f1fb;
  --primary-ring: rgba(31, 95, 174, .22);
  --nav-bg: #0e2340;
  --nav-bg-2: #13305a;
  --nav-text: #c8d3e3;
  --nav-muted: #7d8fab;
  --input-bg: #fffbea;
  --input-border: #efe0a8;
  --input-hover: #fff6d6;
  --good: #12804a; --good-bg: #e6f5ec; --good-dot: #0ca30c;
  --warn: #9a5b00; --warn-bg: #fff3d6; --warn-dot: #fab219;
  --bad: #b42323;  --bad-bg: #fdeaea;  --bad-dot: #d03b3b;
  --neutral: #5b6478; --neutral-bg: #eef1f5;
  --s-service: #2a78d6; --s-transport: #eb6834; --s-other: #1baf7a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
svg.ic { width: 20px; height: 20px; flex: none; display: block; }
svg.ic.inline { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; color: var(--muted); }
.hidden { display: none !important; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ---------- загрузка ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- вход ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  background: radial-gradient(1200px 600px at -10% -20%, #24548f 0%, transparent 60%),
              radial-gradient(900px 500px at 120% 120%, #1a6a8f 0%, transparent 55%),
              linear-gradient(160deg, #0d203b 0%, #12305a 100%);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-hero .brand { display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 17px; letter-spacing: .2px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #3b8be6, #1f5fae); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.brand-mark svg { width: 22px; height: 22px; color: #fff; }
.login-hero h1 { font-size: 34px; line-height: 1.15; margin: 0 0 14px; font-weight: 700; letter-spacing: -.5px; max-width: 460px; }
.login-hero p { color: #b9c8dd; font-size: 15px; max-width: 440px; margin: 0; }
.login-points { display: grid; gap: 14px; margin-top: 34px; }
.login-points div { display: flex; gap: 12px; align-items: center; color: #dbe5f2; }
.login-points svg { width: 20px; height: 20px; color: #7fb6f2; }
.login-hero .foot { color: #7f93b0; font-size: 12px; }
.login-bars { position: absolute; right: -40px; bottom: 60px; display: flex; gap: 10px; align-items: flex-end; opacity: .12; }
.login-bars i { width: 26px; border-radius: 6px 6px 0 0; background: #fff; display: block; }
.login-form-wrap { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.3px; }
.login-card .sub { color: var(--text-2); margin: 0 0 26px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(180, 35, 35, .12); }
select.input { background-color: var(--surface); }   /* шеврон и отступ справа - из ui-controls.css */
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 44px; }
.pass-toggle { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.pass-toggle:hover { color: var(--text); background: var(--surface-3); }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.form-error svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---------- кнопки ---------- */
.btn {
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 13.5px;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; user-select: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #941b1b; }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-bg); }
.btn-lg { height: 44px; font-size: 14.5px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
.sidebar {
  background: linear-gradient(180deg, var(--nav-bg) 0%, #0b1d36 100%); color: var(--nav-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 30;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 18px; color: #fff; }
.sidebar .brand-text b { display: block; font-size: 15px; font-weight: 650; letter-spacing: .1px; }
.sidebar .brand-text span { display: block; font-size: 11.5px; color: var(--nav-muted); margin-top: 1px; line-height: 1.3; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--nav-muted); padding: 16px 10px 7px; font-weight: 600; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 9px; border: 0; background: none;
  color: var(--nav-text); cursor: pointer; text-align: left; font-size: 14px; font-weight: 500; margin-bottom: 2px; text-decoration: none;
}
.nav-item svg { width: 20px; height: 20px; color: var(--nav-muted); }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item:hover svg { color: #c9d6ea; }
.nav-item.active { background: rgba(80, 148, 230, .18); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #5b9ef0; pointer-events: none; }
.nav-item.active svg { color: #8cc0ff; }
.nav-item .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; }
.side-user { border-top: 1px solid rgba(255, 255, 255, .08); padding: 14px 14px 16px; }
.side-user .who { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #3b7fd4, #2a5fa6); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 14px; flex: none; }
.side-user .who b { display: block; color: #fff; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.side-user .who span { display: block; font-size: 12px; color: var(--nav-muted); }
.side-user .acts { display: flex; gap: 6px; }
.side-btn { flex: 1; height: 32px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .12); background: transparent; color: var(--nav-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; font-weight: 550; }
.side-btn svg { width: 16px; height: 16px; }
.side-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- сворачиваемое меню ---------- */
.nav-toggle {
  position: absolute; top: 27px; right: -13px; z-index: 31; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-1);
  display: grid; place-items: center; cursor: pointer; padding: 0; transition: color .15s, border-color .15s;
}
.nav-toggle:hover { color: var(--primary); border-color: #b9cbe4; }
.nav-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.nav-toggle svg { width: 15px; height: 15px; transition: transform .2s ease; }
.nav-item .lbl, .side-btn .lbl, .side-user .who .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar .brand { padding-right: 26px; }   /* место под кнопку сворачивания */
.sidebar .brand-text { min-width: 0; }
.shell.nav-collapsed { --sidebar-w: 76px; }
.nav-collapsed .nav-toggle svg { transform: rotate(180deg); }
.nav-collapsed .sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.nav-collapsed .sidebar .brand-text,
.nav-collapsed .nav-item .lbl,
.nav-collapsed .side-btn .lbl,
.nav-collapsed .side-user .who .lbl { display: none; }
.nav-collapsed .nav { padding: 6px 12px 14px; }
.nav-collapsed .nav-group { font-size: 0; padding: 12px 0 8px; }
.nav-collapsed .nav-group::after { content: ""; display: block; height: 1px; margin: 0 6px; background: rgba(255, 255, 255, .1); }
.nav-collapsed .nav-group:first-child { padding-top: 4px; }
.nav-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.nav-collapsed .nav-item .dot { position: absolute; top: 7px; right: 9px; width: 6px; height: 6px; margin: 0; }
.nav-collapsed .side-user { padding: 12px 10px 14px; }
.nav-collapsed .side-user .who { justify-content: center; }
.nav-collapsed .side-user .acts { flex-direction: column; }
.nav-collapsed .side-btn { flex: none; height: 34px; }
.nav-tip {
  position: fixed; z-index: 70; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: #13233b; color: #fff;
  font-size: 12.5px; font-weight: 550; white-space: nowrap; box-shadow: var(--shadow-2); animation: fade .12s ease-out;
}
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(243, 245, 249, .88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border); padding: 12px 28px; display: flex; align-items: center; gap: 14px; min-height: 66px;
}
.topbar .title { min-width: 0; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 680; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

/* переключатель месяца */
.month-switch { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px; height: 40px; box-shadow: var(--shadow-1); }
.month-switch .arrow { width: 36px; height: 38px; border: 0; background: none; cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.month-switch .arrow:hover { color: var(--primary); background: var(--surface-3); }
.month-switch .arrow:first-child { border-radius: 10px 0 0 10px; }
.month-switch .arrow:last-child { border-radius: 0 10px 10px 0; }
.month-switch .arrow svg { width: 17px; height: 17px; }
.month-btn { height: 38px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: none; padding: 0 14px; display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 650; min-width: 168px; justify-content: center; }
.month-btn svg { width: 18px; height: 18px; color: var(--primary); }
.month-btn .lock { color: var(--muted); width: 15px; height: 15px; }
.month-btn:hover { background: var(--surface-2); }

.save-state { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.save-state svg { width: 17px; height: 17px; }
.save-state.ok svg { color: var(--good); }
.save-state.err { color: var(--bad); }
.save-state.err svg { color: var(--bad); }

/* выпадающие меню */
.dropdown { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 36px rgba(18, 30, 55, .16), 0 2px 8px rgba(18, 30, 55, .06); padding: 6px; min-width: 220px; max-height: 70vh; overflow: auto; animation: pop .14s cubic-bezier(.22, .9, .35, 1.15); transform-origin: top left; font-size: 13px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dd-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #aab2c0; padding: 8px 10px 4px; font-weight: 700; }
.dd-label:not(:first-child) { margin-top: 4px; border-top: 1px solid #eef1f5; padding-top: 10px; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; white-space: nowrap; }
.dd-item + .dd-item { margin-top: 1px; }
.dd-item:hover { background: #f2f4f8; }
.dd-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dd-item.active:hover { background: color-mix(in srgb, var(--primary) 13%, var(--surface)); }
.dd-item .tick { margin-left: auto; margin-right: -2px; color: var(--primary); }
.dd-item svg { width: 17px; height: 17px; color: var(--muted); }
.dd-item .meta { margin-left: auto; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.dd-item .meta svg { width: 14px; height: 14px; }
.dd-item.danger { color: var(--bad); }
.dd-item.danger svg { color: var(--bad); }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- карточки и сетки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15.5px; margin: 0; font-weight: 660; letter-spacing: -.1px; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 12px 0 6px; }
.card-note { margin: 10px 20px 0; padding: 10px 13px; background: var(--primary-soft); color: #2b4a73; border-radius: 10px; font-size: 13px; display: flex; gap: 9px; align-items: flex-start; }
.card-note svg { width: 18px; height: 18px; color: var(--primary); flex: none; margin-top: 1px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2.wide-only { margin-bottom: 20px; }
@media (max-width: 1599px) { .grid-2.wide-only { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 20px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* баннеры */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px; border: 1px solid; }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner b { font-weight: 650; }
.banner.info { background: var(--primary-soft); border-color: #cddff6; color: #22436d; }
.banner.info svg { color: var(--primary); }
.banner.warn { background: var(--warn-bg); border-color: #f3dfaa; color: #6b4300; }
.banner.warn svg { color: #c88a00; }
.banner.bad { background: var(--bad-bg); border-color: #f5c9c9; color: #7f1717; }
.banner.bad svg { color: var(--bad); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner li { margin: 2px 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { --bar: var(--border-strong); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-1); position: relative; }
.kpi::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--bar); pointer-events: none; }
.kpi.st-green { --bar: var(--good-dot); }
.kpi.st-yellow { --bar: var(--warn-dot); }
.kpi.st-red { --bar: var(--bad-dot); }
.kpi .label { font-size: 12.5px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.6px; margin: 6px 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .value.neg { color: var(--bad); }
.kpi .norm { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* статусы */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.badge.green { background: var(--good-bg); color: var(--good); }
.badge.green i { background: var(--good-dot); }
.badge.yellow { background: var(--warn-bg); color: var(--warn); }
.badge.yellow i { background: var(--warn-dot); }
.badge.red { background: var(--bad-bg); color: var(--bad); }
.badge.red i { background: var(--bad-dot); }
.badge.none { background: var(--neutral-bg); color: var(--neutral); }
.badge.none i { background: #b3bccb; }
.badge.blue { background: var(--primary-soft); color: var(--primary-strong); }
.badge.plain { background: var(--surface-3); color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 550; background: var(--surface-3); color: var(--text-2); margin: 2px 4px 2px 0; }
.chip i { width: 8px; height: 8px; border-radius: 3px; display: block; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
table.t td { padding: 9px 14px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t th:first-child, table.t td:first-child { padding-left: 20px; }
table.t th:last-child, table.t td:last-child { padding-right: 20px; }
table.t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t .c { text-align: center; }
table.t tbody tr:hover td { background: #fafbfd; }
table.t tr.total td { background: var(--surface-2); font-weight: 680; border-top: 1px solid var(--border); }
table.t tr.total:hover td { background: var(--surface-2); }
table.t tr.calc td { font-weight: 640; }
table.t tr.calc td:first-child { color: var(--text); }
table.t tr.strong td:first-child { font-weight: 620; }
table.t tr.sub td:first-child { padding-left: 38px; color: var(--text-2); }
table.t tr.auto td { background: #f6f9fd; color: var(--text-2); }
table.t td.muted, table.t .muted { color: var(--muted); }
table.t .nowrap { white-space: nowrap; }
table.t .neg { color: var(--bad); }
table.t .dash { color: #c3cad6; }
table.t td.lbl { min-width: 220px; }
table.t .sub-lbl { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
table.t.compact td { padding-top: 7px; padding-bottom: 7px; }
table.t th.dir { white-space: nowrap; }
table.t.fixed { table-layout: fixed; min-width: 720px; }
table.t.fixed td.lbl { min-width: 0; }
table.t .w-in { width: 184px; }
table.t .w-total { width: 140px; }
table.t .w-num { width: 136px; }
table.t .w-share { width: 190px; }
table.t .w-base { width: 186px; }
table.t.fixed td.in { width: auto; }
table.t.fixed .cell-input { min-width: 0; }
table.t.dense th, table.t.dense td { padding-left: 8px; padding-right: 8px; }
table.t.dense th:first-child, table.t.dense td:first-child { padding-left: 20px; }
table.t.dense th:last-child, table.t.dense td:last-child { padding-right: 20px; }
table.t.dense td.in { width: auto; }
table.t.dense .cell-input { min-width: 96px; }
table.t.dense .cell-input.text { min-width: 150px; }
table.t.dense select.cell-select { min-width: 120px; width: auto; }
.dir-dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 7px; vertical-align: 1px; }
.dir-dot.service { background: var(--s-service); }
.dir-dot.transport { background: var(--s-transport); }
.dir-dot.other { background: var(--s-other); }

/* ячейки ввода */
td.in { padding-top: 5px !important; padding-bottom: 5px !important; width: 168px; }
.cell-input {
  width: 100%; min-width: 120px; height: 34px; border: 1px solid var(--input-border); background: var(--input-bg); border-radius: 8px;
  padding: 0 10px; text-align: right; font-variant-numeric: tabular-nums; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.cell-input:hover { background: var(--input-hover); }
.cell-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-ring); }
.cell-input.invalid { border-color: var(--bad); background: #fff6f6; }
.cell-input.saving { background-image: linear-gradient(90deg, transparent, rgba(31,95,174,.08), transparent); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.cell-input.saved { border-color: #8fd1a8; box-shadow: 0 0 0 3px rgba(18, 128, 74, .12); }
.cell-input[disabled] { background: var(--surface-3); border-color: var(--border); color: var(--text-2); cursor: default; }
select.cell-select {
  height: 34px; border: 1px solid var(--input-border); background-color: var(--input-bg);
  border-radius: 8px; padding: 0 32px 0 10px; outline: none; cursor: pointer; min-width: 132px;
}
select.cell-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
select.cell-select[disabled] { background-color: var(--surface-3); border-color: var(--border); cursor: default; }
.cell-input.text { text-align: left; min-width: 170px; }
.input-legend { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.input-legend i { width: 14px; height: 14px; border-radius: 4px; background: var(--input-bg); border: 1px solid var(--input-border); display: block; }

/* сообщение об ошибке ячейки */
.cell-tip { position: absolute; z-index: 70; background: #2a1414; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; max-width: 280px; box-shadow: var(--shadow-2); pointer-events: none; }

/* ---------- пустые состояния ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty .ico { width: 64px; height: 64px; border-radius: 18px; background: var(--primary-soft); display: grid; place-items: center; margin: 0 auto 16px; color: var(--primary); }
.empty .ico svg { width: 30px; height: 30px; }
.empty h2 { margin: 0 0 6px; font-size: 19px; }
.empty p { margin: 0 auto 20px; color: var(--text-2); max-width: 460px; }
.copy-opts { display: grid; gap: 10px; max-width: 460px; margin: 0 auto 22px; text-align: left; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.opt:hover { border-color: #9fbbe0; }
.opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.opt input { margin-top: 2px; }
.opt b { display: block; font-weight: 620; }
.opt span { display: block; color: var(--text-2); font-size: 12.5px; margin-top: 2px; }

/* ---------- вывод, риски ---------- */
.conclusion { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-1); margin-bottom: 20px; }
.conclusion .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--neutral-bg); color: var(--neutral); }
.conclusion .ico svg { width: 22px; height: 22px; }
.conclusion.green .ico { background: var(--good-bg); color: var(--good); }
.conclusion.yellow .ico { background: var(--warn-bg); color: #b07000; }
.conclusion.red .ico { background: var(--bad-bg); color: var(--bad); }
.conclusion h3 { margin: 0 0 4px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.conclusion p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.risk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.risk-list li { display: flex; gap: 11px; align-items: center; padding: 11px 14px; border-radius: 10px; font-weight: 550; }
.risk-list li svg { width: 19px; height: 19px; flex: none; }
.risk-list li.red { background: var(--bad-bg); color: #8f1c1c; }
.risk-list li.yellow { background: var(--warn-bg); color: #6b4300; }
.risk-list li.green { background: var(--good-bg); color: #0f6a3d; }
.rec-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rec-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid #eef1f5; }
.rec-list li:last-child { border-bottom: 0; }
.rec-list li svg { width: 18px; height: 18px; color: var(--primary); flex: none; margin-top: 1px; }

/* ---------- графики ---------- */
.chart-box { height: 320px; }
.kpi.trend { padding-bottom: 8px; }
.kpi.trend .value { margin-bottom: 2px; }
.kpi .spark { height: 48px; margin: 8px -6px 0 -4px; }
.trend-delta { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.trend-delta .delta { display: inline; font-size: 12px; }
@media (max-width: 640px) { .chart-box { height: 270px; } .kpi .spark { height: 40px; } }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: #e7ebf1; stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11.5px; }
.chart .baseline { stroke: #c9d1dd; stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hl { fill: rgba(15, 27, 45, .04); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.legend i.line { height: 3px; border-radius: 2px; width: 16px; }
.tooltip { position: absolute; z-index: 40; pointer-events: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-2); padding: 10px 12px; font-size: 12.5px; min-width: 180px; }
.tooltip b { display: block; margin-bottom: 6px; font-size: 13px; }
.tooltip .row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.tooltip .row i { width: 9px; height: 9px; border-radius: 3px; display: block; flex: none; }
.tooltip .row span { color: var(--text-2); }
.tooltip .row em { font-style: normal; margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; padding-left: 14px; }
.tooltip .row.total { border-top: 1px solid var(--border); padding-top: 5px; margin-top: 6px; }
.seg-switch { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-switch button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.delta { font-size: 11.5px; font-weight: 600; display: block; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

/* ---------- выбор периода (календарь) ---------- */
.dp-trigger { display: inline-flex; align-items: center; gap: 8px; width: 236px; padding: 0 8px 0 11px; text-align: left; cursor: pointer; }
.filters .dp-trigger { height: 36px; width: 236px; }
.dp-trigger .dp-ico { width: 17px; height: 17px; color: var(--muted); }
.dp-trigger .dp-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.dp-trigger.has-value .dp-text { color: var(--text); font-weight: 550; }
.dp-trigger.has-value .dp-ico { color: var(--primary); }
.dp-trigger.open { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.dp-clear { display: none; width: 22px; height: 22px; border-radius: 6px; place-items: center; color: var(--muted); flex: none; }
.dp-trigger.has-value .dp-clear { display: grid; }
.dp-clear:hover { background: var(--surface-3); color: var(--text); }
.dp-clear svg { width: 13px; height: 13px; }
.dp-pop {
  position: fixed; z-index: 75; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 36px rgba(18, 30, 55, .16), 0 2px 8px rgba(18, 30, 55, .06); max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
  animation: pop .14s cubic-bezier(.22, .9, .35, 1.15); transform-origin: top left; font-size: 13px;
}
.dp-pop.up { transform-origin: bottom left; }
.dp-presets { display: grid; align-content: start; gap: 1px; min-width: 178px; padding: 8px; background: #fafbfd; border-right: 1px solid #eef1f5; }
.dp-preset { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; white-space: nowrap; font-size: 13px; color: var(--text); }
.dp-preset:hover { background: #f0f3f7; }
.dp-preset.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dp-preset .tick svg { width: 16px; height: 16px; color: var(--primary); }
.dp-cal { padding: 12px 14px 12px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-title { font-weight: 650; font-size: 14.5px; letter-spacing: -.1px; }
.dp-nav { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.dp-nav:hover:not(:disabled) { background: var(--surface-3); color: var(--primary); }
.dp-nav:disabled { opacity: .3; cursor: default; }
.dp-nav svg { width: 16px; height: 16px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 40px); row-gap: 2px; }
.dp-wd { padding: 4px 0 8px; text-align: center; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.dp-wd.we { color: #c7a2a2; }
.dp-day { position: relative; height: 36px; padding: 0; border: 0; background: none; cursor: pointer; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.dp-day span { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto; border-radius: 9px; transition: background .1s, color .1s; }
.dp-day:hover:not(:disabled) span { background: #eaeff6; }
.dp-day.we { color: #8f5a5a; }
.dp-day.out { color: #b8bfca; }
.dp-day.future { color: #d5dae2; cursor: default; }
.dp-day.today span::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--primary); }
.dp-day.in::before { content: ""; position: absolute; top: 1px; bottom: 1px; left: 0; right: 0; background: var(--primary-soft); }
.dp-day.start::before { left: 50%; }
.dp-day.end::before { right: 50%; }
.dp-day.start.end::before { display: none; }
.dp-day.in span { color: var(--primary-strong); }
.dp-day.start span, .dp-day.end span { background: var(--primary) !important; color: #fff; font-weight: 650; box-shadow: 0 2px 6px rgba(31, 95, 174, .3); }
.dp-day.start.today span::after, .dp-day.end.today span::after { background: #fff; }
.dp-hint { margin-top: 8px; text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) {
  .dp-pop { flex-direction: column; left: 8px !important; right: 8px; }
  .dp-presets { grid-template-columns: 1fr 1fr; min-width: 0; border-right: 0; border-bottom: 1px solid #eef1f5; padding: 6px; }
  .dp-preset { padding: 7px 10px; }
  .dp-day { height: 34px; }
  .dp-day span { width: 32px; height: 32px; }
  .dp-grid { grid-template-columns: repeat(7, 1fr); }
}

/* ---------- журнал и пользователи ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px 20px 4px; }
.filters label, .filters .flabel { display: grid; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 550; }
.filters .input { height: 36px; width: 190px; min-width: 0; }
.filters .grow { flex: 1; }
.log-old { color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(180, 35, 35, .45); }
.log-new { color: var(--good); font-weight: 600; }
.log-time { color: var(--text-2); white-space: nowrap; font-size: 12.5px; }
.log-who b { display: block; font-weight: 600; }
.log-who span { font-size: 12px; color: var(--muted); }
.count-line { padding: 4px 20px 10px; color: var(--muted); font-size: 12.5px; }
.more-row { text-align: center; padding: 10px; }
.user-cell { display: flex; gap: 11px; align-items: center; }
.user-cell .avatar { width: 34px; height: 34px; font-size: 13px; }
.user-cell b { display: block; font-weight: 600; }
.user-cell span { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.backup-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.backup-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--good-bg); color: var(--good); flex: none; }
.backup-ico.warn { background: var(--warn-bg); color: #b07000; }
.backup-ico svg { width: 22px; height: 22px; }
.backup-text { flex: 1; min-width: 240px; display: grid; gap: 3px; }
.backup-text b { font-weight: 620; }
.backup-text span { color: var(--text-2); font-size: 13px; }
.backup-text .backup-warn { color: #9a5b00; font-weight: 550; }
.perm-yes { color: var(--good); }
.perm-no { color: #c3cad6; }
.perm-yes svg, .perm-no svg { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

/* ---------- модальные окна ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(11, 22, 40, .45); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-2); width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; animation: pop .15s ease-out; }
.modal.wide { max-width: 560px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 680; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 10px 22px 6px; }
.modal-body p { margin: 0 0 12px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; font-weight: 550; font-size: 13px; user-select: none; }
.check input { margin: 0; }
.check.on { border-color: var(--primary); background: var(--primary-soft); }
.check.disabled { opacity: .55; cursor: default; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- уведомления ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #13233b; color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 13.5px; animation: slide .2s ease-out; }
.toast svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.toast.ok svg { color: #6fdc9c; }
.toast.err { background: #4a1414; }
.toast.err svg { color: #ff9b9b; }
.toast.info svg { color: #8cc0ff; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } }

/* ---------- адаптивность ---------- */
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-2); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(11, 22, 40, .4); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .nav-toggle { display: none; }
  /* на телефоне меню выезжает целиком - свёрнутый вид не применяется */
  .shell.nav-collapsed { --sidebar-w: 252px; }
  .nav-collapsed .sidebar .brand { justify-content: flex-start; padding: 20px 18px 18px; }
  .nav-collapsed .sidebar .brand-text, .nav-collapsed .nav-item .lbl, .nav-collapsed .side-btn .lbl, .nav-collapsed .side-user .who .lbl { display: block; }
  .nav-collapsed .nav { padding: 6px 10px 14px; }
  .nav-collapsed .nav-group { font-size: 11px; padding: 16px 10px 7px; }
  .nav-collapsed .nav-group::after { display: none; }
  .nav-collapsed .nav-item { justify-content: flex-start; padding: 9px 10px; }
  .nav-collapsed .nav-item .dot { position: static; width: 8px; height: 8px; margin-left: auto; }
  .nav-collapsed .side-user { padding: 14px 14px 16px; }
  .nav-collapsed .side-user .who { justify-content: flex-start; }
  .nav-collapsed .side-user .acts { flex-direction: row; }
  .nav-collapsed .side-btn { flex: 1; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .content { padding: 18px 16px 40px; }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 24px; min-height: auto; }
  .login-hero h1 { font-size: 24px; }
  .login-points, .login-bars, .login-hero .foot { display: none; }
  .login-hero { gap: 28px; justify-content: flex-start; }
  .login-form-wrap { place-items: start center; padding-top: 32px; }
}
@media (max-width: 960px) {
  /* на узком экране таблицы прокручиваются внутри карточки, первая колонка закреплена */
  table.t.fixed { table-layout: auto; min-width: 0; }
  table.t .w-in, table.t .w-total, table.t .w-num, table.t .w-share, table.t .w-base { width: auto; }
  table.t td.lbl, table.t.fixed td.lbl { min-width: 168px; max-width: 220px; }
  td.in, table.t.fixed td.in { width: 136px; }
  .cell-input, table.t.fixed .cell-input { min-width: 118px; }
  table.t th:first-child, table.t td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  table.t tr.total td:first-child { background: var(--surface-2); }
  table.t tr.auto td:first-child { background: #f6f9fd; }
  table.t tbody tr:hover td:first-child { background: var(--surface); }
}
@media (max-width: 640px) {
  .login-hero p { display: none; }
  .login-hero { padding: 22px 20px 26px; gap: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 13px; }
  .kpi .label { font-size: 12px; }
  .kpi .norm { font-size: 11.5px; }
  .topbar h1 { font-size: 17px; }
  .month-btn { min-width: 132px; padding: 0 8px; }
  .save-state .txt { display: none; }
  .kpi .value { font-size: 18px; letter-spacing: -.3px; }
  table.t th:first-child, table.t td:first-child { padding-left: 14px; }
  table.t th:last-child, table.t td:last-child { padding-right: 14px; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 14px; }
  .filters { padding: 14px 14px 4px; }
  .filters .input { min-width: 140px; }
}

/* ---------- печать ---------- */
.print-title { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 11.5px; }
  .sidebar, .topbar, .no-print, .toasts, .btn, .seg-switch { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .print-title { display: block; font-size: 18px; font-weight: 700; margin: 0 0 12px; }
  .card, .kpi, .conclusion { box-shadow: none; break-inside: avoid; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  table.t tbody tr:hover td { background: none; }
}
