body { background: #f5f6f8; }
.card { border: 1px solid #e2e6ea; border-radius: 0.75rem; box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.04); }
.stat-card { min-height: 120px; }
.stat-label { color: #6c757d; font-size: 0.9rem; margin-bottom: 0.35rem; }
.stat-value { font-size: 2rem; font-weight: 700; }
.table th { white-space: nowrap; }
.table td { vertical-align: middle; }
.preview-text { max-height: 320px; overflow: auto; background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 0.5rem; padding: 0.75rem; font-size: 0.85rem; white-space: pre-wrap; }
.table-scroll { max-height: 680px; overflow: auto; }
.small-dl dt, .small-dl dd { padding-top: 0.25rem; padding-bottom: 0.25rem; border-bottom: 1px solid #f1f3f5; }
code { color: #212529; background: #eef1f4; padding: 0.1rem 0.25rem; border-radius: 0.25rem; }

.kpi-card {
    border-left: 4px solid #0d6efd;
}


/* Analyse financière : mise en page responsive et sélection d'exercices */
.analysis-page {
    max-width: 1800px;
}

.analysis-header h1 {
    line-height: 1.1;
}

.analysis-header-actions .btn {
    white-space: nowrap;
}

.analysis-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.analysis-sidebar {
    position: sticky;
    top: 0.75rem;
    z-index: 1020;
    align-self: start;
    min-width: 0;
}

.analysis-exercise-card {
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
}

.analysis-exercise-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.analysis-exercise-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.45rem;
    align-items: start;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: .5rem;
    padding: .55rem .65rem;
    background: #fff;
    cursor: pointer;
    width: 100%;
}

.analysis-exercise-item:hover {
    background: #f8f9fa;
}

.analysis-exercise-item .form-check-input {
    margin-top: .25rem;
}

.analysis-ajax-status {
    min-height: 1.25rem;
}

.analysis-main {
    min-width: 0;
    overflow: hidden;
}

.analysis-main.is-updating {
    opacity: .6;
    pointer-events: none;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 260px;
    max-height: 40vh;
}

.chart-container.chart-container-sm {
    height: 220px;
}

.chart-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.analysis-main .table-responsive {
    overflow-x: auto;
}

.analysis-main table {
    font-size: .92rem;
}

.analysis-main .table th,
.analysis-main .table td {
    white-space: nowrap;
}

.analysis-main .table td:first-child,
.analysis-main .table th:first-child {
    white-space: normal;
    min-width: 105px;
}

html {
    scroll-behavior: auto !important;
}

@media (max-width: 1199.98px) {
    .analysis-layout {
        grid-template-columns: 205px minmax(0, 1fr);
        gap: .85rem;
    }

    .analysis-main table {
        font-size: .86rem;
    }

    .chart-container {
        height: 230px;
    }

    .chart-container.chart-container-sm {
        height: 205px;
    }
}

@media (max-width: 767.98px) {
    .analysis-layout {
        display: block;
    }

    .analysis-sidebar {
        position: static;
        margin-bottom: 1rem;
    }

    .analysis-exercise-card {
        max-height: none;
    }

    .analysis-exercise-list {
        display: flex;
        flex-direction: column;
    }

    .analysis-header-actions {
        width: 100%;
    }

    .analysis-header-actions .btn {
        flex: 1 1 160px;
    }

    .chart-container,
    .chart-container.chart-container-sm {
        height: 210px;
        max-height: none;
    }
}

@media (max-width: 575.98px) {
    .analysis-page {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }

    .analysis-exercise-card .card-body {
        padding: .75rem;
    }

    .analysis-exercise-item {
        padding: .45rem .55rem;
    }

    .chart-container,
    .chart-container.chart-container-sm {
        height: 185px;
    }

    .stat-value {
        font-size: 1.45rem;
    }
}

/* V7 - Seuil de rentabilité */
.profitability-page .sticky-side-panel {
    position: sticky;
    top: 1rem;
}

.profitability-page .chart-card-body {
    height: 360px;
    min-height: 280px;
}

.profitability-table th,
.profitability-table td {
    white-space: nowrap;
}

@media (max-width: 1199.98px) {
    .profitability-page .sticky-side-panel {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .profitability-page .chart-card-body {
        height: 280px;
    }
}

/* Seuil de rentabilité : graphique mensuel et double saisie % / montant */
.profitability-page .sr-input-group {
    max-width: 120px;
    margin-left: auto;
}

.profitability-page .sr-money-input-group {
    max-width: 145px;
}

.profitability-page .sr-chart-card-body {
    height: 430px;
    min-height: 320px;
}

.profitability-page .sr-monthly-table {
    font-size: 0.86rem;
}

.profitability-page .sr-monthly-table th,
.profitability-page .sr-monthly-table td {
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .profitability-page .sr-chart-card-body {
        height: 340px;
    }

    .profitability-page .profitability-table {
        min-width: 760px;
    }
}

/* V8 - Module taux horaire */
.hourly-rate-page .sticky-side-panel {
    position: sticky;
    top: 1rem;
}

.hourly-rate-page .hourly-chart-body {
    height: 340px;
    min-height: 260px;
}

.hourly-rate-page .small-dl dt,
.hourly-rate-page .small-dl dd {
    padding-top: .35rem;
    padding-bottom: .35rem;
}

@media (max-width: 1199.98px) {
    .hourly-rate-page .sticky-side-panel {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .hourly-rate-page .hourly-chart-body {
        height: 280px;
    }
}

/* V9 - Trésorerie prévisionnelle */
.cashflow-page .sticky-side-panel {
    position: sticky;
    top: 1rem;
}

.cashflow-chart-body {
    height: 320px;
    min-height: 260px;
}

.cashflow-chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.cashflow-table-wrap {
    max-height: 680px;
    overflow: auto;
}

.cashflow-table {
    min-width: 1900px;
    font-size: 0.82rem;
}

.cashflow-table th,
.cashflow-table td {
    white-space: nowrap;
}

.cashflow-table input {
    min-width: 95px;
}

.cashflow-table td:first-child input {
    min-width: 90px;
}

@media (max-width: 1199.98px) {
    .cashflow-page .sticky-side-panel {
        position: static;
    }

    .cashflow-chart-body {
        height: 280px;
    }
}

@media (max-width: 767.98px) {
    .cashflow-chart-body {
        height: 240px;
    }
}

/* V9.1 - aide trésorerie prévisionnelle */
.cashflow-method-note code {
    white-space: normal;
}

.cashflow-table th[data-help],
.cashflow-table input[data-help],
.cashflow-page [data-help] {
    cursor: help;
}

.cashflow-page th[data-help]::after {
    content: " ?";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    margin-left: .25rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
    opacity: .72;
}

.cashflow-page [data-help]:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.cashflow-long-tooltip {
    position: absolute;
    z-index: 3000;
    max-width: 360px;
    padding: .65rem .75rem;
    border-radius: .5rem;
    background: #212529;
    color: #fff;
    font-size: .86rem;
    line-height: 1.35;
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .25);
    pointer-events: none;
}

.sr-cost-structure-chart {
    height: 210px;
}

.sr-cost-structure-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.hourly-hypotheses-card .card-body {
    padding: 1.25rem;
}

.hourly-hypotheses-form > h2 {
    margin: 1.25rem 0 .65rem;
    color: #16355c;
    font-size: 1rem;
}

.hourly-hypotheses-form > h2:first-of-type {
    margin-top: 0;
}

.hourly-hypotheses-form .alert {
    margin-bottom: .85rem;
    padding: .65rem .8rem;
}

.hourly-input-grid {
    margin-right: 0;
    margin-left: 0;
    padding: .85rem;
    border: 1px solid #e3e9f0;
    border-radius: .45rem;
    background: #f8fafc;
}

.hourly-input-grid .form-label {
    margin-bottom: .25rem;
    color: #38516f;
    font-size: .78rem;
    font-weight: 600;
}

.hourly-input-grid .form-control,
.hourly-input-grid .input-group-text {
    min-height: 2.05rem;
    font-size: .9rem;
}

.chantier-charts-page .chantier-chart-frame {
    position: relative;
    height: 340px;
}

.chantier-charts-page .chantier-hours-chart {
    height: 250px;
}

.chantier-charts-page .chantier-input-table th {
    min-width: 220px;
}

.chantier-charts-page .chantier-input-table td {
    min-width: 155px;
}

@media (min-width: 992px) {
    .hourly-hypotheses-card .card-body {
        padding: 1.5rem;
    }
}

@media (min-width: 992px) {
    .border-lg-start {
        border-left: 1px solid var(--bs-border-color) !important;
    }
}

.cashflow-page .form-text {
    font-size: .78rem;
}

.cashflow-page .cashflow-table-wrap {
    border-radius: 0 0 .75rem .75rem;
}

@media (max-width: 767.98px) {
    .cashflow-long-tooltip {
        max-width: calc(100vw - 24px);
        font-size: .82rem;
    }
}

/* V9.5 - navigation et architecture générale */
.app-navbar {
    box-shadow: 0 .125rem .35rem rgba(0, 0, 0, .12);
}

.app-page .page-header {
    border-bottom: 1px solid #e6e9ed;
    padding-bottom: 1rem;
}

.app-table th,
.app-table td {
    vertical-align: middle;
}

.document-filename {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.society-card .card-footer {
    border-top: 1px solid #eef1f4;
}

.dashboard-page .stat-card,
.societies-page .society-card {
    transition: transform .12s ease, box-shadow .12s ease;
}

.dashboard-page .stat-card:hover,
.societies-page .society-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 .35rem .75rem rgba(0, 0, 0, .075);
}

@media (max-width: 991.98px) {
    .app-navbar .dropdown-menu {
        border: 0;
        box-shadow: none;
    }

    .document-filename {
        max-width: 220px;
    }
}

@media (max-width: 575.98px) {
    .app-page {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .document-filename {
        max-width: 160px;
    }

    .society-card .btn,
    .page-header .btn,
    .dashboard-page .btn {
        width: 100%;
    }
}

/* V9.6 - Sélection société dans le menu principal */
.nav-societe-selector select {
    min-width: 220px;
    max-width: 280px;
}

@media (max-width: 991.98px) {
    .nav-societe-selector {
        width: 100%;
        align-items: stretch !important;
        flex-wrap: wrap;
        margin-top: .75rem;
    }

    .nav-societe-selector select {
        flex: 1 1 220px;
        max-width: none;
    }
}

/* V9.8 - Correction du recouvrement par le menu principal */
:root {
    --app-navbar-height: 56px;
    --app-sticky-offset: calc(var(--app-navbar-height) + 1rem);
}

html {
    scroll-padding-top: var(--app-sticky-offset);
}

.app-navbar {
    min-height: var(--app-navbar-height);
    z-index: 1040;
}

/* Les panneaux sticky internes doivent commencer sous la barre principale,
   sinon ils passent derrière le menu au scroll. */
.analysis-sidebar,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    top: var(--app-sticky-offset) !important;
}

.analysis-exercise-card {
    max-height: calc(100vh - var(--app-sticky-offset) - 1rem);
}

.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    max-height: calc(100vh - var(--app-sticky-offset) - 1rem);
    overflow-y: auto;
}

/* Garde un peu d'air sous le menu lorsque la page est appelée depuis une ancre. */
[id] {
    scroll-margin-top: var(--app-sticky-offset);
}

@media (max-width: 1199.98px) {
    .analysis-sidebar,
    .profitability-page .sticky-side-panel,
    .hourly-rate-page .sticky-side-panel,
    .cashflow-page .sticky-side-panel {
        top: auto !important;
        max-height: none;
        overflow-y: visible;
    }
}

/* V9.9 - Gestion documentaire avancée */
.documents-page .documents-toolbar {
    position: sticky;
    top: var(--app-navbar-height, 56px);
    z-index: 1010;
}

.documents-select-col {
    width: 42px;
    text-align: center;
}

.documents-table .document-filename {
    min-width: 230px;
    max-width: 360px;
    overflow-wrap: anywhere;
}

.documents-page .table-responsive {
    max-height: calc(100vh - 260px);
    overflow: auto;
}

.documents-page .app-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
}

@media (max-width: 991.98px) {
    .documents-page .documents-toolbar {
        position: static;
    }

    .documents-page .table-responsive {
        max-height: none;
    }
}

/* V9.10 - Gestion complète des sociétés et menu principal centré */
@media (min-width: 992px) {
    .app-navbar .navbar-collapse {
        display: flex !important;
        align-items: center;
    }

    .app-navbar .navbar-nav {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .app-navbar .nav-societe-selector {
        margin-left: 0 !important;
    }
}

.societies-page .society-card-active {
    border-color: rgba(13, 110, 253, .55);
    box-shadow: 0 .25rem .75rem rgba(13, 110, 253, .12);
}

.societies-page .society-card .card-footer .btn {
    min-width: fit-content;
}

@media (max-width: 767.98px) {
    .societies-page .society-card .card-footer .btn,
    .societies-page .card .btn {
        width: 100%;
    }
}

/* V10 - Assistant REAB */
.assistant-reab-page .assistant-panel {
    top: calc(var(--app-navbar-height, 56px) + 1rem);
}

.assistant-answer p:last-child {
    margin-bottom: 0;
}

.assistant-key-point {
    border: 1px solid #e2e6ea;
    border-radius: .75rem;
    padding: .75rem .9rem;
    background: #f8f9fa;
    min-height: 56px;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.assistant-prompt {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: .86rem;
    background: #f8f9fa;
}

@media (max-width: 991.98px) {
    .assistant-reab-page .assistant-panel {
        position: static;
    }
}

/* V10.1 - Assistant REAB API OpenAI */
.assistant-settings-page code {
    white-space: normal;
}

.assistant-ai-answer {
    font-size: 1rem;
    line-height: 1.55;
}

.assistant-ai-answer p:last-child {
    margin-bottom: 0;
}

/* V10.2 - rendu lisible des réponses IA */
.ai-response {
    font-size: 1rem;
    line-height: 1.65;
}

.ai-response h1,
.ai-response h2,
.ai-response h3,
.ai-response h4 {
    margin-top: 1.25rem;
    margin-bottom: .65rem;
    font-weight: 700;
    line-height: 1.25;
}

.ai-response h1:first-child,
.ai-response h2:first-child,
.ai-response h3:first-child {
    margin-top: 0;
}

.ai-response h1 { font-size: 1.55rem; }
.ai-response h2 { font-size: 1.35rem; border-bottom: 1px solid #e9ecef; padding-bottom: .35rem; }
.ai-response h3 { font-size: 1.15rem; }
.ai-response h4 { font-size: 1.05rem; }

.ai-response p {
    margin-bottom: .85rem;
}

.ai-response ul,
.ai-response ol {
    margin-bottom: 1rem;
    padding-left: 1.35rem;
}

.ai-response li {
    margin-bottom: .35rem;
}

.ai-response blockquote {
    border-left: 4px solid #0d6efd;
    background: #f8f9fa;
    margin: 1rem 0;
    padding: .75rem 1rem;
    border-radius: .35rem;
    color: #212529;
}

.ai-response code {
    white-space: normal;
}

.ai-response hr {
    margin: 1.5rem 0;
    opacity: .15;
}

.assistant-prompt {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .86rem;
    min-height: 420px;
}

.assistant-context-json {
    max-height: 520px;
    overflow: auto;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: .5rem;
    padding: 1rem;
    font-size: .82rem;
    white-space: pre-wrap;
}

/* V10.3 - Chatbot IA global */
.ai-chat-widget {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 2500;
    font-size: .95rem;
}

.ai-chat-toggle {
    border: 0;
    border-radius: 999px;
    background: #0d6efd;
    color: #fff;
    box-shadow: 0 .5rem 1.25rem rgba(13, 110, 253, .28);
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .65rem .95rem;
    font-weight: 600;
}

.ai-chat-toggle:hover {
    background: #0b5ed7;
}

.ai-chat-toggle-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    letter-spacing: .02em;
}

.ai-chat-panel {
    position: absolute;
    right: 0;
    bottom: 3.8rem;
    width: min(440px, calc(100vw - 2rem));
    max-height: min(720px, calc(100vh - 6rem));
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 1rem;
    box-shadow: 0 1rem 2.5rem rgba(0,0,0,.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ai-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ai-chat-context {
    padding: .55rem 1rem;
    border-bottom: 1px solid #eef1f4;
    color: #6c757d;
    background: #fff;
}

.ai-chat-messages {
    padding: 1rem;
    overflow-y: auto;
    min-height: 220px;
    max-height: 430px;
    background: #f5f6f8;
}

.ai-chat-message {
    margin-bottom: .85rem;
}

.ai-chat-message-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    margin-bottom: .25rem;
}

.ai-chat-message-body {
    border-radius: .85rem;
    padding: .75rem .85rem;
    line-height: 1.45;
    background: #fff;
    border: 1px solid #e9ecef;
}

.ai-chat-message-user .ai-chat-message-body {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.ai-chat-message-body h1,
.ai-chat-message-body h2,
.ai-chat-message-body h3 {
    margin-top: .8rem;
    margin-bottom: .45rem;
    line-height: 1.2;
}

.ai-chat-message-body h1 { font-size: 1.25rem; }
.ai-chat-message-body h2 { font-size: 1.12rem; }
.ai-chat-message-body h3 { font-size: 1rem; }
.ai-chat-message-body p:last-child { margin-bottom: 0; }
.ai-chat-message-body ul,
.ai-chat-message-body ol { padding-left: 1.25rem; margin-bottom: .65rem; }
.ai-chat-message-body blockquote {
    border-left: 4px solid #ced4da;
    padding-left: .75rem;
    color: #495057;
    margin: .65rem 0;
}

.ai-chat-form {
    padding: .85rem 1rem 1rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.ai-chat-form textarea {
    resize: vertical;
    min-height: 72px;
    max-height: 160px;
}

.ai-chat-model {
    border-bottom: 1px solid #eef1f4;
    padding-bottom: .35rem;
}

@media (max-width: 575.98px) {
    .ai-chat-widget {
        right: .75rem;
        bottom: .75rem;
    }
    .ai-chat-toggle-text {
        display: none;
    }
    .ai-chat-panel {
        right: -.25rem;
        bottom: 3.4rem;
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 5rem);
    }
    .ai-chat-messages {
        max-height: calc(100vh - 18rem);
    }
}

/* V10.4 - Assistant REAB hub et chatbot multi-fournisseurs */
.assistant-status-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    border: 1px solid #e2e6ea;
    border-radius: .75rem;
    background: #fff;
    padding: .75rem 1rem;
    box-shadow: 0 .125rem .35rem rgba(0, 0, 0, .04);
}

.assistant-hub-tile,
.assistant-hub-feature,
.assistant-provider-line {
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    background: #f8f9fa;
    padding: .85rem;
}

.assistant-hub-feature {
    text-align: center;
    font-weight: 600;
    color: #495057;
}

.assistant-provider-line {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: flex-start;
    margin-bottom: .65rem;
}

.ai-chat-settings {
    padding: .75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #eef1f4;
}

.ai-chat-settings .form-label {
    color: #495057;
    font-weight: 600;
}

.ai-chat-settings-toggle {
    line-height: 1;
}

.assistant-settings-page .table td,
.assistant-settings-page .table th {
    vertical-align: middle;
}

/* V10.5 - Gestion des prompts Assistant REAB */
.assistant-prompt-accordion .accordion-button {
    gap: .35rem;
    flex-wrap: wrap;
}

.assistant-prompt-textarea {
    min-height: 140px;
    font-family: Consolas, 'Courier New', monospace;
    font-size: .9rem;
}

.assistant-prompt-form .form-text {
    font-size: .78rem;
}

/* V10.6 - Historique chatbot et confort de lecture */
.ai-chat-open-conversation[hidden] {
    display: none !important;
}

.ai-chat-message-typing .ai-chat-message-body::after {
    content: "▌";
    display: inline-block;
    margin-left: .1rem;
    animation: aiBlinkCursor .9s steps(1) infinite;
}

@keyframes aiBlinkCursor {
    50% { opacity: 0; }
}

.assistant-history-list {
    display: grid;
    gap: .65rem;
}

.assistant-history-item {
    display: block;
    padding: .7rem .8rem;
    border: 1px solid #e9ecef;
    border-radius: .65rem;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.assistant-history-item:hover {
    border-color: #b6d4fe;
    background: #f8fbff;
}

.assistant-history-summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.assistant-history-table td {
    vertical-align: top;
}

.assistant-conversation-thread {
    display: grid;
    gap: 1rem;
}

.assistant-thread-message {
    border: 1px solid #e6e9ed;
    border-radius: .85rem;
    background: #fff;
    overflow: hidden;
}

.assistant-thread-user {
    border-left: 4px solid #0d6efd;
}

.assistant-thread-assistant {
    border-left: 4px solid #198754;
}

.assistant-thread-label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem .85rem;
    background: #f8f9fa;
    font-size: .86rem;
    font-weight: 600;
}

.assistant-thread-body {
    padding: 1rem;
}

.assistant-thread-body .ai-response > :last-child {
    margin-bottom: 0;
}

@media (max-width: 767.98px) {
    .assistant-thread-label {
        flex-direction: column;
        gap: .15rem;
    }
}

/* V10.7 - Gestion collections et vitesse chatbot */
.assistant-collection-admin .accordion-button {
    font-size: .9rem;
}

.assistant-collection-admin .accordion-body {
    padding: .85rem;
}

.assistant-history-table td:last-child {
    min-width: 150px;
}

.ai-chat-message-typing .ai-chat-message-body::after {
    content: "▌";
    display: inline-block;
    margin-left: .1rem;
    animation: ai-caret-blink 1s step-end infinite;
}

@keyframes ai-caret-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* V10.9 - Oral blanc REAB */
.oral-reab-page .oral-question-text {
    font-size: 1.15rem;
    line-height: 1.55;
    font-weight: 600;
}

.oral-reab-page .oral-answer-textarea {
    min-height: 220px;
    line-height: 1.5;
}

.oral-reab-page .lead-sm {
    font-size: 1.03rem;
    line-height: 1.55;
}

.oral-feedback-box {
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    padding: 1rem;
    height: 100%;
    background: #fff;
}

.oral-feedback-positive {
    border-left: 4px solid #198754;
}

.oral-feedback-warning {
    border-left: 4px solid #ffc107;
}

.oral-method-step {
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    padding: .9rem;
    height: 100%;
    background: #f8f9fa;
}

.oral-method-step strong {
    display: block;
    margin-bottom: .35rem;
}

.oral-method-step span {
    color: #6c757d;
    font-size: .9rem;
}

/* V10.9.7 - Analyse SIG */
.sig-analysis-page .sig-flow {
    display: flex;
    align-items: stretch;
    gap: .75rem;
    overflow-x: auto;
    padding-bottom: .25rem;
}

.sig-analysis-page .sig-flow-step {
    min-width: 170px;
    border: 1px solid #e5e7eb;
    border-radius: .85rem;
    background: #fff;
    padding: .9rem;
    box-shadow: 0 .25rem .75rem rgba(15, 23, 42, .04);
}

.sig-analysis-page .sig-flow-label {
    font-size: .78rem;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: .03em;
    margin-bottom: .4rem;
}

.sig-analysis-page .sig-flow-value {
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}

.sig-analysis-page .sig-flow-meta {
    margin-top: .25rem;
    color: #6c757d;
    font-size: .85rem;
}

.sig-analysis-page .sig-flow-arrow {
    display: flex;
    align-items: center;
    color: #adb5bd;
    font-size: 1.5rem;
    font-weight: 700;
}

@media (max-width: 992px) {
    .sig-analysis-page .sig-flow-arrow {
        display: none;
    }

    .sig-analysis-page .sig-flow {
        flex-wrap: nowrap;
    }
}

/* V10.9.13.6 - Navigation latérale globale */
:root {
    --app-sidebar-width: 284px;
    --app-mobile-topbar-height: 56px;
    --app-navbar-height: 0px;
    --app-sticky-offset: 1rem;
}

.app-shell-body {
    background: #f5f6f8;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--app-sidebar-width);
    z-index: 1060;
    background: #fff;
    border-right: 1px solid #dde3ea;
    box-shadow: .25rem 0 1rem rgba(15, 23, 42, .06);
}

.app-sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-sidebar-brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1rem .85rem;
    border-bottom: 1px solid #eef1f4;
}

.app-sidebar-title {
    color: #111827;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.app-sidebar-subtitle {
    color: #6b7280;
    font-size: .78rem;
    margin-top: .2rem;
}

.app-sidebar-societe {
    padding: .85rem 1rem;
    border-bottom: 1px solid #eef1f4;
    background: #fbfcfd;
}

.app-sidebar-nav {
    padding: .65rem .75rem 1rem;
    overflow-y: auto;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.app-sidebar-group {
    margin-top: .75rem;
}

.app-sidebar-group:first-child {
    margin-top: 0;
}

.app-sidebar-group-title {
    color: #8a94a6;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .35rem .55rem .25rem;
}

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .52rem .65rem;
    border-radius: .65rem;
    color: #303846;
    text-decoration: none;
    font-size: .92rem;
    line-height: 1.2;
    margin: .08rem 0;
    transition: background .12s ease, color .12s ease, transform .12s ease;
}

.app-sidebar-link:hover {
    background: #f0f4f8;
    color: #0d6efd;
}

.app-sidebar-link.active {
    background: #e7f0ff;
    color: #0b5ed7;
    font-weight: 700;
}

.app-sidebar-link-primary {
    background: #0d6efd;
    color: #fff;
    font-weight: 700;
    margin-top: .35rem;
}

.app-sidebar-link-primary:hover {
    background: #0b5ed7;
    color: #fff;
}

.app-sidebar-icon {
    width: 1.35rem;
    min-width: 1.35rem;
    text-align: center;
    font-size: .98rem;
}


.app-sidebar-group-settings {
    margin-top: 1rem;
    padding-top: .65rem;
    border-top: 1px solid #eef1f4;
}

.app-sidebar-group-settings .app-sidebar-group-title {
    color: #8a94a6;
}

.app-sidebar-muted {
    color: #6c757d;
    font-size: .82rem;
    line-height: 1.35;
    padding: .4rem .65rem .55rem;
}

.app-main {
    margin-left: var(--app-sidebar-width);
    min-height: 100vh;
    padding: 1.25rem;
}

.app-mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1050;
    height: var(--app-mobile-topbar-height);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .85rem;
    background: #fff;
    border-bottom: 1px solid #dde3ea;
    box-shadow: 0 .125rem .35rem rgba(15, 23, 42, .08);
}

.app-mobile-brand {
    font-weight: 800;
    color: #111827;
    text-decoration: none;
    white-space: nowrap;
}

.app-mobile-societe {
    margin-left: auto;
    color: #6c757d;
    font-size: .84rem;
    min-width: 0;
}

.app-sidebar-backdrop {
    display: none;
}

/* Les anciens panneaux d'exercices deviennent le panneau contexte de la page. */
.analysis-sidebar .card,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    border-radius: .95rem;
    border-color: #dfe5ec;
    box-shadow: 0 .125rem .5rem rgba(15, 23, 42, .05);
}

.analysis-sidebar .card::before,
.profitability-page .sticky-side-panel::before,
.hourly-rate-page .sticky-side-panel::before,
.cashflow-page .sticky-side-panel::before {
    content: "Contexte de la page";
    display: block;
    padding: .72rem .9rem .45rem;
    color: #6b7280;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 1px solid #eef1f4;
    background: #fbfcfd;
    border-radius: .95rem .95rem 0 0;
}

.analysis-sidebar .card > .card-body,
.profitability-page .sticky-side-panel > .card-body,
.hourly-rate-page .sticky-side-panel > .card-body,
.cashflow-page .sticky-side-panel > .card-body {
    padding-top: .85rem;
}

.analysis-sidebar,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    top: var(--app-sticky-offset) !important;
}

.analysis-exercise-card,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    max-height: calc(100vh - 2rem);
}

@media (min-width: 1600px) {
    .app-main {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 991.98px) {
    :root {
        --app-navbar-height: var(--app-mobile-topbar-height);
        --app-sticky-offset: calc(var(--app-mobile-topbar-height) + 1rem);
    }

    .app-sidebar {
        transform: translateX(-105%);
        transition: transform .18s ease;
        width: min(86vw, var(--app-sidebar-width));
    }

    body.app-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.app-sidebar-open .app-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1055;
        background: rgba(15, 23, 42, .42);
    }

    .app-main {
        margin-left: 0;
        padding: 1rem;
    }

    .analysis-sidebar,
    .profitability-page .sticky-side-panel,
    .hourly-rate-page .sticky-side-panel,
    .cashflow-page .sticky-side-panel {
        top: auto !important;
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 575.98px) {
    .app-main {
        padding: .8rem;
    }

    .app-mobile-societe {
        display: none;
    }
}

/* V11.0.1 - Chatbot persistant : le bouton indique qu'une conversation est simplement réduite. */
.ai-chat-toggle.ai-chat-toggle-has-memory::after {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #198754;
    position: absolute;
    top: 8px;
    right: 8px;
    box-shadow: 0 0 0 2px rgba(255,255,255,.95);
}
.ai-chat-toggle {
    position: relative;
}
.ai-chat-message-body h1,
.ai-chat-message-body h2,
.ai-chat-message-body h3 {
    font-size: 1rem;
    margin-top: .65rem;
    margin-bottom: .35rem;
}
.ai-chat-message-body ul,
.ai-chat-message-body ol {
    padding-left: 1.1rem;
    margin-bottom: .5rem;
}

/* V14.1.1 - Import PDF simplifié avec glisser-déposer pleine page */
.import-pdf-page {
    position: relative;
}

.import-drop-zone {
    min-height: 340px;
    border: 2px dashed #9dbbf7;
    border-radius: 1.25rem;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.import-drop-zone:hover,
.import-drop-zone:focus,
.import-drop-zone.is-dragover {
    border-color: #0d6efd;
    background: #eef6ff;
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 18px 45px rgba(13, 110, 253, .16);
}

.import-drop-zone.has-file {
    border-color: #198754;
    background: #f5fff8;
}

.import-drop-zone-icon {
    width: 74px;
    height: 74px;
    border-radius: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    background: #e7f0ff;
    margin-bottom: 1rem;
}

.import-file-preview {
    border: 1px solid rgba(25, 135, 84, .25);
    background: #fff;
    border-radius: .8rem;
    padding: .85rem 1rem;
    max-width: 100%;
}

.import-drop-zone-help {
    font-size: .9rem;
    color: #667085;
    max-width: 560px;
}

.simple-import-steps {
    padding-left: 1.2rem;
}

.simple-import-steps li {
    margin-bottom: 1rem;
}

.simple-import-steps li:last-child {
    margin-bottom: 0;
}

.simple-import-steps span {
    color: #667085;
}

.import-page-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(248, 251, 255, .88);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.import-page-overlay.show {
    display: flex;
}

.import-page-overlay-inner {
    border: 2px dashed #0d6efd;
    background: #fff;
    border-radius: 1.25rem;
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .18);
}

.min-w-0 {
    min-width: 0;
}

/* V14.1.2 — mode simple société unique */
.app-sidebar-active-company {
    border: 1px solid rgba(13, 110, 253, .18);
    background: rgba(13, 110, 253, .07);
    color: #0b3d91;
    border-radius: .65rem;
    padding: .45rem .6rem;
    font-size: .9rem;
    font-weight: 600;
}

.simple-step-card,
.simple-action-card {
    display: block;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: 1rem;
    background: #fff;
    color: inherit;
    min-height: 100%;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.simple-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 110, 253, .35);
    box-shadow: 0 .5rem 1.5rem rgba(15, 23, 42, .08);
}

.simple-step-number,
.simple-action-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, .1);
    color: #0d6efd;
    font-weight: 700;
    margin-bottom: .75rem;
}

.simple-company-form {
    border-top: 1px solid #e9ecef;
    padding-top: 1.25rem;
}

/* V14.1.4 — Vue d'ensemble */
.overview-page .app-card {
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.overview-kpi {
    border-left: 4px solid #0d6efd;
}

.overview-kpi-success {
    border-left-color: #198754;
}

.overview-kpi-warning {
    border-left-color: #ffc107;
}

.overview-kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0.25rem 0;
}

.overview-list {
    padding-left: 1.1rem;
    margin-bottom: 0;
}

.overview-list li,
.overview-steps li {
    margin-bottom: 0.65rem;
}

.overview-balance-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

.overview-balance-row:last-of-type {
    border-bottom: 0;
}

.overview-link-card {
    display: block;
    height: 100%;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 14px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.overview-link-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 110, 253, 0.35);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
}

.overview-link-card strong {
    display: block;
    margin-bottom: 0.35rem;
}

.overview-link-card span {
    display: block;
    color: #64748b;
    font-size: 0.92rem;
}

/* V14.2.3 — aides pédagogiques débutant */
.analysis-help-card .card-header {
    font-size: .92rem;
}

.analysis-help-card .card-body {
    color: #334155;
}

.analysis-help-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .25rem .6rem;
    background: rgba(13, 110, 253, .08);
    color: #0d6efd;
    font-weight: 700;
    font-size: .78rem;
}

.analysis-reading-steps {
    list-style: none;
}

.analysis-reading-steps li {
    position: relative;
    padding-left: 2.05rem;
    margin-bottom: .8rem;
}

.analysis-reading-steps li:last-child {
    margin-bottom: 0;
}

.analysis-reading-steps span {
    position: absolute;
    left: 0;
    top: .05rem;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef4ff;
    color: #0d6efd;
    font-weight: 800;
    font-size: .8rem;
}

.analysis-reading-steps strong {
    display: block;
    color: #0f172a;
}

.analysis-reading-steps em {
    color: #64748b;
    font-style: normal;
}

.analysis-lexicon dt {
    font-weight: 800;
    color: #0f172a;
    margin-top: .6rem;
}

.analysis-lexicon dt:first-child {
    margin-top: 0;
}

.analysis-lexicon dd {
    margin-bottom: .45rem;
    color: #475569;
}


.analysis-next-steps {
    border: 1px solid rgba(13, 110, 253, 0.12);
}

.analysis-next-card {
    display: block;
    height: 100%;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.9rem;
    text-decoration: none;
    color: inherit;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.analysis-next-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 110, 253, 0.35);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
    color: inherit;
}

.analysis-next-card strong,
.analysis-next-card small {
    display: block;
}

.analysis-next-card small {
    margin-top: 0.35rem;
    color: #6c757d;
}

.analysis-next-label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.45rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #495057;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


/* V14.2.6 — parcours guidé depuis l'accueil et la vue d'ensemble */
.overview-link-card-priority {
    border-color: rgba(13, 110, 253, 0.35);
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.06), #fff 65%);
}

.overview-link-step {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .6rem;
    background: rgba(13, 110, 253, .10);
    color: #0d6efd;
    font-weight: 800;
    font-size: .9rem;
}

/* V15.1 - Menu latéral dépliable et page REAB gestion financière */
.app-sidebar-collapsible {
    border-radius: .75rem;
}

.app-sidebar-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: .65rem;
    transition: background .12s ease, color .12s ease;
}

.app-sidebar-summary::-webkit-details-marker {
    display: none;
}

.app-sidebar-summary:hover {
    background: #f5f7fa;
    color: #0d6efd;
}

.app-sidebar-chevron {
    font-size: .9rem;
    transition: transform .15s ease;
}

.app-sidebar-collapsible[open] .app-sidebar-chevron {
    transform: rotate(180deg);
}

.app-sidebar-group-content {
    margin-top: .15rem;
}

.app-sidebar-subgroup-title {
    color: #9aa3b2;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: .55rem .65rem .2rem;
}

.reab-v15-status-card {
    min-width: min(100%, 320px);
}

.reab-v15-indicator-card {
    border-left: 4px solid #0d6efd !important;
}

.reab-v15-step {
    height: 100%;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e7ecf2;
    border-radius: .85rem;
}

.reab-v15-step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0d6efd;
    color: #fff;
    font-weight: 800;
    margin-bottom: .65rem;
}

/* Correctif V15.1.1 — guide débutant et panneaux latéraux
   Les panneaux latéraux peuvent contenir beaucoup d'informations. Sans overflow,
   leur contenu dépasse visuellement de la carte et chevauche le guide débutant. */
.analysis-sidebar .card,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    overflow-x: hidden;
    overflow-y: auto;
}

.analysis-sidebar .card,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel,
.analysis-help-card {
    z-index: auto;
}

.analysis-help-card {
    position: relative;
    clear: both;
}

@media (min-width: 1200px) {
    .analysis-sidebar .card,
    .profitability-page .sticky-side-panel,
    .hourly-rate-page .sticky-side-panel,
    .cashflow-page .sticky-side-panel {
        max-height: calc(100vh - 2rem);
    }

    .analysis-help-card {
        max-height: none;
    }
}

@media (max-width: 1199.98px) {
    .analysis-sidebar .card,
    .profitability-page .sticky-side-panel,
    .hourly-rate-page .sticky-side-panel,
    .cashflow-page .sticky-side-panel {
        max-height: none;
        overflow: visible;
    }
}

/* V15.2 - Génération guidée des contenus REAB */
.reab-v15-guided-content {
    border-top: 1px solid rgba(15, 23, 42, 0.10);
    padding-top: 1.25rem;
}

.reab-v15-guided-content .card {
    border-radius: 1rem;
}

/* V15.3 - Rédaction REAB assistée */
.reab-v15-draft-overview {
    border-left: 4px solid #0d6efd;
}

.reab-v15-assisted-draft {
    background: #f8fbff;
    border: 1px solid rgba(13, 110, 253, 0.15);
    border-radius: 1rem;
    padding: 1rem;
}

.reab-v15-draft-textarea {
    min-height: 220px;
    line-height: 1.6;
    font-size: 0.95rem;
    color: #1f2937;
    background: #fff;
    resize: vertical;
    white-space: pre-wrap;
}


/* V15.4 - Analyse IA REAB */
.reab-ai-card {
    border-left: 4px solid rgba(13, 110, 253, 0.35);
}

.reab-ai-preview,
.reab-ai-output,
.reab-ai-context {
    white-space: pre-wrap;
    word-break: break-word;
}

.reab-ai-preview {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    padding: 1rem;
    font-size: 0.95rem;
}

.reab-ai-output {
    font-family: inherit;
    margin: 0;
    line-height: 1.55;
    background: #fff;
}

.reab-ai-context {
    max-height: 520px;
    overflow: auto;
    font-size: 0.82rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}


/* V15.4.2 - Page REAB gestion financière restructurée */
.reab-finance-page .reab-section-card {
    scroll-margin-top: 1rem;
}

.reab-finance-page .reab-section-card > .text-uppercase,
.reab-finance-page .reab-section-card .card-header .text-uppercase {
    letter-spacing: 0.08em;
}

.reab-ai-latest {
    border: 1px solid rgba(13, 110, 253, 0.12);
    border-radius: 0.9rem;
    background: #f8fbff;
    padding: 1rem;
}

.reab-finance-page .accordion {
    overflow: hidden;
    border-radius: 0.9rem;
}

.reab-finance-page textarea.reab-v15-draft-textarea {
    line-height: 1.55;
    font-size: 0.95rem;
}


/* V15.4.3 - Mise en forme des analyses IA REAB */
.reab-ai-rendered {
    background: #ffffff;
    border: 1px solid rgba(13, 110, 253, 0.12);
    border-radius: 0.9rem;
    padding: 1rem;
    line-height: 1.62;
    color: #1f2937;
}

.reab-ai-preview.reab-ai-rendered {
    max-height: 420px;
    overflow: auto;
    background: #f8fbff;
}

.reab-ai-detail-output {
    font-size: 1rem;
}

.reab-ai-rendered h3 {
    font-size: 1.25rem;
    margin: 1.25rem 0 0.65rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(13, 110, 253, 0.18);
    color: #0d3b66;
}

.reab-ai-rendered h3:first-child {
    margin-top: 0;
}

.reab-ai-rendered h4 {
    font-size: 1.08rem;
    margin: 1rem 0 0.5rem;
    color: #174ea6;
}

.reab-ai-rendered h5 {
    font-size: 0.98rem;
    margin: 0.85rem 0 0.35rem;
    font-weight: 700;
    color: #253858;
}

.reab-ai-rendered p {
    margin: 0 0 0.75rem;
}

.reab-ai-rendered ul {
    margin: 0.25rem 0 0.9rem 1.1rem;
    padding-left: 0.75rem;
}

.reab-ai-rendered li {
    margin-bottom: 0.35rem;
}

.reab-ai-rendered strong {
    color: #111827;
}

.reab-ai-rendered code {
    background: rgba(13, 110, 253, 0.08);
    border-radius: 0.35rem;
    padding: 0.1rem 0.3rem;
}

.reab-ai-highlight-line {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 0.65rem 0.8rem;
    border-radius: 0.5rem;
}

.reab-ai-ellipsis {
    margin-top: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 0.5rem;
    background: #eef5ff;
    color: #0d6efd;
    font-size: 0.92rem;
    font-weight: 600;
}

/* Authentification et administration */
.auth-page {
    min-height: 100vh;
    margin: 0;
    color: #14213d;
    background: #f4f7fb;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, .82fr) minmax(520px, 1.18fr);
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 5vw, 5rem);
    color: #fff;
    background: linear-gradient(145deg, #0b1736 0%, #153d68 58%, #126a72 100%);
}

.auth-brand-panel::before,
.auth-brand-panel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.12);
}

.auth-brand-panel::before { width: 380px; height: 380px; right: -180px; top: -90px; }
.auth-brand-panel::after { width: 520px; height: 520px; left: -260px; bottom: -270px; }

.auth-logo {
    position: relative;
    z-index: 1;
    display: block;
    width: min(300px, 100%);
    height: auto;
    border-radius: 20px;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, .2));
}

.auth-brand-name { font-size: clamp(2.8rem, 6vw, 5rem); font-weight: 800; letter-spacing: -.06em; }
.auth-brand-copy { max-width: 540px; margin: .8rem 0 0; color: rgba(255,255,255,.76); font-size: 1.15rem; line-height: 1.65; }
.auth-brand-note { position: relative; z-index: 1; max-width: 480px; color: rgba(255,255,255,.58); font-size: .92rem; line-height: 1.6; }
.auth-form-panel { display: grid; place-items: center; padding: 2rem; }
.auth-form-card { width: min(100%, 500px); }
.auth-kicker, .admin-kicker { color: #16747d; font-size: .73rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.auth-title { margin: .55rem 0 .75rem; color: #0f1f3d; font-size: clamp(2rem, 4vw, 3rem); font-weight: 760; letter-spacing: -.04em; }
.auth-subtitle { margin-bottom: 2rem; color: #66758a; line-height: 1.65; }
.auth-form { display: grid; gap: 1.15rem; }
.auth-form .form-control { border-color: #d9e1ea; border-radius: .8rem; font-size: 1rem; }
.auth-form .form-control:focus { border-color: #17818a; box-shadow: 0 0 0 .22rem rgba(23,129,138,.12); }
.auth-form .btn-primary { border: 0; border-radius: .8rem; background: #126f78; box-shadow: 0 10px 24px rgba(18,111,120,.2); }
.auth-form .btn-primary:hover { background: #0e5e66; }
.auth-remember { display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 1rem; border: 1px solid #e2e8f0; border-radius: .8rem; background: #fff; cursor: pointer; }
.auth-remember span { display: flex; flex-direction: column; gap: .15rem; }
.auth-remember strong { color: #24354d; font-size: .92rem; }
.auth-remember small { color: #7b8798; }
.auth-support-link { margin-top: .2rem; text-align: center; }
.auth-support-link a { color: #126f78; font-size: .9rem; font-weight: 700; text-decoration: none; }
.auth-support-link a:hover { color: #0e5e66; text-decoration: underline; }
.auth-info-box { padding: 1rem; border: 1px solid #d9e7ee; border-radius: .8rem; color: #52667d; background: #f7fafc; line-height: 1.55; }
.form-spam-trap { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Bandeau commun : la signature visuelle des espaces d'analyse, de données et d'administration. */
.app-page-hero,
.admin-page-heading {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center !important;
    justify-content: space-between;
    gap: clamp(1rem, 3vw, 2rem);
    min-height: 156px;
    margin-bottom: 1.15rem !important;
    padding: clamp(1.35rem, 3vw, 2.35rem) clamp(1.4rem, 4vw, 3.15rem);
    border: 0;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(120deg, #10284d 0%, #175a72 67%, #178087 100%);
    box-shadow: 0 18px 38px rgba(20, 55, 88, .13);
}

.app-page-hero::before,
.admin-page-heading::before,
.app-page-hero::after,
.admin-page-heading::after {
    position: absolute;
    z-index: -1;
    display: block;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    content: "";
}
.app-page-hero::before,
.admin-page-heading::before { width: 340px; height: 340px; top: -205px; right: -85px; }
.app-page-hero::after,
.admin-page-heading::after { width: 230px; height: 230px; right: 10%; bottom: -178px; }
.app-page-hero > *, .admin-page-heading > * { position: relative; z-index: 1; }
.app-page-hero-logo { position: absolute !important; z-index: 2 !important; top: 50%; right: 2.35rem; width: 128px; height: 128px; transform: translateY(-50%); border-radius: 16px; background: #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); object-fit: cover; pointer-events: none; }
.app-page-hero .admin-kicker, .admin-page-heading .admin-kicker { color: #9ce8e2; }
.app-page-hero h1, .admin-page-heading h1 { margin: .35rem 0 .55rem !important; color: #fff !important; font-size: clamp(1.9rem, 3.4vw, 2.85rem) !important; font-weight: 780 !important; letter-spacing: -.045em; }
.app-page-hero p, .app-page-hero p.text-muted, .admin-page-heading p, .admin-page-heading p.text-muted { max-width: 720px; margin: 0; color: rgba(255, 255, 255, .78) !important; line-height: 1.55; }
.app-page-hero .btn, .admin-page-heading .btn { flex: 0 0 auto; border-color: rgba(255, 255, 255, .94); color: #173451; background: rgba(255, 255, 255, .96); box-shadow: none; }
.app-page-hero .btn:hover, .admin-page-heading .btn:hover { border-color: #fff; color: #0e5e66; background: #fff; }
.app-page-hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.app-page-hero-actions .btn { padding: .42rem .78rem; font-size: .86rem; }
.app-page-hero .admin-lines-back { color: rgba(255, 255, 255, .84); }
.app-page-hero .admin-lines-back:hover { color: #fff; }
.app-page-hero.row { margin-right: 0; margin-left: 0; }

@media (max-width: 760px) {
    .app-page-hero, .admin-page-heading { align-items: flex-start !important; min-height: 0; padding: 1.35rem; border-radius: 18px; }
    .app-page-hero-logo { right: 1.1rem; width: 82px; height: 82px; }
    .app-page-hero .btn, .admin-page-heading .btn { width: 100%; }
    .app-page-hero-actions .btn { width: auto; }
}

.app-sidebar-admin-link { margin-bottom: .45rem; color: #0f666e; background: #edf8f7; font-weight: 700; }
.app-sidebar-admin-link:hover, .app-sidebar-admin-link.active { color: #fff; background: #126f78; }
.app-sidebar-admin-bottom { margin-top: auto; }
.app-sidebar-account { display: flex; align-items: center; gap: .65rem; padding: .8rem .85rem; border-top: 1px solid #e9eef3; background: #fbfcfd; }
.app-sidebar-account-link { display: flex; align-items: center; min-width: 0; flex: 1; gap: .65rem; color: inherit; text-decoration: none; border-radius: 10px; }
.app-sidebar-account-link:hover .app-sidebar-account-copy strong { color: #126f78; }
.user-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #14727b, #173e68); font-size: .88rem; font-weight: 800; }
.app-sidebar-account-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.app-sidebar-account-copy strong { overflow: hidden; color: #24354d; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.app-sidebar-account-copy span { color: #8490a1; font-size: .72rem; }
.app-logout-button { width: 32px; height: 32px; border: 0; border-radius: 9px; color: #6d7888; background: transparent; font-size: 1.15rem; }
.app-logout-button:hover { color: #a61b2b; background: #fff0f1; }

.admin-page { color: #1c2b42; }
.admin-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(1.8rem, 4vw, 3.2rem); border-radius: 24px; color: #fff; background: linear-gradient(120deg, #10284d 0%, #175a72 68%, #178087 100%); box-shadow: 0 20px 45px rgba(20,55,88,.14); }
.admin-hero::after { content: ""; position: absolute; right: -90px; top: -150px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.admin-hero > * { position: relative; z-index: 1; }
.admin-hero > .app-page-hero-logo { top: 50%; right: 17.5rem; width: 92px; height: 92px; transform: translateY(-50%); }
.admin-hero .admin-kicker { color: #8ce0dc; }
.admin-hero h1 { margin: .45rem 0 .6rem; font-size: clamp(2rem, 4vw, 3rem); font-weight: 760; letter-spacing: -.04em; }
.admin-hero p { max-width: 500px; margin: 0; color: rgba(255,255,255,.72); }
.admin-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; margin: 1.2rem 0; }
.admin-stat-card { display: flex; flex-direction: column; min-height: 145px; padding: 1.3rem; border: 1px solid #e3e9ef; border-radius: 18px; background: #fff; box-shadow: 0 8px 26px rgba(23,46,75,.05); }
.admin-stat-card > span { color: #758296; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.admin-stat-card > strong { margin: auto 0 .2rem; color: #132849; font-size: 2rem; font-weight: 780; }
.admin-stat-card > small { color: #8b96a5; }
.admin-stat-accent { border-color: #cde8e5; background: #f3fbfa; }
.admin-status { display: flex; align-items: center; gap: .55rem; font-size: 1.15rem !important; }
.admin-status i { width: 10px; height: 10px; border-radius: 50%; background: #1cab77; box-shadow: 0 0 0 5px rgba(28,171,119,.12); }
.admin-content-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.2rem; align-items: start; }
.admin-panel { overflow: hidden; border: 1px solid #e3e9ef; border-radius: 18px; background: #fff; box-shadow: 0 8px 26px rgba(23,46,75,.045); }
.admin-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem; border-bottom: 1px solid #edf0f4; }
.admin-panel-header h2 { margin: .25rem 0 0; color: #162b4b; font-size: 1.2rem; font-weight: 750; }
.admin-panel-header a { color: #13737b; font-size: .86rem; font-weight: 700; text-decoration: none; }
.admin-user-preview { padding: .35rem 1.35rem; }
.admin-user-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto auto; align-items: center; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid #eef1f4; }
.admin-user-row:last-child { border-bottom: 0; }
.admin-user-row div { display: flex; min-width: 0; flex-direction: column; }
.admin-user-row div strong { color: #273b56; font-size: .9rem; }
.admin-user-row div small { overflow: hidden; color: #8994a4; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.role-badge, .status-dot { padding: .3rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700; }
.role-admin { color: #12676f; background: #e6f7f5; }
.role-user { color: #44566e; background: #edf1f5; }
.status-dot.active { color: #13714f; background: #e8f8f1; }
.status-dot.inactive { color: #9d2f3b; background: #fff0f1; }
.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; padding: 1.2rem; }
.admin-actions a { display: flex; align-items: center; gap: .8rem; min-height: 90px; padding: 1rem; border: 1px solid #e6ebf0; border-radius: 14px; color: inherit; background: #fbfcfd; text-decoration: none; transition: .15s ease; }
.admin-actions a:hover { border-color: #9ecfcf; background: #f2fbfa; transform: translateY(-2px); }
.admin-actions a > span { font-size: 1.25rem; }
.admin-actions a div { display: flex; flex-direction: column; }
.admin-actions strong { color: #263b57; font-size: .86rem; }
.admin-actions small { color: #8792a2; font-size: .72rem; }
.standard-access-panel { max-width: 980px; }
.standard-access-intro { max-width: 760px; margin: 0 0 1.15rem; color: #65778a; line-height: 1.55; }
.standard-access-form { display: grid; gap: .8rem; }
.standard-access-section { margin: 0; padding: 1rem; border: 1px solid #dfe7ec; border-radius: 14px; background: #fbfcfd; }
.standard-access-section legend { float: none; width: auto; margin: 0; padding: 0; }
.standard-access-section .form-switch { display: flex; align-items: flex-start; gap: .55rem; margin: 0; }
.standard-access-section .form-switch .form-check-input { flex: 0 0 auto; margin: .18rem 0 0; }
.standard-access-section .form-switch small { display: block; margin-top: .15rem; color: #758598; font-size: .78rem; font-weight: 400; }
.standard-access-pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .8rem; margin: .85rem 0 0 2.25rem; }
.standard-access-page { min-width: 0; color: #40546b; font-size: .86rem; }
.admin-page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.admin-page-heading h1 { margin: .35rem 0 .35rem; color: #132849; font-size: 2rem; font-weight: 760; letter-spacing: -.035em; }
.admin-page-heading p { margin: 0; color: #758196; }
.admin-users-layout { grid-template-columns: minmax(280px,.65fr) minmax(520px,1.35fr); }
.admin-form { display: grid; gap: 1rem; padding: 1.35rem; }
.admin-users-list { padding: .4rem 1.2rem; }
.admin-user-card { display: grid; grid-template-columns: minmax(220px,1fr) minmax(330px,auto); gap: .85rem 1rem; padding: 1.1rem .15rem; border-bottom: 1px solid #edf0f4; }
.admin-user-card:last-child { border-bottom: 0; }
.admin-user-identity { display: flex; align-items: flex-start; gap: .8rem; }
.admin-user-identity > div { display: flex; min-width: 0; flex-direction: column; }
.admin-user-identity strong { color: #233853; }
.admin-user-identity small { color: #7f8b9c; }
.admin-user-identity div > span { margin-top: .25rem; color: #a0a8b4; font-size: .7rem; }
.admin-access-form { display: grid; grid-template-columns: 135px 80px auto; align-items: center; gap: .55rem; }
.admin-password-form { grid-column: 2; display: flex; justify-content: flex-end; gap: .55rem; }
.admin-password-form input { max-width: 220px; }
.admin-mail-layout { grid-template-columns: minmax(280px, .75fr) minmax(430px, 1.25fr); }
.admin-mail-summary { display: grid; gap: .85rem; padding: 1.35rem; }
.admin-mail-summary div { display: flex; flex-direction: column; gap: .15rem; }
.admin-mail-summary span { color: #8490a1; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.admin-mail-summary strong { overflow-wrap: anywhere; color: #223954; font-size: .92rem; }
.admin-mail-note { margin: 0 1.35rem 1.35rem; padding: .9rem 1rem; border: 1px solid #dbece9; border-radius: 12px; color: #55707a; background: #f3fbfa; font-size: .85rem; line-height: 1.55; }
.admin-mail-fields { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 1rem; }
.admin-mail-reset-form { margin-top: 1rem; text-align: right; }

@media (max-width: 1050px) {
    .admin-stats-grid { grid-template-columns: 1fr 1fr; }
    .admin-content-grid, .admin-users-layout { grid-template-columns: 1fr; }
    .admin-password-form { grid-column: auto; }
}

@media (max-width: 760px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { min-height: 250px; padding: 2rem; }
    .auth-logo { width: min(230px, 70vw); height: auto; }
    .auth-brand-note { display: none; }
    .auth-form-panel { padding: 2rem 1rem; }
    .admin-hero, .admin-page-heading { align-items: flex-start; flex-direction: column; }
    .admin-hero > .app-page-hero-logo { top: 50%; right: 1.1rem; width: 82px; height: 82px; transform: translateY(-50%); }
    .admin-stats-grid { grid-template-columns: 1fr; }
    .admin-user-row { grid-template-columns: 38px minmax(0,1fr); }
    .admin-user-row .role-badge, .admin-user-row .status-dot { grid-column: 2; justify-self: start; }
    .admin-actions { grid-template-columns: 1fr; }
    .standard-access-pages { grid-template-columns: 1fr; margin-left: 0; }
    .admin-user-card { grid-template-columns: 1fr; }
    .admin-access-form { grid-template-columns: 1fr; }
    .admin-password-form { justify-content: stretch; }
    .admin-password-form input { max-width: none; }
    .admin-mail-fields { grid-template-columns: 1fr; }
    .admin-mail-reset-form { text-align: left; }
}

.user-home { max-width: 1050px; }
.user-welcome-card { overflow: hidden; position: relative; padding: clamp(2rem,5vw,4rem); border-radius: 24px; color: #fff; background: linear-gradient(125deg,#10284d,#166e78); box-shadow: 0 20px 45px rgba(20,55,88,.14); }
.user-welcome-copy { position: relative; z-index: 1; min-width: 0; max-width: calc(100% - 170px); }
.user-welcome-card::after { content: ""; position: absolute; right: -100px; top: -160px; width: 370px; height: 370px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; }
.user-welcome-card .admin-kicker { color: #90e1dd; }
.user-welcome-card h1 { position: relative; z-index: 1; margin: .35rem 0 .55rem; font-size: clamp(1.9rem,3.4vw,2.85rem); font-weight: 780; letter-spacing: -.045em; }
.user-welcome-card p { position: relative; z-index: 1; max-width: 720px; margin: 0; color: rgba(255,255,255,.78); line-height: 1.55; }
.user-home-actions { margin-top: 1.25rem; padding: clamp(1.25rem,3vw,2rem); border: 1px solid #e0e8ed; border-radius: 20px; background: #fff; box-shadow: 0 12px 30px rgba(25,50,78,.05); }
.user-home-actions-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.1rem; }
.user-home-actions-heading h2 { margin: .25rem 0 0; color: #183450; font-size: 1.22rem; font-weight: 760; letter-spacing: -.02em; }
.user-home-actions-heading p { max-width: 460px; margin: 0; color: #718195; font-size: .88rem; line-height: 1.55; text-align: right; }
.user-home-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.user-home-action { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: .8rem; min-height: 98px; padding: 1rem; border: 1px solid #e3eaee; border-radius: 15px; color: inherit; background: #fbfcfd; text-decoration: none; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.user-home-action:hover { border-color: #8ec9c8; background: #f2fbfa; color: inherit; transform: translateY(-2px); }
.user-home-action-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #126c74; background: #e8f6f5; font-size: 1.3rem; font-weight: 800; }
.user-home-action span:nth-child(2) { display: grid; gap: .2rem; min-width: 0; }
.user-home-action strong { color: #203953; font-size: .94rem; }
.user-home-action small { color: #788799; font-size: .78rem; line-height: 1.4; }
.user-home-action b { color: #13808a; font-size: 1.1rem; }

@media (max-width: 680px) {
    .user-welcome-copy { max-width: calc(100% - 100px); }
    .user-home-actions-heading { align-items: flex-start; flex-direction: column; gap: .45rem; }
    .user-home-actions-heading p { text-align: left; }
    .user-home-actions-grid { grid-template-columns: 1fr; }
}

/* Centre de données : éditeur des lignes extraites */
.admin-lines-page { color: #1b2d46; }
.analysis-page-context { display: grid; grid-template-columns: auto minmax(260px,auto) 1fr; align-items: center; gap: 1.25rem; max-width: 1320px; margin: 0 auto 1.15rem; padding: .75rem 1rem; border: 1px solid #dce6eb; border-radius: 14px; color: #53677d; background: linear-gradient(135deg,#f8fbfc,#fff); box-shadow: 0 6px 18px rgba(24,52,80,.035); }
.analysis-page-context-title, .analysis-page-context-periods { display: flex; flex-direction: column; gap: .1rem; }
.analysis-page-context-title { padding-right: 1.1rem; border-right: 1px solid #e2e9ed; }
.analysis-page-context-title span, .analysis-page-context-periods > span { color: #8795a4; font-size: .65rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.analysis-page-context-title strong { color: #153752; font-size: .92rem; }
.analysis-page-context-periods > div { display: flex; flex-wrap: wrap; gap: .35rem; }
.analysis-page-context-periods strong { padding: .22rem .5rem; border-radius: 7px; color: #146b72; background: #eaf6f5; font-size: .76rem; }
.analysis-page-context p { margin: 0; color: #7c8997; font-size: .75rem; text-align: right; }
.analysis-page-context,
.analysis-period-selector.single-exercise-context:not(.is-condensed) {
    min-height: 118px;
}
.analysis-period-selector.single-exercise-context {
    margin-bottom: 1.15rem;
}
.analysis-page-context > *,
.analysis-period-selector.single-exercise-context > * {
    align-self: center;
}
.overview-refined-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.overview-refined-header h1 { margin: .25rem 0; color: #173451; font-size: clamp(1.8rem,3vw,2.45rem); font-weight: 770; letter-spacing: -.035em; }
.overview-refined-header p { margin: 0; color: #748397; }
.overview-period-selector { position: sticky; top: .75rem; z-index: 1030; display: grid; grid-template-columns: minmax(280px,1fr) minmax(420px,1.25fr); gap: 1.5rem; width: 100%; max-width: 1320px; margin: 0 auto 1rem; padding: 1.15rem 1.25rem; border: 1px solid #dce5ea; border-radius: 17px; background: #fff; box-shadow: 0 8px 24px rgba(25,50,78,.045); transition: padding .18s ease, gap .18s ease, border-radius .18s ease, box-shadow .18s ease; }
.sticky-period-slot { position: sticky; top: .75rem; z-index: 1030; display: flow-root; pointer-events: none; }
.sticky-period-slot > [data-sticky-period-selector] { position: relative; top: 0; pointer-events: auto; }
.overview-period-selector h2, .overview-section-heading h2 { margin: .15rem 0 .25rem; color: #193752; font-size: 1.08rem; font-weight: 750; }
.overview-period-selector p, .overview-charts-grid article > p { margin: 0; color: #7b8998; font-size: .8rem; }
.overview-period-selector form { align-self: center; }
.overview-period-options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; margin-bottom: .7rem; }
.overview-period-options label { cursor: pointer; }
.overview-period-options input { position: absolute; opacity: 0; pointer-events: none; }
.overview-period-options span { display: block; padding: .45rem .72rem; border: 1px solid #d9e3e8; border-radius: 9px; color: #5d6e80; background: #f9fbfc; font-size: .78rem; font-weight: 700; }
.overview-period-options input:checked + span { border-color: #4a9a9d; color: #116870; background: #eaf6f5; box-shadow: 0 0 0 2px rgba(36,135,140,.08); }
.overview-period-selector.is-condensed { align-items: center; gap: .65rem; padding: .34rem .7rem; border-radius: 11px; box-shadow: 0 10px 24px rgba(25,50,78,.14); }
.overview-period-selector.is-condensed h2 { display: none; }
.overview-period-selector.is-condensed p { display: none; }
.overview-period-selector.is-condensed .admin-kicker { font-size: .64rem; white-space: nowrap; }
.overview-period-selector.is-condensed .admin-kicker::after { content: ' · Exercices comparés'; }
.single-exercise-context.is-condensed .admin-kicker::after { content: ' · Exercice de référence'; }
.overview-period-selector.is-condensed form { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; }
.overview-period-selector.is-condensed .overview-period-options { margin: 0; gap: .3rem; }
.overview-period-selector.is-condensed .overview-period-options span { padding: .27rem .48rem; font-size: .68rem; }
.overview-period-selector.is-condensed form > .d-flex { flex-wrap: nowrap !important; gap: .35rem !important; }
.overview-period-selector.is-condensed .btn { padding: .22rem .52rem; font-size: .72rem; }
.overview-focus-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; padding: .62rem .9rem; border-radius: 11px; color: #697a8d; background: #eef4f6; }
.overview-focus-line div { display: flex; align-items: center; gap: .55rem; }
.overview-focus-line span { font-size: .72rem; font-weight: 750; text-transform: uppercase; }
.overview-focus-line strong { color: #126b72; }
.overview-focus-line p { margin: 0; font-size: .75rem; }
.overview-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .8rem; margin-bottom: .9rem; }
.overview-kpi-grid article { display: flex; flex-direction: column; min-width: 0; padding: 1rem; border: 1px solid #dfe7ec; border-top: 3px solid #8ba0b2; border-radius: 14px; background: #fff; }
.overview-kpi-grid article.is-positive { border-top-color: #2a9a70; }
.overview-kpi-grid article.is-warning { border-top-color: #d29a37; }
.overview-kpi-grid span { color: #7d8b99; font-size: .7rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.overview-kpi-grid strong { margin: .3rem 0 .15rem; overflow: hidden; color: #173651; font-size: 1.35rem; text-overflow: ellipsis; white-space: nowrap; }
.overview-kpi-grid small { color: #8491a0; }
.overview-reading-card, .overview-balance-card, .overview-charts-grid article, .overview-comparison-card, .overview-cross-card { padding: 1.15rem; border: 1px solid #dfe7ec; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(25,50,78,.04); }
.overview-section-heading > span { color: #14747b; font-size: .65rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.overview-reading-card ul { margin: .6rem 0 0; padding-left: 1.1rem; color: #50647a; font-size: .84rem; }
.overview-reading-card li + li { margin-top: .5rem; }
.overview-good-title, .overview-watch-title { margin: .7rem 0 0; font-size: .84rem; font-weight: 800; }
.overview-good-title { color: #247c5f; } .overview-watch-title { color: #a87420; }
.overview-balance-note { margin: .8rem 0 0; padding: .65rem .75rem; border-radius: 9px; color: #64778b; background: #f2f6f7; font-size: .76rem; }
.overview-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: .8rem; }
.overview-chart-wide { grid-column: 1 / -1; }
.overview-chart { position: relative; height: 265px; margin-top: .8rem; }
.overview-comparison-card, .overview-cross-card { margin-bottom: .8rem; }
.overview-comparison-card table { margin-top: .7rem; font-size: .79rem; }
.overview-comparison-card th { color: #718196; font-size: .65rem; letter-spacing: .04em; text-transform: uppercase; }
.overview-cross-column { height: 100%; padding: .85rem; border-radius: 11px; background: #f8fafb; }
.overview-cross-column h3 { font-size: .82rem; font-weight: 800; }
.overview-cross-column > div { padding: .55rem 0; border-top: 1px solid #e2e8ec; }
.overview-cross-column strong { color: #2a4058; font-size: .78rem; }
.overview-cross-column p { margin: .15rem 0 0; color: #718093; font-size: .75rem; }
.overview-cross-column.is-good h3 { color: #247c5f; } .overview-cross-column.is-explain h3 { color: #a87420; } .overview-cross-column.is-watch h3 { color: #a14351; }
.health-refined-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.health-refined-header h1 { margin: .25rem 0; color: #173451; font-size: clamp(1.8rem,3vw,2.45rem); font-weight: 770; letter-spacing: -.035em; }
.health-refined-header p { margin: 0; color: #748397; }
.health-period-panel { position: sticky; top: .75rem; z-index: 1030; display: grid; grid-template-columns: minmax(260px,1fr) minmax(420px,1.25fr); gap: 1.5rem; margin-bottom: .9rem; padding: 1.05rem 1.15rem; border: 1px solid #dce5ea; border-radius: 15px; background: #fff; transition: padding .18s ease, gap .18s ease, border-radius .18s ease, box-shadow .18s ease; }
.health-period-panel h2, .health-summary-heading h2, .health-observation-card h2, .health-charts-grid h2, .health-detail-card h2, .health-advanced-card h2 { margin: .15rem 0 .25rem; color: #193752; font-size: 1.05rem; font-weight: 750; }
.health-period-panel p, .health-summary-heading p, .health-charts-grid p, .health-detail-card p { margin: 0; color: #7b8998; font-size: .78rem; }
.health-period-panel form { align-self: center; }
.health-period-options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; margin-bottom: .65rem; }
.health-period-options label { cursor: pointer; }.health-period-options input { position: absolute; opacity: 0; }.health-period-options span { display: block; padding: .42rem .68rem; border: 1px solid #d9e3e8; border-radius: 8px; color: #607084; background: #f9fbfc; font-size: .76rem; font-weight: 700; }.health-period-options input:checked + span { border-color: #4a9a9d; color: #116870; background: #eaf6f5; }
.health-period-panel.is-condensed { align-items: center; gap: .65rem; padding: .34rem .7rem; border-radius: 11px; box-shadow: 0 10px 24px rgba(25,50,78,.14); }
.health-period-panel.is-condensed h2 { display: none; }
.health-period-panel.is-condensed p { display: none; }
.health-period-panel.is-condensed .admin-kicker { font-size: .64rem; white-space: nowrap; }
.health-period-panel.is-condensed .admin-kicker::after { content: ' · Exercices comparés'; }
.health-period-panel.is-condensed form { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; }
.health-period-panel.is-condensed .health-period-options { margin: 0; gap: .3rem; }
.health-period-panel.is-condensed .health-period-options span { padding: .27rem .48rem; font-size: .68rem; }
.health-period-panel.is-condensed form > .d-flex { flex-wrap: nowrap !important; gap: .35rem !important; }
.health-period-panel.is-condensed .btn { padding: .22rem .52rem; font-size: .72rem; }
.health-summary-card, .health-observation-card, .health-charts-grid article, .health-detail-card, .health-advanced-card { border: 1px solid #dfe7ec; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(25,50,78,.04); }
.health-summary-card { margin-bottom: .8rem; padding: 1.15rem; }
.health-summary-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.health-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; margin: .9rem 0; }
.health-kpi-grid article { display: flex; flex-direction: column; padding: .85rem; border: 1px solid #e2e8ec; border-top: 3px solid #8ba0b2; border-radius: 11px; background: #fbfcfd; }.health-kpi-grid article.is-positive{border-top-color:#2a9a70}.health-kpi-grid article.is-warning{border-top-color:#d29a37}.health-kpi-grid span{color:#7d8b99;font-size:.66rem;font-weight:800;text-transform:uppercase}.health-kpi-grid strong{margin:.25rem 0;color:#173651;font-size:1.18rem}.health-kpi-grid small{color:#8491a0;font-size:.7rem}
.health-summary-points { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .45rem; margin-bottom: .85rem; }.health-summary-points p { margin: 0; padding: .65rem .75rem; border-radius: 9px; color: #5e7185; background: #f2f6f7; font-size: .76rem; }
.health-comparison-table { border-top: 1px solid #e4eaee; }.health-comparison-table table{font-size:.76rem}.health-comparison-table th{color:#758496;font-size:.62rem;text-transform:uppercase}
.health-observation-card { height: 100%; padding: 1rem; }.health-observation-card>span,.health-charts-grid article>div:first-child>span{font-size:.65rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase}.health-observation-card.is-good>span{color:#247c5f}.health-observation-card.is-watch>span{color:#a87420}.health-observation-card ul{margin:.65rem 0 0;padding-left:1.1rem;color:#596c80;font-size:.8rem}.health-observation-card li+li{margin-top:.45rem}
.health-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: .8rem; }.health-charts-grid article{padding:1rem}.health-charts-grid article>div:first-child>span{color:#14747b}.health-chart{position:relative;height:250px;margin-top:.7rem}
.health-detail-card{margin-bottom:.8rem;padding:1rem}.health-detail-card table,.health-advanced-card table{font-size:.76rem}
.health-advanced-card { margin-bottom: 1rem; overflow: hidden; }.health-advanced-card summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem;cursor:pointer;list-style:none}.health-advanced-card summary>span{color:#14747b;font-size:.76rem;font-weight:750}.health-advanced-card[open] summary{border-bottom:1px solid #e3e9ed}.health-advanced-body{padding:1rem}.health-advanced-body h3{color:#29445e;font-size:.88rem;font-weight:750}
.import-sofer-mark { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: linear-gradient(145deg,#14747c,#173f69); font-weight: 800; }
.admin-lines-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; padding: .35rem .25rem; }
.admin-lines-header > div:first-child { min-width: 0; padding-right: 170px; }
.admin-lines-back { display: inline-block; margin-bottom: .9rem; color: #6f7c8e; font-size: .84rem; font-weight: 650; text-decoration: none; }
.admin-lines-back:hover { color: #126f78; }
.admin-lines-header h1 { max-width: 900px; margin: .35rem 0 .25rem; overflow: hidden; color: #132849; font-size: clamp(1.65rem,3vw,2.35rem); font-weight: 760; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.admin-lines-header p { margin: 0; color: #788496; }
.admin-lines-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; padding-right: 170px; }
.admin-lines-statusbar { display: grid; grid-template-columns: minmax(300px,1fr) 150px 150px 125px; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: 1px solid #dfe7ed; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(23,46,75,.045); }
.admin-lines-statusbar > div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .15rem .65rem; }
.admin-lines-statusbar > div:first-child small { grid-column: 2; color: #8995a4; }
.lines-state-dot { grid-row: 1 / 3; width: 10px; height: 10px; border-radius: 50%; background: #1cab77; box-shadow: 0 0 0 5px rgba(28,171,119,.11); }
.is-saving .lines-state-dot { background: #e4a01c; box-shadow: 0 0 0 5px rgba(228,160,28,.12); animation: linesPulse 1s infinite alternate; }
@keyframes linesPulse { to { opacity: .45; } }
.lines-revision, .lines-count { display: flex; flex-direction: column; padding-left: 1rem; border-left: 1px solid #e7ecf0; }
.lines-revision span, .lines-count span { color: #8995a4; font-size: .69rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.lines-revision strong, .lines-count strong { color: #18314f; font-size: 1.2rem; }
.admin-lines-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .8rem; margin-top: .85rem; }
.admin-lines-summary article { display: flex; flex-direction: column; gap: .2rem; min-width: 0; padding: .9rem 1rem; border: 1px solid #e1e8ed; border-radius: 14px; background: linear-gradient(145deg,#fff,#f8fbfc); }
.admin-lines-summary span { color: #8591a0; font-size: .69rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.admin-lines-summary strong { overflow: hidden; color: #193450; font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-lines-document-info { margin-top: .75rem; padding: .7rem 1rem; border: 1px solid #e2e9ee; border-radius: 12px; color: #5e6f83; background: #fbfcfd; font-size: .8rem; }
.admin-lines-document-info summary { cursor: pointer; color: #43566d; font-weight: 700; }
.admin-lines-document-info[open] summary { margin-bottom: .7rem; }
.admin-lines-document-info > div { display: grid; grid-template-columns: 145px minmax(0,1fr); gap: .75rem; padding: .2rem 0; }
.admin-lines-document-info span { color: #8a96a4; }
.admin-lines-document-info strong { overflow-wrap: anywhere; }
.admin-lines-toolbar { display: grid; grid-template-columns: minmax(300px,1fr) 250px auto; align-items: center; gap: .8rem; margin: 1rem 0; }
.lines-search { display: flex; align-items: center; gap: .55rem; min-height: 42px; padding: 0 .85rem; border: 1px solid #dce4eb; border-radius: 12px; background: #fff; }
.lines-search span { color: #8290a2; font-size: 1.25rem; }
.lines-search input { width: 100%; border: 0; outline: 0; color: #263a55; background: transparent; }
.admin-lines-toolbar .form-select { min-height: 42px; border-color: #dce4eb; border-radius: 12px; }
.lines-total-switch { display: flex; align-items: center; gap: .55rem; margin: 0; padding: .6rem .85rem; border: 1px solid #dce4eb; border-radius: 12px; background: #fff; white-space: nowrap; }
.admin-lines-grid-wrap { overflow: auto; max-height: calc(100vh - 325px); border: 1px solid #dfe6ec; border-radius: 16px; background: #fff; box-shadow: 0 10px 30px rgba(20,43,70,.055); }
.admin-lines-grid { width: 100%; min-width: 1280px; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.admin-lines-grid thead { position: sticky; top: 0; z-index: 5; }
.admin-lines-grid th { padding: .75rem .6rem; border-bottom: 1px solid #dce4eb; color: #627188; background: #f5f8fa; font-size: .67rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
.admin-lines-grid td { padding: .28rem .35rem; border-bottom: 1px solid #edf1f4; background: #fff; vertical-align: middle; transition: background .2s ease; }
.admin-lines-grid tr:hover td { background: #f9fbfc; }
.admin-lines-grid tr.just-saved td { background: #f0faf7; }
.admin-lines-grid tr.has-error td { background: #fff6f6; }
.admin-lines-grid tr[hidden] { display: none; }
.admin-lines-grid th:nth-child(1), .admin-lines-grid td:nth-child(1) { width: 55px; text-align: center; }
.admin-lines-grid th:nth-child(2), .admin-lines-grid td:nth-child(2) { width: 150px; }
.admin-lines-grid th:nth-child(3), .admin-lines-grid td:nth-child(3) { width: 105px; }
.admin-lines-grid th:nth-child(4), .admin-lines-grid td:nth-child(4) { min-width: 280px; }
.admin-lines-grid th:nth-child(5), .admin-lines-grid td:nth-child(5) { min-width: 190px; }
.admin-lines-grid th:nth-child(6), .admin-lines-grid td:nth-child(6), .admin-lines-grid th:nth-child(7), .admin-lines-grid td:nth-child(7) { width: 135px; }
.admin-lines-grid th:nth-child(8), .admin-lines-grid td:nth-child(8) { width: 120px; }
.admin-lines-grid th:nth-child(9), .admin-lines-grid td:nth-child(9) { width: 105px; }
.line-input { width: 100%; min-height: 34px; padding: .35rem .45rem; border: 1px solid transparent; border-radius: 7px; color: #253953; background: transparent; outline: none; transition: border .12s ease, background .12s ease, box-shadow .12s ease; }
.line-input:hover { border-color: #dbe4ea; background: #fff; }
.line-input:focus { border-color: #54a9a8; background: #fff; box-shadow: 0 0 0 3px rgba(31,135,140,.11); }
.line-account { color: #126a72; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-weight: 700; }
.line-label { font-weight: 650; }
.line-amount { text-align: right; font-variant-numeric: tabular-nums; }
.line-section { color: #5c6c80; font-size: .75rem; text-transform: capitalize; }
.line-page { color: #93a0ae; font-variant-numeric: tabular-nums; }
.line-variation { padding-right: .7rem !important; color: #607086; text-align: right; font-variant-numeric: tabular-nums; }
.line-save-state { display: inline-flex; align-items: center; gap: .3rem; padding: .28rem .5rem; border-radius: 999px; font-size: .66rem; font-weight: 750; white-space: nowrap; }
.line-save-state.is-saved { color: #197254; background: #e9f8f1; }
.line-save-state.is-saving { color: #926419; background: #fff5dc; }
.line-save-state.is-warning { color: #8a601b; background: #fff1cd; }
.line-save-state.is-error { color: #a02d3b; background: #ffeaed; }
.line-empty { padding: 4rem !important; color: #7d8999; text-align: center; }
.admin-lines-help { padding: .75rem .25rem 0; color: #8793a2; font-size: .78rem; }

@media (max-width: 980px) {
    .admin-lines-header { align-items: flex-start; flex-direction: column; }
    .admin-lines-header > div:first-child, .admin-lines-header-actions { width: calc(100% - 100px); padding-right: 0; }
    .admin-lines-header-actions { justify-content: flex-start; }
    .admin-lines-statusbar { grid-template-columns: 1fr 1fr; }
    .admin-lines-summary { grid-template-columns: 1fr 1fr; }
    .admin-lines-toolbar { grid-template-columns: 1fr 1fr; }
    .lines-search { grid-column: 1 / -1; }
    .admin-lines-grid-wrap { max-height: none; }
}

@media (max-width: 560px) {
    .admin-lines-statusbar, .admin-lines-summary { grid-template-columns: 1fr; }
    .admin-lines-document-info > div { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 760px) {
    .analysis-page-context { grid-template-columns: 1fr; gap: .55rem; }
    .analysis-page-context,
    .analysis-period-selector.single-exercise-context:not(.is-condensed) { min-height: 0; }
    .analysis-page-context-title { padding: 0 0 .45rem; border-right: 0; border-bottom: 1px solid #e2e9ed; }
    .analysis-page-context p { text-align: left; }
    .overview-refined-header { align-items: flex-start; flex-direction: column; }
    .overview-period-selector { grid-template-columns: 1fr; }
    .overview-period-options { justify-content: flex-start; }
    .overview-kpi-grid, .overview-charts-grid { grid-template-columns: 1fr; }
    .overview-chart-wide { grid-column: auto; }
    .overview-focus-line { align-items: flex-start; flex-direction: column; }
    .health-refined-header { align-items: flex-start; flex-direction: column; }
    .health-period-panel { grid-template-columns: 1fr; }
    .health-period-options { justify-content: flex-start; }
    .health-kpi-grid, .health-summary-points, .health-charts-grid { grid-template-columns: 1fr; }
    .health-summary-heading { align-items: flex-start; flex-direction: column; }
}

/* Graphiques : un canevas ne doit jamais conserver une largeur ou une densité
   d'écran d'ordinateur lorsqu'il est affiché dans une colonne étroite. */
.analysis-page .row > *,
.overview-charts-grid > *,
.health-charts-grid > * {
    min-width: 0;
}

.reab-chart-frame,
.chart-container,
.overview-chart,
.health-chart,
.balance-comparison-chart,
.hourly-chart-body,
.cashflow-chart-body,
.sr-chart-card-body {
    width: 100%;
    min-width: 0;
}

.card-body.reab-chart-frame {
    position: relative;
    height: clamp(205px, 22vw, 250px);
    overflow: hidden;
}

.reab-chart-frame > canvas,
.chart-container > canvas,
.overview-chart > canvas,
.health-chart > canvas,
.balance-comparison-chart > canvas,
.hourly-chart-body > canvas,
.cashflow-chart-body > canvas,
.sr-chart-card-body > canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

@media (max-width: 560px) {
    .app-main .analysis-page,
    .app-main .profitability-page,
    .app-main .hourly-rate-page,
    .app-main .cashflow-page,
    .app-main .overview-page-refined,
    .app-main .health-page-refined {
        min-width: 0;
    }

    .card-body.reab-chart-frame {
        height: 205px;
        padding: .75rem .55rem;
    }

    .overview-chart,
    .health-chart,
    .balance-comparison-chart {
        height: 205px;
    }

    .chart-actions {
        top: 6px;
        right: 6px;
        padding: 2px;
    }
}

@media (max-width: 320px) {
    .card-body.reab-chart-frame,
    .overview-chart,
    .health-chart,
    .balance-comparison-chart {
        height: 185px;
    }
}

/* Cohérence visuelle des pages financières et prévisionnelles */
.analysis-page,
.profitability-page,
.hourly-rate-page,
.cashflow-page,
.oral-reab-page,
.pedagogy-page,
.reference-page,
.guided-page {
    max-width: 1320px;
    margin-right: auto;
    margin-left: auto;
}

/* Même largeur utile sur toutes les pages d'analyse, quel que soit le conteneur Bootstrap d'origine. */
.overview-page-refined,
.health-page-refined,
.analysis-page,
.profitability-page,
.hourly-rate-page,
.cashflow-page {
    width: min(100%, 1320px);
    max-width: 1320px;
}

@media (min-width: 761px) {
    .analysis-page,
    .profitability-page,
    .hourly-rate-page,
    .cashflow-page {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }
}

.analysis-page .analysis-header,
.profitability-page > .d-flex.mb-4,
.hourly-rate-page > .d-flex.mb-4,
.cashflow-page > .d-flex.mb-4,
.guided-page > .d-flex.mb-4,
.reference-page > .d-flex.mb-4 {
    align-items: flex-end !important;
    margin-bottom: 1rem !important;
}

.analysis-page .analysis-header h1,
.profitability-page h1,
.hourly-rate-page h1,
.cashflow-page h1,
.guided-page h1,
.reference-page h1,
.oral-reab-page h1,
.pedagogy-page h1 {
    color: #173451;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 770;
    letter-spacing: -.035em;
}

.analysis-page .card,
.profitability-page .card,
.hourly-rate-page .card,
.cashflow-page .card,
.guided-page .card,
.reference-page .card,
.oral-reab-page .card,
.pedagogy-page .card {
    border-color: #dfe7ec;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(25, 50, 78, .04) !important;
}

.analysis-page .card-header,
.profitability-page .card-header,
.hourly-rate-page .card-header,
.cashflow-page .card-header,
.guided-page .card-header,
.reference-page .card-header,
.oral-reab-page .card-header,
.pedagogy-page .card-header {
    padding: .85rem 1rem;
    border-bottom-color: #e4eaee;
    color: #29445e;
    background: #fff !important;
    font-size: .9rem;
    font-weight: 750;
}

.analysis-page .kpi-card,
.profitability-page .kpi-card,
.hourly-rate-page .kpi-card,
.cashflow-page .kpi-card {
    border-top: 3px solid #4a9a9d;
    background: #fbfcfd;
}

.analysis-page .analysis-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.analysis-page .analysis-sidebar {
    display: none;
}

.analysis-page .analysis-sidebar .card::before,
.profitability-page .sticky-side-panel::before,
.hourly-rate-page .sticky-side-panel::before,
.cashflow-page .sticky-side-panel::before {
    display: none !important;
}

.analysis-page .analysis-exercise-card {
    max-height: none;
    overflow: visible;
}

.analysis-page .analysis-exercise-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
}

.analysis-page .analysis-exercise-item {
    min-width: 0;
    margin: 0 !important;
    padding: .65rem .75rem;
    border: 1px solid #dfe7ec;
    border-radius: 10px;
    background: #fbfcfd;
}

.analysis-page .analysis-exercise-item:has(input:checked) {
    border-color: #4a9a9d;
    background: #eaf6f5;
}

.analysis-page .analysis-sidebar .analysis-exercise-card,
.profitability-page .sticky-side-panel,
.hourly-rate-page .sticky-side-panel,
.cashflow-page .sticky-side-panel {
    border-radius: 14px;
    box-shadow: none !important;
}

.analysis-page .table,
.profitability-page .table,
.hourly-rate-page .table,
.cashflow-page .table {
    font-size: .8rem;
}

.analysis-page .table thead th,
.profitability-page .table thead th,
.hourly-rate-page .table thead th,
.cashflow-page .table thead th {
    color: #718196;
    font-size: .66rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

@media (max-width: 980px) {
    .sticky-period-slot { top: calc(var(--app-navbar-height, 0px) + .5rem); }
    .overview-period-selector { top: calc(var(--app-navbar-height, 0px) + .5rem); }
    .health-period-panel { top: calc(var(--app-navbar-height, 0px) + .5rem); }
    .analysis-page .analysis-exercise-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analysis-page .analysis-header,
    .profitability-page > .d-flex.mb-4,
    .hourly-rate-page > .d-flex.mb-4,
    .cashflow-page > .d-flex.mb-4,
    .guided-page > .d-flex.mb-4,
    .reference-page > .d-flex.mb-4 {
        align-items: flex-start !important;
    }
}

@media (max-width: 560px) {
    .overview-period-selector.is-condensed { grid-template-columns: 1fr; gap: .35rem; padding: .48rem .6rem; }
    .overview-period-selector.is-condensed h2 { display: none; }
    .overview-period-selector.is-condensed form { display: block; }
    .overview-period-selector.is-condensed .overview-period-options { justify-content: flex-start; margin-bottom: .3rem; }
    .overview-period-selector.is-condensed form > .d-flex { justify-content: flex-start !important; }
    .health-period-panel.is-condensed { grid-template-columns: 1fr; gap: .35rem; padding: .48rem .6rem; }
    .health-period-panel.is-condensed h2 { display: none; }
    .health-period-panel.is-condensed form { display: block; }
    .health-period-panel.is-condensed .health-period-options { justify-content: flex-start; margin-bottom: .3rem; }
    .health-period-panel.is-condensed form > .d-flex { justify-content: flex-start !important; }
    .analysis-page .analysis-exercise-list { grid-template-columns: 1fr; }
}

.analysis-reading-card .analysis-reading-summary {
    margin: .2rem 0 1rem;
    color: #4d647a;
}

.action-plan-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
}

.action-plan-card {
    border: 1px solid #dfe7ec;
    border-left: 4px solid #d2a355;
    border-radius: 10px;
    padding: .85rem .95rem;
    background: #fffcf6;
}

.action-plan-card h3 {
    margin: 0;
    color: #29445e;
    font-size: .95rem;
}

.action-plan-card p {
    margin: .45rem 0 0;
    color: #526a7d;
    font-size: .84rem;
}

.action-plan-badge {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: .18rem .48rem;
    background: rgba(210, 163, 85, .15);
    color: #815d1f;
    font-size: .68rem;
    font-weight: 750;
}

.action-plan-card.is-easy {
    border-left-color: #2c9b74;
    background: #f1fbf6;
}

.action-plan-card.is-easy .action-plan-badge {
    background: rgba(44, 155, 116, .13);
    color: #167153;
}

.action-plan-card.is-hard {
    border-left-color: #ce5d5d;
    background: #fff6f5;
}

.action-plan-card.is-hard .action-plan-badge {
    background: rgba(206, 93, 93, .12);
    color: #a13737;
}

@media (max-width: 760px) {
    .action-plan-list { grid-template-columns: 1fr; }
}

/* Intitulé complet affiché lors de la première utilisation d'un sigle. */
.acronym-first-use {
    color: inherit;
    cursor: help;
    text-decoration: underline dotted rgba(40, 78, 105, .48);
    text-underline-offset: .16em;
}

.acronym-definition-tooltip {
    position: fixed;
    z-index: 1080;
    max-width: min(300px, calc(100vw - 24px));
    padding: .48rem .65rem;
    border: 1px solid #cfdde5;
    border-radius: 8px;
    color: #24435d;
    background: #fff;
    box-shadow: 0 8px 22px rgba(20, 43, 70, .17);
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.35;
    pointer-events: none;
}
