/* ========================================
   SBOM Generator & Analyzer
   Enterprise-Grade Design System
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Colors */
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --primary-light: rgba(26, 115, 232, 0.08);
    --accent: #00bfa5;
    --accent-hover: #00a08a;

    /* Severity Colors */
    --critical: #d50000;
    --critical-bg: rgba(213, 0, 0, 0.08);
    --high: #ff6d00;
    --high-bg: rgba(255, 109, 0, 0.08);
    --medium: #f9a825;
    --medium-bg: rgba(249, 168, 37, 0.08);
    --low: #2e7d32;
    --low-bg: rgba(46, 125, 50, 0.08);

    /* Surfaces */
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-hover: #f8f9fb;
    --surface-raised: #ffffff;
    --border: #e1e5eb;
    --border-light: #f0f2f5;

    /* Text */
    --text: #1a1a2e;
    --text-secondary: #5f6368;
    --text-tertiary: #9aa0a6;
    --text-inverse: #ffffff;

    /* Sidebar */
    --sidebar-bg: #0a1628;
    --sidebar-text: #a8b2c1;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(26, 115, 232, 0.2);
    --sidebar-border: rgba(255, 255, 255, 0.06);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 0px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 40px -5px rgba(0, 0, 0, 0.12);

    /* Transitions */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-hover: #1c2128;
    --surface-raised: #1c2128;
    --border: #30363d;
    --border-light: #21262d;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    --sidebar-bg: #010409;
    --primary-light: rgba(26, 115, 232, 0.15);
    --critical-bg: rgba(213, 0, 0, 0.15);
    --high-bg: rgba(255, 109, 0, 0.15);
    --medium-bg: rgba(249, 168, 37, 0.12);
    --low-bg: rgba(46, 125, 50, 0.15);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.45);
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--sidebar-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    color: #fff;
    font-size: 1.14rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-subtitle {
    color: var(--sidebar-text);
    font-size: 0.78rem;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 0.93rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.71rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.nav-badge--danger {
    background: var(--critical);
}

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

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

.sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 12px;
    font-size: 0.71rem;
    color: var(--text-tertiary);
    padding: 0 4px;
}

/* --- Mobile Header --- */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    color: #fff;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 99;
}

.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
}

.mobile-title {
    font-weight: 600;
    font-size: 1.07rem;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    max-width: 1400px;
}

/* --- Views --- */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.view-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.view-subtitle {
    color: var(--text-secondary);
    font-size: 0.93rem;
    margin-top: 4px;
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.scan-timestamp {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn--outline:hover { background: var(--primary-light); }

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

.btn--sm { padding: 6px 12px; font-size: 0.85rem; }
.btn--lg { padding: 14px 28px; font-size: 1rem; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Upload Zone --- */
.upload-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.upload-zone {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone.dragover {
    transform: scale(1.01);
}

.upload-icon {
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    color: var(--primary);
}

.upload-title {
    font-size: 1.14rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-desc {
    color: var(--text-tertiary);
    font-size: 0.93rem;
}

/* Supported Formats Card */
.supported-formats {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.supported-formats h4 {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.format-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.format-item:hover {
    background: var(--surface-hover);
}

.format-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
    flex-shrink: 0;
}

.format-icon.npm { background: #cb3837; }
.format-icon.pypi { background: #3776ab; }
.format-icon.go { background: #00add8; }
.format-icon.maven { background: #c71a36; }
.format-icon.rust { background: #dea584; color: #000; }
.format-icon.ruby { background: #cc342d; }
.format-icon.php { background: #777bb4; }
.format-icon.nuget { background: #004880; }

.format-item div {
    display: flex;
    flex-direction: column;
}

.format-item strong {
    font-size: 0.85rem;
    font-weight: 600;
}

.format-item span {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* --- File Queue --- */
.file-queue {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.file-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-item-info {
    flex: 1;
}

.file-item-name {
    font-weight: 600;
    font-size: 0.93rem;
}

.file-item-meta {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition);
}

.file-item-remove:hover {
    background: var(--critical-bg);
    color: var(--critical);
}

.scan-actions {
    display: flex;
    justify-content: center;
}

/* --- Scan Progress --- */
.scan-progress {
    margin-bottom: 24px;
}

.progress-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progress-header h3 {
    font-size: 1.07rem;
    font-weight: 600;
}

.progress-percent {
    font-size: 1.28rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-container {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-status {
    color: var(--text-secondary);
    font-size: 0.93rem;
    margin-bottom: 8px;
}

.progress-details {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* --- Download Bar --- */
.download-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.download-bar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.93rem;
    color: var(--text);
}

.download-bar-info svg {
    color: var(--primary);
    flex-shrink: 0;
}

.download-bar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn--download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.btn--download-csv {
    background: rgba(46, 125, 50, 0.08);
    color: #2e7d32;
    border-color: rgba(46, 125, 50, 0.25);
}
.btn--download-csv:hover {
    background: rgba(46, 125, 50, 0.16);
    border-color: #2e7d32;
}

.btn--download-html {
    background: rgba(106, 27, 154, 0.08);
    color: #6a1b9a;
    border-color: rgba(106, 27, 154, 0.25);
}
.btn--download-html:hover {
    background: rgba(106, 27, 154, 0.16);
    border-color: #6a1b9a;
}

.btn--download-pdf {
    background: rgba(213, 0, 0, 0.08);
    color: #d50000;
    border-color: rgba(213, 0, 0, 0.25);
}
.btn--download-pdf:hover {
    background: rgba(213, 0, 0, 0.16);
    border-color: #d50000;
}

[data-theme="dark"] .btn--download-csv {
    background: rgba(46, 125, 50, 0.15);
    color: #66bb6a;
    border-color: rgba(46, 125, 50, 0.35);
}
[data-theme="dark"] .btn--download-csv:hover {
    background: rgba(46, 125, 50, 0.25);
}

[data-theme="dark"] .btn--download-html {
    background: rgba(106, 27, 154, 0.15);
    color: #ba68c8;
    border-color: rgba(106, 27, 154, 0.35);
}
[data-theme="dark"] .btn--download-html:hover {
    background: rgba(106, 27, 154, 0.25);
}

[data-theme="dark"] .btn--download-pdf {
    background: rgba(213, 0, 0, 0.15);
    color: #ef5350;
    border-color: rgba(213, 0, 0, 0.35);
}
[data-theme="dark"] .btn--download-pdf:hover {
    background: rgba(213, 0, 0, 0.25);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon--blue { background: var(--primary-light); color: var(--primary); }
.stat-icon--red { background: var(--critical-bg); color: var(--critical); }
.stat-icon--orange { background: var(--high-bg); color: var(--high); }
.stat-icon--green { background: var(--low-bg); color: var(--low); }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* --- Charts --- */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* --- Risk Card --- */
.risk-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.risk-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.risk-body {
    display: flex;
    gap: 40px;
    align-items: center;
}

.risk-gauge {
    text-align: center;
    min-width: 120px;
}

.risk-score {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
}

.risk-score.risk--critical { color: var(--critical); }
.risk-score.risk--high { color: var(--high); }
.risk-score.risk--medium { color: var(--medium); }
.risk-score.risk--low { color: var(--low); }
.risk-score.risk--none { color: var(--accent); }

.risk-label {
    font-size: 0.93rem;
    font-weight: 600;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.risk-breakdown {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.risk-item {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.risk-item-count {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.risk-item-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.risk-item--critical .risk-item-count { color: var(--critical); }
.risk-item--high .risk-item-count { color: var(--high); }
.risk-item--medium .risk-item-count { color: var(--medium); }
.risk-item--low .risk-item-count { color: var(--low); }

/* --- Top Vulnerabilities --- */
.top-vulns-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.top-vulns-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top-vuln-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--transition);
}

.top-vuln-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

.severity-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 72px;
    text-align: center;
}

.severity-badge--CRITICAL { background: var(--critical-bg); color: var(--critical); }
.severity-badge--HIGH { background: var(--high-bg); color: var(--high); }
.severity-badge--MEDIUM { background: var(--medium-bg); color: var(--medium); }
.severity-badge--LOW { background: var(--low-bg); color: var(--low); }

.top-vuln-info {
    flex: 1;
    min-width: 0;
}

.top-vuln-id {
    font-weight: 600;
    font-size: 0.93rem;
}

.top-vuln-pkg {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.top-vuln-summary {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Search & Filters --- */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    transition: border-color var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    background: transparent;
    padding: 9px 0;
    font-size: 0.93rem;
    font-family: inherit;
    color: var(--text);
    width: 200px;
    outline: none;
}

.filter-select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.93rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* --- Data Table --- */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: color var(--transition);
}

.data-table th.sortable:hover {
    color: var(--text);
}

.data-table th.sorted-asc .sort-icon::after { content: ' \u2191'; }
.data-table th.sorted-desc .sort-icon::after { content: ' \u2193'; }

.data-table td {
    padding: 14px 16px;
    font-size: 0.93rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

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

.comp-name {
    font-weight: 600;
    color: var(--primary);
}

.comp-version {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.comp-ecosystem {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

.comp-scope {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.vuln-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.vuln-count--clean {
    background: var(--low-bg);
    color: var(--low);
}

.vuln-count--affected {
    background: var(--critical-bg);
    color: var(--critical);
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.table-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    gap: 4px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all var(--transition);
}

.pagination button:hover { background: var(--surface-hover); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Vulnerability List --- */
.vuln-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vuln-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: all var(--transition);
    cursor: pointer;
}

.vuln-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.vuln-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.vuln-card-id {
    font-weight: 700;
    font-size: 1rem;
}

.vuln-card-aliases {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-left: auto;
}

.vuln-card-summary {
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.5;
    margin-bottom: 12px;
}

.vuln-card-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.vuln-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.vuln-meta-item strong {
    color: var(--text);
}

/* --- Export Grid --- */
.export-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.export-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition);
}

.export-card:hover {
    box-shadow: var(--shadow);
}

.export-card--full {
    grid-column: 1 / -1;
}

.export-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.export-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
    flex-shrink: 0;
}

.export-icon--spdx { background: linear-gradient(135deg, #1a73e8, #0d47a1); }
.export-icon--cdx { background: linear-gradient(135deg, #ff6d00, #e65100); }
.export-icon--csv { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
.export-icon--report { background: linear-gradient(135deg, #d50000, #b71c1c); }
.export-icon--html { background: linear-gradient(135deg, #6a1b9a, #4a148c); }

.export-card-header h3 {
    font-size: 1.14rem;
    font-weight: 700;
}

.export-card-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.export-desc {
    font-size: 0.93rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.export-actions {
    display: flex;
    gap: 10px;
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    text-align: center;
    color: var(--text-tertiary);
}

.empty-state h3 {
    font-size: 1.14rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 16px;
}

.empty-state p {
    font-size: 0.93rem;
    margin-top: 4px;
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

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

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
}

.modal--lg {
    max-width: 720px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.14rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
    line-height: 1;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.modal-field:last-child {
    border-bottom: none;
}

.modal-field-label {
    color: var(--text-secondary);
    font-size: 0.93rem;
}

.modal-field-value {
    font-weight: 500;
    font-size: 0.93rem;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

.modal-field-value code {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
}

/* --- Toasts --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 0.93rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 450px;
    animation: toastIn 0.3s ease;
}

.toast--success { border-left: 4px solid var(--accent); }
.toast--error { border-left: 4px solid var(--critical); }
.toast--warning { border-left: 4px solid var(--medium); }
.toast--info { border-left: 4px solid var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-exit {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .risk-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 24px;
    }

    .upload-container {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .export-grid {
        grid-template-columns: 1fr;
    }

    .view-header {
        flex-direction: column;
    }

    .view-actions {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    .risk-body {
        flex-direction: column;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th, .data-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .format-grid {
        grid-template-columns: 1fr;
    }

    .risk-breakdown {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- Utility --- */
.text-mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* --- Print --- */
@media print {
    .sidebar, .mobile-header, .toast-container, .modal-overlay,
    .btn, .search-box, .filter-select, .upload-zone, .scan-actions {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }

    .view { display: block !important; page-break-inside: avoid; }
    .stat-card, .chart-card, .vuln-card { break-inside: avoid; }
}
