/* Cockpit fiscal — un tableau de bord de travail : une colonne, des cartes par rôle, polices système (CSP 'self'). */
:root {
  --bg: #f4f6f3; --surface: #ffffff; --ink: #1c2928; --muted: #5b6a68; --line: #d8dfdb;
  --accent: #1f6f66; --accent-ink: #ffffff; --accent-soft: #e1eeea;
  --ok: #2d7a46; --ok-soft: #e2f1e6; --warn: #9a5b07; --warn-soft: #f7ebd5; --crit: #a53a31; --crit-soft: #f7e0dc;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121918; --surface: #1a2322; --ink: #e4ebe8; --muted: #9daeab; --line: #2c3837;
    --accent: #67c0b3; --accent-ink: #0d1716; --accent-soft: #1d3330;
    --ok: #7fcf96; --ok-soft: #1c3124; --warn: #e5a956; --warn-soft: #33281a; --crit: #ec8d83; --crit-soft: #3a2220;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 40px 16px; color: var(--muted); }
.page { max-width: 980px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 60px; display: grid; gap: 16px; }
.page.centre { min-height: 90vh; place-items: center; }
.pile { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.petit { font-size: 13px; }
.alerte { background: var(--crit-soft); color: var(--crit); padding: 12px 14px; border-radius: 8px; }

/* entête */
.entete { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 16px; }
.marque { display: flex; gap: 10px; align-items: center; }
.marque div { display: grid; line-height: 1.25; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  font: 600 20px/1 var(--serif); }
.onglets-vue { display: flex; flex-wrap: wrap; gap: 4px; }
.lien { background: none; border: 0; color: var(--muted); font: inherit; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.lien:hover, .lien.actif { color: var(--ink); background: var(--accent-soft); }

/* échéances */
.echeances { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.echeance { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.echeance .jours { font: 600 13px var(--mono); white-space: nowrap; }
.echeance.critique { border-color: var(--crit); background: var(--crit-soft); }
.echeance.critique .jours { color: var(--crit); }
.echeance.attention .jours { color: var(--warn); }

/* trimestres */
.trimestres { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tab { background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: 600 14px var(--sans); padding: 8px 12px; border-radius: 8px;
  cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tab.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pastille { background: var(--crit); color: #fff; font: 600 11px var(--mono); border-radius: 999px; padding: 1px 6px; }
.tab.actif .pastille { background: var(--accent-ink); color: var(--accent); }

/* cartes */
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; min-width: 0; }
.carte h2 { font: 600 20px/1.3 var(--serif); margin: 0; text-wrap: balance; }
.carte h3 { margin: 10px 0 0; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.carte h4 { margin: 0; font-size: 16px; }
.carte p { margin: 0; }
.titre-ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.vide { color: var(--ok); font-weight: 600; }
.lettre { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font: 600 13px var(--serif); text-transform: none; letter-spacing: 0; }

/* progression et tuiles */
.progression { display: grid; gap: 6px; }
.barre { height: 10px; background: var(--crit-soft); border-radius: 999px; overflow: hidden; }
.barre span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.tuile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.tuile .n { font: 600 24px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.tuile .lib { font-size: 13px; color: var(--muted); }
.tuile .eur { font: 13px var(--mono); }
.tuile.ok .n { color: var(--ok); } .tuile.attention .n { color: var(--warn); } .tuile.critique .n { color: var(--crit); }

/* fournisseurs à récolter */
.fournisseur { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 6px; }
.fournisseur.termine { opacity: .6; }
.methode { font-size: 13px; color: var(--muted); }
.lignes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ligne { display: grid; grid-template-columns: 88px 100px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; font-size: 14px; }
.ligne:nth-child(odd) { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.ligne .date { font: 13px var(--mono); color: var(--muted); }
.ligne .montant { font: 13px var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.ligne .lib { overflow-wrap: anywhere; }
.ligne .actions { display: flex; gap: 4px; }
.ligne.coche.fait .lib, .ligne.coche.fait .montant { text-decoration: line-through; color: var(--muted); }
.ligne.coche.fait { background: var(--ok-soft); }
.ligne.coche.prive, .ligne.coche.ignore { opacity: .6; }
.ligne.coche.pro { background: var(--accent-soft); }
.case { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
.tournee { margin: 0; padding-left: 22px; display: grid; gap: 6px; }

/* boutons */
.btn { display: inline-block; background: var(--surface); color: var(--accent); border: 1px solid var(--accent); border-radius: 7px; padding: 6px 12px;
  font: 600 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent-soft); }
.btn.primaire { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: wait; }
.mini { background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 3px 8px; font: 12px var(--sans); cursor: pointer; }
.mini.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 600 12px var(--sans); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.attention { background: var(--warn-soft); color: var(--warn); }
.chip.critique { background: var(--crit-soft); color: var(--crit); }

/* tableaux */
.defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.grille { text-align: left; color: var(--muted); }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }

/* connexion */
.connexion { width: min(380px, 100%); }
.connexion h1 { font: 600 26px var(--serif); margin: 0; }
.connexion label:not(.case) { font-size: 13px; font-weight: 600; margin-top: 4px; }
.connexion input:not([type=checkbox]) { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); width: 100%; }
.msg.erreur { color: var(--crit); min-height: 1.2em; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto;
  background: var(--crit); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 20; }

@media (max-width: 640px) {
  .ligne { grid-template-columns: 76px minmax(0, 1fr); }
  .ligne .montant { text-align: left; }
  .ligne .lib { grid-column: 1 / -1; }
  .ligne .actions { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.ajustement { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 6px; }
