/* Bijoute — la boîte à outils du tournage
   Layout : accueil sobre (logo, recherche, outils en tuiles rangées par département : Caméra en bleu lumière du jour,
   Lumière en ambre tungstène, Production en neutre) posé sur un fond d'écran « échelle Kelvin » :
   halo tungstène ambré d'un côté, lumière du jour bleue de l'autre.
   Chaque outil s'ouvre dans des cartes de verre sobres (filet fin, titres en petites capitales à chasse fixe) ;
   son accent prend la teinte de son département (body[data-dept]). */

/* Barlow (SIL OFL, fonts/OFL.txt) : linéale inspirée des marquages DIN, embarquée pour fonctionner hors ligne. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url("../fonts/barlow-semi-condensed-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-semi-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-semi-condensed-700.woff2") format("woff2"); }

:root {
  --bg: #e8ecf2;
  --bg-warm: #ffc56e;          /* halo tungstène 3200 K */
  --bg-cool: #8fc2ff;          /* halo lumière du jour 5600 K */
  --fg: #12151c;
  --fg-2: rgba(18, 21, 28, .62);
  --fg-3: rgba(18, 21, 28, .4);
  --glass: rgba(255, 255, 255, .56);
  --glass-strong: rgba(255, 255, 255, .8);
  --glass-border: rgba(255, 255, 255, .72);
  --hairline: rgba(18, 21, 28, .1);
  --fill: rgba(110, 118, 138, .14);
  --fill-2: rgba(110, 118, 138, .26);
  --accent: #e07b00;           /* ambre « mandarine » */
  --accent-soft: rgba(240, 138, 0, .16);
  --accent-fg: #ffffff;
  --good: #1a9d55;
  --warn: #c98a00;
  --bad: #d93f45;
  --info: #1f7ae0;
  --shadow: 0 12px 40px rgba(34, 46, 80, .13), 0 1px 2px rgba(34, 46, 80, .06);
  --shadow-icon: 0 6px 14px rgba(34, 46, 80, .22);
  --canvas: #f6f7fa;           /* fond des éditeurs (plan de feu, workflow) */
  --canvas-grid: rgba(18, 21, 28, .07);
  --cam: #1f6fe0;              /* Caméra : lumière du jour */
  --cam-soft: rgba(31, 111, 224, .12);
  --lum: #c76100;              /* Lumière : tungstène */
  --lum-soft: rgba(224, 123, 0, .14);
  --prod: #0f8a57;             /* Production : vert « moteur, ça tourne » */
  --prod-soft: rgba(15, 138, 87, .12);
  --cam-grad: linear-gradient(150deg, #4c97ff, #1d52d4);   /* icônes et cartes pleines */
  --lum-grad: linear-gradient(150deg, #ffb23d, #e8620c);
  --prod-grad: linear-gradient(150deg, #3fd394, #0f7d52);
  --mine: #2b3245;             /* Ma bijoute : encre */
  --mine-soft: rgba(43, 50, 69, .1);
  --mine-grad: linear-gradient(150deg, #454e68, #1b202e);
  --row: #ffffff;              /* lignes d'outils, menu */
  --drawer: #f4f6f9;
  --card: rgba(255, 255, 255, .74);  /* cartes des outils */
  --cell: #ffffff;                    /* cases du panneau de mesures */
  --on-cam: #ffffff;
  --on-lum: #ffffff;
  --on-prod: #ffffff;

  --radius: 14px;
  --radius-m: 12px;
  --radius-s: 9px;
  --bar-h: 52px;
  --gutter: 16px;
  --font: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-cond: "Barlow Semi Condensed", "Barlow", "Arial Narrow", -apple-system, BlinkMacSystemFont, sans-serif;  /* chiffres, titres, libellés */
  --font-round: var(--font-cond);
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Roboto Mono", Consolas, monospace;

  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090b10;
    --bg-warm: #7c3f00;
    --bg-cool: #0c3f86;
    --fg: #f2f4f8;
    --fg-2: rgba(242, 244, 248, .64);
    --fg-3: rgba(242, 244, 248, .38);
    --glass: rgba(36, 39, 50, .56);
    --glass-strong: rgba(30, 33, 43, .86);
    --glass-border: rgba(255, 255, 255, .1);
    --hairline: rgba(255, 255, 255, .1);
    --fill: rgba(150, 158, 180, .16);
    --fill-2: rgba(150, 158, 180, .3);
    --accent: #ff9f0a;
    --accent-soft: rgba(255, 159, 10, .2);
    --accent-fg: #1a1100;
    --good: #32d074;
    --warn: #ffd60a;
    --bad: #ff6369;
    --info: #5aa9ff;
    --shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-icon: 0 6px 16px rgba(0, 0, 0, .45);
    --canvas: #14161d;
    --canvas-grid: rgba(255, 255, 255, .06);
    --cam: #62a8ff;
    --cam-soft: rgba(98, 168, 255, .15);
    --lum: #ffa526;
    --lum-soft: rgba(255, 165, 38, .15);
    --prod: #3dd68c;
    --prod-soft: rgba(61, 214, 140, .15);
    --mine: #7f8aa8;
    --mine-soft: rgba(127, 138, 168, .18);
    --mine-grad: linear-gradient(150deg, #3c445c, #1f2433);
    --row: #161922;
    --drawer: #0f1118;
    --card: rgba(19, 21, 29, .7);
    --cell: #12141b;
    --on-cam: #06101f;
    --on-lum: #1a1100;
    --on-prod: #04140c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090b10;
  --bg-warm: #7c3f00;
  --bg-cool: #0c3f86;
  --fg: #f2f4f8;
  --fg-2: rgba(242, 244, 248, .64);
  --fg-3: rgba(242, 244, 248, .38);
  --glass: rgba(36, 39, 50, .56);
  --glass-strong: rgba(30, 33, 43, .86);
  --glass-border: rgba(255, 255, 255, .1);
  --hairline: rgba(255, 255, 255, .1);
  --fill: rgba(150, 158, 180, .16);
  --fill-2: rgba(150, 158, 180, .3);
  --accent: #ff9f0a;
  --accent-soft: rgba(255, 159, 10, .2);
  --accent-fg: #1a1100;
  --good: #32d074;
  --warn: #ffd60a;
  --bad: #ff6369;
  --info: #5aa9ff;
  --shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-icon: 0 6px 16px rgba(0, 0, 0, .45);
  --canvas: #14161d;
  --canvas-grid: rgba(255, 255, 255, .06);
  --cam: #62a8ff;
  --cam-soft: rgba(98, 168, 255, .15);
  --lum: #ffa526;
  --lum-soft: rgba(255, 165, 38, .15);
  --prod: #3dd68c;
  --prod-soft: rgba(61, 214, 140, .15);
  --mine: #7f8aa8;
  --mine-soft: rgba(127, 138, 168, .18);
  --mine-grad: linear-gradient(150deg, #3c445c, #1f2433);
  --row: #161922;
  --drawer: #0f1118;
  --card: rgba(19, 21, 29, .7);
  --cell: #12141b;
  --on-cam: #06101f;
  --on-lum: #1a1100;
  --on-prod: #04140c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }

/* ───────── Fond d'écran Kelvin ───────── */
.wallpaper {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(75vmax 60vmax at -5% -10%, var(--bg-warm), transparent 62%),
    radial-gradient(80vmax 70vmax at 108% 108%, var(--bg-cool), transparent 62%),
    var(--bg);
}
#view { position: relative; z-index: 1; }

/* ───────── Verre ───────── */
.glass {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}
/* Seuls les éléments qui flottent au-dessus du contenu gardent une ombre. */
.bar.glass, .floating.glass, .sheet.glass, .prompter-bar.glass, .vf-panel.glass { box-shadow: var(--shadow); border-color: var(--glass-border); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* ───────── Accueil ───────── */
.home {
  max-width: 1120px; margin: 0 auto;
  padding-block: 22px 40px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 20px;
}
.home { gap: 18px; }
.home-head { display: flex; align-items: center; gap: 8px; padding: 6px 0 0; }
.home-logo { flex: 1; min-width: 0; color: var(--fg); display: flex; }
.home-logo svg { height: 32px; width: auto; }
.menu-btn svg { width: 23px; height: 23px; }

/* Recherche */
.search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px;
  background: var(--row); border: 1px solid var(--hairline); color: var(--fg-3);
  transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--accent); background: var(--row); }
.search svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 16px; color: var(--fg); }
.search input::placeholder { color: var(--fg-3); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }

/* Teinte de chaque catégorie */
.dept-camera { --dept: var(--cam); --dept-soft: var(--cam-soft); --dept-grad: var(--cam-grad); }
.dept-light { --dept: var(--lum); --dept-soft: var(--lum-soft); --dept-grad: var(--lum-grad); }
.dept-prod { --dept: var(--prod); --dept-soft: var(--prod-soft); --dept-grad: var(--prod-grad); }
.dept-mine { --dept: var(--mine); --dept-soft: var(--mine-soft); --dept-grad: var(--mine-grad); }   /* Ma bijoute : encre, toutes teintes mêlées */

/* Icône d'outil : tuile pleine à la teinte de la catégorie, pictogramme blanc */
.ic {
  flex: none; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  background: var(--dept-grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 12px -4px color-mix(in srgb, var(--dept) 70%, transparent);
}
.ic svg { width: 28px; height: 28px; }
.ic.sm { width: 34px; height: 34px; border-radius: 10px; } .ic.sm svg { width: 20px; height: 20px; }
.ic.xs { width: 30px; height: 30px; border-radius: 9px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28); } .ic.xs svg { width: 18px; height: 18px; }
.ic.big { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto; } .ic.big svg { width: 36px; height: 36px; }

/* Accueil : trois grandes cartes de catégorie */
.cats { display: grid; gap: 14px; }
@media (min-width: 900px) {
  .cats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .cats .cat-card { min-height: min(52vh, 440px); grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto; align-items: start; padding: 26px; gap: 22px 16px; }
  .cats .cat-glyph { width: 78px; height: 78px; border-radius: 22px; } .cats .cat-glyph svg { width: 46px; height: 46px; }
  .cats .cat-text { grid-column: 1 / -1; grid-row: 2; align-self: end; }
  .cats .cat-card h2 { font-size: 44px; }
  .cats .cat-go { grid-column: 2; grid-row: 1; }
  .cats .cat-tools { grid-row: 3; margin-top: 0; }
  .cats .cat-mark { width: 300px; height: 300px; right: -50px; bottom: -40px; }
}
.cat-card, .cat-hero {
  position: relative; overflow: hidden; isolation: isolate; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 16px;
  padding: 20px 18px 18px 20px; border-radius: 22px; color: #fff; text-decoration: none; background: var(--dept-grad);
  box-shadow: 0 18px 36px -18px color-mix(in srgb, var(--dept) 85%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .2s cubic-bezier(.3, .7, .3, 1), box-shadow .2s;
}
.cat-card:active { transform: scale(.98); }
@media (hover: hover) { .cat-card:hover { transform: translateY(-3px); } }
.cat-mark { position: absolute; z-index: -1; right: -26px; bottom: -38px; width: 170px; height: 170px; color: #fff; opacity: .13; transform: rotate(-12deg); }
.cat-mark svg { width: 100%; height: 100%; }
.cat-glyph { width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cat-glyph svg { width: 36px; height: 36px; }
.cat-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cat-kicker { font: 600 12.5px/1 var(--font-cond); letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.cat-card h2, .cat-hero h1 { font: 700 32px/1 var(--font-cond); letter-spacing: .02em; text-transform: uppercase; }
.cat-tag { font-size: 14.5px; opacity: .92; }
.cat-go { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .2); }
.cat-go svg { width: 18px; height: 18px; }
.cat-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .22); }
.cat-tools span { width: 22px; height: 22px; opacity: .92; }
.cat-tools svg { width: 100%; height: 100%; }

/* Accueil : « Ma bijoute », les outils favoris en raccourcis */
.mine-card {
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; gap: 16px;
  padding: 16px 16px 18px 18px; border-radius: 22px; color: #fff; background: var(--dept-grad);
  box-shadow: 0 18px 36px -20px color-mix(in srgb, var(--dept) 85%, transparent), inset 0 0 0 1px rgba(255, 255, 255, .1), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.mine-card .cat-mark { width: 150px; height: 150px; right: -22px; bottom: auto; top: -46px; opacity: .08; }
.mine-head { display: flex; align-items: center; gap: 12px; }
.mine-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.mine-title .cat-glyph { flex: none; width: 48px; height: 48px; border-radius: 14px; }
.mine-title .cat-glyph svg { width: 27px; height: 27px; }
.dept-mine .cat-glyph { color: #ffc94d; } .dept-mine .cat-glyph svg { fill: currentColor; }   /* l'étoile, pleine et dorée */
.mine-title h2 { font: 700 27px/1 var(--font-cond); letter-spacing: .02em; text-transform: uppercase; }
.mine-edit {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px 0 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; font: 600 14px/1 var(--font-cond); letter-spacing: .04em;
}
.mine-edit:hover { background: rgba(255, 255, 255, .24); }
.mine-edit svg { width: 16px; height: 16px; }
.mine-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 14px 4px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .16); }
.mine-tile { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; color: #fff; text-decoration: none; text-align: center;
  font: 600 13px/1.15 var(--font-cond); letter-spacing: .01em; transition: transform .18s cubic-bezier(.3, .7, .3, 1); }
.mine-tile:active { transform: scale(.94); }
.mine-tile .ic { width: 54px; height: 54px; border-radius: 15px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 8px 16px -8px rgba(0, 0, 0, .7); }
.mine-tile span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (hover: hover) { .mine-tile:hover { transform: translateY(-2px); } }
@media (min-width: 900px) { .mine-card { padding: 20px 22px 22px 24px; } .mine-tiles { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); } }

/* Étoile « garder dans Ma bijoute » : sur une ligne d'outil, dans la barre d'un outil, dans la feuille de choix */
.tool-item { position: relative; min-width: 0; display: flex; }
.tool-item > .tool-row { flex: 1; padding-right: 54px; }
.fav-star { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--fg-3); transition: color .15s, transform .15s; }
.fav-star svg, .fav-btn svg { width: 22px; height: 22px; }
.fav-star:hover { background: var(--fill); }
.fav-star:active { transform: scale(.86); }
.fav-star.on, .fav-btn.on { color: #e8a200; }
.fav-star.on svg, .fav-btn.on svg { fill: currentColor; }
.icon-btn.fav-btn.on { background: none; }
.fav-pick { display: flex; align-items: center; gap: 12px; }
/* Ordre des favoris : lignes à glisser par la poignée, ou à déplacer avec les flèches */
.fav-order { padding-bottom: 4px; }
.fav-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid var(--hairline); }
.fav-row:last-child { border-bottom: 0; }
.fav-row.drag { z-index: 2; margin: 0 -8px; padding: 0 8px; border-radius: 12px; border-bottom-color: transparent; background: var(--row); box-shadow: var(--shadow); }
.fav-grip { flex: none; width: 34px; height: 44px; margin-left: -8px; display: grid; place-items: center; color: var(--fg-3); cursor: grab; touch-action: none; }
.fav-row.drag .fav-grip { cursor: grabbing; color: var(--fg); }
.fav-grip svg { width: 22px; height: 22px; }
.fav-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-row .icon-btn { width: 36px; height: 36px; }
.fav-row .icon-btn[disabled] { opacity: .28; pointer-events: none; }
@media (max-width: 599px) { .bar-full .fav-btn { display: none; } }   /* éditeurs : la barre est déjà pleine sur téléphone */
.drawer-mine .ic { color: #ffc94d; } .drawer-mine .ic svg { fill: currentColor; }
.drawer-mine .drawer-items .ic { color: #fff; } .drawer-mine .drawer-items .ic svg { fill: none; }
.drawer-mine .drawer-items:empty { display: none; }

/* Page d'une catégorie */
.cat-page {
  max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding-block: 4px 40px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.cat-hero { grid-template-columns: auto minmax(0, 1fr); padding-block: 24px; }
.cat-hero h1 { font-size: 38px; }

/* Lignes d'outils (catégorie, recherche) : surface pleine, icône, nom, description */
.tool-list { display: grid; gap: 10px; }
@media (min-width: 760px) { .tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tool-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tool-row {
  display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 12px 12px 12px; border-radius: 16px;
  background: var(--row); border: 1px solid var(--hairline); color: var(--fg); text-decoration: none;
  transition: transform .18s cubic-bezier(.3, .7, .3, 1), border-color .2s;
}
.tool-row:active { transform: scale(.98); }
@media (hover: hover) { .tool-row:hover { border-color: color-mix(in srgb, var(--dept) 55%, transparent); } }
.tool-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tool-row b { font: 600 18px/1.15 var(--font-cond); letter-spacing: .005em; }
.tool-row small { font-size: 13.5px; line-height: 1.3; color: var(--fg-2); }
.tool-row > svg { width: 18px; height: 18px; flex: none; color: var(--fg-3); }
.home-empty { text-align: center; color: var(--fg-2); padding: 30px 0; grid-column: 1 / -1; }
.home-foot { text-align: center; color: var(--fg-3); font: 500 12.5px/1 var(--font-cond); letter-spacing: .08em; text-transform: uppercase; padding-top: 6px; }
/* Installer l'application (js/install.js) : invitation sur l'accueil et en bas du menu, feuille du geste à faire */
.install-cta {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--hairline); color: var(--fg); font: 600 15px/1 var(--font-cond); letter-spacing: .04em;
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); transition: background .15s, transform .1s;
}
.install-cta:hover { background: var(--fill-2); }
.install-cta:active { transform: scale(.97); }
.install-cta svg { width: 18px; height: 18px; color: var(--accent); }
.drawer-foot { display: grid; gap: 1px; padding-top: 10px; margin-top: auto; border-top: 1px solid var(--hairline); }
.drawer .drawer-link, .drawer-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 11px; color: var(--fg-2); text-align: left;
  font: 500 15px/1.15 var(--font-cond); letter-spacing: .02em; }
.drawer-link:hover { background: var(--fill); color: var(--fg); }
.drawer-link svg { width: 20px; height: 20px; margin: 0 4px; flex: none; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.install-steps li { display: flex; align-items: center; gap: 14px; line-height: 1.4; }
.install-steps b { font-weight: 700; }
.install-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.install-ico svg { width: 22px; height: 22px; }
.install-qr { display: flex; align-items: center; gap: 16px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.install-qr-code { flex: none; width: 132px; }
.install-qr-code svg { display: block; width: 100%; height: auto; border-radius: 10px; }
.install-qr b { font: 700 15px/1.2 var(--font-cond); letter-spacing: .1em; text-transform: uppercase; }
.install-qr .note { margin-top: 4px; }
@media (max-width: 420px) { .install-qr { flex-direction: column; align-items: flex-start; } }

/* Menu latéral ☰ */
.drawer-back { position: fixed; inset: 0; z-index: 600; background: rgba(4, 6, 10, .45); opacity: 0; transition: opacity .28s ease; }
.drawer-back.open { opacity: 1; }
.drawer {
  position: absolute; inset: 0 auto 0 0; width: min(330px, 86vw); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 6px; background: var(--drawer); border-right: 1px solid var(--hairline); box-shadow: var(--shadow);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 24px) max(12px, env(safe-area-inset-left, 0px));
  transform: translateX(-102%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.drawer-back.open .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 0 10px 6px; }
.drawer-logo { display: flex; color: var(--fg); } .drawer-logo svg { height: 28px; width: auto; }
.drawer a { color: var(--fg); text-decoration: none; display: flex; align-items: center; gap: 12px; border-radius: 11px; }
.drawer-home { padding: 9px 10px; font: 600 17px/1 var(--font-cond); letter-spacing: .02em; }
.drawer-home svg { width: 22px; height: 22px; margin: 0 6px; color: var(--fg-2); }
.drawer-group { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--hairline); }
.drawer-cat { padding: 6px 10px 8px; font: 700 15px/1 var(--font-cond); letter-spacing: .12em; text-transform: uppercase; }
.drawer-cat > span:not(.ic) { flex: 1; } .drawer-cat small { font: 600 13px/1 var(--font-cond); color: var(--fg-3); letter-spacing: .04em; }
.drawer-items { display: grid; gap: 1px; }
.drawer-item { padding: 6px 10px; font: 500 16px/1.15 var(--font-cond); }
.drawer a:not(.drawer-logo):hover { background: var(--fill); }
.drawer-data button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: var(--fg); border-radius: 11px; text-align: left; cursor: pointer; }
.drawer-data button:hover { background: var(--fill); }
.drawer-data svg { width: 22px; height: 22px; margin: 0 1px; color: var(--fg-2); flex: none; }
.drawer-data span { flex: 1; } .drawer-data small { font: 600 13px/1 var(--font-cond); color: var(--fg-3); letter-spacing: .04em; }
.drawer a[aria-current="page"] { background: var(--dept-soft, var(--fill)); font-weight: 700; }
.drawer-home[aria-current="page"] { background: var(--fill); }

/* Écran d'ouverture (js/splash.js) */
.splash {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--bg); color: var(--fg);
  transition: opacity .3s ease, visibility .3s;
}
.splash svg { width: min(72vw, 340px); height: auto; overflow: visible; }
.splash.out { opacity: 0; visibility: hidden; }

/* ───────── Teinte du département (accent des outils) ───────── */
body[data-dept="camera"] { --accent: var(--cam); --accent-soft: var(--cam-soft); --accent-fg: var(--on-cam); }
body[data-dept="light"] { --accent: var(--lum); --accent-soft: var(--lum-soft); --accent-fg: var(--on-lum); }
body[data-dept="prod"] { --accent: var(--prod); --accent-soft: var(--prod-soft); --accent-fg: var(--on-prod); }

/* ───────── Lancement d'un outil (js/app.js : launch, stagger) ───────── */
.launch {
  position: fixed; z-index: 900; overflow: hidden; pointer-events: none; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--dept-grad); color: #fff;
  transition: left .36s cubic-bezier(.2, .8, .2, 1), top .36s cubic-bezier(.2, .8, .2, 1), width .36s cubic-bezier(.2, .8, .2, 1),
    height .36s cubic-bezier(.2, .8, .2, 1), border-radius .36s ease, opacity .3s ease;
}
.launch-ic { position: relative; width: 30px; height: 30px; display: grid; place-items: center; transition: transform .36s cubic-bezier(.2, .8, .2, 1); }
.launch-ic svg { width: 100%; height: 100%; }
.launch-name { position: relative; font: 700 26px/1.1 var(--font-cond); letter-spacing: .06em; text-transform: uppercase; margin-top: 22px; text-align: center; padding: 0 24px; opacity: 0; transform: translateY(8px); transition: opacity .25s ease .1s, transform .3s ease .1s; }
.launch.grow { border-radius: 0; }
.launch.grow .launch-ic { transform: scale(2.4); }
.launch.grow .launch-name { opacity: 1; transform: none; }
.launch.out { opacity: 0; }
.rise-in { animation: rise-in .5s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--base, 330ms) + var(--i, 0) * 45ms); }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } }

/* ───────── Barre d'outil ───────── */
.bar-wrap {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  padding-block: 8px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.bar {
  height: var(--bar-h); max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
  border-radius: 14px;
}
.bar-title {
  min-width: 0; font: 600 17px/1.1 var(--font-cond); letter-spacing: .005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 2px;
}
.bar-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.bar-head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-left: 4px; }
.bar > .ic { margin-left: 2px; }
.bar-dept { font: 600 11px/1 var(--font-cond); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  color: var(--fg); transition: background .15s;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:hover { background: var(--fill); }
.icon-btn:active { background: var(--fill-2); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }

/* ───────── Page d'outil ───────── */
.tool {
  max-width: 1120px; margin: 0 auto;
  padding-block: 6px 48px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.calc { display: flex; flex-direction: column; gap: 14px; max-width: 620px; margin: 0 auto; }
.calc-out, .calc-in { display: contents; }
.calc .sticky { z-index: 20; }
@media (min-height: 680px) { .calc .sticky { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) + 16px); } }
@media (min-width: 900px) {
  .calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; max-width: 1120px; align-items: start; }
  .calc-out, .calc-in { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .calc-out {
    position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) + 16px);
    /* fenêtre basse : la colonne des résultats défile plutôt que d'être coupée */
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - var(--bar-h) - 32px); overflow-y: auto; scrollbar-width: none;
  }
  .calc-out::-webkit-scrollbar { display: none; }
  .calc-out > * { flex: none; }
  .calc .sticky { position: static; }
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 620px; margin: 0 auto; }

.card { padding: 16px; min-width: 0; }
.card-title {
  font: 600 12.5px/1 var(--font-cond); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2);
  margin-bottom: 14px;
}
.note { color: var(--fg-2); font-size: 12.5px; line-height: 1.45; }

/* Explications : à quoi sert l'outil, légende d'un schéma, détail du calcul */
.intro { padding: 14px 16px; }
.intro h2 { font: 600 19px/1.2 var(--font-cond); letter-spacing: .01em; color: var(--fg); }
.intro p { margin-top: 5px; font-size: 13.5px; line-height: 1.45; color: var(--fg-2); }
.caption { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.caption b { color: var(--fg); font-weight: 650; }
.caption b.hl { color: var(--accent); }
.tips { display: flex; flex-direction: column; }
.tip { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--hairline); }
.tip:first-child { border-top: 0; padding-top: 0; }
.tip:last-child { padding-bottom: 0; }
.tip-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--fg-3); }
.tip.good .tip-dot { background: var(--good); }
.tip.warn .tip-dot { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); }
.tip.bad .tip-dot { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 22%, transparent); }
.tip b { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
.tip span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--fg-2); }
.tip.bad b { color: var(--bad); }
/* Puissance électrique : un bloc par circuit, sa charge et ce qu'on y branche */
.pw-plan { display: flex; flex-direction: column; gap: 14px; }
.pw-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pw-h b { font-weight: 600; }
.pw-h span { font: 600 16px/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.pw-bar { position: relative; display: block; height: 10px; margin: 8px 0 7px; border-radius: 5px; background: var(--fill); }
.pw-bar b { display: block; height: 100%; border-radius: 5px; background: var(--good); }
.pw-bar u { position: absolute; left: 80%; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--fg-2); }
.pw-c.warn .pw-bar b { background: var(--warn); }
.pw-c.bad .pw-h b, .pw-c.bad .pw-h span { color: var(--bad); }
/* Stockage : légende des marquages d'une carte SD (mêmes numéros que sur le dessin), gammes d'exemple */
.sd-legend { display: flex; flex-direction: column; }
.sd-mark { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--hairline); }
.sd-mark:first-child { border-top: 0; padding-top: 0; }
.sd-mark:last-child { padding-bottom: 0; }
.sd-mark > i { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); font: 700 12px/1 var(--font-cond); font-style: normal; }
.sd-mark.key > i { background: var(--accent); color: var(--accent-fg); }
.sd-mark > div { flex: 1; min-width: 0; }
.sd-mark b { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; line-height: 1.3; }
.sd-mark em { flex: none; font: 700 13px/1 var(--font-cond); font-style: normal; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.sd-mark.key em { color: var(--accent); }
.sd-mark span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--fg-2); }
.sd-models { display: flex; flex-wrap: wrap; gap: 6px; }
.calc-details { padding: 0; }
.calc-details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; cursor: pointer; list-style: none;
  font: 600 12.5px/1 var(--font-cond); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2);
}
.calc-details summary::-webkit-details-marker { display: none; }
.calc-details .chev { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--fill); transition: transform .2s; }
.calc-details .chev svg { width: 14px; height: 14px; }
.calc-details[open] .chev { transform: rotate(180deg); }
.steps { padding: 0 16px 6px; }
.step { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.step-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 12px/1 var(--font-cond); }
.step-b { flex: 1; min-width: 0; }
.step-t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.step-f, .step-c { margin-top: 5px; font-size: 13.5px; line-height: 1.45; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.step-f { color: var(--fg-2); }
.step-c { color: var(--fg); font-weight: 600; }
.step .note { margin-top: 5px; }

/* Listes façon Réglages iOS */
.list { padding: 0 16px; min-width: 0; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}
.row:last-child { border-bottom: 0; }
.row-label { flex: 1; min-width: 0; font-weight: 500; }
.row-label small { display: block; font-weight: 400; color: var(--fg-2); font-size: 12px; margin-top: 1px; }
.row-ctl { flex: none; display: flex; align-items: center; gap: 8px; max-width: 68%; min-width: 0; }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 0; }
.row.col .row-top { display: flex; align-items: center; gap: 12px; }
.row.col .row-ctl { max-width: none; }

.row.wrap { flex-wrap: wrap; gap: 8px; }
.row.wrap > .text { flex: 1 1 160px; width: auto; }
.row.wrap > .row-ctl { margin-left: auto; max-width: none; }

/* Contrôles */
.pick {
  appearance: none; -webkit-appearance: none;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M1.5 5 5 1.5 8.5 5M1.5 9 5 12.5 8.5 9' fill='none' stroke='%23808799' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 0; border-radius: var(--radius-s); padding: 8px 28px 8px 12px; min-height: 36px;
  font-weight: 600; font-variant-numeric: tabular-nums; max-width: 100%; min-width: 0;
  text-overflow: ellipsis; cursor: pointer;
}
.pick:hover { background-color: var(--fill-2); }
.num {
  display: inline-flex; align-items: center; gap: 4px; background: var(--fill);
  border-radius: var(--radius-s); padding: 0 10px; min-height: 36px;
}
.num input {
  width: 5.2ch; min-width: 0; border: 0; background: none; text-align: right; padding: 6px 0;
  font-weight: 600; font-variant-numeric: tabular-nums; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.num .unit { color: var(--fg-2); font-size: 13px; font-weight: 500; }
.text {
  width: 100%; border: 0; background: var(--fill); border-radius: var(--radius-s);
  padding: 9px 12px; min-height: 36px; outline: none; min-width: 0;
}
.text:focus { box-shadow: 0 0 0 2px var(--accent); }
textarea.text { resize: vertical; min-height: 64px; line-height: 1.4; }

input[type="range"].range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 0; cursor: pointer;
}
.range::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p, 50%), var(--fill-2) var(--p, 50%)); }
.range::-moz-range-track { height: 5px; border-radius: 3px; background: var(--fill-2); }
.range::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--accent); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; margin-top: -10.5px;
  background: #fff; border: .5px solid rgba(0, 0, 0, .08); box-shadow: 0 2px 7px rgba(0, 0, 0, .28);
}
.range::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%; background: #fff; border: .5px solid rgba(0, 0, 0, .08);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .28);
}

.seg {
  display: inline-flex; background: var(--fill); border-radius: var(--radius-s); padding: 3px; gap: 2px; max-width: 100%;
}
.seg.block { display: flex; }
.seg button {
  flex: 1; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--fg-2);
  white-space: nowrap; min-height: 30px; transition: background .15s, color .15s;
}
.seg button[aria-pressed="true"] { background: var(--glass-strong); color: var(--fg); box-shadow: 0 1px 4px rgba(0, 0, 0, .14); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--fill-2); transition: background .2s; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 16px; border-radius: 12px; font-weight: 600;
  background: var(--fill); color: var(--fg); transition: background .15s, transform .1s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 999px; background: var(--fill); font-weight: 600; font-size: 13px;
  color: var(--fg-2); font-variant-numeric: tabular-nums; transition: background .15s, color .15s;
}
.chip:hover { background: var(--fill-2); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

/* Résultats */
.stats { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; background: var(--cell); }
.stats .stat { padding: 14px 16px 15px; box-shadow: -1px 0 0 var(--hairline), 0 -1px 0 var(--hairline); }
.stat { min-width: 0; }
.stat.wide { grid-column: 1 / -1; }
.stat-label { font: 600 12px/1.25 var(--font-cond); color: var(--fg-2); letter-spacing: .08em; text-transform: uppercase; }
.stat-value {
  font: 600 28px/1.1 var(--font-cond); letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  margin-top: 4px; overflow-wrap: anywhere;
}
.stat-value .u { font-size: .58em; font-weight: 600; color: var(--fg-2); margin-left: 3px; letter-spacing: 0; }
.stat.hero .stat-value { font-size: 46px; color: var(--accent); letter-spacing: -.02em; }
.stat-sub { font-size: 12px; color: var(--fg-2); margin-top: 1px; }
.stat.good .stat-value { color: var(--good); }
.stat.bad .stat-value { color: var(--bad); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; background: var(--fill); color: var(--fg-2);
}
.pill.good { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.pill.accent-pill { background: var(--accent-soft); color: var(--accent); font-size: 14px; padding: 6px 13px; }

.diagram { padding: 12px; overflow: hidden; }
/* Scène virtuelle (vue simulée de la caméra) */
.scene { padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.scene-canvas { display: block; max-width: 100%; border-radius: var(--radius-s); background: #cfdce6; box-shadow: 0 0 0 1px var(--hairline); }
.scene.sticky { background: linear-gradient(var(--glass-strong), var(--glass-strong)), var(--bg); }  /* opaque : rien ne transparaît quand on fait défiler */
.scene-actions { display: flex; justify-content: center; }
.scene-caption { font-size: 12px; color: var(--fg-2); text-align: center; font-variant-numeric: tabular-nums; }
.diagram > svg { width: 100%; height: auto; }
.diagram text { font-family: var(--font); fill: var(--fg-2); font-size: 11px; font-variant-numeric: tabular-nums; }

/* Tableaux compacts */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font: 600 12px/1.3 var(--font-cond); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); padding: 6px 8px; white-space: nowrap; }
.table td { padding: 9px 8px; border-top: 1px solid var(--hairline); white-space: nowrap; }
.table td.r, .table th.r { text-align: right; }
.table tr.hl td { color: var(--accent); font-weight: 650; }

/* Toast + feuilles modales */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translate(-50%, 20px);
  z-index: 200; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: var(--glass-strong); color: var(--fg); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .32);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  animation: fade .2s backwards;
}
.sheet {
  width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 18px;
  background: var(--glass-strong); animation: rise .28s cubic-bezier(.2, .8, .2, 1) backwards;
}
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font: 600 21px/1.15 var(--font-cond); letter-spacing: .005em; min-width: 0; }
.sheet img.preview { display: block; width: 100%; border-radius: var(--radius-m); border: 1px solid var(--hairline); background: #fff; }
@media (min-width: 700px) { .backdrop { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.enter { animation: enter .28s cubic-bezier(.2, .8, .2, 1) backwards; }

/* ───────── Éditeurs plein écran (plan de feu, workflow) ───────── */
.tool.full { max-width: none; padding: 0; }
.editor {
  position: fixed; inset: 0; z-index: 5; overflow: hidden; background: var(--canvas);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.editor > svg.board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.editor > svg.board.panning { cursor: grabbing; }
.floating {
  position: absolute; z-index: 10; padding: 6px; border-radius: 20px;
  display: flex; align-items: center; gap: 2px;
}
.floating.bottom {
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none;
}
.floating.bottom::-webkit-scrollbar { display: none; }
.floating.right {
  right: max(12px, env(safe-area-inset-right, 0px));
  top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) + 24px);
  flex-direction: column;
}
.floating.left {
  left: max(12px, env(safe-area-inset-left, 0px));
  top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) + 24px);
  flex-direction: column;
}
.floating .sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--hairline); flex: none; }
.floating.right .sep, .floating.left .sep { width: auto; height: 1px; margin: 4px 6px; }
.tool-btn {
  min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10px; font-weight: 600; color: var(--fg-2); transition: background .15s, color .15s;
}
.tool-btn svg { width: 22px; height: 22px; color: var(--fg); }
.tool-btn:hover { background: var(--fill); }
.tool-btn.on { background: var(--accent-soft); color: var(--accent); }
.tool-btn.on svg { color: var(--accent); }
.palette {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px;
}
.palette button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px;
  border-radius: var(--radius-m); background: var(--fill); font-size: 11.5px; font-weight: 600; color: var(--fg);
  min-width: 0; text-align: center; line-height: 1.2;
}
.palette button:hover { background: var(--fill-2); }
.palette button svg { width: 44px; height: 44px; }

/* ───────── Clap ───────── */
.slate { overflow: hidden; padding: 0; }
.slate-stripes { height: 34px; background: repeating-linear-gradient(-60deg, #f4f5f7 0 26px, #14161c 26px 52px); }
.slate-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.slate-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slate-field { min-width: 0; }
.slate-field span, .slate-big span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); margin-bottom: 4px; }
.slate-bigs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.slate-big { min-width: 0; background: var(--fill); border-radius: var(--radius-m); padding: 9px 6px 6px; text-align: center; }
.slate-big input {
  width: 100%; border: 0; background: none; text-align: center; outline: none; padding: 0;
  font: 700 clamp(18px, 5.4vw, 30px)/1.2 var(--font-round); font-variant-numeric: tabular-nums;
}
.slate-big .steps { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.slate-big .steps button { width: 30px; height: 26px; border-radius: 8px; background: var(--fill-2); display: grid; place-items: center; }
.slate-big .steps svg { width: 15px; height: 15px; }
.slate-tc {
  font: 600 clamp(34px, 11.5vw, 68px)/1 var(--font-mono); letter-spacing: -.02em; text-align: center;
  font-variant-numeric: tabular-nums; padding: 8px 0 2px;
}
.slate-tc.frozen { color: var(--accent); }
.slate-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.btn.clap { min-height: 64px; font: 700 24px/1 var(--font-cond); letter-spacing: .12em; background: var(--lum); color: var(--on-lum); }
.flash { position: fixed; inset: 0; z-index: 400; background: #fff; pointer-events: none; }

/* ───────── Découpage & checklist ───────── */
.shot { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.shot:last-child { border-bottom: 0; }
.shot-num {
  flex: none; min-width: 44px; padding: 6px 4px; border-radius: var(--radius-s); background: var(--fill); text-align: center;
  font: 700 15px/1.1 var(--font-round); font-variant-numeric: tabular-nums;
}
.shot-num small { display: block; font: 600 10px/1.2 var(--font); color: var(--fg-2); letter-spacing: .04em; }
.shot-main { flex: 1; min-width: 0; }
.shot-main p { margin-top: 5px; color: var(--fg-2); font-size: 13.5px; overflow-wrap: anywhere; }
.shot.done .shot-main, .shot.done .shot-num { opacity: .45; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 2px 8px; border-radius: 6px; background: var(--fill); font-size: 12px; font-weight: 600; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.checkbox {
  appearance: none; -webkit-appearance: none; flex: none; width: 26px; height: 26px; margin: 0; border-radius: 50%;
  border: 2px solid var(--fg-3); display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.checkbox:checked { background: var(--good); border-color: var(--good); }
.checkbox:checked::after { content: ""; width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.check-row:last-of-type { border-bottom: 0; }
.check-row label { flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.check-row.done label { color: var(--fg-3); text-decoration: line-through; }
.check-row .icon-btn { width: 30px; height: 30px; color: var(--fg-3); }
.check-row .icon-btn svg { width: 16px; height: 16px; }
.progress { height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 4px; background: var(--good); transition: width .3s; }
.add-row { display: flex; gap: 8px; padding: 10px 0 14px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--fg-2); min-width: 0; }
.form label.wide { grid-column: 1 / -1; }
.form .pick { width: 100%; }

/* ───────── Mires ───────── */
.chart-stage { padding: 10px; }
.chart-stage canvas { display: block; width: 100%; height: auto; border-radius: var(--radius-m); }
.chart-full { position: fixed; inset: 0; z-index: 300; background: #000; display: grid; place-items: center; cursor: zoom-out; }
.chart-full canvas { max-width: 100%; max-height: 100%; }

/* ───────── Viseur de champ ───────── */
.vf { background: #000; color: #fff; }
.vf-view { position: absolute; overflow: hidden; border-radius: 6px; }
.vf-stage { position: absolute; transform-origin: center; }
.vf-stage video, .vf-stage img { display: block; width: 100%; height: 100%; object-fit: fill; background: #111; }
.vf-frame {
  position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 4000px rgba(0, 0, 0, .58); pointer-events: none;
}
.vf-frame.wide { border-style: dashed; border-color: #ffd60a; }
.vf-frame .thirds { position: absolute; inset: 0; background:
  linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
  linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.vf-info {
  position: absolute; z-index: 9; left: 50%; transform: translateX(-50%); white-space: nowrap;
  top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) + 22px);
  padding: 5px 12px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.vf-info.warn { background: #ffd60a; color: #1a1100; }
.vf-empty {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 90px 24px 200px; text-align: center;
}
.vf-panel.glass, .vf-empty .card.glass { background: var(--glass-strong); }
.vf-empty .card { max-width: 380px; display: flex; flex-direction: column; gap: 12px; align-items: center; color: var(--fg); }
.vf-panel {
  position: absolute; z-index: 10; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px));
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); padding: 12px 14px; color: var(--fg);
  display: flex; flex-direction: column; gap: 8px;
}
.vf-top { display: flex; align-items: center; gap: 10px; }
.vf-focal { font: 700 26px/1 var(--font-round); font-variant-numeric: tabular-nums; min-width: 4.2em; }
.vf-focal small { font-size: 13px; font-weight: 600; color: var(--fg-2); margin-left: 3px; }
.vf-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.vf-chips::-webkit-scrollbar { display: none; }
.vf-chips .chip { flex: none; }
.shutter-btn {
  width: 52px; height: 52px; border-radius: 50%; flex: none; background: #fff; border: 4px solid rgba(255, 255, 255, .0);
  box-shadow: 0 0 0 3px var(--fg), inset 0 0 0 2px var(--glass-strong); transition: transform .1s;
}
.shutter-btn:active { transform: scale(.92); }
/* Viseur, téléphone à l'horizontale : réglages sur le côté droit, image sur toute la hauteur */
@media (orientation: landscape) and (max-height: 560px) {
  .vf-panel {
    left: auto; transform: none; width: 232px;
    right: max(10px, env(safe-area-inset-right, 0px));
    top: calc(env(safe-area-inset-top, 0px) + var(--bar-h) + 20px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    padding: 10px 12px; overflow-y: auto; scrollbar-width: none;
  }
  .vf-panel::-webkit-scrollbar { display: none; }
  .vf-top { flex-wrap: wrap; row-gap: 4px; }
  .vf-top .vf-focal { flex: 1; min-width: 0; }
  .vf-top .grow { order: 5; flex-basis: 100%; }
  .vf-chips { flex-wrap: wrap; overflow: visible; }
  .vf-info { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); max-width: calc(100% - 280px); }
  .vf-empty { padding: 70px 260px 16px 16px; }
}

/* ───────── Téléprompteur ───────── */
textarea.prompt-text { min-height: 42vh; font-size: 17px; line-height: 1.5; padding: 16px; border-radius: var(--radius); }
.prompter {
  position: fixed; inset: 0; z-index: 300; background: #000; color: #fff; overflow: hidden; touch-action: none;
  user-select: none; -webkit-user-select: none; cursor: pointer;
}
.prompter-scroll { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.prompter-scroll > div {
  margin: 0 auto; padding: 0 max(20px, env(safe-area-inset-left, 0px)); font-family: var(--font); font-weight: 600; line-height: 1.38;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.prompter.mirror .prompter-scroll { transform-origin: center top; }
.prompter-guide {
  position: absolute; left: 0; right: 0; top: 36%; height: 0; pointer-events: none;
  border-top: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.prompter-guide::before {
  content: ""; position: absolute; left: max(2px, env(safe-area-inset-left, 0px)); top: -10px;
  border: 9px solid transparent; border-left: 13px solid var(--accent);
}
.prompter-fade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(#000 0, transparent 14%, transparent 62%, #000 100%); }
.prompter-time {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: max(14px, env(safe-area-inset-right, 0px));
  font: 600 14px/1 var(--font-mono); color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums;
}
.prompter-count { position: absolute; inset: 0; display: grid; place-items: center; font: 800 min(40vw, 40vh)/1 var(--font-round); color: var(--accent); pointer-events: none; }
.prompter-bar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none; cursor: default;
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 22px; color: var(--fg);
  transition: opacity .3s, transform .3s;
}
.prompter-bar::-webkit-scrollbar { display: none; }
.prompter-bar.hide { opacity: 0; pointer-events: none; transform: translate(-50%, 14px); }
.prompter-bar .icon-btn { width: 34px; height: 34px; font-weight: 700; font-size: 14px; }
.prompter-bar .val { min-width: 3.9em; text-align: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.prompter-bar .val small { display: block; font-size: 10px; font-weight: 600; color: var(--fg-2); }

/* Divers */
.empty { text-align: center; color: var(--fg-2); padding: 28px 12px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.muted { color: var(--fg-2); }
.accent { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
