/* ==========================================================================
   ZAPHIRA - Professional SaaS Design System
   Inspired by Linear, Vercel, Stripe, Notion & GitHub
   Clean • Minimal • Modern • Premium • Highly Responsive
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- 1. CSS Custom Properties / Design Tokens --- */
:root {
    /* Base Neutral Palette - Light Mode */
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-subtle: #f1f5f9;
    --bg-surface-hover: #f8fafc;
    --bg-surface-active: #edf2f7;
    
    --border-subtle: #e2e8f0;
    --border-default: #cbd5e1;
    --border-strong: #94a3b8;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Subtle Brand Accent (Restrained Indigo / Slate) */
    --accent-primary: #4f46e5;
    --accent-hover: #4338ca;
    --accent-subtle: #eef2ff;
    --accent-border: #c7d2fe;
    --accent-text: #4338ca;
    
    /* Semantic Status Colors */
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #065f46;
    --success-solid: #10b981;
    
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --warning-text: #92400e;
    --warning-solid: #f59e0b;
    
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #991b1b;
    --error-solid: #ef4444;
    
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;
    --info-text: #075985;
    --info-solid: #0ea5e9;

    /* Geometry & Spacing */
    --sidebar-width: 252px;
    --header-height: 56px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
    
    /* Shadows - Ultra subtle & crisp */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

    /* Transitions */
    --transition-fast: 140ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode Tokens */
html[data-theme="dark"] {
    --bg-page: #090d16;
    --bg-surface: #0f172a;
    --bg-surface-subtle: #1e293b;
    --bg-surface-hover: #1e293b;
    --bg-surface-active: #283548;
    
    --border-subtle: #1e293b;
    --border-default: #334155;
    --border-strong: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    --accent-primary: #6366f1;
    --accent-hover: #818cf8;
    --accent-subtle: rgba(99, 102, 241, 0.12);
    --accent-border: rgba(99, 102, 241, 0.28);
    --accent-text: #a5b4fc;
    
    --success-bg: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.25);
    --success-text: #6ee7b7;
    --success-solid: #34d399;
    
    --warning-bg: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(245, 158, 11, 0.25);
    --warning-text: #fcd34d;
    --warning-solid: #fbbf24;
    
    --error-bg: rgba(239, 68, 68, 0.12);
    --error-border: rgba(239, 68, 68, 0.25);
    --error-text: #fca5a5;
    --error-solid: #f87171;
    
    --info-bg: rgba(14, 165, 233, 0.12);
    --info-border: rgba(14, 165, 233, 0.25);
    --info-text: #7dd3fc;
    --info-solid: #38bdf8;
    
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

/* Respect system dark mode when theme is system */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --bg-page: #090d16;
        --bg-surface: #0f172a;
        --bg-surface-subtle: #1e293b;
        --bg-surface-hover: #1e293b;
        --bg-surface-active: #283548;
        
        --border-subtle: #1e293b;
        --border-default: #334155;
        --border-strong: #475569;
        
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --text-inverse: #0f172a;
        
        --accent-primary: #6366f1;
        --accent-hover: #818cf8;
        --accent-subtle: rgba(99, 102, 241, 0.12);
        --accent-border: rgba(99, 102, 241, 0.28);
        --accent-text: #a5b4fc;
        
        --success-bg: rgba(16, 185, 129, 0.12);
        --success-border: rgba(16, 185, 129, 0.25);
        --success-text: #6ee7b7;
        --success-solid: #34d399;
        
        --warning-bg: rgba(245, 158, 11, 0.12);
        --warning-border: rgba(245, 158, 11, 0.25);
        --warning-text: #fcd34d;
        --warning-solid: #fbbf24;
        
        --error-bg: rgba(239, 68, 68, 0.12);
        --error-border: rgba(239, 68, 68, 0.25);
        --error-text: #fca5a5;
        --error-solid: #f87171;
        
        --info-bg: rgba(14, 165, 233, 0.12);
        --info-border: rgba(14, 165, 233, 0.25);
        --info-text: #7dd3fc;
        --info-solid: #38bdf8;
        
        --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
        --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
    }
}

/* --- 2. CSS Reset & Base Rules --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100%;
    overflow-x: hidden;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

img, svg {
    display: block;
    max-width: 100%;
}

/* --- 3. App Shell & Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-page);
}

/* Sidebar (Desktop) */
.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.6rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--text-primary);
    color: var(--bg-surface);
}

.sidebar-workspace-badge {
    padding: 0.75rem 1.25rem 0.5rem;
}

.workspace-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.workspace-pill span.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success-solid);
    display: inline-block;
    margin-right: 6px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem 1.5rem;
}

.sidebar-section {
    margin-bottom: 1.25rem;
}

.sidebar-section-title {
    padding: 0.35rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.48rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background-color var(--transition-fast), color var(--transition-fast);
    position: relative;
}

.sidebar-nav-item:hover {
    background-color: var(--bg-surface-subtle);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background-color: var(--accent-subtle);
    color: var(--accent-text);
    font-weight: 600;
}

.sidebar-nav-item.active .sidebar-nav-icon {
    color: var(--accent-primary);
}

.sidebar-nav-icon {
    width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.sidebar-nav-item:hover .sidebar-nav-icon {
    color: var(--text-primary);
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    background: var(--bg-surface-subtle);
    color: var(--text-muted);
}

/* Sidebar Backdrop (Mobile) */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 35;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Main Container Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Top Navigation Header */
.app-header {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
}

.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-page-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Trigger Button in Header */
.search-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.83rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 180px;
}

.search-trigger:hover {
    border-color: var(--border-default);
    color: var(--text-secondary);
    background: var(--bg-surface);
}

.search-shortcut {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
}

/* Icon Buttons (Header) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-surface-subtle);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.notif-badge-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    border: 1.5px solid var(--bg-surface);
}

/* User Avatar & Trigger */
.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-full);
}

.avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Dropdown Menus */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 240px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    z-index: 50;
    display: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.dropdown-menu.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-header {
    padding: 0.65rem 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.35rem;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.dropdown-user-email {
    font-size: 0.78rem;
    color: var(--text-muted);
    word-break: break-all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-surface-subtle);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.35rem 0;
}

.dropdown-item.text-danger {
    color: var(--error-text);
}

.dropdown-item.text-danger:hover {
    background: var(--error-bg);
}

/* Notifications Dropdown Specifics */
.notif-dropdown {
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    font-size: 0.88rem;
}

.notif-list {
    padding: 0.35rem;
}

.notif-item {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background-color var(--transition-fast);
}

.notif-item:hover {
    background: var(--bg-surface-subtle);
}

.notif-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- 4. Main Page Body & Containers --- */
.page-container {
    padding: 1.75rem 2rem 3.5rem;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

/* Page Greeting Header */
.page-header-block {
    margin-bottom: 1.75rem;
}

.greeting-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.greeting-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 0.85rem;
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -0.5rem;
    margin-bottom: 0.85rem;
}

/* --- 5. Grid System --- */
.grid-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid-split-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
}

.grid-split-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.25rem;
}

/* --- 6. Card Components --- */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    border-color: var(--border-default);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface-hover);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Minimal Stat Cards (Linear/Stripe style) */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-sm);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.stat-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-footer {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stat-trend {
    font-weight: 600;
    color: var(--success-text);
}

/* Profile Completion Card */
.score-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.5rem;
}

.score-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.score-title-group h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.score-title-group p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    margin: 0;
}

.score-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0.75rem 0 0.6rem;
}

.progress-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.score-action-link {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color var(--transition-fast);
}

.score-action-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Device Overview Cards */
.device-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.device-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-sm);
}

.device-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.device-icon-box {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
}

.device-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.device-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.device-specs {
    margin: 0.5rem 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.device-spec-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.device-spec-label {
    color: var(--text-muted);
}

/* Quick Add Action Cards */
.quick-add-card {
    background: var(--bg-surface);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    min-height: 140px;
    text-decoration: none;
}

.quick-add-card:hover {
    border-color: var(--text-primary);
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.quick-add-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.quick-add-title {
    font-size: 0.88rem;
    font-weight: 600;
}

.quick-add-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Security / CVE Status Section */
.security-banner {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-xs);
}

.security-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.security-icon-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-solid);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.security-text h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.security-text p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Feed Filter Tabs / Pills */
.feed-tabs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 1rem;
}

.tab-pill {
    padding: 0.38rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.tab-pill:hover {
    border-color: var(--border-default);
    color: var(--text-primary);
}

.tab-pill.active {
    background: var(--text-primary);
    color: var(--bg-surface);
    border-color: var(--text-primary);
    font-weight: 600;
}

/* News & Feed Items */
.news-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition-fast);
}

.news-item-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-xs);
}

.news-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.news-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.news-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 0.75rem;
}

.news-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- 7. UI Components: Buttons, Badges, Inputs, Tables --- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-surface);
    border-color: var(--text-primary);
}

.btn-primary:hover {
    background-color: #273549;
    border-color: #273549;
}

html[data-theme="dark"] .btn-primary:hover {
    background-color: #e2e8f0;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

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

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background-color: var(--bg-surface-subtle);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.btn-danger:hover {
    background-color: var(--error-solid);
    color: #ffffff;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
}

.btn-block {
    width: 100%;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    border: 1px solid transparent;
}

.badge-default {
    background-color: var(--bg-surface-subtle);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

.badge-primary {
    background-color: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

.badge-success {
    background-color: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

.badge-warning {
    background-color: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.badge-danger {
    background-color: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}

/* Form Controls */
.form-group {
    margin-bottom: 1.15rem;
}

.form-label {
    display: block;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.form-control:disabled,
input:disabled,
select:disabled {
    background-color: var(--bg-surface-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

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

.data-table th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-surface-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

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

.data-table tbody tr:hover td {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Empty States */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.empty-state-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-surface-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.empty-state-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 360px;
    margin: 0 auto 1.25rem;
}

/* Flash Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

/* Modals */
.modal-overlay, .modal {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal-overlay.active,
.modal.active {
    display: flex;
}

.modal-dialog, .modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    position: relative;
}

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

.modal-title, .modal-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close, .modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.25rem;
}

.modal-close:hover, .modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface-hover);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Command Palette / Global Search Modal */
.cmd-palette-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    z-index: 120;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    padding-left: 1rem;
    padding-right: 1rem;
}

.cmd-palette-backdrop.active {
    display: flex;
}

.cmd-palette-card {
    width: 100%;
    max-width: 580px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    overflow: hidden;
}

.cmd-input-wrapper {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.75rem;
}

.cmd-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    box-shadow: none;
    padding: 0;
}

.cmd-results-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
}

.cmd-result-group-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.4rem 0.6rem 0.2rem;
}

.cmd-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cmd-result-item:hover,
.cmd-result-item.highlighted {
    background: var(--bg-surface-subtle);
    color: var(--text-primary);
}

.cmd-item-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--text-primary);
    color: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.83rem;
    box-shadow: var(--shadow-md);
    animation: toastSlideUp 180ms ease-out;
}

.toast-success { background: var(--success-solid); color: #ffffff; }
.toast-error { background: var(--error-solid); color: #ffffff; }

@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 8. Responsive Breakpoints --- */

/* Tablets (<= 1024px) */
@media (max-width: 1024px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-split-2-1,
    .grid-split-1-2 {
        grid-template-columns: 1fr;
    }
    .page-container {
        padding: 1.5rem;
    }
}

/* Mobile & Small Tablets (<= 768px) */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .search-trigger {
        min-width: unset;
        padding: 0.35rem 0.5rem;
    }
    
    .search-trigger span.search-text {
        display: none;
    }
    
    .search-shortcut {
        display: none;
    }
    
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .page-container {
        padding: 1rem 1rem 3rem;
    }
    
    .security-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .score-top {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Ultra Small Screens (<= 480px) */
@media (max-width: 480px) {
    .app-header {
        padding: 0 0.85rem;
    }
    
    .page-container {
        padding: 0.85rem 0.85rem 2.5rem;
    }
    
    .greeting-title {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.55rem;
    }
    
    .card-body,
    .device-card,
    .score-card {
        padding: 1rem;
    }
}
