
/* ==========================================================================
   Mon Râtelier, système de design V2
   Univers : l'atelier d'un armurier haut de gamme.
   Matières : acier bronzé et bleui (encre, commandes), laiton (mesure,
   sélection), bleu de revenu (focus, liens), plaque de couleur de la
   palette (barre latérale, bandeau du râtelier), orange de sécurité
   (uniquement ce qui arrête l'utilisateur).
   Palette : data-palette="a|b|c" sur :root (section 1 bis), A par défaut.
   Thème : data-theme="light|dark" sur :root, sinon prefers-color-scheme.
   ========================================================================== */

/* ---------- 1. Jetons ---------- */
:root {
  color-scheme: light;
  /* Couleurs : section 1 bis (palettes). */

  /* Rôles sémantiques */
  --sel: var(--c-brass-500);       /* sélection, repères (laiton) */
  --sel-ink: var(--c-brass-700);
  --focus: var(--c-temper);
  --link: var(--c-temper);

  /* Typographie */
  --font-ui: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fw-regular: 400;
  --fw-medium: 520;
  --fw-semibold: 610;
  --fw-bold: 700;
  --stretch-title: 84%;   /* « marquages frappés » du boîtier */
  --stretch-stamp: 92%;

  --fs-2xs: 0.75rem;    /* 12 (D-093 : plus aucun texte sous 12 px) */
  --fs-xs: 0.8125rem;   /* 13, aides et sources */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-md: 1rem;        /* 16, texte courant */
  --fs-lg: 1.125rem;    /* 18 */
  --fs-xl: 1.375rem;    /* 22 */
  --fs-2xl: 1.75rem;    /* 28 */
  --fs-3xl: 2.25rem;    /* 36 */
  --fs-4xl: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  --lh-tight: 1.08;
  --lh-snug: 1.3;
  --lh-body: 1.55;

  /* Espacements (base 4 px) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 28px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  --sp-16: 64px; --sp-20: 80px;
  --gutter: clamp(16px, 3.2vw, 32px);

  /* Rayons */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;

  /* Ombres (acier sur établi : courtes, nettes, puis diffuses) */
  --sh-1: 0 1px 0 rgba(16, 22, 28, .04), 0 1px 2px rgba(16, 22, 28, .06);
  --sh-2: 0 1px 1px rgba(16, 22, 28, .05), 0 4px 12px -2px rgba(16, 22, 28, .08);
  --sh-3: 0 2px 4px rgba(16, 22, 28, .05), 0 16px 40px -8px rgba(16, 22, 28, .18);
  --sh-inset: inset 0 1px 2px rgba(16, 22, 28, .08);
  --sh-press: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 1px rgba(0, 0, 0, .25);

  /* Mouvement */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 120ms;
  --t-med: 220ms;
  --t-slow: 420ms;

  /* Gabarit */
  --sidebar-w: 264px;
  --rail-w: 76px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --content-max: 1240px;
  --tap: 44px;

  /* Textures (SVG en data URI, aucune ressource externe) */
  --tex-walnut: var(--tex-plate); /* compatibilité : la texture suit la palette */
  --tex-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235f6870' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Thème sombre : acier bronzé, établi la nuit */
:root[data-theme="dark"] {
  color-scheme: dark;

  --sh-1: 0 1px 0 rgba(0, 0, 0, .3);
  --sh-2: 0 1px 1px rgba(0, 0, 0, .3), 0 6px 16px -4px rgba(0, 0, 0, .5);
  --sh-3: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 48px -12px rgba(0, 0, 0, .7);
  --sh-inset: inset 0 1px 2px rgba(0, 0, 0, .4);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23949ca4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --sh-1: 0 1px 0 rgba(0, 0, 0, .3);
    --sh-2: 0 1px 1px rgba(0, 0, 0, .3), 0 6px 16px -4px rgba(0, 0, 0, .5);
    --sh-3: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 48px -12px rgba(0, 0, 0, .7);
    --sh-inset: inset 0 1px 2px rgba(0, 0, 0, .4);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23949ca4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* ---------- 1 bis. Palettes (générées : voir docs/design.md §2) ----------
   data-palette="a" | "b" | "c" sur :root, orthogonal à data-theme. Sans attribut : palette A, recommandée.
   Chaque bloc définit la totalité des couleurs dépendantes de la palette, pour qu'aucune valeur ne fuie d'une palette à l'autre. */
/* A, Forêt (acier bleuté, vert forêt, laiton), clair */
:root {
  --c-bg: #e9ecef;
  --c-surface: #ffffff;
  --c-surface-2: #f4f6f8;
  --c-surface-3: #e4e8ec;
  --c-sunk: #dbe0e5;
  --c-line: #d1d7dd;
  --c-line-strong: #7c8792;
  --c-ink: #121920;
  --c-ink-2: #333d47;
  --c-mute: #55606b;
  --c-faint: #545f6a;
  --c-gunmetal: #1b252e;
  --c-gunmetal-hi: #2a3641;
  --c-on-gunmetal: #f1f4f7;
  --c-temper: #2f5fae;
  --c-temper-soft: #dee7f5;
  --c-info-bg: #edf1f4;
  --c-brass-800: #5f4512;
  --c-brass-700: #7a5a1a;
  --c-brass-600: #9a7327;
  --c-brass-500: #b0862f;
  --c-brass-300: #dcc283;
  --c-brass-100: #f5eed9;
  --c-safety: #e2501a;
  --c-safety-ink: #ad3e0e;
  --c-safety-bg: #fdede4;
  --c-safety-line: #f6b998;
  --c-safety-solid: #b8410c;
  --c-ok: #2a7350;
  --c-ok-bg: #e3f0e8;
  --c-ok-line: #a8d3b9;
  --c-ok-solid: #256845;
  --c-verify: #7a5a1a;
  --c-verify-bg: #f6eedb;
  --c-verify-line: #e0c98f;
  --c-verify-solid: #6e5016;
  --c-on-solid: #ffffff;
  --c-plate-950: #0a140f;
  --c-plate-900: #0f1d16;
  --c-plate-800: #16291f;
  --c-plate-700: #1d3629;
  --c-plate-600: #2b4a3a;
  --c-plate-500: #3d6450;
  --c-plate-300: #93b4a2;
  --c-plate-100: #e2ece6;
  --c-side-alert: #e2501a;
  --c-plate: #1d3629;
  --c-on-plate: #f0f6f2;
  --c-on-plate-2: #bcd0c3;
  --c-plate-mark: #e0c47e;
  --c-plate-ov: rgba(0, 0, 0, .22);
  --c-plate-ov-2: rgba(0, 0, 0, .40);
  --c-plate-edge: rgba(255, 255, 255, .14);
  --c-side-bg: #172a21;
  --c-side-ink: #e3ece6;
  --c-side-ink-2: #a8bfb1;
  --c-side-name: #f5f8f6;
  --c-side-hover: rgba(225, 245, 232, .07);
  --c-side-active: rgba(0, 0, 0, .30);
  --c-side-active-ink: #ffffff;
  --c-side-mark: #ddc07a;
  --c-side-edge: rgba(0, 0, 0, .35);
  --il-ink: #1b252e;
  --il-soft: #626d78;
  --il-faint: #c6cdd4;
  --il-paper: #ffffff;
  --il-surface: #edf0f3;
  --il-bg: #ffffff;
  --il-glow: #fff3cf;
  --il-ok: #2a7350;
  --il-bad: #e4561a;
  --v3d-glow: #ffffff;
  --v3d-top: #f4f6f8;
  --v3d-bot: #e4e8ec;
  --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --tex-side: var(--tex-plate);
}
/* B, Ardoise (graphite, bleu acier, laiton), clair */
:root[data-palette="b"] {
  --c-bg: #eaebec;
  --c-surface: #ffffff;
  --c-surface-2: #f5f5f6;
  --c-surface-3: #e6e7e9;
  --c-sunk: #dedfe2;
  --c-line: #d4d6d9;
  --c-line-strong: #7e838a;
  --c-ink: #15171a;
  --c-ink-2: #373b41;
  --c-mute: #5a5f66;
  --c-faint: #585d64;
  --c-gunmetal: #24415c;
  --c-gunmetal-hi: #30537a;
  --c-on-gunmetal: #f1f5f9;
  --c-temper: #2f5fae;
  --c-temper-soft: #dfe7f3;
  --c-info-bg: #eef0f3;
  --c-brass-800: #5f4512;
  --c-brass-700: #7a5a1a;
  --c-brass-600: #9a7327;
  --c-brass-500: #b0862f;
  --c-brass-300: #dcc283;
  --c-brass-100: #f5eed9;
  --c-safety: #e2501a;
  --c-safety-ink: #ad3e0e;
  --c-safety-bg: #fdede4;
  --c-safety-line: #f6b998;
  --c-safety-solid: #b8410c;
  --c-ok: #2a7350;
  --c-ok-bg: #e3f0e8;
  --c-ok-line: #a8d3b9;
  --c-ok-solid: #256845;
  --c-verify: #7a5a1a;
  --c-verify-bg: #f6eedb;
  --c-verify-line: #e0c98f;
  --c-verify-solid: #6e5016;
  --c-on-solid: #ffffff;
  --c-plate-950: #0c0e10;
  --c-plate-900: #14171a;
  --c-plate-800: #1d2125;
  --c-plate-700: #242a31;
  --c-plate-600: #343b44;
  --c-plate-500: #4b5560;
  --c-plate-300: #a3acb6;
  --c-plate-100: #e8eaed;
  --c-side-alert: #e2501a;
  --c-plate: #242a31;
  --c-on-plate: #eff1f3;
  --c-on-plate-2: #b8bfc7;
  --c-plate-mark: #dfc27c;
  --c-plate-ov: rgba(0, 0, 0, .22);
  --c-plate-ov-2: rgba(0, 0, 0, .42);
  --c-plate-edge: rgba(255, 255, 255, .12);
  --c-side-bg: #1d2125;
  --c-side-ink: #e2e5e8;
  --c-side-ink-2: #a5acb4;
  --c-side-name: #f5f6f7;
  --c-side-hover: rgba(255, 255, 255, .06);
  --c-side-active: rgba(0, 0, 0, .32);
  --c-side-active-ink: #ffffff;
  --c-side-mark: #dcc07a;
  --c-side-edge: rgba(0, 0, 0, .35);
  --il-ink: #1d2228;
  --il-soft: #646a72;
  --il-faint: #c8cbd0;
  --il-paper: #ffffff;
  --il-surface: #eef0f2;
  --il-bg: #ffffff;
  --il-glow: #fff3cf;
  --il-ok: #2a7350;
  --il-bad: #e4561a;
  --v3d-glow: #ffffff;
  --v3d-top: #f5f5f6;
  --v3d-bot: #e6e7e9;
  --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='240'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .9' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --tex-side: var(--tex-plate);
}
/* C, Sapin et pierre (clair lumineux, vert sapin, gris pierre), clair */
:root[data-palette="c"] {
  --c-bg: #eeede8;
  --c-surface: #fdfdfb;
  --c-surface-2: #f6f5f1;
  --c-surface-3: #e8e6e0;
  --c-sunk: #e0ded7;
  --c-line: #d7d4cc;
  --c-line-strong: #7f7c72;
  --c-ink: #181b19;
  --c-ink-2: #3a3f3b;
  --c-mute: #5a605b;
  --c-faint: #585e59;
  --c-gunmetal: #1d3f36;
  --c-gunmetal-hi: #285246;
  --c-on-gunmetal: #f2f6f4;
  --c-temper: #2f5fae;
  --c-temper-soft: #e0e7f2;
  --c-info-bg: #efefea;
  --c-brass-800: #5f4512;
  --c-brass-700: #7a5a1a;
  --c-brass-600: #9a7327;
  --c-brass-500: #b0862f;
  --c-brass-300: #dcc283;
  --c-brass-100: #f5eed9;
  --c-safety: #e2501a;
  --c-safety-ink: #ad3e0e;
  --c-safety-bg: #fdede4;
  --c-safety-line: #f6b998;
  --c-safety-solid: #b8410c;
  --c-ok: #2a7350;
  --c-ok-bg: #e3f0e8;
  --c-ok-line: #a8d3b9;
  --c-ok-solid: #256845;
  --c-verify: #7a5a1a;
  --c-verify-bg: #f6eedb;
  --c-verify-line: #e0c98f;
  --c-verify-solid: #6e5016;
  --c-on-solid: #ffffff;
  --c-plate-950: #0b1a16;
  --c-plate-900: #11261f;
  --c-plate-800: #17322a;
  --c-plate-700: #1d3f36;
  --c-plate-600: #2a5649;
  --c-plate-500: #3f7363;
  --c-plate-300: #98bdb1;
  --c-plate-100: #e3eeea;
  --c-side-alert: #b8410c;
  --c-plate: #1d3f36;
  --c-on-plate: #f1f6f3;
  --c-on-plate-2: #bdd2c9;
  --c-plate-mark: #e2c788;
  --c-plate-ov: rgba(0, 0, 0, .20);
  --c-plate-ov-2: rgba(0, 0, 0, .38);
  --c-plate-edge: rgba(255, 255, 255, .14);
  --c-side-bg: #e4e3dc;
  --c-side-ink: #262b28;
  --c-side-ink-2: #565c57;
  --c-side-name: #16322b;
  --c-side-hover: rgba(29, 63, 54, .07);
  --c-side-active: #1d3f36;
  --c-side-active-ink: #ffffff;
  --c-side-mark: #9a7327;
  --c-side-edge: #cfccc3;
  --il-ink: #1d2421;
  --il-soft: #646a65;
  --il-faint: #cdcac2;
  --il-paper: #fdfdfb;
  --il-surface: #f0efea;
  --il-bg: #fdfdfb;
  --il-glow: #fff3cf;
  --il-ok: #2a7350;
  --il-bad: #e4561a;
  --v3d-glow: #ffffff;
  --v3d-top: #f6f5f1;
  --v3d-bot: #e8e6e0;
  --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --tex-side: none;
}
/* A, sombre */
:root[data-theme="dark"] {
  --c-bg: #0b0f12;
  --c-surface: #131a1f;
  --c-surface-2: #182027;
  --c-surface-3: #1f2830;
  --c-sunk: #080b0d;
  --c-line: #25303a;
  --c-line-strong: #5f6c78;
  --c-ink: #e7ecef;
  --c-ink-2: #c0c9d0;
  --c-mute: #929da7;
  --c-faint: #8b97a1;
  --c-gunmetal: #dce3e8;
  --c-gunmetal-hi: #ffffff;
  --c-on-gunmetal: #10171c;
  --c-temper: #86abef;
  --c-temper-soft: #19263a;
  --c-info-bg: #172028;
  --c-brass-800: #e6cd8c;
  --c-brass-700: #d9b867;
  --c-brass-600: #cfa954;
  --c-brass-500: #c49d4a;
  --c-brass-300: #8a6d2c;
  --c-brass-100: #2a2312;
  --c-safety: #ff6a2b;
  --c-safety-ink: #ff9a6c;
  --c-safety-bg: #2b170e;
  --c-safety-line: #6b3218;
  --c-safety-solid: #ff7a3d;
  --c-ok: #63cc94;
  --c-ok-bg: #11241a;
  --c-ok-line: #24503a;
  --c-ok-solid: #5cc08b;
  --c-verify: #dcbd6f;
  --c-verify-bg: #262011;
  --c-verify-line: #5a4a20;
  --c-verify-solid: #dcbd6f;
  --c-on-solid: #10130f;
  --c-plate-950: #07100c;
  --c-plate-900: #0b1712;
  --c-plate-800: #0f1d17;
  --c-plate-700: #142a20;
  --c-plate-600: #1f3d2f;
  --c-plate-500: #2f5644;
  --c-plate-300: #7fa592;
  --c-plate-100: #18261f;
  --c-side-alert: #ff6a2b;
  --c-plate: #142a20;
  --c-on-plate: #eef4f0;
  --c-on-plate-2: #b0c6b9;
  --c-plate-mark: #dcbf78;
  --c-plate-ov: rgba(0, 0, 0, .25);
  --c-plate-ov-2: rgba(0, 0, 0, .45);
  --c-plate-edge: rgba(255, 255, 255, .12);
  --c-side-bg: #0f1d17;
  --c-side-ink: #dae6df;
  --c-side-ink-2: #9db5a7;
  --c-side-name: #f1f6f2;
  --c-side-hover: rgba(225, 245, 232, .06);
  --c-side-active: rgba(0, 0, 0, .40);
  --c-side-active-ink: #ffffff;
  --c-side-mark: #d8bb72;
  --c-side-edge: rgba(0, 0, 0, .5);
  --il-ink: #e2e7ea;
  --il-soft: #97a2ac;
  --il-faint: #384450;
  --il-paper: #1d252c;
  --il-surface: #182027;
  --il-bg: #131a1f;
  --il-glow: #3b3420;
  --il-ok: #63cc94;
  --il-bad: #ff7a3d;
  --v3d-glow: #46535e;
  --v3d-top: #2d3842;
  --v3d-bot: #1e262d;
  --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --tex-side: var(--tex-plate);
}
/* B, sombre */
:root[data-palette="b"][data-theme="dark"] {
  --c-bg: #0d0e10;
  --c-surface: #151719;
  --c-surface-2: #1a1d20;
  --c-surface-3: #212428;
  --c-sunk: #0a0b0c;
  --c-line: #282b30;
  --c-line-strong: #646b73;
  --c-ink: #e9eaec;
  --c-ink-2: #c4c7cc;
  --c-mute: #979ca3;
  --c-faint: #8f949b;
  --c-gunmetal: #b9cde1;
  --c-gunmetal-hi: #d6e3ef;
  --c-on-gunmetal: #0f1924;
  --c-temper: #8cb0ee;
  --c-temper-soft: #1a2537;
  --c-info-bg: #1a1d21;
  --c-brass-800: #e6cd8c;
  --c-brass-700: #d9b867;
  --c-brass-600: #cfa954;
  --c-brass-500: #c49d4a;
  --c-brass-300: #8a6d2c;
  --c-brass-100: #2a2312;
  --c-safety: #ff6a2b;
  --c-safety-ink: #ff9a6c;
  --c-safety-bg: #2b170e;
  --c-safety-line: #6b3218;
  --c-safety-solid: #ff7a3d;
  --c-ok: #63cc94;
  --c-ok-bg: #11241a;
  --c-ok-line: #24503a;
  --c-ok-solid: #5cc08b;
  --c-verify: #dcbd6f;
  --c-verify-bg: #262011;
  --c-verify-line: #5a4a20;
  --c-verify-solid: #dcbd6f;
  --c-on-solid: #10130f;
  --c-plate-950: #08090b;
  --c-plate-900: #0f1114;
  --c-plate-800: #131518;
  --c-plate-700: #1b2027;
  --c-plate-600: #272e37;
  --c-plate-500: #3b4550;
  --c-plate-300: #8b95a0;
  --c-plate-100: #1c2026;
  --c-side-alert: #ff6a2b;
  --c-plate: #1b2027;
  --c-on-plate: #eceef1;
  --c-on-plate-2: #b0b7bf;
  --c-plate-mark: #dcbf78;
  --c-plate-ov: rgba(0, 0, 0, .25);
  --c-plate-ov-2: rgba(0, 0, 0, .45);
  --c-plate-edge: rgba(255, 255, 255, .10);
  --c-side-bg: #17191c;
  --c-side-ink: #dfe2e5;
  --c-side-ink-2: #a0a6ad;
  --c-side-name: #f3f4f5;
  --c-side-hover: rgba(255, 255, 255, .05);
  --c-side-active: rgba(255, 255, 255, .07);
  --c-side-active-ink: #ffffff;
  --c-side-mark: #d8bb72;
  --c-side-edge: rgba(0, 0, 0, .5);
  --il-ink: #e4e6e9;
  --il-soft: #999fa7;
  --il-faint: #3a3f46;
  --il-paper: #1f2226;
  --il-surface: #1a1d20;
  --il-bg: #151719;
  --il-glow: #3b3420;
  --il-ok: #63cc94;
  --il-bad: #ff7a3d;
  --v3d-glow: #4a4e54;
  --v3d-top: #303338;
  --v3d-bot: #212327;
  --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='240'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .9' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --tex-side: var(--tex-plate);
}
/* C, sombre */
:root[data-palette="c"][data-theme="dark"] {
  --c-bg: #10110f;
  --c-surface: #181a17;
  --c-surface-2: #1d201c;
  --c-surface-3: #242822;
  --c-sunk: #0b0c0a;
  --c-line: #2b2f2a;
  --c-line-strong: #676e64;
  --c-ink: #ebece8;
  --c-ink-2: #c6c9c2;
  --c-mute: #9a9f97;
  --c-faint: #92978f;
  --c-gunmetal: #bcd7cc;
  --c-gunmetal-hi: #d7e9e2;
  --c-on-gunmetal: #0e1f1a;
  --c-temper: #8cb0ee;
  --c-temper-soft: #1a2433;
  --c-info-bg: #1c1f1b;
  --c-brass-800: #e6cd8c;
  --c-brass-700: #d9b867;
  --c-brass-600: #cfa954;
  --c-brass-500: #c49d4a;
  --c-brass-300: #8a6d2c;
  --c-brass-100: #2a2312;
  --c-safety: #ff6a2b;
  --c-safety-ink: #ff9a6c;
  --c-safety-bg: #2b170e;
  --c-safety-line: #6b3218;
  --c-safety-solid: #ff7a3d;
  --c-ok: #63cc94;
  --c-ok-bg: #11241a;
  --c-ok-line: #24503a;
  --c-ok-solid: #5cc08b;
  --c-verify: #dcbd6f;
  --c-verify-bg: #262011;
  --c-verify-line: #5a4a20;
  --c-verify-solid: #dcbd6f;
  --c-on-solid: #10130f;
  --c-plate-950: #08120f;
  --c-plate-900: #0d1a16;
  --c-plate-800: #12201b;
  --c-plate-700: #173129;
  --c-plate-600: #22463b;
  --c-plate-500: #336353;
  --c-plate-300: #83ab9e;
  --c-plate-100: #172621;
  --c-side-alert: #ff6a2b;
  --c-plate: #173129;
  --c-on-plate: #eef4f1;
  --c-on-plate-2: #b0c8be;
  --c-plate-mark: #dcbf78;
  --c-plate-ov: rgba(0, 0, 0, .25);
  --c-plate-ov-2: rgba(0, 0, 0, .45);
  --c-plate-edge: rgba(255, 255, 255, .12);
  --c-side-bg: #1b1c19;
  --c-side-ink: #e1e3dd;
  --c-side-ink-2: #a3a89f;
  --c-side-name: #f3f4f1;
  --c-side-hover: rgba(255, 255, 250, .05);
  --c-side-active: #24493f;
  --c-side-active-ink: #ffffff;
  --c-side-mark: #d8bb72;
  --c-side-edge: rgba(0, 0, 0, .5);
  --il-ink: #e6e8e3;
  --il-soft: #9ca199;
  --il-faint: #3b4039;
  --il-paper: #20231f;
  --il-surface: #1d201c;
  --il-bg: #181a17;
  --il-glow: #3b3420;
  --il-ok: #63cc94;
  --il-bad: #ff7a3d;
  --v3d-glow: #4a5047;
  --v3d-top: #30332e;
  --v3d-bot: #21231f;
  --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --tex-side: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #0b0f12;
    --c-surface: #131a1f;
    --c-surface-2: #182027;
    --c-surface-3: #1f2830;
    --c-sunk: #080b0d;
    --c-line: #25303a;
    --c-line-strong: #5f6c78;
    --c-ink: #e7ecef;
    --c-ink-2: #c0c9d0;
    --c-mute: #929da7;
    --c-faint: #8b97a1;
    --c-gunmetal: #dce3e8;
    --c-gunmetal-hi: #ffffff;
    --c-on-gunmetal: #10171c;
    --c-temper: #86abef;
    --c-temper-soft: #19263a;
    --c-info-bg: #172028;
    --c-brass-800: #e6cd8c;
    --c-brass-700: #d9b867;
    --c-brass-600: #cfa954;
    --c-brass-500: #c49d4a;
    --c-brass-300: #8a6d2c;
    --c-brass-100: #2a2312;
    --c-safety: #ff6a2b;
    --c-safety-ink: #ff9a6c;
    --c-safety-bg: #2b170e;
    --c-safety-line: #6b3218;
    --c-safety-solid: #ff7a3d;
    --c-ok: #63cc94;
    --c-ok-bg: #11241a;
    --c-ok-line: #24503a;
    --c-ok-solid: #5cc08b;
    --c-verify: #dcbd6f;
    --c-verify-bg: #262011;
    --c-verify-line: #5a4a20;
    --c-verify-solid: #dcbd6f;
    --c-on-solid: #10130f;
    --c-plate-950: #07100c;
    --c-plate-900: #0b1712;
    --c-plate-800: #0f1d17;
    --c-plate-700: #142a20;
    --c-plate-600: #1f3d2f;
    --c-plate-500: #2f5644;
    --c-plate-300: #7fa592;
    --c-plate-100: #18261f;
    --c-side-alert: #ff6a2b;
    --c-plate: #142a20;
    --c-on-plate: #eef4f0;
    --c-on-plate-2: #b0c6b9;
    --c-plate-mark: #dcbf78;
    --c-plate-ov: rgba(0, 0, 0, .25);
    --c-plate-ov-2: rgba(0, 0, 0, .45);
    --c-plate-edge: rgba(255, 255, 255, .12);
    --c-side-bg: #0f1d17;
    --c-side-ink: #dae6df;
    --c-side-ink-2: #9db5a7;
    --c-side-name: #f1f6f2;
    --c-side-hover: rgba(225, 245, 232, .06);
    --c-side-active: rgba(0, 0, 0, .40);
    --c-side-active-ink: #ffffff;
    --c-side-mark: #d8bb72;
    --c-side-edge: rgba(0, 0, 0, .5);
    --il-ink: #e2e7ea;
    --il-soft: #97a2ac;
    --il-faint: #384450;
    --il-paper: #1d252c;
    --il-surface: #182027;
    --il-bg: #131a1f;
    --il-glow: #3b3420;
    --il-ok: #63cc94;
    --il-bad: #ff7a3d;
    --v3d-glow: #46535e;
    --v3d-top: #2d3842;
    --v3d-bot: #1e262d;
    --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
    --tex-side: var(--tex-plate);
  }
  :root[data-palette="b"]:not([data-theme="light"]) {
    --c-bg: #0d0e10;
    --c-surface: #151719;
    --c-surface-2: #1a1d20;
    --c-surface-3: #212428;
    --c-sunk: #0a0b0c;
    --c-line: #282b30;
    --c-line-strong: #646b73;
    --c-ink: #e9eaec;
    --c-ink-2: #c4c7cc;
    --c-mute: #979ca3;
    --c-faint: #8f949b;
    --c-gunmetal: #b9cde1;
    --c-gunmetal-hi: #d6e3ef;
    --c-on-gunmetal: #0f1924;
    --c-temper: #8cb0ee;
    --c-temper-soft: #1a2537;
    --c-info-bg: #1a1d21;
    --c-brass-800: #e6cd8c;
    --c-brass-700: #d9b867;
    --c-brass-600: #cfa954;
    --c-brass-500: #c49d4a;
    --c-brass-300: #8a6d2c;
    --c-brass-100: #2a2312;
    --c-safety: #ff6a2b;
    --c-safety-ink: #ff9a6c;
    --c-safety-bg: #2b170e;
    --c-safety-line: #6b3218;
    --c-safety-solid: #ff7a3d;
    --c-ok: #63cc94;
    --c-ok-bg: #11241a;
    --c-ok-line: #24503a;
    --c-ok-solid: #5cc08b;
    --c-verify: #dcbd6f;
    --c-verify-bg: #262011;
    --c-verify-line: #5a4a20;
    --c-verify-solid: #dcbd6f;
    --c-on-solid: #10130f;
    --c-plate-950: #08090b;
    --c-plate-900: #0f1114;
    --c-plate-800: #131518;
    --c-plate-700: #1b2027;
    --c-plate-600: #272e37;
    --c-plate-500: #3b4550;
    --c-plate-300: #8b95a0;
    --c-plate-100: #1c2026;
    --c-side-alert: #ff6a2b;
    --c-plate: #1b2027;
    --c-on-plate: #eceef1;
    --c-on-plate-2: #b0b7bf;
    --c-plate-mark: #dcbf78;
    --c-plate-ov: rgba(0, 0, 0, .25);
    --c-plate-ov-2: rgba(0, 0, 0, .45);
    --c-plate-edge: rgba(255, 255, 255, .10);
    --c-side-bg: #17191c;
    --c-side-ink: #dfe2e5;
    --c-side-ink-2: #a0a6ad;
    --c-side-name: #f3f4f5;
    --c-side-hover: rgba(255, 255, 255, .05);
    --c-side-active: rgba(255, 255, 255, .07);
    --c-side-active-ink: #ffffff;
    --c-side-mark: #d8bb72;
    --c-side-edge: rgba(0, 0, 0, .5);
    --il-ink: #e4e6e9;
    --il-soft: #999fa7;
    --il-faint: #3a3f46;
    --il-paper: #1f2226;
    --il-surface: #1a1d20;
    --il-bg: #151719;
    --il-glow: #3b3420;
    --il-ok: #63cc94;
    --il-bad: #ff7a3d;
    --v3d-glow: #4a4e54;
    --v3d-top: #303338;
    --v3d-bot: #212327;
    --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='240'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .9' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
    --tex-side: var(--tex-plate);
  }
  :root[data-palette="c"]:not([data-theme="light"]) {
    --c-bg: #10110f;
    --c-surface: #181a17;
    --c-surface-2: #1d201c;
    --c-surface-3: #242822;
    --c-sunk: #0b0c0a;
    --c-line: #2b2f2a;
    --c-line-strong: #676e64;
    --c-ink: #ebece8;
    --c-ink-2: #c6c9c2;
    --c-mute: #9a9f97;
    --c-faint: #92978f;
    --c-gunmetal: #bcd7cc;
    --c-gunmetal-hi: #d7e9e2;
    --c-on-gunmetal: #0e1f1a;
    --c-temper: #8cb0ee;
    --c-temper-soft: #1a2433;
    --c-info-bg: #1c1f1b;
    --c-brass-800: #e6cd8c;
    --c-brass-700: #d9b867;
    --c-brass-600: #cfa954;
    --c-brass-500: #c49d4a;
    --c-brass-300: #8a6d2c;
    --c-brass-100: #2a2312;
    --c-safety: #ff6a2b;
    --c-safety-ink: #ff9a6c;
    --c-safety-bg: #2b170e;
    --c-safety-line: #6b3218;
    --c-safety-solid: #ff7a3d;
    --c-ok: #63cc94;
    --c-ok-bg: #11241a;
    --c-ok-line: #24503a;
    --c-ok-solid: #5cc08b;
    --c-verify: #dcbd6f;
    --c-verify-bg: #262011;
    --c-verify-line: #5a4a20;
    --c-verify-solid: #dcbd6f;
    --c-on-solid: #10130f;
    --c-plate-950: #08120f;
    --c-plate-900: #0d1a16;
    --c-plate-800: #12201b;
    --c-plate-700: #173129;
    --c-plate-600: #22463b;
    --c-plate-500: #336353;
    --c-plate-300: #83ab9e;
    --c-plate-100: #172621;
    --c-side-alert: #ff6a2b;
    --c-plate: #173129;
    --c-on-plate: #eef4f1;
    --c-on-plate-2: #b0c8be;
    --c-plate-mark: #dcbf78;
    --c-plate-ov: rgba(0, 0, 0, .25);
    --c-plate-ov-2: rgba(0, 0, 0, .45);
    --c-plate-edge: rgba(255, 255, 255, .12);
    --c-side-bg: #1b1c19;
    --c-side-ink: #e1e3dd;
    --c-side-ink-2: #a3a89f;
    --c-side-name: #f3f4f1;
    --c-side-hover: rgba(255, 255, 250, .05);
    --c-side-active: #24493f;
    --c-side-active-ink: #ffffff;
    --c-side-mark: #d8bb72;
    --c-side-edge: rgba(0, 0, 0, .5);
    --il-ink: #e6e8e3;
    --il-soft: #9ca199;
    --il-faint: #3b4039;
    --il-paper: #20231f;
    --il-surface: #1d201c;
    --il-bg: #181a17;
    --il-glow: #3b3420;
    --il-ok: #63cc94;
    --il-bad: #ff7a3d;
    --v3d-glow: #4a5047;
    --v3d-top: #30332e;
    --v3d-bot: #21231f;
    --tex-plate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75 .9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
    --tex-side: none;
  }
}


/* Compatibilité : l'ancienne échelle noyer suit désormais la plaque de la palette active. */
:root {
  --c-walnut-950: var(--c-plate-950); --c-walnut-900: var(--c-plate-900); --c-walnut-800: var(--c-plate-800);
  --c-walnut-700: var(--c-plate-700); --c-walnut-600: var(--c-plate-600); --c-walnut-500: var(--c-plate-500);
  --c-walnut-300: var(--c-plate-300); --c-walnut-100: var(--c-plate-100);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { min-width: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
p { margin: 0 0 var(--sp-3); max-width: 68ch; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--sp-6) 0; }
::selection { background: color-mix(in srgb, var(--c-brass-500) 40%, var(--c-surface)); color: var(--c-ink); }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Titres : Archivo resserré, comme les marquages frappés d'un boîtier */
h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
  font-family: var(--font-ui);
  font-stretch: var(--stretch-title);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: -0.012em;
  margin: 0;
  color: var(--c-ink);
  text-wrap: balance;
}
h1, .h1 { font-size: var(--fs-4xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
h2, .h2 { font-size: var(--fs-2xl); }
h3, .h3 { font-size: var(--fs-xl); }
h4, .h4 { font-size: var(--fs-lg); letter-spacing: 0; }

.eyebrow, .stamp {
  display: inline-block;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  font-stretch: var(--stretch-stamp);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-mute);
}
.stamp { color: var(--sel-ink); }
.lead { font-size: var(--fs-lg); color: var(--c-ink-2); line-height: 1.5; max-width: 60ch; }
.text-mute { color: var(--c-mute); }
.text-small, small { font-size: var(--fs-sm); }
.mono, code, kbd, samp {
  font-family: var(--font-mono);
  font-size: .92em;
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: 0;
}
kbd {
  padding: 1px 6px; border-radius: var(--r-xs);
  border: 1px solid var(--c-line-strong); border-bottom-width: 2px;
  background: var(--c-surface); font-size: .8em;
}
.num { font-variant-numeric: tabular-nums; }
.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Gabarit applicatif ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "side top" "side main";
  min-height: 100vh;
  min-height: 100dvh;
}
.app__main {
  grid-area: main;
  padding: var(--sp-8) var(--gutter) var(--sp-16);
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin: 0 auto;
}

/* Barre latérale : plaque de la palette (forêt, ardoise ou pierre), inventaire des sections */
.sidebar {
  grid-area: side;
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background-color: var(--c-side-bg);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(0, 0, 0, .12)),
    var(--tex-side);
  color: var(--c-side-ink);
  border-right: 1px solid var(--c-side-edge);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04);
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  min-height: var(--topbar-h);
}
.sidebar__mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #e9cf8f, #b48a37 55%, #7f5d1f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 1px 2px rgba(0, 0, 0, .45);
  color: #1c1708;
}
.sidebar__name {
  font-stretch: 80%; font-weight: var(--fw-bold); font-size: 1.35rem;
  letter-spacing: .01em; color: var(--c-side-name); line-height: 1;
}
.sidebar__tag { font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase; color: var(--c-side-ink-2); font-stretch: 92%; }
.sidebar__section {
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
  font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase;
  color: var(--c-side-ink-2); font-weight: var(--fw-semibold); font-stretch: 92%;
}
.sidebar__nav { display: grid; gap: 2px; padding: 0 var(--sp-3); }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  border: 0; background: none; width: 100%; text-align: left;
  color: var(--c-side-ink); text-decoration: none; cursor: pointer;
  font-weight: var(--fw-medium); font-size: .9375rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast);
  position: relative;
}
.nav-item svg { width: 20px; height: 20px; flex: none; opacity: .82; }
.nav-item:hover { background: var(--c-side-hover); color: var(--c-side-name); }
.nav-item[aria-current="page"], .nav-item[aria-selected="true"] {
  background: var(--c-side-active);
  color: var(--c-side-active-ink);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .22), 0 1px 0 rgba(255, 255, 255, .05);
}
.nav-item[aria-current="page"]::before, .nav-item[aria-selected="true"]::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c-side-mark);
}
.nav-item[aria-current="page"] svg { opacity: 1; color: var(--c-plate-mark); }
.nav-item__count {
  margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--c-side-ink-2); font-variant-numeric: tabular-nums;
}
.nav-item__alert {
  margin-left: auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-side-alert); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-side-alert) 28%, transparent);
}
.nav-item:focus-visible { outline-color: var(--c-side-mark); }
.sidebar__foot { margin-top: auto; padding: var(--sp-4) var(--sp-5) var(--sp-5); font-size: var(--fs-xs); color: var(--c-side-ink-2); }

/* Barre supérieure */
.topbar {
  grid-area: top;
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-4);
  min-height: var(--topbar-h);
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--c-bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--c-line);
}
.topbar__title { font-stretch: var(--stretch-title); font-weight: var(--fw-semibold); font-size: var(--fs-lg); }
.topbar__spacer { flex: 1; }
.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-mute); }
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--c-ink); }
.breadcrumb [aria-current] { color: var(--c-ink); font-weight: var(--fw-medium); }
.sync {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--c-mute);
}
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-ok); }
.sync[data-state="local"]::before { background: var(--c-brass-500); }
.sync[data-state="error"]::before { background: var(--c-safety); }

/* Barre d'onglets mobile (cachée sur grand écran) */
.tabbar { display: none; }

/* D-096 : libellés gardés jusqu'à 900 px (barre plus étroite), rail d'icônes en dessous */
@media (max-width: 1080px) and (min-width: 901px) {
  .app { grid-template-columns: 216px minmax(0, 1fr); }
  .sidebar__brand { padding: var(--sp-4) var(--sp-4) var(--sp-3); }
  .sidebar__nav { padding: 0 var(--sp-2); }
  .nav-item { gap: var(--sp-2); padding: 0 var(--sp-2); font-size: var(--fs-sm); }
  .sidebar__section { padding: var(--sp-3) var(--sp-4) var(--sp-1); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .sidebar__name, .sidebar__tag, .sidebar__section, .nav-item span, .nav-item__count, .sidebar__foot { display: none; }
  .sidebar__brand { justify-content: center; padding: var(--sp-3) 0; }
  .sidebar__nav { padding: 0 var(--sp-2); gap: var(--sp-1); }
  .nav-item { justify-content: center; padding: 0; min-height: 52px; }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item__alert { position: absolute; top: 10px; right: 14px; margin: 0; }
  .nav-item[aria-current="page"]::before { left: -8px; }
}
/* Mobile : barre d'onglets en bas, la barre latérale disparaît */
@media (max-width: 640px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top" "main" "tabs";
  }
  .sidebar { display: none; }
  .app__main { padding: var(--sp-5) var(--sp-4) calc(var(--tabbar-h) + var(--sp-10)); }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-3); }
  .topbar .sync { display: none; }
  .breadcrumb > :not([aria-current]) { display: none; }
  .breadcrumb [aria-current] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabbar {
    grid-area: tabs;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    min-height: var(--tabbar-h);
    padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--c-surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.5) blur(18px);
    backdrop-filter: saturate(1.5) blur(18px);
    border-top: 1px solid var(--c-line);
  }
  .tabbar__item {
    display: grid; justify-items: center; align-content: center; gap: 2px;
    min-height: 52px; border: 0; background: none; cursor: pointer;
    color: var(--c-mute); font-size: 12px; font-weight: var(--fw-medium);
    border-radius: var(--r-md); position: relative; text-decoration: none;
  }
  .tabbar__item svg { width: 22px; height: 22px; }
  .tabbar__item[aria-current="page"] { color: var(--c-ink); }
  .tabbar__item[aria-current="page"] svg { color: var(--sel-ink); }
  .tabbar__item[aria-current="page"]::after {
    content: ""; position: absolute; top: 2px; width: 22px; height: 3px; border-radius: 3px; background: var(--sel);
  }
}

/* Mises en page de contenu */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4) var(--sp-6); margin-bottom: var(--sp-8);
}
.page-head__text { display: grid; gap: var(--sp-2); }
.page-head h1 { font-size: var(--fs-3xl); }
.stack { display: grid; gap: var(--sp-4); align-content: start; }
.stack-lg { display: grid; gap: var(--sp-8); align-content: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--sp-5); }
.split { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: var(--sp-8); align-items: start; }
.split--wide { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
@media (max-width: 900px) { .split, .split--wide { grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); } }
.sticky { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
@media (max-width: 900px) { .sticky { position: static; } }

/* ---------- 4. Boutons ---------- */
.btn {
  --btn-bg: var(--c-surface);
  --btn-fg: var(--c-ink);
  --btn-bd: var(--c-line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: var(--fw-semibold);
  font-size: .9375rem;
  letter-spacing: .005em;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--sh-1);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { --btn-bd: var(--c-ink-2); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary {
  --btn-bg: var(--c-gunmetal);
  --btn-fg: var(--c-on-gunmetal);
  --btn-bd: var(--c-gunmetal);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, 0) 60%);
  box-shadow: var(--sh-press), var(--sh-1);
}
.btn--primary:hover { --btn-bg: var(--c-gunmetal-hi); --btn-bd: var(--c-gunmetal-hi); }
.btn--brass {
  --btn-bg: var(--c-brass-500); --btn-fg: #24170a; --btn-bd: var(--c-brass-600);
  background-image: linear-gradient(180deg, rgba(255, 248, 225, .35), rgba(255, 255, 255, 0) 55%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), var(--sh-1);
}
.btn--danger { --btn-bg: var(--c-surface); --btn-fg: var(--c-safety-ink); --btn-bd: var(--c-safety-line); }
.btn--danger:hover { --btn-bg: var(--c-safety-bg); --btn-bd: var(--c-safety); }
.btn--danger-solid { --btn-bg: var(--c-safety-solid); --btn-fg: var(--c-on-solid); --btn-bd: var(--c-safety-solid); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; box-shadow: none; }
.btn--ghost:hover { --btn-bg: var(--c-surface-3); --btn-bd: transparent; }
.btn--icon { padding: 0; width: var(--tap); }
.btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
@media (pointer: coarse) { .btn--sm { min-height: var(--tap); } }
.btn--lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* ---------- 5. Champs ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-ink-2); display: flex; gap: var(--sp-2); align-items: baseline; }
.field__opt { font-weight: var(--fw-regular); color: var(--c-faint); font-size: var(--fs-xs); }
.field__hint { font-size: var(--fs-xs); color: var(--c-mute); line-height: 1.45; }
.field__error { font-size: var(--fs-xs); color: var(--c-safety-ink); font-weight: var(--fw-medium); display: flex; gap: 6px; align-items: flex-start; }
.field__error::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 1px; border-radius: 50%; background: var(--c-safety) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 3.5v4.2M7 10.1v.2' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.input, .select, .textarea,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.field select, .field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line-strong);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--fs-md);
  box-shadow: var(--sh-inset);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input::placeholder, .input::placeholder, .textarea::placeholder { color: var(--c-faint); }
.field input:hover, .field select:hover, .field textarea:hover, .input:hover { border-color: var(--c-ink-2); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
}
.field select, .select {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px;
  background: var(--c-surface) var(--chevron) right 14px center / 12px 8px no-repeat;
}
.field textarea, .textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field--mono input, .input--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.field[data-state="error"] input, .field[data-state="error"] select, .field[data-state="error"] textarea {
  border-color: var(--c-safety); background: color-mix(in srgb, var(--c-safety-bg) 60%, var(--c-surface));
}
.field[data-state="ok"] input { border-color: var(--c-ok-line); }
/* Saisie avec unité affichée en suffixe : la valeur reste vide, saisie depuis le manuel */
.input-unit { position: relative; display: flex; }
.input-unit input { padding-right: 56px !important; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.input-unit__u {
  position: absolute; right: 1px; top: 1px; bottom: 1px;
  display: grid; place-items: center; padding: 0 12px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--c-mute);
  border-left: 1px solid var(--c-line); background: var(--c-surface-2);
  border-radius: 0 calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0;
  pointer-events: none;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--sp-5) var(--sp-5); }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .form-grid--2 { grid-template-columns: minmax(0, 1fr); } }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--sp-4); }
.fieldset legend { padding: 0; margin-bottom: var(--sp-3); }

/* Case à cocher, bouton radio, interrupteur */
.check { display: flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; min-height: var(--tap); padding: 10px 0; }
.check input[type="checkbox"], .check input[type="radio"], input.checkbox {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 22px; height: 22px; margin: 1px 0 0;
  border: 1.5px solid var(--c-line-strong); border-radius: 6px;
  background: var(--c-surface); box-shadow: var(--sh-inset);
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.check input[type="radio"] { border-radius: 50%; }
.check input:hover { border-color: var(--c-ink-2); }
.check input:checked, input.checkbox:checked { background: var(--c-gunmetal); border-color: var(--c-gunmetal); }
.check input[type="checkbox"]:checked::after, input.checkbox:checked::after {
  content: ""; width: 12px; height: 7px; margin-top: -3px;
  border-left: 2.2px solid var(--c-on-gunmetal); border-bottom: 2.2px solid var(--c-on-gunmetal);
  transform: rotate(-45deg);
}
.check input[type="radio"]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-on-gunmetal); }
.check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check__text { display: grid; gap: 2px; }
.check__text small { color: var(--c-mute); font-size: var(--fs-sm); }

.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: var(--tap); }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 44px; height: 26px; border-radius: var(--r-pill); margin: 0;
  background: var(--c-line-strong); position: relative; cursor: pointer;
  transition: background var(--t-med) var(--ease);
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform var(--t-med) var(--ease-out);
}
.switch input:checked { background: var(--c-ok); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Curseur (ex. vue éclatée) : rail usiné, poussoir laiton */
.range { width: 100%; appearance: none; -webkit-appearance: none; background: none; height: var(--tap); margin: 0; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--c-brass-500) var(--fill, 50%), var(--c-line-strong) 0); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--c-line-strong); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--c-brass-500); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e3ad, #c49a43 60%, #8a6524);
  border: 1px solid rgba(0, 0, 0, .25); box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e3ad, #c49a43 60%, #8a6524);
  border: 1px solid rgba(0, 0, 0, .25); box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 40%, transparent); }

/* ---------- 6. Onglets ---------- */
/* Commande segmentée (filtres, vues) */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: calc(var(--r-md) + 3px);
  background: var(--c-surface-3);
  box-shadow: var(--sh-inset);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button, .segmented [role="tab"] {
  flex: none;
  min-height: 38px; padding: 0 var(--sp-4); border: 0; border-radius: var(--r-md);
  background: none; color: var(--c-mute); cursor: pointer; white-space: nowrap;
  font-weight: var(--fw-semibold); font-size: var(--fs-sm);
  transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
@media (pointer: coarse) { .segmented button, .segmented [role="tab"] { min-height: var(--tap); } }
.segmented button:hover { color: var(--c-ink); }
.segmented [aria-selected="true"], .segmented [aria-pressed="true"] {
  background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-2);
}
/* Onglets soulignés (sections d'une fiche) */
.tabs {
  display: flex; gap: var(--sp-1);
  border-bottom: 1px solid var(--c-line);
  overflow-x: auto; scrollbar-width: none;
  margin-bottom: var(--sp-6);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"], .tabs button {
  flex: none;
  position: relative; min-height: 48px; padding: 0 var(--sp-4);
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: var(--c-mute); font-weight: var(--fw-semibold); font-size: .9375rem;
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.tabs [role="tab"]:hover { color: var(--c-ink); }
.tabs [aria-selected="true"] { color: var(--c-ink); }
.tabs [aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: -1px; height: 2px;
  background: var(--c-ink); border-radius: 2px 2px 0 0;
}
.tabs .badge { margin-left: 2px; }

/* ---------- 7. Cartes ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: clamp(var(--sp-4), 2.4vw, var(--sp-6));
}
.card--flat { box-shadow: none; }
.card--raised { box-shadow: var(--sh-2); border-color: transparent; }
.card--sunk { background: var(--c-surface-2); box-shadow: var(--sh-inset); }
.card--interactive { cursor: pointer; transition: box-shadow var(--t-med) var(--ease), border-color var(--t-med), transform var(--t-med) var(--ease); text-align: left; width: 100%; font: inherit; color: inherit; }
.card--interactive:hover { box-shadow: var(--sh-3); border-color: var(--c-line-strong); transform: translateY(-1px); }
.card--interactive[aria-current="true"], .card--interactive[aria-pressed="true"] {
  border-color: var(--c-brass-500);
  box-shadow: 0 0 0 1px var(--c-brass-500), var(--sh-2);
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card__title { font-size: var(--fs-lg); font-stretch: var(--stretch-title); font-weight: var(--fw-semibold); letter-spacing: -0.005em; }
.card__sub { font-size: var(--fs-sm); color: var(--c-mute); margin-top: 2px; }
.card__foot { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--c-line); display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.card__media { margin: calc(-1 * clamp(var(--sp-4), 2.4vw, var(--sp-6))); margin-bottom: var(--sp-4); border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; }
/* Plaque de la palette : en-tête de râtelier, fiche d'arme (noms historiques .card--wood et .plate-wood conservés) */
.card--wood, .plate-wood, .plate {
  background-color: var(--c-plate);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .22)), var(--tex-plate);
  color: var(--c-on-plate); border-color: rgba(0, 0, 0, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), var(--sh-2);
}
.card--wood h1, .card--wood h2, .card--wood h3, .plate-wood h1, .plate-wood h2, .plate-wood h3, .plate h1, .plate h2, .plate h3 { color: var(--c-on-plate); }
.card--wood .text-mute, .plate-wood .text-mute, .plate .text-mute { color: var(--c-on-plate-2); }
/* Plaque gravée (numéro de série, calibre) */
.engraved {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--r-sm);
  background: linear-gradient(180deg, #2a3138, #1b2026);
  color: #cfd5da; border: 1px solid #0c0f12;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .6);
}

/* Carte d'arme du râtelier */
.weapon-card { display: grid; grid-template-rows: auto 1fr; padding: 0; overflow: hidden; }
.weapon-card__fig {
  aspect-ratio: 16 / 7; position: relative;
  background:
    radial-gradient(120% 90% at 50% 10%, color-mix(in srgb, var(--c-surface) 92%, var(--c-brass-100)), var(--c-surface-2));
  border-bottom: 1px solid var(--c-line);
  display: grid; place-items: center;
}
.weapon-card__fig { padding: 5% 4%; }
:root[data-theme="dark"] .weapon-card__fig, :root[data-theme="dark"] .v3d__fallback { --fig-rim: drop-shadow(0 0 .6px rgba(255, 255, 255, .45)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .weapon-card__fig, :root:not([data-theme="light"]) .v3d__fallback { --fig-rim: drop-shadow(0 0 .6px rgba(255, 255, 255, .45)); } }
.weapon-card__fig svg, .v3d__fallback svg { filter: var(--fig-rim, none); }
.weapon-card__fig svg { width: 100%; height: 100%; }
.weapon-card__body { padding: var(--sp-4) var(--sp-5) var(--sp-5); display: grid; gap: var(--sp-2); }
.weapon-card__name { font-size: var(--fs-lg); font-stretch: var(--stretch-title); font-weight: var(--fw-semibold); }
.weapon-card__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.weapon-card--add {
  border: 1.5px dashed var(--c-line-strong); background: transparent; box-shadow: none;
  display: grid; place-items: center; min-height: 220px; color: var(--c-mute); gap: var(--sp-2);
}
.weapon-card--add:hover { border-color: var(--c-ink-2); color: var(--c-ink); }

/* Statistiques (tuiles) */
.stat { display: grid; gap: 2px; }
.stat__label { font-size: var(--fs-xs); color: var(--c-mute); font-weight: var(--fw-medium); }
.stat__value { font-size: var(--fs-2xl); font-stretch: 88%; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.1; }
.stat__unit { font-size: var(--fs-sm); color: var(--c-mute); font-weight: var(--fw-medium); margin-left: 3px; }

/* Liste de définitions (caractéristiques) */
.specs { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr) auto; margin: 0; }
.specs > div { display: contents; }
.specs dt, .specs dd { padding: 12px 0; border-top: 1px solid var(--c-line); margin: 0; }
.specs > div:first-child dt, .specs > div:first-child dd { border-top: 0; }
.specs dt { color: var(--c-mute); font-size: var(--fs-sm); padding-right: var(--sp-4); }
.specs dd { font-weight: var(--fw-medium); }
.specs dd:last-child { padding-left: var(--sp-3); text-align: right; }
@media (max-width: 600px) {
  .specs { grid-template-columns: minmax(0, 1fr) auto; }
  .specs dt { grid-column: 1 / -1; padding-bottom: 0; }
  .specs dd { border-top: 0; padding-top: 4px; }
}

/* ---------- 8. Alertes ---------- */
.alert {
  --a-bg: var(--c-info-bg); --a-bd: var(--c-line); --a-ic: var(--c-ink-2); --a-fg: var(--c-ink);
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: var(--sp-3);
  align-items: start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--a-bg);
  border: 1px solid var(--a-bd);
  color: var(--a-fg);
  font-size: .9375rem; line-height: 1.5;
}
.alert__icon { width: 22px; height: 22px; color: var(--a-ic); margin-top: 1px; }
.alert__title { font-weight: var(--fw-semibold); margin: 0 0 2px; font-size: .9375rem; }
.alert__body p { margin: 0; }
.alert__body ul { margin: 6px 0 0; padding-left: 18px; }
.alert__body li + li { margin-top: 2px; }
.alert--ok { --a-bg: var(--c-ok-bg); --a-bd: var(--c-ok-line); --a-ic: var(--c-ok); }
.alert--verify { --a-bg: var(--c-verify-bg); --a-bd: var(--c-verify-line); --a-ic: var(--c-verify); }
.alert--danger {
  --a-bg: var(--c-safety-bg); --a-bd: var(--c-safety-line); --a-ic: var(--c-safety);
  border-left: 4px solid var(--c-safety);
  padding-left: calc(var(--sp-4) - 3px);
}
.alert--danger .alert__title { color: var(--c-safety-ink); }
/* Bandeau de blocage : l'action est refusée tant que la condition n'est pas levée */
.alert--block {
  --a-bg: var(--c-safety-solid); --a-bd: var(--c-safety-solid); --a-ic: var(--c-on-solid); --a-fg: var(--c-on-solid);
  /* D-093 : fond uni (les rayures gênaient la lecture), texte plus grand et gras */
  background-image: none;
  box-shadow: var(--sh-2);
  font-size: var(--fs-md); font-weight: var(--fw-medium);
}
.alert--block .alert__title { color: var(--c-on-solid); font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.alert--block a { color: inherit; text-decoration-thickness: 2px; }

/* ---------- 9. Badges ---------- */
.badge {
  --b-bg: var(--c-surface-3); --b-fg: var(--c-ink-2); --b-bd: transparent;
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-bd);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .01em;
  white-space: nowrap; line-height: 1;
}
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { --b-bg: var(--c-ok-bg); --b-fg: var(--c-ok); --b-bd: var(--c-ok-line); }
.badge--verify { --b-bg: var(--c-verify-bg); --b-fg: var(--c-verify); --b-bd: var(--c-verify-line); border-style: dashed; }
.badge--danger { --b-bg: var(--c-safety-bg); --b-fg: var(--c-safety-ink); --b-bd: var(--c-safety-line); }
.badge--solid { --b-bg: var(--c-gunmetal); --b-fg: var(--c-on-gunmetal); }
.badge--brass { --b-bg: linear-gradient(180deg, #ecd394, #c39a45); --b-fg: #2a1b08; background: linear-gradient(180deg, #ecd394, #c39a45); }
.badge--mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: .02em; border-radius: var(--r-xs); }

/* ---------- 10. Tableaux ---------- */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-lg);
  background: var(--c-surface); box-shadow: var(--sh-1);
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--c-line); }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--c-surface-2);
  font-size: var(--fs-2xs); letter-spacing: .1em; text-transform: uppercase; font-stretch: 92%;
  color: var(--c-mute); font-weight: var(--fw-semibold); white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--c-surface-2); }
.table tbody tr[aria-selected="true"] { background: var(--c-brass-100); box-shadow: inset 3px 0 0 var(--c-brass-500); }
.table .n, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: .8125rem; }
.table .act { width: 1%; white-space: nowrap; text-align: right; }
.table--dense th, .table--dense td { padding: 8px 12px; }
/* Sur mobile : chaque ligne devient une carte (ajouter data-label aux td) */
@media (max-width: 560px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-line); }
  .table--cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: var(--sp-4); text-align: right; }
  .table--cards td::before { content: attr(data-label); color: var(--c-mute); font-size: var(--fs-xs); text-align: left; font-family: var(--font-ui); }
  .table--cards td.act { justify-content: flex-end; }
  .table--cards td.act::before { content: none; }
}

/* ---------- 11. Jauges (limites légales, stocks) ---------- */
/* Usage : <div class="gauge" style="--value:.62" data-level="ok|near|over"> */
.gauge { --value: 0; --warn-at: .8; display: grid; gap: var(--sp-2); }
.gauge__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.gauge__label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.gauge__value { font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--c-ink-2); }
.gauge__track {
  position: relative; height: 14px; border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), color-mix(in srgb, var(--c-ink) 18%, transparent) calc(10% - 1px) 10%) 0 100% / 100% 5px no-repeat,
    var(--c-sunk);
  box-shadow: var(--sh-inset);
  overflow: hidden;
}
/* zone d'approche de la limite, hachurée */
.gauge__track::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--warn-at) * 100%); right: 0;
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c-safety) 16%, transparent) 0 4px, transparent 4px 8px);
}
.gauge__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: calc(min(var(--value), 1) * 100%);
  background: linear-gradient(180deg, #59646f, #2c343c);
  border-radius: 3px 0 0 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: width var(--t-slow) var(--ease-out);
}
:root[data-theme="dark"] .gauge__fill { background: linear-gradient(180deg, #c9d0d6, #8f9aa4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gauge__fill { background: linear-gradient(180deg, #c9d0d6, #8f9aa4); } }
.gauge[data-level="near"] .gauge__fill { background: linear-gradient(180deg, #d7b060, #a47c2c); }
.gauge[data-level="over"] .gauge__fill { background: linear-gradient(180deg, #ff8a52, var(--c-safety)); }
.gauge__scale { display: flex; justify-content: space-between; font-size: var(--fs-2xs); color: var(--c-faint); font-family: var(--font-mono); }
.gauge__note { font-size: var(--fs-xs); color: var(--c-mute); }
.gauge[data-level="over"] .gauge__note { color: var(--c-safety-ink); font-weight: var(--fw-semibold); }
/* Jauge circulaire (tableau de bord) */
.dial {
  --value: 0; --size: 132px; --col: var(--c-gunmetal);
  width: var(--size); aspect-ratio: 1; border-radius: 50%; position: relative; flex: none;
  background:
    radial-gradient(closest-side, var(--c-surface) 76%, transparent 77% 100%),
    conic-gradient(from -135deg, var(--col) calc(var(--value) * 270deg), var(--c-sunk) 0 270deg, transparent 0);
  display: grid; place-items: center; text-align: center;
}
.dial[data-level="near"] { --col: var(--c-brass-500); }
.dial[data-level="over"] { --col: var(--c-safety); }
.dial__v { font-size: var(--fs-xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; font-stretch: 88%; line-height: 1; }
.dial__l { font-size: var(--fs-2xs); color: var(--c-mute); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }

/* Barre de progression simple */
.progress { height: 6px; border-radius: 6px; background: var(--c-sunk); overflow: hidden; }
.progress > i { display: block; height: 100%; width: calc(var(--value, 0) * 100%); background: var(--c-brass-500); border-radius: inherit; transition: width var(--t-slow) var(--ease-out); }

/* ---------- 12. Dialogues ---------- */
dialog.dialog, .dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--c-line); border-radius: var(--r-xl);
  background: var(--c-surface); color: var(--c-ink);
  box-shadow: var(--sh-3), 0 0 0 1px rgba(0, 0, 0, .04);
  overflow: hidden;
}
dialog.dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: dlg-in var(--t-med) var(--ease-out); }
dialog.dialog::backdrop { background: rgba(10, 13, 16, .48); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in var(--t-med) var(--ease); }
.dialog__head { padding: var(--sp-6) var(--sp-6) var(--sp-3); display: flex; gap: var(--sp-3); align-items: flex-start; justify-content: space-between; }
.dialog__head h2 { font-size: var(--fs-xl); }
.dialog__body { padding: 0 var(--sp-6) var(--sp-5); overflow-y: auto; }
.dialog__foot {
  padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--c-line);
  background: var(--c-surface-2); display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: flex-end;
}
.dialog--danger .dialog__head h2 { color: var(--c-safety-ink); }
@media (max-width: 560px) {
  dialog.dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; }
  dialog.dialog[open] { animation: sheet-in var(--t-slow) var(--ease-out); }
  .dialog__foot .btn { flex: 1; }
}
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes sheet-in { from { transform: translateY(40%); opacity: .4; } }
@keyframes fade-in { from { opacity: 0; } }

/* Menu contextuel / liste déroulante */
.menu { min-width: 220px; padding: var(--sp-1); border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: var(--sh-3); }
.menu button { display: flex; width: 100%; gap: var(--sp-3); align-items: center; min-height: 40px; padding: 0 var(--sp-3); border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.menu button:hover { background: var(--c-surface-3); }

/* Notification passagère (D-091) : pile de trois au plus, en pause au survol, bouton de fermeture */
.toasts {
  position: fixed; left: 50%; bottom: calc(var(--sp-6) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  position: relative; pointer-events: auto;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px 10px 10px 18px; border-radius: var(--r-lg); max-width: 100%;
  background: var(--c-gunmetal); color: var(--c-on-gunmetal); box-shadow: var(--sh-3);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.4;
  animation: dlg-in var(--t-med) var(--ease-out);
}
body > .toast { position: fixed; left: 50%; bottom: var(--sp-6); transform: translateX(-50%); z-index: 100; }
.toast__icon { width: 20px; height: 20px; flex: none; }
.toast__text { flex: 1; }
.toast__close {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: inherit; cursor: pointer;
}
.toast__close:hover { background: rgba(255, 255, 255, .24); }
.toast__close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
/* Téléphone : en haut, sous la barre supérieure, pour ne couvrir ni la barre du bas ni les boutons d'action */
@media (max-width: 640px) { .toasts { top: calc(var(--topbar-h) + var(--sp-2)); bottom: auto; width: calc(100vw - 24px); } .toast { width: 100%; } }

/* ---------- 13. Check-lists et étapes ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; }
.checklist__item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: var(--sp-3);
  align-items: start; padding: var(--sp-4) 0;
  border-top: 1px solid var(--c-line);
}
.checklist__item:first-child { border-top: 0; }
.checklist__box {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer;
  border: 1.5px solid var(--c-line-strong); background: var(--c-surface); box-shadow: var(--sh-inset);
  display: grid; place-items: center; position: relative;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.checklist__box::before { content: ""; position: absolute; inset: -9px; } /* zone tactile 44 px */
.checklist__box:checked { background: var(--c-ok); border-color: var(--c-ok); }
.checklist__box:checked::after {
  content: ""; width: 13px; height: 7px; margin-top: -3px;
  border-left: 2.4px solid #fff; border-bottom: 2.4px solid #fff; transform: rotate(-45deg);
}
.checklist__box:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.checklist__title { font-weight: var(--fw-semibold); line-height: 1.35; }
.checklist__desc { color: var(--c-mute); font-size: var(--fs-sm); margin-top: 2px; }
.checklist__item[data-state="done"] .checklist__title { color: var(--c-mute); }
.checklist__item[data-state="blocked"] { background: linear-gradient(90deg, var(--c-safety-bg), transparent 70%); border-radius: var(--r-sm); padding-left: var(--sp-2); margin-left: calc(-1 * var(--sp-2)); }
.checklist__item[data-state="blocked"] .checklist__box { border-color: var(--c-safety); }

/* Parcours d'étapes (rechargement, formation, montage de lunette) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center;
  width: 100%; min-height: 48px; padding: 6px var(--sp-3) 6px var(--sp-2);
  border: 0; border-radius: var(--r-md); background: none; text-align: left; cursor: pointer;
  color: var(--c-ink-2); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  position: relative;
  transition: background var(--t-fast);
}
.step:hover { background: var(--c-surface-3); color: var(--c-ink); }
.step__no {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600;
  border: 1.5px solid var(--c-line-strong); color: var(--c-mute); background: var(--c-surface);
}
.step[aria-current="step"], .step[aria-current="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-2); }
.step[aria-current="step"] .step__no, .step[aria-current="true"] .step__no { border-color: var(--c-gunmetal); background: var(--c-gunmetal); color: var(--c-on-gunmetal); }
.step[data-state="done"] .step__no { border-color: var(--c-ok-solid); background: var(--c-ok-solid); color: var(--c-on-solid); font-size: 0; }
.step[data-state="done"] .step__no::after { content: ""; width: 10px; height: 5px; margin-top: -2px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg); }
.step[data-state="blocked"] .step__no { border-color: var(--c-safety); color: var(--c-safety-ink); }
/* fil vertical reliant les étapes */
.steps--rail .step:not(:last-child)::after {
  content: ""; position: absolute; left: calc(var(--sp-2) + 14px); top: 40px; height: calc(100% - 30px); width: 1.5px;
  background: var(--c-line);
}
/* Indicateur horizontal compact (mobile) */
.stepper { display: flex; gap: 4px; }
.stepper i { flex: 1; height: 4px; border-radius: 4px; background: var(--c-line); }
.stepper i[data-state="done"] { background: var(--c-ok); }
.stepper i[data-state="current"] { background: var(--c-gunmetal); }

/* Fiche d'étape (illustration + contenu) */
.step-sheet { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
@media (max-width: 900px) { .step-sheet { grid-template-columns: minmax(0, 1fr); } }
.step-sheet__k { font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--c-mute); font-weight: var(--fw-semibold); margin-bottom: 4px; }
.step-sheet dl { display: grid; gap: var(--sp-4); margin: 0; }
.step-sheet dd { margin: 0; }

/* ---------- 14. Illustrations ---------- */
.illus {
  position: relative;
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 80% at 50% 25%, var(--c-surface), var(--c-surface-2));
  border: 1px solid var(--c-line);
  overflow: hidden;
  color: var(--il-ink);
  --il-bg: var(--c-surface);
}
.illus > svg { width: 100%; height: auto; display: block; }
.illus__cap { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--c-line); font-size: var(--fs-xs); color: var(--c-mute); background: var(--c-surface); }
.illus--bare { background: none; border: 0; border-radius: 0; }

/* ---------- 15. Visionneuse 3D ---------- */
.v3d {
  position: relative;
  aspect-ratio: 16 / 8;
  min-height: 260px;
  border-radius: var(--r-xl);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(70% 70% at 50% 38%, var(--v3d-glow), transparent 72%),
    linear-gradient(180deg, var(--v3d-top), var(--v3d-bot));
  border: 1px solid var(--c-line);
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
  cursor: grab;
  outline-offset: 3px;
}
.v3d:active { cursor: grabbing; }
.v3d:focus-visible { outline: 2px solid var(--focus); }
@media (max-width: 640px) { .v3d { aspect-ratio: 4 / 3; border-radius: var(--r-lg); } }
.v3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.v3d__labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.v3d-label {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, calc(-100% - var(--lead, 30px)));
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--c-surface) 90%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--c-line);
  box-shadow: var(--sh-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--c-ink);
  white-space: nowrap;
  transition: opacity var(--t-med) var(--ease);
  z-index: 1;
}
.v3d-label:not(.v3d-label--soft) { z-index: 2; }
.v3d-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-brass-500); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-brass-500) 30%, transparent); }
.v3d-label::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: var(--lead, 30px);
  background: linear-gradient(var(--c-ink-2), color-mix(in srgb, var(--c-ink-2) 30%, transparent));
}
.v3d-label__dot { position: absolute; left: 50%; top: calc(100% + var(--lead, 30px)); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c-brass-500); border: 2px solid var(--c-surface); box-shadow: 0 0 0 1px var(--c-ink-2); }
.v3d-label[data-below] { transform: translate(-50%, var(--lead, 30px)); }
.v3d-label[data-below]::after { top: auto; bottom: 100%; background: linear-gradient(color-mix(in srgb, var(--c-ink-2) 30%, transparent), var(--c-ink-2)); }
.v3d-label[data-below] .v3d-label__dot { top: auto; bottom: calc(100% + var(--lead, 30px)); margin: 0 0 -4.5px -4.5px; }
.v3d-label--soft { opacity: .92; font-weight: var(--fw-medium); }
.v3d-label--soft::before { background: var(--c-faint); box-shadow: none; }
.v3d__tools {
  position: absolute; right: var(--sp-3); bottom: var(--sp-3); z-index: 3;
  display: flex; gap: 2px; padding: 3px;
  border-radius: calc(var(--r-md) + 3px);
  background: color-mix(in srgb, var(--c-surface) 82%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.3); backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--c-line);
  box-shadow: var(--sh-2);
}
.v3d__tools button {
  width: var(--tap); height: var(--tap); border: 0; border-radius: var(--r-md);
  background: none; color: var(--c-ink-2); cursor: pointer; display: grid; place-items: center;
}
.v3d__tools button:hover { background: var(--c-surface-3); color: var(--c-ink); }
.v3d__tools button[aria-pressed="true"] { color: var(--sel-ink); background: var(--c-brass-100); }
.v3d__tools svg { width: 20px; height: 20px; }
.v3d__tools .sep { width: 1px; margin: 8px 2px; background: var(--c-line); }
@media (max-width: 480px) { .v3d__tools .opt { display: none; } }
.v3d__hint {
  position: absolute; left: var(--sp-4); top: var(--sp-3); z-index: 3;
  font-size: var(--fs-xs); color: var(--c-mute); pointer-events: none;
  display: flex; align-items: center; gap: 6px;
  transition: opacity var(--t-slow) var(--ease);
}
.v3d__hint[data-hidden] { opacity: 0; }
@media (max-width: 560px) { .v3d__hint { display: none; } }
.v3d__fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--sp-6) var(--sp-4) var(--sp-10); }
.v3d__fallback svg { width: 100%; height: 100%; }
.v3d__note { position: absolute; left: var(--sp-4); top: var(--sp-3); font-size: var(--fs-xs); color: var(--c-mute); z-index: 3; }
.v3d[data-mode="fallback"] { cursor: default; }

/* ---------- 16. Divers ---------- */
.empty {
  display: grid; place-items: center; text-align: center; gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-6);
  border: 1.5px dashed var(--c-line-strong); border-radius: var(--r-lg); color: var(--c-mute);
}
.empty svg { width: 120px; height: auto; color: var(--c-faint); }
.divider-label { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--c-mute); font-weight: var(--fw-semibold); }
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--c-line); }
.source { font-size: var(--fs-xs); color: var(--c-mute); }
.source a { color: inherit; }
.legal-foot { font-size: var(--fs-xs); color: var(--c-faint); max-width: 80ch; margin-top: var(--sp-12); padding-top: var(--sp-5); border-top: 1px solid var(--c-line); }
.skeleton { background: linear-gradient(90deg, var(--c-surface-3), var(--c-surface-2), var(--c-surface-3)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.skip-link { position: absolute; left: var(--sp-3); top: -60px; z-index: 200; padding: 10px 16px; border-radius: var(--r-md); background: var(--c-gunmetal); color: var(--c-on-gunmetal); }
.skip-link:focus { top: var(--sp-3); }

/* ---------- 17. Impression (fiches, étiquettes, export) ---------- */
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .tabbar, .v3d__tools, .btn, .toast, .toasts, .m-rack, .skip-link, .m-shell__foot, .no-print { display: none !important; }
  .app { display: block; }
  .app__main { padding: 0; max-width: none; }
  .print-only { display: block !important; }
  .table-wrap { overflow: visible; border: 0; }
  .table-wrap > table, .table { font-size: 9.5pt; }
  .table-wrap > table thead th { position: static; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
  .illus { break-inside: avoid; }
}


/* ==========================================================================
   19. Contrat d'interface commun (docs/CONTRATS.md §2)
   Noms imposés, utilisés tels quels par tous les modules. Ils s'appuient
   sur les jetons ci-dessus : un seul système, deux vocabulaires.
   ========================================================================== */
:root {
  --bg: var(--c-bg);
  --surface: var(--c-surface);
  --surface-2: var(--c-surface-2);
  --line: var(--c-line);
  --ink: var(--c-ink);
  --ink-2: var(--c-mute);
  --plate: var(--c-plate);             /* plaque de la palette (barre latérale, bandeau) */
  --walnut: var(--c-plate-600);        /* alias historique de --plate, conservé pour compatibilité */
  --steel: var(--c-gunmetal);
  --brass: var(--c-brass-500);
  --accent: var(--c-safety);          /* orange de sécurité */
  --ok: var(--c-ok);
  --warn: var(--c-verify);
  --stop: var(--c-safety-ink);
  --radius: var(--r-md);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --font-display: var(--font-ui);
  --font-text: var(--font-ui);
}

/* Mise en page */
.page { width: 100%; max-width: var(--content-max); margin: 0 auto; display: grid; gap: var(--sp-8); align-content: start; }
.cols { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: var(--sp-8); align-items: start; }
.cols--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 820px) { .cols, .cols--even { grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); } }
.side { display: grid; gap: var(--sp-3); align-content: start; position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
@media (max-width: 820px) { .side { position: static; } }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card-head h2, .card-head h3 { font-size: var(--fs-xl); }
.card-head p { margin: 4px 0 0; color: var(--c-mute); font-size: var(--fs-sm); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--sp-5); }
.card + .card { margin-top: 0; }

/* Champ : <label class="field">Libellé<input>…<small>aide</small></label> */
.field { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-ink-2); }
.field > input, .field > select, .field > textarea { font-weight: var(--fw-regular); color: var(--c-ink); }
.field > small, .field .hint { font-size: var(--fs-xs); font-weight: var(--fw-regular); color: var(--c-mute); line-height: 1.45; }

/* Boutons */
.btn-primary { --btn-bg: var(--c-gunmetal); --btn-fg: var(--c-on-gunmetal); --btn-bd: var(--c-gunmetal); background-image: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, 0) 60%); box-shadow: var(--sh-press), var(--sh-1); }
.btn-primary:hover { --btn-bg: var(--c-gunmetal-hi); --btn-bd: var(--c-gunmetal-hi); }
.btn-danger { --btn-bg: var(--c-surface); --btn-fg: var(--c-safety-ink); --btn-bd: var(--c-safety-line); }
.btn-danger:hover { --btn-bg: var(--c-safety-bg); --btn-bd: var(--c-safety); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; box-shadow: none; }
.btn-ghost:hover { --btn-bg: var(--c-surface-3); --btn-bd: transparent; }

/* Étiquettes d'état (= badges) */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); background: var(--c-surface-3); color: var(--c-ink-2);
  border: 1px solid transparent; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  white-space: nowrap; line-height: 1;
}
.tag-ok { background: var(--c-ok-bg); color: var(--c-ok); border-color: var(--c-ok-line); }
.tag-warn { background: var(--c-verify-bg); color: var(--c-verify); border-color: var(--c-verify-line); border-style: dashed; }
.tag-stop { background: var(--c-safety-bg); color: var(--c-safety-ink); border-color: var(--c-safety-line); }
.tag-ok::before, .tag-warn::before, .tag-stop::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Alertes : .alert-ok, .alert-warn, .alert-stop (contenu libre ou structure .alert__*) */
.alert:not(:has(.alert__icon)) { display: block; }
.alert > b:first-child, .alert > strong:first-child { font-weight: var(--fw-semibold); }
.alert-ok { --a-bg: var(--c-ok-bg); --a-bd: var(--c-ok-line); --a-ic: var(--c-ok); }
.alert-warn { --a-bg: var(--c-verify-bg); --a-bd: var(--c-verify-line); --a-ic: var(--c-verify); }
.alert-stop { --a-bg: var(--c-safety-bg); --a-bd: var(--c-safety-line); --a-ic: var(--c-safety); border-left: 4px solid var(--c-safety); padding-left: calc(var(--sp-4) - 3px); }
.alert-stop > b:first-child, .alert-stop > strong:first-child, .alert-stop .alert__title { color: var(--c-safety-ink); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert p { margin: 0; }
.alert p + p { margin-top: 6px; }

/* Jauge simple : <div class="meter" data-level="near|over"><i style="width:62%"></i></div> */
.meter {
  position: relative; height: 10px; border-radius: 3px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), color-mix(in srgb, var(--c-ink) 16%, transparent) calc(10% - 1px) 10%) 0 100% / 100% 4px no-repeat,
    var(--c-sunk);
  box-shadow: var(--sh-inset);
}
.meter > i { display: block; height: 100%; width: 0; border-radius: 3px 0 0 3px; background: linear-gradient(180deg, #59646f, #2c343c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); transition: width var(--t-slow) var(--ease-out); }
:root[data-theme="dark"] .meter > i { background: linear-gradient(180deg, #c9d0d6, #8f9aa4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .meter > i { background: linear-gradient(180deg, #c9d0d6, #8f9aa4); } }
.meter[data-level="near"] > i, .meter.near > i { background: linear-gradient(180deg, #d7b060, #a47c2c); }
.meter[data-level="over"] > i, .meter.over > i, .meter.hot > i { background: linear-gradient(180deg, #ff8a52, var(--c-safety)); }

/* Check-list : <ul class="checklist"><li><label class="check"><input type="checkbox"><span>…</span></label></li></ul> */
.checklist > li { border-top: 1px solid var(--c-line); }
.checklist > li:first-child { border-top: 0; }
.checklist .check { padding: var(--sp-3) 0; }
.checklist .check b, .checklist .check strong { font-weight: var(--fw-semibold); display: block; }
.checklist .check small { display: block; color: var(--c-mute); font-size: var(--fs-sm); }
.checklist li[data-state="blocked"] .check input { border-color: var(--c-safety); }
.check input[type="checkbox"]:checked { background: var(--c-ok-solid); border-color: var(--c-ok-solid); }
.check input[type="checkbox"]:checked::after { border-color: var(--c-on-solid); }

/* Tableaux nus dans .table-wrap */
.table-wrap > table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table-wrap > table th, .table-wrap > table td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--c-line); }
.table-wrap > table thead th { position: sticky; top: 0; background: var(--c-surface-2); font-size: var(--fs-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--c-mute); font-weight: var(--fw-semibold); white-space: nowrap; }
.table-wrap > table tbody tr:last-child td { border-bottom: 0; }
.table-wrap > table tbody tr:hover { background: var(--c-surface-2); }
.table-wrap > table .n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: .8125rem; }

/* Onglets : <div class="tabs" role="tablist"><button class="tab" role="tab" aria-selected="true"> */
.tab {
  flex: none;
  position: relative; min-height: 48px; padding: 0 var(--sp-4); border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: var(--c-mute); font-weight: var(--fw-semibold); font-size: .9375rem; display: inline-flex; align-items: center; gap: var(--sp-2);
}
.tab:hover { color: var(--c-ink); }
.tab[aria-selected="true"], .tab.on { color: var(--c-ink); }
.tab[aria-selected="true"]::after, .tab.on::after { content: ""; position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: -1px; height: 2px; background: var(--c-ink); border-radius: 2px 2px 0 0; }

/* Parcours : .stepper contient des .step (boutons) ou des <i> (barre compacte) */
.stepper:has(.step) { display: grid; gap: 2px; }
.step.on, .step[aria-selected="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-2); }
.step.on .step__no, .step[aria-selected="true"] .step__no { border-color: var(--c-gunmetal); background: var(--c-gunmetal); color: var(--c-on-gunmetal); }
.step.done .step__no { border-color: var(--c-ok-solid); background: var(--c-ok-solid); color: var(--c-on-solid); }

/* Quiz */
.quiz { display: grid; gap: var(--sp-4); }
.quiz__q { font-size: var(--fs-lg); font-weight: var(--fw-semibold); font-stretch: var(--stretch-title); line-height: 1.3; }
.quiz__choices, .quiz ol, .quiz ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); counter-reset: q; }
.quiz button.choice, .quiz .choice {
  counter-increment: q; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: var(--sp-3); align-items: center;
  width: 100%; min-height: 52px; padding: 10px 14px; text-align: left; cursor: pointer;
  border: 1px solid var(--c-line-strong); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-ink);
  font-size: .9375rem; transition: border-color var(--t-fast), background var(--t-fast);
}
.quiz .choice::before {
  content: counter(q, upper-alpha); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; border: 1.5px solid var(--c-line-strong); color: var(--c-mute);
}
.quiz .choice:hover { border-color: var(--c-ink-2); }
.quiz .choice[aria-pressed="true"] { border-color: var(--c-gunmetal); box-shadow: 0 0 0 1px var(--c-gunmetal); }
.quiz .choice.good, .quiz .choice[data-result="good"] { border-color: var(--c-ok); background: var(--c-ok-bg); }
.quiz .choice.good::before, .quiz .choice[data-result="good"]::before { background: var(--c-ok-solid); border-color: var(--c-ok-solid); color: var(--c-on-solid); }
.quiz .choice.bad, .quiz .choice[data-result="bad"] { border-color: var(--c-safety); background: var(--c-safety-bg); }
.quiz .choice.bad::before, .quiz .choice[data-result="bad"]::before { background: var(--c-safety-solid); border-color: var(--c-safety-solid); color: var(--c-on-solid); }
.quiz__explain { font-size: var(--fs-sm); color: var(--c-ink-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--c-surface-2); border: 1px solid var(--c-line); }
.quiz__score { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--c-mute); }

/* Indicateur clé : <div class="kpi"><span>Libellé</span><b>12</b><small>unité / note</small></div> */
.kpi {
  display: grid; gap: 2px; align-content: start;
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg);
  background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: var(--sh-1);
}
.kpi > span { font-size: var(--fs-xs); color: var(--c-mute); font-weight: var(--fw-medium); }
.kpi > b { font-size: var(--fs-2xl); font-stretch: 88%; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.15; }
.kpi > small { font-size: var(--fs-xs); color: var(--c-mute); }
.kpi[data-level="near"] { border-color: var(--c-verify-line); }
.kpi[data-level="over"] { border-color: var(--c-safety); box-shadow: 0 0 0 1px var(--c-safety); }
.kpi[data-level="over"] > b { color: var(--c-safety-ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--sp-4); }

/* Dialogue en <div class="dialog"> (si <dialog> n'est pas utilisé) */
div.dialog { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 90; padding: var(--sp-6); }
.dialog-backdrop { position: fixed; inset: 0; z-index: 89; background: rgba(10, 13, 16, .48); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* ---------- 18. Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Choix de la palette (dialogue de la barre supérieure) ---------- */
.palette-pick { border: 0; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.palette-pick__opt {
  display: grid; grid-template-columns: 22px 72px minmax(0, 1fr); gap: var(--sp-3); align-items: start;
  padding: var(--sp-3) var(--sp-4); min-height: var(--tap); cursor: pointer;
  border: 1.5px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.palette-pick__opt:hover { border-color: var(--c-line-strong); }
.palette-pick__opt:has(input:checked) { border-color: var(--c-brass-500); box-shadow: 0 0 0 1px var(--c-brass-500); }
.palette-pick__opt input {
  appearance: none; -webkit-appearance: none; margin: 2px 0 0; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--c-line-strong); background: var(--c-surface); display: grid; place-items: center; cursor: pointer;
}
.palette-pick__opt input:checked { border-color: var(--c-gunmetal); background: var(--c-gunmetal); }
.palette-pick__opt input:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-on-gunmetal); }
.palette-pick__opt input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.palette-pick__sw { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr 1fr; height: 44px; border-radius: var(--r-sm); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.palette-pick__sw i { display: block; }
.palette-pick__txt { display: grid; gap: 2px; }
.palette-pick__txt b { font-weight: var(--fw-semibold); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.palette-pick__txt small { color: var(--c-mute); font-size: var(--fs-xs); line-height: 1.45; }
.palette-pick__note { margin: var(--sp-4) 0 0; font-size: var(--fs-xs); }
@media (max-width: 480px) { .palette-pick__opt { grid-template-columns: 22px minmax(0, 1fr); } .palette-pick__sw { grid-column: 2; height: 28px; } .palette-pick__txt { grid-column: 2; } }

/* ==========================================================================
   19. Coquille 0.6.0 (D-090 à D-099) : taille du texte, contraste renforcé,
   états doublés de formes, bandeau repliable, menu par activité, petits écrans
   ========================================================================== */

/* Taille du texte (préférence prefs.taille, menu Présentation du Mac) : toute l'échelle est en rem */
:root[data-taille="grand"] { font-size: 115%; }
:root[data-taille="tres-grand"] { font-size: 130%; }
:root[data-taille="tres-grand"] { --sidebar-w: 290px; }

/* Animations réduites à la demande, même sans réglage du système */
:root[data-mouvement="reduit"] *, :root[data-mouvement="reduit"] *::before, :root[data-mouvement="reduit"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; scroll-behavior: auto !important;
}

/* Contraste renforcé, palette adaptée aux daltoniens (Okabe et Ito, 2008) : bleu = bon, ambre = à vérifier,
   vermillon = bloquant ; textes plus foncés, traits plus marqués. Clair d'abord, puis sombre. */
html:root[data-contraste="renforce"][data-contraste] {
  --c-ink: #000000; --c-ink-2: #1a1f24; --c-mute: #2e353c; --c-faint: #333a41;
  --c-line: #8a949e; --c-line-strong: #1f2a33;
  --c-ok: #0a5a9c; --c-ok-bg: #e3eefa; --c-ok-line: #0a5a9c; --c-ok-solid: #0a5a9c;
  --c-verify: #7a4a00; --c-verify-bg: #fff1d6; --c-verify-line: #b87400; --c-verify-solid: #8a5400;
  --c-safety: #c03a00; --c-safety-ink: #9e2f00; --c-safety-bg: #ffe6dc; --c-safety-line: #c03a00; --c-safety-solid: #a83200;
  --c-on-solid: #ffffff; --link: #0a4f8a; --focus: #000000;
}
html:root[data-contraste="renforce"][data-theme="dark"] {
  --c-ink: #ffffff; --c-ink-2: #eef2f5; --c-mute: #d2d9df; --c-faint: #c8d0d7;
  --c-line: #7d8993; --c-line-strong: #e6ebef;
  --c-ok: #56b4e9; --c-ok-bg: #0b2233; --c-ok-line: #56b4e9; --c-ok-solid: #56b4e9;
  --c-verify: #f0c35a; --c-verify-bg: #2b2108; --c-verify-line: #e69f00; --c-verify-solid: #e69f00;
  --c-safety: #ff8a50; --c-safety-ink: #ffb08a; --c-safety-bg: #33160a; --c-safety-line: #ff8a50; --c-safety-solid: #ff8a50;
  --c-on-solid: #000000; --link: #8cc8f0; --focus: #ffffff;
}
@media (prefers-color-scheme: dark) {
  html:root[data-contraste="renforce"]:not([data-theme="light"]) {
    --c-ink: #ffffff; --c-ink-2: #eef2f5; --c-mute: #d2d9df; --c-faint: #c8d0d7;
    --c-line: #7d8993; --c-line-strong: #e6ebef;
    --c-ok: #56b4e9; --c-ok-bg: #0b2233; --c-ok-line: #56b4e9; --c-ok-solid: #56b4e9;
    --c-verify: #f0c35a; --c-verify-bg: #2b2108; --c-verify-line: #e69f00; --c-verify-solid: #e69f00;
    --c-safety: #ff8a50; --c-safety-ink: #ffb08a; --c-safety-bg: #33160a; --c-safety-line: #ff8a50; --c-safety-solid: #ff8a50;
    --c-on-solid: #000000; --link: #8cc8f0; --focus: #ffffff;
  }
}
:root[data-contraste="renforce"] .field__hint, :root[data-contraste="renforce"] .source, :root[data-contraste="renforce"] .text-mute { color: var(--c-ink-2); }
:root[data-contraste="renforce"] .badge, :root[data-contraste="renforce"] .alert { border-width: 2px; }

/* États doublés d'une forme (D-094) : coche = bon, point d'interrogation = à vérifier, point d'exclamation = bloquant */
.badge--ok:not(.badge--dot)::before, .badge--verify:not(.badge--dot)::before, .badge--danger:not(.badge--dot)::before {
  content: ""; width: 11px; height: 11px; flex: none; background: currentColor;
  -webkit-mask: var(--etat-ic) center / contain no-repeat; mask: var(--etat-ic) center / contain no-repeat;
}
.badge--ok { --etat-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.4l2.6 2.6L10 3.4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.badge--verify { --etat-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 4.3a2 2 0 013.9.6c0 1.3-1.9 1.6-1.9 2.8' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='6' cy='10.2' r='1.1'/%3E%3C/svg%3E"); }
.badge--danger { --etat-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 1.5v6' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='6' cy='10.3' r='1.3'/%3E%3C/svg%3E"); }
.alert--ok .alert__icon:empty, .alert--verify .alert__icon:empty, .alert--danger .alert__icon:empty, .alert--block .alert__icon:empty {
  display: block; background: currentColor; color: var(--a-ic);
  -webkit-mask: var(--etat-ic) center / 18px no-repeat; mask: var(--etat-ic) center / 18px no-repeat;
}
.alert--ok { --etat-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M7 12.5l3.5 3.5L17 9' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.alert--verify { --etat-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l10 18H2z' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 9v5' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='17.3' r='1.3'/%3E%3C/svg%3E"); }
.alert--danger, .alert--block { --etat-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 2h8l6 6v8l-6 6H8l-6-6V8z' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 7v6' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='16.6' r='1.3'/%3E%3C/svg%3E"); }
.gauge[data-level="over"] .gauge__value::before { content: "Dépassé : "; font-weight: var(--fw-bold); }
.gauge[data-level="near"] .gauge__value::before { content: "Proche : "; font-weight: var(--fw-semibold); }

/* Pastille d'alerte du menu : marquée d'un signe, pas seulement d'une couleur */
.nav-item__alert {
  width: 18px; height: 18px; display: grid; place-items: center;
  font-style: normal; font-size: 12px; font-weight: var(--fw-bold); line-height: 1; color: #fff;
}
.nav-item__alert[data-kind="warn"] { border-radius: 4px; background: var(--c-verify-solid); box-shadow: none; }
.sidebar__more { display: grid; gap: 2px; padding: var(--sp-3) var(--sp-3) 0; margin-top: var(--sp-2); border-top: 1px solid var(--c-side-edge); }
.nav-item--small { min-height: 40px; font-size: var(--fs-sm); color: var(--c-side-ink-2); }
.nav-item--small svg { width: 18px; height: 18px; }

/* Menu « Plus » du téléphone : mêmes groupes que le menu latéral */
.m-shell__menugrp + .m-shell__menugrp { margin-top: var(--sp-4); }
.m-shell__menutitre { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--c-mute); margin: 0 0 var(--sp-2); font-weight: var(--fw-semibold); }
.m-shell__menupied { margin: var(--sp-4) 0 0; }

/* Bandeau des armes repliable (D-096) */
.m-rack__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: 0 0 var(--sp-2); }
.m-rack__titre { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; font-weight: var(--fw-semibold); color: var(--c-on-plate-2); }
.m-rack__toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--sp-3);
  border: 1px solid var(--c-plate-edge); border-radius: var(--r-pill); background: var(--c-plate-ov);
  color: var(--c-on-plate); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.m-rack__toggle:hover { background: var(--c-plate-ov-2); }
.m-rack__toggle:focus-visible { outline: 2px solid var(--c-plate-mark); outline-offset: 2px; }
@media (pointer: coarse) { .m-rack__toggle { min-height: var(--tap); } }
.m-rack--replie { padding-top: var(--sp-2); padding-bottom: var(--sp-2); margin-bottom: var(--sp-5); }
.m-rack--replie .m-rack__head { margin-bottom: var(--sp-1); }
.m-rack--replie .m-rack__gun { width: auto; min-width: 0; min-height: 44px; display: inline-flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-3); }
.m-rack--replie .m-rack__meta { display: none; }
.m-rack--replie .m-rack__name { font-size: var(--fs-sm); }
.m-rack--replie .m-rack__plus { font-size: 20px; }
.m-rack__pastille { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--gun, var(--c-brass-500)); box-shadow: 0 0 0 2px var(--c-plate-ov-2); }

/* Petits écrans en hauteur (1280 x 720, 1024 x 600) : en-tête et bandeau plus compacts, dialogues défilants */
@media (max-height: 760px) {
  :root { --topbar-h: 52px; }
  .sidebar__tag { display: none; }
  .sidebar__brand { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
  .app__main { padding-top: var(--sp-5); }
  .m-rack { margin-bottom: var(--sp-5); padding: var(--sp-3) var(--sp-3) var(--sp-2); }
  .m-rack .m-rack__fig { display: none; }
  .m-rack .m-rack__gun { min-height: 64px; }
  dialog.dialog, .dialog { max-height: calc(100dvh - 16px); }
  .dialog__head { padding: var(--sp-4) var(--sp-5) var(--sp-2); }
  .dialog__body { padding: 0 var(--sp-5) var(--sp-4); }
  .dialog__foot { padding: var(--sp-3) var(--sp-5); }
}
/* Indice de défilement : ombre en haut et en bas d'un corps de dialogue qui déborde */
.dialog__body {
  background:
    linear-gradient(var(--c-surface) 30%, transparent) center top / 100% 24px no-repeat local,
    linear-gradient(transparent, var(--c-surface) 70%) center bottom / 100% 24px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .18), transparent) center top / 100% 10px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .18), transparent) center bottom / 100% 10px no-repeat scroll;
}

/* Dialogue « Affichage et préférences » et choix des activités */
.shell-prefs + .shell-prefs { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--c-line); }
.shell-prefs h3 { font-size: var(--fs-lg); margin: 0 0 var(--sp-3); }
.shell-prefs__tailles { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.shell-prefs__taille { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4); border: 1.5px solid var(--c-line); border-radius: var(--r-md); cursor: pointer; }
.shell-prefs__taille:has(input:checked) { border-color: var(--c-brass-500); box-shadow: 0 0 0 1px var(--c-brass-500); }
.shell-prefs__taille[data-t="grand"] span { font-size: 1.15em; }
.shell-prefs__taille[data-t="tres-grand"] span { font-size: 1.3em; }
.shell-usages { border: 0; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.shell-usages__leg { font-weight: var(--fw-semibold); margin-bottom: var(--sp-2); padding: 0; }

/* Impression : seulement les éléments prévus (inventaire, fiches) */
.print-only { display: none; }

/* Écran de verrouillage de l'application de bureau (D-099) */
.desktop-verrou { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: var(--sp-6); background: var(--c-side-bg); background-image: var(--tex-side); color: var(--c-side-name); }
.desktop-verrou__carte { max-width: 440px; text-align: center; display: grid; gap: var(--sp-4); justify-items: center; }
.desktop-verrou__carte h1 { font-size: var(--fs-2xl); color: var(--c-side-name); }
.desktop-verrou__carte p { color: var(--c-side-ink); margin: 0; }

/* ==== Suppression commune (D-130) : bouton corbeille à gauche de chaque élément de liste ==== */
.suppr-ligne { display: flex; align-items: stretch; gap: var(--sp-2); }
.suppr-ligne > .suppr-ligne__corps { flex: 1 1 auto; min-width: 0; }
.suppr-ligne > .suppr-ligne__corps > .card { width: 100%; height: 100%; }
.btn-suppr {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); min-width: var(--tap); min-height: var(--tap); padding: 0;
  border: 1px solid var(--c-line); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-safety-ink); cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast);
}
.btn-suppr svg { width: 20px; height: 20px; }
.btn-suppr:hover { background: var(--c-safety-bg); border-color: var(--c-safety); }
.btn-suppr:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
td.act--gauche { width: calc(var(--tap) + var(--sp-2)); }
li.suppr-li { display: flex; align-items: flex-start; gap: var(--sp-2); }
li.suppr-li > .suppr-li__corps { flex: 1 1 auto; min-width: 0; }
.suppr-dlg__nom { font-size: var(--fs-lg); }

/* ==== Menu : recherche et activités (D-132, D-135) ==== */
.nav-recherche { padding: 0 var(--sp-3) var(--sp-2); display: grid; gap: var(--sp-1); }
.nav-recherche__lab { font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase; color: var(--c-side-ink-2); font-weight: var(--fw-semibold); padding: 0 var(--sp-2); }
.nav-recherche__champ { width: 100%; min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--r-md); border: 1px solid var(--c-side-edge); background: var(--c-side-hover); color: var(--c-side-name); font: inherit; }
.nav-recherche__champ::placeholder { color: var(--c-side-ink-2); opacity: 1; }
.nav-recherche__champ:focus-visible { outline: 2px solid var(--c-side-mark); outline-offset: 1px; }
.nav-recherche__res { display: grid; gap: 2px; }
.nav-recherche__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-recherche__vide { margin: 0; padding: var(--sp-2); color: var(--c-side-ink); font-size: var(--fs-sm); }
.nav-recherche__aide { margin: 0; padding: 0 var(--sp-2); font-size: var(--fs-2xs); color: var(--c-side-ink-2); }
.dialog .nav-recherche__aide { color: var(--c-mute); }
.nav-recherche__mot { background: var(--c-side-mark, #e9c46a); color: #14181a; border-radius: 2px; padding: 0 1px; font-weight: var(--fw-semibold); }
.dialog .nav-recherche__mot { background: #f3dea0; color: var(--c-ink); }
.nav-recherche__chemin { display: block; }
.nav-recherche__masquee { display: block; font-size: var(--fs-2xs); color: var(--c-side-ink-2); font-weight: var(--fw-regular, 400); }
.nav-recherche__rail { display: none; }
.nav-recherche__plan { display: grid; gap: var(--sp-1); padding: 0 0 var(--sp-2); border-bottom: 1px solid var(--c-side-edge); }
.nav-recherche__plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-recherche__plan-titre, .nav-recherche__plan-sec { margin: var(--sp-1) 0 0; padding: 0 var(--sp-2); font-size: var(--fs-2xs); letter-spacing: .14em; text-transform: uppercase; color: var(--c-side-ink-2); font-weight: var(--fw-semibold); }
.dialog .nav-recherche__plan-titre, .dialog .nav-recherche__plan-sec { color: var(--c-mute); }
.dialog .nav-recherche__plan { border-bottom-color: var(--c-line); }
.dialog .nav-recherche { padding: 0 0 var(--sp-3); }
.dialog .nav-recherche__lab, .dialog .nav-recherche__vide, .dialog .nav-recherche__masquee { color: var(--c-mute); }
.dialog .nav-recherche__champ { background: var(--c-surface); color: var(--c-ink); border-color: var(--c-line-strong); }
.dialog .nav-recherche__champ::placeholder { color: var(--c-mute); }
.nav-activites { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin: 0 var(--sp-3) var(--sp-2); padding: var(--sp-2) var(--sp-2); border-radius: var(--r-md); background: var(--c-side-hover); color: var(--c-side-ink); font-size: var(--fs-sm); }
.nav-activites__txt { margin: 0; flex: 1 1 auto; min-width: 0; }
.nav-activites__txt b { color: var(--c-side-name); }
.nav-activites__btn { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); padding: 0 var(--sp-2); border: 0; border-radius: var(--r-md); background: none; color: var(--c-side-mark); font: inherit; font-weight: var(--fw-semibold); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.nav-activites__btn svg { width: 18px; height: 18px; }
.nav-activites__btn:focus-visible { outline: 2px solid var(--c-side-mark); outline-offset: 1px; }
.nav-activites--plus { margin: 0 0 var(--sp-3); background: var(--c-surface-2); color: var(--c-ink-2); }
.nav-activites--plus b { color: var(--c-ink); }
.nav-activites--plus .nav-activites__btn { color: var(--c-ink); }
@media (max-width: 900px) {
  .sidebar .nav-recherche__lab, .sidebar .nav-recherche__champ, .sidebar .nav-recherche__res, .sidebar .nav-activites { display: none; }
  .sidebar .nav-recherche { padding: 0 var(--sp-2) var(--sp-1); }
  .sidebar .nav-recherche__rail { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; width: 100%; border: 0; border-radius: var(--r-md); background: none; color: var(--c-side-ink); cursor: pointer; }
  .sidebar .nav-recherche__rail svg { width: 22px; height: 22px; }
}
.nav-recherche { margin-top: var(--sp-2); }
#m-list + .btn { margin-top: var(--sp-3); }
