/* ============================================================
   Gestion Stock TCG — design system v3 « Premium Noir & Or »
   Téléphone (<800) : barre du haut + navigation basse
   Tablette (≥800)  : barre latérale
   PC (≥1100)       : contenu large + tableau de bord 2 colonnes
   ============================================================ */
:root {
  --bg: #0a0a0f;
  --card: #14141c;
  --card-2: #101017;
  --ink: #ecedf2;
  --muted: #9aa1b2;
  --line: #242532;
  --accent: #d9b45b;
  --accent-hover: #e6c368;
  --accent-soft: rgb(217 180 91 / .13);
  --accent-ink: #16130a;
  --ok: #34d399;
  --ok-soft: rgb(52 211 153 / .14);
  --ok-ink: #7ce8bd;
  --warn: #fbbf24;
  --warn-soft: rgb(251 191 36 / .13);
  --warn-ink: #fcd34d;
  --bad: #f87171;
  --bad-soft: rgb(248 113 113 / .14);
  --bad-ink: #fca5a5;
  --info-soft: rgb(129 140 248 / .16);
  --info-ink: #b4bcfd;
  --side: #07070c;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / .45), 0 6px 20px rgb(0 0 0 / .35);
  --shadow-lift: 0 4px 12px rgb(0 0 0 / .5), 0 16px 40px rgb(0 0 0 / .45);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15.5px; line-height: 1.5;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
::selection { background: rgb(217 180 91 / .3); }
a { color: var(--accent); }

/* ---------- icônes SVG (couleur héritée du texte) ---------- */
svg.icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3.5px; }
svg.icon.nav { width: 22px; height: 22px; vertical-align: 0; }
svg.logo-mark { width: 22px; height: 22px; vertical-align: -5px; }
svg.logo-mark.big { width: 26px; height: 26px; vertical-align: -6px; }
svg.logo-mark.hero { width: 54px; height: 54px; margin-bottom: 10px;
  filter: drop-shadow(0 8px 24px rgb(217 180 91 / .35)); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b2c3a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a3b4c; }

/* ---------- barre du haut (téléphone) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgb(7 7 12 / .92); backdrop-filter: blur(14px);
  color: #fff; border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; max-width: 1100px; margin: 0 auto;
}
.brand { font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.page-title { flex: 1; text-align: center; font-weight: 600; font-size: 14.5px; opacity: .85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip { background: var(--accent-soft); border: 1px solid rgb(217 180 91 / .3);
  color: var(--accent); border-radius: 999px; padding: 2px 11px; font-size: 13px; font-weight: 600; }

.content { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ---------- navigation basse (téléphone) ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: flex-end;
  background: rgb(13 13 19 / .92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 7px 4px calc(9px + env(safe-area-inset-bottom));
}
.bottomnav a, .bottomnav .morebtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
  background: none; border: none; cursor: pointer; font-family: inherit; padding: 3px 0;
}
.bottomnav .ico { font-size: 21px; line-height: 1.1; }
.bottomnav a.active { color: var(--accent); }
.fab-link { position: relative; top: -16px; }
.fab {
  display: flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 18px;
  background: linear-gradient(135deg, #e6c368, #b98a2e);
  color: var(--accent-ink); font-size: 30px; font-weight: 700;
  box-shadow: 0 8px 24px rgb(217 180 91 / .35);
}

/* ---------- menu « Plus » (téléphone) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .6); z-index: 45; }
.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: #16161f; border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.sheet-grip { width: 44px; height: 5px; background: #323342; border-radius: 5px; margin: 8px auto 12px; }
.sheet a, .sheet .linklike {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 8px;
  border: none; border-bottom: 1px solid var(--line);
  background: none; color: var(--ink); text-decoration: none;
  font-size: 16px; font-weight: 500; font-family: inherit; cursor: pointer;
}
.sheet form { margin: 0; }
.sheet a:last-child, .sheet .linklike:last-child { border-bottom: none; }
.sheet a svg.icon, .sheet .linklike svg.icon { color: var(--accent); }

/* ---------- cartes & grilles ---------- */
.card {
  background: linear-gradient(180deg, #15151e, #12121a);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.card h3 { margin: 14px 0 8px; font-size: 14.5px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.kpi { padding: 12px 14px; border-radius: 12px; background: var(--card-2);
  border: 1px solid var(--line); }
.kpi .label { font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 19px; font-weight: 800; margin-top: 3px; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; }
.kpi.small .value { font-size: 16px; }
.kpi-strip { margin-bottom: 14px; }
.kpi-strip .kpi { background: linear-gradient(180deg, #15151e, #12121a); box-shadow: var(--shadow); }

/* ---------- messages ---------- */
.flash { padding: 13px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 600;
  font-size: 14.5px; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok-ink); border-color: rgb(52 211 153 / .3); }
.flash-error { background: var(--bad-soft); color: var(--bad-ink); border-color: rgb(248 113 113 / .3); }
.flash-message, .flash-info { background: var(--info-soft); color: var(--info-ink); border-color: rgb(129 140 248 / .3); }

.alert-banner { border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
  color: #fff; box-shadow: var(--shadow-lift); border: 1px solid rgb(255 255 255 / .08); }
.alert-rouge { background: linear-gradient(135deg, #b91c1c, #7f1212); }
.alert-orange { background: linear-gradient(135deg, #d97706, #92500a); }
.alert-ok { background: linear-gradient(135deg, #059669, #065f46); }
.alert-banner .big { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.alert-banner .sub { opacity: .95; margin-top: 5px; font-size: 14.5px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.35; }
.b-ok { background: var(--ok-soft); color: var(--ok-ink); }
.b-warn { background: var(--warn-soft); color: var(--warn-ink); }
.b-bad { background: var(--bad-soft); color: var(--bad-ink); }
.b-muted { background: #23242f; color: #b6bccb; }
.b-info { background: var(--info-soft); color: var(--info-ink); }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(135deg, #e2bd62, #c39b3e);
  color: var(--accent-ink);
  padding: 12px 20px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700; font-family: inherit; letter-spacing: -.01em;
  text-decoration: none; cursor: pointer; min-height: 46px;
  box-shadow: 0 4px 14px rgb(217 180 91 / .25);
  transition: filter .12s ease, transform .12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #23242f; color: var(--ink); box-shadow: none; }
.btn.secondary:hover { background: #2b2c3a; filter: none; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff;
  box-shadow: 0 4px 14px rgb(239 68 68 / .25); }
.btn.ghost { background: none; color: var(--accent); border: 1.5px solid rgb(217 180 91 / .45);
  box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); filter: none; }
.btn.small { padding: 7px 14px; min-height: 36px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* ---------- formulaires ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: #b0b6c6; margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; font-size: 15.5px; font-family: inherit;
  border: 1.5px solid #2c2d3c; border-radius: 11px;
  background: #0e0e15; color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: #5d6374; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(217 180 91 / .18);
}
input[type="date"] { color-scheme: dark; }

/* menus déroulants : chevron doré sur mesure */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23d9b45b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 13px;
  padding-right: 38px;
}

/* cases à cocher & boutons radio dessinés sur mesure */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none;
  width: 21px !important; height: 21px; min-width: 21px; padding: 0;
  border: 1.5px solid #3d3e50; border-radius: 7px; background: #0e0e15;
  display: inline-block; vertical-align: -5px; margin: 0 4px 0 0;
  cursor: pointer; position: relative;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: rgb(217 180 91 / .6); }
input[type="checkbox"]:checked, input[type="radio"]:checked {
  border-color: var(--accent);
  background: linear-gradient(135deg, #e6c368, #bd8f32);
}
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 6.5px; top: 2.5px; width: 5px; height: 10px;
  border: solid #16130a; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
input[type="radio"]:checked::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #16130a;
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgb(217 180 91 / .25);
}

/* un label contenant une case ou un radio devient une tuile sélectionnable */
label:has(> input[type="radio"]), label:has(> input[type="checkbox"]) {
  display: flex; align-items: center; gap: 10px; min-width: 0; overflow-wrap: break-word;
  background: var(--card-2); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 8px 0; cursor: pointer;
  font-size: 14.5px; font-weight: 500; color: var(--ink); line-height: 1.4;
  transition: border-color .12s ease, background .12s ease;
}
label:has(> input[type="radio"]):hover, label:has(> input[type="checkbox"]):hover {
  border-color: rgb(217 180 91 / .45);
}
label:has(> input[type="radio"]:checked), label:has(> input[type="checkbox"]:checked) {
  border-color: rgb(217 180 91 / .65); background: var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 559px) {
  .field-row { grid-template-columns: 1fr; }
}
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hint a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---------- tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px;
  font-size: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
table.data th, table.data td { padding: 10px 12px; text-align: left;
  border-bottom: 1px solid #1e1f2b; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data th { background: #191a25; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.data tbody tr:hover td, table.data tr:hover td { background: #1a1b28; }
table.data tr.total td, table.data tr.total:hover td { font-weight: 800; background: #1d1e2b; }
table.data tr.set-row td, table.data tr.set-row:hover td {
  font-weight: 700; background: var(--accent-soft); color: var(--accent);
  border-top: 1px solid rgb(217 180 91 / .25); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data a { color: var(--accent); font-weight: 600; text-decoration: none; }
table.data a:hover { text-decoration: underline; }
/* les boutons placés dans un tableau gardent leurs couleurs de bouton */
table.data a.btn { color: var(--accent-ink); }
table.data a.btn.secondary { color: var(--ink); }
table.data a.btn.ghost { color: var(--accent); }
table.data a.btn:hover { text-decoration: none; }

/* ---------- listes (cartes tactiles) ---------- */
.list-item {
  display: block; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 13px; padding: 13px 15px; margin-bottom: 9px;
  text-decoration: none; color: var(--ink);
  transition: border-color .12s ease, background .12s ease;
}
a.list-item:hover { border-color: rgb(217 180 91 / .4); background: #16161f; }
.list-item .row1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.list-item .row2 { display: flex; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: 13px; margin-top: 4px; flex-wrap: wrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; flex: 1; min-width: 120px;
  padding: 9px 11px; font-size: 14px; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 12px; }

/* ---------- affichage conditionnel PC / téléphone ---------- */
.only-desktop { display: none; }

/* ---------- onglets (catalogues…) ---------- */
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; gap: 4px; margin: 0 0 14px; }
.seg a { display: inline-block; padding: 8px 16px; border-radius: 9px; font-size: 14px;
  font-weight: 700; color: var(--muted); text-decoration: none;
  transition: background .12s ease, color .12s ease; }
.seg a:hover { color: var(--ink); }
.seg a.active { background: linear-gradient(135deg, #e2bd62, #c39b3e);
  color: var(--accent-ink); box-shadow: 0 2px 10px rgb(217 180 91 / .3); }

/* Vente TTC → seul le champ TTC visible ; vente HT → seul le champ HT. */
form.price-form .price-ht-field { display: none; }
form.price-form.exempt .price-ht-field { display: block; }
form.price-form.exempt .price-ttc-field { display: none; }

/* ---------- timeline virements ---------- */
.timeline .week {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  padding: 12px 15px; margin-bottom: 9px;
}
.week-num { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 13.5px;
  background: #23242f; color: var(--muted); }
.week.paye .week-num { background: var(--ok-soft); color: var(--ok-ink); }
.week.partiel .week-num { background: var(--warn-soft); color: var(--warn-ink); }
.week.reporte .week-num { background: var(--bad-soft); color: var(--bad-ink); }
.week.courante { border-color: rgb(217 180 91 / .55); box-shadow: 0 0 0 3px rgb(217 180 91 / .15); }

.progressbar { height: 9px; border-radius: 6px; background: #23242f; overflow: hidden; }
.progressbar > div { height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #e6c368, #b98a2e); }

/* ---------- connexion / installation ---------- */
.login-wrap { max-width: 430px; margin: 8vh auto 0; }
.login-wrap .brand-big { font-size: 27px; font-weight: 800; text-align: center;
  margin-bottom: 20px; letter-spacing: -.02em; }

details.box { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-top: 10px; }
details.box summary { cursor: pointer; font-weight: 700; font-size: 14.5px; }
details.box[open] summary { margin-bottom: 6px; }
pre.diff { font-size: 12px; overflow-x: auto; background: #050508; color: #b9c5e8;
  border: 1px solid var(--line); padding: 10px; border-radius: 10px; }

code { background: #23242f; padding: 2px 7px; border-radius: 6px; font-size: .92em; }

/* ============================================================
   Finitions premium (composants)
   ============================================================ */
/* titres de cartes : barrette dorée */
.card h2 { display: flex; align-items: center; gap: 9px; }
.card h2::before { content: ""; width: 4px; height: 17px; border-radius: 3px; flex: 0 0 auto;
  background: linear-gradient(180deg, #e6c368, #b98a2e); }

/* liseré doré discret en haut des indicateurs clés */
.kpi { position: relative; overflow: hidden; transition: border-color .12s ease; }
.kpi-strip .kpi::before, .dash-main .kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 5%, rgb(217 180 91 / .55), transparent 95%);
}
.kpi:hover { border-color: #33344388; }

/* messages : accent latéral */
.flash { border-left-width: 4px; }

/* focus clavier visible partout */
a:focus-visible, button:focus-visible, .btn:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* tableaux : transitions douces */
table.data td { transition: background .1s ease; }

/* détails dépliables : marqueur doré */
details.box summary::marker, details summary::marker { color: var(--accent); }

/* pages hors connexion (login / installation) : fond mis en scène */
body:not(.with-sidebar) {
  background:
    radial-gradient(900px 420px at 50% -8%, rgb(217 180 91 / .09), transparent 65%),
    radial-gradient(700px 500px at 85% 110%, rgb(109 40 217 / .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
.login-wrap .brand-big {
  background: linear-gradient(135deg, #f2dc96, #c69f43);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-wrap .card { padding: 28px; }

/* ============================================================
   Tablette & PC (≥ 800 px) : barre latérale
   ============================================================ */
.sidebar { display: none; }
.page-head { display: none; }

@media (min-width: 800px) {
  body { padding-bottom: 28px; }
  body.with-sidebar { padding-left: 242px; }
  .topbar, .bottomnav, .sheet, .sheet-backdrop { display: none !important; }
  .only-desktop { display: block; }
  .only-mobile { display: none; }

  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; width: 242px; z-index: 40;
    background: linear-gradient(180deg, #07070c 0%, #0d0c16 100%);
    border-right: 1px solid var(--line);
    color: #dbe0ee; padding: 18px 13px; overflow-y: auto;
  }
  .sidebar-brand { font-size: 19px; font-weight: 800; color: #fff;
    padding: 2px 10px 16px; letter-spacing: -.02em; }
  .sidebar-new {
    display: block; text-align: center;
    background: linear-gradient(135deg, #e6c368, #b98a2e); color: var(--accent-ink);
    text-decoration: none; font-weight: 700; padding: 11px; border-radius: 12px;
    margin: 0 4px 16px; box-shadow: 0 6px 20px rgb(217 180 91 / .3);
    transition: filter .12s ease;
  }
  .sidebar-new:hover { filter: brightness(1.08); }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    color: #9aa1b8; text-decoration: none; padding: 9px 11px; border-radius: 10px;
    font-size: 14px; font-weight: 500; white-space: nowrap;
    border-left: 3px solid transparent;
    transition: background .12s ease, color .12s ease;
  }
  .sidebar-nav a:hover { background: #ffffff0d; color: #fff; }
  .sidebar-nav a.active { background: var(--accent-soft); color: var(--accent);
    font-weight: 700; border-left-color: var(--accent); }
  .sidebar-footer { border-top: 1px solid #ffffff14; padding-top: 12px; margin-top: 12px; }
  .sidebar-footer .user-chip { display: block; background: none; border: none;
    padding: 2px 11px 8px; font-size: 13px; color: #9aa1b8; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; }
  .sidebar-footer .linklike { background: none; border: none; color: #9aa1b8;
    font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 6px 11px;
    display: flex; align-items: center; gap: 9px; }
  .sidebar-footer .linklike:hover { color: #fff; }

  .content { max-width: 1000px; margin: 0; padding: 26px 32px; }
  .page-head { display: block; }
  .page-head h1 { margin: 0 0 18px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
  .page-head h1:empty { display: none; }

  body:not(.with-sidebar) .content { margin: 0 auto; }

  .table-wrap { margin: 0; padding: 0; }
  table.data { min-width: 0; }
  .btn { min-height: 42px; padding: 10px 18px; }
}

/* ============================================================
   PC large (≥ 1100 px)
   ============================================================ */
@media (min-width: 1100px) {
  .content { max-width: 1260px; padding: 30px 40px; }
  .dash-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 0 18px; align-items: start; }
  .grid3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .kpi .value { font-size: 21px; }
  .filters select, .filters input { flex: 0 1 auto; }
}

/* ============================================================
   Échelle d'affichage sur PC / tablette : 80 % (équivalent du zoom
   navigateur à 80 %). Le téléphone garde la taille normale (cibles tactiles,
   champs ≥ 16 px pour éviter le zoom automatique d'iOS).
   ============================================================ */
@media (min-width: 800px) {
  html { zoom: 0.8; }
}
/* largeur max agrandie d'autant (1260 / 0,8) pour ne pas laisser de bande vide */
@media (min-width: 1100px) {
  .content { max-width: 1575px; }
}

/* ============================================================
   Rôles : lecture seule, badge, administration
   ============================================================ */
/* Lecteur : le serveur refuse déjà toute écriture ; on masque aussi les formulaires. */
body.readonly form[method="post" i]:not(.keep-readonly) { display: none !important; }
.ro-badge { margin-left: 6px; font-size: 11px; padding: 2px 8px; }
.count-badge { display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 6px;
  border-radius: 999px; background: var(--bad-soft); color: var(--bad-ink);
  font-size: 12px; font-weight: 800; text-align: center; line-height: 1.5; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.admin-actions form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.admin-actions select { width: auto; min-height: 34px; padding: 4px 8px; }
.temp-password { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 800;
  letter-spacing: .04em; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent); user-select: all; display: inline-block; margin: 8px 0; }

/* ============================================================
   Inventaire sur téléphone : une carte par article
   ============================================================ */
.inv-group { background: var(--accent-soft); border: 1px solid rgb(217 180 91 / .25);
  border-radius: 13px; padding: 11px 15px; margin: 14px 0 9px; }
.inv-group.inv-total { margin-top: 16px; background: var(--card-2); border-color: var(--line); }
.inv-card { margin-bottom: 9px; }
.inv-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.inv-name { font-weight: 700; overflow-wrap: anywhere; }
.inv-group .inv-name { color: var(--accent); }
.inv-group.inv-total .inv-name { color: var(--ink); }
.inv-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.inv-dispo { display: flex; flex-direction: column; align-items: flex-end; flex: none;
  font-size: 30px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.inv-dispo.small { font-size: 22px; }
.inv-dispo span { font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin-top: 2px; }
.inv-line { color: var(--muted); font-size: 12px; margin-top: 8px; }
@media (max-width: 559px) {
  .inv-filters { flex-direction: column; }
  .inv-filters select, .inv-filters input, .inv-filters .btn { width: 100%; flex: none; }
}

/* ---------- accueil : résumé « À faire » ---------- */
.todo-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px; margin-top: 14px; }
.todo-kpis .hint { margin-top: 2px; }

/* ============================================================
   Formulaire de vente compact (nouvelle vente / modification)
   ============================================================ */
:root { --nav-h: calc(72px + env(safe-area-inset-bottom)); } /* app.js la remplace par la mesure réelle */
.sale-form .first-label { margin-top: 0; }
.sale-form details.box { padding: 0 14px; }
.sale-form details.box[open] { padding-bottom: 12px; }
.sale-form details.box > summary { padding: 12px 0; }
.sale-form details.box[open] > summary { margin-bottom: 0; }
.more-sum { display: block; margin-top: 1px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
details[open] > summary > .more-sum { display: none; }

.sale-form .sale-line { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.line-head { display: flex; align-items: center; gap: 8px; }
.line-head select { flex: 1; min-width: 0; }
.line-x { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card-2); color: var(--bad-ink);
  font: inherit; font-size: 17px; line-height: 1; }
.line-x:hover { background: var(--bad-soft); border-color: rgb(248 113 113 / .5); }
.line-hint { margin: 4px 0 0; }
.line-qp { display: grid; grid-template-columns: minmax(88px, 1fr) 2fr; gap: 10px; }
.line-qp label { margin-top: 6px; }
.remise-box { max-width: 50%; }
.linkbtn { background: none; border: none; padding: 0 2px; min-height: 44px; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; }

.plan-line { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; min-height: 44px; }
.plan-row { display: grid; grid-template-columns: 1fr 1.4fr 44px; gap: 10px; align-items: end;
  margin-bottom: 6px; }

.draft-row { margin-top: 0; }
.sale-bar { position: sticky; bottom: calc(var(--nav-h) + 10px); z-index: 35; margin: 8px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgb(13 13 19 / .96); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px;
  box-shadow: var(--shadow-lift); }
.sale-bar-total { display: flex; flex-direction: column; line-height: 1.15; flex: none;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sale-bar-total strong { font-size: 18px; font-weight: 800; color: var(--ink); text-transform: none;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sale-bar .btn { flex: 1; padding-left: 12px; padding-right: 12px; }
/* un champ qui prend le focus ne se cache pas sous la barre */
.sale-form input, .sale-form select, .sale-form textarea { scroll-margin-bottom: calc(var(--nav-h) + 96px); }

@media (max-width: 799px) {
  /* ≥ 16 px : iOS ne zoome pas dans les champs ; cibles tactiles ≥ 44 px */
  .sale-form input:not([type="checkbox"]):not([type="radio"]), .sale-form select, .sale-form textarea {
    font-size: 16px; min-height: 44px; }
  .sale-form .btn, .sale-form .btn.small { min-height: 44px; }
}
@media (min-width: 800px) {
  .sale-bar { bottom: 12px; }
}
