/* Inventaire Martineau — charte graphique 2023 : marine #192441, or #CD9A10 (décoratif), noir #000000, blanc.
   Titres : Argesta Display (repli Georgia). Contenus : Made Mirage / Satoshi (repli Calibri). */
:root {
  --navy: #192441;
  --navy-deep: #0e1629;
  --navy-soft: #2c3a5e;
  --ink: #000000;
  --gold: #cd9a10;
  --gold-soft: #f7edd2;
  --gold-text: #7a5a06;
  --muted: #565a6b;
  --border: #dfe1e8;
  --surface: #f5f5f7;
  --tint: #eef0f5;
  --ok: #1f6b4a;
  --ok-bg: #e6f3ec;
  --warn: #8a4b00;
  --warn-bg: #fff3dc;
  --warn-border: #e9b55a;
  --bad: #9b2c1c;
  --bad-bg: #fdecea;
  --title-font: "Argesta Display", Georgia, "Times New Roman", serif;
  font-family: Satoshi, Calibri, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--surface);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2 { font-family: var(--title-font); font-weight: 400; letter-spacing: .005em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1rem; font-weight: 700; }
p { line-height: 1.5; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small, small { color: var(--muted); font-size: .84rem; }

/* ---------- Barre haute ---------- */
.topbar { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.top-inner, .shell { max-width: 1180px; margin: 0 auto; padding-inline: 24px; }
.top-inner { min-height: 64px; padding-block: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .connection { display: flex; align-items: center; gap: 10px; }
.brand { min-width: 0; color: #d3d8e6; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.brand-logo { display: block; flex: none; height: 38px; width: auto; aspect-ratio: 470 / 132; color: #fff; }
.brand-copy { display: grid; min-width: 0; gap: 2px; line-height: 1.2; }
.brand-app { font-family: var(--title-font); font-weight: 400; font-size: 1.12rem; color: #fff; }
.brand-subtitle { font-size: .79rem; }
.brand-divider { height: 22px; width: 1px; flex: none; background: #56627f; }
.connection { color: #e6e9f2; font-size: .84rem; white-space: nowrap; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.08); }
.connection i { width: 9px; height: 9px; border-radius: 100%; background: #6fd3a5; }
.connection[data-state=offline] { background: #fff3dc; color: var(--warn); }
.connection[data-state=offline] i { background: #d97a00; }
.connection[data-state=pending] { background: #fff3dc; color: var(--warn); }
.connection[data-state=pending] i { background: #d97a00; }

/* ---------- Bandeau ---------- */
.hero {
  margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(255px, .5fr); gap: 28px;
  align-items: end; background: var(--navy); border-radius: 14px; padding: 24px 28px; color: #fff;
  border-left: 6px solid var(--gold);
}
.session-label, .eyebrow { color: var(--gold); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); line-height: 1.1; margin-block: 6px 8px; }
.hero p { color: #d3d8e6; font-size: .94rem; overflow-wrap: anywhere; }
.progress-summary { display: grid; gap: 8px; min-width: 0; color: #d3d8e6; font-size: .85rem; }
.progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.progress-top strong { color: #fff; font-size: 1.4rem; }
progress { width: 100%; height: 8px; display: block; appearance: none; border: 0; border-radius: 99px; background: #34405f; overflow: hidden; }
progress::-webkit-progress-bar { background: #34405f; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--gold); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 99px; }

/* ---------- Onglets ---------- */
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); margin: 14px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 46px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); border-radius: 0; font-weight: 650; }
.tabs button[aria-current] { color: var(--navy); border-color: var(--gold); }
.tabs-spacer { flex: 1; }
.tabs .tab-tool { font-weight: 500; font-size: .86rem; }
.space-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.space-nav .space-button { min-height: 42px; padding-inline: 18px; border-color: var(--border); background: #fff; color: var(--navy); }
.space-nav .space-button[aria-current] { background: var(--navy); border-color: var(--navy); color: #fff; }
.space-nav .tab-tool { min-height: 36px; padding-inline: 8px; font-size: .86rem; }
.space-nav + .tabs, .space-nav + .tabs + .tabs { margin-top: 6px; }
.stock-metrics { display: grid; gap: 14px; }
.stock-dashboard-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); }
.stock-dashboard-stores { margin-top: 14px; }
.stock-dashboard-stores table { min-width: 720px; }
.stock-dashboard-stores th:nth-child(n+3), .stock-dashboard-stores td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.stock-dashboard-kpis .kpi.amount strong { font-size: 1.23rem; }
.stock-dashboard-stores .table-wrap { margin-top: 10px; }
.campaign-review-actions { flex-wrap: wrap; }
#achats-dashboard-source { margin-top: 12px; }
#panel-campaigns > .section-header { flex-wrap: wrap; }
.campaign-form { display: grid; gap: 12px; margin-bottom: 20px; padding: 14px; background: var(--surface); border-radius: 10px; }
.campaign-zones { min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.campaign-zones legend { font-weight: 650; }
.campaign-form .buttons { flex-wrap: wrap; }
.campaign-zone-list { max-height: 230px; overflow: auto; }
.campaign-zone-list label { display: flex; min-height: 38px; gap: 8px; align-items: center; padding: 4px 0; }
.campaign-zone-list label small { margin-left: auto; }
#campaigns-list table { min-width: 520px; }
#campaigns-list .campaign-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
#campaigns-list .campaign-actions button { white-space: nowrap; }

/* ---------- Commandes ---------- */
input, select, button, textarea { font: inherit; }
input[type=text], input[type=search], select {
  width: 100%; min-width: 0; min-height: 46px; padding: 8px 12px; border: 1px solid #c5c9d6; border-radius: 8px;
  background: #fff; color: inherit; font-size: 1rem;
}
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%); background-position: right 17px top 20px, right 12px top 20px; background-size: 5px 5px; background-repeat: no-repeat; }
:is(button, input, select, textarea):focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button { cursor: pointer; border-radius: 8px; border: 1px solid transparent; padding: 9px 14px; min-height: 44px; font-weight: 650; font-size: .94rem; line-height: 1.25; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--navy); color: #fff; }
.primary:hover:not(:disabled) { background: var(--navy-deep); }
.secondary { background: #fff; color: var(--navy); border-color: #c5c9d6; }
.secondary:hover:not(:disabled) { background: var(--tint); }
.big { min-height: 54px; font-size: 1.05rem; }
.text-button { background: transparent; color: var(--navy); padding: 0 2px; min-height: 32px; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.field { display: grid; gap: 6px; margin: 0; min-width: 0; }
.field label, .scan-form label, .qty-block label { font-weight: 650; font-size: .9rem; }
.buttons, .side-heading, .section-header { display: flex; gap: 8px; align-items: center; }
.buttons { flex-wrap: wrap; }
.side-heading, .section-header { justify-content: space-between; }
.section-header { margin-bottom: 16px; }
.card-heading p, .section-header p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; min-width: 0; }
.feedback { border-radius: 8px; background: var(--ok-bg); color: var(--ok); padding: 9px 12px; margin: 10px 0; font-size: .92rem; overflow-wrap: anywhere; }
.feedback.error { background: var(--bad-bg); color: var(--bad); }
.empty { color: var(--muted); padding-block: 8px; font-size: .9rem; }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; overflow-wrap: anywhere; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--navy); }

/* ---------- Comptage ---------- */
.count-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.count-main { display: grid; gap: 12px; min-width: 0; }
.count-side { display: grid; gap: 12px; position: sticky; top: 12px; }

.location-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 14px 12px 16px; border-left: 6px solid var(--gold);
  box-shadow: 0 6px 16px rgba(25, 36, 65, .18);
}
.location-text { display: grid; min-width: 0; }
.location-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--gold); font-weight: 700; }
.location-text strong { font-size: 1.75rem; line-height: 1.1; letter-spacing: .01em; overflow-wrap: anywhere; }
.location-detail { font-size: .86rem; color: #d3d8e6; }
.location-side { display: grid; justify-items: end; gap: 6px; flex: none; }
.location-progress { font-size: .82rem; color: #d3d8e6; white-space: nowrap; }
.location-change { min-height: 40px; background: #fff; color: var(--navy); border: 0; }

.zone-sheet { display: grid; gap: 12px; border: 2px solid var(--navy); }
.sheet-heading { display: flex; justify-content: space-between; align-items: center; }
.zone-list { display: grid; gap: 14px; max-height: 60vh; overflow: auto; }
.zone-group h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.zone-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.zone-option { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); text-align: left; min-height: 52px; }
.zone-option[aria-current=true] { border: 2px solid var(--navy); background: var(--tint); }
.zone-option strong { font-size: 1.1rem; }
.zone-option small { white-space: nowrap; }
.zone-option.done small { color: var(--ok); font-weight: 700; }

.scan-card { display: grid; gap: 14px; }
.scan-button {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 64px;
  background: var(--gold); color: var(--navy-deep); font-size: 1.25rem; font-weight: 800; letter-spacing: .02em;
  border-radius: 12px; box-shadow: 0 3px 0 #9a7208;
}
.scan-button:hover:not(:disabled) { background: #d9a722; }
.scan-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #9a7208; }
.scan-icon { width: 30px; height: 22px; border: 2px solid currentColor; border-radius: 4px; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px, currentColor 4px 5px, transparent 5px 8px); background-clip: content-box; padding: 3px; }
.scan-form { display: grid; gap: 6px; }
.scan-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.scan-actions button { min-width: 64px; }
.camera-box { display: grid; gap: 8px; }
.camera-box video { width: 100%; max-height: 300px; background: var(--navy-deep); border-radius: 10px; object-fit: cover; }

.state-banner { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 14px 16px; font-size: 1rem; overflow-wrap: anywhere; border: 1px solid transparent; }
.state-banner::before { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 800; }
.state-banner.ok { background: var(--ok-bg); color: var(--ok); border-color: #b5dcc6; }
.state-banner.ok::before { content: "✓"; background: var(--ok); color: #fff; }
.state-banner.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.state-banner.warn::before { content: "!"; background: #d97a00; color: #fff; }
.state-banner.bad { background: var(--bad-bg); color: var(--bad); border-color: #f0b8b0; }
.state-banner.bad::before { content: "×"; background: var(--bad); color: #fff; }
.state-banner.info { background: var(--tint); color: var(--navy); }
.state-banner.info::before { content: "…"; background: var(--navy); color: #fff; }
.state-banner strong { display: block; font-size: 1.05rem; }

.state-card { display: grid; gap: 12px; border-width: 2px; }
.item-card, .state-card, .zone-sheet, #search { scroll-margin-top: 112px; }
.state-card.bad { border-color: #e6968b; background: #fffafa; }
.state-card.warn { border-color: var(--warn-border); background: #fffcf5; }
.state-card .state-title { display: flex; align-items: center; gap: 10px; }
.state-card .state-title span { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; padding: 3px 8px; border-radius: 6px; }
.state-card.bad .state-title span { background: var(--bad); color: #fff; }
.state-card.warn .state-title span { background: #d97a00; color: #fff; }
.state-card.info .state-title span { background: var(--navy); color: #fff; }
.state-card .code { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; font-weight: 700; }
.state-card .state-actions { display: grid; gap: 8px; }
.state-card .choice { display: grid; gap: 4px; text-align: left; background: #fff; border: 1px solid var(--border); }
.state-card .choice:hover { background: var(--tint); }

.item-card { display: grid; gap: 14px; border: 2px solid var(--navy); }
.item-kicker { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-text); font-weight: 800; }
.item-head h2 { font-family: inherit; font-weight: 800; font-size: 1.2rem; line-height: 1.25; overflow-wrap: anywhere; margin-top: 2px; }
.item-name2 { color: var(--muted); font-weight: 600; }
.item-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.item-facts div { background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0; }
.item-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.item-facts dd { font-weight: 750; overflow-wrap: anywhere; font-size: .98rem; }
.item-facts .unit dd { color: var(--navy); }
.item-variant { display: grid; gap: 6px; }
.item-variant:empty { display: none; }
.variant-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.variant-key { display: flex; flex-wrap: wrap; gap: 6px; }
.variant-key b { background: var(--gold-soft); color: var(--ink); border: 1px solid var(--gold); border-radius: 6px; padding: 3px 9px; font-size: 1rem; }
.variant-all { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.variant-diff { font-size: .9rem; font-weight: 650; color: var(--ink); background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 6px 9px; border-radius: 4px; }
.variant-warning { font-size: .86rem; color: var(--gold-text); font-weight: 650; }
.item-previous { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.item-previous strong { font-size: 1.15rem; color: var(--ink); }
.item-previous button { justify-self: start; min-height: 36px; padding: 4px 10px; }
.qty-block { display: grid; gap: 8px; }
.qty-entry { display: flex; align-items: stretch; border: 2px solid var(--navy); border-radius: 10px; overflow: hidden; background: #fff; }
.qty-entry:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }

.qty-entry input::placeholder { font-size: 1.1rem; font-weight: 500; color: #8a8ea0; }
.qty-entry input { border: 0 !important; outline: none !important; min-height: 60px !important; font-size: 1.8rem !important; font-weight: 800; padding-inline: 14px; text-align: right; flex: 1; }
.qty-unit { display: grid; place-items: center; min-width: 76px; padding-inline: 12px; background: var(--navy); color: #fff; font-weight: 800; font-size: 1.05rem; }
.zero-button { justify-self: start; background: #fff; color: var(--navy); border: 1px dashed var(--navy); min-height: 40px; font-size: .9rem; }
.zero-button[aria-pressed=true] { background: var(--navy); color: #fff; border-style: solid; }
.item-status { border-radius: 8px; padding: 9px 12px; font-weight: 650; }
.item-status.info { background: var(--tint); color: var(--navy); }
.item-status.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.item-status.bad { background: var(--bad-bg); color: var(--bad); }
.item-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.zone-items { display: grid; gap: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 10px; padding: 4px; gap: 4px; }
.segmented button { background: transparent; color: var(--muted); min-height: 40px; }
.segmented button[aria-selected=true] { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.segmented b { display: inline-block; min-width: 24px; margin-left: 4px; padding: 1px 6px; border-radius: 99px; background: var(--tint); font-size: .82rem; }
.associate-hint { background: var(--gold-soft); border-radius: 8px; padding: 8px 10px; font-size: .9rem; font-weight: 600; }
.matches { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.match { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; background: #fff; color: inherit; border-radius: 0; border: 0; border-bottom: 1px solid var(--border); text-align: left; padding: 10px 4px; font-weight: 650; overflow-wrap: anywhere; min-height: 56px; }
.match:hover, .match[aria-pressed=true] { background: var(--tint); }
.match small { grid-column: 1; font-weight: 450; }
.match .badge { grid-row: 1 / span 2; grid-column: 2; }

.badge { display: inline-block; white-space: nowrap; font-size: .76rem; font-weight: 750; padding: 3px 8px; border-radius: 99px; background: var(--tint); color: var(--muted); }
.badge.todo { background: #eceef3; color: #4a4f62; }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.zero { background: var(--navy); color: #fff; }
.badge.pending { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.badge.recount { background: var(--gold-soft); color: var(--gold-text); }
.badge.issue { background: var(--bad-bg); color: var(--bad); }

.pending-card { border: 2px solid var(--warn-border); background: #fffcf5; display: grid; gap: 8px; }
.pending-card h2 { color: var(--warn); font-size: 1.1rem; }
.pending-help { font-size: .9rem; color: var(--warn); }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pending-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--warn-border); border-radius: 8px; padding: 8px 10px; }
.pending-list li div { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pending-list .buttons button { min-height: 38px; padding: 6px 10px; }

.side-card { padding: 16px; }
.side-card h2 { font-size: 1.1rem; }
.zone-totals { margin-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.zone-totals div { display: grid; gap: 3px; padding-inline: 10px; border-left: 1px solid var(--border); }
.zone-totals div:first-child { border: 0; padding-left: 0; }
.zone-totals strong { font-size: 1.6rem; line-height: 1.05; }
.zone-totals span { font-size: .8rem; color: var(--muted); }
.recent-list { list-style: none; padding: 0; margin: 8px 0 0; }
.recent-list li { display: flex; justify-content: space-between; gap: 8px; padding-block: 9px; border-top: 1px solid var(--border); font-size: .9rem; overflow-wrap: anywhere; }
.recent-list li:first-child { border-top: 0; }
.recent-list li > div { display: grid; gap: 3px; min-width: 0; }
.recent-list li > span { white-space: nowrap; font-weight: 700; }
.save-state { color: var(--ok); font-size: .84rem; margin-top: 10px; }

/* ---------- Suivi ---------- */
#panel-review { display: grid; gap: 14px; }
.review-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.review-header p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.export-button { min-height: 48px; padding-inline: 18px; background: var(--gold); color: var(--navy-deep); font-weight: 800; }
.export-button:hover:not(:disabled) { background: #d9a722; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; text-align: left; color: inherit; font-weight: 500; }
button.kpi:hover { border-color: var(--navy); }
.kpi strong { font-size: 1.8rem; line-height: 1; }
.kpi span { color: var(--muted); font-size: .86rem; }
.kpi.alert strong { color: var(--bad); }
.kpi.todo strong { color: var(--navy); }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.table-wrap { overflow-x: auto; }
.reference-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 12px; align-items: end; }
.reference-filters .buttons { grid-column: 1 / -1; }
.reference-status { margin-block: 16px 8px; }
#reference-table table { min-width: 860px; }
#reference-table td:nth-child(3) { max-width: 290px; overflow-wrap: anywhere; }
#reference-pager { flex-wrap: wrap; }
.reference-dialog { width: min(680px, calc(100% - 32px)); max-height: 85dvh; padding: 20px; border: 1px solid var(--border); border-radius: 14px; color: inherit; }
.reference-dialog::backdrop { background: #192441a8; }
.reference-dialog .section-header { align-items: start; gap: 12px; }
.reference-dialog dl { margin-bottom: 0; }
.reference-dialog dl > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.reference-dialog dt { font-weight: 700; }
.reference-dialog dd { margin: 0; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .92rem; }
th { background: var(--tint); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
.zones-table tbody tr { cursor: pointer; }
.zones-table tbody tr:hover, .zones-table tbody tr[aria-selected=true] { background: var(--gold-soft); }
.zones-table .zone-name { font-weight: 750; }
.mini-bar { display: block; height: 6px; border-radius: 99px; background: #e5e7ee; overflow: hidden; margin-top: 5px; min-width: 60px; }
.mini-bar i { display: block; height: 100%; background: var(--gold); }
.mini-bar.full i { background: var(--ok); }
.issues { display: grid; gap: 14px; }
.issue-group h4 { margin: 0 0 6px; font-size: .86rem; display: flex; gap: 8px; align-items: center; }
.issue-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issue-group li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; font-size: .9rem; overflow-wrap: anywhere; }
.issue-group li small { font-size: .8rem; }
.review-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; margin-block: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips button { min-height: 36px; padding: 5px 12px; border-radius: 99px; background: #fff; color: var(--navy); border: 1px solid #c5c9d6; font-size: .86rem; }
.chips button[aria-checked=true] { background: var(--navy); color: #fff; border-color: var(--navy); }
.lines-table td small { display: block; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 12px; }

/* ---------- Données / Achats ---------- */
.data-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.data-options section { border: 1px solid var(--border); border-radius: 10px; padding: 13px; }
.data-options p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.data-options .buttons { margin-top: 9px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; align-items: start; }
#panel-achats > .section-header { margin: 6px 0 16px; }
.achats-workspace > section { min-width: 0; }
.achats-search { margin-block: 12px; }
.achats-tree-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
#achats-jump-notes { display: none; }
.achats-tree-viewport { max-block-size: clamp(16rem, 52dvh, 34rem); overflow: auto; border-block: 1px solid var(--border); scrollbar-gutter: stable; }
.achats-results, .achats-path { margin-block: 8px; overflow-wrap: anywhere; }
.achats-rows, .achats-children, .achats-notes { list-style: none; margin: 0; padding: 0; }
.achats-children { margin-inline-start: .45rem; padding-inline-start: .5rem; border-inline-start: 1px solid var(--border); }
.achats-row { display: grid; grid-template-columns: .85rem minmax(0, 1fr) auto; gap: .55rem; align-items: center; width: 100%; padding: 8px 6px; text-align: start; overflow-wrap: anywhere; min-height: 42px; background: none; border: 0; border-radius: 7px; }
.achats-row:hover, .achats-row[aria-expanded="true"] { background: var(--tint); }
.achats-row[aria-current] { background: var(--gold-soft); color: var(--navy); }
.achats-row code { color: var(--muted); font-weight: 500; font-size: .78rem; }
.achats-row:has(.achats-note-count:not([hidden])) { grid-template-columns: .85rem minmax(0, 1fr) auto auto; }
.achats-note-count { display: inline-flex; min-inline-size: 1.5em; justify-content: center; border-radius: 5px; padding-inline: 5px; background: var(--tint); color: var(--navy); font-size: .75rem; font-weight: 700; }
#achats-filter[aria-pressed="true"] { background: var(--tint); color: var(--navy); border-color: var(--navy); }
.achats-notes-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.achats-row small { display: block; margin-top: 2px; color: var(--muted); font-weight: 400; }
.achats-row:focus-visible { outline-offset: -2px; }
.achats-chevron { display: grid; place-items: center; }
.achats-row[aria-expanded] .achats-chevron::before { content: ""; width: .4rem; height: .4rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); }
.achats-row[aria-expanded="true"] .achats-chevron::before { transform: translateY(-1px) rotate(45deg); }
.achats-pages { margin-top: 10px; justify-content: space-between; }
/* Achats : zone élargie pour dérouler l’arborescence (PC). */
body.view-achats .shell, body.view-achats .top-inner { max-width: 1680px; }
.achats-workspace { grid-template-columns: minmax(0, 2.6fr) minmax(320px, 1fr); }
@media (min-width: 781px) {
  .achats-workspace > section:last-child { position: sticky; top: 12px; }
  #panel-achats > .section-header { margin: 0 0 12px; }
  #panel-achats > .section-header h1 { font-size: 1.7rem; margin-block: 0 2px; }
  .achats-workspace > section:first-child { padding-block: 16px 12px; }
  .achats-workspace .achats-search { margin-block: 8px; }
  .achats-tree-viewport { max-block-size: max(22rem, calc(100dvh - 392px)); }
}
@media (max-width: 780px) {
  #achats-jump-notes:not([hidden]) { display: inline-flex; }
  .achats-row { min-height: 44px; }
}
#achats-discussion { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.achats-notes > li { padding-block: 8px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.achats-notes p { white-space: pre-wrap; }
.achats-note-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .82rem; }
#achats-form { margin-top: 12px; }
#achats-body { width: 100%; border: 1px solid #c5c9d6; border-radius: 8px; padding: 9px; font: inherit; resize: vertical; }

.footer { color: var(--muted); padding-block: 18px; font-size: .83rem; }
/* ---------- Connexion ---------- */
/* Plein écran marine, logo officiel en blanc (seule application autorisée sur marine), or en décor uniquement. */
body.signed-out { background: var(--navy); }
body.signed-out .topbar, body.signed-out .footer { display: none; }
.login-screen { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; overflow: hidden; color: #fff; padding: 32px 20px;
  background: radial-gradient(ellipse at 50% 42%, #22305a 0%, var(--navy) 46%, #0b1224 100%); }
/* Guilloché de médaille : rayons et anneaux très fins, tournant lentement, presque invisibles. */
.login-guilloche { position: absolute; z-index: -1; inset: 50% auto auto 50%; width: min(150vmax, 1500px); aspect-ratio: 1; translate: -50% -50%; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle, transparent 0 20%, #000 30%, rgba(0,0,0,.6) 45%, transparent 64%); mask-image: radial-gradient(circle, transparent 0 20%, #000 30%, rgba(0,0,0,.6) 45%, transparent 64%); }
.login-guilloche i { position: absolute; inset: 0; border-radius: 50%; }
.login-guilloche i:first-child { background: repeating-conic-gradient(from 0deg, rgba(205, 154, 16, .055) 0deg .25deg, transparent .25deg 4deg); animation: guilloche 300s linear infinite; }
.login-guilloche i:last-child { background: repeating-radial-gradient(circle, rgba(205, 154, 16, .07) 0 1px, transparent 1px 42px); animation: guilloche 400s linear infinite reverse; }
@keyframes guilloche { to { rotate: 360deg; } }
.login-stage { display: grid; justify-items: center; text-align: center; gap: 0; width: min(100%, 420px); }
.login-logo { margin: 0; width: min(76%, 380px); line-height: 0; }
.login-logo svg { display: block; width: 100%; height: auto; color: #fff; }
.login-word { margin-top: 26px; font-family: var(--title-font); font-size: clamp(1.45rem, 5vw, 2rem); letter-spacing: .05em; color: #fff; }
.login-word::before, .login-word::after { content: ""; display: block; width: 0; height: 1px; margin: 0 auto; background: var(--gold); transition: width 1s; }
.login-word::before { margin-bottom: 18px; width: 56px; }
.login-word::after { display: none; }
#login-intro { margin-top: 7px; font-size: .95rem; color: #d3d8e6; }
#login-intro:empty { display: none; }
#login-form { margin-top: 48px; width: 100%; }
/* Bouton conforme aux règles Microsoft : fond blanc, bordure #8C8C8C, texte #5E5E5E, logo à gauche. */
.ms-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px;
  background: #fff; color: #5e5e5e; border: 1px solid #8c8c8c; border-radius: 2px; font-family: "Segoe UI", Satoshi, Calibri, system-ui, sans-serif; font-size: 15px; font-weight: 600; }
.ms-button:hover:not(:disabled) { background: #f3f3f3; }
.ms-button:active:not(:disabled) { background: #e9e9e9; }
.ms-button:disabled { opacity: .55; }
.ms-button[aria-busy=true] { cursor: progress; opacity: .85; }
.ms-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.ms-logo { flex: none; }
.login-feedback { margin-top: 18px; max-width: 36ch; font-size: .9rem; line-height: 1.45; color: #f3c9c1; }
/* Apparition lente. */
@media (prefers-reduced-motion: no-preference) {
  .login-logo { animation: reveal 1.8s cubic-bezier(.2, .7, .2, 1) both; }
  .login-word { animation: fade 1.2s .9s both; }
  .login-word::before { animation: line 1.2s 1.1s both; }
  #login-form { animation: rise 1s 1.5s both; }
}
@keyframes reveal { from { opacity: 0; filter: blur(10px); transform: scale(.97); } to { opacity: 1; filter: none; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes line { from { width: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .login-guilloche i { animation: none !important; } }

/* ---------- Tablette ---------- */
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-grid { grid-template-columns: 1fr; }
}

/* ---------- Smartphone ---------- */
@media (max-width: 760px) {
  .top-inner, .shell { padding-inline: 12px; }
  .top-inner { min-height: 58px; gap: 8px; }
  .brand-logo { height: 32px; }
  .brand-app { font-size: .95rem; }
  .hero { gap: 10px; padding: 14px 16px; margin-top: 10px; grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; margin-block: 2px 4px; }
  .hero p { font-size: .84rem; }
  body.view-count .hero { display: none; }
  .tabs { margin: 6px 0 10px; }
  .tabs button { padding: 0 10px; }
  .count-layout, .workspace, .data-options { grid-template-columns: 1fr; }
  .count-side { position: static; }
  .count-side .side-card:first-child { display: none; }
  .card { padding: 14px; }
  .location-bar { top: 0; margin-inline: -4px; border-radius: 0 0 12px 12px; }
  .item-actions { grid-template-columns: 1fr; }
  .item-actions .secondary { order: 2; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-filters { grid-template-columns: 1fr; }
  .lines-table .col-ref, .lines-table .col-date { display: none; }
}
@media (max-width: 380px) {
  .brand { gap: 7px; }
  .brand-logo { height: 23px; }
  .brand-app { font-size: 1rem; }
  .brand-subtitle { font-size: .75rem; }
}
@media (max-width: 380px) {
  .location-text strong { font-size: 1.45rem; }
  .connection { padding: 4px 8px; font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
