/* === SAM — Django app additions (complete les 3 CSS du design) === */

/* Phase empty (pas d'analyse selectionnee) */
.phase.empty .phase-circle {
    opacity: 0.5;
}
.phase.empty .phase-label { color: var(--text-3); }
.phase.empty .phase-frac { color: var(--text-3); opacity: 0.7; }

/* ═══ Compact project header ═══ */

.proj-header-compact { margin-bottom: 20px; }

.proj-title-compact {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.025em;
    margin: 0 0 12px 0;
}

.proj-meta-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-2);
}

.proj-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
}
.proj-meta-item .icon { color: var(--text-3); width: 14px; height: 14px; }
.proj-meta-item strong { color: var(--ink); font-weight: 500; }



/* ═══ Welcome banner (dashboard) ═══ */

.welcome-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 18px 24px;
    background: var(--surface);
    border-left: 4px solid var(--gold);
    border-radius: var(--r-md);
    margin-bottom: 20px;
    box-shadow: var(--sh-sm);
    flex-wrap: wrap;
}
.welcome-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin: 0;
}
.welcome-name { color: var(--azur); }
.welcome-sub {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 4px;
}
.welcome-banner-right {
    display: flex;
    gap: 32px;
}
.welcome-stat-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
}
.welcome-stat-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 2px;
}
.welcome-stat-warning { color: var(--warning); }

@media (max-width: 900px) {
    .welcome-banner { flex-direction: column; align-items: flex-start; }
    .welcome-banner-right { gap: 20px; }
}



/* ═══════════════════════════════════════════════════════════
   COMPATIBILITY SHIMS — pour anciennes classes utilisees dans les tabs
   (eviter de tout reecrire en une fois)
   ═══════════════════════════════════════════════════════════ */

/* card-title / card-subtitle : utilise partout dans les tabs */
.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.015em;
    margin: 0;
}
.card-subtitle {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 2px;
}

/* chip extensions */
.chip-engine { background: var(--azur-pale); color: var(--azur-dark); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; }
.chip-progress { background: var(--azur-pale); color: var(--azur-dark); }
.chip-muted { background: var(--surface-3); color: var(--text-3); }
.chip-completed { background: var(--success-soft); color: #1E7E3E; }
.chip-classified { background: var(--danger-soft); color: #8A2A20; }
.chip-restricted { background: var(--warning-soft); color: #8A5A15; }
.chip-gate { background: var(--gold-pale); color: var(--gold-dark); }
.chip-source { background: var(--azur-pale); color: var(--azur-dark); font-weight: 500; }
.chip-status-open { background: var(--warning-soft); color: #8A5A15; }
.chip-status-acknowledged { background: var(--azur-pale); color: var(--azur-dark); }
.chip-status-in_progress { background: var(--azur-pale); color: var(--azur); }
.chip-status-resolved { background: var(--success-soft); color: #1E7E3E; }
.chip-status-rejected { background: var(--surface-3); color: var(--text-3); }
.chip-priority-critical { background: var(--danger-soft); color: #8A2A20; font-weight: 600; }
.chip-priority-high { background: #FDCDAA; color: #92400E; }
.chip-priority-medium { background: var(--warning-soft); color: #8A5A15; }
.chip-priority-low { background: var(--success-soft); color: #1E7E3E; }
.chip-priority-info { background: var(--azur-pale); color: var(--azur-dark); }

/* Critical dot (risques avec alerte) */
.critical-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    margin-left: 6px;
    animation: critpulse 2s infinite;
    vertical-align: middle;
}
@keyframes critpulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(192,57,43,0); }
}

/* Tables helpers */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 10px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--surface-2); }

/* Metrics row (analyses section) */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}
.metric-box {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 14px;
    text-align: center;
}
.metric-box-critical { background: var(--danger-soft); border-color: #E8C2BD; color: #8A2A20; }
.metric-box-warning { background: var(--warning-soft); border-color: #F0D9A8; color: #6E4611; }
.metric-box .metric-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
}
.metric-box .metric-value {
    font-family: var(--font-display);
    font-size: 1.5em;
    font-weight: 700;
    color: inherit;
    margin-top: 4px;
    line-height: 1;
}
.metric-box .metric-sub {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 4px;
}

.section-subtitle {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin: 20px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-soft);
}

/* Functional tree */
.func-tree { display: flex; flex-direction: column; gap: 8px; }
.func-node {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 12px 14px;
}
.func-child { margin-left: 24px; border-left: 3px solid var(--azur-pale); }
.func-node-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.func-id {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--azur);
    font-weight: 600;
}
.func-name { font-weight: 500; color: var(--text); }
.func-desc { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* Recommendation cards */
.rec-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.rec-card {
    padding: 14px;
    border-radius: var(--r-md);
    text-align: center;
    border: 1px solid;
}
.rec-card-critical { background: var(--danger-soft); border-color: #E8C2BD; color: #8A2A20; }
.rec-card-high { background: #FDCDAA; border-color: #F0B988; color: #92400E; }
.rec-card-medium { background: var(--warning-soft); border-color: #F0D9A8; color: #6E4611; }
.rec-card-low { background: var(--success-soft); border-color: #C5E5D1; color: #1E5C33; }
.rec-card-total { background: var(--azur-pale); border-color: #C9E1EF; color: var(--azur-dark); }
.rec-card-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; }
.rec-card-value {
    font-family: var(--font-display);
    font-size: 1.6em;
    font-weight: 700;
    margin-top: 4px;
}

.recommendation-item {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-bottom: 10px;
}
.rec-priority-bar { width: 4px; flex-shrink: 0; }
.rec-priority-critical .rec-priority-bar { background: var(--danger); }
.rec-priority-high .rec-priority-bar { background: var(--warning); }
.rec-priority-medium .rec-priority-bar { background: #EAB308; }
.rec-priority-low .rec-priority-bar { background: var(--success); }
.rec-priority-info .rec-priority-bar { background: var(--azur); }
.rec-content { flex: 1; padding: 14px 18px; }
.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.rec-date { font-size: 11.5px; color: var(--text-3); }
.rec-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.rec-desc { color: var(--text); font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
.rec-rationale { background: var(--surface-2); padding: 10px 14px; border-radius: var(--r-sm); font-size: 12.5px; margin-bottom: 8px; }
.rec-links { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; }
.rec-link { padding: 2px 8px; background: var(--azur-pale); color: var(--azur-dark); border-radius: var(--r-pill); }
.rec-actions { display: flex; gap: 6px; margin-top: 8px; }

/* History timeline */
.history-timeline { }
.history-item {
    display: grid;
    grid-template-columns: 80px 40px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
}
.history-time { text-align: right; font-size: 12px; }
.history-date { font-weight: 500; color: var(--text); }
.history-hour { color: var(--text-3); font-size: 0.9em; }
.history-marker { display: flex; justify-content: center; }
.history-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--azur-pale);
    color: var(--azur);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
}
.history-action { font-size: 13px; color: var(--text); }
.history-details { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.history-detail { margin-right: 10px; }
.history-ip { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }

/* Team */
.team-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.team-member {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--surface-2);
    border-radius: var(--r-md);
}
.team-name { font-weight: 500; color: var(--text); }
.team-role { font-size: 12px; color: var(--azur); font-weight: 500; }
.team-org { font-size: 11.5px; color: var(--text-3); }

/* Critical risk badge (project header) */
.critical-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--danger-soft);
    color: #8A2A20;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 600;
}

/* Risk critical row highlighting */
.risk-critical { background: #FEF7F5 !important; border-left: 3px solid var(--danger); }

/* Upload + inputs */
.upload-box {
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: 18px;
    margin: 14px 0;
}
.upload-box.hidden { display: none; }
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
}
.doc-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 12px 14px;
    display: flex;
    gap: 10px;
}
.doc-icon { font-size: 20px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name {
    font-weight: 500;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.doc-parsed { color: var(--success); font-weight: 500; }
.doc-desc { font-size: 12px; color: var(--text); margin-top: 4px; }
.doc-actions { display: flex; gap: 4px; align-items: center; }
.docs-category-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--azur);
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--azur-pale);
}
.docs-count { color: var(--text-3); font-weight: 400; }
.docs-by-cat { display: flex; flex-direction: column; gap: 20px; }



/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
}
.empty-state h3 {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--ink);
    margin: 16px 0 8px;
}
.empty-state p {
    color: var(--text-3);
    margin-bottom: 16px;
}
.empty-state img.empty-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    margin-bottom: 8px;
}

/* Form controls (matching input style) */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

textarea.input { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }

/* Alerts inline */
.alert-error {
    padding: 12px 14px;
    background: var(--danger-soft);
    color: #8A2A20;
    border: 1px solid #E8C2BD;
    border-radius: var(--r-md);
    font-size: 13px;
}

/* Django messages */
.sam-messages { margin-bottom: 20px; }

/* Pending gates alert (on project page) */
.gate-alert {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.gate-alert-item {
    display: inline-block;
    margin-right: 6px;
    padding: 2px 8px;
    background: white;
    border-radius: 12px;
    font-size: 0.82em;
}

/* Project main layout (sidebar + content) */
.project-main-layout {
    padding: 0;
    min-height: calc(100vh - 64px);
}

/* Section layouts */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.section-header .card-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--ink);
}
.section-header .card-subtitle {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 2px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
    gap: 12px;
}

/* Analysis flexible workflow (keep compatible with earlier code) */
.analysis-card {
    padding: 16px 20px;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    border-radius: var(--r-lg);
    margin-bottom: 10px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.analysis-card-icon {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0;
    font-size: 1em;
    background: var(--text-3);
}
.analysis-completed .analysis-card-icon { background: var(--success); }
.analysis-available .analysis-card-icon { background: var(--azur); }
.analysis-blocked .analysis-card-icon { background: var(--warning); }
.analysis-card-body { flex: 1; min-width: 0; }
.analysis-card-head {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-bottom: 4px;
}
.analysis-card-label {
    font-family: var(--font-display);
    font-size: 14px; font-weight: 600; color: var(--ink);
    margin: 0;
}
.analysis-card-desc {
    font-size: 12.5px; color: var(--text-3);
    line-height: 1.5; margin-top: 4px;
}

/* Checklist for selecting analyses (setup) */
.analyses-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.analyses-check {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}
.analyses-check:hover {
    border-color: var(--azur);
    background: var(--azur-paler);
}
.analyses-check input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--azur);
}
.analyses-check-content { flex: 1; min-width: 0; }
.analyses-check-code {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--surface);
    color: var(--azur-dark);
    padding: 2px 7px;
    border-radius: var(--r-sm);
    font-weight: 500;
    display: inline-block;
    margin-bottom: 3px;
}
.analyses-check-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
}
.analyses-check-desc {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 2px;
}
/* Selection d'analyses : la liste de phases en tete etait un residu non
   regroupant (les 17 cases sont dans une grille plate en dessous) et redondant
   avec la timeline des phases plus bas -> masquee pour un rendu propre. */
.analyses-grouped { display: flex; flex-direction: column; }
.analyses-phase { display: none; }
.form-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: flex-end;
}

/* Data helpers */
.hash-code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-3);
}
.result-details summary {
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-3);
    padding: 8px 0;
}
.result-data {
    background: var(--surface-2);
    padding: 10px;
    border-radius: var(--r-sm);
    font-size: 11.5px;
    overflow: auto;
    max-height: 300px;
}

/* Deliverables group card */
.deliverables-group {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    margin-bottom: 18px;
    overflow: hidden;
}
.deliverables-group-header {
    padding: 14px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dg-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    color: var(--azur-dark);
    text-decoration: none;
}
.dg-title:hover { text-decoration: underline; }
.dg-meta {
    font-size: 12px;
    color: var(--text-3);
}

/* Filters bar (my_projects) */
.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
}
.filters-bar .input,
.filters-bar .select,
.filters-bar select.input,
.filters-bar select.select {
    width: auto;
    min-width: 180px;
    flex: 0 0 auto;
}
.filters-bar .input-search { width: 260px; flex: 0 0 auto; }
.filters-bar .btn { flex: 0 0 auto; }
.result-count { font-size: 13px; color: var(--text-3); margin: 0; }

/* Pagination */
.pagination-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.pagination-nav .btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination-ellipsis {
    padding: 0 6px;
    color: var(--text-3);
    font-size: 13px;
    user-select: none;
}

/* Page container compat */
.page-main { min-height: calc(100vh - 64px); }
.page-container { /* reuse .page from design */ }

/* Spinner */
.sam-spinner {
    width: 36px; height: 36px;
    margin: 16px auto;
    border: 4px solid var(--azur-pale);
    border-top-color: var(--azur);
    border-radius: 50%;
    animation: samSpin 0.8s linear infinite;
}
@keyframes samSpin { to { transform: rotate(360deg); } }

/* Toast extras (compatibility) */
.sam-toasts {
    position: fixed;
    top: 80px; right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
.sam-toast {
    min-width: 260px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--azur);
    border-radius: var(--r-md);
    box-shadow: var(--sh-md);
    display: flex;
    gap: 10px;
    align-items: center;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.2s var(--ease);
}
.sam-toast-show { opacity: 1; transform: translateX(0); }
.sam-toast-success { border-left-color: var(--success); }
.sam-toast-error { border-left-color: var(--danger); }
.sam-toast-warning { border-left-color: var(--warning); }
.sam-toast-icon {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--azur); color: white;
    font-weight: 700; flex-shrink: 0;
}
.sam-toast-success .sam-toast-icon { background: var(--success); }
.sam-toast-error .sam-toast-icon { background: var(--danger); }
.sam-toast-warning .sam-toast-icon { background: var(--warning); }
.sam-toast-body { flex: 1; font-size: 13px; }
.sam-toast-close {
    background: transparent; border: none; cursor: pointer;
    color: var(--text-3);
}

/* Modal */
.sam-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 40, 71, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sam-modal {
    background: white;
    border-radius: var(--r-xl);
    padding: 24px;
    width: 440px;
    max-width: 90vw;
    box-shadow: var(--sh-xl);
}
.sam-modal-title {
    font-family: var(--font-display);
    font-weight: 700; font-size: 17px; color: var(--ink);
    margin-bottom: 12px;
}
.sam-modal-body { font-size: 13.5px; line-height: 1.55; margin-bottom: 16px; }
.sam-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Responsive */
@media (max-width: 900px) {
    .topnav-center { display: none; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
    .hero { flex-direction: column; text-align: center; }
    .project-layout { grid-template-columns: 1fr; }
    .project-sidebar { position: static; height: auto; }
    .profile-layout { grid-template-columns: 1fr; }
}

/* ═══ Architecture tree (System > Subsystem > LRU > SRA > SRU > Component) ═══ */

.arch-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.arch-node {
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}
.arch-node > .arch-node-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    list-style: none;
    flex-wrap: wrap;
}
.arch-node > .arch-node-head::-webkit-details-marker { display: none; }
.arch-node > .arch-node-head:hover { background: var(--surface-2); }

.arch-chevron {
    display: inline-flex;
    transition: transform var(--dur) var(--ease);
    color: var(--text-3);
}
.arch-node[open] > .arch-node-head > .arch-chevron { transform: rotate(90deg); }

/* Level pills (compact monospace tag at left of each node) */
.arch-level {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 36px;
    text-align: center;
    flex: none;
}
.arch-level-system     { background: var(--ink); color: #fff; }
.arch-level-subsystem  { background: var(--azur); color: #fff; }
.arch-level-lru        { background: var(--azur-pale); color: var(--azur-dark); border: 1px solid var(--azur-light); }
.arch-level-sra        { background: var(--gold-pale); color: var(--gold-dark); border: 1px solid var(--gold-light); }
.arch-level-sru        { background: var(--success-soft); color: #1E7E3E; border: 1px solid #C5E5D1; }
.arch-level-component  { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong); }

.arch-node-name {
    flex: 1;
    min-width: 200px;
    font-weight: 500;
    color: var(--ink);
}

.arch-functions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* Children container with left rail */
.arch-node-children {
    padding: 4px 14px 10px 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.arch-node-children::before {
    content: '';
    position: absolute;
    left: 22px;
    top: 0;
    bottom: 10px;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
}

/* ═══ Functional analysis (APTE: FP / FC / FT / SF) ═══ */

.func-type-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 4px;
    flex: none;
}
.func-type-fp { background: var(--azur); color: #fff; }
.func-type-fc { background: var(--warning); color: #fff; }
.func-type-ft { background: var(--success); color: #fff; }
.func-type-sf { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong); }

.func-card {
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface-2);
    margin-bottom: 10px;
}
.func-card:last-child { margin-bottom: 0; }
.func-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.func-card-title { flex: 1; min-width: 200px; font-weight: 500; color: var(--ink); font-size: 14px; }
.func-card-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.5; margin-bottom: 6px; }
.func-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

.func-tree { display: flex; flex-direction: column; gap: 6px; }

.func-node {
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}
.func-node > .func-node-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    list-style: none;
    flex-wrap: wrap;
}
.func-node > .func-node-head::-webkit-details-marker { display: none; }
.func-node > .func-node-head:hover { background: var(--surface-2); }

.func-chevron {
    display: inline-flex;
    transition: transform var(--dur) var(--ease);
    color: var(--text-3);
    width: 16px;
}
.func-node[open] > .func-node-head > .func-chevron { transform: rotate(90deg); }

.func-node-name { flex: 1; min-width: 200px; font-weight: 500; color: var(--ink); }
.func-node-desc { padding: 0 14px 10px 40px; font-size: 12.5px; color: var(--text-2); }

.func-node-children {
    padding: 4px 14px 10px 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.func-node-children::before {
    content: '';
    position: absolute;
    left: 22px;
    top: 0;
    bottom: 10px;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
}

.func-node-leaf {
    border-color: var(--border-soft);
    background: var(--surface-2);
}
.func-node-leaf .func-node-head { padding: 8px 12px; cursor: default; }
.func-node-leaf .func-node-head:hover { background: var(--surface-2); }

/* ═══ Edit modal (HTML5 dialog) ═══ */

dialog.modal-edit {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 0;
    box-shadow: var(--sh-xl);
    width: 720px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 60px);
    background: var(--surface);
    color: var(--text);
    overflow: hidden;
}
dialog.modal-edit::backdrop {
    background: rgba(15, 40, 71, 0.45);
    backdrop-filter: blur(2px);
}

.modal-edit-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 60px);
}
.modal-edit-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface-2);
}
.modal-edit-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
}
.modal-edit-sub {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-edit-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.field-row { margin-bottom: 14px; }
.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.field-cell { display: flex; flex-direction: column; gap: 4px; }
.field-cell label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-cell .input { height: 32px; }
.field-hint { font-size: 11px; line-height: 1.4; margin-top: 2px; }
.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
}
.checkbox-row input[type="checkbox"] { margin-top: 3px; flex: none; }

.field-section {
    border-top: 1px solid var(--border-soft);
    padding-top: 14px;
    margin-top: 6px;
}
.field-section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    margin-bottom: 10px;
}

.modal-edit-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-soft);
    background: var(--surface-2);
}

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

/* ═══ Excel workflow (import/export buttons block) ═══ */

.excel-workflow {
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
}
.excel-workflow-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.excel-workflow-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.excel-import-form { display: inline-flex; }

/* ═══ Floating SAM chat panel ═══ */

.sam-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 900;
}
.sam-chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 8px 8px;
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    box-shadow: var(--sh-lg);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.sam-chat-toggle:hover { transform: translateY(-2px); box-shadow: var(--sh-xl); }
.sam-chat-toggle img {
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid var(--gold);
}
.sam-chat-panel {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    flex-direction: column;
    overflow: hidden;
}
.sam-chat:not(.collapsed) .sam-chat-panel { display: flex; }
.sam-chat:not(.collapsed) .sam-chat-toggle { display: none; }

.sam-chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--azur-deep), var(--azur));
    color: #fff;
}
.sam-chat-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid var(--gold);
}
.sam-chat-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.sam-chat-status { font-size: 11px; opacity: 0.85; }
.sam-chat-header .btn-icon { color: #fff; }

.sam-chat-messages {
    flex: 1; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    background: var(--surface-2);
}

.chat-welcome {
    text-align: center; padding: 30px 20px;
    color: var(--text-3);
}
.chat-welcome img {
    width: 56px; height: 56px; border-radius: 50%;
    border: 2px solid var(--gold);
    margin-bottom: 10px;
}
.chat-welcome p { font-size: 13px; line-height: 1.5; }

.chat-msg {
    display: flex; align-items: flex-end; gap: 8px;
}
.chat-msg-sam { align-self: flex-start; max-width: 85%; }
.chat-msg-user { align-self: flex-end; max-width: 85%; flex-direction: row-reverse; }
.chat-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    flex: none;
}
.chat-msg-avatar-user {
    background: linear-gradient(145deg, var(--azur-light), var(--azur-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 11px;
}
.chat-msg-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
}
.chat-msg-sam .chat-msg-bubble {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-bottom-left-radius: 4px;
    color: var(--text);
}
.chat-msg-user .chat-msg-bubble {
    background: var(--azur);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
}

.sam-chat-input {
    padding: 12px;
    border-top: 1px solid var(--border-soft);
    display: flex; gap: 8px;
    background: #fff;
}
.sam-chat-input input {
    flex: 1;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    padding: 0 14px;
    height: 36px;
    font-size: 13px;
    outline: none;
}
.sam-chat-input input:focus { border-color: var(--azur); }

/* ═══ Messaging hub ═══ */

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

.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.msg-row:hover {
    background: var(--surface-2);
    border-color: var(--azur-light);
    transform: translateX(2px);
}

.msg-avatar { flex: none; }
.msg-body { flex: 1; min-width: 0; }
.msg-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.msg-project {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--ink);
}
.msg-date {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--text-3);
}
.msg-preview {
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.msg-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.msg-arrow {
    color: var(--text-3);
    align-self: center;
}


/* ═══ LLM AI panel (legacy) ═══ */

.llm-panel {
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--azur-paler) 0%, var(--gold-pale) 100%);
    border: 1px solid var(--azur-light);
    border-radius: var(--r-md);
    margin-top: 14px;
}
.llm-panel-head { display: flex; align-items: center; gap: 14px; }
.llm-panel-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    margin-bottom: 2px;
}

/* ═══ LLM optional (discreet collapsible trigger) ═══ */

.llm-optional {
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    margin-bottom: 16px;
    overflow: hidden;
}
.llm-optional-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    list-style: none;
    color: var(--text-2);
}
.llm-optional-summary::-webkit-details-marker { display: none; }
.llm-optional-summary:hover { background: var(--surface-3); }

.llm-optional-icon {
    display: inline-flex;
    color: var(--gold-dark);
}
.llm-optional-label {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink);
}
.llm-optional-chevron {
    margin-left: auto;
    color: var(--text-3);
    transition: transform var(--dur) var(--ease);
}
.llm-optional[open] .llm-optional-chevron { transform: rotate(90deg); }

.llm-optional-body {
    padding: 0 14px 14px 14px;
    border-top: 1px solid var(--border-soft);
    padding-top: 12px;
}

/* ═══ Recommendations (05) ═══ */

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

.rec-card {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: box-shadow var(--dur) var(--ease);
}
.rec-card:hover { box-shadow: var(--sh-md); }

.rec-card-priority {
    width: 5px;
    flex: none;
}
.rec-card-priority-critical { background: var(--danger); }
.rec-card-priority-high     { background: var(--warning); }
.rec-card-priority-medium   { background: var(--gold); }
.rec-card-priority-low      { background: var(--azur); }
.rec-card-priority-info     { background: var(--text-3); }

.rec-card-body { flex: 1; padding: 14px 18px; }
.rec-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.rec-card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    margin: 4px 0 6px;
}
.rec-card-desc {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.55;
    margin: 0 0 8px;
}
.rec-card-rationale {
    padding: 10px 12px;
    background: var(--surface-2);
    border-left: 3px solid var(--azur-light);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    margin: 8px 0;
    font-size: 12.5px;
    color: var(--text);
}
.rec-card-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 8px 0;
}
.rec-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

/* Timeline */
.rec-timeline {
    position: relative;
    padding-left: 24px;
}
.rec-timeline::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-soft);
}
.rec-timeline-item {
    position: relative;
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.rec-timeline-marker {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--azur);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    color: var(--ink);
    z-index: 1;
}
.rec-timeline-marker.rec-card-priority-critical { border-color: var(--danger); }
.rec-timeline-marker.rec-card-priority-high     { border-color: var(--warning); }
.rec-timeline-marker.rec-card-priority-medium   { border-color: var(--gold); }
.rec-timeline-marker.rec-card-priority-low      { border-color: var(--azur); }

.rec-timeline-body {
    flex: 1;
    margin-left: 32px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
}
.rec-timeline-head {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}
.rec-timeline-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 8px;
}
.rec-timeline-action,
.rec-timeline-comment {
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
}
.rec-timeline-action > span,
.rec-timeline-comment > span { display: block; margin-bottom: 2px; }

/* ═══ Risk register (03 Risques) ═══ */

.risk-filters .risk-filter { transition: all var(--dur-fast) var(--ease); }

.risk-register-table .safety-badge { margin-right: 0; }

.risk-sev-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: -1px;
}
.risk-sev-5 { background: var(--danger); }
.risk-sev-4 { background: var(--warning); }
.risk-sev-3 { background: var(--gold); }
.risk-sev-2 { background: var(--azur-light); }
.risk-sev-1 { background: var(--success); }

/* ═══ Safety sub-tabs (FHA / FMEA / FMES / FTA / CCA) ═══ */

.safety-subtabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--surface-2);
    padding: 6px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    overflow-x: auto;
}
.safety-subtab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 13px;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
    white-space: nowrap;
}
.safety-subtab:hover { background: var(--surface); color: var(--ink); }
.safety-subtab.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--sh-sm);
    font-weight: 500;
}
.safety-subtab .safety-badge {
    margin-right: 0;
    vertical-align: 0;
}
.safety-subtab-count {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--surface-3);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--r-pill);
    min-width: 22px;
    text-align: center;
}
.safety-subtab.active .safety-subtab-count {
    background: var(--azur-pale);
    color: var(--azur-dark);
}

/* ═══ Safety hub badges (FHA / FMEA / FMES / FTA / CCA) ═══ */

.safety-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: 2px;
    color: #fff;
}
.safety-badge-fha  { background: var(--danger); }
.safety-badge-fmea { background: var(--azur); }
.safety-badge-fmes { background: var(--gold-dark); }
.safety-badge-fta  { background: var(--warning); }
.safety-badge-cca  { background: var(--ink); }

/* ═══ TAT breakdown (horizontal chain) ═══ */

.tat-breakdown {
    display: flex;
    align-items: stretch;
    gap: 4px;
    flex-wrap: wrap;
}

.tat-step {
    flex: 1 1 130px;
    min-width: 110px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface-2);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tat-step-highlight {
    background: var(--azur-pale);
    border-color: var(--azur-light);
}
.tat-step-total {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.tat-step-total .tat-step-label,
.tat-step-total .tat-step-value strong { color: #fff; }
.tat-step-total .tat-step-detail { color: rgba(255,255,255,0.7) !important; }

.tat-step-icon {
    color: var(--azur);
    display: flex;
    justify-content: center;
}
.tat-step-highlight .tat-step-icon { color: var(--azur-dark); }
.tat-step-total .tat-step-icon { color: var(--gold-light); }

.tat-step-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 12px;
    color: var(--ink);
}
.tat-step-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}
.tat-step-total .tat-step-value { font-size: 18px; }
.tat-step-detail {
    font-size: 10.5px;
    line-height: 1.3;
}

.tat-arrow {
    display: flex;
    align-items: center;
    color: var(--text-3);
    font-size: 18px;
    font-weight: 700;
    padding: 0 2px;
}
.tat-arrow-final {
    color: var(--ink);
    font-size: 22px;
}

@media (max-width: 1100px) {
    .tat-arrow { display: none; }
}

/* ═══ Maintainability / Availability formulas ═══ */

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.formula-item {
    font-size: 12.5px;
    color: var(--text-2);
    font-family: var(--font-mono);
    line-height: 1.6;
}
.formula-item strong { color: var(--ink); }

.avail-formulas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.avail-formula {
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface-2);
}
.avail-formula-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    margin-bottom: 8px;
}
.avail-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    min-width: 32px;
    text-align: center;
}
.avail-badge-i  { background: var(--success); }
.avail-badge-si { background: var(--azur); }
.avail-badge-s  { background: var(--warning); }
.avail-badge-o  { background: var(--ink); }

.avail-formula-eq {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--azur-dark);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 8px 10px;
    margin-bottom: 8px;
}
.avail-formula-detail {
    font-size: 12px;
    line-height: 1.5;
}

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

/* ═══ Pareto chart (horizontal bars by function) ═══ */

.pareto-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pareto-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 5px 0;
}

.pareto-row-label {
    flex: 0 0 380px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
    font-size: 12.5px;
    overflow: hidden;
}
.pareto-row-label > .chip-mono,
.pareto-row-label > .chip { flex: 0 0 auto; }
.pareto-row-name {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ink);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pareto-row-bar-wrap {
    flex: 1 1 auto;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
    height: 14px;
    position: relative;
    min-width: 200px;
}
.pareto-row-bar {
    height: 100%;
    background: var(--azur-light);
    min-width: 4px;
    transition: width 400ms var(--ease);
}
.pareto-row-bar-value {
    display: none;
}

.pareto-row-critical .pareto-row-bar { background: var(--danger); }

.pareto-row-stats {
    flex: 0 0 210px;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 12px;
    font-family: var(--font-mono);
    line-height: 1.2;
    white-space: nowrap;
}
.pareto-row-stats .pareto-fit {
    font-size: 11.5px;
    color: var(--text-2);
    white-space: nowrap;
}
.pareto-row-stats .pareto-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    min-width: 42px;
    text-align: right;
    white-space: nowrap;
}
.pareto-row-stats .pareto-cum {
    font-size: 10px;
    color: var(--text-3);
    white-space: nowrap;
}

.pareto-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--text-2);
    flex-wrap: wrap;
}
.pareto-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pareto-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

@media (max-width: 900px) {
    .pareto-row { flex-direction: column; align-items: stretch; gap: 4px; }
    .pareto-row-label, .pareto-row-bar-wrap, .pareto-row-stats { flex: 1 1 auto; }
    .pareto-row-stats { text-align: left; }
}

/* Export tiles */
.export-tile {
    padding: 20px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--surface-2);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.export-tile .export-icon { color: var(--azur); margin-bottom: 4px; }
.export-tile h4 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    margin: 0;
}
.export-tile p { margin: 0; }
.export-tile .btn { margin-top: auto; }

/* Compliance matrix table */
.compliance-table th { white-space: nowrap; }
.compliance-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.cell-chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.compliance-chip-fp { background: var(--azur); color: #fff; border: 0; }
.compliance-chip-fc { background: var(--warning); color: #fff; border: 0; }
.compliance-chip-ft { background: var(--success); color: #fff; border: 0; }

/* Justification cell */
.compliance-justif {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-2);
    white-space: normal;
}
.compliance-evidence {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Row left border per status */
.compliance-row-compliant td:first-child     { border-left: 3px solid var(--success); }
.compliance-row-partial td:first-child       { border-left: 3px solid var(--warning); }
.compliance-row-non_compliant td:first-child { border-left: 3px solid var(--danger); }
.compliance-row-not_applicable td:first-child { border-left: 3px solid var(--text-3); opacity: 0.85; }

/* Section label above each FAST branch (FP / FC) */
.func-section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 10px;
}

/* Subtle background tint per FAST level */
.func-node-fp { background: linear-gradient(to right, var(--azur-paler), var(--surface)); }
.func-node-fc { background: linear-gradient(to right, var(--gold-pale), var(--surface)); }
.func-node-ft .func-node-head { background: var(--surface); }
.func-node-sf {
    background: var(--surface-2);
    border-style: dashed;
}
