:root {
    /* Refined Professional Palette */
    --primary: #60a5fa;
    --primary-glow: rgba(96, 165, 250, 0.4);
    --bg-main: #020617;
    --bg-sidebar: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.5);
    --bg-card: rgba(30, 41, 59, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #a78bfa;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --border: rgba(255, 255, 255, 0.08);

    /* Spacing & Radius */
    --sidebar-width: 280px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Depth */
    --shadow-premium: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 20px 50px -12px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

h1,
h2,
h3,
.logo-text {
    font-family: 'Outfit', sans-serif;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 32px 0;
    z-index: 10;
}

.logo {
    padding: 0 24px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-text span {
    color: var(--primary);
}

.nav-menu {
    flex: 1;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    margin-bottom: 4px;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    color: white;
    box-shadow: 0 10px 15px -3px var(--primary-glow);
}

.nav-item svg {
    opacity: 0.8;
}

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

.sidebar .sync-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sync-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.sync-button svg {
    transition: transform 0.5s ease;
}

.sync-button:hover svg {
    transform: rotate(180deg);
}

.sync-button.update-available {
    animation: pulse-update 2s infinite;
}

@keyframes pulse-update {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

.last-sync {
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.08), transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(167, 139, 250, 0.08), transparent 50%);
}

.top-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    background: rgba(15, 23, 42, 0.7);
    z-index: 5;
}

.top-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge {
    padding: 4px 12px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

/* View Container */
.view-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.03), transparent 70%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 0 20px var(--primary-glow);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    font-family: 'Outfit', sans-serif;
}

.stat-change {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

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

/* Dashboard Sections */
.dashboard-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.section-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

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

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-body {
    padding: 0;
    background: var(--bg-card);
}

/* List/Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

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

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

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

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

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

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

/* Risk Flagging */
.risk-row {
    background-color: rgba(239, 68, 68, 0.05) !important;
    border-left: 3px solid var(--danger);
}

.risk-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--danger);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .top-header,
    .search-controls,
    .nav-link,
    .monitor-btn,
    .sync-button,
    .close-modal {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
        height: auto !important;
    }

    .app-container {
        display: block !important;
    }

    .main-content {
        padding: 0 !important;
        background: white !important;
    }

    .view-container {
        padding: 0 !important;
        overflow: visible !important;
    }

    .modal-overlay {
        position: static !important;
        background: transparent !important;
        backdrop-filter: none !important;
    }

    .modal {
        width: 100% !important;
        max-width: none !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
    }

    .badge,
    .status-badge {
        border-color: #ccc !important;
    }

    .detail-label {
        color: #666 !important;
    }

    .detail-value {
        color: black !important;
    }
}

/* Search Controls */
.search-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 48px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.search-input:focus {
    outline: 2px solid var(--primary);
    background-color: var(--bg-card);
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-surface);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s;
}

.hidden {
    display: none;
    opacity: 0;
}

.modal {
    background: var(--bg-sidebar);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

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

.detail-row {
    margin-bottom: 16px;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
}

.monitor-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.monitor-btn.monitored {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.app-disclaimer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    padding: 8px 32px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Global Command Palette */
.command-palette {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(25px);
    width: 100%;
    max-width: 650px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 30px 60px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    margin-top: 15vh;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.command-input-wrapper {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.command-input-wrapper svg {
    color: var(--primary);
}

#global-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
}

.command-shortcut {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.command-results {
    max-height: 50vh;
    overflow-y: auto;
    padding: 12px;
}

.command-result-group {
    margin-bottom: 16px;
}

.command-result-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin: 8px 12px;
    letter-spacing: 0.1em;
}

.command-item {
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.command-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.command-item.active {
    background: rgba(96, 165, 250, 0.1);
}

.command-item-main {
    display: flex;
    flex-direction: column;
}

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

.command-item-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.command-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}