/* Dendro — interface compacte de gestion */
:root {
    --bg: #f5f5f4;
    --surface: #ffffff;
    --surface-2: #f7f7f6;
    --text: #24272b;
    --muted: #63696f;
    --faint: #737e8c;
    --border: #e1e3e4;
    --border-strong: #cfd4dc;
    --accent: #343d45;
    --accent-hover: #222a31;
    --accent-soft: #e9ecee;
    --sidebar: #eeefee;
    --sidebar-text: #555b60;
    --danger: #b42318;
    --warning-bg: #fff6e0;
    --warning-text: #8a5a00;
    --warning-line: #f0b429;
    --success-bg: #e6f4ea;
    --success-text: #1e6b3a;
    --error-bg: #fdecea;
    --error-text: #a01d12;
    --info-bg: #e8f0fb;
    --info-text: #1f4b8f;
    --radius: 4px;
    font-size: 13px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    /* Pas de substitutions typographiques : « 09x305x130 » doit rester tel qu'imprimé. */
    font-feature-settings: "calt" 0, "liga" 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; font-weight: 600; margin: 0; }
h2 { font-size: 12px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pre-line { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.strong { font-weight: 600; }

/* ============ structure : barre latérale + contenu ============ */
.app { display: grid; grid-template-columns: 180px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    background: var(--sidebar); color: var(--sidebar-text); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: block; padding: 14px 16px 12px; color: var(--text); font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand span { color: inherit; }
.nav { display: flex; flex-direction: column; padding: 4px 8px; gap: 1px; }
.nav a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; border-radius: 5px; color: var(--sidebar-text); font-weight: 500;
}
.nav a:hover { background: #e3e5e4; color: var(--text); text-decoration: none; }
.nav a.active { background: #dce0de; color: #202723; font-weight: 600; }
.nav .count { font-size: 11px; background: #d8dcda; color: var(--text); border-radius: 9px; padding: 0 7px; line-height: 17px; }
.nav .count.warn { background: var(--warning-line); color: #2a1d00; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 10px 12px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot select { width: 100%; height: 26px; background: #fff; color: var(--text); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 6px; font: inherit; }
.sidebar-foot .org { color: var(--text); font-weight: 600; }
.sidebar-foot .user { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.sidebar-foot form { margin: 0; }
.sidebar-foot .btn-link { color: var(--sidebar-text); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.pagebar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 48px;
    padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.pagebar .title { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.pagebar .back { color: var(--muted); font-size: 12px; }
.pagebar .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.pagebar .actions form { margin: 0; }
.content { padding: 12px 16px 24px; }
.content-flush { padding: 0; }

/* ============ boutons et champs ============ */
.btn {
    display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
    border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }

input[type="text"], input[type="password"], input[type="search"], input[type="email"], input[type="number"], input[type="date"], select, textarea {
    font: inherit; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong);
    border-radius: var(--radius); background: #fff; color: var(--text);
}
textarea { height: auto; padding: 6px 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 3px; font-weight: 500; font-size: 12px; }
.form small { font-weight: 400; color: var(--muted); }
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.form legend { font-weight: 600; font-size: 12px; padding: 0 4px; }

/* ============ pages hors connexion ============ */
body.simple { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 24px;  }
.card-narrow { width: 100%; max-width: 340px; }
.card h1 { margin-bottom: 12px; }
.brand-center { text-align: center; margin: 0 0 14px; font-weight: 700; font-size: 17px; }
.brand-center span { color: var(--accent); }

/* ============ messages ============ */
.alert { padding: 7px 10px; border-radius: var(--radius); margin-bottom: 10px; font-size: 12.5px; }
.alert ul { margin: 0; padding-left: 16px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }
.flashes { padding: 10px 16px 0; }
.flashes .alert { margin-bottom: 0; }
.error-text { color: var(--error-text); }
.warning-text { color: var(--warning-text); }

.badge { display: inline-block; padding: 0 7px; border-radius: 3px; font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.badge-en_attente { background: #eef0f3; color: var(--muted); }
.badge-en_cours { background: var(--info-bg); color: var(--info-text); }
.badge-a_valider { background: var(--warning-bg); color: var(--warning-text); }
.badge-valide { background: var(--success-bg); color: var(--success-text); }
.badge-erreur { background: var(--error-bg); color: var(--error-text); }
.badge-neutral { background: #eef0f3; color: var(--muted); }

/* ============ barre d'outils de liste ============ */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: 12px; border: 0; background: none; padding: 0 10px; height: 26px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg .n { color: var(--faint); margin-left: 3px; font-weight: 400; }
.toolbar input[type="search"] { width: 240px; height: 28px; }
.toolbar .spacer { margin-left: auto; }

/* ============ tableaux denses ============ */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 6px 9px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th {
    font-size: 11.5px; font-weight: 500; color: var(--muted);
    background: var(--surface-2); white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f5f7f9; }
.table tr.clickable { cursor: pointer; }
.table td .sub { display: block; font-size: 11.5px; color: var(--muted); }
.table .trunc { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: left; color: var(--muted); padding: 24px 16px; max-width: 760px; }
.empty strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }

/* ============ import de PDF ============ */
.drop-overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(29, 35, 48, .45); }
.drop-overlay.on { display: flex; }
.drop-overlay div { background: #fff; border: 2px dashed var(--accent); border-radius: 10px; padding: 28px 44px; font-size: 15px; font-weight: 600; color: var(--accent); }
.upload-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.upload-panel[hidden] { display: none; }
.upload-list { list-style: none; margin: 0; padding: 4px 0; }
.upload-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 10px; font-size: 12px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--muted); white-space: nowrap; }
.upload-ok .upload-state { color: var(--success-text); }
.upload-doublon .upload-state { color: var(--warning-text); }
.upload-refuse .upload-state { color: var(--error-text); }

.queue-banner { display: flex; align-items: center; gap: 8px; padding: 5px 10px; margin-bottom: 8px; border-radius: var(--radius); background: var(--info-bg); color: var(--info-text); font-size: 12px; }
.queue-banner[hidden] { display: none; }
.spinner { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ document : PDF à gauche, données à droite ============ */
.doc-view { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); height: calc(100vh - 48px); }
.doc-pdf { border-right: 1px solid var(--border); background: #525659; min-height: 0; }
.doc-pdf iframe { width: 100%; height: 100%; border: 0; display: block; }
.doc-data { overflow-y: auto; padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; }
.panel-head .right { margin-left: auto; }
.panel-body { padding: 8px 10px; }
.panel .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr) 92px minmax(0, 1fr); gap: 3px 10px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv .wide { grid-column: span 3; }
.totals { display: flex; gap: 20px; padding: 7px 10px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.totals div { display: flex; flex-direction: column; }
.totals span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.totals strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.totals .note { margin-left: auto; align-self: center; font-size: 11.5px; color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 8px; align-items: baseline; padding: 5px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.checks li:last-child { border-bottom: 0; }
.sev { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 0 5px; line-height: 16px; }
.sev-erreur { background: var(--error-bg); color: var(--error-text); }
.sev-attention { background: var(--warning-bg); color: var(--warning-text); }
.sev-info { background: var(--info-bg); color: var(--info-text); }
.ok-line { padding: 6px 10px; color: var(--success-text); font-size: 12.5px; }

.table-lines td { vertical-align: top; }
.table-lines .designation { font-weight: 500; }
.table-lines .meta { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.table-lines .flag { display: block; font-size: 11.5px; color: var(--warning-text); margin-top: 2px; }
.row-warning td { background: #fffbf0; }
.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--warning-line); }
.cat { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #eef0f3; border-radius: 4px; padding: 0 5px; line-height: 16px; }
.remarks { font-size: 12.5px; margin: 0; }
.foot-note { font-size: 11.5px; color: var(--faint); }

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar .brand { padding: 10px 12px; }
    .nav { flex-direction: row; padding: 4px; }
    .sidebar-foot { margin: 0 0 0 auto; border: 0; flex-direction: row; align-items: center; padding: 6px 12px; }
    .doc-view { grid-template-columns: 1fr; height: auto; }
    .doc-pdf iframe { height: 60vh; }
    .kv { grid-template-columns: 90px minmax(0, 1fr); }
    .kv .wide { grid-column: auto; }
    .hide-sm { display: none; }
    .toolbar input[type="search"] { width: 100%; }
}


/* ============ validation (formulaire compact) ============ */
@media (min-width: 901px) {
    .doc-view.doc-edit, .doc-view { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
}
.validation-form { display: flex; flex-direction: column; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
.form-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 500; }
.form-grid input, .form-grid select { height: 26px; font-size: 12.5px; color: var(--text); width: 100%; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span4 { grid-column: span 4; }
.totals.form-grid { display: grid; }
.new-supplier { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; background: var(--warning-bg); border-radius: var(--radius); }
.new-supplier input { height: 24px; flex: 1; min-width: 140px; }
.new-supplier .w-tva { flex: 0 0 130px; min-width: 0; }
.success-text { color: var(--success-text); }

.table-edit th, .table-edit td { padding: 3px 4px; vertical-align: top; }
.table-edit tbody.line { border-bottom: 1px solid var(--border); }
.table-edit tbody.line td { border-bottom: 0; }
.table-edit tbody.line:hover td { background: #f7f9fb; }
.table-edit input, .table-edit select, .table-edit textarea { height: 24px; font-size: 12px; padding: 0 5px; width: 100%; border-color: var(--border); background: transparent; }
.table-edit input:hover, .table-edit select:hover, .table-edit textarea:hover { border-color: var(--border-strong); background: #fff; }
.table-edit textarea { resize: none; padding: 3px 5px; line-height: 16px; min-height: 24px; overflow: hidden; }
.table-edit .pos { width: 22px; padding-top: 7px; }
.table-edit .in-cat { width: 84px; }
.table-edit .in-unit { width: 58px; }
.table-edit .in-num { width: 68px; text-align: right; font-variant-numeric: tabular-nums; }
.table-edit .w-desig { min-width: 180px; }
.table-edit .calc { padding-top: 7px; color: var(--muted); }
.table-edit .tools { padding-top: 3px; }
.table-edit .flag { display: block; font-size: 11px; color: var(--warning-text); margin: 1px 0 0 5px; }
.table-edit tbody.row-warning td { background: #fffbf0; }
.table-edit tbody.row-warning .line-main td:first-child { box-shadow: inset 3px 0 0 var(--warning-line); }
.table-edit tbody.deleted td { opacity: .35; text-decoration: line-through; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); font-size: 12px; }
.icon-btn:hover { border-color: var(--border-strong); background: #fff; color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.details-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; padding: 4px 0 6px; }
.details-grid label { display: flex; flex-direction: column; font-size: 10.5px; color: var(--muted); gap: 1px; }
.details-grid input { background: #fff; border-color: var(--border-strong); }

.savebar {
    position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; align-items: center; gap: 8px;
    padding: 8px 10px; margin: 0 -14px -20px; background: rgba(255,255,255,.96); border-top: 1px solid var(--border);
}
.savebar [data-dirty-note] { margin-right: auto; color: var(--warning-text); }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 32px; z-index: 20; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(16,24,40,.12); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.menu-pop form { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.menu-pop select { height: 26px; }

@media (max-width: 900px) {
    .form-grid, .details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid .span4 { grid-column: span 2; }
}

.fiche { display: flex; align-items: center; gap: 6px; margin: 2px 0 0 5px; }
.fiche-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.table-edit .in-fiche { height: 22px; font-size: 11.5px; width: auto; flex: 1; min-width: 220px; max-width: 360px; color: var(--muted); }

/* ============ fiches produits ============ */
.product-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; align-items: start; }
.stat-row { display: flex; border-bottom: 1px solid var(--border); }
.stat { flex: 1; padding: 8px 12px; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.stat:last-child { border-right: 0; }
.stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 11px; color: var(--faint); }
.chart-box { position: relative; height: 230px; padding: 8px 10px 6px; }
.honest { margin: 0; padding: 14px 12px; color: var(--muted); font-size: 12.5px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid textarea { font-size: 12.5px; width: 100%; }
.section-gap { margin-top: 10px; }
.nature { font-size: 11px; font-weight: 600; white-space: nowrap; }
.nature::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.nature-paye::before { background: #2a78d6; }
.nature-propose::before { background: #eb6834; }
.nature-commande::before { background: #1baf7a; }
@media (max-width: 900px) { .product-grid { grid-template-columns: 1fr; } .stat-row { flex-wrap: wrap; } }

/* ============ recherche ============ */
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filters input, .filters select { height: 26px; font-size: 12px; }
.filters .f-text { width: 230px; }
.filters .f-small { width: 110px; }
.filters .f-dim { width: 72px; }
.filters .f-date, .filters .f-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.filters .f-date input { width: 128px; }
.table th.sortable a { color: inherit; text-decoration: none; }
.table th.sorted { color: var(--text); }
.table-search td { font-size: 12.5px; }
.table-search .cell-prod { max-width: 340px; }
.trunc-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.checks li.dup { align-items: center; }
.checks .grow { flex: 1; min-width: 0; }
.checks form { display: flex; gap: 4px; margin: 0; }

/* ============ comparer / fournisseurs ============ */
.inline-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.inline-form select, .inline-form input { height: 26px; font-size: 12px; }
.swatch { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.row-best td { background: #f2f9f5; }
.chart-tall { height: 280px; }
.in-qty { width: 80px; text-align: right; }
.in-num { width: 80px; text-align: right; }
.w-name { width: 220px; }

/* ============ administration ============ */
.admin-tabs a { display: inline-flex; align-items: center; font-size: 12px; padding: 0 10px; height: 26px; color: var(--muted); border-right: 1px solid var(--border); }
.admin-tabs a:last-child { border-right: 0; }
.admin-tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.admin-tabs a:hover { text-decoration: none; color: var(--text); }
.seg a { display: inline-flex; align-items: center; font-size: 12px; padding: 0 10px; height: 26px; color: var(--muted); border-right: 1px solid var(--border); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.small-strong { font-size: 12.5px !important; }
.w-pass { width: 150px; }
details.ctx summary { cursor: pointer; color: var(--muted); font-size: 11px; }
details.ctx pre { margin: 4px 0 0; padding: 6px; background: var(--surface-2); border-radius: 4px; font-size: 11px; max-width: 700px; overflow: auto; }
code { font-size: 11.5px; background: var(--surface-2); padding: 0 4px; border-radius: 3px; }
.nav .nav-admin { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; border-radius: 0 0 5px 5px; }
.sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.kv-simple { display: grid; grid-template-columns: 160px 1fr; gap: 3px 10px; margin: 0; }
.kv-simple dt { color: var(--muted); }
.kv-simple dd { margin: 0; }
.model-pick { display: inline-flex; align-items: center; gap: 6px; }
.model-pick select { height: 28px; font-size: 12px; max-width: 280px; }
.stat-wide { flex: 2; }
.stat-wide select { height: 24px; font-size: 12px; margin: 2px 0; max-width: 100%; }

/* Repères visuels sobres, sans augmenter la hauteur des lignes de données. */
.sidebar .brand { padding-top: 18px; padding-bottom: 18px; font-size: 19px; }
.pagebar .title > .muted { font-size: 12px; font-variant-numeric: tabular-nums; }
.panel-head { background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.panel-head h2 { color: var(--text); }
.table th { color: #545c62; background: #f1f2f2; padding-top: 7px; padding-bottom: 7px; }
.table tbody tr:focus-within td { background: #eef0f2; }
.table .row-warning:hover td, .table tbody.row-warning:hover td { background: #fff4d6; }
.table .row-best:hover td { background: #e6f3eb; }
.seg .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.seg .on .n { color: var(--accent); }
.seg button.on, .seg a.on { background: #e5e8e9; color: #24272b; }
:where(a, button, summary, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sidebar :focus-visible { outline-color: var(--accent); }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 12px; background: #fff; border: 2px solid var(--accent); border-radius: var(--radius); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.filter-summary { margin: 7px 0 0; color: var(--muted); font-size: 11.5px; }
.filter-empty { padding: 24px 12px; border-top: 1px solid var(--border); text-align: left; color: var(--muted); }
.filter-empty p { margin: 0 0 8px; }
.totals { flex-wrap: wrap; gap: 8px 20px; }
@media (max-width: 900px) {
    .sidebar { min-width: 0; }
    .sidebar .brand { padding: 10px 12px; font-size: 17px; }
    .nav { order: 3; width: 100%; overflow-x: auto; padding: 4px 8px 8px; gap: 3px; }
    .nav a { flex: 0 0 auto; gap: 6px; white-space: nowrap; }
    .nav .nav-admin { margin-top: 0; border-top: 0; padding-top: 8px; border-radius: 5px; }
    .sidebar-foot { max-width: 100%; flex-wrap: wrap; }
    .doc-data { overflow-y: visible; }
    .seg { max-width: 100%; overflow-x: auto; flex-shrink: 0; }
    .seg button, .seg a { flex-shrink: 0; white-space: nowrap; }
}
@media (max-width: 600px) {
    .content { padding: 10px 10px 20px; }
    .pagebar { padding: 8px 10px; position: static; }
    .pagebar .actions { margin-left: 0; width: 100%; }
    .btn { min-height: 32px; }
    .seg button, .seg a { min-height: 32px; }
    .filters > input, .filters > select { max-width: 100%; }
    .model-pick { min-width: 0; flex-wrap: wrap; }
    .model-pick select { max-width: 100%; }
    .savebar { flex-wrap: wrap; }
    .kv-simple { grid-template-columns: 110px minmax(0, 1fr); }
    .kv-simple dd { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Mise en page des outils : largeur utile et formulaires alignés. */
.panel, .product-grid > * { min-width: 0; }
.panel-head { flex-wrap: wrap; min-height: 34px; }
.panel-head form, td form { margin: 0; }
h1 { overflow-wrap: anywhere; }
.table a { color: #34536b; }
.table th.sortable a { color: inherit; }
.table th.num { font-variant-numeric: tabular-nums; }
.inline-form input, .inline-form select { max-width: 100%; min-width: 0; }
.inline-form select[name="produit_b"] { flex: 1; width: 220px; }
.panel > .foot-note { padding: 0 10px 8px; }
.admin-overview { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-defaults { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-defaults .stat { gap: 3px; }
.admin-defaults select { width: 100%; max-width: 100%; }
.admin-consumption { grid-column: 1 / -1; }
.admin-consumption .table td { white-space: nowrap; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.form-row > label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); flex: 1 1 140px; min-width: 0; }
.form-row input, .form-row select { width: 100%; }
.group-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(160px, .65fr) auto; }
.group-form > label { min-width: 0; }
.group-form select, .group-form input { width: 100%; }
.user-actions { min-width: 350px; gap: 5px; }
.user-actions .w-pass { width: 140px; }
.journal-table { table-layout: fixed; }
.journal-table th:nth-child(1) { width: 150px; }
.journal-table th:nth-child(2), .journal-table th:nth-child(3) { width: 100px; }
.journal-table th:last-child { width: 120px; }
.journal-table td { vertical-align: top; overflow-wrap: anywhere; }
.journal-table details.ctx pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-data { min-width: 0; }
.doc-data .panel { flex-shrink: 0; }
.table-edit .w-desig { min-width: 230px; }
.table-edit .in-fiche { min-width: 140px; max-width: 260px; }
.table-edit .line-details td { background: var(--surface-2); }
.card-narrow { max-width: 380px; }
.brand-center { text-align: left; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.simple .form input { min-height: 32px; }
.simple .card { margin: auto; }
@media (min-width: 901px) {
    .main:has(.doc-view), .main:has(.chat-view) { height: 100dvh; overflow: hidden; }
    .main:has(.doc-view) > .content-flush, .main:has(.chat-view) > .content-flush { flex: 1; min-height: 0; }
    .doc-view, .chat-view { height: 100%; }
    .pagebar { flex-shrink: 0; }
}
@media (max-width: 1100px) {
    .group-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sidebar-foot .user { flex-wrap: wrap; }
    .admin-grid { grid-template-columns: 1fr; }
    .journal-table { min-width: 740px; }
    .menu-pop { right: auto; left: 0; max-width: calc(100vw - 24px); min-width: 220px; }
    .menu-pop select { width: 100%; }
}
@media (max-width: 600px) {
    .sidebar-foot { padding: 6px 10px; font-size: 11px; }
    .sidebar-foot .user { font-size: 11px; }
    .admin-defaults, .group-form { grid-template-columns: 1fr; }
    .admin-overview .stat { padding: 8px 6px; }
    .admin-overview .stat span { font-size: 10px; letter-spacing: 0; }
    .admin-overview .stat em { display: none; }
    .checks li { flex-wrap: wrap; }
    .checks .grow { flex-basis: 65%; overflow-wrap: anywhere; }
    .checks form { margin-left: auto; }
    .panel-head .right { max-width: 100%; }
    .filters > input, .filters > select { flex: 1 1 140px; min-width: 0; }
    .filters .f-dim { flex-basis: 80px; }
    .stat { flex-basis: 45%; }
    .doc-pdf iframe { height: 45vh; }
    .doc-data { padding: 10px 10px 20px; }
    .savebar { margin-left: -10px; margin-right: -10px; }
}

.product-detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); grid-template-areas: "prices fiche" "tiers fiche" "equivalents fiche"; gap: 10px; align-items: start; }
.product-prices { grid-area: prices; }
.product-form { grid-area: fiche; }
.product-tiers { grid-area: tiers; }
.product-equivalents { grid-area: equivalents; }
.form-row-title { flex-basis: 100%; font-size: 12px; }
.table-search .cell-prod { min-width: 260px; }
.table-search .cell-prod .sub { -webkit-line-clamp: 1; }
.fiche[hidden] { display: none; }
@media (max-width: 900px) {
    .product-detail-grid { grid-template-columns: 1fr; grid-template-areas: "prices" "fiche" "tiers" "equivalents"; }
}

/* ============ questions : fenêtre de discussion ============ */
.cw { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; background: var(--surface); position: relative; overflow: hidden; }
/* Historique : tiroir discret, fermé par défaut, qui s'ouvre par-dessus la discussion. */
.cw-side { position: absolute; inset: 0 auto 0 0; width: min(300px, 85vw); z-index: 20; display: flex; flex-direction: column; min-height: 0;
    background: var(--surface); border-right: 1px solid var(--border); box-shadow: 6px 0 24px rgba(20, 24, 28, .10);
    transform: translateX(-102%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; }
.cw.side-open .cw-side { transform: none; visibility: visible; transition: transform .18s ease; }
.cw-backdrop { display: none; }
.cw.side-open .cw-backdrop { display: block; position: absolute; inset: 0; z-index: 10; background: rgba(20, 24, 28, .12); }
.cw-side-head { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 6px; }
.cw-side-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); }
.cw-close { border: 0; background: none; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.cw-close:hover { color: var(--text); background: var(--surface-2); }
.cw-search { height: 28px; width: 100%; font-size: 12px; background: var(--surface-2); border-color: var(--border); }
.cw-list { flex: 1; overflow-y: auto; padding: 0 6px 10px; }
.cw-list-empty { color: var(--faint); font-size: 12px; padding: 8px 6px; margin: 0; }
.cw-group-title { font-size: 10.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin: 10px 6px 2px; }
.cw-conv { display: flex; align-items: baseline; gap: 8px; padding: 5px 6px; border-radius: 5px; color: var(--muted); font-size: 12.5px; }
.cw-conv:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.cw-conv.active { background: var(--accent-soft); color: var(--text); }
.cw-conv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-conv-date { flex: none; font-size: 10.5px; color: var(--faint); }
.cw-ghost { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: none;
    color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.cw-ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); text-decoration: none; }
.cw-ghost svg { flex: none; }

.cw-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fbfbfa; }
.cw-head { display: flex; align-items: center; gap: 10px; padding: 10px 18px; min-height: 58px; border-bottom: 1px solid var(--border); background: var(--surface); }
.cw-head-text { display: flex; flex-direction: column; min-width: 0; }
.cw-head h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-status { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.cw-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2f9e62; }
.cw-head-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.cw-head-actions form { display: inline; }
.cw-ghost-danger:hover { color: var(--error-text); background: var(--error-bg); border-color: transparent; }

.cw-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.cw-avatar-lg { width: 36px; height: 36px; font-size: 15px; }
.cw-avatar-xl { width: 56px; height: 56px; font-size: 24px; margin: 0 auto 14px; }

.cw-thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.cw-inner { max-width: 820px; margin: 0 auto; padding: 22px 20px 12px; display: flex; flex-direction: column; gap: 16px; }
.cw-msg { display: flex; gap: 10px; animation: cw-in .18s ease-out; }
@keyframes cw-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cw-me { flex-direction: column; align-items: flex-end; }
.cw-me .cw-bubble { background: var(--accent); color: #fff; border-radius: 18px 18px 4px 18px; padding: 9px 14px; max-width: min(560px, 85%); font-size: 13.5px; line-height: 1.45; }
.cw-ai .cw-body { min-width: 0; flex: 1; }
.cw-ai .cw-bubble { background: #fff; border: 1px solid var(--border); border-radius: 4px 18px 18px 18px; padding: 11px 15px; font-size: 13.5px; line-height: 1.5; box-shadow: 0 1px 2px rgba(20, 24, 28, .04); overflow-wrap: anywhere; }
.cw-error .cw-bubble { background: var(--error-bg); color: var(--error-text); border-color: transparent; }
.cw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; padding: 0 4px; font-size: 11px; color: var(--faint); }
.cw-details { color: var(--faint); }
.cw-action { font: inherit; font-size: 11px; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; }
.cw-action:hover { color: var(--text); text-decoration: underline; }

.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md .md-h { font-weight: 600; margin-top: 10px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md .md-table { overflow-x: auto; margin: 6px 0 10px; border: 1px solid var(--border); border-radius: 8px; }
.md .table th, .md .table td { padding: 5px 9px; font-size: 12.5px; }
.md .table tr:last-child td { border-bottom: 0; }
.md a { font-weight: 500; }

.cw-typing .cw-bubble { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.cw-dots { display: inline-flex; gap: 4px; }
.cw-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: cw-dot 1.2s infinite ease-in-out; }
.cw-dots i:nth-child(2) { animation-delay: .15s; }
.cw-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes cw-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.cw-welcome { text-align: center; margin: 7vh auto 0; max-width: 620px; }
.cw-welcome h2 { font-size: 20px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.cw-welcome p { color: var(--muted); margin: 0 0 22px; }
.cw-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.cw-card { font: inherit; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s; }
.cw-card:hover { border-color: var(--border-strong); box-shadow: 0 2px 8px rgba(20, 24, 28, .07); }
.cw-card-tag { font-size: 11px; font-weight: 600; color: var(--muted); }

.cw-composer { padding: 8px 20px 16px; background: linear-gradient(to bottom, rgba(251, 251, 250, 0), #fbfbfa 30%); }
.cw-box { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid var(--border-strong); border-radius: 16px; padding: 10px 10px 8px 14px; box-shadow: 0 2px 10px rgba(20, 24, 28, .06); }
.cw-box:focus-within { border-color: var(--accent); }
.cw-box textarea { width: 100%; border: 0; outline: 0; resize: none; padding: 2px 0; min-height: 24px; max-height: 180px; font-size: 14px; line-height: 1.45; background: transparent; }
.cw-box textarea:focus { outline: 0; border: 0; }
.cw-box-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cw-model { width: auto; height: 28px; font-size: 12px; border-radius: 14px; padding: 0 8px; max-width: 200px; background: var(--surface-2); }
.cw-hint { font-size: 11px; color: var(--faint); margin-left: auto; }
.cw-send { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cw-send:hover { background: var(--accent-hover); }
.cw-send:disabled { background: #c9cdd0; cursor: default; }

@media (max-width: 900px) {
    .app:has(.cw) { height: 100dvh; }
    .main:has(.cw) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
    .main:has(.cw) > .content-flush { flex: 1; min-height: 0; }
    .cw-head { padding: 8px 12px; }
    .cw-status { display: none; }
    .cw-head .cw-avatar-lg { display: none; }
    .cw-ghost .lbl { display: none; }
    .cw-hint { display: none; }
    .cw-inner { padding: 14px 12px 8px; }
    .cw-composer { padding: 6px 10px 10px; }
    .cw-cards { grid-template-columns: 1fr; }
    .cw-me .cw-bubble { max-width: 90%; }
}
.cw-conv[hidden], .cw-group[hidden] { display: none; }
@media (max-width: 900px) { .cw-send { margin-left: auto; } }

/* Administration › Paramètres */
.settings-web { display: flex; flex-direction: column; gap: 10px; }
.settings-note { margin: 0; max-width: 820px; }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.settings-inline { display: inline-flex; align-items: center; gap: 6px; }
.settings-inline select { height: 26px; width: auto; }
.settings-web .table-wrap { max-width: 720px; }
.w-check { width: 70px; text-align: center; }
.settings-actions { display: flex; justify-content: flex-start; }

/* Chat : interrupteurs d'options et liens externes */
.cw-options { max-width: 820px; margin: 0 auto 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.cw-switch { font: inherit; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 8px; border: 1px solid var(--border-strong); border-radius: 15px; background: #fff; color: var(--muted); font-size: 12px; cursor: pointer; }
.cw-switch:hover { border-color: #aeb5bd; }
.cw-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cw-track { position: relative; flex: none; width: 28px; height: 16px; border-radius: 8px; background: #c3c8cd; transition: background .15s; }
.cw-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.cw-switch-label { color: var(--text); font-weight: 500; }
.cw-state { font-weight: 600; color: var(--faint); min-width: 62px; }
.cw-switch[aria-checked="true"] { border-color: #8fcfae; background: #eef9f3; }
.cw-switch[aria-checked="true"] .cw-track { background: #1f9d5c; }
.cw-switch[aria-checked="true"] .cw-track::after { transform: translateX(12px); }
.cw-switch[aria-checked="true"] .cw-state { color: #16794a; }
.cw-switch-web[aria-checked="true"] { border-color: #8ab8ea; background: #eaf3fd; }
.cw-switch-web[aria-checked="true"] .cw-track { background: #2a78d6; }
.cw-switch-web[aria-checked="true"] .cw-state { color: #1d5fa8; }
.cw-web-notice { max-width: 820px; margin: 0 auto 6px; padding: 6px 10px; border-radius: 8px; background: #eaf3fd; color: #1d5fa8; font-size: 12px; }
.cw-web-notice[hidden] { display: none; }
.cw-composer.web-on .cw-box { border-color: #2a78d6; box-shadow: 0 0 0 3px rgba(42, 120, 214, .12); }
.cw-tag { font-size: 11px; color: #1d5fa8; }
.md a.ext::after { content: " ↗"; font-size: 11px; }
@media (max-width: 600px) {
    .cw-state { min-width: 0; }
    .cw-switch { padding: 0 9px 0 6px; }
}
.settings-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.settings-option { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.settings-option p { margin: 0; }
@media (max-width: 900px) { .settings-options { grid-template-columns: 1fr; } }
.supplier-contact a { display: block; line-height: 1.45; overflow-wrap: anywhere; }

/* Tous les tableaux : les titres de colonnes restent visibles pendant le défilement. */
.table thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; }
.table-wrap { max-height: 75dvh; overflow: auto; }
/* Pages « liste » (documents, produits, recherche, fournisseurs, journal) : le tableau occupe la hauteur de l'écran. */
@media (min-width: 901px) {
    .main:has(.table-page) { height: 100dvh; overflow: hidden; }
    .main:has(.table-page) > .content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 12px; }
    .main:has(.table-page) > .content > * { flex-shrink: 0; }
    .main:has(.table-page) > .content > .table-wrap:has(.table-page) { flex: 0 1 auto; min-height: 0; max-height: none; }
}
.cell-prod .condition { display: block; font-size: 11px; color: #8a5a00; }

/* Chat : sur grand écran, l'historique déplié est une colonne fixe, sans voile. */
@media (min-width: 901px) {
    .cw.side-open { grid-template-columns: 250px minmax(0, 1fr); }
    .cw.side-open .cw-side { position: static; width: auto; transform: none; visibility: visible; box-shadow: none; transition: none; background: var(--surface-2); }
    .cw.side-open .cw-backdrop { display: none; }
    .cw.side-open .cw-conv.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
    .cw.side-open .cw-search { background: var(--surface); }
}

/* Paramètres : une option coupée pour tous grise sa colonne (les cases gardent leur valeur pour la réactivation). */
.options-table .col-off { display: none; font-size: 10px; font-weight: 400; color: var(--faint); }
.options-table.off-savoir .col-savoir, .options-table.off-web .col-web { background: #f1f2f2; }
.options-table.off-savoir td.col-savoir input, .options-table.off-web td.col-web input { opacity: .35; pointer-events: none; }
.options-table.off-savoir th.col-savoir, .options-table.off-web th.col-web { color: var(--faint); }
.options-table.off-savoir th.col-savoir .col-off, .options-table.off-web th.col-web .col-off { display: block; color: var(--error-text); }
.options-table .col-always { text-align: center; }
.options-table .always { font-size: 11px; color: #16794a; font-weight: 500; }

/* Menu : icône + libellé (+ compteur à droite). */
.nav a { justify-content: flex-start; gap: 9px; }
.nav .nav-ico { flex: none; color: var(--faint); transition: color .12s; }
.nav a:hover .nav-ico, .nav a.active .nav-ico { color: var(--text); }
.nav .nav-lbl { flex: 1; min-width: 0; }
.nav .count { margin-left: auto; }
@media (max-width: 900px) { .nav a { gap: 6px; } .nav .nav-lbl { flex: none; } }

/* Aperçu d'une fiche produit au survol */
.pcard { position: fixed; z-index: 50; width: 320px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 8px; box-shadow: 0 8px 28px rgba(20, 24, 28, .16); padding: 10px 12px; font-size: 12px; color: var(--text); }
.pcard[hidden] { display: none; }
.pcard-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.pcard-head strong { font-size: 13px; line-height: 1.3; }
.pcard-sup { color: var(--muted); font-size: 11.5px; }
.pcard-specs { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 6px; }
.pcard-specs dt { color: var(--faint); }
.pcard-specs dd { margin: 0; font-variant-numeric: tabular-nums; }
.pcard-price { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.pcard-big { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pcard-desig { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; max-height: 4.2em; overflow: hidden; }
.pcard-empty { margin: 0; color: var(--muted); }
.pcard-foot { margin: 6px 0 0; padding-top: 5px; border-top: 1px solid var(--border); color: var(--faint); font-size: 10.5px; }
[data-product-card] { text-decoration: underline dotted rgba(52, 61, 69, .35); text-underline-offset: 3px; }

/* ============ accueil hors connexion ============ */
body.landing { margin: 0; min-height: 100vh; background: var(--surface-2); }
.lp { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); min-height: 100vh; }
.lp-hero { position: relative; overflow: hidden; background: #2b3339; color: #e9edef; display: flex; align-items: center; padding: 48px 56px; }
/* Veinage de bois discret en fond */
.lp-hero::before { content: ""; position: absolute; inset: 0; opacity: .07; pointer-events: none;
    background: repeating-radial-gradient(ellipse 140% 60% at 10% 110%, transparent 0 14px, #fff 14px 15px); }
.lp-hero-inner { position: relative; max-width: 520px; }
.lp-brand { margin: 0 0 40px; font-size: 22px; font-weight: 700; letter-spacing: .02em; color: #fff; }
.lp-brand span { color: #c9a26b; }
.lp-hero h1 { margin: 0 0 14px; font-size: 34px; line-height: 1.15; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.lp-lead { margin: 0 0 30px; font-size: 15px; line-height: 1.55; color: #c3cbd0; }
.lp-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.lp-features li { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: #aeb8be; }
.lp-features strong { display: block; color: #fff; font-size: 13.5px; font-weight: 600; margin-bottom: 1px; }
.lp-ico { flex: none; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .08); color: #c9a26b; }
.lp-foot { margin: 36px 0 0; font-size: 11.5px; color: #8b979e; letter-spacing: .02em; }

.lp-side { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.lp-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 30px 28px 24px; box-shadow: 0 10px 30px rgba(20, 24, 28, .07); }
.lp-card h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--text); }
.lp-sub { margin: 4px 0 20px; color: var(--muted); font-size: 13px; }
.lp-brand-mobile { display: none; }
.lp-form { display: flex; flex-direction: column; }
.lp-form > label:not(.lp-check) { font-size: 12px; font-weight: 600; color: var(--text); margin: 0 0 5px; }
.lp-form input[type=text], .lp-form input[type=password] { height: 40px; font-size: 14px; padding: 0 12px; border-radius: 8px; margin-bottom: 14px; width: 100%; }
.lp-pass { position: relative; }
.lp-pass input { padding-right: 44px !important; }
.lp-eye { position: absolute; right: 4px; top: 4px; width: 34px; height: 32px; border: 0; background: none; border-radius: 6px; color: var(--faint); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lp-eye:hover { color: var(--text); background: var(--surface-2); }
.lp-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lp-eye .eye-closed { display: none; }
.lp-eye[aria-pressed="true"] .eye-open { display: none; }
.lp-eye[aria-pressed="true"] .eye-closed { display: block; }
.lp-check { display: flex; align-items: center; gap: 8px; margin: 2px 0 18px; font-size: 13px; color: var(--text); cursor: pointer; }
.lp-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.lp-check span { color: var(--faint); font-size: 11.5px; }
.lp-submit { height: 42px; font-size: 14px; border-radius: 8px; justify-content: center; }
.lp-help { margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--faint); }
.lp-card .alert { margin-bottom: 14px; }

@media (max-width: 900px) {
    .lp { grid-template-columns: 1fr; }
    .lp-hero { padding: 28px 22px 26px; }
    .lp-brand { margin-bottom: 18px; }
    .lp-hero h1 { font-size: 24px; }
    .lp-lead { margin-bottom: 18px; font-size: 14px; }
    .lp-features { gap: 12px; }
    .lp-foot { display: none; }
    .lp-side { padding: 22px 16px 36px; align-items: flex-start; }
}
@media (max-width: 600px) {
    .lp-features li:nth-child(n+3) { display: none; }
}

/* Administration › fiche d'un compte */
.user-edit { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 10px; align-items: start; }
.user-form { display: flex; flex-direction: column; gap: 10px; }
.user-form > label:not(.f-check), .user-form label > .lp-pass { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.user-form input[type=text], .user-form input[type=password], .user-form select { height: 32px; max-width: 360px; width: 100%; }
.user-form .lp-pass { position: relative; max-width: 360px; }
.user-form .lp-eye { top: 0; height: 32px; }
.user-form .hint, .user-edit .hint { font-size: 11px; color: var(--faint); margin: 0; }
.user-orgs { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.user-orgs legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.user-active { display: flex; align-items: center; gap: 6px; }
.user-actions-bar { display: flex; gap: 6px; }
@media (max-width: 900px) { .user-edit { grid-template-columns: 1fr; } }
