<!-- Finite State Report Design System v1.0
     Shared CSS for all report templates.
     Usage: {% include '_design_system.html' %} inside <head>
     See dev/AI_HINTS.md for class reference and migration guide. -->
<style>
    /* =================================================================
       RESET & BASE
       ================================================================= */
    * { margin: 0; padding: 0; box-sizing: border-box; }

    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        line-height: 1.6;
        color: #333;
        background-color: #f8f9fa;
    }

    /* =================================================================
       LAYOUT
       ================================================================= */
    .container {
        margin: 0 auto;
        padding: 20px;
        background-color: white;
        border: 1px solid #dee2e6;
        min-height: 100%;
    }

    .header {
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 2px solid #e9ecef;
    }

    .logo-container { margin-bottom: 20px; }
    .company-logo { max-height: 50px; width: auto; margin: 0 auto; display: block; }
    .header h1 { color: #2c3e50; font-size: 2.2em; margin-bottom: 10px; }
    .header .subtitle { color: #6c757d; font-size: 1.1em; }

    .metadata {
        background-color: #f8f9fa;
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 30px;
        font-size: 0.9em;
        color: #6c757d;
    }

    .footer {
        text-align: center;
        padding: 20px 0;
        margin-top: 30px;
        border-top: 1px solid #e9ecef;
        color: #adb5bd;
        font-size: 0.85em;
    }

    .finite-state-logo { color: #007bff; font-weight: bold; }

    /* =================================================================
       KPI CARDS  (Version Comparison style — white bg, border, shadow)
       ================================================================= */
    .kpi-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 16px;
        margin-bottom: 30px;
    }

    .kpi-card {
        background-color: #fff;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        padding: 20px;
        text-align: center;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    .kpi-card .kpi-title {
        font-size: 0.85em;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 8px;
    }

    .kpi-card .kpi-value {
        font-size: 1.8em;
        font-weight: 700;
        color: #2c3e50;
    }

    .kpi-card .kpi-values {
        display: flex;
        justify-content: center;
        align-items: baseline;
        gap: 8px;
        font-size: 1.6em;
        font-weight: 700;
        color: #2c3e50;
    }

    .kpi-card .kpi-arrow { font-size: 0.7em; color: #6c757d; }

    .kpi-card .kpi-delta {
        font-size: 0.55em;
        font-weight: 600;
        padding: 3px 8px;
        border-radius: 12px;
        margin-top: 8px;
        display: inline-block;
    }

    .kpi-delta.improved { background-color: #e8f5e9; color: #2e7d32; }
    .kpi-delta.regressed { background-color: #ffebee; color: #c62828; }
    .kpi-delta.neutral { background-color: #f5f5f5; color: #757575; }

    /* =================================================================
       SUMMARY CARDS  (Triage style — colored bg, white text)
       ================================================================= */
    .summary-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
        margin-bottom: 30px;
    }

    .summary-card {
        padding: 20px;
        border-radius: 8px;
        text-align: center;
        color: white;
        font-weight: bold;
    }

    .summary-card .count { font-size: 2.5em; line-height: 1; }
    .summary-card .label { font-size: 0.9em; margin-top: 5px; opacity: 0.9; }

    .card-critical { background-color: #dc3545; }
    .card-high { background-color: #fd7e14; }
    .card-medium { background-color: #ffc107; color: #333; }
    .card-low { background-color: #28a745; }
    .card-info { background-color: #6c757d; }
    .card-total { background-color: #2c3e50; }

    /* =================================================================
       MINI KPIs  (inside project sections or sub-panels)
       ================================================================= */
    .mini-kpi-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        margin-bottom: 20px;
    }

    .mini-kpi {
        text-align: center;
        padding: 10px;
        border-radius: 8px;
        background-color: #f8f9fa;
    }

    .mini-kpi .label { font-size: 0.75em; color: #6c757d; text-transform: uppercase; }
    .mini-kpi .value { font-size: 1.4em; font-weight: 700; color: #2c3e50; }

    /* =================================================================
       CHARTS
       ================================================================= */
    .chart-container {
        background-color: white;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 20px;
        border: 1px solid #dee2e6;
    }

    .chart-wrapper { position: relative; height: 300px; }
    .chart-wrapper-tall { position: relative; height: 400px; margin: 20px 0; }
    .chart-wrapper-xtall { position: relative; height: 500px; margin: 20px 0; }

    .chart-title { color: #2c3e50; font-size: 1.5em; margin-bottom: 10px; }
    .chart-description { color: #6c757d; font-size: 0.95em; margin-bottom: 20px; }

    /* =================================================================
       GRID LAYOUTS
       ================================================================= */
    .two-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 30px;
    }

    @media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

    .changes-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
    @media (max-width: 900px) { .changes-two-col { grid-template-columns: 1fr; } }

    .changes-col { min-width: 0; }
    .changes-col-title {
        font-size: 1em; color: #2c3e50;
        margin-bottom: 10px; padding-bottom: 6px;
        border-bottom: 1px solid #e9ecef;
    }

    /* =================================================================
       TABLES
       ================================================================= */
    .data-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9em;
    }

    .data-table thead th {
        background-color: #f8f9fa;
        border-bottom: 2px solid #dee2e6;
        padding: 10px 12px;
        text-align: left;
        font-weight: 600;
        color: #495057;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .data-table tbody td {
        padding: 8px 12px;
        border-bottom: 1px solid #e9ecef;
    }

    .data-table tbody tr:hover { background-color: #f8f9fa; }
    .data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

    /* Table container for overflow scrolling */
    .table-container {
        background-color: white;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 30px;
        border: 1px solid #dee2e6;
        overflow-x: auto;
    }

    .table-container h2 { color: #2c3e50; font-size: 1.3em; margin-bottom: 5px; }
    .table-container p { color: #6c757d; font-size: 0.95em; margin-bottom: 15px; }

    /* Project group row (for tables grouped by project) */
    .project-group-row {
        background-color: #f8f9fa;
        font-weight: bold;
    }

    /* =================================================================
       BADGES — Severity
       ================================================================= */
    .severity-badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8em;
        font-weight: 600;
        text-transform: uppercase;
    }

    .severity-CRITICAL { background-color: #ffebee; color: #b71c1c; }
    .severity-HIGH { background-color: #fff3e0; color: #e65100; }
    .severity-MEDIUM { background-color: #fff8e1; color: #f57f17; }
    .severity-LOW { background-color: #e8f5e9; color: #2e7d32; }
    .severity-INFO { background-color: #e3f2fd; color: #1565c0; }
    .severity-UNSPECIFIED { background-color: #f5f5f5; color: #757575; }

    /* =================================================================
       BADGES — Priority Band (pill, colored bg, white text)
       ================================================================= */
    .band-badge {
        display: inline-block;
        padding: 2px 10px;
        border-radius: 12px;
        font-size: 0.8em;
        font-weight: 600;
        color: white;
    }

    .band-CRITICAL { background-color: #dc3545; }
    .band-HIGH { background-color: #fd7e14; }
    .band-MEDIUM { background-color: #ffc107; color: #333; }
    .band-LOW { background-color: #28a745; }
    .band-INFO { background-color: #6c757d; }

    /* =================================================================
       BADGES — Change Type (added, removed, updated)
       ================================================================= */
    .change-badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.8em;
        font-weight: 600;
    }

    .change-added { background-color: #e8f5e9; color: #2e7d32; }
    .change-removed { background-color: #ffebee; color: #c62828; }
    .change-updated { background-color: #e3f2fd; color: #1565c0; }

    /* =================================================================
       BADGES — Status (component status, policy status, copyleft)
       ================================================================= */
    .status-badge {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.85em;
        font-weight: 500;
    }

    /* Component status */
    .status-CONFIRMED { background-color: #e8f5e9; color: #2e7d32; }
    .status-NEEDS_REVIEW { background-color: #fff3e0; color: #ef6c00; }
    .status-IN_REVIEW { background-color: #e3f2fd; color: #1565c0; }
    .status-FALSE_POSITIVE { background-color: #f5f5f5; color: #616161; }
    .status-UNKNOWN { background-color: #fafafa; color: #757575; }

    /* Policy status */
    .policy-PERMITTED { background-color: #e8f5e9; color: #2e7d32; }
    .policy-WARNING { background-color: #fff3e0; color: #ef6c00; }
    .policy-VIOLATION { background-color: #ffebee; color: #c62828; }

    /* Copyleft classification */
    .copyleft-PERMISSIVE { background-color: #e8f5e9; color: #2e7d32; }
    .copyleft-WEAK_COPYLEFT { background-color: #fff3e0; color: #ef6c00; }
    .copyleft-STRONG_COPYLEFT { background-color: #ffebee; color: #c62828; }
    .copyleft-UNKNOWN { background-color: #f5f5f5; color: #757575; }

    /* Component type */
    .type-library { background-color: #e3f2fd; color: #1565c0; }
    .type-application { background-color: #f3e5f5; color: #7b1fa2; }
    .type-firmware { background-color: #fff3e0; color: #ef6c00; }
    .type-file { background-color: #e8f5e9; color: #2e7d32; }
    .type-operating-system { background-color: #fce4ec; color: #c2185b; }
    .type-default { background-color: #f5f5f5; color: #616161; }

    /* Generic badge (pill) */
    .badge {
        font-size: 0.8em;
        padding: 3px 10px;
        border-radius: 12px;
        font-weight: 600;
    }

    .badge-fixed { background-color: #e8f5e9; color: #2e7d32; }
    .badge-new { background-color: #ffebee; color: #c62828; }
    .badge-churn { background-color: #e3f2fd; color: #1565c0; }

    /* =================================================================
       SECTIONS & COLLAPSIBLE
       ================================================================= */
    .section { margin-bottom: 20px; }

    .section-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid #e9ecef;
    }

    .section-header h3 { font-size: 1.1em; color: #2c3e50; }

    /* Project sections (collapsible project panels) */
    .project-section {
        margin-bottom: 40px;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        overflow: hidden;
    }

    .project-header {
        background-color: #f8f9fa;
        padding: 16px 20px;
        border-bottom: 1px solid #dee2e6;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
    }

    .project-header h2 { font-size: 1.3em; color: #2c3e50; }
    .project-header .project-meta { font-size: 0.85em; color: #6c757d; }
    .project-body { padding: 20px; }

    /* Changelog entries (expand/collapse) */
    .changelog-section { margin-top: 24px; }
    .changelog-section h3 { margin-bottom: 12px; }
    .changelog-entry { border: 1px solid #e9ecef; border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
    .changelog-entry-header {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 16px; background: #f8f9fa;
        cursor: pointer; font-weight: 500;
    }
    .changelog-entry-header:hover { background: #e9ecef; }
    .changelog-entry-header .changelog-version { color: #2c3e50; }
    .changelog-entry-body { padding: 16px; display: none; border-top: 1px solid #e9ecef; }
    .changelog-entry.expanded .changelog-entry-body { display: block; }

    /* =================================================================
       INTERACTIVE: SHOW MORE / HIDDEN ROWS
       ================================================================= */
    .show-more-row td { text-align: center; padding: 10px; }
    .show-more-btn {
        background: none;
        border: 1px solid #dee2e6;
        border-radius: 6px;
        padding: 6px 16px;
        color: #495057;
        cursor: pointer;
        font-size: 0.9em;
    }
    .show-more-btn:hover { background-color: #f8f9fa; }
    .hidden-row { display: none; }

    /* =================================================================
       NARRATIVE / TEXT SECTIONS
       ================================================================= */
    .narrative-section {
        background-color: white;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 30px;
        border: 1px solid #dee2e6;
    }

    .narrative-section h3 { color: #2c3e50; margin-bottom: 15px; }
    .narrative-section h4 { color: #495057; margin: 20px 0 10px 0; }
    .narrative-section ul { margin-left: 20px; margin-bottom: 15px; }
    .narrative-section li { margin-bottom: 8px; }

    /* =================================================================
       ENTITY LINKS
       ================================================================= */
    a.entity-link { color: #007bff; text-decoration: none; font-weight: 500; }
    a.entity-link:hover { text-decoration: underline; color: #0056b3; }
    a.entity-link-cve { color: #6f42c1; }
    a.entity-link-cve:hover { color: #533399; }
    a.entity-link-component { color: #0d6efd; }
    a.entity-link-component:hover { color: #0a58ca; }
    a.entity-link-folder { color: #198754; }
    a.entity-link-folder:hover { color: #146c43; }

    /* =================================================================
       EMPTY STATE
       ================================================================= */
    .empty-state {
        text-align: center;
        padding: 40px 20px;
        color: #6c757d;
    }
    .empty-state p { font-size: 1.1em; margin-bottom: 8px; }
    .empty-state-inline { color: #6c757d; font-style: italic; padding: 12px 0; margin: 0; }

    /* =================================================================
       DELTA COLORS (for progression tables)
       ================================================================= */
    .delta-positive { color: #c62828; }   /* Increase = bad (more findings) */
    .delta-negative { color: #2e7d32; }   /* Decrease = good (fewer findings) */
    .delta-zero { color: #757575; }

    .changes-summary { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; font-size: 0.9em; color: #495057; }
    .changes-summary-fixed { color: #2e7d32; font-weight: 500; }
    .changes-summary-new { color: #c62828; font-weight: 500; }

    /* =================================================================
       ICONS (contextual emoji-based indicators)
       ================================================================= */
    .icon-exploit { color: #6f42c1; }
    .icon-kev { color: #dc3545; }
    .icon-reachable { color: #28a745; }
    .icon-unreachable { color: #6c757d; }
    .icon-unknown { color: #ffc107; }

    /* =================================================================
       UTILITY: TRUNCATED TEXT
       ================================================================= */
    .truncate {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* =================================================================
       PRINT STYLES
       ================================================================= */
    @media print {
        body { background-color: white; }
        .container { max-width: none; }
        .chart-container, .narrative-section, .table-container { border: 1px solid #dee2e6; }
        .show-more-btn, .show-more-row { display: none; }
        .hidden-row { display: table-row !important; }
    }
</style>
