/*
   Planning Piste suit le thème de NoiseTracker Live : Radzen "standard-dark" (voir App.razor) et la police Nasalization des titres.
   Tout ce qui est couleur vient des variables --rz-* du thème, pour que le changer ne demande rien ici.
*/
@font-face {
    font-family: 'nasalization';
    src: url('font/nasalization.otf');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --pp-card: var(--rz-base-background-color, #242527);
    --pp-line: var(--rz-base-700, #3b3c3f);
    --pp-soft: var(--rz-base-400, #b0b2b5);
    --pp-weekend: rgba(56, 113, 255, .08);
    --pp-holiday: rgba(56, 113, 255, .18);
    /* Les trois familles de colonnes */
    --pp-arret: #a78bfa;
    --pp-roulage: var(--rz-primary, #3871ff);
    --pp-derog: var(--rz-info, #12a4f5);
}

html, body { min-height: 100%; }

.brand-font { font-family: 'nasalization', sans-serif; font-weight: bolder; font-style: italic; }
.brand-logo { height: 30px; width: 30px; }
.year { min-width: 4ch; text-align: center; font-variant-numeric: tabular-nums; }
.user-name { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Un fichier à ouvrir se choisit par un bouton comme les autres. */
.open-file { position: relative; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---------- Connexion / déconnexion ---------- */
.splash { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--rz-body-background-color, #19191a); color: var(--rz-text-color, #eaebec); }
.splash-card { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 48px; border-radius: 12px; background: var(--pp-card); border: 1px solid var(--pp-line); box-shadow: 0 8px 32px rgba(0, 0, 0, .35); text-align: center; }
.splash-logo { width: 72px; height: 72px; }
.splash-title { margin: 0; font-size: 2rem; }
.splash-title b { color: var(--rz-primary-light, #88aaff); }
.splash-text { color: var(--pp-soft); }
.splash-choices { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Menu des mois (barre latérale) ---------- */
.months { display: flex; flex-direction: column; padding: 8px 0; }
.month {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: .75rem;
    row-gap: 6px;
    padding: .7rem 1rem .55rem;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s;
}
.month:hover { background: var(--rz-base-700, #3b3c3f); }
.month.active { background: var(--rz-base-700, #3b3c3f); border-left-color: var(--rz-primary, #3871ff); }
.month .rz-icon { color: var(--pp-soft); }
.month.active .rz-icon { color: var(--rz-primary-light, #88aaff); }
.month-count { font-size: .75rem; color: var(--pp-soft); font-weight: 400; font-variant-numeric: tabular-nums; }
.month-gauge { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--rz-base-600, #4f5154); overflow: hidden; }
/* Couleur d'un mois selon la part de jours planifiés (seuils dans Home.razor) : rouge, orange, vert. Le vert est la couleur de base de la jauge. */
.month.level-low { --level: var(--rz-danger, #f31155); }
.month.level-mid { --level: var(--rz-warning, #f5a524); }
.month.level-low .month-name, .month.level-low .month-count, .month.level-low .rz-icon,
.month.level-mid .month-name, .month.level-mid .month-count, .month.level-mid .rz-icon { color: var(--level); }
.month.level-low .month-count { font-weight: 700; }
.month.level-low .month-gauge, .month.level-mid .month-gauge { background: color-mix(in srgb, var(--level) 25%, transparent); }
.month.level-low .month-gauge i, .month.level-mid .month-gauge i { background: var(--level); }
.month-gauge i { display: block; height: 100%; background: var(--rz-success, #3ab99a); transition: width .25s; }

/* ---------- Barre d'outils ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; color: #fff; }
.chip.c-arret { background: var(--pp-arret); color: #1b1b1f; }
.chip.c-roulage { background: var(--pp-roulage); }
.chip.c-derog { background: var(--pp-derog); }
.chip.c-we { background: var(--pp-weekend); color: var(--rz-primary-light, #88aaff); border: 1px solid var(--rz-primary, #3871ff); }
.chip.c-ferie { background: var(--rz-primary, #3871ff); }

/* ---------- Grille ---------- */
.grid-card { background: var(--pp-card); border: 1px solid var(--pp-line); border-radius: 8px; overflow: hidden; }
.grid-scroll { overflow: auto; max-height: calc(100vh - 190px); min-height: 320px; }

table.planning { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
.planning th, .planning td { border-bottom: 1px solid var(--pp-line); padding: 0; }

.planning thead th { position: sticky; z-index: 3; background: var(--pp-card); text-align: center; font-weight: 600; color: var(--pp-soft); }
.planning .groups th { top: 0; height: 34px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #fff; }
.planning .groups th.c-day, .planning .groups th.c-comment { background: var(--rz-base-700, #3b3c3f); }
.planning .groups th.g-arret { background: var(--pp-arret); color: #1b1b1f; }
.planning .groups th.g-roulage { background: var(--pp-roulage); }
.planning .groups th.g-derog { background: var(--pp-derog); }
.planning .labels th { top: 34px; height: 156px; vertical-align: bottom; padding: 6px 2px 8px; border-bottom: 2px solid var(--pp-line); }
.planning .labels th span {
    display: inline-block;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    max-height: 142px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
    line-height: 1.1;
}
.planning .labels th.g-arret { color: var(--pp-arret); }
.planning .labels th.g-roulage { color: var(--rz-primary-light, #88aaff); }
.planning .labels th.g-derog { color: var(--pp-derog); }

.planning .c-day {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 124px;
    min-width: 124px;
    text-align: left;
    padding: 0 12px;
    background: var(--pp-card);
    white-space: nowrap;
    border-right: 1px solid var(--pp-line);
}
.planning thead .c-day { z-index: 5; }
.planning .groups .c-day, .planning .groups .c-comment { text-align: left; padding: 0 12px; }
.planning .c-day .dow { display: inline-block; min-width: 4.4ch; text-transform: lowercase; color: var(--pp-soft); font-weight: 400; }
.planning .c-day .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.planning .c-day .holiday-name { display: block; font-size: .68rem; font-weight: 600; color: var(--rz-primary-light, #88aaff); line-height: 1.1; margin: 0; padding-bottom: 5px; }
.planning tr.holiday th.c-day { padding-top: 4px; line-height: 1.2; }

.planning .c-comment { min-width: 260px; width: 34%; padding: 0 8px; }
.planning tbody tr { height: 40px; }
.planning tbody tr:hover td, .planning tbody tr:hover th.c-day { background-color: var(--rz-base-700, #3b3c3f); }
.planning tr.weekend td, .planning tr.weekend th.c-day { background-image: linear-gradient(var(--pp-weekend), var(--pp-weekend)); }
.planning tr.holiday td, .planning tr.holiday th.c-day { background-image: linear-gradient(var(--pp-holiday), var(--pp-holiday)); }

/*
   Commentaire : une ligne dans la grille (le survol affiche le texte entier), et au clic la zone s'ouvre au-dessus des lignes voisines,
   en plusieurs lignes, pour lire et modifier un long texte. Entrée valide (voir planning.js).
*/
.planning td.c-comment { position: relative; }
.comment {
    display: block;
    width: 100%;
    height: 30px;
    resize: none;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    padding: 4px 8px;
    font: inherit;
    line-height: 20px;
    color: inherit;
}
.comment:hover { border-color: var(--pp-line); }
.comment:focus {
    outline: none;
    position: absolute;
    top: 4px;
    left: 8px;
    z-index: 2;
    width: max(420px, calc(100% - 16px));
    height: 110px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border-color: var(--rz-primary, #3871ff);
    background: var(--rz-base-900, #19191a);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.comment::placeholder { color: var(--rz-base-600, #4f5154); }

.planning td.cell { width: 56px; min-width: 56px; text-align: center; }

/* Séparation des trois familles : un trait épais de leur couleur avant la première colonne, et un fond légèrement teinté. */
.planning .g-first { border-left: 3px solid transparent; }
.planning .g-first.g-arret { border-left-color: var(--pp-arret); }
.planning .g-first.g-roulage { border-left-color: var(--pp-roulage); }
.planning .g-first.g-derog { border-left-color: var(--pp-derog); }
.planning td.g-arret { background-color: color-mix(in srgb, var(--pp-arret) 8%, var(--pp-card)); }
.planning td.g-roulage { background-color: color-mix(in srgb, var(--pp-roulage) 10%, var(--pp-card)); }
.planning td.g-derog { background-color: color-mix(in srgb, var(--pp-derog) 8%, var(--pp-card)); }
.planning .labels th.g-arret { background-color: color-mix(in srgb, var(--pp-arret) 14%, var(--pp-card)); }
.planning .labels th.g-roulage { background-color: color-mix(in srgb, var(--pp-roulage) 16%, var(--pp-card)); }
.planning .labels th.g-derog { background-color: color-mix(in srgb, var(--pp-derog) 14%, var(--pp-card)); }
.cell-btn {
    display: grid;
    place-items: center;
    width: 100%;
    height: 38px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    position: relative;
}
.cell-btn::before {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--rz-base-600, #4f5154);
    background: var(--rz-base-900, #19191a);
    position: absolute;
    transition: transform .12s, border-color .12s, background .12s;
}
.cell-btn svg { position: relative; z-index: 1; }
.cell-btn:hover::before { transform: scale(1.15); border-color: var(--rz-primary-light, #88aaff); }
.cell-btn:focus-visible { outline: 2px solid var(--rz-primary, #3871ff); outline-offset: -3px; }
.cell-btn.on::before { transform: scale(1.15); }
.g-arret .cell-btn.on { color: #1b1b1f; }
.g-arret .cell-btn.on::before { background: var(--pp-arret); border-color: var(--pp-arret); }
.g-roulage .cell-btn.on::before { background: var(--pp-roulage); border-color: var(--pp-roulage); }
.g-derog .cell-btn.on::before { background: var(--pp-derog); border-color: var(--pp-derog); }

.empty-hint { padding: 14px 18px; color: var(--pp-soft); border-top: 1px solid var(--pp-line); }

/* ---------- Dialogues (les couleurs viennent du thème Radzen) ---------- */
.info-dialog { text-align: center; }
.info-dialog .brand-mark { margin-bottom: 8px; }
.info-title { font-size: 1.6rem; }
.info-title b { color: var(--rz-primary-light, #88aaff); }
.info-version { color: var(--pp-soft); font-size: .85rem; margin-bottom: 8px; }
.info-small { color: var(--pp-soft); font-size: .85rem; }

.cat-help { margin-top: 0; color: var(--pp-soft); font-size: .88rem; }
.cat-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; max-height: 46vh; overflow: auto; }
.cat-list li { display: flex; align-items: center; gap: 8px; }
.cat-index { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; background: var(--pp-roulage); flex: none; }
.cat-input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--pp-line); border-radius: 6px; font: inherit; color: inherit; background: var(--rz-base-900, #19191a); }
.cat-input:focus { outline: none; border-color: var(--rz-primary, #3871ff); }
.cat-days { font-size: .8rem; color: var(--pp-soft); min-width: 4ch; text-align: right; }
.cat-empty { color: var(--pp-soft); font-style: italic; }
.cat-add { display: flex; gap: 8px; }
.cat-footer, .stats-footer { display: flex; justify-content: flex-end; margin-top: 18px; }

.stats-head { color: var(--pp-soft); margin-bottom: 14px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.tile { border-radius: 8px; padding: 12px 14px; color: #fff; }
.tile.t-roulage { background: var(--pp-roulage); }
.tile.t-arret { background: var(--pp-arret); color: #1b1b1f; }
.tile.t-none { background: var(--rz-base-600, #4f5154); }
.tile-value { font-size: 1.9rem; font-weight: 700; line-height: 1; font-family: 'nasalization', sans-serif; }
.tile-label { font-size: .78rem; opacity: .9; margin-top: 4px; }
.tile-pct { font-size: .78rem; opacity: .75; }
.stats-cols { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.stats h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pp-soft); margin: 0 0 8px; }
.stats .stats-sub { margin-top: 18px; }
.stats-empty { color: var(--pp-soft); font-style: italic; padding: 12px 0; }
.stats-note { font-size: .75rem; color: var(--pp-soft); margin-top: 4px; }
.derog-row { display: flex; justify-content: space-between; font-size: .88rem; padding: 4px 0; border-bottom: 1px dashed var(--pp-line); }

.act-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.act-head h3 { margin: 0; }
.act-filter { width: 180px; padding: 5px 10px; border: 1px solid var(--pp-line); border-radius: 6px; font: inherit; font-size: .85rem; color: inherit; background: var(--rz-base-900, #19191a); }
.act-filter:focus { outline: none; border-color: var(--rz-primary, #3871ff); }
/* Beaucoup d'activités : la liste défile, le reste du dialogue reste en place. */
.act-list { max-height: 44vh; overflow-y: auto; padding-right: 6px; }
.act-row { display: grid; grid-template-columns: 12px minmax(90px, 200px) 1fr 52px 56px; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--pp-line); font-size: .86rem; }
.act-row.unused { opacity: .5; }
.act-dot { width: 10px; height: 10px; border-radius: 3px; }
.act-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-bar { height: 7px; border-radius: 4px; background: var(--rz-base-700, #3b3c3f); overflow: hidden; }
.act-bar i { display: block; height: 100%; border-radius: 4px; }
.act-days { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.act-pct { text-align: right; color: var(--pp-soft); font-variant-numeric: tabular-nums; }
.act-unused { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .82rem; color: var(--pp-soft); cursor: pointer; }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
    .tiles { grid-template-columns: repeat(2, 1fr); }
    .stats-cols { grid-template-columns: 1fr; }
    .user-name { display: none; }
    .grid-scroll { max-height: none; }
}

/* ---------- Rapports circuits ---------- */
.reports-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--rz-body-background-color, #19191a); color: var(--rz-text-color, #eaebec); }
.reports-header { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; background: var(--pp-card); border-bottom: 1px solid var(--pp-line); }
.reports-brand { display: flex; align-items: center; gap: .6rem; margin-right: auto; color: inherit; text-decoration: none; font-size: 1.4rem; }
.reports-brand b { color: var(--rz-primary-light, #88aaff); }
.reports-main { padding: 1.5rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--pp-soft); }
.card { padding: 1rem 1.25rem; margin-bottom: 1rem; border-radius: 10px; background: var(--pp-card); border: 1px solid var(--pp-line); }
.card h2 { margin: 0 0 .75rem; font-size: 1.1rem; }
.row-actions { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; }
.nested { background: var(--rz-base-800, #2c2d2f); }
.schedule { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; margin-top: .75rem; }
.schedule > b { min-width: 9rem; }
.schedule label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--pp-soft); }
.rz-textbox.short { width: 5rem; }
.hint { color: var(--pp-soft); }
.simple-table { width: 100%; border-collapse: collapse; }
.simple-table th, .simple-table td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--pp-line); }
.point-row { align-items: end; margin-bottom: .5rem; }

/* ---------- Rapport : une feuille blanche qui s'imprime ---------- */
.paper { background: #fff; color: #111; padding: 2rem 2.5rem; margin: 1rem auto; max-width: 1000px; box-shadow: 0 4px 24px rgba(0, 0, 0, .35); font-family: 'Segoe UI', Arial, sans-serif; }
.paper h1, .paper h2, .paper h3 { color: #0b2a5b; margin: 1.2rem 0 .6rem; }
.paper h1 { font-size: 2rem; margin-top: 0; }
.paper h2 { font-size: 1.3rem; border-bottom: 2px solid #0b2a5b; padding-bottom: .2rem; }
.paper h3 { font-size: 1.05rem; }
.paper p { margin: .4rem 0; }
.cover { min-height: 55vh; display: flex; flex-direction: column; justify-content: center; gap: .6rem; padding-bottom: 2rem; }
.cover-kicker { text-transform: uppercase; letter-spacing: .15em; color: #5b6b8a; }
.cover-period { font-size: 1.2rem; }
.cover-meta { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; align-items: start; }
.cover-meta dt { color: #5b6b8a; padding-top: .35rem; }
.cover-meta dd { margin: 0; }
.editable { width: 100%; border: 1px dashed #c3cadb; border-radius: 4px; background: #fbfcff; color: inherit; font: inherit; padding: .35rem .5rem; resize: vertical; field-sizing: content; min-height: 1.8rem; }
.editable:focus { outline: 2px solid #3871ff; background: #fff; }
.paper h1 .editable { font-size: 2rem; font-weight: 700; color: #0b2a5b; }
.chart { margin: .5rem 0 1rem; break-inside: avoid; }
.chart svg { width: 100%; height: auto; background: #fff; }
.chart-title { font-size: 13px; font-weight: 600; fill: #111; }
.chart-tick { font-size: 10px; fill: #333; }
.chart-grid { stroke: #e2e5ee; stroke-width: 1; }
.chart-axis { stroke: #333; stroke-width: 1; }
.legend-note { font-size: .8rem; color: #555; }
.month-tables { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.report-table { border-collapse: collapse; font-size: .8rem; }
.report-table th, .report-table td { border: 1px solid #b7bfd1; padding: .15rem .5rem; text-align: right; }
.report-table th { background: #e9eefb; text-align: center; }
.report-table td:first-child { text-align: left; }
.top30 { width: 100%; }
.warning { color: #b00020; }
.paper .warning { background: #fdeaea; padding: .4rem .6rem; border-radius: 4px; }
.inline { display: inline-flex; align-items: center; gap: .5rem; flex-direction: row !important; }

@media print {
    @page { size: A4; margin: 14mm; }
    html, body { background: #fff !important; }
    .no-print, .reports-header { display: none !important; }
    .reports-shell, .reports-main { display: block; max-width: none; padding: 0; margin: 0; background: #fff; }
    .paper { box-shadow: none; padding: 0; margin: 0; max-width: none; }
    .page-break { break-before: page; }
    .editable { border: none; background: transparent; resize: none; padding: 0; }
    .cover { min-height: 80vh; }
}

/* ---------- Mise en page avec les composants Radzen ---------- */
body { font-family: var(--rz-text-font-family, 'Segoe UI', Arial, sans-serif); color: var(--rz-text-color); background: var(--rz-body-background-color); margin: 0; }
a { color: var(--rz-link-color, #88aaff); }
h1, h2, h3, h4, h5, h6 { font-family: inherit; }
.reports-shell { min-height: 100vh; }
.reports-header { border-bottom: 1px solid var(--pp-line); }
.reports-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.reports-brand b { color: var(--rz-primary-light, #88aaff); }
.reports-body { padding: 0; }
.reports-main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.card-block { margin-bottom: 1rem; }
.card-block .rz-text-h6, .card-block h6 { margin: 0 0 .75rem; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field-label { color: var(--rz-text-secondary-color, #b0b2b5); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; align-items: end; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.add-row { margin-top: .75rem; }
.add-button { padding-bottom: 2px; }
.point-row { margin-bottom: .75rem; }
.nested { margin: 1rem 0; }
.time-input, .plan-input { width: 100%; min-height: 2.5rem; padding: 0 .75rem; box-sizing: border-box; }
.hint { color: var(--rz-text-secondary-color, #b0b2b5); }
@media (max-width: 700px) { .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Rapports Word : A4, Arial 9 pt, tableaux à la manière du document d'origine ---------- */
.word-report { counter-reset: sheet; font-family: Arial, Helvetica, sans-serif; color: #000; font-size: 9pt; }
.word-report .sheet { counter-increment: sheet; position: relative; box-sizing: border-box; background: #fff; width: 210mm; min-height: 297mm; padding: 25mm; margin: 14px auto; box-shadow: 0 4px 24px rgba(0, 0, 0, .35); overflow: hidden; }
.word-report .sheet.landscape { width: 297mm; min-height: 210mm; padding: 10mm; }
.word-report .sheet::after { content: counter(sheet); position: absolute; right: 10mm; bottom: 7mm; font: 9pt Calibri, Carlito, Arial, sans-serif; }
.word-report .editable { font: inherit; }
.word-report .editable.cell { appearance: none; -webkit-appearance: none; border-radius: 0; box-shadow: none; border: none; background: transparent; padding: 0; min-height: 0; resize: none; text-align: inherit; overflow: hidden; }
.word-report .editable.cell:focus { background: #fffbe0; outline: 1px solid #3871ff; }

/* Page de garde */
.cover-sheet { font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; font-size: 11pt; }
.cover-sheet .logos { display: flex; justify-content: space-between; align-items: flex-start; }
.cover-sheet .logo-azimut { height: 36mm; }
.cover-sheet .logo-opqibi { height: 24mm; margin-top: 4mm; }
.cover-sheet .logo-client { height: 60mm; display: flex; justify-content: center; align-items: center; margin-top: 14mm; }
.cover-sheet .logo-client img { max-height: 36mm; max-width: 70mm; }
.cover-titles { margin: 20mm 0 24mm; text-align: center; }
.cover-titles .editable.cover-title { display: block; text-align: center; font: bold 17pt Calibri, Carlito, 'Segoe UI', Arial, sans-serif; border-color: transparent; background: transparent; resize: none; margin-bottom: 4mm; overflow: hidden; }
.cover-period, .cover-ref { border-collapse: collapse; width: 100%; font-size: 11pt; }
.cover-period { margin-bottom: 16mm; }
.cover-period th, .cover-period td { border: .75pt solid #000; padding: 1mm 2mm; text-align: left; font-weight: bold; }
.cover-period th { width: 33%; }
.cover-ref th, .cover-ref td { border: .75pt solid #000; padding: 0 2mm; font-style: italic; font-weight: normal; }
.cover-ref th { width: 33%; text-align: center; }
.cover-ref .editable.cover-cell { border-color: transparent; background: transparent; font-style: italic; resize: none; padding: 0; min-height: 0; overflow: hidden; }
.cover-ref .company { padding: 0 2mm 2mm; font-style: normal; }
.cover-ref .editable.company-text { border-color: transparent; background: transparent; font: 8pt Calibri, Carlito, Arial, sans-serif; color: #4a4a4a; resize: none; padding: 0; overflow: hidden; }
.placeholder-xxx { background: #ffff00 !important; width: auto; }

/* Tableaux */
.caption { margin: 0 0 5px; font-size: 9pt; }
.wt { border-collapse: collapse; font-size: 9pt; }
.wt th, .wt td { border: .5pt solid #7f7f7f; padding: 0 3px; text-align: center; height: 5.1mm; line-height: 1.1; vertical-align: middle; }
.wt th { font-weight: normal; }
.wt.quarterly { flex: 1; }
.wt.quarterly th { background: #fff2cc; }
.wt.quarterly td.date { background: #d9e2f3; width: 33%; }
.month-row { display: flex; gap: 14mm; align-items: flex-start; }
.wt.monthly { width: 100%; }
.wt.monthly.reference th { background: #fff2cc; }
.wt.monthly th.wide { width: 18%; }
.wt.monthly td.comment { text-align: left; }
.wt.monthly.neighbour th { background: #fff; }
.wt.monthly.neighbour td, .wt.monthly.reference td { font-size: 8pt; }

/* TOP 30 */
.top30-title { font: bold 9pt Arial, sans-serif; text-decoration: underline; text-align: center; margin: 14mm 0 10mm; }
.wt.top30 { width: 100%; }
.wt.top30 th { height: 16mm; }
.wt.top30 td { height: 8.2mm; border-color: #555; }
.wt.top30 th, .wt.top30 td { border-color: #555; text-align: center; }

/* Émergences */
.eme-box { border: .75pt solid #555; }
.eme-title { margin: 0; padding: 1mm 0; background: #66c3f0; border-bottom: .75pt solid #555; text-align: center; font: normal 11pt Arial, sans-serif; }
.eme-box .chart { margin: 2mm; }
.eme-box .chart svg { background: transparent; }
.retenir { border-top: .75pt solid #555; padding: 1mm 2mm 4mm; min-height: 38mm; }
.retenir-title { margin: 0 0 4mm; font-weight: bold; text-decoration: underline; }
.word-report .editable.retenir-text { border-color: transparent; background: transparent; resize: none; }
.annex-title { text-align: center; font: bold 11pt Calibri, Carlito, Arial, sans-serif; margin: 20mm 0 18mm; }
.wt.annex { width: 100%; font-family: Calibri, Carlito, Arial, sans-serif; font-size: 11pt; }
.wt.annex th { text-align: left; font-weight: bold; }
.wt.annex td { text-align: left; border-color: #999; }

@media print {
    @page portrait { size: A4 portrait; margin: 25mm; @bottom-right { content: counter(page); font: 9pt Calibri, Arial, sans-serif; } }
    @page landscape { size: A4 landscape; margin: 10mm; @bottom-right { content: counter(page); font: 9pt Calibri, Arial, sans-serif; } }
    .word-report .sheet { page: portrait; width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none; overflow: visible; break-after: page; }
    .word-report .sheet.landscape { page: landscape; }
    .word-report .sheet:last-child { break-after: auto; }
    .word-report .sheet::after { display: none; }
    .word-report .editable { border: none !important; background: transparent !important; resize: none; padding: 0; }
    .word-report .placeholder-xxx { background: #ffff00 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .wt th, .wt td, .eme-title, .wt.quarterly td.date { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.logo-preview { max-height: 56px; max-width: 160px; background: #fff; padding: 4px; border-radius: 4px; }

/* ---------- Cases modifiables ---------- */
.cell-input { width: 100%; box-sizing: border-box; border: none; background: transparent; font: inherit; color: inherit; text-align: inherit; padding: 0; margin: 0; min-height: 1em; outline: none; }
.cell-input:focus { background: #fffbe0; outline: 1px solid #3871ff; }
.cell-input:hover { background: rgba(56, 113, 255, .07); }
.wt td .cell-input { text-align: center; }
.wt.monthly td.comment .cell-input, .wt.annex td .cell-input { text-align: left; }
.sheet-input { width: 100%; min-width: 3.5rem; height: 1.6rem; padding: 0 .35rem; box-sizing: border-box; }
.sheet-cell { display: block; min-height: 1.4rem; line-height: 1.4rem; border-radius: 3px; cursor: pointer; padding: 0 .25rem; }
.sheet-cell:hover { outline: 1px solid var(--rz-primary, #3871ff); }
.sheet-cell.edited { background: rgba(245, 120, 0, .55); font-weight: 700; }
.sheet-cell.struck { text-decoration: line-through; opacity: .45; }
.sheet-cell.hit { background: rgba(245, 165, 36, .22); font-weight: 600; }
.sheet-cell.hit.edited { background: rgba(245, 120, 0, .55); }

@media print { .cell-input { background: transparent !important; outline: none !important; } }

/* ---------- Feuilles de données (comme les onglets Excel) ---------- */
.data-sheets .sheet-note { display: block; margin: .25rem 0 .5rem; color: var(--rz-text-secondary-color, #b0b2b5); }
.sheet-grid { font-variant-numeric: tabular-nums; }
.sheet-grid .struck { text-decoration: line-through; opacity: .45; }
.hcell { display: block; min-height: 1.4rem; line-height: 1.4rem; border-radius: 3px; cursor: pointer; }
.hcell:hover { outline: 1px solid var(--rz-primary, #3871ff); }
.hcell.hit { background: rgba(245, 165, 36, .22); font-weight: 600; }
.hcell.edited { background: rgba(245, 120, 0, .55); font-weight: 700; }

/* ---------- Rapport complet (rapport de synthèse) ---------- */
.complete .sheet { font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; font-size: 11pt; }
.complete .sheet.landscape { padding: 12mm 14mm; }
.complete .sheet:not(.landscape):not(.cover-sheet) { padding: 20mm 22mm; }
.titre1 { text-align: center; font-weight: bold; font-size: 12pt; margin: 6mm 0 14mm; color: #000; text-decoration: none; }
.complete .lead { margin: 0 0 4mm; }
.complete .subhead { margin: 10mm 0 2mm; font-weight: bold; text-decoration: underline; }
.complete .subhead.small { font-weight: normal; font-size: 10pt; }
.complete .editable { background: transparent; border-color: transparent; resize: none; overflow: hidden; }
.complete .editable:hover { border-color: #c3cadb; }
.map-placeholder { margin-top: 10mm; min-height: 110mm; display: grid; place-items: center; border: 1px dashed #aab; color: #889; }

/* Sommaire */
.toc-title { text-align: center; font-weight: normal; font-size: 12pt; margin: 12mm 0 16mm; }
.toc-line { display: flex; align-items: baseline; gap: 4px; font-size: 9pt; margin-bottom: 3.2mm; }
.toc-dots { flex: 1; border-bottom: 1px dotted #000; transform: translateY(-2px); }

/* Cadre d'analyse : titre bleu, but bleu clair, graphiques, à retenir jaune pâle */
.abox { border: .75pt solid #333; font-size: 9pt; }
.abox-title { background: #66ccff; text-align: center; padding: 1mm 2mm; border-bottom: .75pt solid #333; font-size: 10pt; }
.abox-but { background: #ccecff; padding: 1mm 2mm 2mm; border-bottom: .75pt solid #333; }
.abox-body { background: #fff; padding: 1mm; }
.abox-body .chart { margin: 0 0 1mm; }
.abox-body .chart svg { background: transparent; }
.abox-body .stat { margin: 1mm 2mm; font-style: italic; }
.abox-retenir { background: #ffffcc; border-top: .75pt solid #333; padding: 1mm 2mm 3mm; min-height: 20mm; }
.abox-retenir .retenir-title { margin: 0 0 3mm; font-weight: bold; text-decoration: underline; }
.abox-retenir .editable.retenir-text { font: inherit; padding: 0; }

/* Page « annexes » */
.annex-cover { text-align: center; margin-top: 55mm; }
.annex-cover h1 { font-size: 36pt; font-weight: normal; margin-bottom: 14mm; }
.annex-cover p { margin: 0 0 12mm; font-size: 11pt; }

/* Extrait de l'arrêté et mise en page de l'A4 */
.extract-placeholder { margin: 6mm 0; min-height: 90mm; display: grid; place-items: center; border: 1px dashed #aab; color: #889; }
.abox-retenir.standalone { border: .75pt solid #333; margin-top: 8mm; }
.a4-grid { display: grid; grid-template-columns: 60% 40%; grid-template-rows: auto auto; align-items: start; }
.a4-grid > :first-child { grid-row: 1 / span 2; }

/* Compléments méthodologiques */
.method { font-size: 10pt; line-height: 1.35; text-align: justify; }
.method p { margin: 0 0 2mm; }
.method ul { margin: 0 0 3mm; padding-left: 5mm; }
.method li { margin-bottom: 3mm; }
.method .dash { list-style: none; }
.method .dash > li::before { content: "-  "; margin-left: -4mm; }
.method .dash > li > div { margin-left: 4mm; }
.method .circle { list-style: "o  "; }
.method .square { list-style: "▪  "; }
.method li > div { margin-top: 1mm; }

/* Tableaux d'excès et d'annexe */
.wt.excess { width: 100%; font-family: Arial, sans-serif; font-size: 8pt; }
.wt.excess th { background: #fff; }
.wt.excess th.wide { width: 15%; }
.wt.excess td.result { text-align: left; }
.wt.excess .editable.cell { font-size: 8pt; }
.wt.excess tbody td { height: 5.4mm; }
.complete-top30 th, .complete-top30 td { font-family: Arial, sans-serif; }
.complete-top30 th { height: 13mm; font-size: 8pt; }
.complete-top30 td { height: 7.2mm; }
.complete-top30 td.derog { background: #ffa500; }
.annex-frame { width: 100%; border: .75pt solid #333; font-family: Arial, sans-serif; }
.annex-frame th.strong { font-weight: bold; font-size: 9pt; height: 8mm; }
.annex-frame .graph-cell { height: 105mm; padding: 2mm; }
.graph-placeholder { height: 100%; display: grid; place-items: center; border: 1px dashed #aab; color: #889; font-size: 9pt; }
.annex-frame .comment-cell { text-align: left; vertical-align: top; height: 40mm; }
.annex-frame .comment-title { margin: 0 0 2mm; font-size: 9pt; }

@media print {
    .graph-placeholder, .map-placeholder, .extract-placeholder { border-color: transparent; color: transparent; }
    .complete .editable:hover { border-color: transparent; }
}

/* ---------- Erreur non gérée (Blazor affiche ce bandeau) ---------- */
#blazor-error-ui {
    display: none;
    background: #fff3cd;
    color: #333;
    bottom: 0;
    left: 0;
    padding: .6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
