/* AXSYSTEM : thème sombre par défaut, thème clair via [data-theme="light"] */

:root {
    --bg: #0b1220;
    --surface: #121c2e;
    --surface-2: #18253b;
    --line: #22324d;
    --line-strong: #2f4466;
    --text: #e6f0fa;
    --text-2: #8fa3bf;
    --accent: #5cc8f5;
    --accent-strong: #8fdcff;
    --accent-soft: #0e3a52;
    --on-accent: #06121f;
    --ok: #4ade80;   --ok-soft: #0f3a24;
    --warn: #fbbf24; --warn-soft: #3d2e0a;
    --bad: #f87171;  --bad-soft: #3f1616;
    --radius: 12px;
    --radius-sm: 8px;
    --tap: 44px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f3f7fb;
    --surface: #ffffff;
    --surface-2: #eef4fa;
    --line: #d6e2ee;
    --line-strong: #b9cbdd;
    --text: #0f1b2d;
    --text-2: #5a6b82;
    --accent: #0a84c6;
    --accent-strong: #06679b;
    --accent-soft: #dbeffa;
    --on-accent: #ffffff;
    --ok: #15803d;   --ok-soft: #dcfce7;
    --warn: #b45309; --warn-soft: #fef3c7;
    --bad: #b91c1c;  --bad-soft: #fee2e2;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 16px; margin-bottom: 12px; }
p { margin: 0 0 10px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.inline { display: inline; margin: 0; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .icon--light, [data-theme="light"] .icon--dark { display: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────────── Boutons ───────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); padding: 0 16px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn--danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: progress; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ───────────── Formulaires ───────────── */
.form { display: flex; flex-direction: column; gap: 14px; }
.form--narrow { max-width: 420px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--text-2); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select, textarea {
    width: 100%; min-height: var(--tap); padding: 10px 12px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text);
    font: inherit; font-size: 16px; /* 16px : pas de zoom automatique sur iPhone */
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.password { position: relative; display: block; }
.password input { padding-right: 48px; }
.password__toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.input-code { letter-spacing: 8px; font-size: 22px !important; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ───────────── Messages ───────────── */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; }
.alert .icon { margin-top: 1px; }
.alert--success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.alert--error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.alert--info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.alert--warning { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert span { color: var(--text); }

/* ───────────── Pages invité (connexion…) ───────────── */
.guest__main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.guest__brand img { display: block; width: 110px; height: 110px; object-fit: contain; border-radius: 20px; margin-bottom: 18px; }
.guest__card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px 20px; }
.guest__title { font-size: 20px; margin-bottom: 16px; text-align: center; }
.guest__links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 18px; font-size: 14px; }
.guest__links a { display: inline-flex; align-items: center; gap: 6px; }
.guest__links .icon { width: 16px; height: 16px; }
.guest__foot { margin-top: 20px; font-size: 12px; color: var(--text-2); }
.theme-toggle--corner { position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.steps li { margin-bottom: 4px; }

.pending { text-align: center; }
.pending__icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); display: flex; align-items: center; justify-content: center; }
.pending__icon .icon { width: 32px; height: 32px; }
.stack-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.stack-actions form { margin: 0; }
.stack-actions .btn { width: 100%; }

.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.choice span { flex: 1; }
.choice .icon { color: var(--accent); }
.choice:hover, .choice.is-current { border-color: var(--accent); }
.choice__check { color: var(--ok) !important; }

.error-page { text-align: center; }
.error-page__code { font-size: 44px; font-weight: 800; color: var(--accent); margin: 0; }
.error-page h1 { margin-bottom: 8px; }

/* ───────────── Application connectée ───────────── */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 12px; padding-top: env(safe-area-inset-top);
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; letter-spacing: .5px; }
.topbar__brand img { border-radius: 8px; }
.topbar__brand span { display: none; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 45vw; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .icon { width: 16px; height: 16px; }
.chip--link:hover { color: var(--accent-strong); }

.shell { display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--text-2); font-size: 11px; font-weight: 600; }
.tab .icon { width: 22px; height: 22px; }
.tab.is-active { color: var(--accent); }

@media (min-width: 900px) {
    .topbar__brand span { display: inline; }
    .tabbar { display: none; }
    .sidebar {
        display: flex; flex-direction: column; gap: 2px;
        position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
        width: 240px; flex: none; padding: 16px 12px;
        border-right: 1px solid var(--line); background: var(--surface);
    }
    .main { padding: 24px 32px 40px; }
}
.side-title { margin: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-2); }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: 14px; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.is-active { background: var(--accent-soft); color: var(--accent); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin: 2px 0 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }

/* Accueil */
.scan-cta { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 12px; border-radius: 16px; background: var(--accent); color: var(--on-accent); }
.scan-cta:hover { background: var(--accent-strong); color: var(--on-accent); }
button.scan-cta { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; }
.scan-cta__icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.scan-cta__icon .icon { width: 30px; height: 30px; }
.scan-cta strong { display: block; font-size: 18px; }
.scan-cta small { opacity: .85; }
.scan-cta__arrow { margin-left: auto; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.quick__item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600; text-align: center; }
.quick__item .icon { width: 26px; height: 26px; color: var(--accent); }
.quick__item:hover { border-color: var(--accent); color: var(--text); }

/* Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list li form { margin: 0; }
.list__row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; color: var(--text); width: 100%; }
.list__row:hover { color: var(--text); }
.list__row--button { border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.list__main { flex: 1; font-weight: 600; min-width: 0; }
.list__main small { display: block; font-weight: 400; color: var(--text-2); font-size: 13px; }
.list__arrow { color: var(--text-2); }
.dot { width: 36px; height: 36px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.dot--warn { background: var(--warn-soft); color: var(--warn); }
.dot--bad { background: var(--bad-soft); color: var(--bad); }
.empty { display: flex; align-items: center; gap: 8px; color: var(--text-2); margin: 0; }
.empty .icon { color: var(--ok); }
.empty-state { text-align: center; padding: 32px 16px; }
.empty-state__icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.empty-state__icon .icon { width: 32px; height: 32px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; }
.kv--small { font-size: 13px; margin-bottom: 12px; }

.pills { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.pill { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }

/* Utilisateurs */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.user-card.is-locked { border-color: var(--bad); }
.user-card.is-pending { border-color: var(--warn); }
.user-card summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.user-card summary::-webkit-details-marker { display: none; }
.user-card__main { flex: 1; min-width: 0; }
.user-card__main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card__main small { color: var(--text-2); font-size: 13px; }
.user-card__badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.user-card__chevron { color: var(--text-2); transition: transform .2s; }
.user-card[open] .user-card__chevron { transform: rotate(180deg); }
.user-card__body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions form { margin: 0; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-row select, .action-row input { flex: 1; min-width: 160px; }

/* Grilles et cases à cocher */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.checks { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.checks legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 4px; }
.check--super { color: var(--warn); }
.check--super .icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.check span { display: inline-flex; align-items: center; }
.access { border-top: 1px dashed var(--line); padding-top: 12px; gap: 10px; }
.access__title { margin: 0; font-weight: 700; font-size: 14px; }
.action-row--top { margin-top: 12px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.user-card.is-muted { opacity: .65; }

/* Filtres repliables */
.filters { padding: 0; }
.filters > summary { display: flex; align-items: center; gap: 8px; padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary .icon { color: var(--accent); }
.filters[open] > summary { border-bottom: 1px solid var(--line); }
.filters > form, .filters__form { padding: 16px; }
.filters__form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filters__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Journal */
.card--flush { padding: 0; overflow: hidden; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.log:last-child { border-bottom: 0; }
.log__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.log__head time { font-size: 12px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log__meta { font-size: 13px; margin-top: 4px; }
.log__details { margin: 4px 0 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 16px; }

/* ───────────── Modules terrain (inventaire, gaz, CO2) ───────────── */
.toolbar { display: flex; flex-direction: column; gap: 10px; }
.toolbar__row { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar .pill { display: inline-flex; align-items: center; gap: 6px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.toolbar .pill .icon { width: 16px; height: 16px; }
.search-row { display: flex; gap: 8px; }
.search { flex: 1; position: relative; display: block; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.search input { padding-left: 40px; }
.btn--icon { padding: 0 14px; }
@media (max-width: 420px) { .btn--icon span { display: none; } }
.btn--danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger-solid:hover { filter: brightness(1.1); color: #fff; background: var(--bad); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.alert--button { width: 100%; text-align: left; cursor: pointer; font: inherit; margin-bottom: 12px; }
.empty--search { margin: 8px 0 12px; }

.stock-list { list-style: none; margin: 0 0 16px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stock-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); transition: background .3s; }
.stock-item:last-child { border-bottom: 0; }
.stock-item[hidden] { display: none; }
/* Un élément masqué (attribut hidden) reste masqué même si sa classe lui donne display: flex (ex. « Bouteille non trouvée ») */
.empty[hidden] { display: none; }
.stock-item.is-flash { background: var(--accent-soft); }
.stock-item__main { flex: 1; min-width: 0; }
.stock-item__main strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.stock-item__main small { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.stock-item__actions { display: flex; gap: 6px; flex: none; }

.qty { min-width: 44px; padding: 4px 8px; border-radius: 10px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.qty--ok { background: var(--ok-soft); color: var(--ok); }
.qty--low { background: #3a3510; color: #facc15; }
[data-theme="light"] .qty--low { background: #fef9c3; color: #a16207; }
.qty--warn { background: var(--warn-soft); color: var(--warn); }
.qty--bad { background: var(--bad-soft); color: var(--bad); }
.qty--small { min-width: 0; padding: 2px 8px; }

.round-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.round-btn:hover { background: var(--accent); color: var(--on-accent); }
.round-btn--out { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.round-btn--out:hover { background: var(--bad); color: #fff; }
.round-btn--ghost { border-color: var(--line-strong); background: transparent; color: var(--text-2); }
.round-btn--ghost:hover { background: var(--surface-2); color: var(--text); }

/* Chiffres clés et échéances (CERFA, PDP) */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat__value { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 12px; color: var(--text-2); }
.stat--bad .stat__value { color: var(--bad); }
.stat--warn .stat__value { color: var(--warn); }
.qty--wide { min-width: 0; white-space: nowrap; font-size: 13px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.meta-line > span { display: inline-flex; align-items: center; gap: 5px; }
.meta-line .icon { width: 15px; height: 15px; }
.stock-item.item--bad { box-shadow: inset 3px 0 0 var(--bad); }
.stock-item.item--warn { box-shadow: inset 3px 0 0 var(--warn); }
.stock-item.is-done { opacity: .72; }
.progress-card { display: flex; flex-direction: column; gap: 8px; }
.progress-card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.progress-card p { margin: 0; }
.card--link { display: flex; color: var(--text); }
.card--link:hover { border-color: var(--accent); color: var(--text); }
.progress-card__head .icon { color: var(--accent); vertical-align: -4px; }

/* Annuaire et Aide */
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.back .icon { width: 16px; height: 16px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line-strong); flex: none; }
.status-dot--online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-dot--offline { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.status-dot--unknown { background: var(--text-2); }
.secret { font-family: ui-monospace, Consolas, monospace; }
.note { margin: 0; font-size: 14px; color: var(--text); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; overflow-wrap: anywhere; }
.code-box { display: flex; gap: 8px; align-items: flex-start; }
.code-box pre { flex: 1; margin: 0; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; }
.list--padded li { padding: 8px 0; }
.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-actions form { margin: 0; }
.filters__body { padding: 16px; }
.table--compact td, .table--compact th { padding: 4px 8px; font-size: 13px; }
.row-changed td { background: var(--accent-soft); }
.row-bad td { color: var(--bad); }
.trend--warn { color: var(--warn); font-weight: 800; }
.table__empty td { text-align: center; color: var(--text-2); padding: 20px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.legend span:first-child { display: inline-block; min-width: 28px; text-align: center; font-weight: 800; }
.dialog--wide { width: min(640px, calc(100vw - 24px)); }
.pairs { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px 8px; align-items: center; }
.pairs input { min-height: 40px; padding: 6px 8px; text-align: center; }
.pairs__label { font-size: 13px; }

/* Compteurs « à faire » (tuiles, menus) */
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; font-size: 12px; font-weight: 800; line-height: 1; margin-left: auto; flex: none; }
.count--bad { background: var(--bad); color: #fff; }
.count--warn { background: var(--warn); color: #1a1204; }
.side-link .count { margin-left: auto; }
.list__row .count { margin-left: 8px; }
.quick__item, .tab { position: relative; }
.count--corner { position: absolute; top: 6px; right: 6px; margin: 0; }
/* Onglets du menu Gaz : compteur collé au libellé */
.gas-tabs .pill { display: inline-flex; align-items: center; gap: 6px; }
.gas-tabs .count { margin: 0; min-width: 18px; height: 18px; font-size: 10px; padding: 0 4px; }
.count--tab { position: absolute; top: 2px; left: 50%; margin: 0 0 0 6px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 4px; }
.todo { display: flex; align-items: center; gap: 8px; }
.todo .list__row { flex: 1; min-width: 0; }
.todo form { margin: 0; flex: none; }
.stock-item--rows { flex-direction: column; align-items: stretch; gap: 8px; }
.stock-item__top { display: flex; align-items: center; gap: 10px; }
.row-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-controls form { margin: 0; }
.select--small { min-height: 36px !important; padding: 4px 8px !important; font-size: 14px !important; width: auto !important; max-width: 180px; }
.round-btn--small { width: 36px; height: 36px; border-radius: 10px; margin-left: auto; }
.stock-item--tap { cursor: pointer; }
.stock-item--tap:hover, .stock-item--tap:focus-visible { background: var(--surface-2); }
.tag { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 11px; }
.qty--kg { min-width: 70px; }
.qty--kg small { font-size: 10px; margin-left: 2px; font-weight: 600; }
.alert--block { margin-bottom: 12px; }
.alert--block form { margin-top: 8px; }
.btn--small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 14px 16px; }
.totals__group { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.totals__title { font-weight: 700; margin: 0 0 6px; display: flex; justify-content: space-between; gap: 8px; }
.totals__line { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.totals__line--sub { padding-left: 12px; font-size: 12px; color: var(--text-2); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-block { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sheet-summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; margin-bottom: 10px; }
.sheet-summary::-webkit-details-marker { display: none; }
.sheet-summary .icon { color: var(--accent); }
.state-row { display: flex; gap: 8px; flex-wrap: wrap; }
.state-row form { flex: 1; margin: 0; }
.state-row .btn { width: 100%; }

/* Fenêtres */
.dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--text); padding: 20px; }
.dialog::backdrop { background: rgba(3, 8, 18, .7); }
.dialog h2 { font-size: 18px; margin-bottom: 4px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dialog__danger { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0; font-size: 14px; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { text-align: center; font-size: 20px; font-weight: 700; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; min-width: 0; }

/* Scanner */
.dialog--scan { width: min(520px, calc(100vw - 24px)); }
.scan-view { position: relative; border-radius: 12px; overflow: hidden; background: #000; margin: 10px 0; aspect-ratio: 4 / 3; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line { position: absolute; left: 6%; right: 6%; height: 2px; background: var(--accent); top: 50%; animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 20%; } 50% { top: 80%; } }
.scan-status { font-size: 13px; color: var(--accent); margin: 0 0 10px; min-height: 20px; }
/* Contrôle de stock : résultat du dernier scan, bien visible */
.scan-status--ok, .scan-status--warn, .scan-status--bad { font-size: 15px; font-weight: 700; padding: 8px 10px; border-radius: var(--radius-sm); }
.scan-status--ok { color: var(--ok); background: var(--ok-soft); }
.scan-status--warn { color: var(--warn); background: var(--warn-soft); }
.scan-status--bad { color: var(--bad); background: var(--bad-soft); }
.control-count { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.control-count strong { color: var(--accent); }
.control-count .muted { font-size: 15px; font-weight: 500; }
.control-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.control-mark { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); }
.control-item.is-found .control-mark { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 3px var(--surface); }
.control-item.is-found strong { color: var(--ok); }
.control-item.is-extra { color: var(--warn); }
.scan-manual { margin-bottom: 4px; }

/* Notifications */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(460px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 8px 24px rgba(0,0,0,.35); transition: opacity .3s, transform .3s; }
.toast--success { border-color: var(--ok); color: var(--ok); }
.toast--error { border-color: var(--bad); color: var(--bad); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

/* Tableaux et barres */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--text-2); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 8px; border-bottom: 1px solid var(--line); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars__label { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bars__meter { width: 100%; height: 8px; }
.bars__meter::-webkit-meter-bar { background: var(--surface-2); border: 0; border-radius: 6px; }
.bars__meter::-webkit-meter-optimum-value { background: var(--accent); border-radius: 6px; }
.bars__meter::-moz-meter-bar { background: var(--accent); border-radius: 6px; }
/* Bouteilles de récupération : remplissage (vert, orange à 90 %, rouge pleine) et entrées */
meter.fill { display: block; width: 100%; height: 8px; margin: 6px 0 2px; }
meter.fill::-webkit-meter-bar { background: var(--surface-2); border: 0; border-radius: 6px; }
meter.fill::-webkit-meter-optimum-value { background: var(--ok); border-radius: 6px; }
meter.fill::-webkit-meter-suboptimum-value { background: var(--warn); border-radius: 6px; }
meter.fill::-webkit-meter-even-less-good-value { background: var(--bad); border-radius: 6px; }
meter.fill::-moz-meter-bar { background: var(--ok); border-radius: 6px; }
meter.fill:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); }
meter.fill:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--bad); }
.entries { margin-top: 6px; }
.entries summary { cursor: pointer; color: var(--text-2); }

.mail-body { background: #ffffff; color: #0f1b2d; border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; font-size: 14px; }
.mail-body div, .mail-body h2 { color: inherit; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ── Suivi de site ── */
.code-inline { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; font-weight: 500; }
p.code-inline { padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.stack-actions--row { flex-direction: row; margin: 0 0 16px; }
.stack-actions--row .btn { flex: 1; width: auto; }
.section-title { font-size: 17px; margin: 8px 2px 10px; scroll-margin-top: 16px; }
.list__row > .icon { color: var(--accent); flex: none; }
/* ── Drive ── */
.gauge-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.gauge-card p { margin: 8px 0 0; }
progress { width: 100%; height: 10px; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; transition: width .2s; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.gauge { height: 14px; }
.gauge--warn::-webkit-progress-value { background: var(--warn); }
.gauge--warn::-moz-progress-bar { background: var(--warn); }
.gauge--bad::-webkit-progress-value { background: var(--bad); }
.gauge--bad::-moz-progress-bar { background: var(--bad); }
.drive-hint { margin: 8px 0 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 2px 12px; font-size: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.crumbs a[aria-current] { color: var(--text); font-weight: 600; }
.crumbs .icon { width: 16px; height: 16px; }
.crumbs__sep { color: var(--text-2); display: inline-flex; }
.card--flush { padding: 4px 12px; }
.drive-row { display: flex; align-items: center; gap: 6px; }
.drive-row .list__row { flex: 1; min-width: 0; }
.drive-row .list__main { overflow-wrap: anywhere; }
.drive-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.drive-icon--folder, .drive-icon--pdf, .drive-icon--image, .drive-icon--video { background: var(--accent-soft); color: var(--accent); }
.drive-uploads { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.drive-uploads[hidden] { display: none; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.upload-row strong { overflow-wrap: anywhere; font-size: 14px; }
.upload-row progress { grid-column: 1 / -1; }
.upload-row small { color: var(--text-2); font-size: 12px; }
.upload-row .link { grid-row: 1; grid-column: 2; }
.upload-row.is-ok small { color: var(--ok); }
.upload-row.is-error small { color: var(--bad); }
.dropzone { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(8, 18, 32, .82); border: 3px dashed var(--accent); color: #fff; font-size: 20px; pointer-events: none; text-align: center; padding: 16px; }
.dropzone[hidden] { display: none; }
.dropzone .icon { width: 48px; height: 48px; color: var(--accent); }
.dropzone small { opacity: .8; font-size: 14px; }
h1.break { overflow-wrap: anywhere; }
.viewer { padding: 8px; }
.viewer__image { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: var(--radius-sm); }
.viewer__media { display: block; width: 100%; max-height: 75vh; background: #000; border-radius: var(--radius-sm); }
audio.viewer__media { background: none; }
.viewer p { margin: 8px 4px 0; }
.pdf-view { display: flex; flex-direction: column; gap: 10px; }
.pdf-page { display: block; width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.text-view { margin: 0; padding: 12px; max-height: 75vh; overflow: auto; background: var(--surface-2); border-radius: var(--radius-sm); font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
/* ── Rapports d'intervention ── */
.report-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; border: 2px dashed var(--line); }
.report-drop__icon { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.report-drop__text { flex: 1; min-width: 160px; }
.report-drop__text strong { display: block; }
.report-drop__text small { color: var(--text-2); }
.report-drop__list { flex-basis: 100%; margin: 4px 0 0; }
.upload-row.is-warn small { color: var(--warn); }
.note-card p { margin: 0; }
.toolbar__end { margin-left: auto; }
.report-link { display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.report-link:hover { color: var(--text); }
.block { display: block; }
.block .icon { width: 13px; height: 13px; vertical-align: -2px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.badge--info { background: var(--accent-soft); color: var(--accent); }
.ai-card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.ai-card__head h2 { margin: 0; }
.ai-card--actions { box-shadow: inset 3px 0 0 var(--warn); }
.ai-card h3 { font-size: 15px; margin: 14px 0 6px; }
.ai-summary { margin: 0; line-height: 1.55; }
.action-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.action-list li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--warn-soft); }
.action-list .icon { color: var(--warn); flex: none; width: 18px; height: 18px; margin-top: 1px; }
details > summary { cursor: pointer; padding: 2px 0; }
details[open] > summary { margin-bottom: 8px; }
.row-total td { border-top: 2px solid var(--line); font-weight: 600; }

/* ── Actions à prévoir : case « faite » (admins) ── */
.action-list li.action-item { align-items: center; }
.action-item form { margin: 0; flex: none; }
.action-check { width: 26px; height: 26px; flex: none; padding: 0; border-radius: 7px; border: 2px solid var(--warn); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.action-check:hover { border-color: var(--ok); }
.action-check--static { cursor: default; }
.action-list .action-check .icon { color: var(--surface); width: 16px; height: 16px; margin: 0; }
.action-item__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.action-item__text small { color: var(--text-2); font-size: 12px; }
.action-list li.action-item.is-done { background: var(--ok-soft); }
.action-item.is-done .action-item__label { text-decoration: line-through; color: var(--text-2); }
.action-item.is-done .action-check { background: var(--ok); border-color: var(--ok); }
.done-actions { margin-top: 12px; }
.done-actions > summary { color: var(--text-2); font-size: 14px; }
.done-actions .action-list { margin-top: 8px; }

/* ── Dossiers clients ── */
.folder-natures { margin: -6px 2px 14px; }
.folder-filters__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.folder-filters .field { margin: 0; }
/* ── Statistiques ── */
.stats-section { padding: 0; }
.stats-section > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; font-size: 16px; list-style: none; }
.stats-section > summary::-webkit-details-marker { display: none; }
.stats-section > summary .icon { color: var(--accent); }
.stats-section > summary::after { content: '▾'; margin-left: auto; color: var(--text-2); transition: transform .2s; }
.stats-section[open] > summary::after { transform: rotate(180deg); }
.stats-section[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 0; }
.stats-section__body { padding: 14px 16px 16px; }
.stats-section__body h3 { font-size: 14px; margin: 16px 0 8px; color: var(--text-2); text-transform: none; }
.stats-section__body > h3:first-child, .stats-grid h3 { margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; margin-bottom: 8px; }
.chart-donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut__bg { fill: none; stroke: var(--surface-2); stroke-width: 6; }
.donut__seg { fill: none; stroke-width: 6; transition: stroke-width .15s; }
.donut__seg:hover { stroke-width: 7.5; }
.donut__center { font-size: 7px; font-weight: 800; fill: var(--text); text-anchor: middle; }
.donut__sub { font-size: 3.2px; fill: var(--text-2); text-anchor: middle; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend__label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.legend__value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend__value small { color: var(--text-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chart-c0 { stroke: #38bdf8; background: #38bdf8; } .chart-c1 { stroke: #f59e0b; background: #f59e0b; }
.chart-c2 { stroke: #10b981; background: #10b981; } .chart-c3 { stroke: #a78bfa; background: #a78bfa; }
.chart-c4 { stroke: #f472b6; background: #f472b6; } .chart-c5 { stroke: #64748b; background: #64748b; }
.chart-c6 { stroke: #22d3ee; background: #22d3ee; } .chart-c7 { stroke: #fb923c; background: #fb923c; }
.chart-ok { stroke: var(--ok); background: var(--ok); } .chart-warn { stroke: var(--warn); background: var(--warn); }
.chart-bad { stroke: var(--bad); background: var(--bad); } .chart-muted { stroke: var(--text-2); background: var(--text-2); }
.text-warn { color: var(--warn); } .text-bad { color: var(--bad); }
/* ── Contrôle d'étanchéité / fluides ── */
.leak-card--alert { box-shadow: inset 3px 0 0 var(--bad); }
.alert--inline { margin: 8px 0 0; }
.fluid-family { padding: 12px 4px 0; font-size: 16px; }
.login-hint { display: flex; gap: 6px; align-items: flex-start; margin: 4px 0 0; }
.login-hint .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }