/* ============================================================
   BizSettle — Главный файл стилей
   Финансовый учёт взаиморасчётов
   
   Дизайн-система: тёплый минимализм с акцентами индиго.
   Адаптивность: mobile-first подход.
   ============================================================ */

/* ── CSS-переменные (дизайн-токены) ── */
:root {
    /* Цвета */
    --color-bg:          #f8f7f4;
    --color-surface:     #ffffff;
    --color-surface-alt: #f1f0ec;
    --color-border:      #e5e2db;
    --color-border-light:#eeece6;
    --color-text:        #1a1a1a;
    --color-text-muted:  #6b6560;
    --color-text-light:  #9c9690;

    --color-primary:     #4f46e5;
    --color-primary-hover:#4338ca;
    --color-primary-soft: #eef2ff;
    --color-primary-text: #3730a3;

    --color-success:     #16a34a;
    --color-success-soft:#f0fdf4;
    --color-danger:      #dc2626;
    --color-danger-soft: #fef2f2;
    --color-warning:     #d97706;
    --color-warning-soft:#fffbeb;
    --color-info:        #0284c7;
    --color-info-soft:   #f0f9ff;

    /* Типографика */
    --font-main:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', var(--font-main);
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

    /* Размеры шрифтов */
    --text-xs:   0.75rem;
    --text-sm:   0.8125rem;
    --text-base: 0.9375rem;
    --text-lg:   1.125rem;
    --text-xl:   1.375rem;
    --text-2xl:  1.75rem;
    --text-3xl:  2.25rem;

    /* Отступы */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Скругления */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-full: 9999px;

    /* Тени */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.08);

    /* Анимация */
    --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Сайдбар */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
}


/* ── Сброс и базовые стили ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-hover); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
}


/* ═══════════════════════════════════════
   СТРАНИЦА ВХОДА
   ═══════════════════════════════════════ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f7f4 0%, #eef2ff 50%, #f8f7f4 100%);
    padding: var(--space-4);
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--color-border-light);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo__icon {
    width: 56px;
    height: 56px;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    color: white;
    font-size: 1.5rem;
}

.login-logo__title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
}

.login-logo__subtitle {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}


/* ═══════════════════════════════════════
   ЛЕЙАУТ: САЙДБАР + КОНТЕНТ
   ═══════════════════════════════════════ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Сайдбар ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar__header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar__logo {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.sidebar__brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--color-text);
}

.sidebar__nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section__label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-light);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.nav-link.active {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 600;
}

.nav-link__icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-link.active .nav-link__icon {
    opacity: 1;
}

.sidebar__footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border-light);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-badge:hover {
    background: var(--color-surface-alt);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.user-badge__info {
    flex: 1;
    min-width: 0;
}

.user-badge__name {
    font-weight: 600;
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-badge__role {
    font-size: var(--text-xs);
    color: var(--color-text-light);
}


/* ── Основной контент ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    padding: var(--space-6) var(--space-8);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-header__title {
    font-size: var(--text-xl);
    font-weight: 700;
    font-family: var(--font-display);
}

.content-header__subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.content-body {
    padding: var(--space-6) var(--space-8);
}


/* ── Мобильное меню ── */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) var(--space-4);
    align-items: center;
    justify-content: space-between;
}

.mobile-burger {
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--color-text);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99;
    backdrop-filter: blur(4px);
}


/* ═══════════════════════════════════════
   КОМПОНЕНТЫ
   ═══════════════════════════════════════ */

/* ── Карточки ── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card--flat {
    box-shadow: none;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.card__title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
}

/* ── Стат-карточки (дашборд) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card__icon--primary  { background: var(--color-primary-soft); color: var(--color-primary); }
.stat-card__icon--success  { background: var(--color-success-soft); color: var(--color-success); }
.stat-card__icon--warning  { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-card__icon--danger   { background: var(--color-danger-soft);  color: var(--color-danger); }
.stat-card__icon--info     { background: var(--color-info-soft);    color: var(--color-info); }

.stat-card__label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.stat-card__value {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
}

.stat-card__hint {
    font-size: var(--text-xs);
    color: var(--color-text-light);
    margin-top: var(--space-1);
}


/* ── Баланс-карточка ── */
.balance-card {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    border: none;
    color: white;
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    position: relative;
    overflow: hidden;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.balance-card__label {
    font-size: var(--text-sm);
    opacity: 0.85;
    margin-bottom: var(--space-2);
}

.balance-card__amount {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.balance-card__status {
    font-size: var(--text-sm);
    opacity: 0.9;
}

.balance-positive { color: #86efac; }
.balance-negative { color: #fca5a5; }
.balance-zero     { color: rgba(255,255,255,0.8); }


/* ── Кнопки ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: var(--text-sm);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn--primary {
    background: var(--color-primary);
    color: white;
}
.btn--primary:hover {
    background: var(--color-primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn--secondary {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn--secondary:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

.btn--danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}
.btn--danger:hover {
    background: var(--color-danger);
    color: white;
}

.btn--ghost {
    background: transparent;
    color: var(--color-text-muted);
}
.btn--ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.btn--sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.btn--lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn--block {
    width: 100%;
}


/* ── Формы ── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-light);
    margin-top: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-surface);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder {
    color: var(--color-text-light);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}


/* ── Таблицы ── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    background: var(--color-surface-alt);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--color-surface-alt);
}

.table__amount {
    font-family: var(--font-display);
    font-weight: 600;
    white-space: nowrap;
}

.table__amount--positive { color: var(--color-success); }
.table__amount--negative { color: var(--color-danger); }


/* ── Бейджи ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.badge--primary  { background: var(--color-primary-soft); color: var(--color-primary); }
.badge--success  { background: var(--color-success-soft); color: var(--color-success); }
.badge--danger   { background: var(--color-danger-soft);  color: var(--color-danger); }
.badge--warning  { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--neutral  { background: var(--color-surface-alt);  color: var(--color-text-muted); }


/* ── Уведомления (флеш-сообщения) ── */
.flash {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: flashIn 0.3s ease;
}

.flash--success { background: var(--color-success-soft); color: var(--color-success); border: 1px solid #bbf7d0; }
.flash--error   { background: var(--color-danger-soft);  color: var(--color-danger);  border: 1px solid #fecaca; }
.flash--info    { background: var(--color-info-soft);    color: var(--color-info);    border: 1px solid #bae6fd; }

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── Фильтры ── */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-group label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
}

.filter-group select,
.filter-group input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    background: var(--color-surface);
    min-width: 140px;
}


/* ── Лента активности ── */
.activity-feed {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item__avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    flex-shrink: 0;
}

.activity-item__text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.5;
}

.activity-item__text strong {
    color: var(--color-text);
}

.activity-item__time {
    font-size: var(--text-xs);
    color: var(--color-text-light);
    margin-top: 2px;
}


/* ── Пустые состояния ── */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--color-text-muted);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state__title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.empty-state__text {
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
}


/* ── Грид расходов (карточный вид) ── */
.expense-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
}

.expense-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--transition-normal);
}

.expense-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.expense-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.expense-card__category {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-muted);
}

.expense-card__category-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.expense-card__amount {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
}

.expense-card__desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}

.expense-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border-light);
}

.expense-card__user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.expense-card__date {
    font-size: var(--text-xs);
    color: var(--color-text-light);
}

.expense-card__actions {
    display: flex;
    gap: var(--space-1);
}


/* ── Графики-заглушки (простые CSS-бары) ── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    height: 160px;
    padding-top: var(--space-4);
}

.bar-chart__bar {
    flex: 1;
    background: var(--color-primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 4px;
    position: relative;
    transition: all var(--transition-normal);
    opacity: 0.7;
}

.bar-chart__bar:hover {
    opacity: 1;
}

.bar-chart__bar-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--color-text-light);
    white-space: nowrap;
}

.bar-chart__bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.bar-chart__bar:hover .bar-chart__bar-value {
    opacity: 1;
}


/* ── Категории-дуга (простая визуализация) ── */
.category-list {
    list-style: none;
}

.category-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.category-item__bar {
    flex: 1;
    height: 8px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.category-item__fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}

.category-item__name {
    font-size: var(--text-sm);
    font-weight: 500;
    min-width: 120px;
}

.category-item__amount {
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-display);
    min-width: 100px;
    text-align: right;
}


/* ── Модалки ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal__title {
    font-size: var(--text-lg);
    font-weight: 700;
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: var(--space-1);
}

.modal__body {
    padding: var(--space-6);
}

.modal__footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}


/* ── Утилиты ── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.font-bold    { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.flex  { display: flex; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }


/* ═══════════════════════════════════════
   АДАПТИВНОСТЬ
   ═══════════════════════════════════════ */

@media (max-width: 1024px) {
    .content-body {
        padding: var(--space-4) var(--space-5);
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Скрыть десктопный сайдбар, показать мобильное меню */
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.active {
        display: block;
    }
    .mobile-header {
        display: flex;
    }
    .main-content {
        margin-left: 0;
    }

    .content-header {
        padding: var(--space-4) var(--space-4);
        flex-direction: column;
        align-items: flex-start;
    }

    .content-body {
        padding: var(--space-4);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .expense-cards {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group select,
    .filter-group input {
        min-width: auto;
        width: 100%;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .balance-card__amount {
        font-size: var(--text-2xl);
    }

    .table th:nth-child(n+4),
    .table td:nth-child(n+4) {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: var(--space-6);
    }

    .btn--lg {
        padding: var(--space-3) var(--space-4);
    }
}


/* ── Анимации появления элементов ── */
.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }


/* ── Скроллбар ── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}


/* ═══════════════════════════════════════
   УВЕДОМЛЕНИЯ (колокольчик) — v1.2.0
   ═══════════════════════════════════════ */

.notif-bell {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
    color: var(--color-text-muted);
}

.notif-bell:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: notifPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes notifPop {
    0%   { transform: scale(0); }
    80%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ── Dropdown уведомлений ── */
.notif-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.notif-dropdown__header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-dropdown__list {
    max-height: 340px;
    overflow-y: auto;
}

.notif-dropdown__empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--color-text-light);
    font-size: var(--text-sm);
}

.notif-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition-fast);
    text-decoration: none;
    color: inherit;
}

.notif-item:hover {
    background: var(--color-surface-alt);
    color: inherit;
}

.notif-item__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    padding-top: 2px;
}

.notif-item__content {
    flex: 1;
    min-width: 0;
}

.notif-item__title {
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.4;
}

.notif-item__msg {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item__time {
    font-size: 10px;
    color: var(--color-text-light);
    margin-top: 3px;
}


/* ── Бейдж pending в навигации ── */
.pending-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: var(--color-warning);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: 0 5px;
    margin-left: auto;
}


/* ── Адаптивность для уведомлений ── */
@media (max-width: 768px) {
    .notif-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
}


/* ═══════════════════════════════════════
   МАССОВАЯ ОПЛАТА (модалка) — v1.3.0
   ═══════════════════════════════════════ */

.batch-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
}

.batch-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.batch-item:last-child { border-bottom: none; }

.batch-item:hover { background: var(--color-surface-alt); }

.batch-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
    cursor: pointer;
}

.batch-item__info {
    flex: 1;
    min-width: 0;
}

.batch-item__label {
    font-size: var(--text-sm);
    line-height: 1.4;
    color: var(--color-text);
}

.batch-item__amount {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-danger);
    white-space: nowrap;
}
