:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Luxury Dark / Cyber Obsidian Theme (Default) */
    --bg-body: #07090e;
    --bg-surface: rgba(13, 17, 26, 0.88);
    --bg-card: rgba(13, 17, 26, 0.82);
    --bg-subtle: #0d121c;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);
    
    --text-main: #f1f5f9;
    --text-muted: #7b8ea5;
    --text-inverse: #07090e;
    
    /* Vibrant Electric Blue */
    --primary: #0052ff;
    --primary-hover: #1a66ff;
    --primary-light: rgba(0, 82, 255, 0.15);
    --primary-text: #60a5fa;
    --primary-glow: 0 0 25px rgba(0, 82, 255, 0.55);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --success-text: #34d399;
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --warning-text: #fbbf24;
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --danger-text: #f87171;
    
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.15);
    --info-text: #38bdf8;
    
    --sidebar-width: 250px;
    --header-height: 68px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
    --radius: 10px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-body: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --border-color: #e2e8f0;
    --border-subtle: #edf2f7;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    --primary: #0052ff;
    --primary-hover: #0045d8;
    --primary-light: #eff6ff;
    --primary-text: #1e40af;
    --primary-glow: 0 0 15px rgba(0, 82, 255, 0.3);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    position: relative;
}

/* Анимированные фоновые волны (Canvas) */
.bg-waves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

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

a:hover {
    color: var(--primary-hover);
}

/* Сайдбар */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(8, 11, 16, 0.94);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.brand-container {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.brand-text-block {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Навигационные ссылки (стиль из скриншота) */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #8fa0b5;
    font-size: 0.88rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: #f1f5f9;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.20) !important;
    border-radius: 8px;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.nav-link i {
    width: 18px;
    font-size: 0.95rem;
    text-align: center;
}


/* Основная рабочая область */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    position: relative;
    z-index: 10;
}

/* Шапка приложения */
.header {
    height: var(--header-height);
    background: rgba(9, 12, 18, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 82, 255, 0.16);
    border: 1px solid rgba(0, 82, 255, 0.35);
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.header-title-block {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.header-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
}

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


/* Неоновая кнопка "✦ Принять устройство" (стиль из скриншота) */
.btn-hero-electric {
    background: var(--primary) !important;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    padding: 9px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--primary-glow);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
}

.btn-hero-electric:hover {
    background: var(--primary-hover) !important;
    box-shadow: 0 0 32px rgba(0, 82, 255, 0.8);
    transform: translateY(-1px);
    color: #fff !important;
}

/* Основной контент */
.content-body {
    padding: 24px;
    flex: 1;
}

/* Карточки (Glassmorphic) */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

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

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.btn-outline {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.btn-success { background-color: var(--success); color: #fff; }
.btn-success:hover { background-color: #059669; color: #fff; }
.btn-danger { background-color: var(--danger); color: #fff; }
.btn-danger:hover { background-color: #dc2626; color: #fff; }

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Формы и поля ввода */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: #0a0d14;
    color: #f1f5f9;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.22);
}

textarea.form-control {
    resize: vertical;
}

/* Выпадающие списки (select) и темные опции */
select.form-control,
.form-control select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 34px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    cursor: pointer;
}

select option {
    background-color: #0d121c !important;
    color: #f8fafc !important;
    padding: 10px 14px !important;
}

select option:checked,
select option:hover {
    background-color: #1e293b !important;
    color: #38bdf8 !important;
}

/* Кастомные чекбоксы и радио */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--primary);
    cursor: pointer;
}

/* Таблицы */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.table th {
    padding: 12px 16px;
    background-color: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr {
    transition: background 0.12s ease;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.025);
}

/* Бейджи */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

.badge-primary { background-color: var(--primary-light); color: var(--primary-text); }
.badge-success { background-color: var(--success-light); color: var(--success-text); }
.badge-warning { background-color: var(--warning-light); color: var(--warning-text); }
.badge-danger { background-color: var(--danger-light); color: var(--danger-text); }
.badge-info { background-color: var(--info-light); color: var(--info-text); }
.badge-secondary { background-color: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* Алерты */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-success { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); color: #34d399; }
.alert-danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); color: #f87171; }
.alert-warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); color: #fbbf24; }
.alert-info { background: rgba(6, 182, 212, 0.12); border-color: rgba(6, 182, 212, 0.3); color: #38bdf8; }

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

/* Combobox (Searchable Select) */
.combobox-chevron {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.combobox-chevron:hover {
    color: var(--primary);
}

.combobox-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 250px;
    overflow-y: auto;
    background: #0d121c !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.2);
    z-index: 9999 !important;
    display: none;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #0d121c !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: var(--radius);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 1px rgba(255, 255, 255, 0.25);
    z-index: 9999 !important;
    min-width: 240px;
    padding: 6px 0;
}

.combobox-item {
    padding: 9px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    transition: background 0.12s ease, color 0.12s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.combobox-item:hover {
    background: rgba(0, 82, 255, 0.15);
    color: #60a5fa;
}

.combobox-item.create-new {
    background: rgba(0, 82, 255, 0.09);
    color: #60a5fa;
    font-weight: 600;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.combobox-item.create-new:hover {
    background: rgba(0, 82, 255, 0.22);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #0d121c;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

/* Мобильные элементы навигации */
.mobile-menu-btn {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    margin-right: 12px;
    flex-shrink: 0;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #60a5fa;
    border-color: #3b82f6;
}

.mobile-menu-close {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    margin-left: auto;
    padding: 4px 8px;
    line-height: 1;
}

.mobile-menu-close:hover {
    color: #fff;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Утилиты отображения Desktop / Mobile */
.mobile-only {
    display: none !important;
}
.desktop-only {
    display: initial;
}

/* Базовые стили карточек и оберток */
.card {
    width: 100%;
    box-sizing: border-box;
}

/* Адаптивные модульные сетки страниц */
.settings-grid,
.order-create-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    width: 100%;
}

.settings-left-col,
.settings-right-col {
    width: 100%;
    min-width: 0;
}

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

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

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

/* ========================================================
   АДАПТИВНОСТЬ ДЛЯ ПЛАНШЕТОВ И СМАРТФОНОВ (<= 900px)
   ======================================================== */
@media (max-width: 900px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: inline-flex !important;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .mobile-menu-close {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 290px;
        z-index: 999;
        box-shadow: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.95);
    }

    body.sidebar-opened {
        overflow: hidden;
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .header {
        height: 56px !important;
        min-height: 56px !important;
        padding: 0 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 10px;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .header-left {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .header-title {
        font-size: 1rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: auto;
    }

    .btn-hero-electric {
        padding: 6px 10px;
        min-width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.92rem;
        border-radius: 8px;
    }

    .content-body {
        padding: 12px 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Все двухколоночные и трехколоночные сетки сворачиваются в 1 колонку */
    .settings-grid,
    .order-create-grid,
    .order-details-grid,
    .form-row-2,
    .form-row-3,
    .form-row-2-1,
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr 1fr"],
    div[style*="grid-template-columns: 2fr 1fr 2fr"],
    div[style*="grid-template-columns: repeat(4, 1fr)"],
    div[style*="grid-template-columns: repeat(3, 1fr)"] {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 14px !important;
    }

    .settings-left-col,
    .settings-right-col,
    .settings-grid > div,
    .order-create-grid > div,
    .order-details-grid > div {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Верхняя панель карточки заказа (полная ширина на мобильных) */
    .order-top-bar {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 14px !important;
        padding: 14px 16px !important;
    }

    .order-action-buttons {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .order-action-buttons > * {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }

    .order-action-buttons .btn-print-main,
    .order-action-buttons > a.btn-primary {
        grid-column: span 2 !important;
        width: 100% !important;
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    .order-action-buttons form {
        width: 100% !important;
        grid-column: span 2 !important;
    }

    .order-action-buttons form button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Адаптивность таблиц */
    .table-container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        margin-bottom: 8px;
        border-radius: var(--radius);
        box-sizing: border-box !important;
    }

    .table-container > table {
        min-width: 600px;
    }

    /* Формы и кнопки */
    .form-control, .btn {
        font-size: 15px;
    }

    input[type="text"], input[type="tel"], input[type="number"], input[type="password"], select, textarea {
        font-size: 16px !important; /* Предотвращает зум в iOS Safari */
    }

    /* Форма фильтров в списке заказов */
    #orderFilterForm {
        flex-direction: column;
        align-items: stretch !important;
    }

    #orderFilterForm > div {
        width: 100% !important;
        min-width: 100% !important;
    }

    #orderFilterForm > div:last-child {
        display: grid !important;
        grid-template-columns: 1fr 44px;
        gap: 8px;
    }

    #orderFilterForm > div:last-child > a:last-child {
        grid-column: span 2;
        justify-content: center;
    }
}

/* ========================================================
   ОСОБАЯ АДАПТАЦИЯ ДЛЯ СМАРТФОНОВ (<= 680px)
   ======================================================== */
@media (max-width: 680px) {
    /* Переключение между таблицей и карточками работ/запчастей */
    .order-items-table-desktop {
        display: none !important;
    }

    .order-items-mobile-list {
        display: block !important;
    }

    .card {
        padding: 14px !important;
        border-radius: 8px !important;
    }

    .orders-tab-pills {
        gap: 4px !important;
    }

    .orders-tab-pills .btn {
        font-size: 0.76rem !important;
        padding: 5px 8px !important;
    }
}

@media (min-width: 681px) {
    .order-items-table-desktop {
        display: block !important;
    }

    .order-items-mobile-list {
        display: none !important;
    }
}

/* ========================================================
   ЖИВЫЕ УВЕДОМЛЕНИЯ И КНОПКА ОБНОВЛЕНИЯ (LIVE UI)
   ======================================================== */
.header-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
    color: var(--text-muted);
    border-color: var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-refresh-btn:hover {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.1);
}

.header-refresh-btn.refreshing i {
    animation: spinRefresh 0.8s linear infinite;
    color: #38bdf8;
}

@keyframes spinRefresh {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 32px);
    pointer-events: none;
}

.toast-item {
    background: rgba(11, 15, 24, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75), 0 0 24px rgba(0, 82, 255, 0.2);
    border-radius: 10px;
    padding: 12px 14px;
    color: #fff;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.25s ease;
    text-decoration: none;
    cursor: pointer;
}

.toast-item:hover {
    border-color: #38bdf8;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.35);
    transform: translateY(-2px);
}

.toast-item.toast-closing {
    opacity: 0;
    transform: translateX(40px);
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.toast-icon.new_order {
    background: rgba(0, 82, 255, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.toast-icon.status_change {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.toast-icon.payment {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

.toast-msg {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.15s ease;
}

.toast-close:hover {
    color: #fff;
}

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

/* ========================================================
   КАСТОМНЫЕ МУЛЬТИСЕЛЕКТЫ (.ms) — СТАТУСЫ И МАСТЕРА
   ======================================================== */
.ms {
    position: relative;
    width: 100%;
}

.ms.open {
    position: relative;
    z-index: 500;
}

.ms-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    min-height: 38px;
    background-color: #0a0d14;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: #f1f5f9;
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
}

.ms-btn:hover,
.ms.open .ms-btn {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

.ms-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.ms-caret {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.ms.open .ms-caret {
    transform: rotate(180deg);
    color: #38bdf8;
}

.ms-panel {
    display: none;
    position: absolute;
    z-index: 1000;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: min(380px, 92vw);
    background: #0d121c;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(56, 189, 248, 0.15);
    padding: 10px;
    backdrop-filter: blur(20px);
}

.ms.open .ms-panel {
    display: block;
    animation: msDropdownFade 0.15s ease-out;
}

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

.ms-search {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: var(--transition);
}

.ms-search:focus {
    border-color: #38bdf8;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.ms-list {
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.04);
}

.ms-list::-webkit-scrollbar {
    width: 6px;
}

.ms-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
}

.ms-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.ms-list::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

.ms-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #f1f5f9;
    transition: background 0.15s ease;
    user-select: none;
}

.ms-opt:hover {
    background: rgba(56, 189, 248, 0.12);
}

.ms-opt input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #0284c7;
    cursor: pointer;
    flex-shrink: 0;
}

.ms-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ms-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ms-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: underline;
    padding: 4px 6px;
    border-radius: 4px;
}

.ms-clear:hover {
    color: #f87171;
}
