/* Финансы и отчёты — mobile-first, без CDN (шрифт захощен локально в fonts/).
   Визуальный стиль — по образцу Финтабло (fintablo.ru), решение владельца
   12.10.2026: белые карточки на голубоватом фоне, тёмно-синий текст, яркая
   синяя кнопка, коралловый для негатива. Шрифт Golos Text — открытый аналог
   их LabGrotesque. Тёмная тема — те же токены, переопределены под
   [data-theme="dark"] (см. applyTheme() в app.js). */

@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/golos-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/golos-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  /* latin-ext нужен ради знака рубля (U+20BD) — он в этом сабсете. */
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/golos-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }

:root {
  --page: #f4f7fd;
  --surface: #ffffff;
  --surface-2: #eef2fb;
  --text-primary: #091a4e;
  --text-secondary: #404c72;
  --text-muted: #8189a6;
  --border: #e2e8f5;
  --border-soft: #edf1fa;
  --accent: #2951ca;
  --accent-deep: #1d3fa6;
  --accent-ink: #ffffff;
  --accent-wash: #eaf0ff;
  --good: #1f9d61;
  --good-wash: #e6f7ef;
  --warning: #b07a00;
  --warning-wash: #fff3da;
  --critical: #f2544a;
  --critical-wash: #feedec;
  --chart-surface: #ffffff;
  --chart-bar-muted: #cfdcf8;
  --chart-grid: #e2e8f5;
  /* Категориальная палитра — фиксированный порядок из скилла dataviz
     (references/palette.md), прошедший проверку на различимость при
     дальтонизме; цвет закреплён за категорией по id, а не по рангу суммы —
     при смене месяца категория не перекрашивается. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --shadow-card: 0 1px 2px rgba(9,26,78,0.04), 0 10px 28px rgba(9,26,78,0.07);
  --radius-card: 16px;
  --radius-control: 10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --page: #0a1330;
  --surface: #111b3c;
  --surface-2: #16214a;
  --text-primary: #eef2fc;
  --text-secondary: #aab4d6;
  --text-muted: #7c87ad;
  --border: #22305c;
  --border-soft: #1b2650;
  --accent: #4c7fe8;
  --accent-deep: #6c97ee;
  --accent-ink: #ffffff;
  --accent-wash: #16224a;
  --good: #35c281;
  --good-wash: #10301f;
  --warning: #e3ab3f;
  --warning-wash: #3a2c0d;
  --critical: #ff6f66;
  --critical-wash: #3a1414;
  --chart-surface: #111b3c;
  --chart-bar-muted: #27386e;
  --chart-grid: #22305c;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.35), 0 10px 28px rgba(0,0,0,0.4);
  color-scheme: dark;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--page);
  color: var(--text-primary);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }

/* --- Каркас --- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  background: var(--page);
}

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

/* --- Шапка --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
}

.topbar-title { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.topbar-user { font-size: 13px; color: var(--text-secondary); }

.topbar-actions { display: flex; align-items: center; gap: 2px; }

/* Кнопка темы — два SVG друг на друге, тему показывает та, что сейчас не активна
   (клик переключает на неё): на светлой теме видна луна («переключит на тёмную»). */
.topbar-actions [data-action="toggle-theme"] svg { width: 19px; height: 19px; }
.topbar-actions [data-action="toggle-theme"] svg:first-child { display: none; }
:root[data-theme="dark"] .topbar-actions [data-action="toggle-theme"] svg:first-child { display: block; }
:root[data-theme="dark"] .topbar-actions [data-action="toggle-theme"] svg:last-child { display: none; }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  cursor: pointer;
}
.logout-btn:active { background: var(--border-soft); }

/* --- Навигация: нижний таб-бар на телефоне, боковая панель на десктопе --- */

.nav-bar {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 4px;
  padding-top: 6px;
  /* Крайние кнопки иначе лезут прямо в закруглённые углы экрана телефона —
     добавочный отступ (поверх safe-area, не вместо неё) держит их читаемыми. */
  padding-right: max(14px, env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: max(14px, env(safe-area-inset-left));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  z-index: 6;
  order: 2;
}

.nav-brand { display: none; }
.brand-mark { flex: 0 0 30px; width: 30px; height: 30px; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  border-radius: 14px;
  padding: 18px 2px 14px;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
}

.nav-item svg { width: 32px; height: 32px; }
.nav-item .nav-label { font-size: 13px; line-height: 1.2; }
/* Выделение активного раздела — не только цветом текста, но и заливкой
   всей кнопки, чтобы было видно даже боковым зрением, не всматриваясь. */
.nav-item.active { color: var(--accent); background: var(--accent-wash); }

.nav-badge {
  position: absolute;
  top: 14px;
  right: calc(50% - 24px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--critical);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.screen-content { flex: 1; min-width: 0; }

/* --- Экран --- */

.screen { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* --- Отчёты --- */

.screen.reports-screen { max-width: none; }

.period-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.period-presets button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 13px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.period-presets button:hover { border-color: var(--accent); }

.period-custom { display: flex; align-items: center; gap: 8px; }
.period-custom input[type=date] {
  flex: 1;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: 15px;
  background: var(--surface);
  color: var(--text-primary);
}
.period-custom span { color: var(--text-muted); }

.report-stat { font-size: 26px; }

.export-sections { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.export-sections label { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.export-sections input { width: 18px; height: 18px; }

#report-log .history-entry:first-child { padding-top: 0; }

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}

.section-title { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.withdrawal-list-title { margin-top: 22px; }
.lead-note { font-size: 13px; color: var(--text-secondary); margin: -2px 0 12px; }

/* --- Поля форм --- */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.field-optional { color: var(--text-muted); font-weight: 400; }

.field input[type=text],
.field input[type=date],
.field input[type=number],
.field input[type=password],
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: 16px;
  background: var(--surface);
  color: var(--text-primary);
}

.field textarea {
  resize: none;
  overflow: hidden;
  min-height: 42px;
  line-height: 1.4;
}

.field-checkbox label { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-primary); }
.field-checkbox input { width: 18px; height: 18px; }

/* --- Кнопки --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-control);
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, transform .1s ease;
}

.btn.full { width: 100%; }
.btn.big { padding: 16px; font-size: 18px; border-radius: 16px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:active { transform: scale(0.98); }

/* Вторичная кнопка — как «Войти» у Финтабло: белая с синей рамкой и синим текстом. */
.btn-secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: var(--accent-wash); }
.btn-secondary:active { background: var(--accent-wash); }

.btn-danger { background: var(--critical-wash); color: var(--critical); }

.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-control);
}
.icon-btn:active { background: var(--border-soft); }

.category-pick-btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
}

/* --- Экран ввода --- */

.amount-label {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 20px;
}

.amount-input {
  border: none;
  outline: none;
  font-size: 52px;
  font-weight: 700;
  text-align: center;
  width: 100%;
  background: transparent;
  color: var(--text-primary);
  font-variant-numeric: proportional-nums;
}

.amount-suffix { font-size: 32px; color: var(--text-muted); font-weight: 600; }

.frequent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.frequent-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.frequent-chip:active { background: var(--border-soft); }

.flash {
  background: var(--good-wash);
  color: var(--good);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 15px;
}

.flash.error { background: var(--critical-wash); color: var(--critical); }

/* --- Обзор --- */

.overview-hero { text-align: center; }
.overview-hero .hero-value { font-size: 40px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.overview-hero .hero-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.hero-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.hero-delta.up { background: var(--critical-wash); color: var(--critical); }
.hero-delta.down { background: var(--good-wash); color: var(--good); }
.hero-delta.flat { background: var(--surface-2); color: var(--text-secondary); }

.saldo-breakdown { display: flex; justify-content: center; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
.saldo-income::before { content: '↑ '; color: var(--good); font-weight: 700; }
.saldo-expense::before { content: '↓ '; color: var(--critical); font-weight: 700; }

.revenue-stats-row { display: flex; flex-wrap: wrap; gap: 28px; margin-bottom: 14px; }

.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }

.bar-hit { fill: transparent; cursor: pointer; }
.bar { fill: var(--chart-bar-muted); }
.bar.selected { fill: var(--accent); }
.bar-cap { fill: var(--chart-bar-muted); }
.bar-cap.selected { fill: var(--accent); }
.chart-month-label { fill: var(--text-muted); font-size: 9px; font-family: inherit; }
.chart-month-label.selected { fill: var(--accent); font-weight: 600; }
.chart-value-label { fill: var(--text-primary); font-size: 10px; font-weight: 600; font-family: inherit; }

/* «Доходы по месяцам» — те же столбики, зелёная тема вместо синей. */
.chart-income .bar, .chart-income .bar-cap { fill: var(--good-wash); }
.chart-income .bar.selected, .chart-income .bar-cap.selected { fill: var(--good); }
.chart-income .chart-month-label.selected { fill: var(--good); }

.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--text-primary);
  color: #ffffff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  z-index: 60;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  box-shadow: var(--shadow-card);
}

.breadcrumb-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.breadcrumb-row button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  padding: 2px 4px;
  cursor: pointer;
}
.breadcrumb-row .sep { color: var(--text-muted); }
.breadcrumb-row .current { color: var(--text-primary); font-weight: 600; padding: 2px 4px; }

/* Кольцевая диаграмма «Обзора» — доля категорий, тот же разворот, что и
   список под ней (клик по сектору = клик по строке списка). Пустая
   середина кольца нарочно без подписи — сумма месяца уже видна в герое
   выше, дублировать её тут незачем. */
.donut-wrap { display: flex; justify-content: center; padding: 4px 0 20px; }
.donut-chart { width: 196px; height: 196px; }
.donut-chart circle { cursor: pointer; }
.donut-chart circle.not-clickable { cursor: default; }

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  cursor: default;
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row.clickable { cursor: pointer; }
.breakdown-row.clickable:active { opacity: 0.7; }

.breakdown-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; }
.cat-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
.cat-icon svg { width: 16px; height: 16px; }
.breakdown-main { flex: 1; min-width: 0; }
.breakdown-name { font-size: 14px; margin-bottom: 2px; }
.breakdown-pct { font-size: 12px; font-weight: 700; }
.breakdown-amt { font-weight: 600; font-size: 14px; white-space: nowrap; }
.breakdown-chevron { color: var(--text-muted); font-size: 18px; }

.recurring-mini-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.recurring-mini-card:last-child { border-bottom: none; }
.recurring-mini-card .label { font-size: 14px; }
.recurring-mini-card .value { font-size: 20px; font-weight: 700; }

/* --- Ежемесячные: подсказки --- */

.suggestion-card {
  border: 1px solid var(--chart-bar-muted);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--accent-wash);
}
.suggestion-card .suggestion-text { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.suggestion-card .suggestion-text b { font-weight: 700; }
.suggestion-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.suggestion-actions .btn { flex: 1; padding: 9px 12px; font-size: 13px; }

/* --- Журнал --- */

.month-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.month-switch > div { font-weight: 600; font-size: 16px; }

.journal-total {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}

.journal-total span { font-size: 13px; color: var(--text-secondary); font-weight: 400; display: block; }

/* Заголовок колонок журнала — осмыслен только в табличном виде на десктопе. */
.journal-list-desktop-head { display: none; }

.day-group { margin-bottom: 10px; }
.day-header {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  padding: 6px 2px;
}

.expense-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.expense-row:active { background: var(--border-soft); }

.expense-main { flex: 1; min-width: 0; }
.expense-path { font-size: 14px; font-weight: 500; }
.expense-comment { font-size: 13px; color: var(--text-secondary); word-wrap: break-word; white-space: pre-wrap; }
.expense-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.tag-auto {
  display: inline-block;
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 6px;
}

.expense-amount { font-weight: 700; white-space: nowrap; font-variant-numeric: proportional-nums; }

.expense-actions { display: flex; gap: 2px; }
.expense-actions button {
  background: none;
  border: none;
  font-size: 23px;
  line-height: 1;
  padding: 7px 8px;
  border-radius: var(--radius-control);
  cursor: pointer;
  color: var(--text-secondary);
}
.expense-actions button:active { background: var(--border-soft); }

/* Карандаш правки — везде, где он стоит рядом с текстовыми кнопками
   (категории, сотрудники, автоплатежи), крупнее, чтобы легче попадать. */
.icon-edit {
  font-size: 19px !important;
  line-height: 1;
  padding: 6px 10px !important;
}

.history-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Оверлей «История записи» --- */

.history-entry { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.history-entry:last-child { border-bottom: none; }
.history-head { font-size: 13px; margin-bottom: 4px; }
.history-diff { font-size: 13px; color: var(--text-secondary); margin: 2px 0 2px 4px; }

/* --- Админка --- */

.admin-subtabs { display: flex; gap: 6px; margin-bottom: 14px; }
.admin-subtabs button {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 9px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.admin-subtabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.cat-tree-node { margin-left: 0; }
.cat-tree-children { margin-left: 16px; }

.cat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.cat-row .cat-name { flex: 1; font-size: 14px; }
.cat-row .cat-name.archived { color: var(--text-muted); text-decoration: line-through; }
.cat-row button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
  color: var(--text-secondary);
}

.list-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface);
}

.list-card .title { font-weight: 600; margin-bottom: 4px; }
.list-card .sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.list-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; flex-wrap: wrap; gap: 6px; }
.list-card .row button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}
.list-card .row button:hover { border-color: var(--accent); background: var(--accent-wash); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.badge.ok { background: var(--good-wash); color: var(--good); }
.badge.wait { background: var(--warning-wash); color: var(--warning); }
.badge.off { background: var(--surface-2); color: var(--text-muted); }

.add-btn { margin-bottom: 14px; }

.empty-note { color: var(--text-muted); font-size: 14px; text-align: center; padding: 20px 0; }
.empty-note.calm { background: var(--good-wash); color: var(--good); border-radius: var(--radius-control); padding: 14px; text-align: left; }

/* --- Логин --- */

.login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  gap: 14px;
}

.login-logo { width: 56px; height: 56px; margin: 0 auto; }
.login-logo svg { width: 100%; height: 100%; display: block; }
.login-screen h1 { font-size: 22px; text-align: center; margin-bottom: 0; }
.login-sub { text-align: center; color: var(--text-secondary); font-size: 14px; margin: 0 0 6px; }

.auth-tabs { display: flex; gap: 6px; margin-bottom: 4px; }
.auth-tabs button {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 9px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}
.auth-tabs button.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.admin-pending-card { margin-bottom: 14px; }

/* --- Оверлеи --- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}

.overlay.hidden { display: none; }

.overlay-box {
  background: var(--surface);
  color: var(--text-primary);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 20px 20px 0 0;
  padding: 14px 16px 20px;
  max-height: 85vh;
  overflow-y: auto;
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.breadcrumb { font-size: 14px; color: var(--text-secondary); flex: 1; text-align: center; }

.cp-search {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-size: 16px;
  background: var(--surface-2);
  color: var(--text-primary);
}
.cp-search:focus { background: var(--surface); border-color: var(--accent); outline: none; }

.picker-list { display: flex; flex-direction: column; gap: 6px; }
.picker-item-path { font-size: 15px; }
.picker-item-path b { color: var(--accent); font-weight: 700; }

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
}
.picker-item > span:not(.cat-icon) { flex: 1; min-width: 0; }
.cat-icon-sm { flex: 0 0 26px; width: 26px; height: 26px; font-size: 11px; }
.cat-icon-sm svg { width: 14px; height: 14px; }

.picker-item.disabled { color: var(--text-muted); background: var(--surface-2); cursor: not-allowed; }
.picker-item .chevron { color: var(--text-muted); }
.picker-empty { text-align: center; color: var(--text-muted); padding: 16px 0; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.modal-actions .btn { flex: 1; }

.form-error {
  color: var(--critical);
  font-size: 13px;
  margin-top: 8px;
}
.form-error.hidden { display: none; }

.hidden { display: none !important; }

/* ===================== Десктоп (>=900px) ===================== */

@media (min-width: 900px) {
  .app-shell {
    max-width: none;
    flex-direction: row;
    align-items: stretch;
  }

  .nav-bar {
    order: 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: 240px;
    flex: 0 0 240px;
    border-top: none;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 10px;
    gap: 2px;
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 22px;
    font-weight: 700;
    font-size: 15.5px;
    line-height: 1.2;
    color: var(--text-primary);
  }

  .nav-item:hover { background: var(--border-soft); }
  .nav-item.active:hover { background: var(--accent-wash); }
  .frequent-chip:hover { background: var(--accent-wash); border-color: var(--accent); }
  .picker-item:hover { border-color: var(--accent); }
  .expense-row:hover { background: var(--border-soft); }
  .logout-btn:hover { background: var(--border-soft); }

  .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-control);
    font-size: 15px;
  }
  .nav-item svg { width: 22px; height: 22px; } /* на ПК крупные мобильные иконки не нужны — тут не тап пальцем */
  .nav-item .nav-label { font-size: 15px; }
  .nav-item.active { background: var(--accent-wash); color: var(--accent); }
  .nav-item:active { background: var(--border-soft); }

  .nav-badge {
    position: static;
    margin-left: auto;
  }

  .main-col { max-width: none; }

  .screen { padding: 28px 36px 40px; max-width: 1040px; }

  .cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: start;
  }
  .cards-grid .card.span-2 { grid-column: 1 / -1; }

  .overview-hero { text-align: left; }
  .overview-hero .hero-value { font-size: 48px; }
  .saldo-breakdown { justify-content: flex-start; }

  /* Журнал — табличный вид */
  .journal-list-desktop-head {
    display: flex;
    padding: 0 2px 8px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .journal-list-desktop-head span:first-child { flex: 1; }
  .journal-list-desktop-head span:nth-child(2) { flex: 0 0 140px; text-align: right; }
  .journal-list-desktop-head span:nth-child(3) { flex: 0 0 110px; text-align: right; }

  .expense-row {
    align-items: center;
    padding: 12px 2px;
  }
  .expense-row .expense-main { display: flex; align-items: baseline; gap: 10px; flex: 1; }
  .expense-row .expense-path { flex: 0 0 260px; }
  .expense-row .expense-comment { flex: 1; margin: 0; }
  .expense-row .expense-meta { flex: 0 0 140px; margin: 0; text-align: right; }
  .expense-row .expense-amount { flex: 0 0 110px; text-align: right; }

  .entry-screen { max-width: 420px; }

  /* Список «Вывода денег» живёт в узкой колонке «Ввода» (420px) — табличная
     раскладка журнала туда не помещается, строки накладываются друг на друга.
     Возвращаем компактный (как на телефоне) вид именно здесь. */
  .entry-screen .expense-row {
    align-items: flex-start;
    padding: 10px 2px;
  }
  .entry-screen .expense-row .expense-main { display: block; }
  .entry-screen .expense-row .expense-path,
  .entry-screen .expense-row .expense-comment,
  .entry-screen .expense-row .expense-meta,
  .entry-screen .expense-row .expense-amount { flex: none; }
  .entry-screen .expense-row .expense-meta { text-align: left; }

  .login-screen { max-width: 360px; margin: 0 auto; }
}

/* --- Заставка (первая загрузка, переход после входа) --- */

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
}

.boot-mark {
  position: relative;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: boot-pulse 1.4s ease-in-out infinite;
}
.boot-mark svg { width: 100%; height: 100%; border-radius: 16px; }
.boot-mark::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 24px;
  border: 3px solid var(--accent-wash);
  border-top-color: var(--accent);
  animation: boot-spin 0.9s linear infinite;
}

@keyframes boot-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* --- Модалка подтверждения (удаление, правка чужой/значимой записи) --- */

.confirm-box { max-width: 420px; }
.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.confirm-body { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.confirm-body p { margin: 8px 0 0; }
.confirm-body b { color: var(--text-primary); }
.confirm-summary {
  background: var(--surface-2);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}
