/* ═══════════════════════════════════════════════════════
   WB Analytics — Дизайн-система
   Тёплый, профессиональный интерфейс для продавцов
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Палитра */
    --purple-primary: #6C3AED;
    --purple-light: #8B5CF6;
    --purple-dark: #5B21B6;
    --purple-bg: #F5F3FF;
    
    --green-success: #059669;
    --green-light: #D1FAE5;
    --red-danger: #DC2626;
    --red-light: #FEE2E2;
    --orange-warning: #F59E0B;
    --orange-light: #FEF3C7;
    --blue-info: #2563EB;
    --blue-light: #DBEAFE;

    /* Нейтральные */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #E5E5E5;
    --gray-300: #D4D4D4;
    --gray-400: #A3A3A3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;

    /* Типографика */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Размеры */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
}

/* ─── Сброс ──────────────────────────────────────────── */

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

body {
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--purple-primary); text-decoration: none; }
a:hover { color: var(--purple-dark); }

/* ─── Макет ──────────────────────────────────────────── */

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--purple-light), #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-logo .badge {
    background: var(--purple-primary);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    padding: 0 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--gray-300);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: white;
}

.nav-link.active {
    background: var(--purple-primary);
    color: white;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ─── Основной контент ───────────────────────────────── */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.page-content {
    padding: 24px 32px;
    max-width: 1400px;
}

/* ─── Карточки метрик ────────────────────────────────── */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s;
}

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

.metric-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}

.metric-change {
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.metric-change.positive { color: var(--green-success); }
.metric-change.negative { color: var(--red-danger); }

/* ─── Таблицы ────────────────────────────────────────── */

.data-table-container {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 24px;
}

.data-table-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-table-title {
    font-size: 16px;
    font-weight: 600;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table .number {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 13px;
}

/* ─── Карточки секций ────────────────────────────────── */

.section-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-card-title {
    font-size: 16px;
    font-weight: 600;
}

.section-card-body {
    padding: 24px;
}

/* ─── Формы ──────────────────────────────────────────── */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-main);
    transition: border-color 0.15s, box-shadow 0.15s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(108, 58, 237, 0.1);
}

.form-input-mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23737373' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-main);
}

.btn-primary {
    background: var(--purple-primary);
    color: white;
}
.btn-primary:hover { background: var(--purple-dark); }

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-success {
    background: var(--green-success);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ─── Выбор периода ──────────────────────────────────── */

.date-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.date-filter input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-main);
}

.period-tabs {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.period-tab {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
}

.period-tab.active {
    background: white;
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
}

/* ─── Налоговая карточка ─────────────────────────────── */

.tax-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.tax-card.current {
    border-color: var(--purple-primary);
    background: var(--purple-bg);
}

.tax-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.tax-amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--red-danger);
    font-variant-numeric: tabular-nums;
}

.tax-details {
    margin-top: 12px;
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.8;
}

/* ─── Алерты ─────────────────────────────────────────── */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-error {
    background: var(--red-light);
    color: var(--red-danger);
    border: 1px solid #FECACA;
}

.alert-success {
    background: var(--green-light);
    color: var(--green-success);
    border: 1px solid #A7F3D0;
}

.alert-info {
    background: var(--blue-light);
    color: var(--blue-info);
    border: 1px solid #BFDBFE;
}

.alert-warning {
    background: var(--orange-light);
    color: #92400E;
    border: 1px solid #FDE68A;
}

/* ─── Адаптивность ───────────────────────────────────── */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 16px;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .metric-value {
        font-size: 22px;
    }
    .data-table-container {
        overflow-x: auto;
    }
    .date-filter {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ─── Страница авторизации ───────────────────────────── */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, #1E1B4B 100%);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 32px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--gray-500);
}

/* ─── Утилиты ────────────────────────────────────────── */

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--green-success); }
.text-danger { color: var(--red-danger); }
.font-mono { font-family: var(--font-mono); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
