/* Feuille de style de base — système visuel de l'application.
   Pas de dépendance externe : fonctionne en réseau local sans internet. */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #d5dce4;
  --text: #17212b;
  --text-muted: #5b6b7b;
  --primary: #14467a;
  --primary-strong: #0e3459;
  --accent: #1a8f9e;
  --ok: #1e7b45;
  --ok-bg: #e6f4ec;
  --warning: #8a5300;
  --warning-bg: #fff4e0;
  --error: #b3261e;
  --error-bg: #fdecea;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--primary); }
code, .mono { font-family: var(--mono); font-size: .9em; word-break: break-all; }
.muted { color: var(--text-muted); }

/* Barre supérieure */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--primary); color: #fff;
}
.topbar__brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.topbar__logo {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: linear-gradient(135deg, #7fd3e0, var(--accent));
}
.topbar__meta { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.topbar .muted { color: #c9d8e8; }

/* Page */
.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page__header { margin-bottom: 1.25rem; }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
}
.card--narrow { max-width: 560px; margin: 2rem auto; }
.card__title { color: var(--primary); }

.kv { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

.status { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin: 0 0 .75rem; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.status--ok { color: var(--ok); }
.status--error { color: var(--error); }

.alert { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.alert--warning { background: var(--warning-bg); color: var(--warning); border-color: #f0d29a; }
.alert--error { background: var(--error-bg); color: var(--error); border-color: #f2b8b5; }

.badge { white-space: nowrap; display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge--warning { background: var(--warning-bg); color: var(--warning); }

.hint { color: var(--text-muted); font-size: .9rem; margin: .75rem 0 0; }
.error-code { color: var(--text-muted); font-weight: 600; margin: 0 0 .25rem; }

.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: var(--radius);
  background: var(--primary); color: #fff; text-decoration: none; font: inherit; font-weight: 600; border: 0;
  cursor: pointer; line-height: 1.4;
}
.btn:hover, .btn:focus-visible { background: var(--primary-strong); }
:focus-visible { outline: 3px solid #7fb3e6; outline-offset: 2px; }

@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: .25rem; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: .4rem; }
}

/* ---- Étape 4 : navigation, formulaires, tableaux ---- */
.topbar a { color: #fff; text-decoration: none; }
.topbar__user { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.topbar__role { font-size: .75rem; color: #c9d8e8; }
.inline { display: inline; margin: 0; }

.mainnav {
  display: flex; flex-wrap: wrap; gap: 0 .25rem; padding: 0 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.mainnav__toggle { display: none; }
.mainnav a {
  padding: .7rem .85rem; color: var(--text); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500;
}
.mainnav a:hover { color: var(--primary); }
.mainnav a.is-active { border-bottom-color: var(--primary); color: var(--primary); }
/* Téléphone : menu replié derrière un bouton (étape 25) */
@media (max-width: 720px) {
  .mainnav__toggle { display: block; width: 100%; padding: .65rem 1rem; text-align: left; font: inherit; font-weight: 600;
    color: var(--primary); background: var(--surface); border: 0; border-bottom: 1px solid var(--border); cursor: pointer; }
  .mainnav { display: none; flex-direction: column; padding: 0; }
  .mainnav.is-open { display: flex; }
  .mainnav a { border-bottom: 1px solid #eef1f4; border-left: 3px solid transparent; }
  .mainnav a.is-active { border-bottom-color: #eef1f4; border-left-color: var(--primary); }
}

.page__header--row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.footer { text-align: center; padding: 1rem; font-size: .8rem; }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.plain-list { margin: 0; padding-left: 1.1rem; }
.plain-list li { margin: .2rem 0; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: .92rem; }
fieldset.field { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  font: inherit; padding: .55rem .65rem; border: 1px solid #b8c4d0; border-radius: 6px; background: #fff;
  width: 100%; min-height: 42px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); outline: 2px solid #b9d3ee; }
.field__help { color: var(--text-muted); font-size: .82rem; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.25rem; }
.field--full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400 !important; padding: .2rem 0; }
.check input { width: 18px; height: 18px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .1rem 1rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 1rem; margin-bottom: 1rem; }
.filters .actions { align-self: end; margin-bottom: .9rem; flex-wrap: wrap; }
.filters .field--check { align-self: end; grid-column: span 2; }
@media (max-width: 720px) { .filters .field--check { grid-column: auto; } }
.login { margin-top: 3rem; }

/* Boutons */
.btn--block { width: 100%; text-align: center; padding: .7rem; }
.btn--secondary { background: #e8eef5; color: var(--primary); }
.btn--secondary:hover, .btn--secondary:focus-visible { background: #d7e2ee; }
.btn--ghost { background: transparent; border: 1px solid rgba(255,255,255,.6); color: #fff; }
.btn--ghost:hover { background: rgba(255,255,255,.12); }
.btn--small { padding: .3rem .7rem; font-size: .85rem; }
.link-button { background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; padding: 0 0 0 .6rem; }

/* Tableaux */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .55rem .7rem; border-bottom: 1px solid #e6ebf0; text-align: left; vertical-align: top; }
.table th { background: #eef3f8; color: var(--primary); font-weight: 600; white-space: nowrap; }
.table tbody tr:hover { background: #f7fafc; }
.table tr.is-inactive td { color: var(--text-muted); }
.table--audit td { font-size: .85rem; }
.kvlist { list-style: none; margin: 0; padding: 0; }
.pager { display: flex; gap: .5rem; justify-content: center; margin-top: 1rem; }

.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--error { background: var(--error-bg); color: var(--error); }
.badge--muted { background: #e9edf2; color: #45525f; }
.alert--success { background: var(--ok-bg); color: var(--ok); border-color: #a9d8bb; }
.alert--info { background: #e8f1fb; color: var(--primary); border-color: #b9d3ee; }

@media (max-width: 600px) {
  .topbar__meta { flex-wrap: wrap; }
  .topbar__user { text-align: left; }
}

/* ---- Étape 5 : configuration ---- */
.card--link { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.card--link:hover { border-color: var(--primary); }
.empty { text-align: center; padding: 2rem; }
.section { margin-bottom: 1.25rem; scroll-margin-top: 1rem; }
.section__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.section__head .card__title { margin: 0; }
.subnav { display: flex; gap: 1rem; margin: 0 0 1rem; flex-wrap: wrap; }
.subnav a { font-weight: 600; }
.h1-code { font-size: 1rem; font-weight: 400; margin-left: .4rem; }
.table-wrap--flat { border: 0; margin: .75rem 0; }
.table .num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; margin-top: 1rem;
  padding-top: 1rem; border-top: 1px solid var(--border); }
.inline-form .field { flex: 0 1 200px; }
.inline-form .field--grow { flex: 1 1 260px; }
.field--button { flex: 0 0 auto !important; }
.pad-left { margin-left: .6rem; }
.toggle { display: inline-block; margin-left: .6rem; }
.toggle summary { list-style: none; display: inline; padding: 0; }
.toggle summary::-webkit-details-marker { display: none; }
.toggle[open] summary { font-weight: 600; }
.toggle__form { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; padding: .75rem;
  background: #fff8f7; border: 1px solid #f2b8b5; border-radius: var(--radius); min-width: 240px; white-space: normal; }
.toggle__form label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; font-weight: 600; }
.toggle__form input { font: inherit; padding: .4rem .5rem; border: 1px solid #b8c4d0; border-radius: 6px; }
.btn--danger { background: var(--error); }
.btn--danger:hover, .btn--danger:focus-visible { background: #8f1d17; }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.table .mono { white-space: nowrap; word-break: normal; }

/* ---- Étape 6 : rapports, calendrier, synchronisation ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.count-badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--error);
  color: #fff; font-size: .75rem; text-align: center; margin-left: .2rem; }
.sync-banner { padding: .55rem 1.25rem; font-size: .92rem; border-bottom: 1px solid; }
.sync-banner a { margin-left: .5rem; }
.sync-banner--offline { background: #2f3b48; color: #fff; border-color: #2f3b48; }
.sync-banner--offline a { color: #cfe3f7; }
.sync-banner--warning { background: var(--warning-bg); color: var(--warning); border-color: #f0d29a; }
.sync-banner--error { background: var(--error-bg); color: var(--error); border-color: #f2b8b5; }
.file-button { cursor: pointer; }

.inline-select { display: flex; align-items: center; gap: .5rem; }
.inline-select label { font-weight: 600; }
.inline-select select { font: inherit; padding: .45rem .6rem; border: 1px solid #b8c4d0; border-radius: 6px; min-height: 40px; }
.calendar-head { display: flex; justify-content: space-between; align-items: center; margin: .5rem 0 .75rem; }
.calendar-head h2 { margin: 0; text-transform: capitalize; }
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar__row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar__row--head div { padding: .5rem; font-weight: 600; color: var(--primary); background: #eef3f8; text-align: center; }
.calendar__cell { min-height: 78px; padding: .4rem .5rem; border-top: 1px solid #e6ebf0; border-left: 1px solid #e6ebf0;
  display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: var(--text); background: #fff; }
.calendar__row .calendar__cell:first-child { border-left: 0; }
a.calendar__cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.calendar__cell--out { background: #f7f9fb; }
.calendar__cell--future { background: #f7f9fb; color: #9aa7b4; }
.calendar__cell--today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar__day { font-weight: 700; }
.calendar__status { font-size: .78rem; line-height: 1.2; }
.status-none .calendar__status { color: var(--text-muted); }
.status-brouillon { border-left: 4px solid #8a99a8; }
.status-rejete { background: var(--error-bg); }
.status-soumis, .status-valide_csp, .status-valide_cu, .status-valide_dt { background: #fff7e6; }
.status-valide { background: var(--ok-bg); }
.status-badge.status-brouillon { background: #e9edf2; color: #45525f; border: 0; }
.status-badge.status-rejete { color: var(--error); }
.status-badge.status-valide { color: var(--ok); }
.status-badge.status-soumis, .status-badge.status-valide_csp, .status-badge.status-valide_cu, .status-badge.status-valide_dt { color: var(--warning); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; font-size: .85rem; color: var(--text-muted); }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px;
  border: 1px solid #c8d1db; }
.legend .dot.status-none { background: #fff; }
.legend .dot.status-brouillon { background: #fff; border-left: 4px solid #8a99a8; }

.report-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.report-head__date { font-size: 1.15rem; font-weight: 600; margin: .1rem 0; }
.report-head__side { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.status-badge { font-size: .9rem; padding: .3rem .8rem; }
.day-nav { display: flex; gap: .4rem; }
.inline-form--plain { border-top: 0; padding-top: 0; margin-top: .5rem; }
.save-status { font-size: .9rem; }
.save-status--ok { color: var(--ok); }
.save-status--warning { color: var(--warning); }
.save-status--error { color: var(--error); }
@media (max-width: 600px) {
  .calendar__cell { min-height: 58px; padding: .3rem; }
  .calendar__status { font-size: .68rem; }
  .report-head__side { align-items: flex-start; }
}

/* Attribut hidden toujours respecté (badges, messages) */
[hidden] { display: none !important; }

/* Tableau empilé en fiches sur téléphone (page Synchronisation) */
.sync-row--conflit td[data-label="État"], .sync-row--refusee td[data-label="État"] { color: var(--error); font-weight: 600; }
@media (max-width: 720px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { border-bottom: 1px solid var(--border); padding: .6rem .2rem; }
  .table--stack td { border: 0; padding: .2rem .6rem; white-space: normal; }
  .table--stack td::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--text-muted); font-weight: 600; }
  .table--stack td.nowrap { display: flex; gap: 1rem; flex-wrap: wrap; padding-top: .5rem; }
  .table--stack td.nowrap::before { display: none; }
}

/* ---------------- Étape 7 : onglets du rapport, indicateurs, champs numériques ---------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; overflow-x: auto;
        -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tabs__tab { padding: .65rem 1rem; color: var(--text-muted); text-decoration: none; font-weight: 600; white-space: nowrap;
             border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs__tab:hover { color: var(--primary); }
.tabs__tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
body:not(.has-tabs) .tab-panel + .tab-panel { margin-top: 2rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem;
       display: flex; flex-direction: column; gap: .15rem; box-shadow: var(--shadow); }
.kpi__label { font-size: .82rem; color: var(--text-muted); font-weight: 600; }
.kpi__value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi__value small { font-size: .9rem; font-weight: 600; color: var(--text-muted); }
.kpi__note { font-size: .82rem; color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; align-items: start; }
.field--number input { font-variant-numeric: tabular-nums; text-align: right; font-size: 1.05rem; }
.field__label { font-weight: 600; font-size: .92rem; }
.unit { font-weight: 400; color: var(--text-muted); }
.value-display { margin: 0; padding: .5rem 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.value-display--result { font-size: 1.35rem; font-weight: 700; color: var(--primary); padding: .35rem 0; }
.field input.is-invalid, .field textarea.is-invalid { border-color: var(--error); background: var(--error-bg); }
.field__error { color: var(--error); font-size: .84rem; margin: 0; font-weight: 600; }
.alert--inline { margin: .25rem 0 1rem; padding: .5rem .8rem; font-size: .9rem; }
.card .field__help + .form-row { margin-top: .9rem; }

/* ---------------- Étape 8 : grille horaire des index ---------------- */
.hgrid-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.hgrid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.hgrid th, .hgrid td { padding: .25rem .45rem; border-bottom: 1px solid #e7ecf1; white-space: nowrap; vertical-align: middle; }
.hgrid thead { position: sticky; top: 0; z-index: 3; }
.hgrid thead th { background: #eef3f8; vertical-align: bottom; }
.hgrid thead tr:nth-child(2) th { font-size: .78rem; color: var(--text-muted); }
.hgrid tfoot { position: sticky; bottom: 0; z-index: 3; }
.hgrid tfoot th, .hgrid tfoot td { background: #eef3f8; border-top: 2px solid var(--border); }
.hgrid__hour { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; font-variant-numeric: tabular-nums; min-width: 5.5rem; }
.hgrid thead .hgrid__hour { z-index: 3; background: #eef3f8; }
.hgrid__meter { text-align: center; border-left: 2px solid var(--border); }
.hgrid td.hgrid__cell { border-left: 2px solid var(--border); }
.hgrid__row--bound th, .hgrid__row--bound td { background: #f6f9fc; }
.hgrid__input { width: 8.5rem; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px; text-align: right;
               font: inherit; font-variant-numeric: tabular-nums; background: #fff; }
.hgrid__input:focus { border-color: var(--primary); outline: 2px solid #b9d3ee; }
.hgrid__input:disabled { background: #f1f3f5; color: var(--text-muted); border-style: dashed; }
.hgrid__input.is-invalid { border-color: var(--error); background: var(--error-bg); }
.hgrid__input.is-reset { background: var(--warning-bg); border-color: #f0d29a; }
.hgrid__volume { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 5rem; }
.hgrid__na { text-align: center; color: #c3ccd5; }
.hgrid__value { font-variant-numeric: tabular-nums; }
.badge--type { background: var(--primary); color: #fff; }
.field__errors { background: var(--error-bg); color: var(--error); border: 1px solid #f2b8b5; border-radius: var(--radius);
                 padding: .5rem .8rem; margin: .75rem 0; font-size: .88rem; }
.field__errors p { margin: .15rem 0; }
.actions--sticky { position: sticky; bottom: 0; background: var(--surface); padding: .6rem 0; margin-top: .5rem; z-index: 4; }
.field select { font: inherit; }

/* ---------------- Étape 9 : bilan hydraulique ---------------- */
.balance { max-width: 560px; }
.balance th { background: transparent; color: var(--text); font-weight: 500; }
.balance td { font-variant-numeric: tabular-nums; text-align: right; }
.balance__total th, .balance__total td { font-weight: 700; border-top: 2px solid var(--border); }
.balance__ecart td { color: var(--primary); font-size: 1.1rem; }
.table--middle td { vertical-align: middle; }

/* ---------------- Étape 10 : pompes ---------------- */
.kpis--compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kpis--compact .kpi__value { font-size: 1.35rem; }
.pgrid .pgrid__input { width: 4.6rem; }
.pgrid__stopped { display: none; font-weight: 700; color: var(--warning); letter-spacing: .04em; }
.pgrid__cell.is-stopped .pgrid__input { display: none; }
.pgrid__cell.is-stopped .pgrid__stopped { display: inline-block; }
.pgrid__cell.is-stopped { background: var(--warning-bg); }
.pgrid__toggle { padding-left: 0 !important; }
.btn--tiny { padding: .2rem .45rem; font-size: .72rem; font-weight: 700; background: #eef3f8; color: var(--text-muted);
             border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.btn--tiny.is-on { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn--tiny:disabled { opacity: .45; cursor: default; }
.row-action { display: inline-block; margin-right: .6rem; vertical-align: top; }
.row-action[open] { display: block; margin: .4rem 0; }
.row-action form { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: flex-end; padding: .6rem; margin-top: .4rem;
                   background: #f6f9fc; border: 1px solid var(--border); border-radius: var(--radius); white-space: normal; }
.row-action label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; gap: .2rem; }
.row-action input { padding: .3rem .45rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.row-action .field__errors { flex-basis: 100%; margin: 0; }
.time-input { font-variant-numeric: tabular-nums; max-width: 9rem; }

/* ---------------- Étape 11 : courbes des citernes ---------------- */
.tank-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 1rem; }
.tank-chart { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .8rem .4rem; background: var(--surface); }
.tank-chart figcaption { font-size: .9rem; margin-bottom: .3rem; }
.tank-chart__svg { width: 100%; height: auto; display: block; overflow: visible; }
.tank-chart__grid { stroke: #e7ecf1; stroke-width: 1; }
.tank-chart__tick { fill: var(--text-muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.tank-chart__line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tank-chart__dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.tank-chart__capacity { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.tank-chart__hit { fill: transparent; cursor: crosshair; }
.tank-chart__tip rect { fill: var(--text); }
.tank-chart__tip text { fill: #fff; font-size: 12px; font-family: var(--font); font-weight: 600; }

/* ---------------- Étape 12 : produits ---------------- */
.products .hgrid__input { width: 5.6rem; }
.products .products__obs { width: 9rem; text-align: left; }
.products th, .products td { padding-left: .45rem; padding-right: .45rem; }
.products__group th { background: #f6f9fc; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.products tbody th[scope=row] { background: transparent; color: var(--text); font-weight: 600; }
/* Onglets du rapport : sur ordinateur et tablette, retour à la ligne (tous visibles) ; défilement sur téléphone */
@media (min-width: 721px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 0; }
}

/* ---------------- Étape 14 : analyses ---------------- */
.analysis-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 .9rem; }
.analysis-inputs input { text-align: right; }
.analysis-table th[scope=row] { background: transparent; color: var(--text); font-weight: 600; }
.value-out { color: var(--error); font-weight: 700; }
.badge--muted { background: #eef1f4; color: var(--text-muted); }
.badge--error { background: var(--error-bg); color: var(--error); }

/* Étape 15 — rendement */
.month-yield { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .75rem; }
.month-yield__main { display: flex; flex-direction: column; min-width: 180px; }
.month-yield__detail { flex: 1 1 320px; }
.month-yield__detail p { margin: 0 0 .35rem; }
.calendar__yield { display: block; margin-top: .2rem; font-weight: 600; font-size: .85rem; color: var(--primary); }

/* Étape 16 — incidents */
a.kpi--link { color: inherit; text-decoration: none; }
a.kpi--link:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.incident { border: 1px solid var(--border); border-left: 4px solid #9aa7b4; border-radius: var(--radius); padding: .65rem .85rem; margin: 0 0 .75rem; background: var(--surface); }
.incident--ouvert, .incident--en_cours { border-left-color: var(--warning); }
.incident--resolu { border-left-color: var(--ok); }
.incident__head { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; }
.incident__desc { margin: .4rem 0; white-space: pre-line; }
.incident__facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem 1rem; margin: 0 0 .35rem; }
.incident__facts dt { font-size: .8rem; color: var(--muted, #5b6875); }
.incident__facts dd { margin: 0; white-space: pre-line; }
.incident .row-action form { margin-top: .5rem; }
.incident-new > summary { cursor: pointer; }
.form-row--wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem 1rem; }
.form-row--wide textarea { width: 100%; }
.kpi__alert { display: block; margin-top: .3rem; font-size: .8rem; font-weight: 600; color: var(--error); }
.calendar__yield--over { color: var(--error); }

/* Étape 17 — graphique de marche 06h00 → 06h00 (SVG, positions en % de la journée) */
.rc { --rc-label: 170px; --rc-total: 110px; font-size: .9rem; }
.rc__row { display: grid; grid-template-columns: var(--rc-label) minmax(0, 1fr) var(--rc-total); align-items: center; gap: .5rem; min-height: 34px; }
.rc__row + .rc__row { border-top: 1px solid #eef1f4; }
.rc__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc__total { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc__row--axis { min-height: 26px; font-size: .78rem; color: #5b6875; }
.rc__row--axis .rc__total { font-weight: 600; }
.rc__axis, .rc__track { display: block; overflow: visible; }
.rc__tick { fill: #5b6875; font-size: 11px; }
.rc__group { margin-top: .5rem; padding: .25rem 0; font-weight: 600; color: var(--primary); border-bottom: 1px solid var(--border); }
.rc__bg { fill: #f4f6f8; }
.rc__grid { stroke: #dfe4ea; stroke-width: 1; }
.rc__bar { fill: var(--primary); }
.rc__bar--open { fill: #4f7fae; stroke: #0c2f52; stroke-width: 1; stroke-dasharray: 4 2; }
.rc__incident { fill: #c42b1c; }
.rc__incident--open { fill: #e0786d; stroke: #7a1a10; stroke-width: 1; stroke-dasharray: 3 2; }
.rc__bar:focus, .rc__incident:focus { outline: none; stroke: #f0a000; stroke-width: 2; }
.rc__future { fill: rgba(240, 242, 245, .85); pointer-events: none; }
.rc__now { stroke: #f0a000; stroke-width: 2; pointer-events: none; }
.rc__legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .75rem; font-size: .85rem; color: #45525f; }
.rc__legend span { display: inline-flex; align-items: center; gap: .35rem; }
.rc__sw { display: inline-block; width: 22px; height: 12px; border-radius: 2px; }
.rc__sw--run { background: var(--primary); }
.rc__sw--open { background: #4f7fae; border: 1px dashed #0c2f52; }
.rc__sw--incident { height: 6px; background: #c42b1c; }
.rc__sw--now { width: 3px; background: #f0a000; }
.rc__sw--future { background: #e8ebef; border: 1px solid #d5dbe2; }
@media (max-width: 1100px) {
  .rc__tick--minor { display: none; }
  .rc__total .badge { display: none; }
}
@media (max-width: 720px) {
  .rc { --rc-label: 64px; --rc-total: 52px; font-size: .8rem; }
  .rc__label .muted { display: none; }
  .rc__tick--minor, .rc__tick--phone { display: none; }
  .rc__total .badge { display: none; }
}
@media print { .rc__sw { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.rc__detail { margin: .6rem 0 0; padding: .4rem .6rem; border-radius: var(--radius); background: #f4f6f8; font-size: .85rem; color: #5b6875; }
.rc__detail.is-set { color: inherit; background: #eef3f8; }
.rc__bar, .rc__incident { cursor: pointer; }

/* Étape 18 — validation à 5 niveaux */
.wf__steps { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: .25rem 0 .75rem; }
.wf__step { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem .3rem .35rem; border-radius: 999px;
  background: #eef1f4; color: #5b6875; font-size: .85rem; }
.wf__num { display: inline-flex; width: 1.4rem; height: 1.4rem; align-items: center; justify-content: center; border-radius: 50%;
  background: #fff; font-weight: 700; font-size: .8rem; }
.wf__step.is-done { background: var(--ok-bg); color: var(--ok); }
.wf__step.is-done .wf__num { background: var(--ok); color: #fff; }
.wf__step.is-current { background: var(--warning-bg); color: var(--warning); font-weight: 600; outline: 2px solid currentColor; }
.wf__list { margin: .25rem 0 .75rem 1.2rem; padding: 0; }
.wf__list li { margin: .15rem 0; }
.wf__list--error { color: var(--error); }
.wf__warnings summary, .wf__history summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }
.wf__form { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .75rem; max-width: 760px; }
.wf__form textarea { width: 100%; }
.pre-line { white-space: pre-line; }
.wf__hwarn summary { cursor: pointer; font-size: .85rem; color: var(--warning); }
.wf__hwarn .wf__list { font-size: .85rem; }

/* Étape 19 — tableau de bord */
.dash-day { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.dash-todo { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1rem; }
.dash-alerts__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.dash-alert { display: flex; gap: .45rem; align-items: baseline; }
.dash-alert__icon { width: 1rem; text-align: center; }
.dash-alert--critique .dash-alert__icon { color: var(--error); }
.dash-alert--attention .dash-alert__icon { color: var(--warning); }
.dash-table th[scope=row] { white-space: nowrap; }
.dash-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 1rem; }
.dash-months .card.section { margin: 0; }
.dchart { margin: .5rem 0 0; }
.dchart__body { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: .4rem; }
.dchart__y { display: flex; flex-direction: column; justify-content: space-between; height: 150px; text-align: right;
  font-size: .72rem; color: #5b6875; font-variant-numeric: tabular-nums; line-height: 1; margin-top: -.35em; }
.dchart__svg { display: block; overflow: visible; }
.dchart__grid { stroke: #e3e8ee; stroke-width: 1; }
.dchart__bar { fill: var(--primary); cursor: pointer; }
.dchart__bar--over { fill: var(--error); }
.dchart__bar:focus { outline: none; stroke: #f0a000; stroke-width: 2; }
.dchart__cap { stroke: #45525f; stroke-width: 2; stroke-dasharray: 6 3; }
.dchart__x { fill: #5b6875; font-size: 11px; }
.dchart__detail { margin: .4rem 0 0; padding: .35rem .6rem; border-radius: var(--radius); background: #f4f6f8; font-size: .85rem; color: #5b6875; }
.dchart__detail.is-set { color: inherit; background: #eef3f8; }
.dchart__legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .45rem 0 0; font-size: .8rem; color: #45525f; }
.dchart__legend span { display: inline-flex; align-items: center; gap: .3rem; }
.dchart__sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; background: var(--primary); }
.dchart__sw--over { background: var(--error); }
.dchart__sw--cap { height: 0; border-top: 2px dashed #45525f; width: 18px; border-radius: 0; }
@media (max-width: 640px) { .dash-months { grid-template-columns: 1fr; } }

/* Étape 21 — rapports de période */
.links-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.period-row--month td { font-weight: 600; background: #f4f7fa; }

/* Étape 22 — historique et archives */
#historique .table--audit td { overflow-wrap: break-word; }
#historique .table--audit td:nth-child(2) { min-width: 110px; }
#historique .table--audit td:nth-child(7) { min-width: 180px; max-width: 280px; }

/* Identité de l'entreprise */
.topbar__img { height: 34px; width: auto; max-width: 120px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.topbar__names { display: flex; flex-direction: column; line-height: 1.15; }
.topbar__company { font-size: .78rem; font-weight: 500; color: #c9d8e8; letter-spacing: .02em; }
.identity-preview { margin: .25rem 0 .5rem; padding: .5rem; background: #f4f6f8; border: 1px solid var(--border); border-radius: var(--radius); display: inline-block; }
.identity-preview img { max-height: 90px; max-width: 260px; display: block; }
