:root {
    --grade-a: #4CAF50;
    --grade-b: #8BC34A;
    --grade-c: #FFC107;
    --grade-d: #FF9800;
    --grade-f: #F44336;
    --emergency: #D32F2F;
    --planned: #FFA000;
    --deferred: #1976D2;
    --primary: #1565C0;
    --secondary: #424242;
    --bg: #fafafa;
    --card-bg: #ffffff;
    --text: #212121;
    --text-muted: #757575;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Navigation */
.nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
}

.logo-icon {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--primary);
}

.logo-text {
    font-size: 1.1em;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95em;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-signin {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95em;
    transition: color 0.2s;
}

.nav-signin:hover {
    color: var(--text);
}

.nav-active {
    color: var(--primary) !important;
    font-weight: 600;
}

/* Footer */
.footer {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    margin-top: 40px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Legacy Header (kept for compatibility) */
header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
    color: var(--text);
}

.tagline {
    font-size: 0.95em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.version {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card h2, .card h3 {
    margin-bottom: 16px;
    color: var(--secondary);
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--secondary);
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1em;
}

/* Checkbox styling */
.checkbox-group {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-hint {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 4px;
    margin-left: 24px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #0D47A1;
}

/* Progress */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #0D47A1);
    width: 0;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    text-align: center;
}

/* Grade Display */
.grade-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.grade-letter {
    font-size: 4em;
    font-weight: bold;
    padding: 20px 30px;
    border-radius: 8px;
    min-width: 100px;
}

.grade-score {
    font-size: 2em;
    font-weight: 600;
    color: var(--text-muted);
}

.grade-a { background: var(--grade-a); color: white; }
.grade-b { background: var(--grade-b); color: white; }
.grade-c { background: var(--grade-c); color: white; }
.grade-d { background: var(--grade-d); color: white; }
.grade-f { background: var(--grade-f); color: white; }

/* Temporal Pattern */
.temporal-pattern {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    letter-spacing: 2px;
}

/* Efficiency Gauge */
.efficiency-subtitle {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.efficiency-gauge {
    position: relative;
}

.gauge-svg {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    display: block;
}

.efficiency-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary);
    margin-top: 10px;
}

.efficiency-status {
    font-size: 1.1em;
    font-weight: 500;
    margin-top: 8px;
}

.efficiency-underspend { color: #F44336; }
.efficiency-optimal { color: #4CAF50; }
.efficiency-overspend { color: #FF9800; }

/* Priority Badge */
.priority-badge {
    margin: 20px 0;
}

.tier-label {
    font-size: 1.8em;
    font-weight: bold;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.tier-emergency {
    background: var(--emergency);
    color: white;
}

.tier-planned {
    background: var(--planned);
    color: white;
}

.tier-deferred {
    background: var(--deferred);
    color: white;
}

.risk-score {
    font-size: 1.3em;
    color: var(--text-muted);
}

/* Priority Matrix */
.priority-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: 4px;
}

.matrix-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    color: white;
}

/* PQC Status */
.pqc-status {
    margin: 20px 0;
}

.pqc-icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.pqc-label {
    font-size: 1.3em;
    font-weight: 600;
}

.pqc-ready { color: #4CAF50; }
.pqc-partial { color: #FF9800; }
.pqc-vulnerable { color: #F44336; }

.pqc-timeline {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.9em;
}

/* ROI Section */
.roi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.roi-metric {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 4px;
}

.roi-metric label {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.roi-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary);
}

/* Temporal Analysis */
.temporal-visualization {
    margin: 20px 0;
    padding: 20px;
    background: var(--bg);
    border-radius: 4px;
}

.grade-timeline {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
}

.grade-point {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.2em;
}

.pattern-insights {
    margin-top: 16px;
}

.insight-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
}

.insight-label {
    font-weight: 600;
    color: var(--secondary);
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.detail-list {
    max-height: 300px;
    overflow-y: auto;
}

.detail-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.95em;
}

.detail-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--secondary);
}

/* Findings */
.finding-critical {
    border-left: 4px solid #D32F2F;
}

.finding-high {
    border-left: 4px solid #F57C00;
}

.finding-medium {
    border-left: 4px solid #FFA000;
}

.finding-low {
    border-left: 4px solid #1976D2;
}

/* Change Detection */
.change-item {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.change-added {
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
}

.change-removed {
    background: #FFEBEE;
    border-left: 4px solid #F44336;
}

.change-modified {
    background: #FFF3E0;
    border-left: 4px solid #FF9800;
}

/* Recent Scans */
.scans-list {
    display: grid;
    gap: 12px;
}

.scan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.scan-item:hover {
    background: var(--border);
}

.scan-target {
    font-weight: 600;
    color: var(--secondary);
}

.scan-grade {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
}

.scan-time {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.8em;
    }

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

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .grade-display {
        flex-direction: column;
        gap: 10px;
    }

    .grade-letter {
        font-size: 3em;
        padding: 15px 25px;
    }
}
