/* Styles de VitiSample — REPRIS de VitiVente (même châssis, mêmes thèmes,
   mêmes cartes, volets et tableaux) pour que les applis Oenovae se
   ressemblent. Ce qui est propre à VitiSample est en fin de fichier.
   ══ Thèmes ══════════════════════════════════════════════════════════════
   Un thème ne fixe que SIX couleurs (papier, carte, encre, gris, marque, or) ;
   les autres nuances en sont dérivées par color-mix. Les couleurs de statut
   (vert, orange, rouge) sont communes à tous les thèmes. */
:root {
  --paper: #f3efe9;
  --card: #fff;
  --ink: #241a1d;
  --muted: #7b7480;
  --p: #6a1b2a;
  --gold: #a9803f;
}
[data-theme='ardoise'] {
  --paper: #eef1f5;
  --card: #fff;
  --ink: #161b22;
  --muted: #646e7d;
  --p: #33485f;
  --gold: #a8794c;
}
[data-theme='vigne'] {
  --paper: #eff3ee;
  --card: #fff;
  --ink: #16201a;
  --muted: #66756a;
  --p: #2c5942;
  --gold: #a9803f;
}
[data-theme='cuivre'] {
  --paper: #f7f0ea;
  --card: #fff;
  --ink: #2a1f18;
  --muted: #7c7067;
  --p: #8a4526;
  --gold: #b5843a;
}
[data-theme='sombre'] {
  --paper: #141213;
  --card: #1d1a1b;
  --ink: #f0ebe7;
  --muted: #a39b9e;
  --p: #e07a9c;
  --gold: #c9a15e;
  color-scheme: dark;
}

:root {
  --bg: var(--paper);
  --surface: var(--card);
  --surface-2: color-mix(in oklab, var(--paper) 70%, var(--card));
  --border: color-mix(in oklab, var(--paper) 88%, var(--ink));
  --text: var(--ink);
  --text-2: color-mix(in oklab, var(--card) 27%, var(--ink));
  --accent: var(--p);
  --accent-soft: color-mix(in oklab, var(--card) 90%, var(--p));
  --th: color-mix(in oklab, var(--card) 88%, var(--gold));
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #6250d6;
  --s7: #008300;
  --good: #15803d;
  --warn: #b45309;
  --bad: #c62828;
  --good-bg: color-mix(in oklab, var(--card) 88%, #15803d);
  --warn-bg: color-mix(in oklab, var(--card) 86%, #d97706);
  --bad-bg: color-mix(in oklab, var(--card) 88%, #c62828);
  --shadow:
    0 1px 2px color-mix(in oklab, var(--ink) 7%, transparent),
    0 8px 24px color-mix(in oklab, var(--ink) 9%, transparent);
  --rayon: 12px;
}
[data-theme='sombre'] {
  --good: #5cc27a;
  --warn: #e0a640;
  --bad: #ef6b6b;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.45 'Segoe UI',
    system-ui,
    -apple-system,
    Roboto,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent);
}
h1,
h2,
h3 {
  font-weight: 650;
}

/* ── Châssis ─────────────────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}
nav.side {
  width: 222px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  font-weight: 750;
  font-size: 16px;
  padding: 0 8px 10px;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.brand small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}
nav.side a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-2);
  text-decoration: none;
  margin-top: 2px;
}
nav.side a:hover {
  background: var(--surface-2);
}
nav.side a.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
nav.side .ic {
  width: 20px;
  text-align: center;
  flex: none;
}
nav.side .cnt {
  margin-left: auto;
  font-size: 11px;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 999px;
  padding: 0 7px;
  font-weight: 700;
}
nav.side .sep {
  height: 1px;
  background: var(--border);
  margin: 12px 6px;
}
nav.side .note {
  font-size: 12px;
  color: var(--muted);
  padding: 0 8px;
}
nav.side .version {
  margin-top: 6px;
  opacity: 0.7;
}
.replier {
  margin-top: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}
.replier:hover {
  background: var(--surface-2);
}
body.mini nav.side {
  width: 62px;
  padding: 16px 8px;
}
body.mini nav.side .lbl,
body.mini nav.side .note,
body.mini .brand small,
body.mini nav.side .cnt {
  display: none;
}
body.mini .brand {
  font-size: 0;
  padding: 0 0 10px;
  text-align: center;
}
body.mini .brand::before {
  content: 'V';
  font-size: 18px;
}
body.mini nav.side a {
  justify-content: center;
  padding: 9px 0;
}

main {
  flex: 1;
  min-width: 0;
  padding: 0 24px 14px;
}
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  margin: 0 -24px 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  font-size: 20px;
  margin: 0 auto 0 0;
}
.ybanner {
  background: var(--warn-bg);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

/* ── Contrôles ───────────────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.barre-filtres {
  margin-bottom: 10px;
}
.barre-filtres input[type='search'] {
  flex: 1;
  min-width: 240px;
}
select,
input[type='text'],
input:not([type]),
input[type='number'],
input[type='date'],
input[type='search'],
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
  min-height: 34px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
input.grand {
  width: 100%;
  font-size: 15px;
  padding: 9px 12px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: none;
  padding: 6px 11px;
  cursor: pointer;
  color: var(--text-2);
}
.seg button:hover {
  background: var(--surface-2);
}
.seg button.on {
  background: var(--accent);
  color: #fff;
}
.seg.annee button {
  font-weight: 650;
}
.seg.annee button.on {
  background: var(--ink);
  color: var(--paper);
}
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn:hover {
  filter: brightness(0.97);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.danger {
  color: var(--bad);
}
.btn.ghost {
  border-color: transparent;
  background: none;
  color: var(--accent);
  padding: 4px 6px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.case {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

/* ── Cartes, indicateurs ─────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.kpis {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.kpis.trois {
  grid-template-columns: repeat(3, 1fr);
}
.two {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}
.deux {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.param .large {
  grid-column: 1 / -1;
}
@media (max-width: 1100px) {
  .two,
  .deux {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rayon);
  padding: 16px;
  margin-bottom: 14px;
}
.grid > .card {
  margin-bottom: 0;
}
.card h2 {
  font-size: 15px;
  margin: 0 0 4px;
}
.card .sub {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
.card.erreur {
  border-color: var(--bad);
}
.chead {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.chead .sub {
  margin: 0;
}
.bandeau-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.kpi .lab {
  color: var(--text-2);
  font-size: 12px;
}
.kpi .val {
  font-size: 24px;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.kpi .val small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.kpi .foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.kpi.hl {
  border-color: var(--accent);
}
.petit {
  font-size: 15px;
}

/* ── Tableaux : pleine largeur de la carte, en-têtes figés ───────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--th);
}
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th:first-child,
td:first-child {
  padding-left: 16px;
}
th:last-child,
td:last-child {
  padding-right: 16px;
}
td.n,
th.n {
  text-align: right;
  white-space: nowrap;
}
th.grpH {
  text-align: center;
  border-bottom: 0;
  padding-bottom: 0;
}
td.sepL,
th.sepL {
  border-left: 1px solid var(--border);
}
tr.click {
  cursor: pointer;
}
tbody tr:not(.grp):not(.total):hover td {
  background: var(--accent-soft);
}
tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: var(--surface-2);
}
tr.grp td {
  background: var(--bg);
  font-weight: 700;
  color: var(--accent);
}
/* Une seule barre de défilement à l'écran : un tableau ordinaire grandit et
   la page défile ; un grand tableau (.plein) s'arrête pile en bas de l'écran
   (hauteur calculée par app.js#ajusterTableaux) et garde ses en-têtes figés. */
.scroll {
  overflow: auto;
}
.scroll.court {
  max-height: none;
}
.card .scroll {
  margin-left: -16px;
  margin-right: -16px;
  border-top: 1px solid var(--border);
}
/* En-tête figé PARTOUT : sous la barre du haut quand la page défile
   (--haut-entete, mesurée par app.js), en haut du cadre quand c'est le
   tableau qui défile (.plein, .deborde, fenêtres, volets). */
:root {
  --haut-entete: 64px;
}
thead {
  position: sticky;
  top: var(--haut-entete);
  z-index: 3;
}
.scroll.plein thead,
.scroll.deborde thead,
.modal thead,
.drawer thead,
.mbody thead,
.dbody thead {
  top: 0;
}
.scroll:not(.plein):not(.deborde) {
  overflow: visible;
}
.scroll.deborde {
  overflow: auto;
  max-height: calc(100vh - var(--haut-entete) - 20px);
}
.drawer .scroll,
.modal .scroll {
  margin: 0;
}
.vide {
  text-align: center;
  color: var(--muted);
  padding: 28px 10px;
}
.note-tableau {
  margin: 10px 16px 0;
}
.sous-liste {
  margin-top: 12px;
}

/* ── Petites marques ─────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill.good {
  background: var(--good-bg);
  color: var(--good);
  border-color: transparent;
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: transparent;
}
.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: transparent;
}
.neg {
  color: var(--bad);
  font-weight: 600;
}
.ok {
  color: var(--good);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.lien {
  color: var(--accent);
}
.espace-haut {
  margin-top: 8px;
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 6px;
}
.bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  min-width: 70px;
  display: flex;
}
.bar.epaisse {
  height: 12px;
  max-width: 280px;
}
.bar i {
  display: block;
  height: 100%;
}
.bar i + i {
  margin-left: 2px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
  margin: 6px 0 4px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 12px;
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.chips .x {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
}
.chips .x:hover {
  color: var(--bad);
}
.cascade {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
}
.cascade .lv {
  border: 2px solid;
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13px;
  background: var(--surface);
}
.cascade .pile {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cascade .ar {
  color: var(--muted);
  font-size: 12px;
}
.alert {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.alert:last-child {
  border-bottom: 0;
}
.alert .ic {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}
.alert .ic.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.alert .ic.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.alert .ic.good {
  background: var(--good-bg);
  color: var(--good);
}
.alert .t {
  font-weight: 600;
}
.alert .d {
  font-size: 12px;
  color: var(--text-2);
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart text {
  fill: var(--muted);
  font-size: 11px;
}
.chart .grille {
  stroke: var(--border);
}
.tip {
  position: fixed;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  z-index: 80;
  display: none;
  min-width: 160px;
}
.tip b {
  display: block;
  margin-bottom: 4px;
}
.tip .r {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.tip .tot {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 4px;
}

/* ── Saisie en ligne (DR) ────────────────────────────────────────────── */
input.cell {
  width: 96px;
  text-align: right;
  min-height: 30px;
  padding: 4px 7px;
  font-variant-numeric: tabular-nums;
}
input.cell.invalide {
  border-color: var(--bad);
  background: var(--bad-bg);
}
input.cell.enregistre {
  border-color: var(--good);
  transition: border-color 0.2s;
}

/* ── Volet, fenêtre, formulaires ─────────────────────────────────────── */
.voile {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: none;
  z-index: 30;
}
.voile.open {
  display: block;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(640px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 31;
  transform: translateX(100%);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.drawer.open {
  transform: none;
}
.dhead {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.dhead h3 {
  margin: 0;
  font-size: 18px;
}
.dbody {
  padding: 16px 20px;
  overflow: auto;
  flex: 1;
}
.dfoot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.fond-fenetre {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  z-index: 40;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
}
.fond-fenetre.open {
  display: flex;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(1200px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.mhead {
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.mhead h3 {
  margin: 0 0 10px;
  font-size: 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mhead .filters {
  margin-top: 8px;
}
.mbody {
  overflow: auto;
}
.mbody thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.mcorps {
  padding: 16px 18px;
}
.mpied {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.kv {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin: 14px 0;
}
.kv > div:nth-child(odd) {
  color: var(--muted);
}
.fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.fgrid .full {
  grid-column: 1 / -1;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  width: 100%;
}
.hint {
  font-size: 12px;
  margin-top: 3px;
}
.valeur-calc {
  padding-top: 7px;
  font-weight: 600;
}
.ligne-champs {
  display: flex;
  gap: 6px;
}
.ligne-champs input {
  flex: 1;
  min-width: 0;
}
.section-t {
  font-size: 12px;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-t:first-child {
  margin-top: 0;
}
.line {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.line .lh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
}
.pick {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.pick:hover {
  border-color: var(--accent);
}
.pick.chosen {
  border-style: solid;
}
.pick .who {
  font-weight: 600;
}
.pick .what {
  font-size: 12px;
  color: var(--text-2);
}
.pick .droite {
  text-align: right;
}
.compoed .crow {
  display: grid;
  grid-template-columns: 1fr 90px 40px;
  gap: 6px;
  margin-top: 6px;
}
.compoed .crow-pied {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
}
.compoed select {
  width: 100%;
}
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 90;
  display: none;
  font-size: 13px;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
.toast.visible {
  display: block;
}
.toast.erreur {
  background: var(--bad);
  color: #fff;
}

/* ── Simplicité : recherche, saisie, vue simple, aide ────────────────── */
.recherche-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  flex: 0 1 360px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  text-align: left;
}
.recherche-btn:hover {
  border-color: var(--accent);
}
.recherche-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aide {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  vertical-align: 1px;
}
.bascule-vue {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: left;
  margin-bottom: 6px;
}
.bascule-vue:hover {
  background: var(--surface-2);
}
.interrupteur {
  flex: none;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background 0.15s;
}
.interrupteur::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--card);
  transition: left 0.15s;
}
.bascule-vue[aria-pressed='true'] .interrupteur {
  background: var(--accent);
}
.bascule-vue[aria-pressed='true'] .interrupteur::after {
  left: 15px;
}
body.mini .bascule-vue {
  justify-content: center;
  padding: 9px 0;
}
body.simple {
  font-size: 15px;
}
body.simple .avance {
  display: none;
}
.seg.onglets button {
  padding: 8px 14px;
  font-weight: 600;
}
.pill.lot {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  font-weight: 600;
}
.mpied.gauche {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}
.mpied.gauche input {
  flex: 1;
  min-width: 200px;
}

/* Accueil */
.accueil-tete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.bonjour {
  font-size: 22px;
  font-weight: 700;
}
.actions-rapides {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.grand-btn {
  padding: 10px 16px;
  font-weight: 600;
  border-radius: 10px;
}
.grand-btn span {
  color: var(--accent);
}
.trois-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1250px) {
  .trois-col {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 860px) {
  .trois-col {
    grid-template-columns: 1fr;
  }
}
.structure .chead {
  margin-bottom: 4px;
}
.structure h2 {
  font-size: 17px;
}
.phrase {
  font-size: 22px;
  margin: 2px 0 12px;
}
.phrase b {
  font-variant-numeric: tabular-nums;
}
.bar.geante {
  height: 22px;
  border-radius: 6px;
  background: transparent;
  gap: 2px;
}
.bar.geante i + i {
  margin-left: 0;
}
.bar.geante i:first-child {
  border-radius: 6px 0 0 6px;
}
.bar.geante i:last-child {
  border-radius: 0 6px 6px 0;
}
.bar.geante i:only-child {
  border-radius: 6px;
}
i.vendu {
  background: var(--accent);
}
i.resa {
  background: var(--gold);
}
i.libre {
  background: color-mix(in oklab, var(--card) 78%, var(--accent));
}
.legende3 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 6px;
  font-size: 13px;
  color: var(--text-2);
}
.legende3 span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legende3 i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.legende3 b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
table.simple td,
table.simple th {
  padding: 6px 0;
  background: none;
}
table.simple th {
  border-bottom: 1px solid var(--border);
}
table.simple td:first-child,
table.simple th:first-child {
  padding-left: 0;
}
table.simple td:last-child,
table.simple th:last-child {
  padding-right: 0;
}
.tache {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  cursor: pointer;
}
.tache:hover {
  background: var(--surface-2);
}
.tache.warn {
  border-left-color: var(--warn);
}
.tache.bad {
  border-left-color: var(--bad);
}
.tache .t {
  font-weight: 650;
}
.tache .d {
  grid-column: 1;
  font-size: 12px;
  color: var(--text-2);
}
.tache .fl {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  font-size: 20px;
  color: var(--muted);
}
.card h2.espace-haut {
  margin-top: 20px;
}
.chiffres {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.chiffres .lab {
  font-size: 12px;
  color: var(--text-2);
}
.chiffres .val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chiffres .val small {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* Fenêtre « + Saisir » */
.tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.tuile {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 2px 10px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}
.tuile:hover,
.tuile:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.tuile .ic {
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.tuile .t {
  font-weight: 650;
  font-size: 15px;
}
.tuile .d {
  font-size: 12px;
  color: var(--text-2);
}

/* Recherche partout */
.rg-groupe {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  padding: 12px 18px 4px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.rg-item {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 9px 18px;
  text-align: left;
  cursor: pointer;
  align-items: center;
}
.rg-item:hover,
.rg-item:focus {
  background: var(--accent-soft);
  outline: none;
}
.rg-plus {
  padding: 6px 18px;
}

/* Cases à cocher des cuves d'un lot */
.liste-coches {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 6px;
}
.coche {
  display: grid;
  grid-template-columns: 20px 70px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.coche:last-child {
  border-bottom: 0;
}
.coche:hover {
  background: var(--surface-2);
}
.coche .n {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
  .app {
    display: block;
  }
  nav.side {
    position: static;
    width: auto;
    height: auto;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  #menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  nav.side .sep,
  nav.side .note,
  .replier {
    display: none;
  }
  .recherche-btn {
    min-width: 0;
    flex: 1;
  }
  .recherche-btn span {
    display: none;
  }
  main {
    padding: 0 16px 40px;
  }
  .topbar {
    margin: 0 -16px 12px;
    padding: 10px 16px;
  }
  .fgrid,
  .kpis.trois {
    grid-template-columns: 1fr;
  }
}
@media print {
  nav.side,
  .topbar .filters,
  #choix-recolte,
  .btn {
    display: none !important;
  }
  .scroll {
    max-height: none;
    overflow: visible;
  }
}

/* ── Connexion ──────────────────────────────────────────────────────── */
.card.connexion {
  max-width: 440px;
  margin: 40px auto;
}
.card.connexion input {
  width: 100%;
}
.liste-caves {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.liste-caves .btn {
  justify-content: space-between;
  text-align: left;
  width: 100%;
}
button.lien {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}
.mdp-provisoire {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ── Paramètres en onglets ──────────────────────────────────────────── */
.param-tete {
  padding: 10px 14px;
}
.barre-liste {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 8px 0 12px;
}
.ajout-liste {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 2 1 480px;
  margin: 0;
}
.ajout-liste input {
  flex: 1 1 240px;
  min-width: 200px;
}
.recherche-liste {
  flex: 1 1 260px;
  min-width: 200px;
}
/* Tableau qui descend jusqu'en bas de l'écran (en-tête et onglets déduits). */
.scroll.plein {
  max-height: max(360px, calc(100vh - 300px));
}
.card .scroll.plein {
  margin-bottom: -16px;
}
.param {
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
}
.param-utilisateurs {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}
@media (max-width: 1100px) {
  .param-utilisateurs {
    grid-template-columns: 1fr;
  }
}
.table-liste td .btn.ghost {
  padding: 2px 8px;
}
.param-regles {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.param-regles .large {
  grid-column: 1 / -1;
}
.param-regles .double {
  grid-column: span 2;
}
@media (max-width: 1250px) {
  .param-regles {
    grid-template-columns: 1fr 1fr;
  }
  .param-regles .double {
    grid-column: 1 / -1;
  }
}
@media (max-width: 860px) {
  .param-regles {
    grid-template-columns: 1fr;
  }
}

/* ── Outils des tableaux (vue/tableaux.js) ──────────────────────────── */
tr.filtres th {
  padding-top: 4px;
  padding-bottom: 6px;
  background: var(--th);
  position: relative;
}
.filtre-col {
  width: 100%;
  min-width: 60px;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-weight: 400;
}
th.deplacable {
  cursor: grab;
  user-select: none;
}
th.deplacable:active {
  cursor: grabbing;
}
th.cible {
  box-shadow: inset 3px 0 0 var(--accent);
  background: var(--accent-soft);
}
.reinit-tableau {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  padding: 0 6px;
  line-height: 20px;
}
tr.filtres th:last-child {
  padding-right: 34px;
}
.seg.onglets button .nb {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 7px;
  border-radius: 999px;
  background: color-mix(in oklab, currentColor 14%, transparent);
}
.tete-onglets {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.panneau-mises {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface-2);
}

/* Fines barres verticales entre les colonnes de tous les tableaux. */
th + th,
td + td {
  border-left: 1px solid color-mix(in oklab, var(--border) 65%, transparent);
}
table.simple th + th,
table.simple td + td,
.kv th + th,
.kv td + td {
  border-left: 0;
}
/* Bloc repliable (alertes…). */
details.replie {
  border: 1px solid color-mix(in oklab, var(--warn) 35%, var(--border));
  background: var(--warn-bg);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 8px 0 12px;
}
details.replie > summary {
  cursor: pointer;
  color: var(--warn);
  list-style: revert;
}
details.replie[open] > summary {
  margin-bottom: 6px;
}
details.replie .alerte-douce {
  margin: 4px 0;
  background: var(--surface);
}

/* ══════════════════════════════════════════════════════════════════════
   PROPRE À VITISAMPLE
   ══════════════════════════════════════════════════════════════════════ */

/* ── Bas du menu : qui est connecté ── */
nav.side .compte {
  padding: 4px 8px 0;
  font-size: 12px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
nav.side .compte a {
  display: inline;
  padding: 0;
  margin: 0;
  color: var(--accent);
  text-decoration: underline;
}
body.mini nav.side .compte {
  display: none;
}
.ybanner.demo {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── À préparer : demandes en cartes, groupées par échéance ── */
.grp {
  margin-bottom: 22px;
}
.grp > h2 {
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.grp > h2 .n {
  font-weight: 600;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 8px;
  color: var(--muted);
}
.grp.late > h2 {
  color: var(--bad);
}
details.grp > summary {
  cursor: pointer;
  font-weight: 650;
  margin-bottom: 10px;
}
.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
  align-items: start;
}
.dem {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rayon);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dem.late {
  border-left: 4px solid var(--bad);
}
.dem.today {
  border-left: 4px solid var(--warn);
}
.dem.done {
  border-left: 4px solid var(--good);
}
.dem-tete {
  padding: 12px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.dem-tete h3 {
  font-size: 17px;
  margin: 0;
  overflow-wrap: anywhere;
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 1px 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag.t2 {
  background: var(--th);
  color: var(--text-2);
}
.dem-sous {
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.lignes {
  list-style: none;
  margin: 0;
  padding: 2px 6px 6px;
}
.ln {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  color: inherit;
}
.ln:hover {
  background: var(--surface-2);
}
.ln:disabled {
  cursor: default;
}
.ck {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  margin-top: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: transparent;
  font-weight: 700;
}
.ln.ok .ck {
  background: var(--good);
  border-color: var(--good);
  color: #fff;
}
.ln.ok .lt {
  text-decoration: line-through;
  color: var(--muted);
}
.ln.attente .ck {
  border-style: dashed;
}
.lt {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.lm {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.dot.d-Blanc {
  background: #e3c75d;
}
.dot.d-Rosé {
  background: #ef8fa6;
}
.dot.d-Rouge {
  background: #8c1c2b;
}
.dot.d-Orange {
  background: #e08a2e;
}
.dem-pied {
  margin-top: auto;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.prog {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.prog .bar {
  flex: 1;
}
.prog .bar i {
  background: var(--good);
}
.dem-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}
.btn.sm {
  padding: 4px 9px;
  font-size: 12.5px;
}

/* ── Formulaire d'une demande (volet élargi) ── */
.drawer.large {
  width: min(920px, 100vw);
}
.echantillon {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.echantillon .eh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.echantillon .eg {
  display: grid;
  grid-template-columns: 70px 100px minmax(0, 1fr) 110px;
  gap: 8px;
}
.echantillon .eg + .eg {
  margin-top: 8px;
}
.echantillon .eg.b {
  grid-template-columns: 100px 120px 110px minmax(0, 1fr);
}
.echantillon input,
.echantillon select {
  width: 100%;
  min-width: 0;
}
.echantillon .field label {
  font-size: 11px;
}
.echantillon .eh .fait {
  color: var(--good);
}
@media (max-width: 640px) {
  .echantillon .eg,
  .echantillon .eg.b {
    grid-template-columns: 1fr 1fr;
  }
  .echantillon .eg .vin,
  .echantillon .eg .info {
    grid-column: 1 / -1;
  }
}
textarea.rapide {
  width: 100%;
  font-family: inherit;
}

/* ── Étiquettes : planche A4 en aperçu ── */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 1000px) {
  .split {
    grid-template-columns: 1fr;
  }
}
.coches-champs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
}
.coches-champs label {
  display: flex;
  gap: 6px;
  align-items: center;
}
.feuille-cadre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--rayon);
  padding: 12px;
  overflow: hidden;
  position: sticky;
  top: calc(var(--haut-entete) + 8px);
}
.feuille-boite {
  position: relative;
  margin: 0 auto;
}
.feuille {
  position: absolute;
  left: 0;
  top: 0;
  width: 210mm;
  height: 297mm;
  background: #fff;
  color: #000;
  transform-origin: 0 0;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
  font-family: Arial, Helvetica, sans-serif;
}
.etq {
  position: absolute;
  outline: 0.2mm dashed #c9c9c9;
  display: flex;
  align-items: center;
  gap: 2mm;
  padding: 2mm 2.5mm;
  overflow: hidden;
}
.etq.saut {
  background: repeating-linear-gradient(45deg, #f1f1f1 0 2mm, #fff 2mm 4mm);
}
.etq img {
  flex: none;
  height: auto;
}
.etq div {
  line-height: 1.18;
  min-width: 0;
  overflow-wrap: anywhere;
}
.pages {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
table.saisie td {
  padding: 3px 4px;
}
table.saisie input,
table.saisie select {
  width: 100%;
  min-width: 60px;
}
.x {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.x:hover {
  color: var(--bad);
  background: var(--bad-bg);
}
.logo-apercu {
  max-width: 220px;
  max-height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}
.journal-version {
  margin: 0 0 14px;
}
.journal-version h3 {
  font-size: 14px;
  margin: 0 0 4px;
}
.journal-version ul {
  margin: 0;
  padding-left: 18px;
}
