/* Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Основные цвета */
    --primary-color: #0B1F3B;
    --secondary-color: #1FB6AA;
    --accent-color: #667eea;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;
    
    /* Светлая тема */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-sidebar: #0B1F3B;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Размеры */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 50px;
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

/* Темная тема */
[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #0F172A;
    --bg-sidebar: #101A2E;
    --text-primary: #E5E7EB;
    --text-secondary: #9CA3AF;
    --border-color: #243044;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
    line-height: 1.6;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 13px;
}

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

/* Сайдбар */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 24px 10px;
    grid-template-columns: 1fr;
    justify-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.sidebar.collapsed .logo {
    justify-content: center;
    width: 100%;
}

.logo i {
    font-size: 24px;
    color: var(--secondary-color);
}

.logo-text {
    transition: var(--transition);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-subtitle {
    display: none;
}

.logo-subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

.server-status-header {
    grid-column: 1 / 2;
    justify-content: flex-start;
    margin-top: 6px;
}

.sidebar-toggle {
    grid-column: 2 / 3;
    justify-self: end;
}

.sidebar.collapsed .sidebar-toggle {
    grid-column: 1 / -1;
    justify-self: center;
}

.sidebar.collapsed .server-status-header {
    justify-content: center;
    grid-column: 1 / -1;
    margin-top: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition);
    padding: 8px;
    border-radius: 6px;
}

.sidebar.collapsed .sidebar-toggle {
    padding: 10px;
}

.sidebar-toggle:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
    overflow-y: auto;
}

.user-info {
    padding: 0 20px 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
    text-transform: capitalize;
}

.sidebar.collapsed .user-details {
    display: none;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px 11px 20px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

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

.nav-link.active {
    background: rgba(31, 182, 170, 0.18);
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
    font-weight: 600;
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    transition: var(--transition);
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 11px;
    border-left-color: transparent;
}

.sidebar.collapsed .nav-link.active {
    border-left-color: transparent;
    border-bottom: 2px solid var(--secondary-color);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.server-status {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    justify-content: center;
}

.server-status .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--warning-color);
}

.sidebar.collapsed .server-label {
    display: none;
}

.sidebar.collapsed .server-status {
    justify-content: center;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.sidebar.collapsed .logout-btn span {
    display: none;
}

.sidebar.collapsed .logout-btn {
    justify-content: center;
    padding: 12px;
}

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

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

.main-header {
    height: 58px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.system-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.system-status-badge .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.1;
}


.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
    position: relative;
}

.header-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.notification-badge.hidden {
    display: none;
}

/* Контент */
.content-area {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
}

.content-area > *:first-child {
    margin-top: 0;
}

/* Дашборд */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: rgba(102, 126, 234, 0.3);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.users { background: rgba(59, 130, 246, 0.1); color: var(--info-color); }
.stat-icon.companies { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; }
.stat-icon.agents { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.stat-icon.activity { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.stat-icon.sales { background: rgba(59, 130, 246, 0.12); color: var(--info-color); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
    line-height: 1.05;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.35px;
    font-weight: 500;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    margin-top: 4px;
}

.stat-change.status {
    color: var(--text-secondary);
}

.stat-change .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.ok {
    background: var(--success-color);
}

.status-dot.warn {
    background: var(--warning-color);
}

.status-dot.error {
    background: var(--danger-color);
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* Таблицы */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 24px;
}

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

.table-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filters .form-input,
.filters .form-select {
    min-width: 180px;
}

.filter-bar {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.role-filter-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 16px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
}

.role-filter-tab {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.role-filter-tab:hover {
    color: var(--text-primary);
    background: rgba(31, 182, 170, 0.08);
}

.role-filter-tab.active {
    color: var(--secondary-color);
    background: rgba(31, 182, 170, 0.12);
    box-shadow: inset 0 0 0 1px rgba(31, 182, 170, 0.12);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.filter-actions.inline {
    justify-content: flex-start;
}

.promo-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sales-actions {
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
}

.sales-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-input {
    flex: 1 1 160px;
    max-width: 220px;
    min-width: 140px;
}

@media (max-width: 900px) {
    .sales-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-actions {
        justify-content: flex-start;
    }
    .filter-input {
        max-width: none;
        flex: 1 1 100%;
    }
}

@media (max-width: 1024px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions {
        justify-content: flex-start;
    }
}

.table-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.page-indicator {
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

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

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table th {
    text-align: left;
    padding: 12px 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.55px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
}

.table tr:hover {
    background: var(--bg-secondary);
}

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

#sales-table {
    width: 100%;
    /* table-layout: auto — колонки растут пропорционально,
       min-width задаёт нижнюю границу для каждой */
}

/* Покупатель — много текста, приоритет */
#sales-table th:nth-child(1),
#sales-table td:nth-child(1) { width: 20%; min-width: 150px; }

/* Агент */
#sales-table th:nth-child(2),
#sales-table td:nth-child(2) { width: 15%; min-width: 110px; }

/* Компания — шире за счёт Статуса и Распределения */
#sales-table th:nth-child(3),
#sales-table td:nth-child(3) { width: 17%; min-width: 120px; }

/* Тип / Срок */
#sales-table th:nth-child(4),
#sales-table td:nth-child(4) { width: 14%; min-width: 110px; }

/* Статус — только бейдж, узко */
#sales-table th:nth-child(5),
#sales-table td:nth-child(5) { width: 6%; min-width: 72px; text-align: center; }

/* Сумма — число, right-align */
#sales-table th:nth-child(6),
#sales-table td:nth-child(6) { width: 8%; min-width: 68px; text-align: right; }

/* Распределение — компактно, прижато вправо */
#sales-table th:nth-child(7),
#sales-table td:nth-child(7) { width: 20%; min-width: 150px; text-align: right; }

#sales-table th,
#sales-table td {
    padding: 10px 12px;
    overflow: hidden;
}

/* ── Покупатель ── */
.sale-customer__name {
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.3;
    color: var(--text-primary);
}

.sale-customer__contact {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 3px;
}

.sale-customer__contact span {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* ── Агент ── */
.sale-agent-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ── Компания ── */
.sale-company-name {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ── Тип / Срок ── */
.sale-type strong {
    font-size: 13px;
    font-weight: 600;
}

.sale-type small {
    font-size: 11.5px;
    margin-top: 2px;
    display: block;
}

/* ── Сумма ── */
.sale-amount strong {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
}

/* ── Распределение ── */
.sales-distribution-cell {
    vertical-align: middle;
}

.sale-distribution {
    display: inline-flex;       /* ширина по содержимому */
    flex-direction: column;
    align-items: flex-end;      /* строки прижаты вправо */
    gap: 3px;
    margin-left: auto;          /* блок у правого края ячейки */
}

.sale-distribution__row {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
}

.sale-distribution__row--main {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-pending {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-color);
}

.status-expired {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

.status-canceled {
    background: rgba(251, 113, 133, 0.12);
    color: #be3455;
}

.status-revoked {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    margin-bottom: 6px;
}

.admin-name {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.request-type-badge {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.requests-page {
    display: grid;
    gap: 14px;
}

.requests-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 220px auto auto;
    gap: 10px;
    padding: 0 24px;
}

.requests-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 0 24px;
}

.requests-stat-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.requests-stat-card span {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.requests-stat-card strong {
    font-size: 22px;
    line-height: 1.1;
    color: var(--text-primary);
}

.request-note-trigger {
    white-space: nowrap;
}

.request-note-modal__textarea {
    width: 100%;
    min-height: 130px;
    resize: vertical;
}

#requests-table {
    min-width: 1200px;
}

#requests-table th,
#requests-table td {
    vertical-align: top;
}

#requests-table th:nth-child(1),
#requests-table td:nth-child(1) {
    min-width: 110px;
}

#requests-table th:nth-child(2),
#requests-table td:nth-child(2) {
    min-width: 320px;
}

#requests-table th:nth-child(3),
#requests-table td:nth-child(3) {
    min-width: 130px;
    white-space: nowrap;
}

#requests-table th:nth-child(4),
#requests-table td:nth-child(4) {
    min-width: 130px;
    white-space: nowrap;
}

#requests-table th:nth-child(5),
#requests-table td:nth-child(5) {
    min-width: 130px;
    white-space: nowrap;
}

#requests-table th:nth-child(6),
#requests-table td:nth-child(6) {
    min-width: 140px;
    white-space: nowrap;
}

#requests-table th:nth-child(7),
#requests-table td:nth-child(7) {
    min-width: 160px;
    white-space: nowrap;
}

#requests-table th:nth-child(8),
#requests-table td:nth-child(8) {
    min-width: 160px;
    white-space: nowrap;
}

.request-row {
    cursor: pointer;
}

.request-row:hover {
    background: var(--bg-secondary);
}

.request-date-cell {
    white-space: nowrap;
}

.request-approve-modal {
    display: grid;
    gap: 16px;
}

.request-summary-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fc 100%);
}

.request-summary-card__main {
    min-width: 0;
}

.request-summary-card__eyebrow {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.request-summary-card__title {
    margin: 0;
    font-size: 28px;
    line-height: 1.08;
    font-weight: 800;
    color: var(--text-primary);
}

.request-summary-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.request-summary-card__meta span:not(:last-child)::after {
    content: "•";
    margin-left: 10px;
    color: rgba(109, 115, 129, 0.72);
}

.request-status-note {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
}

.request-status-note--approved {
    background: rgba(31, 182, 170, 0.08);
    border-color: rgba(31, 182, 170, 0.18);
    color: #0f766e;
}

.request-status-note--rejected {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.16);
    color: #b42318;
}

.request-approve-dialog {
    max-width: 1280px;
    width: min(1280px, 96vw);
    max-height: 92vh;
}

.request-approve-dialog .modal-body {
    overflow: hidden;
    min-height: 0;
}

.request-approve-dialog .modal-footer {
    flex-shrink: 0;
}

.request-approve-dialog .request-approve-modal {
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
    overscroll-behavior: contain;
}

.request-approve-section {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-secondary);
}

.request-approve-section h4 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.request-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.request-detail-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.request-detail-block {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    margin-top: 10px;
}

.request-decision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.request-admin-agent-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin: 2px 0 2px;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .requests-toolbar {
        grid-template-columns: 1fr;
    }

    .requests-stats {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .request-detail-grid {
        grid-template-columns: 1fr;
    }

    .request-decision-grid {
        grid-template-columns: 1fr;
    }

    .request-summary-card {
        flex-direction: column;
        align-items: stretch;
    }

    .request-summary-card__title {
        font-size: 22px;
    }
}

/* Профиль */
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
}

.profile-page {
    display: flex;
    justify-content: center;
    padding: 4px 0 24px;
}

.profile-card {
    width: 100%;
    max-width: 980px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 32px;
}

.profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-identity h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.profile-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-actions .btn {
    white-space: nowrap;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.profile-section h4 {
    margin-bottom: 16px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-field:last-child {
    border-bottom: none;
}

.field-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.field-value {
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
}

@media (max-width: 768px) {
    .profile-card {
        padding: 20px;
    }

    .profile-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.action-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-btn.action-btn--danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.action-btn.action-btn--success:hover {
    background: var(--success-color);
    border-color: var(--success-color);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Формы */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    appearance: auto;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.settings-header {
    margin-bottom: 16px;
}

.settings-panel .form-row {
    grid-template-columns: minmax(240px, 360px);
}

.input-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.input-actions .form-input {
    flex: 1 1 240px;
    min-width: 220px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.documents-upload-panel {
    margin: 16px 24px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.documents-upload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.documents-upload-head h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.documents-upload-head p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.documents-upload-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
}

.documents-upload-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 10px 12px;
}

.documents-upload-grid .form-group {
    margin-bottom: 0;
}

.documents-upload-grid .form-label {
    font-size: 12px;
    margin-bottom: 6px;
}

.documents-upload-grid .form-input {
    min-height: 42px;
}

.documents-upload-description {
    grid-column: 1 / -1;
}

.documents-upload-description .form-input {
    min-height: 76px;
}

.documents-upload-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.documents-file-meta {
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-primary);
    max-width: 620px;
    flex: 1 1 520px;
}

.documents-file-meta-main {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.documents-file-meta i {
    font-size: 16px;
    color: var(--primary-color);
    opacity: 0.9;
}

.documents-file-meta-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.documents-file-meta-text strong {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.documents-file-meta-text span {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.2;
}

.documents-file-meta-empty {
    color: var(--text-secondary);
}

.documents-file-meta-empty i {
    color: var(--text-secondary);
}

.documents-file-pick-btn {
    flex: 0 0 auto;
}

.documents-upload-toggle-inline {
    flex: 0 0 auto;
}

#docSaveBtn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

#docSaveBtn {
    min-height: 44px;
    min-width: 154px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 700;
}

.text-muted.small {
    font-size: 12px;
}

@media (max-width: 1100px) {
    .documents-upload-grid {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
    }
}

@media (max-width: 700px) {
    .documents-upload-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .documents-upload-grid {
        grid-template-columns: 1fr;
    }

    .documents-file-meta {
        max-width: 100%;
        flex-basis: 100%;
    }

    .documents-upload-toggle-inline {
        order: 3;
        flex-basis: 100%;
    }

    #docSaveBtn {
        order: 2;
    }

    .documents-upload-actions {
        justify-content: stretch;
    }

    .documents-file-meta {
        max-width: 100%;
        flex-basis: 100%;
    }

    .documents-upload-actions .btn {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
    }
}

.ios-settings {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ios-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
}

.ios-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.ios-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.ios-switch input {
    display: none;
}

.ios-slider {
    width: 46px;
    height: 26px;
    background: #cbd5f1;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s ease;
}

.ios-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}

.ios-switch input:checked + .ios-slider {
    background: var(--secondary-color);
}

.ios-switch input:checked + .ios-slider::before {
    transform: translateX(20px);
}

.ios-state {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

.telegram-accounts {
    margin-top: 18px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

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

.telegram-list {
    display: grid;
    gap: 10px;
}

.telegram-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.telegram-meta {
    display: grid;
    gap: 4px;
}

.telegram-name {
    font-weight: 600;
    color: var(--text-primary);
}

.telegram-caption {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.hidden {
    display: none;
}

.modal-container {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1001;
}

.modal-container.visible {
    display: flex;
}

.modal-open {
    overflow: hidden;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal--xl {
    max-width: 1180px;
    width: min(1180px, 96vw);
}

.kb-editor-modal {
    overflow: hidden;
    max-height: min(92vh, 980px);
}

.company-modal {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.company-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.user-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.user-card .user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 20px;
}

.user-card .user-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-card .user-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-card .user-status {
    margin-left: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.user-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.user-card-stack {
    grid-template-columns: 1fr;
}

.report-card {
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.report-header h4 {
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.report-period-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

.report-period-nav #report-period {
    margin: 0;
    min-width: 0;
    text-transform: lowercase;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}

.report-period-nav__button {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.report-period-nav__button:hover:not(:disabled) {
    background: #eef6f5;
    border-color: rgba(31, 182, 170, 0.28);
    color: var(--secondary-color);
    transform: translateY(-1px);
}

.report-period-nav__button:disabled {
    opacity: 0.45;
    cursor: default;
}

.report-chart {
    min-height: 260px;
}

.report-day-details {
    margin-top: 22px;
    border-top: 1px solid var(--border-color);
    padding-top: 18px;
}

.report-day-details__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.report-day-details__header h5 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.report-day-details__header p,
.report-day-details__empty {
    color: var(--text-secondary);
    font-size: 14px;
}

.report-day-sales {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-day-sale {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    padding: 14px 16px;
}

.report-day-sale__main {
    min-width: 0;
}

.report-day-sale__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.report-day-sale__meta,
.report-day-sale__time {
    font-size: 13px;
    color: var(--text-secondary);
}

.report-day-sale__side {
    text-align: right;
    flex-shrink: 0;
}

.report-day-sale__amount {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
    gap: 10px;
    align-items: stretch;
    min-height: 238px;
    padding-top: 26px;
}

.chart-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}
.bar-track-shell {
    --bar-track-height: 168px;
    --bar-highlight-top: 12px;
    --bar-highlight-bottom: 14px;
    position: relative;
    width: 100%;
}

.bar-track-shell::after {
    content: "";
    position: absolute;
    top: calc(var(--bar-highlight-top) * -1);
    right: -6px;
    bottom: calc(var(--bar-highlight-bottom) * -1);
    left: -6px;
    border-radius: 28px;
    background: transparent;
    transition: background 0.18s ease, transform 0.18s ease;
    z-index: 0;
}
.chart-bar > * { position: relative; z-index: 1; }
.chart-bar:hover .bar-track-shell::after {
    background: linear-gradient(180deg, rgba(31, 182, 170, 0.08), rgba(11, 31, 59, 0.05));
    transform: scaleY(1.02);
}

.chart-bar.is-hovered .bar-track-shell::after,
.chart-bar.is-selected .bar-track-shell::after {
    background: linear-gradient(180deg, rgba(11, 31, 59, 0.07), rgba(31, 182, 170, 0.14));
}

.bar-track {
    width: 100%;
    height: var(--bar-track-height);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, #eef2f7 100%);
    border-radius: 999px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.05),
        inset 0 14px 24px rgba(255, 255, 255, 0.35);
}

.bar-fill {
    width: 100%;
    position: relative;
    background: linear-gradient(180deg, #56ddd5 0%, #2cbab3 58%, #1fb6aa 100%);
    border-radius: 999px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, filter 0.18s ease;
    box-shadow:
        0 14px 28px rgba(31, 182, 170, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.bar-fill::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 42%;
    height: 10px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}
.chart-bar:hover .bar-fill {
    background: linear-gradient(180deg, #25497c 0%, #153562 45%, var(--primary-color) 100%);
    box-shadow:
        0 18px 30px rgba(11, 31, 59, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform: translateY(-2px) scaleX(1.06);
    filter: saturate(1.05);
}

.chart-bar.is-hovered .bar-fill,
.chart-bar.is-selected .bar-fill {
    background: linear-gradient(180deg, #25497c 0%, #153562 45%, var(--primary-color) 100%);
    box-shadow:
        0 18px 30px rgba(11, 31, 59, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform: translateY(-2px) scaleX(1.06);
}

.bar-value {
    display: none;
}

.bar-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 8px;
}

.bar-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 0);
    background: var(--text-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 10px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 10px 20px rgba(11, 31, 59, 0.18);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.chart-bar:hover .bar-tooltip {
    opacity: 1;
    transform: translate(-50%, -4px);
}

.chart-bar.is-hovered .bar-tooltip,
.chart-bar.is-selected .bar-tooltip {
    opacity: 1;
    transform: translate(-50%, -4px);
}

.company-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.company-invite {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.invite-row .form-input {
    flex: 1;
}

.invite-row .btn {
    white-space: nowrap;
}

.company-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.company-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.company-value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.company-section h4 {
    margin-bottom: 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.company-admins {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.admin-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-email {
    font-weight: 600;
    font-size: 14px;
}

.admin-role {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    min-width: 0;
    flex: 1;
}

.kb-modal-title-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
    outline: none;
}

.kb-modal-title-input::placeholder {
    color: #98a2b3;
    opacity: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: var(--transition);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.modal-body {
    padding: 20px 24px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.kb-editor-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 22px;
    min-height: 64vh;
    height: 100%;
    align-items: start;
    flex: 1;
    min-height: 0;
}

.kb-editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 4px;
}

.kb-editor-panel {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    background: linear-gradient(180deg, #fbfcfe 0%, #f7f9fc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.kb-editor-panel__title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.kb-editor-main {
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: #fff;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    max-height: 100%;
    min-height: 0;
}

.kb-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 248, 252, 0.98) 100%);
    position: sticky;
    top: 0;
    z-index: 2;
}

.kb-editor-toolbar__btn {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    border-radius: 12px;
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.kb-editor-toolbar__btn:hover {
    background: rgba(31, 182, 170, 0.08);
    border-color: rgba(31, 182, 170, 0.24);
    transform: translateY(-1px);
}

.kb-editor-surface {
    flex: 1;
    min-height: 420px;
    padding: 28px 30px;
    outline: none;
    overflow-y: auto;
    min-height: 0;
    font-size: 16px;
    line-height: 1.72;
    color: var(--text-primary);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 251, 253, 0.98) 100%);
}

.kb-editor-surface:empty::before {
    content: attr(data-placeholder);
    color: #9aa4b2;
}

.kb-editor-surface h2,
.kb-editor-surface h3 {
    color: var(--primary-color);
    line-height: 1.3;
    margin: 20px 0 10px;
}

.kb-editor-surface h2 {
    font-size: 28px;
}

.kb-editor-surface h3 {
    font-size: 22px;
}

.kb-editor-surface p {
    margin: 0 0 12px;
}

.kb-editor-surface ul,
.kb-editor-surface ol {
    margin: 0 0 14px 22px;
    list-style-position: outside;
    padding-left: 18px;
}

.kb-editor-surface ul {
    list-style-type: disc;
}

.kb-editor-surface ol {
    list-style-type: decimal;
}

.kb-editor-surface li + li {
    margin-top: 6px;
}

.kb-editor-hint {
    padding: 12px 18px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    background: rgba(248, 250, 252, 0.9);
}

@media (max-width: 980px) {
    .modal--xl {
        width: min(96vw, 96vw);
    }

    .kb-editor-layout {
        grid-template-columns: 1fr;
        min-height: auto;
        height: auto;
    }

    .modal-body {
        padding: 16px 18px;
        overflow-y: auto;
    }

    .kb-editor-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .kb-editor-main {
        max-height: none;
    }

    .kb-editor-surface {
        min-height: 320px;
        padding: 22px 20px;
    }
}

/* Уведомления */
.notifications-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    min-width: 280px;
}

.notification {
    padding: 14px 16px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.25s ease;
    transform: translateX(0);
    transition: transform 0.25s ease, opacity 0.25s ease;
    font-size: 14px;
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.hiding {
    transform: translateX(100%);
    opacity: 0;
}

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

.notification.error {
    background: var(--danger-color);
    color: white;
}

.notification.warning {
    background: var(--warning-color);
    color: white;
}

.notification.info {
    background: var(--info-color);
    color: white;
}

.notification-icon {
    font-size: 20px;
}

.notification-content {
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.8;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

/* Лоадер */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(17, 24, 39, 0.9);
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.kb-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    padding: 20px;
    align-items: start;
    background: linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
}

.kb-column {
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: #fbfcfe;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.kb-column__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.kb-column__header h4 {
    margin: 0;
    font-size: 1.15rem;
}

.kb-column__header p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.kb-column__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(31, 182, 170, 0.10);
    color: var(--secondary-color);
    font-weight: 700;
}

.kb-sort-list {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.kb-sort-list.drag-over {
    background: rgba(31, 182, 170, 0.05);
    box-shadow: inset 0 0 0 2px rgba(31, 182, 170, 0.12);
}

.kb-article-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #fff;
    padding: 14px 16px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
    cursor: grab;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.kb-article-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    border-color: rgba(31, 182, 170, 0.24);
}

.kb-article-card.dragging {
    opacity: 0.55;
    transform: scale(0.985);
    cursor: grabbing;
}

.kb-article-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kb-article-card__title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.kb-article-card__text {
    min-width: 0;
}

.kb-article-card__drag {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f4f7fb;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kb-article-card__title {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.35;
}

.kb-article-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.35;
}

.kb-article-card__actions {
    display: flex;
    margin-top: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.kb-empty {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    background: #fff;
}

.kb-empty i {
    font-size: 1.4rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .table-actions {
        justify-content: flex-end;
    }
    
    .table {
        display: block;
        overflow-x: auto;
    }

    .kb-board {
        grid-template-columns: 1fr;
    }
}

/* Утилиты */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.p-4 {
    padding: 16px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state.compact {
    padding: 18px;
}

.empty-state.compact i {
    font-size: 28px;
    margin-bottom: 8px;
}

.loading-row {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== НЕДОСТАЮЩИЕ И ИСПРАВЛЕННЫЕ СТИЛИ ===== */

/* Заголовок дашборда */
.dashboard-header {
    margin-bottom: 4px;
}

.dashboard-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Role badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.role-badge.super_admin {
    background: rgba(102, 126, 234, 0.12);
    color: var(--accent-color);
}

.role-badge.company_admin {
    background: rgba(31, 182, 170, 0.12);
    color: var(--secondary-color);
}

.role-badge.agent {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
}

/* Detail item (в карточках просмотра) */
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-item label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.detail-item span {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

/* Referral link block */
.referral-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.referral-link span {
    flex: 1;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.referral-link .btn {
    flex-shrink: 0;
}

/* Кнопки — недостающие варианты */
.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* btn-small алиас */
.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* Иконка stat-card для системы */
.stat-icon.system {
    background: rgba(102, 126, 234, 0.1);
    color: var(--accent-color);
}

/* Группы навигации */
.nav-group {
    margin-top: 6px;
}

.nav-group-label {
    padding: 12px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: rgba(255, 255, 255, 0.38);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.nav-group-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar.collapsed .nav-group-label {
    display: none;
}

.sidebar.collapsed .nav-group {
    margin-top: 4px;
}

.nav-group-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Уменьшенный отступ form-group внутри модалок */
.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Закрытие модалки: иконка-кнопка */
.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: 6px;
}

/* Убираем лишний отступ у первого table-container на странице */
.content-area > .table-container:first-child,
.content-area > div:first-child > .table-container:first-child {
    margin-top: 0;
}

/* page-container — общий враппер для страниц без table */
.page-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Улучшенный чекбокс в форме */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
}

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

.form-checkbox-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Метка «обязательно» рядом с label */
.form-label .required {
    color: var(--danger-color);
    margin-left: 2px;
}

/* Hint под полем */
.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Пустое состояние внутри таблицы */
.table-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.table-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.4;
    display: block;
}

.table-empty p {
    font-size: 14px;
    margin-bottom: 12px;
}

/* Inline code / pre */
.code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
    max-height: 200px;
    overflow-y: auto;
}

/* Inline badge для суммы */
.amount-badge {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Кнопка «Обработать» в выплатах */
.btn-process {
    background: var(--accent-color);
    color: white;
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-process:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Форматирование сумм в таблице */
.amount {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Вспомогательные типографические классы */
.text-success { color: var(--success-color); }
.text-danger  { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info    { color: var(--info-color); }
.text-primary { color: var(--text-primary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.font-mono { font-family: 'Courier New', monospace; }
.mono { font-family: 'Courier New', monospace; font-size: 13px; }

/* Информационный баннер (ФНС-блокировки и другие страницы) */
.fns-info-banner {
    margin: 0 24px 0;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--warning-color);
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.5;
}

.fns-info-banner i {
    color: var(--warning-color);
    margin-top: 1px;
    flex-shrink: 0;
}

/* required star */
.required {
    color: var(--danger-color);
    margin-left: 2px;
}
