/* ============================================================================
   #ЧистоШава Admin — Brand Design System v3 (28.04.2026)
   Бренд: чёрный + ШАВА жёлтый + Шавамен (бирюзовый+красный)
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

/* === Brand fonts (с Yandex.Disk фирстиля #ЧИСТОШАВА) === */
@font-face {
    font-family: 'Gilroy';
    src: url('/static/fonts/gilroy-extra-bold.woff2') format('woff2'),
         url('/static/fonts/gilroy-extra-bold.ttf') format('truetype');
    font-weight: 800 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'CDXStarstreak';
    src: url('/static/fonts/CDXStarstreak-Bold.woff2') format('woff2'),
         url('/static/fonts/CDXStarstreak-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Troubleside';
    src: url('/static/fonts/Troubleside.woff2') format('woff2'),
         url('/static/fonts/Troubleside.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* === Brand палитра (точно как в реальной вывеске) === */
    --brand-black: #0F0F12;
    --brand-black-2: #1A1A1F;
    --brand-yellow: #F5C518;        /* ШАВА текст */
    --brand-yellow-soft: #FFF3C0;
    --brand-yellow-deep: #C9A013;
    --brand-teal: #2BA89E;          /* костюм Шавамена */
    --brand-teal-dark: #1F7E76;
    --brand-teal-soft: #C5EBE7;
    --brand-red: #E84855;           /* плащ/перчатки */
    --brand-red-dark: #C13242;
    --brand-orange: #FF6B35;        /* доп. CTA акцент */
    --brand-orange-dark: #E55520;
    --brand-orange-soft: #FFE5DA;

    /* Aliases (back-compat) — primary = жёлтый бренда */
    --primary: var(--brand-yellow);
    --primary-dark: var(--brand-yellow-deep);
    --primary-light: var(--brand-yellow-soft);

    /* Surfaces */
    --bg: #F5F5F7;
    --bg-warm: #FAFAF7;
    --surface: #FFFFFF;
    --surface-hover: #FAFAFC;
    --surface-2: #F0F1F4;
    --surface-dark: var(--brand-black);

    /* Text */
    --text: var(--brand-black);
    --text-2: #3A3A42;
    --text-muted: #6B7280;
    --text-subtle: #9CA3AF;
    --text-on-dark: #F5F5F7;

    /* Borders */
    --border: #E5E7EB;
    --border-soft: #F0F1F5;

    /* States */
    --success: #10B981;
    --success-bg: #D1FAE5;
    --danger: var(--brand-red);
    --danger-bg: #FEE2E2;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --info: var(--brand-teal);
    --info-bg: var(--brand-teal-soft);

    /* Shape */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15,15,18,0.04), 0 1px 3px rgba(15,15,18,0.06);
    --shadow: 0 4px 14px rgba(15,15,18,0.06), 0 1px 3px rgba(15,15,18,0.04);
    --shadow-md: 0 10px 25px rgba(15,15,18,0.08), 0 4px 10px rgba(15,15,18,0.04);
    --shadow-lg: 0 20px 50px rgba(15,15,18,0.12), 0 8px 16px rgba(15,15,18,0.06);
    --shadow-yellow: 0 8px 24px rgba(245, 197, 24, 0.35);
    --shadow-orange: 0 8px 24px rgba(255, 107, 53, 0.28);
    --shadow-teal: 0 8px 20px rgba(43, 168, 158, 0.25);

    /* Layout */
    --sidebar-width: 268px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 0.15s;
    --t-base: 0.25s;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    font-feature-settings: "ss01", "tnum";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--brand-yellow); color: var(--brand-black); }

a { color: var(--brand-orange); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-orange-dark); }

/* === Brand Wordmark (Gilroy ExtraBold + CDXStarstreak для #) — точно по фирстилю === */
.brand-wordmark {
    font-family: 'Gilroy', 'Manrope', 'Inter', system-ui, sans-serif;
    font-weight: 900;
    letter-spacing: -0.025em;
    font-size: 26px;
    line-height: 1;
    display: inline-flex;
    align-items: baseline;
    color: var(--brand-black);
    white-space: nowrap;
}
/* # — фирменный grunge-шрифт CDXStarstreak (рукописный) */
.brand-wordmark .hash {
    font-family: 'CDXStarstreak', 'Gilroy', sans-serif;
    color: var(--brand-yellow);
    display: inline-block;
    margin-right: 4px;
    font-weight: 700;
    font-size: 1.05em;
}
.brand-wordmark .chisto { color: inherit; }
.brand-wordmark .shava { color: var(--brand-yellow); }
.brand-wordmark.light { color: white; }
.brand-wordmark.light .chisto { color: white; }
.brand-wordmark.lg { font-size: 38px; }
.brand-wordmark.xl { font-size: 56px; }
.brand-wordmark.xxl { font-size: 76px; }

/* === Shavaman Ш-emblem (мини логотип в sidebar) === */
.brand-emblem {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--brand-black);
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(15,15,18,0.25);
    position: relative;
    flex-shrink: 0;
}
.brand-emblem::before {
    content: 'Ш';
    font-family: 'Bebas Neue', sans-serif;
    color: var(--brand-yellow);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}
.brand-emblem.with-cape::after {
    content: ''; position: absolute; right: -3px; top: 4px; bottom: 4px; width: 4px;
    background: var(--brand-red);
    border-radius: 2px;
    opacity: 0.85;
}

/* === LAYOUT === */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border-soft);
    padding: 24px 14px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow: hidden;          /* сам сайдбар не скроллится — скроллится .sidebar-scroll внутри */
    z-index: 100;
    transition: transform var(--t-base) var(--ease-out);
    /* App-shell: меню скроллится в .sidebar-scroll, футер (профиль + колокольчик/
       шестерёнка/выход) — нескроллируемый flex-ребёнок, ВСЕГДА виден внизу. */
    display: flex;
    flex-direction: column;
}
/* Скролл-контейнер меню: занимает всё свободное место и скроллится сам.
   min-height:0 ОБЯЗАТЕЛЬНО — иначе flex-ребёнок не сожмётся и скролл не появится. */
.sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 22px;
    padding: 4px 10px 18px;
    border-bottom: 1px solid var(--border-soft);
}
.sidebar-brand .brand-logo {
    height: 56px;
    width: auto;
    max-width: 100%;
}
/* День: logo/3.png (чёрная ЧИСТО, квадратный 1135x502).
   Ночь: logo/1.png (белая ЧИСТО, горизонтальный 2885x386 ≈ 7.47:1) — высота меньше.
   ВАЖНО: Гиро-переключатель занимает 56px в правом углу sidebar-brand,
   ширина sidebar ~248px → логотипу остаётся ~170-180px.
   Логотип-день 56px×127px (≈2.26:1) — помещается.
   Логотип-ночь надо ограничить по ширине, иначе налезает на Гиро. */
.sidebar-brand .brand-logo-night,
.logo-mobile .brand-logo-night { height: 24px; max-width: 170px; }
.sidebar-brand .brand-logo-day,
.logo-mobile .brand-logo-day { height: 24px; max-width: 170px; }
.brand-logo.brand-logo-day  { display: block; }
.brand-logo.brand-logo-night { display: none; }
html[data-theme="dark"] .brand-logo.brand-logo-day  { display: none; }
html[data-theme="dark"] .brand-logo.brand-logo-night { display: block; }
.sidebar-brand-sub {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 16px 12px 8px;
    margin-top: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 1px;
    transition: all var(--t-fast) var(--ease-out);
    position: relative;
}
.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}
.nav-item.active {
    background: linear-gradient(90deg, var(--brand-yellow-soft) 0%, #FFF8DC 100%);
    color: var(--brand-black);
    font-weight: 700;
}
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
    background: var(--brand-yellow);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(245, 197, 24, 0.5);
}
/* SVG-иконки Lucide-style — единый стиль stroke */
.ic {
    width: 18px; height: 18px;
    flex-shrink: 0;
    color: currentColor;
    transition: opacity var(--t-fast);
    display: inline-block;
    vertical-align: middle;
}
.nav-item .ic { opacity: 0.75; }
.nav-item:hover .ic, .nav-item.active .ic { opacity: 1; }
.nav-item.active .ic { color: var(--brand-yellow-deep); }
.btn .ic { width: 16px; height: 16px; opacity: 0.85; }

.sidebar-footer {
    flex-shrink: 0;            /* нескроллируемый flex-ребёнок фикс-высоты — ВСЕГДА виден внизу колонки */
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    background: var(--surface); /* фон сайдбара, чтобы пункты не просвечивали */
}
.user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--brand-black);
    color: var(--text-on-dark);
    border-radius: var(--radius-sm);
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-yellow), var(--brand-orange));
    color: var(--brand-black); font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(245, 197, 24, 0.4);
    flex-shrink: 0;
    font-size: 14px;
}

/* Main */
.main { flex: 1; margin-left: var(--sidebar-width); padding: 32px 36px; min-width: 0; }

/* Mobile */
.mobile-header { display: none; }
.sidebar-overlay { display: none; }
.menu-toggle {
    background: var(--brand-black);
    color: var(--brand-yellow);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 18px; cursor: pointer;
    transition: all var(--t-fast);
}
.menu-toggle:hover { background: var(--brand-black-2); }
.logo-mobile {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 16px;
    color: var(--text); letter-spacing: -0.01em;
}

@media (max-width: 1024px) {
    /* Layout перестаёт быть flex-row, чтобы main занял всю ширину */
    .layout { display: block; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 16px 16px 36px; width: 100%; }
    .mobile-header {
        display: flex; justify-content: space-between; align-items: center;
        padding: 12px 16px; background: rgba(255,255,255,0.85);
        backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid var(--border-soft);
        position: sticky; top: 0; z-index: 90;
    }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,15,18,0.4); backdrop-filter: blur(2px); z-index: 99; }
    .sidebar-overlay.open { display: block; }

    /* Welcome-card: убираем max-width 60% и mascot на mobile */
    .welcome-card-content { max-width: 100% !important; }
    .welcome-mascot { display: none; }

    /* Двухколоночные grid на dashboard сжимаем в 1 колонку */
    .main > div[style*="grid-template-columns:1.4fr 1fr"],
    .main > div[style*="grid-template-columns: 1.4fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Page title чуть меньше */
    .page-title { font-size: 24px; }
    .stat-value { font-size: 22px; }

    /* Cards padding меньше на мобиле */
    .card { padding: 18px 16px; }
    .stat-card { padding: 14px 16px; }
    .welcome-card { padding: 20px 22px; }
}

/* === Page header === */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title {
    font-family: 'Gilroy', 'Manrope', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: -0.025em;
    line-height: 1.15;
}
.page-subtitle { color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* === Cards === */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-soft);
    transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow); }
.card-title { font-size: 17px; font-weight: 700; margin: 0 0 16px; color: var(--text); letter-spacing: -0.01em; }
.cards { display: grid; gap: 14px; }
.spacer { height: 16px; }

/* === Stat cards (премиальные с brand accent) === */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    transition: all var(--t-base) var(--ease-out);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-yellow-soft);
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--brand-yellow), var(--brand-orange));
    opacity: 0;
    transition: opacity var(--t-base);
}
.stat-card:hover::before { opacity: 1; }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--brand-yellow-soft);
    color: var(--brand-yellow-deep);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-icon .ic { width: 22px; height: 22px; opacity: 1; }
.stat-icon-yellow { background: var(--brand-yellow-soft); color: var(--brand-yellow-deep); }
.stat-icon-red    { background: #FEE2E2; color: var(--brand-red-dark); }
.stat-icon-teal   { background: var(--brand-teal-soft); color: var(--brand-teal-dark); }
.stat-icon-orange { background: var(--brand-orange-soft); color: var(--brand-orange-dark); }
.stat-icon-success{ background: var(--success-bg); color: #047857; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--t-fast);
}
.form-control:hover { border-color: var(--text-subtle); }
.form-control:focus {
    outline: none;
    border-color: var(--brand-yellow);
    box-shadow: 0 0 0 4px rgba(245, 197, 24, 0.18);
}
.form-control::placeholder { color: var(--text-subtle); }
.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all var(--t-fast) var(--ease-out);
    text-decoration: none;
    line-height: 1.2;
    user-select: none;
    white-space: nowrap;
}
.btn:hover {
    background: var(--surface-2);
    border-color: var(--text-subtle);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

/* Primary = бренд жёлтый на чёрном (как ШАВА на вывеске) */
.btn-primary {
    background: var(--brand-black);
    color: var(--brand-yellow);
    border-color: var(--brand-black);
    box-shadow: 0 4px 14px rgba(15,15,18,0.2);
    font-weight: 700;
    letter-spacing: 0.01em;
}
.btn-primary:hover {
    background: var(--brand-black-2);
    color: var(--brand-yellow);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(15,15,18,0.3);
    border-color: var(--brand-black-2);
}
.btn-primary:active { transform: translateY(0); }

/* Secondary CTA = оранжевый */
.btn-orange {
    background: linear-gradient(135deg, var(--brand-orange) 0%, #FF8347 100%);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-orange);
    font-weight: 700;
}
.btn-orange:hover {
    background: linear-gradient(135deg, var(--brand-orange-dark) 0%, var(--brand-orange) 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 107, 53, 0.4);
}

/* Teal — для info-CTA */
.btn-teal {
    background: var(--brand-teal);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-teal);
}
.btn-teal:hover {
    background: var(--brand-teal-dark);
    color: white;
    transform: translateY(-1px);
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    line-height: 1.4;
}
.badge-primary { background: var(--brand-yellow-soft); color: var(--brand-yellow-deep); }
.badge-success { background: var(--success-bg); color: #047857; }
.badge-danger { background: var(--danger-bg); color: var(--brand-red-dark); }
.badge-warning { background: var(--warning-bg); color: #92400E; }
.badge-info { background: var(--brand-teal-soft); color: var(--brand-teal-dark); }

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 3px solid;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.alert-success { border-color: var(--success); background: var(--success-bg); color: #065F46; }
.alert-danger { border-color: var(--danger); background: var(--danger-bg); color: var(--brand-red-dark); }
.alert-warning { border-color: var(--warning); background: var(--warning-bg); color: #92400E; }
.alert-info { border-color: var(--brand-teal); background: var(--brand-teal-soft); color: var(--brand-teal-dark); }

/* === Tables === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table thead th {
    text-align: left;
    padding: 10px 14px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }

/* === Empty state === */
.empty-state { text-align: center; padding: 36px 20px; color: var(--text-muted); }
.empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.6; }

/* === Login (split-screen, brand wall) === */
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--bg);
}
/* Левая часть — БРЕНД: реальная фото Шавамена возле вывески #ЧИСТОШАВА */
.login-hero {
    position: relative;
    background:
        linear-gradient(135deg, rgba(15,15,18,0.92) 0%, rgba(15,15,18,0.55) 60%, rgba(15,15,18,0.85) 100%),
        url('/static/img/welcome.jpg') center/cover no-repeat;
    color: white;
    padding: 56px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
/* Декор: жёлтые блики — подсветка вывески сверху */
.login-hero::before {
    content: '';
    position: absolute;
    top: -180px; left: -180px;
    width: 460px; height: 460px;
    background: radial-gradient(circle, rgba(245, 197, 24, 0.22) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}
/* Красное свечение от плаща — снизу справа */
.login-hero::after {
    content: '';
    position: absolute;
    bottom: -120px; right: -120px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(232, 72, 85, 0.2) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.login-hero-brand {
    position: relative; z-index: 2;
    display: flex; align-items: center; gap: 14px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    letter-spacing: 0.02em;
    line-height: 1;
}
.login-hero-brand .y { color: var(--brand-yellow); }

.login-hero-content {
    position: relative; z-index: 2;
    max-width: 500px;
}
.login-hero-content h2 {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin: 0 0 16px;
    color: white;
}
.login-hero-content h2 .accent { color: var(--brand-yellow); }
.login-hero-content p {
    font-size: 17px;
    line-height: 1.6;
    color: rgba(255,255,255,0.78);
    margin: 0 0 28px;
}

.login-hero-stats {
    position: relative; z-index: 2;
    display: flex; gap: 36px;
    color: rgba(255,255,255,0.75);
    flex-wrap: wrap;
}
.login-hero-stats div { font-size: 13px; }
.login-hero-stats strong {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    color: var(--brand-yellow);
    margin-bottom: 2px;
    line-height: 1;
}

/* Убрали .login-hero-mascot — Шавамен уже в фоне через welcome.jpg */

.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: linear-gradient(180deg, var(--bg) 0%, #FAFAF7 100%);
    position: relative;
}
.login-form-side::before {
    content: '';
    position: absolute;
    top: 80px; left: 50%; transform: translateX(-50%);
    width: 280px; height: 280px;
    background: radial-gradient(circle, var(--brand-yellow-soft) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.6;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 44px 38px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-soft);
    position: relative;
    z-index: 2;
}
/* .login-logo больше не используется — теперь wordmark.svg вставляется напрямую в шаблоне */
.login-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    text-align: center;
    letter-spacing: -0.02em;
}
.login-subtitle { color: var(--text-muted); text-align: center; margin: 0 0 26px; font-size: 14px; }

@media (max-width: 980px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

/* === Welcome card (на dashboard) === */
.welcome-card {
    background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-black-2) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}
.welcome-card::before {
    content: '';
    position: absolute;
    top: -100px; right: -100px;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(245,197,24,0.2) 0%, transparent 70%);
    pointer-events: none;
}
.welcome-card-content { position: relative; z-index: 2; max-width: 60%; }
.welcome-card h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 6px;
    color: white;
    letter-spacing: -0.01em;
}
.welcome-card h2 .y { color: var(--brand-yellow); }
.welcome-card p { color: rgba(255,255,255,0.7); margin: 0; font-size: 14px; }
.welcome-mascot {
    position: absolute;
    right: 16px; top: 0; bottom: 0;
    width: 220px;
    background: url('/static/img/shavamen.webp') right center/contain no-repeat;
    z-index: 1;
    opacity: 1;
    pointer-events: none;
    /* Лёгкий fade слева чтобы текст «Привет, Илья!» не упирался */
    mask-image: linear-gradient(90deg, transparent 0%, black 28%, black 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 28%, black 100%);
}
html[data-theme="dark"] .welcome-mascot { opacity: 0.95; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4)); }
.welcome-logo { /* moved closer to mascot */
    position: absolute;
    top: 50%; right: 200px;
    transform: translateY(-50%);
    z-index: 1;
    pointer-events: none;
}
.welcome-logo .brand-logo { height: 42px; width: auto; opacity: 1; display: block; }
.welcome-logo .brand-logo-day  { display: none; }
.welcome-logo .brand-logo-night{ display: block; }
html[data-theme="dark"] .welcome-logo .brand-logo-day  { display: none; }
html[data-theme="dark"] .welcome-logo .brand-logo-night{ display: block; }
/* Welcome-card сама по себе ВСЕГДА тёмная (это брендовая «hero»),
   так что используем НОЧНОЙ (белая ЧИСТО) логотип в обеих темах. */
@media (max-width: 1100px){ .welcome-logo{ display:none; } }
@media (max-width: 720px){ .welcome-mascot{ width: 130px; opacity: 0.55; } }

/* === Дополнительные === */
hr.divider { border: 0; height: 1px; background: var(--border-soft); margin: 18px 0; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.main > * { animation: fadeIn 0.3s var(--ease-out) both; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   🌙 НОЧНАЯ ТЕМА — data-theme="dark" на <html>
   ============================================================================ */
html[data-theme="dark"] {
    /* Surfaces */
    --bg: #0B0B0E;
    --bg-warm: #0E0E12;
    --surface: #16161B;
    --surface-hover: #1C1C22;
    --surface-2: #20202A;
    --surface-dark: #050507;

    /* Text */
    --text: #F0F0F2;
    --text-2: #C4C4CC;
    --text-muted: #8B8B95;
    --text-subtle: #5A5A66;
    --text-on-dark: #F5F5F7;

    /* Borders */
    --border: #2A2A33;
    --border-soft: #1F1F27;

    /* States — фоны для алертов делаем темнее */
    --success-bg: #0A2D1F;
    --danger-bg: #2D0E14;
    --warning-bg: #2D1F08;
    --info-bg: #0E2A28;

    /* Тени — тёмные с тёплым акцентом */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.4);
    --shadow: 0 4px 14px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.35);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.55), 0 4px 10px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.65), 0 8px 16px rgba(0,0,0,0.45);
}

/* Wordmark в тёмной теме — белый chisto, жёлтая шава */
html[data-theme="dark"] .brand-wordmark { color: #F0F0F2; }
html[data-theme="dark"] .brand-wordmark .chisto { color: #F0F0F2; }
html[data-theme="dark"] .brand-wordmark.light .chisto { color: #F0F0F2; }

/* Sidebar в тёмной теме — глубокий чёрный с жёлтой подсветкой active */
html[data-theme="dark"] .sidebar { background: #0E0E12; border-right-color: #1F1F27; }
html[data-theme="dark"] .sidebar-footer { background: #0E0E12; }
html[data-theme="dark"] .sidebar-section-title { color: #6B6B75; }
html[data-theme="dark"] .nav-item { color: #C4C4CC; }
html[data-theme="dark"] .nav-item:hover { background: #1A1A22; color: #F5F5F7; }
html[data-theme="dark"] .nav-item.active {
    background: linear-gradient(135deg, rgba(245,197,24,0.15) 0%, rgba(245,197,24,0.05) 100%);
    color: #F5C518;
    border-color: rgba(245,197,24,0.25);
}

/* User card в footer */
html[data-theme="dark"] .user-card { background: #1A1A22; border-color: #2A2A33; }

/* Карточки */
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card {
    background: var(--surface);
    border-color: var(--border);
}
html[data-theme="dark"] .stat-card:hover {
    background: var(--surface-hover);
}

/* Inputs — белый текст на тёмном фоне */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #1C1C24;
    color: #F0F0F2;
    border-color: #2A2A33;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus {
    border-color: var(--brand-yellow);
    box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}
html[data-theme="dark"] input::placeholder { color: #6B6B75; }

/* Таблицы */
html[data-theme="dark"] .table thead th {
    background: #1A1A22;
    color: #C4C4CC;
    border-bottom-color: #2A2A33;
}
html[data-theme="dark"] .table tbody tr { border-bottom-color: #1F1F27; }
html[data-theme="dark"] .table tbody tr:hover { background: #1C1C24; }
html[data-theme="dark"] .table tbody td { color: #E0E0E5; }

/* Бэйджи — adapt для тёмного фона */
html[data-theme="dark"] .badge { background: #2A2A33; color: #C4C4CC; }
html[data-theme="dark"] .badge-info { background: #0E2A28; color: #5BD5C8; }
html[data-theme="dark"] .badge-warning { background: #2D1F08; color: #F5C518; }
html[data-theme="dark"] .badge-primary { background: rgba(245,197,24,0.15); color: #F5C518; }
html[data-theme="dark"] .badge-danger { background: #2D0E14; color: #F87280; }

/* Алерты */
html[data-theme="dark"] .alert-success { background: #0A2D1F; color: #6EE7B7; border-color: #1A4A35; }
html[data-theme="dark"] .alert-danger { background: #2D0E14; color: #F87280; border-color: #4A1822; }
html[data-theme="dark"] .alert-warning { background: #2D1F08; color: #F5C518; border-color: #4A3A12; }
html[data-theme="dark"] .alert-info { background: #0E2A28; color: #5BD5C8; border-color: #1A4A45; }

/* Welcome card */
html[data-theme="dark"] .welcome-card {
    background: linear-gradient(135deg, #050507 0%, #16161B 100%);
}

/* Empty state */
html[data-theme="dark"] .empty-state { color: #6B6B75; }

/* Spacer/divider */
html[data-theme="dark"] hr.divider { background: #1F1F27; }

/* Code blocks (если есть) */
html[data-theme="dark"] code, html[data-theme="dark"] pre {
    background: #16161B; color: #E0E0E5; border-color: #2A2A33;
}

/* Buttons — outline вариант на тёмном фоне */
html[data-theme="dark"] .btn { background: #1C1C24; color: #E0E0E5; border-color: #2A2A33; }
html[data-theme="dark"] .btn:hover { background: #232330; color: #F5F5F7; }
html[data-theme="dark"] .btn-primary { background: var(--brand-yellow); color: #0F0F12; border-color: var(--brand-yellow); }
html[data-theme="dark"] .btn-primary:hover { background: var(--brand-yellow-deep); }
html[data-theme="dark"] .btn-orange { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); }

/* Кнопка переключения темы */
.theme-toggle {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--t-fast);
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--brand-yellow);
}
.theme-toggle .ic { width: 16px; height: 16px; }
html[data-theme="dark"] .theme-toggle { background: #1C1C24; color: #F5C518; border-color: #2A2A33; }
html[data-theme="dark"] .theme-toggle:hover { background: #232330; }

/* Иконки луны/солнца (показываем только нужную) */
.theme-toggle .moon { display: inline-flex; }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: inline-flex; }

/* Скроллбары для тёмной темы */
html[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #0E0E12; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2A2A33; border-radius: 8px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #383844; }

/* ============================================================================
   🔆 Гиро-переключатель темы — канонический Гиро (PNG ассеты бренда)
   ============================================================================ */
.giro-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 56px;
    height: 56px;
    background: transparent !important;
    border: none !important;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s var(--ease-spring);
    overflow: visible;
}
.giro-toggle:hover {
    transform: translateY(-2px) rotate(-3deg) scale(1.05);
    background: transparent !important;
}
.giro-toggle:active {
    transform: scale(0.94);
}
.giro-toggle picture,
.giro-toggle img {
    width: 56px;
    height: 56px;
    display: block;
    object-fit: contain;
    pointer-events: none;
}
.giro-toggle .giro-day { display: inline-flex; }
.giro-toggle .giro-night { display: none; }
html[data-theme="dark"] .giro-toggle .giro-day { display: none; }
html[data-theme="dark"] .giro-toggle .giro-night { display: inline-flex; }

/* Свечение вокруг ночного Гиро (от лампы) — сильнее, чтобы был хорошо виден на тёмном фоне */
html[data-theme="dark"] .giro-toggle .giro-night img {
    filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.65))
            drop-shadow(0 0 18px rgba(255, 180, 60, 0.35));
    animation: giro-lamp-flicker 4s ease-in-out infinite;
}
@keyframes giro-lamp-flicker {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.65))
                drop-shadow(0 0 18px rgba(255, 180, 60, 0.35));
    }
    50% {
        filter: drop-shadow(0 0 14px rgba(255, 220, 100, 0.85))
                drop-shadow(0 0 26px rgba(255, 180, 60, 0.55));
    }
}

/* Sidebar-brand становится позиционным контейнером */
.sidebar-brand { position: relative; }

/* Туллтип День / Ночь */
.giro-toggle::after {
    content: День;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 2px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}
html[data-theme="dark"] .giro-toggle::after { content: Ночь; color: #F5C518; }
.giro-toggle:hover::after { opacity: 1; }

/* === Контраст в тёмной теме: пастельные плашки → приглушённо-тёплые === */
/* Иконки stat-card: фоны слегка приглушаем, чтобы не били в глаза на тёмном; */
/* иконку рисуем в ярком брендовом цвете (читаемо). */
html[data-theme="dark"] .stat-icon-yellow {
    background: rgba(245,197,24,0.16);
    color: #F5C518;
}
html[data-theme="dark"] .stat-icon-red {
    background: rgba(192,54,44,0.18);
    color: #F87280;
}
html[data-theme="dark"] .stat-icon-teal {
    background: rgba(43,168,158,0.18);
    color: #5BD5C8;
}
html[data-theme="dark"] .stat-icon-orange {
    background: rgba(232,118,42,0.18);
    color: #FFA56B;
}
/* CRITICAL fix: stat-icon-success раньше был невидим (тёмно-зелёный иконка на тёмно-зелёном фоне) */
html[data-theme="dark"] .stat-icon-success {
    background: rgba(16,185,129,0.18);
    color: #6EE7B7;
}

/* Текст-заглушки и муты: чуть выше контраст, чтобы читались на чёрном */
html[data-theme="dark"] .page-subtitle { color: #A0A0AA; }
html[data-theme="dark"] .stat-label { color: #9A9AA4; }
html[data-theme="dark"] .empty-state { color: #8B8B95; }
html[data-theme="dark"] .empty-icon { opacity: 0.4; }

/* Search bar в тёмной теме */
html[data-theme="dark"] .search-bar input,
html[data-theme="dark"] .search-bar { background: #1C1C24; }

/* Tooltip-карточка (.card warm hint) — фон #FFFAEC слишком светлый на тёмном; делаем тёмно-янтарный */
html[data-theme="dark"] .card[style*="FFFAEC"],
html[data-theme="dark"] .card[style*="background:#FFFAEC"],
html[data-theme="dark"] .card[style*="background: #FFFAEC"] {
    background: #2D1F08 !important;
    border-color: #4A3A12 !important;
    color: #E0C46A;
}

/* Hover на строке таблицы — мягкий, не белёсый */
html[data-theme="dark"] .table tbody tr[onclick]:hover { background: #1F1F2A; }

/* Бейдж .badge-info на инверсии (раньше был светло-теал на белом — на тёмном уже переопределили #0E2A28) */
/* Бейджи стрипных ролей (если есть) */
html[data-theme="dark"] .badge-secondary { background: #232330; color: #C4C4CC; }

/* Кнопки выделения active в подменю/табах */
html[data-theme="dark"] .btn.active,
html[data-theme="dark"] .nav-tab.active {
    background: rgba(245,197,24,0.15);
    color: #F5C518;
    border-color: rgba(245,197,24,0.3);
}

/* Файловый input в тёмной теме (загрузка фото/договора) */
html[data-theme="dark"] input[type="file"] {
    background: #1C1C24;
    color: #C4C4CC;
}
html[data-theme="dark"] input[type="file"]::file-selector-button {
    background: #2A2A33;
    color: #F0F0F2;
    border: 1px solid #3A3A44;
}

/* === Перебивка inline-пастелей в тёмной теме ===
   Многие шаблоны используют style="background:#FEE2E2;color:#991B1B" и т.п.
   Эти inline-стили выигрывают по специфичности у обычных CSS-правил, поэтому
   ловим их через [style*="..."] + !important. Ручное редактирование шаблонов
   не требуется. */

/* Светло-розовый → тёмно-бордовый (danger) */
html[data-theme="dark"] [style*="#FEE2E2"] {
    background: rgba(192,54,44,0.18) !important;
    color: #F87280 !important;
}
html[data-theme="dark"] [style*="#991B1B"] {
    color: #F87280 !important;
}

/* Светло-синий → тёмно-синий (info) */
html[data-theme="dark"] [style*="#DBEAFE"] {
    background: rgba(59,130,246,0.18) !important;
    color: #93C5FD !important;
}
html[data-theme="dark"] [style*="#1E40AF"] {
    color: #93C5FD !important;
}

/* Светло-жёлтый → тёмно-янтарный (warning) */
html[data-theme="dark"] [style*="#FEF3C7"] {
    background: rgba(245,197,24,0.16) !important;
    color: #F5C518 !important;
}
html[data-theme="dark"] [style*="#92400E"] {
    color: #F5C518 !important;
}

/* Светло-зелёный → тёмно-зелёный (success) */
html[data-theme="dark"] [style*="#D1FAE5"] {
    background: rgba(16,185,129,0.18) !important;
    color: #6EE7B7 !important;
}
html[data-theme="dark"] [style*="#065F46"] {
    color: #6EE7B7 !important;
}

/* Светло-серый footer-фон → тёмно-серый */
html[data-theme="dark"] [style*="#F9FAFB"] {
    background: #1F1F2A !important;
    color: #E0E0E5 !important;
}

/* Класс для итогового ряда таблицы (заменяет inline в новых шаблонах) */
.table-footer-total { background: #F9FAFB; font-weight: 600; }
/* Числовые столбцы в таблице ведомости — равноширинные цифры, выравнивание вправо */
.table .num-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 92px;
}
.table thead th.num-col { font-weight: 600; }

html[data-theme="dark"] .table-footer-total { background: #1F1F2A; }

/* ============================================================
 *  INV TEMPLATES COMPAT — старые классы инвесторских страниц,
 *  переопределены под светлую админ-тему.
 * ============================================================ */
.inv-page { /* обёртка больше не накладывает тёмную тему */
    color: var(--text);
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 18px 0 6px 0;
}
.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Filter bar — стилизуем как ряд .btn */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 8px 0 14px 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.filter-btn:hover { background: var(--bg-warm); }
.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--brand-black, #0F0F12);
    font-weight: 600;
}

/* Stats grid — auto-fit как .cards в админке */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Цветовые акценты значений */
.stat-value.gold,
.stat-value .gold,
.gold { color: #A07A00; font-weight: 600; }
.stat-value.green,
.green { color: #1F7E76; font-weight: 600; }
.stat-value.red,
.red { color: #C0362C; font-weight: 600; }

/* btn-outline → как .btn */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg-warm); }
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 12px;
}
.btn-back:hover { background: var(--bg-warm); color: var(--text); }
.btn-full { width: 100%; justify-content: center; }

/* Inv-item card — отступ + светлый фон */
.card.inv-item {
    background: #fff;
    border: 1px solid var(--border);
}

/* Таблицы инвесторских отчётов */
.table-footer-total td {
    border-top: 2px solid var(--border);
    font-weight: 700;
}

/* Form элементы */
.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
}
