/* ============================================================
   天宏选煤厂网络管理系统 — Aurora Enterprise Theme
   Premium dark-navy command center aesthetic
   Designed for sophistication, depth, and operational clarity
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    /* Brand Palette — Deep Indigo Navy */
    --brand-deep: #0f172a;
    --brand-navy: #1e293b;
    --brand-slate: #334155;
    --brand-steel: #475569;
    --brand-mist: #94a3b8;
    --brand-fog: #cbd5e1;
    --brand-snow: #f1f5f9;
    --brand-ice: #f8fafc;

    /* Accent — Electric Indigo */
    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-primary-light: #818cf8;
    --accent-primary-glow: rgba(79, 70, 229, 0.35);
    --accent-primary-bg: rgba(79, 70, 229, 0.08);
    --accent-primary-border: rgba(79, 70, 229, 0.2);

    /* Teal secondary accent */
    --accent-teal: #0d9488;
    --accent-teal-light: #2dd4bf;

    /* Status Colors */
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #3b82f6;
    --info-dark: #2563eb;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-bright: #000000;
    --text-inverse: #f8fafc;

    /* Backgrounds */
    --bg-base: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #f8fafc;
    --bg-input: #f8fafc;
    --bg-overlay: rgba(15, 23, 42, 0.6);

    /* Borders */
    --border-subtle: rgba(15, 23, 42, 0.05);
    --border-default: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.14);
    --border-active: rgba(79, 70, 229, 0.4);

    /* Typography */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Shadows — Layered for depth */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.1), 0 4px 10px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 48px rgba(15, 23, 42, 0.14), 0 8px 20px rgba(15, 23, 42, 0.08);
    --shadow-2xl: 0 32px 64px rgba(15, 23, 42, 0.2);
    --shadow-glow: 0 0 24px var(--accent-primary-glow);

    /* Radius */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* Transitions */
    --transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Legacy compatibility */
    --primary-color: var(--accent-primary);
    --secondary-color: var(--text-secondary);
    --success-color: var(--success);
    --danger-color: var(--danger);
    --warning-color: var(--warning);
    --info-color: var(--info);
    --light-color: var(--bg-base);
    --dark-color: var(--brand-deep);
}

/* ---- Global Reset & Base ---- */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-base);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.006em;
}

/* Subtle ambient gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(79, 70, 229, 0.05), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(13, 148, 136, 0.03), transparent);
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.3;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent-primary-hover);
}

code, .font-mono, .text-monospace {
    font-family: var(--font-mono);
}

/* ---- Page Load Animation ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-primary-glow); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

.container-fluid {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

/* ============================================================
   NAVBAR — Glassmorphic Premium Bar
   ============================================================ */
.navbar.bg-primary,
.navbar-dark.bg-primary {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e1b4b 100%) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.15);
    padding: 0 1.25rem;
    min-height: 60px;
}

.navbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.02em;
    padding: 0.5rem 0;
}

.navbar-brand i {
    color: var(--accent-primary-light);
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px var(--accent-primary-glow));
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.65) !important;
    font-weight: 500;
    font-size: 0.84rem;
    padding: 0.55rem 1rem !important;
    border-radius: var(--radius-pill);
    transition: var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 7px;
    position: relative;
}

.navbar .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
}

.navbar .nav-link.active {
    color: #fff !important;
    background: rgba(79, 70, 229, 0.25);
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.navbar .nav-link i {
    font-size: 0.88rem;
}

.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    padding: 6px 10px;
    border-radius: var(--radius-sm) !important;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%23ffffff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ============================================================
   CARDS — Layered Glass Design
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-default);
}

.card-header {
    background: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
    font-family: var(--font-display);
    padding: 16px 22px;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.card-header h5 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
    font-weight: 700;
}

.card-header h5 i,
.card-header i {
    color: var(--accent-primary);
    margin-right: 2px;
}

.card-body {
    color: var(--text-primary);
    padding: 22px;
}

.card-footer {
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border-default) !important;
    padding: 14px 22px;
}

/* ============================================================
   TABLES — Refined Data Grid
   ============================================================ */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(79, 70, 229, 0.02);
    --bs-table-hover-bg: rgba(79, 70, 229, 0.04);
    --bs-table-hover-color: var(--text-primary);
    background-color: transparent;
    border-color: var(--border-default);
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-hover);
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border-default);
    border-top: none;
    padding: 14px 18px;
    white-space: nowrap;
}

.table tbody td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 13px 18px;
    vertical-align: middle;
    font-size: 0.86rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.04);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(15, 23, 42, 0.015);
}

.table-responsive {
    border-radius: var(--radius-sm);
}

/* ============================================================
   BUTTONS — Premium Pill Design
   ============================================================ */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.84rem;
    border-radius: var(--radius-pill);
    padding: 9px 22px;
    transition: var(--transition);
    border: none;
    letter-spacing: -0.006em;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.78rem;
    border-radius: var(--radius-pill);
}

.btn-lg {
    padding: 12px 32px;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover), #4f46e5);
    color: #fff;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--brand-snow);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--brand-fog);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-dark), #047857);
    color: #fff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-dark), #b91c1c);
    color: #fff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
    background: linear-gradient(135deg, var(--warning-dark), #b45309);
    color: #fff;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

.btn-info {
    background: linear-gradient(135deg, var(--info), var(--info-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-info:hover {
    background: linear-gradient(135deg, var(--info-dark), #1d4ed8);
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--accent-primary);
    color: var(--accent-primary);
}

.btn-outline-primary:hover {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-outline-secondary {
    background: transparent;
    border: 1.5px solid var(--border-strong);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--brand-slate);
    color: var(--text-primary);
}

.btn-outline-success {
    background: transparent;
    border: 1.5px solid var(--success);
    color: var(--success-dark);
}

.btn-outline-success:hover {
    background: var(--success);
    color: #fff;
}

.btn-outline-warning {
    background: transparent;
    border: 1.5px solid var(--warning);
    color: var(--warning-dark);
}

.btn-outline-warning:hover {
    background: var(--warning);
    color: #fff;
}

.btn-outline-info {
    background: transparent;
    border: 1.5px solid var(--info);
    color: var(--info-dark);
}

.btn-outline-info:hover {
    background: var(--info);
    color: #fff;
}

.btn-link {
    color: var(--accent-primary);
    font-weight: 500;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* ============================================================
   FORMS — Refined Inputs
   ============================================================ */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border: 1.5px solid var(--border-default);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.88rem;
    font-family: inherit;
    transition: var(--transition-fast);
    line-height: 1.5;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-surface);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    color: var(--text-primary);
    outline: none;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    padding-right: 36px;
}

.form-select option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.form-label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 7px;
    letter-spacing: -0.006em;
}

.form-text {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.input-group-text {
    background-color: var(--bg-input);
    border-color: var(--border-default);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.form-control.form-control-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.form-select.form-select-sm {
    padding: 7px 28px 7px 12px;
    font-size: 0.82rem;
}

/* ============================================================
   MODALS — Premium Dialog
   ============================================================ */
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    color: var(--text-primary);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--brand-snow), var(--bg-surface)) !important;
    border-bottom: 1px solid var(--border-default);
    padding: 18px 24px;
    color: var(--text-primary);
}

.modal-header.bg-primary {
    background: linear-gradient(135deg, var(--brand-deep), var(--brand-navy)) !important;
    border-bottom: none;
}

.modal-header.bg-primary .modal-title,
.modal-header.bg-primary {
    color: #fff !important;
}

.modal-header.bg-primary .btn-close {
    filter: invert(1) brightness(2);
    opacity: 0.6;
}

.modal-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.modal-body {
    color: var(--text-primary);
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-default);
    background: var(--bg-hover);
    padding: 16px 24px;
}

.modal .btn-close {
    opacity: 0.4;
    transition: opacity 0.15s;
    padding: 0.8rem;
}

.modal .btn-close:hover {
    opacity: 0.8;
}

.modal-backdrop.show {
    opacity: 0.5;
    backdrop-filter: blur(4px);
}

/* ============================================================
   BADGES — Soft Pill Design
   ============================================================ */
.badge {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}

.badge.bg-success {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #059669;
}

.badge.bg-danger {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #dc2626;
}

.badge.bg-warning {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #d97706;
}

.badge.bg-info {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #2563eb;
}

.badge.bg-secondary {
    background: rgba(100, 116, 139, 0.12) !important;
    color: var(--text-secondary);
}

.badge.bg-primary {
    background: rgba(79, 70, 229, 0.12) !important;
    color: var(--accent-primary);
}

/* ============================================================
   STATUS INDICATORS
   ============================================================ */
.status-online { color: var(--success); }
.status-offline { color: var(--danger); }
.status-warning { color: var(--warning); }

/* ============================================================
   DROPDOWNS — Glass Menu
   ============================================================ */
.dropdown-menu {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 200px;
}

.dropdown-item {
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--accent-primary-bg);
    color: var(--accent-primary);
}

.dropdown-item.active {
    background: var(--accent-primary-bg);
    color: var(--accent-primary);
    font-weight: 600;
}

.dropdown-item.text-danger {
    color: var(--danger) !important;
}

.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    color: var(--danger-dark) !important;
}

.dropdown-divider {
    border-color: var(--border-default);
    margin: 4px 0;
}

/* ============================================================
   PAGINATION — Refined Navigation
   ============================================================ */
.pagination {
    margin-top: 20px;
    gap: 4px;
}

.page-link {
    background: transparent;
    border: 1.5px solid transparent;
    color: var(--accent-primary);
    border-radius: var(--radius-sm) !important;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.84rem;
    transition: var(--transition-fast);
}

.page-link:hover {
    background: var(--accent-primary-bg);
    border-color: var(--accent-primary-border);
    color: var(--accent-primary-hover);
}

.page-item.active .page-link {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    opacity: 0.5;
}

/* ============================================================
   ALERTS — Soft Notification Design
   ============================================================ */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    padding: 14px 18px;
    font-size: 0.86rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-info {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}

.alert-success {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.18);
    color: #059669;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.18);
    color: #dc2626;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.18);
    color: #d97706;
}

/* ============================================================
   SEARCH BOX
   ============================================================ */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 42px;
    border-radius: var(--radius-pill);
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================================
   SIDEBAR — Dark Command Center Panel
   ============================================================ */
.sidebar,
.sidebar.bg-light {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);
}

.sidebar .nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    padding: 13px 22px;
    border-left: 3px solid transparent;
    border-radius: 0;
    transition: var(--transition-fast);
    font-size: 0.84rem;
    letter-spacing: -0.006em;
    margin: 2px 8px;
    border-radius: var(--radius-sm);
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.3), rgba(99, 102, 241, 0.15));
    border-left-color: var(--accent-primary-light);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.2);
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: var(--accent-primary-light);
    font-size: 0.9rem;
}

/* ============================================================
   DASHBOARD STAT CARDS — Premium Metric Tiles
   ============================================================ */
.border-left-primary {
    border-left: 4px solid var(--accent-primary) !important;
}
.border-left-success {
    border-left: 4px solid var(--success) !important;
}
.border-left-warning {
    border-left: 4px solid var(--warning) !important;
}
.border-left-danger {
    border-left: 4px solid var(--danger) !important;
}
.border-left-info {
    border-left: 4px solid var(--info) !important;
}

.text-xs { font-size: 0.72rem; }
.font-weight-bold { font-weight: 700 !important; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.06em; }

.text-gray-800 { color: var(--text-primary) !important; }
.text-gray-300 { color: var(--text-secondary) !important; }
.text-gray-500 { color: var(--text-muted) !important; }

.h5 { font-size: 1.15rem; font-weight: 700; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }

.shadow { box-shadow: var(--shadow-md) !important; }
.h-100 { height: 100% !important; }

/* Stat card hover glow */
.card.border-left-primary:hover {
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12), var(--shadow-sm) !important;
    transform: translateY(-2px);
}
.card.border-left-success:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12), var(--shadow-sm) !important;
    transform: translateY(-2px);
}
.card.border-left-warning:hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.12), var(--shadow-sm) !important;
    transform: translateY(-2px);
}
.card.border-left-danger:hover {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.12), var(--shadow-sm) !important;
    transform: translateY(-2px);
}

/* ============================================================
   DEVICE CARDS
   ============================================================ */
.device-card {
    text-align: center;
    padding: 28px 18px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.device-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary-border);
}

.device-card i {
    font-size: 2.5rem;
    margin-bottom: 14px;
    color: var(--accent-primary);
    filter: drop-shadow(0 4px 8px var(--accent-primary-glow));
}

.device-card h5 {
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.device-card .device-ip {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-family: var(--font-mono);
}

/* ============================================================
   LOADING & EMPTY STATES
   ============================================================ */
.loading {
    text-align: center;
    padding: 48px;
}

.loading i {
    font-size: 2.5rem;
    color: var(--accent-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.15;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--brand-snow);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-primary-light));
    border-radius: var(--radius-pill);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-default);
}

.timeline-item {
    position: relative;
    margin-bottom: 22px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid var(--bg-surface);
    box-shadow: 0 0 0 2px var(--accent-primary), 0 0 12px var(--accent-primary-glow);
}

/* ============================================================
   ALERT ITEMS
   ============================================================ */
.alert-item {
    padding: 16px;
    border-left: 4px solid;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    transition: var(--transition-fast);
}

.alert-item:hover {
    box-shadow: var(--shadow-sm);
}

.alert-item.alert-critical {
    border-left-color: var(--danger);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.04), transparent);
}

.alert-item.alert-warning {
    border-left-color: var(--warning);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.04), transparent);
}

.alert-item.alert-info {
    border-left-color: var(--info);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.04), transparent);
}

/* ============================================================
   CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.28);
}

/* Sidebar custom scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   FOOTER
   ============================================================ */
.bg-light {
    background: var(--bg-base) !important;
}

.border-top {
    border-top: 1px solid var(--border-default) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.tooltip-inner {
    background: var(--brand-deep);
    border-radius: var(--radius-sm);
    color: #fff;
    box-shadow: var(--shadow-md);
    font-size: 0.78rem;
    padding: 8px 14px;
    font-weight: 500;
}

/* ============================================================
   TEXT OVERRIDES
   ============================================================ */
.text-dark { color: var(--text-primary) !important; }
.text-body { color: var(--text-primary) !important; }
.text-white { color: #fff !important; }
.text-primary { color: var(--accent-primary) !important; }
.text-success { color: var(--success-dark) !important; }
.text-danger { color: var(--danger-dark) !important; }
.text-warning { color: var(--warning-dark) !important; }
.text-info { color: var(--info-dark) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-white { background-color: var(--bg-surface) !important; }
.bg-primary { background-color: var(--accent-primary) !important; }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner-border {
    color: var(--accent-primary);
    border-width: 2.5px;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1) !important;
}

.bg-gradient-dark {
    background: linear-gradient(135deg, var(--brand-deep), var(--brand-navy)) !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark)) !important;
}

.bg-gradient-info {
    background: linear-gradient(135deg, var(--info), var(--info-dark)) !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark)) !important;
}

.bg-gradient-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark)) !important;
}

/* ============================================================
   SIDEBAR CARD (for dashboard widgets)
   ============================================================ */
.sidebar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.sidebar-card:hover {
    box-shadow: var(--shadow-md);
}

.sidebar-card .card-header {
    padding: 14px 18px;
    font-size: 0.85rem;
}

.sidebar-card .card-body {
    padding: 18px;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 992px) {
    .navbar .nav-link {
        padding: 0.6rem 0.85rem !important;
        font-size: 0.82rem;
    }

    .navbar-collapse {
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .sidebar {
        display: none;
    }

    /* 侧边栏隐藏后，主内容区占满全宽（覆盖 ms-sm-auto 的 margin-left:auto） */
    main.col-md-10 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-left: 0 !important;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .card {
        margin-bottom: 14px;
        border-radius: var(--radius-sm);
    }

    .card-header {
        padding: 14px 16px;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 16px;
    }

    .table thead th {
        font-size: 0.7rem;
        padding: 10px 12px;
    }

    .table tbody td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .btn {
        padding: 8px 18px;
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 5px 14px;
        font-size: 0.74rem;
    }

    .row > div[class*="col-md"] {
        margin-bottom: 8px;
    }

    .navbar-brand {
        font-size: 0.9rem;
    }

    .navbar-brand i {
        font-size: 1.2rem;
    }

    .row.mb-3 > div[class*="col-md"] {
        margin-bottom: 6px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-header {
        padding: 14px 18px;
    }

    .modal-footer {
        padding: 12px 18px;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 0.82rem;
    }

    .card-header .btn {
        padding: 4px 12px;
        font-size: 0.72rem;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-link {
        padding: 6px 11px;
        font-size: 0.76rem;
    }

    /* Compact stat cards — 4 per row on mobile */
    .stat-cards-row {
        --bs-gutter-x: 0.3rem;
    }
    .stat-card-col {
        padding-right: 0.15rem;
        padding-left: 0.15rem;
    }
    .stat-card-col .card-body {
        padding: 0.4rem 0.35rem !important;
    }
    .stat-card-col .card.py-2 {
        padding-top: 0.35rem !important;
        padding-bottom: 0.35rem !important;
    }
    .stat-card-col .text-xs {
        font-size: 0.56rem !important;
        letter-spacing: 0.02em !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .stat-card-col .h5 {
        font-size: 0.82rem !important;
        line-height: 1.2;
    }
    .stat-card-col .col-auto {
        display: none !important;
    }
    .stat-card-col .col.mr-2 {
        margin-right: 0 !important;
        text-align: center;
        flex: 1 1 auto;
        width: 100%;
    }
    .stat-card-col .row.no-gutters {
        justify-content: center;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .navbar, .btn, .no-print, .sidebar {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    body::before {
        display: none !important;
    }

    .card {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}
