/* Foulée atelier : DA v2 du site, en version de travail (sobre, dense, bureau). */
:root {
  --paper: #faf6ee;
  --paper-soft: #f2ebdd;
  --sand: #e7dfd0;
  --stone: #857763;
  --ink: #1b1a17;
  --ink-soft: #4c463d;
  --primary: #1e3a2f;
  --primary-deep: #152b22;
  --primary-soft: #dce7df;
  --on-primary: #faf6ee;
  --cacao: #7a4227;
  --peach-soft: #fbe4d9;
  --rust: #8f3d28;
  --rust-soft: #f1d9cf;
  --sun-soft: #f8e7b8;
  --success: #2d5443;
  --danger: #b3261e;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  min-width: 960px;
}
a { color: var(--rust); }
code { font-size: 0.88em; background: var(--paper-soft); padding: 0.1em 0.35em; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0 0 0.6em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; margin-top: 1.2em; }

/* ── Barre du haut ─────────────────────────────────────────────── */
.top { background: var(--primary); color: var(--on-primary); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 0 28px; height: 60px; display: flex; align-items: center; gap: 32px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--on-primary); text-decoration: none; }
.brand span { font-family: var(--sans); font-weight: 500; font-size: 0.8rem; opacity: 0.7; margin-left: 4px; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--on-primary); text-decoration: none; padding: 7px 12px; border-radius: 999px; opacity: 0.78; font-weight: 500; }
.top nav a:hover { opacity: 1; background: rgb(255 255 255 / 0.08); }
.top nav a[aria-current="page"] { opacity: 1; background: rgb(255 255 255 / 0.16); }
.sync { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 0.82rem; opacity: 0.9; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 28px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; }
.lede { color: var(--ink-soft); margin: 0; max-width: 70ch; }

/* ── Bandeaux ──────────────────────────────────────────────────── */
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 0.9rem; }
.banner-info { background: var(--primary-soft); }
.banner-warn { background: var(--sun-soft); }
.banner-bad { background: var(--rust-soft); color: var(--rust); }

/* ── Cartes, grilles ───────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--sand); border-radius: 14px; padding: 20px 22px; margin-bottom: 20px; }
.card-accent { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-2 > .card { margin-bottom: 20px; }
section > h2 .count, h2 .count { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; background: var(--paper-soft); color: var(--ink-soft); padding: 2px 9px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card .stats { margin-bottom: 14px; }
.stats-2 { grid-template-columns: 1fr 1fr; }
.stat { background: var(--paper); border-radius: var(--radius); padding: 12px 14px; }
.stat-label { font-size: 0.8rem; color: var(--stone); font-weight: 500; }
.stat-value { font-family: var(--serif); font-weight: 700; font-size: 1.55rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-sub { font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }
.wrap > .stats .stat { background: #fff; border: 1px solid var(--sand); }
.stat-strong, .wrap > .stats .stat-strong { background: var(--primary-soft); }
.stat-good .stat-value { color: var(--success); }
.stat-bad .stat-value { color: var(--rust); }

/* ── Tableaux ──────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--sand); vertical-align: top; }
.table thead th { font-size: 0.78rem; color: var(--stone); font-weight: 600; border-bottom-color: var(--ink-soft); }
.table tbody th { font-family: var(--serif); font-weight: 700; font-size: 1rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .big { font-family: var(--serif); font-weight: 700; font-size: 1.4rem; }
.table .label { max-width: 380px; word-break: break-word; }
.table .right { text-align: right; }
.table tr.row-bad td { color: var(--rust); }
.stock td { vertical-align: middle; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { display: inline-block; background: var(--paper-soft); border-radius: 999px; padding: 3px 11px; font-size: 0.85rem; margin: 2px 0; }

/* ── Formulaires et boutons ────────────────────────────────────── */
input, select, button { font: inherit; }
input, select {
  border: 1px solid var(--sand); background: #fff; border-radius: 8px; padding: 7px 10px; color: var(--ink); min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  background: var(--primary); color: var(--on-primary); font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--primary-deep); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-small { padding: 5px 12px; font-size: 0.85rem; }
.btn-quiet { background: var(--paper-soft); color: var(--ink); }
.btn-quiet:hover { background: var(--sand); }
.btn-link { background: none; color: var(--rust); padding: 4px 6px; font-weight: 500; text-decoration: underline; }
.btn-link:hover { background: none; color: var(--ink); }
.btn-ghost-light { background: rgb(255 255 255 / 0.14); color: var(--on-primary); padding: 6px 14px; }
.btn-ghost-light:hover { background: rgb(255 255 255 / 0.24); }

form.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 3px 8px 3px 0; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--ink-soft); font-weight: 500; }
.span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; color: var(--ink-soft); }
.w-num { width: 92px; }
.w-note { width: 170px; }
.upload { color: var(--rust); text-decoration: underline; cursor: pointer; font-size: 0.88rem; }
.upload input { display: none; }
.picker label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--stone); font-weight: 600; }

/* ── Commandes (atelier) ───────────────────────────────────────── */
.order { background: #fff; border: 1px solid var(--sand); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.order-late { border-color: var(--rust); box-shadow: inset 4px 0 0 var(--rust); }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; background: var(--paper); }
.ref { font-family: var(--serif); font-size: 1.1rem; margin-right: 6px; }
.order-body { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 20px; padding: 14px 18px; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { padding: 3px 0; }
.qty { color: var(--stone); font-variant-numeric: tabular-nums; }
.addr pre { font: inherit; margin: 0 0 8px; white-space: pre-line; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 0.88rem; }
.meta dt { color: var(--stone); }
.meta dd { margin: 0; word-break: break-word; }
.order-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--sand); flex-wrap: wrap; }
.order-foot .note input { width: 260px; }
.recap th { width: 160px; }

.badge { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--primary-soft); color: var(--success); }
.badge-soon { background: var(--sun-soft); color: #6b4b00; }
.badge-late { background: var(--rust-soft); color: var(--rust); }

details.past { margin-top: 10px; }
details.past summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); padding: 8px 0; }

/* ── Tableau de bord ───────────────────────────────────────────── */
.declare p { margin: 0 0 10px; }
.result { padding: 12px 14px; border-radius: var(--radius); margin: 4px 0 10px; }
.result.good { background: var(--primary-soft); }
.result.bad { background: var(--peach-soft); }
.gauge { margin-bottom: 16px; }
.gauge-head { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 5px; }
.gauge-track { height: 10px; background: var(--paper-soft); border-radius: 999px; overflow: hidden; }
.gauge-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.gauge.warn .gauge-fill { background: #c98a1a; }
.gauge.bad .gauge-fill { background: var(--rust); }
.chart { width: 100%; height: 220px; display: block; margin: 6px 0 8px; }
.chart .bar { fill: var(--primary); }
.chart .axis { stroke: var(--sand); }
.chart .bar-val { font: 600 11px var(--sans); fill: var(--ink-soft); text-anchor: middle; }
.chart .bar-lab { font: 500 11px var(--sans); fill: var(--stone); text-anchor: middle; }

/* ── Divers ────────────────────────────────────────────────────── */
.muted { color: var(--stone); }
.small { font-size: 0.82rem; }
.good { color: var(--success); }
.warn { color: #8a5d00; }
.bad { color: var(--rust); }
.empty { color: var(--stone); font-style: italic; margin: 6px 0 14px; }
.note-text { color: var(--ink-soft); font-size: 0.88rem; margin: 8px 0 14px; }
ul.plain { padding-left: 18px; font-size: 0.9rem; color: var(--ink-soft); }
ul.plain li { margin-bottom: 8px; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; transition: 0.2s; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--rust); }

/* ── Atelier en colonnes ───────────────────────────────────────── */
.wrap-wide { max-width: 1640px; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kcol { background: var(--paper-soft); border-radius: 14px; padding: 14px 12px 6px; min-height: 240px; }
.kcol h2 { font-size: 1.08rem; margin: 2px 4px 12px; }
.kcol-route { background: var(--primary-soft); }
.kcol-recue { background: #ebe6db; }
.kcol .empty { margin: 4px 4px 14px; font-size: 0.88rem; }
.krecap { background: #fff; border-radius: 10px; padding: 9px 11px; margin-bottom: 10px; font-size: 0.84rem; border: 1px dashed var(--sand); }
.krecap div + div { margin-top: 3px; }
.kcard { background: #fff; border: 1px solid var(--sand); border-radius: 12px; padding: 11px 12px; margin-bottom: 10px; font-size: 0.88rem; }
.kcard-late { border-color: var(--rust); box-shadow: inset 3px 0 0 var(--rust); }
.kcard-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kcard .ref { font-size: 1rem; }
.kbadge { margin: 6px 0 8px; }
.kbadge .badge { font-size: 0.75rem; padding: 2px 9px; }
.klines { list-style: none; padding: 0; margin: 0 0 6px; }
.klines li { padding: 1px 0; }
.kwho { margin-bottom: 8px; }
.knote { background: var(--sun-soft); border-radius: 8px; padding: 5px 8px; margin-bottom: 8px; font-size: 0.82rem; }
.kactions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kactions .btn-link { padding: 4px 2px; }
.kform { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; margin-bottom: 2px; }
.kform input:not([type]), .kform input[name] { width: 100%; }
.kform input[type="checkbox"] { width: auto; }
.kform .btn { align-self: flex-start; }
.kmore { margin-top: 8px; border-top: 1px solid var(--sand); padding-top: 6px; }
.kmore summary { cursor: pointer; color: var(--stone); font-size: 0.8rem; font-weight: 600; }
.kmore pre { font: inherit; white-space: pre-line; margin: 8px 0 6px; }
.kmore .meta { margin: 10px 0; font-size: 0.82rem; }
.kmore .kform { flex-direction: row; }

.kcol-coudre { background: var(--peach-soft); }
.kcard-manual { border-style: dashed; }
.korigin { font-size: 0.76rem; color: var(--cacao); font-weight: 600; margin-top: 3px; }
.krecap-title { font-size: 0.74rem; font-weight: 600; color: var(--stone); margin-bottom: 4px; }

/* ── Vente hors site ───────────────────────────────────────────── */
.sale-form > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.sale-form > summary::-webkit-details-marker { display: none; }
.sale-form[open] > summary { margin-bottom: 16px; }
.sale-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 18px; }
.sale-grid fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.sale-grid legend { font-family: var(--serif); font-weight: 700; font-size: 1rem; margin-bottom: 8px; padding: 0; }
.sale-grid label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--ink-soft); font-weight: 500; }
.sale-grid .btn { align-self: flex-start; margin-top: 4px; }
.sale-line { display: flex; gap: 8px; }
.sale-line select { flex: 1; min-width: 0; }
.sale-two { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.sale-address { display: flex; flex-direction: column; gap: 9px; }
.sale-address[hidden] { display: none; }
.kcard-top { flex-wrap: wrap; }
.kcard .ref { white-space: nowrap; }

/* ── Connexion (atelier en ligne) ──────────────────────────────── */
.who { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; margin: 0; }
.who span { opacity: 0.8; }
body.login-page { min-width: 0; }
.login { max-width: 420px; margin: 12vh auto 0; padding: 0 16px; }
.login .brand { color: var(--primary); display: block; margin-bottom: 18px; }
.login .card { padding: 26px 26px 22px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); font-weight: 500; }
.login input { font: inherit; padding: 9px 11px; border: 1px solid var(--sand); border-radius: 8px; background: #fff; }
.login .btn { align-self: flex-start; }
.login .msg { background: var(--primary-soft); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; }
.login .msg.bad { background: var(--rust-soft); color: var(--rust); }
.form-grid label.check { flex-direction: row; align-items: center; }

/* ── Vignettes des motifs ──────────────────────────────────────── */
.vig { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; flex: none; border: 1px solid var(--sand); background: var(--paper-soft); }
.vig-s { width: 24px; height: 24px; border-radius: 5px; }
.klines li { display: flex; align-items: center; gap: 8px; }
.klines li + li { margin-top: 5px; }
.krecap-row { display: flex; align-items: center; gap: 7px; }
.krecap-row + .krecap-row { margin-top: 4px; }
.motif-cell { display: inline-flex; align-items: center; gap: 10px; }
.klines .vig { width: 44px; height: 44px; }
