/* FinPlan — интерфейс. Тёплая палитра (графит + золото), mobile-first, полноценный ПК-режим.
   Темы переключаются атрибутом data-theme на <html>: graphite | forest | plum | paper. */

/* ─────────── палитра по умолчанию: тёплый графит + золото ─────────── */
:root,
:root[data-theme="graphite"] {
  --bg: #131110;
  --bg-soft: #1a1715;
  --card: #1e1a17;
  --card-2: #272119;
  --line: #352d24;
  --text: #f4ede3;
  --muted: #a79783;
  --accent: #e5a13c;
  --accent-2: #d4763f;
  --accent-ink: #2a1a06;
  --green: #6fae76;
  --red: #e0705f;
  --amber: #e0b352;
  --grid: #2a2420;
  --shadow: 0 10px 34px rgba(0, 0, 0, .5);
}

:root[data-theme="forest"] {
  --bg: #101410;
  --bg-soft: #161b16;
  --card: #1a201a;
  --card-2: #212a21;
  --line: #2c3a2c;
  --text: #eef2e9;
  --muted: #96a68f;
  --accent: #9cc46b;
  --accent-2: #6f9e4f;
  --accent-ink: #16210c;
  --green: #7cc47f;
  --red: #dd7f66;
  --amber: #d9bb5e;
  --grid: #26301f;
  --shadow: 0 10px 34px rgba(0, 0, 0, .5);
}

:root[data-theme="plum"] {
  --bg: #141013;
  --bg-soft: #1a151a;
  --card: #1f1920;
  --card-2: #281f28;
  --line: #3a2c38;
  --text: #f3ebf1;
  --muted: #a89aa6;
  --accent: #e08b9c;
  --accent-2: #a86fa8;
  --accent-ink: #2b0f18;
  --green: #7fbf8f;
  --red: #e2726f;
  --amber: #dcae63;
  --grid: #2e2430;
  --shadow: 0 10px 34px rgba(0, 0, 0, .5);
}

:root[data-theme="paper"] {
  --bg: #f5f1e8;
  --bg-soft: #fffdf8;
  --card: #fffdf8;
  --card-2: #f2ece0;
  --line: #e0d7c6;
  --text: #241f18;
  --muted: #7d7264;
  --accent: #c07a1e;
  --accent-2: #a2542a;
  --accent-ink: #fff8ec;
  --green: #3f8a53;
  --red: #c04a3f;
  --amber: #b8862b;
  --grid: #e8e0d0;
  --shadow: 0 6px 22px rgba(70, 55, 30, .12);
}

:root {
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --tabbar-h: 60px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}

/* ─────────── шапка ─────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .2px; }
.logo { color: var(--accent); }
.brand-name { font-size: 17px; }
.page-title { font-size: 18px; font-weight: 650; display: none; }
.top-actions { display: flex; gap: 8px; }

.icon-btn {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; min-width: 44px; min-height: 44px; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:active { transform: scale(.96); }
.icon-btn.accent { color: var(--accent); }

.demo-banner {
  margin: 10px 16px 0; padding: 10px 14px; border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent); font-size: 13px;
}

/* ─────────── контент ─────────── */
.view {
  max-width: 720px; margin: 0 auto;
  padding: 14px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 26px);
}
.skeleton { color: var(--muted); text-align: center; padding: 40px 0; }

.section-title {
  display: flex; align-items: baseline; justify-content: flex-start; gap: 10px;
  margin: 20px 2px 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
/* шеврон сворачивания добавляется третьим элементом: сумму держим у правого края,
   а если суммы нет — сам шеврон прижимаем вправо (space-between растащил бы сумму в середину) */
.section-title > span:nth-of-type(2) { margin-left: auto; }
.section-title > span:only-of-type { margin-right: auto; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.tight { padding: 12px 14px; }
.card.hero {
  background: color-mix(in srgb, var(--accent) 11%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.value.sm { font-size: 19px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.dim { opacity: .75; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: 7px; padding: 12px; }
.stat .label { font-size: 11px; }
.stat .num { font-size: 17px; font-weight: 650; margin-top: 4px; }

/* ─────────── бары и графики ─────────── */
.bar-track { height: 8px; background: var(--grid); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); }
.bar-fill.warn { background: var(--amber); }

.chart { width: 100%; height: 132px; display: block; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .lbl { fill: var(--muted); font-size: 9px; }
.chart .bar-in { fill: var(--green); }
.chart .bar-out { fill: var(--red); opacity: .85; }

.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
.cat-row:last-child { margin-bottom: 0; }
.cat-row .name { font-size: 14px; }
.cat-row .amt { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-bar { height: 6px; border-radius: 99px; background: var(--grid); margin-top: 6px; overflow: hidden; }
.cat-bar > i { display: block; height: 100%; }

/* ─────────── списки ─────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 11px 13px;
}
.row .ico {
  width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center;
  background: var(--card-2); font-size: 18px;
}
.row .title { font-size: 14.5px; font-weight: 550; }
.row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .amount { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 99px; font-size: 13.5px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted); cursor: pointer;
}
.chip.is-active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent); color: var(--accent);
}

/* ─────────── календарь трат ─────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  text-align: center; font-size: 10px; color: var(--muted); padding-bottom: 2px;
  text-transform: uppercase; letter-spacing: .04em;
}
.cal-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-height: 50px; padding: 5px 2px; border-radius: 5px;
  background: var(--card-2); border: 1px solid transparent; color: var(--text);
  font: inherit; cursor: pointer; overflow: hidden;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell .d { font-size: 12.5px; font-weight: 600; line-height: 1; }
.cal-cell .s { font-size: 9.5px; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-cell.past { opacity: .5; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.planned { background: color-mix(in srgb, var(--red) 13%, var(--card-2)); }
.cal-cell.has-income { background: color-mix(in srgb, var(--green) 14%, var(--card-2)); }
.cal-cell.picked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--card-2));
}

/* месяцы плана: на ПК ставим в колонки, иначе вкладка выглядит узкой полоской слева */
.months { display: grid; gap: 12px; }
@media (min-width: 1100px) {
  /* у вкладки нет боковой колонки — не оставляем пустую половину экрана */
  .dash.dash-wide { grid-template-columns: minmax(0, 1fr); }
  .months { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
  .months > .panel { margin-bottom: 0; }
}

/* расшифровка выбранного дня в календаре постоянных трат */
.day-box {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 7px;
}
.day-box-head { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.day-box-head .btn { margin-left: auto; }
.day-box .u { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: baseline; font-size: 13.5px; }
.day-box .u .dt { color: var(--muted); font-variant-numeric: tabular-nums; }
.day-box .u .tag { font-size: 10.5px; }
.cal-legend {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.upcoming { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.upcoming .u { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.upcoming .u .dt { color: var(--muted); font-variant-numeric: tabular-nums; }
.vars { display: flex; flex-direction: column; gap: 7px; }
.vars .v-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: 13.5px; }
.vars .v-bar { height: 5px; border-radius: 99px; background: var(--grid); margin-top: 5px; overflow: hidden; }
.vars .v-bar > i { display: block; height: 100%; background: var(--accent); }

.cat-line {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer;
}
.cat-line:last-child { border-bottom: 0; }
.cat-line .muted { font-size: 12px; text-align: right; }

/* ─────────── цели и кредиты ─────────── */
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11.5px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
}
.tag.good { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent);
  background: color-mix(in srgb, var(--green) 12%, transparent); }
.tag.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent);
  background: color-mix(in srgb, var(--red) 12%, transparent); }
.tag.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent);
  background: color-mix(in srgb, var(--amber) 12%, transparent); }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 10px; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  flex: 1 1 auto; min-height: 44px; padding: 10px 16px; border-radius: 6px; cursor: pointer;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line); font-size: 14.5px;
}
/* иконка внутри кнопки не должна растягиваться и переносить текст на новую строку */
button.btn .ic { width: 16px; height: 16px; margin: 0; flex: 0 0 auto; }
button.btn.primary {
  background: var(--accent);
  color: var(--accent-ink); border: 0; font-weight: 650;
}
button.btn:disabled { opacity: .5; }

/* ─────────── нижняя навигация (мобилка) ─────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg-soft) 96%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; color: var(--muted); font-size: 10px; letter-spacing: -.1px;
  padding: 6px 0; cursor: pointer; min-width: 0;
}
.tab .ic { margin: 0 auto 3px; }
.tab.is-active { color: var(--accent); }
.tabbar-brand { display: none; }

/* ─────────── слот снизу (форма) ─────────── */
.sheet {
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: 720px; margin: 0 auto;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--bg-soft); color: var(--text); padding: 12px 16px calc(24px + var(--safe-bottom));
  max-height: 88vh; overflow: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, .55); }
.sheet-head { display: flex; justify-content: flex-end; margin: 0 0 4px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; font-size: 16px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: transparent;
}
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg.pick { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.seg button {
  min-height: 44px; border-radius: 6px; background: var(--card); color: var(--muted);
  border: 1px solid var(--line); cursor: pointer; font-size: 14px;
}
.seg button.is-active {
  background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
}

/* кнопки в шапке: иконка + подпись, не растягиваются (display задаём только в ПК-медиазапросе,
   иначе правило перебивает .desktop-only и кнопки вылезают на мобилке) */
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; }

/* панели и плитки вместо нижних полей у карточек */
.dash .panel:last-child, .dash .card:last-child { margin-bottom: 0; }
.plain-rows .bar-track { max-width: none; }
@media (min-width: 900px) {
  .dash .col-side .panel:last-child { margin-bottom: 0; }
}

/* ─────────── вход ─────────── */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card button {
  min-height: 48px; border: 0; border-radius: 6px; font-weight: 650;
  background: var(--accent);
  color: var(--accent-ink); cursor: pointer;
}

/* ─────────── тост ─────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 60;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  padding: 11px 16px; border-radius: 6px; font-size: 14px; box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}


/* ─────────── иконки (SVG-спрайт из index.html) ─────────── */
.ic {
  width: 22px; height: 22px; display: block; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic.lg { width: 19px; height: 19px; }
.top-actions .ic, .tabbar-brand .ic { margin: 0; }
.desktop-only, button.desktop-only { display: none; }
.search { display: none; }        /* поиск в шапке — только ПК, см. медиазапрос ниже */

/* ─────────── KPI-плитки ─────────── */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow);
}
.tile.accent {
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}
.tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font-size: 21px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; }
.tile.accent .v { color: var(--accent); }
.tile .d { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* ─────────── панель с заголовком ─────────── */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.panel.accent {
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.panel .hd { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; }
.panel .hd .t { font-size: 15px; font-weight: 640; }
.panel .hd .r { margin-left: auto; font-size: 12.5px; color: var(--muted); text-align: right; }
.panel .footnote { margin-top: 11px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.panel > .value, .panel > .muted { margin-bottom: 2px; }

/* сворачивание «облачков»: шеврон в шапке панели и в заголовке раздела */
.chev {
  margin-left: 6px; flex: 0 0 auto; align-self: center;
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer;
}
.panel > .hd:not(:has(.r)) .chev { margin-left: auto; }
.chev .ic { width: 16px; height: 16px; transition: transform .15s ease; }
.chev:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.panel.collapsed > .hd { margin-bottom: 0; }
.panel.collapsed > .hd .chev .ic, .section-title.collapsed .chev .ic { transform: rotate(-90deg); }
.panel.collapsed > *:not(.hd) { display: none; }
.sec-hidden { display: none !important; }

/* ─────────── рейтинг категорий ─────────── */
.rank { display: flex; flex-direction: column; gap: 9px; }
.rank .r { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; font-size: 13.5px; }
.rank .r .nm { grid-area: 1 / 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .r .nm small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.rank .r .amt { grid-area: 1 / 2; text-align: right; font-weight: 620; white-space: nowrap; }
.rank .r .bar-track { grid-area: 2 / 1 / 3 / 3; }
.rank .r .sh { display: none; }

/* ─────────── таблица ─────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 500; padding: 0 0 8px; border-bottom: 1px solid var(--line);
}
.tbl th.r, .tbl td.r { text-align: right; }
.tbl td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; padding-bottom: 0; }
.tbl .nm { font-weight: 560; }
.tbl .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.tbl .amt { font-weight: 620; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .hide-sm { display: none; }
.tbl tfoot td { border-top: 1px solid var(--line); border-bottom: none; padding-top: 12px; font-weight: 640; }

/* ─────────── строки-списки и итог ─────────── */
.plain-rows { display: flex; flex-direction: column; }
.plain-rows .r { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plain-rows .r:first-child { padding-top: 0; }
.plain-rows .r:last-child { border-bottom: none; padding-bottom: 0; }
.plain-rows .mid { min-width: 0; flex: 1; }
.plain-rows .nm { font-size: 13.5px; font-weight: 560; }
.plain-rows .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.plain-rows .amt { font-weight: 620; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total { display: flex; align-items: baseline; padding-top: 12px; margin-top: 11px; border-top: 1px solid var(--line); }
.total .t { font-size: 13.5px; font-weight: 620; }
.total .v { margin-left: auto; font-size: 18px; font-weight: 670; letter-spacing: -.3px; }

/* ─────────── широкий график платежей ─────────── */
.chart-wrap svg { display: block; width: 100%; height: 180px; }
.sched .bar-i { fill: var(--accent-2); }
.sched .bar-p { fill: var(--accent); }
.sched .grid-line { stroke: var(--grid); stroke-width: 1; }
.sched .axis { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 16px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }

/* ─────────── врезка-сценарий ─────────── */
.scen {
  margin-top: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.5;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 6px; padding: 10px 11px;
}
.scen b { color: var(--accent); font-weight: 620; }

/* ═══════════════ ПК: боковое меню и колонки ═══════════════ */
@media (min-width: 900px) {
  body { padding-left: var(--sidebar-w); }

  .tabbar {
    inset: 0 auto 0 0; width: var(--sidebar-w);
    display: flex; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 20px 14px; border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 19px; font-weight: 700; padding: 4px 10px 22px; color: var(--text);
  }
  .tabbar-brand .logo { color: var(--accent); font-size: 20px; }
  .tab {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    font-size: 15px; padding: 12px 14px; border-radius: 6px; width: 100%;
  }
  .tab .ic { width: 19px; height: 19px; margin: 0; }
  .tab.is-active { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text); }
  .tab.is-active .ic { color: var(--accent); }
  .tab:hover:not(.is-active) { background: var(--card-2); color: var(--text); }
  .tab .cnt { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .tabbar-brand { border-bottom: 1px solid var(--line); margin-bottom: 8px; padding-bottom: 18px; }
  .desktop-only, button.desktop-only { display: inline-flex; }

  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile .v { font-size: 23px; }
  .rank .r { grid-template-columns: minmax(0, 1fr) 190px 96px 52px; gap: 12px; }
  .rank .r .nm, .rank .r .amt, .rank .r .bar-track, .rank .r .sh { grid-area: auto; }
  .rank .r .sh { display: block; text-align: right; color: var(--muted); font-size: 12px; }
  .tbl .hide-sm { display: table-cell; }
  .chart-wrap svg { height: 200px; }

  .search {
    display: flex; align-items: center; gap: 9px; background: var(--card);
    border: 1px solid var(--line); border-radius: 6px; padding: 9px 13px;
    color: var(--muted); font-size: 13px; flex: 1 1 auto; min-width: 120px; max-width: 230px;
  }
  .search input {
    background: none; border: 0; outline: none; color: var(--text);
    font: inherit; min-height: 0; padding: 0; width: 100%; min-width: 0;
  }
  .search input:focus { outline: none; }
  .topbar { gap: 12px; }
  .topbar > div:first-child { min-width: 0; }
  .page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-actions { flex: 0 1 auto; min-width: 0; }
  .top-actions .btn {
    display: inline-flex; align-items: center; gap: 8px;
    flex: 0 0 auto; min-height: 40px; height: 40px; padding: 0 15px; font-size: 13.5px;
  }

  .brand { display: none; }
  .page-title { display: block; }
  .topbar { padding: 16px 28px; }
  .view { max-width: 1240px; padding: 8px 28px 48px; }

  .dash { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
  .cards-grid, .rows-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .cards-grid .card { margin-bottom: 0; }
  .rows-grid .row { margin-bottom: 0; }

  /* календарь не растягиваем на всю ширину */
  .cal { max-width: 560px; }
  .cal-cell { min-height: 54px; }
  .cal-cell .s { font-size: 10.5px; }

  /* форма по центру экрана, а не «слот снизу» */
  .sheet {
    inset: 0; margin: auto; width: min(560px, 92vw); height: fit-content;
    max-height: 84vh; border-radius: 10px; border-bottom: 1px solid var(--line);
  }
  .toast { bottom: 28px; }

  .stat .num { font-size: 19px; }
  .value { font-size: 30px; }
}

@media (min-width: 1100px) {
  .dash { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
  .col-side .card:last-child { margin-bottom: 0; }
}

@media (min-width: 1500px) {
  .view { max-width: 1400px; }
  .grid-2 { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ─────────── узкие ПК-окна: шапка не должна разваливаться ─────────── */
@media (min-width: 900px) and (max-width: 1149px) {
  #btn-import { font-size: 0; gap: 0; padding: 0 12px; }
  #btn-import .ic { width: 18px; height: 18px; }
  .search { min-width: 110px; }
}
