/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */

:root {
    /* Color Palette (Sleek Dark Mode default) */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-rgb: 99, 102, 241;
    
    --secondary: #a855f7;
    --secondary-light: #c084fc;
    --secondary-rgb: 168, 85, 247;
    
    --accent: #06b6d4;
    --accent-rgb: 6, 182, 212;
    
    /* Criticities colors (accessibility optimized) */
    --c-green: #10b981;
    --c-green-bg: rgba(16, 185, 129, 0.15);
    --c-yellow: #f59e0b;
    --c-yellow-bg: rgba(245, 158, 11, 0.15);
    --c-orange: #f97316;
    --c-orange-bg: rgba(249, 115, 22, 0.15);
    --c-red: #ef4444;
    --c-red-bg: rgba(239, 68, 68, 0.18);

    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: #16161f;
    --bg-card-hover: #1e1e2d;
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.16);
    
    /* Text Colors */
    --text-primary: #f0f0f5;
    --text-secondary: #a1a1aa;
    --text-muted: #6b7280;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
    
    /* Border Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-card: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%);
    
    /* Font Families */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Space Grotesk', monospace;
}

/* Light Theme Overrides */
html.light-mode {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    
    /* Stronger borders for contrast */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-hover: rgba(0, 0, 0, 0.16);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
    
    --gradient-card: linear-gradient(180deg, rgba(0,0,0,0.01) 0%, rgba(0,0,0,0) 100%);

    /* Criticities colors in light mode (deeper tone for readability) */
    --c-green: #047857;
    --c-green-bg: rgba(16, 185, 129, 0.1);
    --c-yellow: #d97706;
    --c-yellow-bg: rgba(245, 158, 11, 0.08);
    --c-orange: #ea580c;
    --c-orange-bg: rgba(249, 115, 22, 0.08);
    --c-red: #dc2626;
    --c-red-bg: rgba(239, 68, 68, 0.08);
}

/* ==========================================================================
   RESET & GLOBAL STYLES
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    min-height: 100vh;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
html:not(.light-mode) ::-webkit-scrollbar-thumb {
    background: #475569;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
html:not(.light-mode) ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ==========================================================================
   GRIMONT GLOBAL HEADER
   ========================================================================== */

.grimont-global-header {
    width: 100%;
    z-index: 1000;
    position: sticky;
    top: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 0;
    font-family: var(--font-display);
    color: #e2e8f0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

html.light-mode .grimont-global-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #0f172a;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.ggh-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ggh-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.ggh-logo-group {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.ggh-logo-group:hover {
    transform: scale(1.02);
}

.ggh-logo-box {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.ggh-logo-text {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    letter-spacing: 0.05em;
    display: none;
}

html.light-mode .ggh-logo-text {
    color: #0f172a;
}

.ggh-logo-text span {
    color: #00f2ff;
}

html.light-mode .ggh-logo-text span {
    color: #2563eb;
}

.ggh-separator {
    width: 1px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    display: none;
}

html.light-mode .ggh-separator {
    background-color: rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .ggh-logo-text { display: block; }
}

@media (min-width: 768px) {
    .ggh-separator { display: block; }
}

.ggh-app-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ggh-app-title-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ggh-app-icon-container {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #60a5fa;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

html.light-mode .ggh-app-icon-container {
    background: #f1f5f9;
    border-color: rgba(0,0,0,0.08);
    color: #2563eb;
}

.ggh-app-name {
    font-weight: 700;
    color: white;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

html.light-mode .ggh-app-name {
    color: #0f172a;
}

.ggh-app-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    max-width: 500px;
    display: none;
    margin: 4px 0 0 0;
    line-height: 1.4;
    font-weight: 300;
}

@media (min-width: 1024px) {
    .ggh-app-desc { display: block; }
}

.ggh-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ggh-theme-toggle {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ggh-theme-toggle:hover {
    background: rgba(30, 41, 59, 1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

html.light-mode .ggh-theme-toggle {
    background: rgba(241, 245, 249, 0.8);
    border-color: rgba(0,0,0,0.08);
    color: #475569;
}

html.light-mode .ggh-theme-toggle:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   APP CONTAINER & HERO
   ========================================================================== */

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 1.5rem 80px;
}

.hero-section {
    text-align: center;
    margin-bottom: 48px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 100px;
    color: var(--primary-light);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

html.light-mode .hero-badge {
    background: rgba(99, 102, 241, 0.05);
}

.hero-title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ==========================================================================
   CONFIG CARDS & LAYOUTS
   ========================================================================== */

.config-section {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.config-card {
    background: var(--bg-card);
    background-image: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

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

.config-card-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.config-icon {
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    font-size: 1.5rem;
    flex-shrink: 0;
}

html.light-mode .config-icon {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
}

.config-card-header h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.config-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Models Grid */
.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.model-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}

.model-card.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 1px var(--primary);
}

.model-icon {
    font-size: 1.6rem;
}

.model-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.model-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ==========================================================================
   EVALUATOR SECTION & TABLE
   ========================================================================== */

.evaluator-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.risk-rows-header {
    display: grid;
    grid-template-columns: 1fr 150px 150px 50px;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.risk-rows-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-row {
    display: grid;
    grid-template-columns: 1fr 150px 150px 50px;
    gap: 16px;
    align-items: center;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.risk-row:hover {
    border-color: var(--border-color-hover);
}

.risk-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
}

.risk-input:focus {
    border-bottom-color: var(--primary-light);
}

.risk-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
}

.risk-select:focus {
    border-color: var(--primary);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.btn-remove:hover {
    color: var(--c-red);
}

.evaluator-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-size: 0.95rem;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.generate-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

/* ==========================================================================
   RESULTS LAYOUT & EXPORTS
   ========================================================================== */

.results-section {
    margin-top: 48px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    animation: slideUp 0.5s ease-out forwards;
}

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

.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.results-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 100px;
    color: var(--secondary-light);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.results-title-group h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.results-helper-text i {
    color: var(--primary-light);
}

.export-bar {
    display: flex;
    gap: 12px;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.export-pdf-btn {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.export-pdf-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.export-word-btn {
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
    color: white;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
}

.export-word-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.45);
}

.export-pptx-btn {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: white;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
}

.export-pptx-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
}

/* Result Cards styling */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-b: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.result-card-header h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-card-header h3 i {
    color: var(--primary-light);
}

.export-single-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-single-btn:hover {
    color: var(--text-primary);
    border-color: var(--primary-light);
    background: var(--bg-card-hover);
}

.deliverable-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ==========================================================================
   LIVRABLE 1 : 5x5 CRITICALITY RISK MATRIX
   ========================================================================== */

.matrix-canvas-wrapper {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: relative;
}

/* Header visible only during PNG capture exports */
.export-header-watermark {
    display: none;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
    padding-bottom: 14px;
    margin-bottom: 24px;
}

.watermark-logo {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.watermark-logo span {
    color: #2563eb;
}

.watermark-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.matrix-main-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
    justify-content: center;
    max-width: 650px;
    margin: 0 auto;
}

.y-axis-label-container {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.matrix-grid-outer {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.matrix-grid-5x5 {
    display: grid;
    grid-template-rows: repeat(5, 90px);
    gap: 6px;
    width: 100%;
}

.matrix-row {
    display: grid;
    grid-template-columns: 50px repeat(5, 1fr);
    gap: 6px;
}

.y-axis-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.matrix-cell {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 6px;
    gap: 4px;
    min-height: 90px;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.02);
    transition: transform var(--transition-fast);
}

.matrix-cell:hover {
    transform: scale(1.01);
    z-index: 10;
}

/* Zone Colors HSL style for premium design */
.zone-faible {
    background-color: var(--c-green-bg);
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.zone-modere {
    background-color: var(--c-yellow-bg);
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.zone-eleve {
    background-color: var(--c-orange-bg);
    border: 1px solid rgba(249, 115, 22, 0.4);
}
.zone-critique {
    background-color: var(--c-red-bg);
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.x-axis-label-container {
    display: flex;
    justify-content: center;
    padding-left: 50px;
    margin-top: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

.matrix-x-axis-header {
    display: grid;
    grid-template-columns: 50px repeat(5, 1fr);
    gap: 6px;
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.x-axis-value {
    padding-top: 4px;
}

/* Risk Dot Badge in Matrix */
.matrix-risk-badge {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-primary));
    border: 2px solid var(--primary-light);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.matrix-risk-badge:hover {
    transform: scale(1.2);
    border-color: white;
    z-index: 50;
}

/* Tooltip standard */
.matrix-risk-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.matrix-risk-badge:hover::after {
    opacity: 1;
}

/* Editable legend in Matrix Card */
.matrix-legend-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 32px;
    padding-top: 20px;
    border-t: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.legend-color-box {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

/* ==========================================================================
   LIVRABLE 2 & 4 : TABULAR DELIVERABLES
   ========================================================================== */

.ranking-table-wrapper, .mitigation-table-wrapper {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.styled-table th, .styled-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.styled-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.styled-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

html.light-mode .styled-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

/* Editable in place visual helper */
[contenteditable="true"] {
    outline: none;
    border-bottom: 1px dashed transparent;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    padding: 2px 4px;
    border-radius: 4px;
}

[contenteditable="true"]:hover {
    border-bottom-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.05);
    cursor: text;
}

[contenteditable="true"]:focus {
    border-bottom-style: solid;
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

/* Criticities level tags styling */
.crit-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.crit-badge.level-faible {
    background-color: var(--c-green-bg);
    color: var(--c-green);
}
.crit-badge.level-modere {
    background-color: var(--c-yellow-bg);
    color: var(--c-yellow);
}
.crit-badge.level-eleve {
    background-color: var(--c-orange-bg);
    color: var(--c-orange);
}
.crit-badge.level-critique {
    background-color: var(--c-red-bg);
    color: var(--c-red);
}

/* Score display standard */
.score-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0 auto;
}

/* ==========================================================================
   LIVRABLE 3 : DETAILED CARDS
   ========================================================================== */

.explanations-list-wrapper {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.explanations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.explanation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform var(--transition-fast);
}

.explanation-card:hover {
    transform: translateY(-2px);
}

.exp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.exp-card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.exp-scores-row {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.exp-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.exp-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 6px;
}

.exp-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.exp-section h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

html.light-mode .exp-section h4 {
    color: var(--primary);
}

.exp-section p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==========================================================================
   LIVRABLE 5 : SOURCES CARDS
   ========================================================================== */

.sources-list-wrapper {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    gap: 16px;
}

.source-icon {
    font-size: 1.5rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.source-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.source-details h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.source-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.source-link {
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    align-self: flex-start;
    transition: color var(--transition-fast);
}

.source-link:hover {
    color: white;
}

html.light-mode .source-link:hover {
    color: var(--primary-dark);
}

/* ==========================================================================
   MITIGATION TABLE CUSTOMIZATIONS
   ========================================================================== */

.mitigation-table td {
    vertical-align: top;
    font-size: 0.9rem;
}

.mitigation-table p {
    margin-bottom: 6px;
}

.mitigation-table p:last-child {
    margin-bottom: 0;
}

.action-list-bullet {
    list-style-type: none;
}

.action-list-bullet li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 6px;
}

.action-list-bullet li:last-child {
    margin-bottom: 0;
}

.action-list-bullet li::before {
    content: "•";
    color: var(--primary-light);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* ==========================================================================
   EXPORT MODE OVERRIDES
   ========================================================================== */

.is-exporting {
    background-color: var(--bg-secondary) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
}

.is-exporting .export-header-watermark {
    display: flex !important;
}

.is-exporting .export-single-btn,
.is-exporting [contenteditable="true"]:hover {
    background: transparent !important;
}

.is-exporting [contenteditable="true"] {
    border-bottom: none !important;
}

/* ==========================================================================
   FOOTER & APP LEVEL UTILITIES
   ========================================================================== */

.app-footer {
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    margin-top: 80px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.app-footer a:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .config-card {
        padding: 20px;
    }
    
    .risk-rows-header {
        display: none;
    }
    
    .risk-row {
        grid-template-columns: 1fr;
        gap: 12px;
        position: relative;
        padding-top: 36px;
    }
    
    .risk-row::before {
        content: "Risque";
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-muted);
        position: absolute;
        top: 10px;
        left: 16px;
    }
    
    .risk-row .btn-remove {
        position: absolute;
        top: 4px;
        right: 12px;
    }
    
    .results-header-bar {
        align-items: stretch;
        flex-direction: column;
    }
    
    .export-bar {
        flex-direction: column;
    }
    
    .matrix-canvas-wrapper {
        padding: 20px 10px;
    }
    
    .matrix-grid-5x5 {
        grid-template-rows: repeat(5, 75px);
    }
    
    .matrix-cell {
        min-height: 75px;
        padding: 2px;
        gap: 2px;
    }
    
    .matrix-row {
        grid-template-columns: 30px repeat(5, 1fr);
    }
    
    .y-axis-value {
        padding-right: 6px;
        font-size: 0.75rem;
    }
    
    .matrix-x-axis-header {
        grid-template-columns: 30px repeat(5, 1fr);
        font-size: 0.75rem;
    }
    
    .matrix-risk-badge {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
    }
}
