/* ============================================================================
   Дизайн-система «Финансового планировщика» (MVP).

   ИСТОЧНИК ИСТИНЫ ПО ДИЗАЙНУ — пакет UX/UI, а не этот файл:
     • UX/UI/эскизы-mvp.html              — каркасы всех экранов и оболочки
                                            (авторизация, дашборд, календарь, операции,
                                            счета, бюджеты, отчёты, настройки, админка);
     • UX/UI/03-визуальное-направление.md — палитра, типографика, сетка, радиусы,
                                            тени, состояния компонентов, графики;
     • UX/UI/02-эскизы-экранов.md         — состав блоков, данные, состояния экранов;
     • UX/UI/00-README.md                 — термины интерфейса и тон текстов.

   Правило для дальнейшей работы: любой новый экран, блок или компонент сначала
   находим в эскизах (по коду SCR-…/DRW-…/MDL-… или по названию раздела) и
   переносим оттуда как образец. Токены ниже — значения из §3.2–3.6 визуального
   направления; «на глаз» их не меняем и собственные цвета не вводим.
   ============================================================================ */

:root {
    color-scheme: light;

    /* Поверхности и границы */
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-sunken: #eef1f5;
    --surface-subtle: #fafbfc;
    --border: #e2e6ec;
    --border-strong: #cbd2db;

    /* Текст */
    --ink: #111826;
    --ink-2: #4b5566;
    --ink-3: #667080;

    /* Акцент: бренд и основное действие */
    --primary: #1b4f72;
    --primary-hover: #153e5a;
    --primary-tint: #eaf1f7;

    /* Смысловые цвета: доход / расход / внимание / ошибка / инфо */
    --income: #0f7b5f;
    --income-tint: #e7f4ef;
    --expense: #b23b2e;
    --expense-tint: #fbeeeb;
    --warning: #a65e00;
    --warning-tint: #fdf3e2;
    --danger: #b3261e;
    --danger-tint: #fbe9e7;
    --info: #2f6690;
    --neutral: #5b6675;

    /* Геометрия и тени (визуальное направление §3.4)
       --radius-control = --radius-sm (8px), --radius-card = --radius-md (12px),
       --radius-modal = --radius-lg (16px), --radius-pill = 999px */
    --radius-control: 8px;
    --radius-card: 12px;
    --radius-modal: 16px;
    --radius-pill: 999px;
    --shadow-card: 0 1px 2px rgba(17, 24, 38, 0.06);
    --shadow-modal: 0 16px 40px rgba(17, 24, 38, 0.18);
    --shadow-drawer: -8px 0 32px rgba(17, 24, 38, 0.12);
    --focus-ring: 0 0 0 3px rgba(27, 79, 114, 0.25);

    /* Каркас */
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --content-max: 1200px;
    --font-sans: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/24px var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
    margin: 0;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--primary-hover);
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: var(--radius-control);
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 12px;
    color: #fff;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

/* ------------------------------- типографика ------------------------------- */

.page-title {
    font-size: 28px;
    line-height: 36px;
}

.page-sub {
    margin-top: 6px;
    color: var(--ink-2);
    font-size: 15px;
}

.eyebrow,
.metric-label,
.nav-group,
.section-label {
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 16px;
    text-transform: uppercase;
}

.muted {
    color: var(--ink-3);
}

.hint {
    margin: 0;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 16px;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.text-income {
    color: var(--income);
}

.text-expense {
    color: var(--expense);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

/* -------------------------------- кнопки ---------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-control);
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover,
.button:active {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.button:disabled,
.button[aria-disabled="true"] {
    background: var(--surface-sunken);
    border-color: var(--border);
    color: var(--ink-3);
    cursor: not-allowed;
}

.button-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--ink);
}

.button-secondary:hover,
.button-secondary:active {
    background: var(--surface-subtle);
    border-color: var(--ink-3);
    color: var(--ink);
}

.button-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--primary);
}

.button-ghost:hover,
.button-ghost:active {
    background: var(--primary-tint);
    border-color: transparent;
    color: var(--primary-hover);
}

.button-danger {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}

.button-danger:hover,
.button-danger:active {
    background: var(--danger-tint);
    border-color: var(--danger);
    color: var(--danger);
}

.button-small {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
    line-height: 18px;
}

.button-block {
    width: 100%;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* --------------------------- чипы, бейджи, метки -------------------------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    white-space: nowrap;
}

.chip-primary {
    border-color: #c9dcea;
    background: var(--primary-tint);
    color: var(--primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface-sunken);
    color: var(--neutral);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-tint);
    color: var(--primary);
}

.badge-income {
    background: var(--income-tint);
    color: #0b5c46;
}

.badge-expense {
    background: var(--expense-tint);
    color: #8f251d;
}

.badge-warning {
    background: var(--warning-tint);
    color: #7e4900;
}

.badge-soon {
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--ink-3);
    font-weight: 400;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.tag {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-subtle);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 16px;
}

.tag-primary {
    border-color: #c9dcea;
    background: var(--primary-tint);
    color: var(--primary);
}

/* -------------------------------- карточки -------------------------------- */

.card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 18px;
    line-height: 26px;
}

.card-sub {
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}

.section {
    margin-top: 32px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-title {
    font-size: 18px;
    line-height: 26px;
}

.section-meta {
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}

/* ------------------------------ показатели -------------------------------- */

/* Главная цифра экрана — блок SCR-10 «Свободные деньги». Подключим, когда
   появятся суммы (этап 2); сейчас дашборд показывает счётчики .kpi-*. */
.metric-label {
    margin-bottom: 6px;
}

.metric-value {
    font-size: 40px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    line-height: 44px;
}

.metric-note {
    margin-top: 8px;
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.kpi-label {
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 16px;
    text-transform: uppercase;
}

.kpi-value {
    margin-top: 4px;
    font-size: 22px;
    font-weight: 600;
    line-height: 30px;
    overflow-wrap: anywhere;
}

.kpi-note {
    margin-top: 2px;
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}

/* --------------------------- списки и строки ------------------------------ */

.row-list {
    margin: 0;
}

.row-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.row-item:first-child {
    padding-top: 4px;
}

.row-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.row-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface-sunken);
    color: var(--ink-2);
    font-size: 14px;
    line-height: 1;
}

.row-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.row-title {
    font-size: 15px;
    font-weight: 500;
    line-height: 24px;
}

.row-note {
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}

/* -------------------------------- прогресс -------------------------------- */

.progress {
    display: block;
    flex: 1;
    min-width: 40px;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--primary);
}

.progress-warning > span {
    background: #c88a2e;
}

.progress-danger > span {
    background: var(--expense);
}

/* -------------------------------- таблицы --------------------------------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table th {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table .is-right,
.table th.is-right {
    text-align: right;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

/* ---------------------------- формы и поля -------------------------------- */

.form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 6px;
}

.field-label {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
}

.field-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
    line-height: 22px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input::placeholder {
    color: var(--ink-3);
}

.field-input:hover {
    border-color: var(--ink-3);
}

.field-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.field-input[aria-invalid="true"] {
    border-color: var(--danger);
}

.field-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.18);
}

.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 12px;
    line-height: 16px;
}

.form-actions {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

/* ------------------------------- уведомления ------------------------------ */

.alert {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface-subtle);
    font-size: 14px;
    line-height: 20px;
}

.alert-title {
    font-weight: 600;
}

.alert-error {
    border-color: #ebc9c4;
    background: var(--danger-tint);
    color: #8f251d;
}

.alert-warning {
    border-color: #ebd6b4;
    background: var(--warning-tint);
    color: #7e4900;
}

.alert-info {
    border-color: #c9dcea;
    background: var(--primary-tint);
    color: var(--primary);
}

/* ---------------------------- пустые состояния ---------------------------- */

.empty {
    padding: 24px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-card);
    background: var(--surface-subtle);
    text-align: center;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 24px;
}

.empty-text {
    margin-top: 4px;
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}
/* --------------------------------- бренд ---------------------------------- */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover {
    color: var(--ink);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-control);
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text b {
    font-size: 15px;
    font-weight: 600;
}

.brand-sub {
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ============================ публичные страницы ========================== */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 20px 32px;
}

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.site-nav a {
    color: var(--ink-2);
    font-size: 15px;
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--primary);
}

.site-nav .button,
.site-nav .button:hover {
    color: #fff;
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 8px 32px 64px;
}

.site-footer {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 20px 32px 32px;
    border-top: 1px solid var(--border);
    color: var(--ink-3);
    font-size: 12px;
    line-height: 16px;
}

.hero-card {
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.hero-title {
    margin-top: 16px;
    font-size: clamp(30px, 4vw, 40px);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.12;
}

.hero-lead {
    max-width: 62ch;
    margin-top: 12px;
    color: var(--ink-2);
    font-size: 16px;
    line-height: 26px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.feature {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    border-radius: var(--radius-control);
    background: var(--primary-tint);
    color: var(--primary);
    font-size: 16px;
    line-height: 1;
}

.feature h2,
.feature h3 {
    font-size: 16px;
    line-height: 24px;
}

.feature p {
    color: var(--ink-2);
    font-size: 14px;
    line-height: 22px;
}

/* --------------------------- авторизация: сплит ---------------------------- */

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 44%) minmax(0, 1fr);
    min-height: 560px;
    margin-top: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-modal);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.auth-promo {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 36px;
    border-right: 1px solid var(--border);
    background: var(--surface-sunken);
}

.auth-promo .brand {
    margin-bottom: 28px;
}

.auth-promo-title {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.auth-promo-lead {
    margin-top: 8px;
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
}

.auth-promo-list {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.auth-promo-list li {
    position: relative;
    padding-left: 16px;
    color: var(--ink-2);
    font-size: 14px;
    line-height: 20px;
}

.auth-promo-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.auth-promo-footer {
    color: var(--ink-3);
    font-size: 12px;
    line-height: 16px;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 40px 32px;
}

.auth-form {
    width: 100%;
    max-width: 360px;
}

.auth-title {
    font-size: 22px;
    line-height: 30px;
}

.auth-lead {
    margin-top: 6px;
    color: var(--ink-3);
    font-size: 14px;
    line-height: 20px;
}

.auth-note {
    color: var(--ink-3);
    font-size: 13px;
    line-height: 20px;
    text-align: center;
}

.auth-form > .alert,
.auth-form > .form,
.auth-form > .auth-note {
    margin-top: 16px;
}
/* ----------------------------- оболочка приложения ------------------------ */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100vh;
    padding: 20px 12px 16px;
    border-right: 1px solid var(--border);
    background: var(--surface-subtle);
    overflow-y: auto;
}

.sidebar > .brand {
    margin-bottom: 16px;
    padding: 0 8px;
}

.ledger-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--surface);
}

.ledger-badge {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-control);
    background: var(--primary-tint);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
}

.ledger-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ledger-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ledger-meta {
    color: var(--ink-3);
    font-size: 11px;
    line-height: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group {
    margin: 16px 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-control);
    color: var(--ink-2);
    font-size: 14px;
    line-height: 20px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--primary-tint);
    color: var(--primary);
}

.nav-item.is-active {
    background: var(--primary-tint);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.is-soon,
.nav-item.is-soon:hover {
    background: transparent;
    color: var(--ink-3);
    cursor: default;
}

.nav-item .badge {
    margin-left: auto;
}

.nav-icon {
    display: inline-block;
    flex: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    opacity: 0.65;
}

.sidebar-divider {
    height: 1px;
    margin: 12px 8px;
    background: var(--border);
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 8px 0;
    color: var(--ink-3);
    font-size: 11px;
    line-height: 16px;
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: var(--topbar-height);
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
}

.topbar-spacer {
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.topbar-user-name {
    max-width: 220px;
    color: var(--ink-2);
    font-size: 14px;
    line-height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 32px;
}

.app-footer {
    padding: 16px 32px 24px;
    border-top: 1px solid var(--border);
    color: var(--ink-3);
    font-size: 12px;
    line-height: 16px;
}

/* ------------------------------ шапка страницы ---------------------------- */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.page-head .eyebrow {
    margin-bottom: 4px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.metric-card {
    padding: 24px;
}

.account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

/* ------------------------------- адаптивность ----------------------------- */

/* По §4 визуального направления на 1024–1279 сайдбар сворачивается в иконки
   72px, а на 768–1023 уходит в drawer. Пока в проекте нет JS, сайдбар
   превращается в горизонтальную полосу навигации: механика drawer придёт
   вместе с первым JS-модулем. Остальные правила соответствуют §4. */
@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        height: auto;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        overflow: visible;
    }

    .sidebar > .brand {
        margin: 0 12px 0 0;
        padding: 0;
    }

    .ledger-switch {
        margin: 0 12px 0 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .nav-group,
    .sidebar-divider,
    .sidebar-footer {
        display: none;
    }

    .nav-item {
        padding: 6px 10px;
    }
}

@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .auth-promo {
        display: none;
    }

    .auth-panel {
        padding: 32px 24px;
    }
}

@media (max-width: 768px) {
    .site-header,
    .site-main,
    .site-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-main {
        padding-bottom: 48px;
    }

    .hero-card {
        padding: 24px;
    }

    .topbar {
        padding: 0 16px;
    }

    .app-content {
        padding: 24px 16px;
    }

    .app-footer {
        padding: 16px 16px 24px;
    }

    .topbar-user-name {
        display: none;
    }

    .page-head {
        flex-direction: column;
        gap: 16px;
    }

    .metric-card {
        padding: 20px;
    }

    .metric-value {
        font-size: 32px;
        line-height: 38px;
    }
}

@media (max-width: 560px) {
    .hero-actions,
    .page-actions {
        width: 100%;
    }

    .hero-actions .button,
    .page-actions .button {
        width: 100%;
    }

    .card {
        padding: 16px;
    }

    .row-item {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
