:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --tick: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.08);
  --hover: rgba(11, 11, 11, 0.05);
  --accent: #1a7f37;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --good-ink: #006300;
  --critical: #d03b3b;
  --warning-bg: #fff4d6;
  --warning-ink: #5c4300;
  --PB1: #2a78d6;
  --PB10: #eb6834;
  --PB31: #1baf7a;
  --PB3: #eda100;
  --solo: #2a78d6;
  --heat: #2a78d6;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a29a;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.08);
    --hover: rgba(255, 255, 255, 0.06);
    --accent: #2ea043;
    --good-ink: #0ca30c;
    --warning-bg: #3a2e0a;
    --warning-ink: #fab219;
    --PB1: #3987e5;
    --PB10: #d95926;
    --PB31: #199e70;
    --PB3: #c98500;
    --solo: #3987e5;
    --heat: #3987e5;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
b, strong { font-weight: 600; }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0; font-weight: 600; }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 16px; font-weight: 600; }
h3, .h3 { font-size: 14px; margin: 24px 0 8px; font-weight: 600; color: var(--ink-2); }
/* Nom de l'étape (Défruitage, Criblage…) : plus grand, en vert */
.card.stage > h2 { font-size: 24px; color: var(--accent); }
details.fold > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; width: 14px; height: 14px; background: currentColor; transition: transform 120ms var(--ease);
  -webkit-mask: var(--icon-chevron) center / contain no-repeat; mask: var(--icon-chevron) center / contain no-repeat; }
details.fold:not([open]) > summary::after { transform: rotate(-90deg); }
details.fold:not([open]) > summary { margin-bottom: 0; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 32px 64px; }

/* Barre du haut */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; line-height: 1.2; }
.brand img { height: 32px; width: auto; background: #fff; border-radius: 4px; padding: 2px; }
/* Marque : texte vert Phosboucraa à la place du logo OCP, sur téléphone et sur PC */
.brand img, .brand-text { display: none; }
.brand-short { display: inline-flex; flex-direction: column; align-items: center; flex: none; font-size: 15px; line-height: 1.2; color: var(--accent); text-align: center; white-space: nowrap; }
.brand-name { display: block; font-size: 13px; font-weight: 700; line-height: 1.15; }
.brand-text { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--ink); text-align: center; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.topbar nav a:hover { background: var(--hover); color: var(--ink); }
.topbar nav a[aria-current] { color: var(--ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 0 0; }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-left: auto; font-size: 13px; }
.account form { margin: 0; }
.account .btn { font-size: 13px; height: 32px; }
.freshness { margin: 0; font-size: 13px; color: var(--muted); }
.freshness b { color: var(--ink-2); font-weight: 500; }
.i { display: block; flex: none; width: 16px; height: 16px; }
.topbar nav .i, .account .user .i { display: none; }
.account .user { text-decoration: underline; }
.btn { gap: 8px; }
.btn .i { color: currentColor; }
.btn.ib:not(:has(.lbl)) { padding: 0 10px; }
.user-menu { display: none; position: relative; }
.user-menu > summary { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; color: var(--ink-2); cursor: pointer; list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary .i { width: 20px; height: 20px; }
.user-menu[open] > summary { background: var(--hover); color: var(--ink); }
.user-menu-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 232px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); }
.user-menu-name { margin: 0; padding: 8px 12px 4px; font-size: 12px; color: var(--muted); }
.user-menu-panel a, .user-menu-panel button { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--hover); }
.user-menu-panel .i { width: 18px; height: 18px; color: var(--ink-2); }
.user-menu-panel form { margin: 0; border-top: 1px solid var(--border); padding-top: 4px; margin-top: 4px; }
.warn-flag { position: relative; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--warning-ink); cursor: pointer; }
.warn-flag::before { content: ""; position: absolute; inset: 7px; background: currentColor; -webkit-mask: var(--icon-alert) center / contain no-repeat; mask: var(--icon-alert) center / contain no-repeat; }
.warn-flag:hover { background: var(--warning-bg); }
.warn-flag[aria-expanded="true"] { background: var(--warning-bg); }
.warn-flag[aria-expanded="true"]::after { content: attr(data-msg); position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: 240px; padding: 8px 12px; border-radius: 8px;
  background: var(--warning-bg); color: var(--warning-ink); font-size: 13px; line-height: 1.4; text-align: left; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }


/* Formulaires */
.form-card { max-width: 420px; margin: 40px auto; }
.form-card h1 { margin-bottom: 16px; }
.form-card form { display: flex; flex-direction: column; gap: 16px; }
.form-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.form-card input { font: inherit; height: 40px; padding: 0 12px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); }
.form-card .btn { align-self: flex-start; }
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.upload input[type="file"] { font: inherit; font-size: 14px; max-width: 100%; color: var(--ink-2); }
.upload input[type="file"]::file-selector-button { font: inherit; font-size: 14px; height: 36px; padding: 0 12px; margin-right: 8px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; }
code { font-size: 13px; overflow-wrap: anywhere; }

/* En-tête de page */
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 24px; }
.head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.eyebrow { margin: 0; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.controls label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.controls label.btn { font-size: 14px; color: var(--ink); gap: 8px; }
/* Champ « Date » (période du → au) et son calendrier */
.range { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.range-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; font: inherit; font-size: 14px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.range-btn:hover { background: var(--hover); }
.range-btn[aria-expanded="true"] { border-color: var(--accent); }
.range-btn .i { color: var(--muted); }
.cal { position: fixed; z-index: 50; width: 280px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); color: var(--ink); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-title { font-weight: 500; text-transform: capitalize; }
.cal-nav { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.cal-nav:hover { background: var(--hover); }
.cal-hint { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-day { height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.cal-day:hover { background: var(--hover); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--axis); }
.cal-day.in { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.cal-day.edge { background: var(--accent); color: var(--accent-ink); }
input[type="date"] { font: inherit; font-size: 14px; height: 36px; padding: 0 8px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); }
.btn { display: inline-flex; align-items: center; height: 36px; font: inherit; font-size: 14px; padding: 0 12px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color 120ms var(--ease), border-color 120ms var(--ease); }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Blocs */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-bottom: 16px; }
.banner, .success { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; }
.banner { background: var(--warning-bg); color: var(--warning-ink); padding: 12px 16px; border-radius: 8px; }
.success { color: var(--good-ink); }
.banner::before, .success::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px; background: currentColor; -webkit-mask: var(--icon-alert) center / contain no-repeat; mask: var(--icon-alert) center / contain no-repeat; }
.success::before { -webkit-mask-image: var(--icon-check); mask-image: var(--icon-check); }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
main > .note { margin: 0 0 16px; }
.subtitle { margin: -8px 0 16px; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }
.count { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }

/* Tuiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; text-decoration: none; transition: border-color 120ms var(--ease); }
a.tile:hover { border-color: var(--axis); }
.tile-label { font-size: 13px; color: var(--ink-2); }
.tile-value { font-size: 24px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tile-value small, .split small { font-size: 12px; font-weight: 400; color: var(--muted); }
.tile-note { font-size: 12px; color: var(--muted); }
.tiles.compact { grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); }
.tiles.compact .tile-value { font-size: 20px; }
.card .tile { background: transparent; border-radius: 8px; }
.stage-tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); }
.stage-tiles .tile-value { font-size: 20px; }
.split { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.split li { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: baseline; }
.split li > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.split .num { font-size: 16px; font-weight: 600; }
.split .tile-note { grid-column: 1 / -1; }
.split .swatch { margin: 0; }

.tag.stop { display: inline-block; font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: 4px; background: var(--hover); color: var(--ink-2); }
.flag { display: inline-block; width: 16px; font-weight: 600; text-align: center; }
.flag.ok { color: var(--good-ink); }
.flag.bad { color: var(--critical); }
.neg { color: var(--critical); font-weight: 600; }
.alerts { list-style: none; margin: 0; padding: 0; columns: 2 320px; column-gap: 32px; }
.alerts li { padding: 4px 0; break-inside: avoid; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.wrap th, table.wrap td, table.wrap-head th { white-space: normal; }
table.wrap-head th { vertical-align: bottom; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--axis); }
.heat td[style] { background: color-mix(in srgb, var(--heat) calc(var(--v) * 0.55), transparent); }

/* Graphiques */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px 32px; margin-top: 8px; }
.multiples { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px 32px; }
figure { margin: 0; min-width: 0; }
figcaption { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 16px 0 8px; }
.comment { margin-top: 24px; padding: 4px 16px 12px; border-left: 2px solid var(--accent); }
.manual-comment { white-space: pre-line; margin: 0 0 8px; }
.edit-comment textarea { width: 100%; font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
@media print { .edit-comment { display: none; } }
.comment h3 { margin-top: 8px; }
.comment ul { margin: 0; padding-left: 20px; }

svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { font: 11.5px system-ui, -apple-system, "Segoe UI", sans-serif; }
.tick { fill: var(--tick); font-variant-numeric: tabular-nums; }
.grid { stroke: var(--grid); stroke-width: 1; }
.base { stroke: var(--axis); stroke-width: 1; }
.nodata { fill: var(--grid); opacity: 0.45; }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.limit { stroke-width: 1.25; stroke-dasharray: 5 4; opacity: 0.8; }
.dot { stroke: var(--surface); stroke-width: 2; }
.dim { opacity: 0.45; }
.hit { fill: transparent; }
.hit:hover { fill: var(--hover); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.legend .swatch { margin-right: 0; }
.fill-PB1 { fill: var(--PB1); } .stroke-PB1 { stroke: var(--PB1); } .s-PB1 { background: var(--PB1); }
.fill-PB10 { fill: var(--PB10); } .stroke-PB10 { stroke: var(--PB10); } .s-PB10 { background: var(--PB10); }
.fill-PB31 { fill: var(--PB31); } .stroke-PB31 { stroke: var(--PB31); } .s-PB31 { background: var(--PB31); }
.fill-PB3 { fill: var(--PB3); } .stroke-PB3 { stroke: var(--PB3); } .s-PB3 { background: var(--PB3); }
.fill-solo { fill: var(--solo); }

#tip { position: fixed; z-index: 10; pointer-events: none; max-width: 240px; padding: 8px 12px; font-size: 13px; line-height: 1.4; border-radius: 8px; background: var(--ink); color: var(--surface); }

/* Saisie du rapport journalier */
.saisie input:not([type=checkbox]), .saisie select { font: inherit; font-size: 14px; height: 32px; padding: 0 8px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface); color: inherit; width: 104px; }
.saisie input.wide { width: 100%; min-width: 160px; }
.saisie select { width: auto; }
.saisie td { vertical-align: middle; padding-top: 4px; padding-bottom: 4px; }

@media (max-width: 760px) {
  .stage-tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stage-tiles .tile-split { grid-column: 1 / -1; }
}
.m-show { display: none; }
@media (max-width: 640px) {
  .m-hide { display: none !important; }
  .m-show { display: inline; }
  body { font-size: 14px; }
  main { padding: 16px 12px 40px; }
  h1 { font-size: 20px; }
  h2 { font-size: 17px; margin-bottom: 12px; }
  .card.stage > h2 { font-size: 21px; }

  /* Barre du haut sur une ligne : logo, date des données, compte, déconnexion */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; padding: 8px 12px; }
  .brand-short { font-size: 13px; }
  .account { flex-wrap: nowrap; justify-content: flex-end; gap: 4px; margin-left: auto; font-size: 12px; min-width: 0; }
  .freshness { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-right: 4px; }
  .user-menu { display: block; }
  .warn-flag[aria-expanded="true"]::after { position: fixed; top: 56px; left: 12px; right: 12px; width: auto; }

  /* Navigation : barre d'onglets en bas de l'écran, icône + mot court */
  .topbar nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .topbar nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; line-height: 1.2; border-radius: 8px; box-shadow: none; }
  .topbar nav a .i { display: block; width: 22px; height: 22px; }
  .nav-module { display: none; }
  .topbar nav a[aria-current] { color: var(--accent); font-weight: 600; box-shadow: none; border-radius: 8px; background: var(--hover); }

  /* Boutons : icône seule (le titre et l'aria-label portent le libellé) */
  .ib .lbl { display: none; }
  .btn.ib { width: 40px; padding: 0; justify-content: center; }
  .btn .i { width: 18px; height: 18px; }
  .save-bar { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; margin: 16px 0 0; }
  .save-bar .btn { width: 100%; justify-content: center; height: 44px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }

  /* En-tête de page et boutons */
  .report-head { gap: 12px; margin-bottom: 16px; }
  .report-head .muted { font-size: 13px; margin: 4px 0 0; }
  .head-actions { justify-content: flex-start; gap: 8px; width: 100%; }
  .controls { gap: 8px; }
  .btn, input[type="date"] { height: 40px; }
  .controls input[type="date"] { min-width: 0; }
  .controls.period { display: flex; flex-wrap: nowrap; width: 100%; gap: 6px; }
  .controls.period label { flex: 1 1 0; min-width: 0; gap: 0; }
  .controls.period input[type="date"] { width: 100%; padding: 0 4px; font-size: 13px; }
  .controls.period .btn { flex: none; }
  .controls.period .range { flex: 1 1 auto; min-width: 0; }
  .controls.period .range-btn { width: 100%; height: 40px; justify-content: center; }

  /* Blocs */
  .form-card { margin: 16px auto; }
  .card { padding: 16px 12px; border-radius: 10px; margin-bottom: 12px; }
  .grid-2, .multiples { grid-template-columns: minmax(0, 1fr); }
  .tiles, .tiles.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile-value, .stage-tiles .tile-value, .tiles.compact .tile-value { font-size: 19px; }
  .tile-note { font-size: 11.5px; }
  .stage-tiles .tile-split { grid-column: 1 / -1; }
  .alerts { columns: 1; }

  /* Tableaux plus serrés ; ceux qui restent larges défilent dans leur cadre */
  table { font-size: 13px; }
  th { font-size: 12px; padding: 6px 8px; }
  td { padding: 8px 8px; }
  .table-wrap { margin: 0 -12px; padding: 0 12px; }
  table.wrap-head th { min-width: 56px; }
}

@media print {
  :root { color-scheme: light; --page: #fff; --surface: #fff; }
  @page { size: A4; margin: 12mm; }
  body { font-size: 11.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main { max-width: none; padding: 0; }
  .m-show { display: none !important; }
  .topbar nav, .account, .controls, .head-actions, #tip, .stage-dates, .cal { display: none !important; }
  .topbar { padding: 0 0 8px; border-bottom: 1px solid #999; background: #fff; }
  .card { border: 0; padding: 0; margin: 0 0 16px; }
  .stage { break-before: page; }
  table { font-size: 10.5px; }
  th, td { padding: 3px 6px; }
  .tile, figure, tr, .comment { break-inside: avoid; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .multiples { grid-template-columns: 1fr 1fr; }
  h3 { break-after: avoid; margin-top: 12px; }
  .table-wrap { overflow: visible; }
}

/* Plateforme : accueil et modules */
.nav-module { align-self: center; max-width: 280px; padding: 0 12px 0 8px; margin-right: 4px; border-right: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero { position: relative; display: flex; align-items: flex-end; min-height: 340px; margin-bottom: 32px; border-radius: 16px; overflow: hidden; background: #2b2a28 center 30% / cover no-repeat; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.25) 55%, rgba(0, 0, 0, 0) 100%); }
.hero-text { position: relative; max-width: 620px; padding: 32px 40px; color: #fff; }
.hero-text h1 { font-size: 34px; margin: 4px 0 8px; color: #fff; }
.hero-text p { margin: 0; color: rgba(255, 255, 255, 0.86); }
.hero-eyebrow { font-size: 13px; letter-spacing: 0.02em; }
.section-title { margin: 8px 0 16px; font-size: 20px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 40px; }
.module-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease); }
.module-card:hover { border-color: var(--axis); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
.module-cover { position: relative; display: block; aspect-ratio: 16 / 8; overflow: hidden; background: var(--hover); }
.module-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ease); }
.module-card:hover .module-cover img { transform: scale(1.03); }
.module-card.soon .module-cover img { filter: grayscale(0.7); opacity: 0.85; }
.module-num { position: absolute; top: 12px; left: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.module-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 16px 20px 20px; }
.module-title { display: flex; align-items: center; gap: 12px; }
.module-title h2 { margin: 0; font-size: 17px; }
.module-body p { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1; }
.module-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.module-icon .i { width: 20px; height: 20px; }
.module-card.soon .module-icon { background: var(--hover); color: var(--muted); }
.module-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.module-foot .btn.ib .lbl { display: inline; }
.module-foot .btn.ib { width: auto; padding: 0 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border-radius: 12px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { padding: 8px 12px; font-size: 13px; color: var(--ink-2); }
.module-banner { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 120px; margin-bottom: 24px; padding: 16px 24px; border-radius: 12px; overflow: hidden; background: #2b2a28 center / cover no-repeat; color: #fff; }
.module-banner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.25) 70%, rgba(0, 0, 0, 0.1) 100%); }
.module-banner > * { position: relative; margin: 0; }
.module-banner p { font-size: 12px; color: rgba(255, 255, 255, 0.8); }
.module-banner h2 { font-size: 22px; color: #fff; }
.empty-module { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; }
.empty-module h2 { margin: 16px 0 4px; }
.empty-module p { max-width: 480px; margin: 0 0 20px; }
.empty-module .btn.ib .lbl { display: inline; }
.empty-module .btn.ib { width: auto; padding: 0 14px; }
@media (max-width: 640px) {
  .hero { min-height: 260px; margin-bottom: 24px; border-radius: 12px; }
  .hero-text { padding: 20px; }
  .hero-text h1 { font-size: 23px; }
  .modules { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .gallery { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .gallery figcaption { font-size: 12px; padding: 6px 8px; }
  .module-banner { min-height: 84px; padding: 12px 16px; margin-bottom: 16px; }
  .module-banner h2 { font-size: 17px; }
}
@media print { .module-banner { display: none; } }

/* Connexion et mot de passe : photo de Phosboucraa en arrière-plan, bouton « afficher le mot de passe » */
body.page-fond { min-height: 100vh; background: #2b2a28 url("img/connexion-fond.jpg") center / cover no-repeat fixed; }
body.page-fond::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(0, 0, 0, 0.35); }
body.page-fond { position: relative; z-index: 0; }
body.page-fond .form-card { margin-top: 10vh; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3); }
.form-card .eyebrow { margin-bottom: 0; }
.pw { position: relative; display: flex; }
.pw input { flex: 1; min-width: 0; padding-right: 44px; }
.pw-toggle { position: absolute; top: 0; right: 0; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 0 8px 8px 0; background: none; color: var(--muted); cursor: pointer; }
.pw-toggle:hover { color: var(--ink); }
.pw-toggle .i { width: 18px; height: 18px; }
.pw-toggle .i + .i, .pw-toggle[aria-pressed="true"] .i:first-child { display: none; }
.pw-toggle[aria-pressed="true"] .i + .i { display: block; }
.pw input::-ms-reveal { display: none; }

/* Cartographie des stocks */
.ref { stroke: var(--critical); stroke-width: 1; stroke-dasharray: 4 3; }
.ref-label { fill: var(--critical); }
tfoot th, tfoot td { border-top: 1px solid var(--axis); border-bottom: 0; }
td.bad { color: var(--critical); font-weight: 600; }
.small { font-size: 13px; }
.method { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.formula { font-family: ui-monospace, Consolas, monospace; font-size: 14px; background: var(--hover); padding: 12px 16px; border-radius: 8px; }
.params { display: flex; flex-direction: column; gap: 16px; }
.params label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.unit-field { display: flex; align-items: center; gap: 8px; }
.unit-field input { font: inherit; width: 140px; height: 40px; padding: 0 12px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); }
.params .btn { align-self: flex-start; }
.area { opacity: 0.55; }
.area-line { stroke-width: 1.5; stroke-linejoin: round; }
.releve-form { display: flex; flex-direction: column; gap: 12px; }
.releve-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; }
.releve-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.releve-grid input, .releve-grid select { font: inherit; height: 40px; padding: 0 10px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0; }
.releve-form .save-bar { margin: 4px 0 0; }
input.cell { font: inherit; font-size: 14px; width: 84px; height: 34px; padding: 0 8px; border: 1px solid var(--axis); border-radius: 6px; background: var(--surface); color: var(--ink); }
@media (max-width: 640px) { .releve-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* Vue réaliste des parcs */
.stop-PB1 { stop-color: var(--PB1); } .stop-PB10 { stop-color: var(--PB10); } .stop-PB31 { stop-color: var(--PB31); } .stop-PB3 { stop-color: var(--PB3); }
.parc-view .view-title { font-size: 12px; font-weight: 600; fill: var(--ink-2); }
.parc-view .sol { fill: #d9c9a3; }
.parc-view .parc-sol { fill: color-mix(in srgb, #d9c9a3 35%, var(--surface)); stroke: var(--axis); stroke-width: 1; }
.parc-view .tas { stroke: none; }
.parc-view .tas-crete { stroke-width: 1.5; stroke-linejoin: round; }
.parc-view .niveau { stroke: rgba(0, 0, 0, 0.18); stroke-width: 0.6; }
.parc-view .n0 { opacity: 0.35; } .parc-view .n1 { opacity: 0.55; } .parc-view .n2 { opacity: 0.75; } .parc-view .n3 { opacity: 0.95; }
.parc-view .rail { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 1 3; }
.parc-view .axe { stroke: rgba(0, 0, 0, 0.25); stroke-width: 0.6; stroke-dasharray: 3 3; }
.parc-view .repere { stroke: var(--tick); }
.view-note { margin: 6px 0 0; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .parc-view .sol { fill: #6b5e43; } }
.parc3d { position: relative; color: var(--muted); margin-top: 4px; }
.parc3d canvas { display: block; width: 100%; cursor: grab; touch-action: pan-y; border-radius: 8px; background: linear-gradient(180deg, color-mix(in srgb, #9fc3e6 40%, var(--surface)) 0%, var(--surface) 75%); }
.parc3d canvas:active { cursor: grabbing; }
.vue-technique { margin-top: 12px; }
/* Simulateur de stock */
.sim { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sim-panel { display: flex; flex-direction: column; gap: 0; }
.sim-card { padding: 16px 20px; }
.sim-card h2 { font-size: 15px; margin-bottom: 10px; }
.sim-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.sim-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.sim-fields select, .sim-fields input { font: inherit; font-size: 14px; height: 36px; padding: 0 10px; border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0; }
.sim-fields .unit-field input { width: 120px; }
.choice { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; cursor: pointer; }
.file-btn .lbl { display: inline !important; }
.file-btn { width: auto !important; padding: 0 12px !important; }
.sim-result { position: sticky; top: 12px; display: flex; flex-direction: column; }
.sim-view { position: relative; color: var(--muted); }
.sim-view canvas, .parc3d canvas { display: block; width: 100%; cursor: grab; touch-action: pan-y; border-radius: 8px; background: linear-gradient(180deg, color-mix(in srgb, #9fc3e6 40%, var(--surface)) 0%, var(--surface) 75%); }
.sim-view canvas:active, .parc3d canvas:active { cursor: grabbing; }
.sim-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.legend-bar { display: inline-block; width: 160px; height: 10px; border-radius: 5px; }
.legend-ramp { background: linear-gradient(90deg, rgb(236,224,196) 0%, rgb(226,196,140) 25%, rgb(210,160,92) 50%, rgb(178,118,62) 75%, rgb(128,78,44) 100%); }
.sim-open { margin-left: auto; }
.sim-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.sim-tiles .tile-value { font-size: 22px; }
.method-note code { font-size: 12px; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
@media (max-width: 900px) { .sim { grid-template-columns: minmax(0, 1fr); } .sim-result { position: static; order: -1; } }
.pile-PB1 { background: rgb(214, 186, 138); } .pile-PB3 { background: rgb(200, 166, 116); } .pile-PB10 { background: rgb(182, 188, 196); } .pile-PB31 { background: rgb(188, 202, 160); }
.zones { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 4px 0 10px; }
.zone { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink-2); }
.zone .swatch { width: 12px; height: 12px; border-radius: 3px; margin: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.parc-vide { padding: 24px 0; text-align: center; }
