/* ========================================================== THÈMES */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f1f4f9; --card: #ffffff; --card-2: #f8fafc; --text: #1e293b; --muted: #64748b; --border: #e2e8f0;
  --input-bg: #ffffff; --input-border: #cbd5e1; --hover: #f1f5f9; --grid: #e2e8f0;
  --topbar: #0f172a; --topbar-text: #cbd5e1; --topbar-hover: #1e293b;
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-soft: #dbeafe; --primary-ring: #bfdbfe;
  --danger: #dc2626; --danger-soft: #fee2e2; --danger-row: #fef2f2; --danger-border: #fecaca;
  --warn: #b45309; --warn-soft: #fef3c7;
  --ok: #047857; --ok-btn: #059669; --ok-soft: #d1fae5;
  --info-soft: #eff6ff; --info-border: #bfdbfe; --info-text: #1e3a8a;
  --success-soft: #ecfdf5; --success-border: #a7f3d0; --success-text: #065f46;
  --error-text: #991b1b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120; --card: #131c2e; --card-2: #182337; --text: #e2e8f0; --muted: #94a3b8; --border: #243047;
  --input-bg: #0f1729; --input-border: #334155; --hover: #1a2539; --grid: #243047;
  --topbar: #060a14; --topbar-text: #cbd5e1; --topbar-hover: #182337;
  --primary: #3b82f6; --primary-dark: #2563eb; --primary-soft: #1e3a8a55; --primary-ring: #1e40af;
  --danger: #f87171; --danger-soft: #7f1d1d66; --danger-row: #3b141855; --danger-border: #7f1d1d;
  --warn: #fbbf24; --warn-soft: #78350f66;
  --ok: #34d399; --ok-btn: #059669; --ok-soft: #064e3b88;
  --info-soft: #172554; --info-border: #1e40af; --info-text: #bfdbfe;
  --success-soft: #052e2b; --success-border: #065f46; --success-text: #a7f3d0;
  --error-text: #fecaca;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ========================================================== BASE */
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; margin: 0 0 1.25rem; font-weight: 700; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); padding: 2rem; text-align: center; }

/* ========================================================== EN-TÊTE */
.topbar { background: var(--topbar); color: #fff; display: flex; align-items: center; gap: 2rem; padding: .5rem 2rem; min-height: 64px; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: var(--topbar-text); padding: .55rem .95rem; border-radius: 8px; font-size: 1rem; }
.topbar nav a:hover { background: var(--topbar-hover); text-decoration: none; color: #fff; }
.topbar nav a.active { background: var(--primary); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.theme-toggle { background: transparent; border: 1px solid #334155; color: #fff; border-radius: 8px; width: 40px; height: 38px; cursor: pointer; font-size: 1.05rem; }
.theme-toggle:hover { background: var(--topbar-hover); }
[data-theme="dark"] .ico-dark, [data-theme="light"] .ico-light, :root:not([data-theme]) .ico-light { display: none; }
.user-chip { display: flex; align-items: center; gap: .6rem; color: #fff; padding: .3rem .7rem .3rem .3rem; border-radius: 999px; }
.user-chip:hover, .user-chip.active { background: var(--topbar-hover); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.user-name { display: flex; flex-direction: column; line-height: 1.15; font-size: .92rem; }
.user-name small { color: #94a3b8; font-size: .75rem; }
.logout { color: #94a3b8; font-size: .92rem; }
.logout:hover { color: #fff; }

/* ========================================================== MISE EN PAGE */
.container { width: 100%; max-width: 1840px; margin: 1.75rem auto; padding: 0 2.5rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; overflow-x: auto; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1.5rem; }
.grid > .card { margin-bottom: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.5rem; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem 1.5rem; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .92rem; }
.kpi .value { font-size: 2.1rem; font-weight: 700; margin-top: .35rem; line-height: 1.1; }
.kpi.alert .value { color: var(--danger); }

.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar h1, .toolbar h2 { margin: 0; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.25rem; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .3rem; }
.filters label.check { flex-direction: row; align-items: center; padding-bottom: .55rem; }

/* ========================================================== TABLEAUX */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card table { border-radius: 8px; }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--card-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.alerte td { background: var(--danger-row); }
tr.alerte:hover td { background: var(--danger-row); filter: brightness(.98); }
tr.inactif td { color: var(--muted); font-style: italic; }
tfoot td { font-weight: 700; background: var(--card-2); border-top: 1px solid var(--border); border-bottom: 0; }
table.kv { border: 0; }
table.kv th { width: 40%; text-transform: none; letter-spacing: 0; font-size: .92rem; background: transparent; }

/* ========================================================== BADGES */
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-muted { background: var(--hover); color: var(--muted); border: 1px solid var(--border); }
.badge-entree { background: var(--ok-soft); color: var(--ok); }
.badge-sortie { background: var(--primary-soft); color: var(--primary); }
.badge-ajustement { background: var(--warn-soft); color: var(--warn); }

/* ========================================================== BOUTONS */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-size: .95rem; line-height: 1.2; white-space: nowrap; font-family: inherit; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--ok-btn); border-color: var(--ok-btn); color: #fff; }
.btn-success:hover { filter: brightness(.95); background: var(--ok-btn); }
.btn-danger { color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: .35rem .65rem; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; padding: .7rem 1rem; }
.inline { display: inline; }

/* ========================================================== FORMULAIRES */
form.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem 1.5rem; }
form.form.form-1 { grid-template-columns: 1fr; }
form.form .full { grid-column: 1 / -1; }
form.form label, .field label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .35rem; }
input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--input-border); border-radius: 8px; font-size: 1rem; background: var(--input-bg); color: var(--text); font-family: inherit;
}
.filters input, .filters select { min-width: 160px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--primary-ring); outline-offset: 0; border-color: var(--primary); }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.actions { grid-column: 1 / -1; display: flex; gap: .75rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: auto; }
.edit-row td input, .edit-row td select { padding: .4rem .55rem; font-size: .93rem; }
.inline-details { display: inline-block; position: relative; }
.inline-details summary { list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.mini-form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .75rem; display: flex; gap: .5rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); width: 340px; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: .6rem; }
.perm { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card-2); cursor: pointer; }
.perm:hover { border-color: var(--primary); }

/* ========================================================== DIVERS */
.flash { padding: .85rem 1.1rem; border-radius: 10px; margin-bottom: 1.25rem; border: 1px solid; }
.flash-success { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); }
.flash-error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--error-text); }
.flash-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info-text); }
.progress { height: 9px; background: var(--hover); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; min-width: 140px; }
.progress > div { height: 100%; background: var(--ok-btn); }
.progress > div.warn { background: #f59e0b; }
.progress > div.danger { background: #ef4444; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tabs a { padding: .7rem 1.1rem; border-bottom: 2px solid transparent; color: var(--muted); margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.chart-box { position: relative; height: 380px; }
.login { max-width: 420px; margin: 5rem auto; padding: 2rem; }
.login h1 { margin-bottom: .25rem; }

@media (max-width: 800px) {
  .container { padding: 0 .9rem; margin-top: 1rem; }
  .topbar { padding: .5rem 1rem; gap: .75rem; }
  .user-name { display: none; }
  th, td { padding: .5rem .6rem; font-size: .88rem; }
  .kpi .value { font-size: 1.6rem; }
}
@media print {
  .topbar, .toolbar .btn, .filters, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  .card, table { box-shadow: none; }
}

/* ========================================================== SAISIE RAPIDE */
.quick { border-left: 4px solid var(--primary); overflow: visible; }
.quick[data-kind="entree"] { border-left-color: var(--ok-btn); }
.quick-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.quick-head h2 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: var(--card-2); }
.seg-btn { border: 0; background: transparent; color: var(--muted); padding: .45rem 1.1rem; border-radius: 7px; cursor: pointer; font-size: .95rem; font-weight: 600; font-family: inherit; }
.seg-btn.active { background: var(--primary); color: #fff; }
.quick[data-kind="entree"] .seg-btn.active { background: var(--ok-btn); }
.quick-form { display: flex; gap: .9rem; align-items: flex-end; flex-wrap: wrap; }
.quick-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); position: relative; }
.quick-form .q-conso { flex: 1 1 380px; }
.quick-form .q-qte input { width: 90px; }
.quick-form .q-prix input { width: 110px; }
.quick-form select { min-width: 190px; }
.q-stock { font-weight: 600; }
.txt-danger { color: var(--danger); } .txt-ok { color: var(--ok); }
.quick[data-kind="sortie"] .q-e, .quick[data-kind="entree"] .q-s { display: none; }
.q-submit { padding: .62rem 1.3rem; }
/* champs compacts dans les tableaux de tarifs */
input.in-num { width: 100px; text-align: right; padding: .4rem .55rem; }
input.in-sm { width: 150px; padding: .4rem .55rem; }
input.in-url { width: 260px; padding: .4rem .55rem; margin-right: .4rem; }
a.ext::after { content: " ↗"; font-size: .8em; }
textarea { resize: vertical; }

/* ========================================================== v4 — LISIBILITÉ & ERGONOMIE */
/* Tableaux denses, en-tête qui reste visible au défilement */
table.dense { overflow: visible; }
table.dense th, table.dense td { padding: .55rem .85rem; }
table.dense thead th { position: sticky; top: 64px; z-index: 2; }
table.dense thead th:first-child { border-top-left-radius: 12px; }
table.dense thead th:last-child { border-top-right-radius: 12px; }
.card table.dense thead th { position: static; }
.table-wrap { margin-bottom: 1.5rem; }
@media (max-width: 1200px) { .table-wrap { overflow-x: auto; } table.dense thead th { position: static; } }
th.th-sort { cursor: pointer; user-select: none; }
th.th-sort:hover { color: var(--text); }
th.th-sort::after { content: " ↕"; opacity: .35; }
th[data-dir="asc"]::after { content: " ↑"; opacity: 1; }
th[data-dir="desc"]::after { content: " ↓"; opacity: 1; }

/* Cellule consommable : référence + désignation sur une ligne */
.cell-conso { white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.c-ref { font-weight: 650; color: var(--text); }
a.c-ref:hover { color: var(--primary); }
.c-des { color: var(--muted); font-size: .85rem; margin-left: .45rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; vertical-align: -.05rem; box-shadow: 0 0 0 1px rgba(127,127,127,.35); }
.sub { display: block; font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.trunc { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.plain { color: inherit; }
a.plain:hover { color: var(--primary); }
.tag { display: inline-block; padding: .05rem .45rem; border-radius: 6px; background: var(--hover); border: 1px solid var(--border); font-size: .78rem; margin-right: .35rem; white-space: nowrap; }

/* Quantités colorées */
.qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.qty-entree { color: var(--ok); }
.qty-sortie { color: var(--primary); }
.qty-ajustement { color: var(--warn); }
.stock-alerte { color: var(--danger); } .stock-bas { color: var(--warn); } .stock-ok { color: var(--ok); }

/* Jauge de stock (trait vertical = seuil d'alerte) */
.stock-cell { display: flex; align-items: center; justify-content: flex-end; gap: .7rem; }
.gauge { position: relative; width: 90px; height: 8px; border-radius: 999px; background: var(--hover); border: 1px solid var(--border); }
.gauge-fill { height: 100%; border-radius: 999px; }
.g-alerte { background: #ef4444; } .g-bas { background: #f59e0b; } .g-ok { background: #10b981; }
.gauge-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .45; }
.stock-cell strong { min-width: 2ch; text-align: right; }

/* Actions de ligne : discrètes, révélées au survol */
.col-act { width: 1%; white-space: nowrap; text-align: right; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; border-radius: 7px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-size: .95rem; text-decoration: none; }
.icon-btn:hover { background: var(--hover); text-decoration: none; border-color: var(--primary); }
.icon-btn.ok { color: var(--ok); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
@media (hover: hover) {
  table.dense tbody tr .col-act .icon-btn { opacity: .35; transition: opacity .15s; }
  table.dense tbody tr:hover .col-act .icon-btn, table.dense tbody tr .col-act .icon-btn:focus { opacity: 1; }
}

/* Panneau de filtres */
.filter-panel { padding: 1rem 1.25rem; }
.filter-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .75rem; }
.filter-row label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--muted); }
.filter-row label.grow { flex: 1 1 360px; }
.filter-row select { min-width: 150px; }
input[type=search] { width: 100%; padding: .6rem .75rem; border: 1px solid var(--input-border); border-radius: 8px; font-size: 1rem; background: var(--input-bg); color: var(--text); font-family: inherit; }
a.seg-btn { text-decoration: none; display: inline-block; }
.seg-btn:hover { color: var(--text); }
.seg-btn.seg-entree.active { background: var(--ok-btn); }
.seg-btn.seg-ajustement.active { background: #d97706; }
.chips { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.chips .spacer { flex: 1; }
.chip { display: inline-flex; gap: .35rem; align-items: center; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); font-size: .85rem; cursor: pointer; font-family: inherit; text-decoration: none; }
.chip:hover { border-color: var(--primary); text-decoration: none; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active .muted { color: #dbeafe; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--danger); background: var(--danger-soft); }

/* Bandeau de synthèse */
.summary { display: flex; gap: 1.75rem; flex-wrap: wrap; align-items: baseline; margin: -.25rem 0 1rem .25rem; color: var(--muted); font-size: .92rem; }
.summary-val { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-right: .2rem; }
.sum-sortie .summary-val { color: var(--primary); } .sum-entree .summary-val { color: var(--ok); } .sum-ajust .summary-val { color: var(--warn); }

/* Pagination */
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 0 0 1.5rem; }

/* Messages */
.flashes { position: relative; }
.flash { display: flex; align-items: center; gap: 1rem; transition: opacity .4s, transform .4s; }
.flash span { flex: 1; }
.flash-close { border: 0; background: transparent; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; opacity: .6; padding: 0 .2rem; }
.flash-close:hover { opacity: 1; }
.flash-out { opacity: 0; transform: translateY(-6px); }

/* Pied de page */
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 2rem; }
kbd { font-family: ui-monospace, monospace; font-size: .75rem; padding: .05rem .4rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--card); }

/* Focus clavier visible partout */
a:focus-visible, button:focus-visible, .chip:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

/* ========================================================== Autocomplétion */
.ac { position: relative; display: flex; flex-direction: column; gap: .3rem; }
.ac > label { font-size: .85rem; color: var(--muted); }
.ac-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; margin: 0; padding: .3rem; list-style: none;
  max-height: 380px; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.22); }
.ac-list li { display: flex; align-items: center; gap: .1rem; padding: .5rem .65rem; border-radius: 7px; cursor: pointer; color: var(--text); }
.ac-list li.on { background: var(--primary-soft); }
.ac-list li.ac-vide { color: var(--muted); cursor: default; }
.ac-ref { font-weight: 650; }
.ac-des { color: var(--muted); font-size: .85rem; margin-left: .5rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-stock { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: right; margin-left: .75rem; }
.ac-stock::before { content: "stock "; font-weight: 400; font-size: .75rem; color: var(--muted); }

/* Rupture de stock */
.ac-list li.off { opacity: .45; cursor: not-allowed; }
.ac-list li.off.on { background: var(--hover); }
.ac-rupture { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--danger); border: 1px solid var(--danger-border); border-radius: 999px; padding: .05rem .5rem; margin-left: .5rem; }
.icon-btn.disabled { opacity: .25 !important; cursor: not-allowed; }
.icon-btn.disabled:hover { background: var(--card); border-color: var(--border); }

/* ========================================================== Fiche consommable : bloc stock */
.h1-sub { font-size: 1.1rem; font-weight: 500; }
.dot-lg { width: 1rem; height: 1rem; margin-right: .6rem; vertical-align: .1rem; }
.stock-card { border-left: 4px solid var(--primary); }
.stock-hero { display: flex; gap: 2.5rem; align-items: center; flex-wrap: wrap; }
.stock-big { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; min-width: 150px; }
.stock-big .label { color: var(--muted); font-size: .9rem; }
.stock-big .value { font-size: 3.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stock-meta { flex: 1 1 420px; display: flex; flex-direction: column; gap: 1rem; }
.gauge-lg { width: 100%; height: 12px; }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.meta-grid > div { display: flex; flex-direction: column; gap: .15rem; }
.meta-grid strong { font-size: 1.15rem; }
@media (max-width: 900px) { .meta-grid { grid-template-columns: repeat(2, 1fr); } }
.stock-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn.is-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.inventaire { margin-top: 1.5rem; padding: 1rem 1.25rem; border-radius: 10px; background: var(--card-2); border: 1px dashed var(--border); }
.inv-title { margin-bottom: .75rem; }
.inv-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.inv-row label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.inv-row label.grow { flex: 1 1 280px; }
.inv-row input[type=number] { width: 140px; font-size: 1.15rem; font-weight: 700; }
.inv-ecart { min-width: 190px; padding-bottom: .65rem; font-weight: 600; }
.btn-warn { background: #d97706; border-color: #d97706; color: #fff; }
.btn-warn:hover { background: #b45309; }
.section-title { margin: .5rem 0 .75rem; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; }

/* ========================================================== Seuil désactivable */
.stock-na { color: var(--text); }
.g-na { background: #64748b; }
.seuil-field { display: flex; flex-direction: column; gap: .35rem; }
.seuil-field .check-line { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--text); font-size: .9rem; cursor: pointer; }
input.is-off { opacity: .45; text-decoration: line-through; }

/* ========================================================== v4.4 — Saisie rapide multi-lignes */
.quick-form { display: flex; flex-direction: column; flex-wrap: nowrap; gap: .9rem; align-items: stretch; }
.q-add, .q-commun { display: flex; gap: .9rem; align-items: flex-end; flex-wrap: wrap; }
.q-add .q-conso { flex: 1 1 420px; }
.q-add .q-qte input { width: 90px; }
.q-add .q-prix input { width: 110px; }
.q-commun { padding-top: .9rem; border-top: 1px solid var(--border); }
.q-commun .spacer { flex: 1; }
.q-commun select { min-width: 210px; }
.q-astuce { margin: -.2rem 0 0; }
.quick[data-kind="sortie"] .q-e, .quick[data-kind="entree"] .q-s { display: none; }
.cart { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.cart li { display: flex; align-items: center; gap: .9rem; padding: .45rem .6rem .45rem .9rem; border: 1px solid var(--border); border-radius: 9px; background: var(--card-2); }
.cart li.pulse { animation: pulse 1s ease-out; }
@keyframes pulse { from { background: var(--primary-soft); border-color: var(--primary); } to { background: var(--card-2); border-color: var(--border); } }
.cart-conso { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart label { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.cart .in-q { width: 75px; padding: .35rem .5rem; font-weight: 700; }
.cart .in-p { width: 95px; padding: .35rem .5rem; }
.cart-reste { min-width: 80px; text-align: right; }
.cart input:invalid { border-color: var(--danger); outline: 2px solid var(--danger-soft); }
tr.row-new td { animation: rownew 3s ease-out; }
@keyframes rownew { 0%, 40% { background: var(--primary-soft); } 100% { background: transparent; } }

/* ========================================================== Tableau de bord : divers */
.toolbar-sm { margin-bottom: .75rem; }
.toolbar-sm h2 { font-size: 1.15rem; }
a.kpi-link { color: inherit; text-decoration: none; transition: border-color .15s; }
a.kpi-link:hover { border-color: var(--primary); }

/* ========================================================== Graphique de consommation */
.conso-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.conso-head h2 { margin: 0; flex: 1; }
.conso-nav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.conso-nav .spacer { flex: 1; }
.conso-nav strong { min-width: 9ch; text-align: center; }
.conso-nav .icon-btn:disabled { opacity: .3; cursor: default; }
.conso-total { color: var(--muted); font-size: .92rem; }
.conso-total > span:first-child, #c-valeur { color: var(--text); font-weight: 700; }
.btn-ghost-p { border-color: transparent; background: transparent; color: var(--primary); }
.chart-box-sm { height: 260px; }
.conso-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin-top: 1rem; }
@media (max-width: 1400px) { .conso-detail { grid-template-columns: 1fr; } }
.conso-sub { text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; font-size: .75rem; }
.type-list, .top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.type-list li { display: grid; grid-template-columns: auto 90px 1fr auto 80px; align-items: center; gap: .55rem; }
.type-list .sq { width: .75rem; height: .75rem; border-radius: 3px; }
.type-list .t-bar { height: 7px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.type-list .t-bar span { display: block; height: 100%; border-radius: 999px; }
.type-list .t-val { text-align: right; }
.top-list li { display: flex; align-items: center; gap: .1rem; white-space: nowrap; overflow: hidden; }
.top-list .c-des { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.top-q { margin-left: .75rem; }

/* Correctifs v4.4 */
[hidden] { display: none !important; }
.quick-form .ac > label { display: block; }
.cart label { flex-direction: row; }

/* Zone de suppression groupée */
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: -.5rem; padding: .8rem 1rem; border: 1px dashed var(--danger-border); border-radius: 10px; }

/* ========================================================== Dépenses */
.page-intro { margin: -.75rem 0 1.25rem; }
.legend { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
.legend .sq, .type-list .sq { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; }
.bar-cell { display: inline-block; vertical-align: middle; width: 90px; height: 7px; border-radius: 999px; background: var(--hover); overflow: hidden; margin-right: .5rem; }
.bar-cell span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.type-list-lg li { grid-template-columns: auto 100px 1fr auto 70px; padding: .3rem 0; }
.dep-resume { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.6fr; gap: 1.5rem; }
.dep-resume > div { display: flex; flex-direction: column; gap: .25rem; }
.dep-resume strong { font-size: 1.3rem; }
.dep-big { font-size: 1.9rem !important; }
.dep-four strong { font-size: .95rem !important; margin-left: .3rem; }
@media (max-width: 1000px) { .dep-resume { grid-template-columns: 1fr 1fr; } }
