: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;
}

/* Кастомные чекбоксы и радио */
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;
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; width: 100%; }
}
