/* ==========================================================================
   Prospection DPE — tableau de bord
   Identité : bleu nuit et indigo, surfaces claires et calmes. Les seules
   couleurs vives sont celles de l'étiquette DPE, toujours accompagnées de
   leur lettre (A et B sont proches, même pour une vision normale).
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/inter-700.woff2") format("woff2"); }
@font-face { font-family: "Inter Display"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-display-600.woff2") format("woff2"); }
@font-face { font-family: "Inter Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/inter-display-700.woff2") format("woff2"); }

/* ---------- Jetons ---------- */

:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Display", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --page: #F3F4F8;
  --surface: #FFFFFF;
  --surface-2: #F6F7FA;
  --surface-3: #ECEEF4;
  --ink-1: #0B1020;
  --ink-2: #475069;
  --ink-3: #5F6780;
  --line: #E3E6EE;
  --line-soft: #EDEFF4;

  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-ink: #4338CA;
  --accent-soft: #EEF0FF;
  --on-accent: #FFFFFF;
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --on-primary: var(--on-accent);
  --focus: #4F46E5;

  --hot: #C2410C;
  --hot-soft: #FFF1EA;
  --danger: #B42318;
  --danger-soft: #FDEDEB;
  --warning: #8A5300;
  --warning-soft: #FFF4D6;
  --success: #067A53;
  --success-soft: #E6F4EE;

  --track: #ECEEF4;
  --bar: #4F46E5;
  --tooltip: #0B1020;
  --on-tooltip: #FFFFFF;

  /* Intensité du calendrier : une seule teinte, du clair au foncé (rampe validée) */
  --heat-0: #ECEEF4;
  --heat-1: #9FAEFB;
  --heat-2: #818CF8;
  --heat-3: #6366F1;
  --heat-4: #4F46E5;
  --heat-5: #3730A3;

  /* Barre latérale et bandeau principal : bleu nuit dans les deux thèmes */
  --night: #0B1020;
  --night-ink-2: #A9B1C6;
  --night-ink-3: #8790A8;
  --night-line: rgb(255 255 255 / 0.08);
  --night-hover: rgb(255 255 255 / 0.06);
  --night-active: rgb(255 255 255 / 0.10);
  --night-focus: #A5B4FC;

  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-tile: 0 1px 2px rgb(16 24 40 / 0.04), 0 4px 12px -4px rgb(16 24 40 / 0.06);
  --shadow-md: 0 1px 2px rgb(16 24 40 / 0.04), 0 10px 28px -8px rgb(16 24 40 / 0.14);
  --shadow-lg: 0 24px 64px rgb(16 24 40 / 0.20), 0 2px 8px rgb(16 24 40 / 0.08);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-tile: 22px;
  --sidebar: 256px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --z-sticky: 10;
  --z-nav: 20;
  --z-tooltip: 40;
  --z-toast: 60;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #05070B;
    --surface: #0E131B;
    --surface-2: #131925;
    --surface-3: #1B2230;
    --ink-1: #F2F4F9;
    --ink-2: #B7BFD0;
    --ink-3: #8B94A9;
    --line: #1F2633;
    --line-soft: #171D28;
    --accent: #818CF8;
    --accent-hover: #A5B4FC;
    --accent-ink: #A5B4FC;
    --accent-soft: #1A1F45;
    --on-accent: #0B1020;
    --focus: #A5B4FC;
    --hot: #FDBA8C;
    --hot-soft: #2A160E;
    --danger: #FF8B7B;
    --danger-soft: #3A1714;
    --warning: #F6C85F;
    --warning-soft: #33280F;
    --success: #4CD69B;
    --success-soft: #0E2B20;
    --track: #1B2230;
    --bar: #818CF8;
    --tooltip: #F2F4F9;
    --on-tooltip: #0B1020;
    --heat-0: #1B2230;
    --heat-1: #3D46A8;
    --heat-2: #5360D6;
    --heat-3: #7381F2;
    --heat-4: #9AA6FA;
    --heat-5: #C7CEFE;
    --night: #090D16;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.5);
    --shadow-tile: none;
    --shadow-md: 0 1px 2px rgb(0 0 0 / 0.5), 0 10px 28px -8px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 0.65);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding: 88px 0 168px; }
@media (min-width: 1024px) { html { scroll-padding: 24px 0 112px; } }
body {
  margin: 0;
  min-height: 100dvh;
  font: 400 16px/1.5 var(--font);
  color: var(--ink-1);
  background: radial-gradient(1100px 520px at 78% -14%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%) no-repeat, var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}
@media (min-width: 1024px) { body { font-size: 15px; } }

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
table { border-collapse: separate; border-spacing: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

/* ---------- Structure ---------- */

.sidebar {
  --focus: var(--night-focus);
  position: fixed; inset: 0 auto 0 0; z-index: var(--z-nav);
  width: var(--sidebar);
  display: none; flex-direction: column; gap: 28px;
  padding: 24px 16px 20px;
  color: #FFFFFF;
  background:
    radial-gradient(360px 240px at 0% 0%, rgb(99 102 241 / 0.26), transparent 70%),
    var(--night);
  border-right: 1px solid var(--night-line);
  overflow-y: auto;
}
.main {
  --main-max: 1280px;
  width: 100%; max-width: var(--main-max);
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
}
.page-dashboard .main { --main-max: 1480px; }
.main:focus { outline: none; }

@media (min-width: 768px) { .main { padding: 32px 32px 104px; } }
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  /* Centré dans l'espace laissé par la barre latérale sur les très grands écrans */
  .main { width: calc(100% - var(--sidebar)); margin-left: calc(var(--sidebar) + max(0px, (100% - var(--sidebar) - var(--main-max)) / 2)); padding: 36px 40px 64px; }
  .topbar, .tabbar { display: none !important; }
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; }
.brand-mark { display: flex; gap: 2px; align-items: flex-end; height: 18px; }
.brand-mark span { width: 4px; height: 18px; border-radius: 1.5px; }
.brand-text { display: grid; line-height: 1.25; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-zone { font-size: 12.5px; color: var(--ink-3); }
.sidebar .brand-zone { color: var(--night-ink-3); }

.nav { display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 12px;
  border-radius: 10px;
  color: var(--night-ink-2); font-weight: 500; text-decoration: none;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.nav-link:hover { background: var(--night-hover); color: #FFFFFF; }
.nav-link[aria-current="page"] { background: var(--night-active); color: #FFFFFF; font-weight: 600; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.04); }
.nav-link[aria-current="page"] .icon { color: #A5B4FC; stroke-width: 2; }

.sidebar .btn-primary { box-shadow: 0 10px 24px -10px rgb(99 102 241 / 0.9), inset 0 1px 0 rgb(255 255 255 / 0.16); }
.sidebar .btn-ghost { color: var(--night-ink-2); }
.sidebar .btn-ghost:hover:not(:disabled) { background: var(--night-hover); color: #FFFFFF; }

.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.status {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
  padding: 12px; border-radius: var(--radius); background: rgb(255 255 255 / 0.04); border: 1px solid var(--night-line);
}
.status-label { font-weight: 600; font-size: 13.5px; }
.status-detail { grid-column: 2; font-size: 12.5px; color: var(--night-ink-3); }

/* Pastille d'état : verte (active), ambrée (à configurer), grise (e-mail désactivé) */
.status-dot { --dot: var(--success); width: 8px; height: 8px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent); }
[data-state="waiting"] .status-dot { --dot: var(--warning); }
[data-state="pause"] .status-dot { --dot: var(--ink-3); }
.sidebar .status-dot { --dot: #34D399; }
.sidebar [data-state="waiting"] .status-dot { --dot: #FBBF24; }
.sidebar [data-state="pause"] .status-dot { --dot: var(--night-ink-3); }
@media (prefers-reduced-motion: no-preference) {
  [data-state="active"] .status-dot { animation: beacon 2.6s var(--ease) infinite; }
}
@keyframes beacon {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--dot) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--dot) 0%, transparent); }
}

/* Barre du haut et onglets du bas (mobile et tablette) */
.topbar {
  position: sticky; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { padding: 0; margin-right: auto; }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: var(--z-nav);
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: grid; justify-items: center; gap: 2px;
  min-height: 48px; padding: 6px 2px; border-radius: 10px;
  font-size: 11px; font-weight: 500; color: var(--ink-3); text-decoration: none; white-space: nowrap;
}
.tab .icon { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--accent-ink); font-weight: 600; }
.tab[aria-current="page"] .icon { stroke-width: 2.1; }

/* ---------- En-tête de page ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { font-family: var(--font-display); font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
.page-sub { margin-top: 6px; color: var(--ink-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13.5px; color: var(--ink-3); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink-1); text-decoration: underline; }
@media (min-width: 768px) { .page-title { font-size: 32px; } }

/* ---------- Grilles et cartes (pages de détail) ---------- */

.stack { display: grid; gap: 16px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 768px) { .grid, .stack { gap: 20px; } }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-tile);
  padding: 20px;
  min-width: 0;
}
@media (min-width: 768px) { .card { padding: 24px; } }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.card-meta { font-size: 13px; color: var(--ink-3); }
.section-gap { margin-top: 20px; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 11px;
  font-size: 14.5px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease), transform 100ms var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink-1); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: color-mix(in srgb, var(--line) 60%, var(--ink-3)); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink-1); }
.btn-light { background: #FFFFFF; color: #0B1020; font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); }
.btn-light:hover:not(:disabled) { background: #E0E7FF; }
.btn-glass { background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.18); color: #FFFFFF; }
.btn-glass:hover:not(:disabled) { background: rgb(255 255 255 / 0.15); border-color: rgb(255 255 255 / 0.28); }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; gap: 6px; }
.btn-icon { width: 40px; padding: 0; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-primary) var(--on-primary) transparent transparent;
  animation: spin 700ms linear infinite;
}
.btn-secondary.is-loading::after { border-color: var(--ink-1) var(--ink-1) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1023px) { .btn { min-height: 44px; } .btn-sm { min-height: 40px; } }

/* ---------- Puces ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip .icon { width: 14px; height: 14px; stroke-width: 2.25; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-error { background: var(--danger-soft); color: var(--danger); }
.chip-running, .chip-warning { background: var(--warning-soft); color: var(--warning); }

/* Étiquette DPE : couleur officielle + lettre, toujours ensemble */
.dpe {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 7px;
  font-size: 13px; font-weight: 700; line-height: 1;
}
.dpe-xs { width: 20px; height: 20px; border-radius: 6px; font-size: 11px; }
.dpe-sm { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }
.dpe-lg { width: 40px; height: 40px; border-radius: 11px; font-size: 18px; }
.dpe-A { background: #009C6D; color: #FFFFFF; }
.dpe-B { background: #52B153; color: #0E1116; }
.dpe-C { background: #A5CC74; color: #0E1116; }
.dpe-D { background: #F4E70F; color: #0E1116; }
.dpe-E { background: #F0B50F; color: #0E1116; }
.dpe-F { background: #EB8235; color: #0E1116; }
.dpe-G { background: #D7221F; color: #FFFFFF; }
.dpe-x { background: var(--surface-3); color: var(--ink-2); }

/* ---------- Encadrés ---------- */

.callout {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start;
  padding: 16px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--surface-2);
}
.callout > .icon { margin-top: 2px; }
.callout-title { font-weight: 600; }
.callout-text { grid-column: 2; color: var(--ink-2); font-size: 14px; }
.callout-action { grid-column: 2; margin-top: 8px; }
.callout-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 22%, transparent); }
.callout-warning > .icon { color: var(--warning); }
.callout-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.callout-danger > .icon { color: var(--danger); }
@media (min-width: 768px) {
  .callout { grid-template-columns: auto 1fr auto; align-items: center; }
  .callout-text { grid-column: 2; }
  .callout-action { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
}

/* ==========================================================================
   Tableau de bord
   La grille suit la largeur réelle du contenu (requêtes de conteneur), pas
   celle de l'écran : la barre latérale ne la déséquilibre jamais.
   ========================================================================== */

.dash { container-type: inline-size; }

.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.dash-date { font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.dash-title { margin-top: 8px; font-family: var(--font-display); font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; }
.dash-sub { margin-top: 8px; color: var(--ink-2); }
@container (min-width: 640px) { .dash-title { font-size: 42px; } }

.dash-status {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.dash-status-text { display: grid; line-height: 1.3; }
.dash-status-text strong { font-size: 13.5px; font-weight: 600; }
.dash-status-text span { font-size: 12.5px; color: var(--ink-3); }
@media (min-width: 1024px) { .dash-status { display: none; } }

.banner {
  --tone: var(--warning);
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 14px;
  margin-bottom: 20px; padding: 14px 16px; border-radius: 18px;
  background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent);
}
.banner-danger { --tone: var(--danger); background: var(--danger-soft); }
.banner-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.banner-title { font-weight: 600; }
.banner-text { margin-top: 2px; font-size: 14px; color: var(--ink-2); }
.banner .btn { grid-column: 1 / -1; justify-self: start; }
@container (min-width: 720px) {
  .banner { grid-template-columns: auto minmax(0, 1fr) auto; padding: 14px 16px 14px 14px; }
  .banner .btn { grid-column: auto; }
}

/* ---------- Grille « bento » ---------- */

.bento { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@container (min-width: 640px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
  .tile-hero, .tile-map, .tile-calendar, .tile-funnel, .tile-prospects { grid-column: span 6; }
  .tile-kpi, .tile-label, .tile-sectors { grid-column: span 3; }
}
@container (min-width: 1040px) {
  .bento { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .tile-hero { grid-column: span 6; }
  .tile-kpi { grid-column: span 3; }
  .tile-map { grid-column: span 8; }
  .tile-label { grid-column: span 4; }
  .tile-sectors { grid-column: span 5; }
  .tile-calendar { grid-column: span 7; }
  .tile-funnel, .tile-prospects { grid-column: span 12; }
}

.tile {
  position: relative; min-width: 0;
  display: flex; flex-direction: column;
  padding: 20px; border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-tile);
}
@container (min-width: 640px) { .tile { padding: 24px; border-radius: var(--radius-tile); } }

/* Le titre prend la place restante ; sur téléphone, la précision passe sous le titre. */
.tile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-bottom: 20px; min-width: 0; }
.tile-icon {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.tile-icon-hot { background: var(--hot-soft); color: var(--hot); }
.tile-title { flex: 1 1 0; min-width: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.tile-heading { flex: 1 1 0; min-width: 0; }
.tile-heading .tile-title { flex: none; }
.tile-sub { margin-top: 2px; font-size: 13.5px; color: var(--ink-3); text-wrap: pretty; }
.tile-meta { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.tile-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  margin-top: auto; padding-top: 20px;
  font-size: 14px; font-weight: 600; color: var(--accent-ink); text-decoration: none;
}
.tile-link:hover { text-decoration: underline; }
.tile-link .icon { transition: transform 150ms var(--ease); }
.tile-link:hover .icon { transform: translateX(2px); }
.tile-head .tile-link { margin: 0; padding: 0; align-self: center; white-space: nowrap; }
@container (max-width: 639px) {
  .tile-head .tile-meta, .tile-head .tile-link { flex-basis: 100%; padding-left: 46px; }
  .tile-head .tile-link { margin-top: 8px; }
}
.tile-note { margin-top: auto; padding-top: 16px; font-size: 12.5px; color: var(--ink-3); }
.tile-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px;
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--ink-3);
}
.tile-foot strong { color: var(--ink-1); font-weight: 600; }

/* ---------- Bandeau du dernier rapport ---------- */

.tile-hero {
  --focus: var(--night-focus);
  container-type: inline-size;
  overflow: hidden; isolation: isolate;
  color: #FFFFFF;
  border-color: transparent;
  background: #0B1020;
  box-shadow: 0 1px 2px rgb(11 16 32 / 0.18), 0 18px 40px -18px rgb(11 16 32 / 0.55);
}
/* Aurore : trois halos qui dérivent lentement. Translation et échelle seulement, sans
   rotation ni masque : fluide même sans carte graphique (rendu logiciel, bureau à distance). */
.tile-hero::after {
  content: ""; position: absolute; inset: -18% -12%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(42% 50% at 20% 26%, rgb(99 102 241 / 0.62), transparent 70%),
    radial-gradient(38% 44% at 84% 82%, rgb(16 185 129 / 0.30), transparent 70%),
    radial-gradient(30% 36% at 70% 14%, rgb(168 85 247 / 0.22), transparent 70%);
  animation: aurora 24s ease-in-out 2 alternate; /* un aller-retour, puis l'aurore se pose : sobre en énergie */
}
.tile-hero.is-offscreen::after { animation-play-state: paused; }
/* Grain et grille fine : de la matière, sans image à télécharger */
.tile-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px);
  background-size: 160px 160px, 28px 28px, 28px 28px;
}
.hero-body::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, #009C6D, #52B153, #A5CC74, #F4E70F, #F0B50F, #EB8235, #D7221F);
}
@media (prefers-color-scheme: dark) { .tile-hero { border-color: rgb(255 255 255 / 0.07); } }
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(5%, -4%, 0) scale(1.08); }
  100% { transform: translate3d(-4%, 5%, 0) scale(1.03); }
}

.hero-body { flex: 1 1 auto; display: flex; flex-direction: column; }
.hero-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.hero-eyebrow { font-size: 13px; font-weight: 600; color: #C7D2FE; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.1);
  font-size: 12.5px; font-weight: 500; color: #E0E7FF;
}
.hero-number {
  margin-top: 22px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(68px, 18cqi, 112px); line-height: 0.9; letter-spacing: -0.045em;
}
.hero-number span {
  background: linear-gradient(110deg, #FFFFFF 0 44%, #C7D2FE 50%, #FFFFFF 56% 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-unit { margin-top: 12px; font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; }
.hero-meta { margin-top: 4px; font-size: 14px; color: #C7D2FE; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 24px; }
.hero-of { font-size: 15px; font-weight: 500; color: #C7D2FE; letter-spacing: 0; }

/* Bandeau sur toute la largeur (tablette, petit portable) : boutons en bas à droite. */
@container (min-width: 700px) {
  .hero-body {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px;
    grid-template-areas: "top top" "number number" "unit actions" "meta actions" "window window";
  }
  .window { grid-area: window; }
  .hero-top { grid-area: top; }
  .hero-number { grid-area: number; }
  .hero-unit { grid-area: unit; }
  .hero-meta { grid-area: meta; }
  .hero-actions { grid-area: actions; align-self: end; padding-top: 0; }
}

.tile-welcome { padding: 32px; }
.tile-welcome .hero-unit { margin-top: 8px; font-size: 24px; }
.tile-welcome .hero-meta { max-width: 52ch; }

/* ---------- Indicateurs ---------- */

.kpi-number { font-family: var(--font-display); font-size: 52px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; }
.kpi-unit { margin-left: 6px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-2); }
.kpi-caption { margin-top: 8px; font-size: 14px; color: var(--ink-2); text-wrap: pretty; }
.kpi-foot { margin-top: auto; padding-top: 24px; }

.split { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.split-part { flex: 1 1 0; min-width: 6px; }
.split-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-foot .tile-link { padding-top: 18px; }
.split-legend li { display: inline-flex; align-items: center; gap: 8px; }

.parts { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.parts.kpi-foot { padding-top: 24px; }
.parts li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; font-size: 14px; }
.parts-label { color: var(--ink-2); }
.parts-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.parts-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.parts-track span { display: block; height: 100%; min-width: 3px; border-radius: 3px; background: var(--bar); }

/* ---------- Carte ---------- */

.map-frame {
  position: relative; isolation: isolate;
  flex: 1 1 auto; min-height: 340px;
  border-radius: 16px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
@container (min-width: 1040px) { .map-frame { min-height: 400px; } }
/* Plus spécifique que .maplibregl-map (position: relative), chargée après cette feuille. */
.map-frame > .map { position: absolute; inset: 0; }
.map-message {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center; padding: 24px;
  background: var(--surface-2); color: var(--ink-3); font-size: 14px; text-align: center;
}
.map-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.legend-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px 0 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-1);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.legend-chip .dpe { border-radius: 50%; }
.legend-chip:hover:not(:disabled) { border-color: color-mix(in srgb, var(--line) 40%, var(--ink-3)); }
.legend-chip[aria-pressed="false"] { background: transparent; border-style: dashed; color: var(--ink-3); }
.legend-chip[aria-pressed="false"] .dpe { background: var(--surface-3); color: var(--ink-3); }
.legend-chip[aria-pressed="false"] .legend-count { text-decoration: line-through; }
.legend-chip:disabled { opacity: 0.45; cursor: default; }
@media (max-width: 1023px) { .legend-chip { height: 40px; } }

/* Habillage de MapLibre aux couleurs de l'interface */
.map .maplibregl-ctrl-group { overflow: hidden; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md); }
.map .maplibregl-ctrl-group:not(:empty) { box-shadow: var(--shadow-md); }
.map .maplibregl-ctrl-group button { width: 34px; height: 34px; }
.map .maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.map .maplibregl-ctrl-group button:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.map .maplibregl-ctrl-attrib { font: 11px/1.4 var(--font); background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--ink-3); }
.map .maplibregl-ctrl-attrib a { color: var(--ink-2); }
.map .maplibregl-ctrl-attrib.maplibregl-compact { background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink-3); }
.map .maplibregl-cooperative-gesture-screen { font: 500 15px/1.4 var(--font); background: rgb(11 16 32 / 0.55); }
.map .maplibregl-popup-content {
  padding: 14px 16px 12px; border-radius: 14px;
  background: var(--surface); color: var(--ink-1); box-shadow: var(--shadow-lg);
  font: 400 14px/1.45 var(--font);
}
.map .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.map .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.map .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.map .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.map .maplibregl-popup-close-button { top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; font-size: 20px; line-height: 1; color: var(--ink-3); }
.map .maplibregl-popup-close-button:hover { background: var(--surface-3); color: var(--ink-1); }
@media (prefers-color-scheme: dark) {
  .map .maplibregl-ctrl-icon, .map .maplibregl-ctrl-attrib-button { filter: invert(1) hue-rotate(180deg); }
}

.pop { display: grid; gap: 12px; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding-right: 20px; }
.pop-entry + .pop-entry { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pop-title { font-weight: 600; overflow-wrap: anywhere; }
.pop-note { font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.pop-meta { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.pop-links { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; font-weight: 600; }
.pop-links a { color: var(--accent-ink); text-decoration: none; }
.pop-links a:hover { text-decoration: underline; }
.pop-more { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Étiquettes énergie : flèches proportionnelles ---------- */

/* Les flèches grandissent avec la place disponible (tuile étirée par la carte voisine) au lieu de s'écarter. */
.scale { flex: 1 1 auto; display: grid; grid-auto-rows: minmax(34px, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.scale-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px 44px; align-items: stretch; gap: 12px; }
.scale-track { display: flex; align-items: center; min-width: 0; }
.scale-count, .scale-share { align-self: center; }
.scale-arrow {
  display: flex; align-items: center;
  width: max(48px, var(--w)); height: min(100%, 46px); min-height: 34px; padding-left: 12px;
  border-radius: 8px 0 0 8px;
  background: var(--fill);
  font-size: 14px; font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
  transform-origin: left center;
}
.scale-count { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.scale-share { text-align: right; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- Secteurs ---------- */

.ranking { display: grid; margin: 0; padding: 0; list-style: none; }
.ranking-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: baseline; gap: 6px 10px;
  padding: 11px 0; border-top: 1px solid var(--line-soft);
}
.ranking-row:first-child { border-top: 0; padding-top: 0; }
.ranking-index { font-size: 12px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ranking-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.ranking-code { margin-left: 2px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.ranking-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.ranking-track { grid-column: 2 / -1; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.ranking-track span { display: block; height: 100%; border-radius: 3px; background: var(--bar); }

/* ---------- Calendrier ---------- */

.cal-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 24px 48px; }
.cal { --cell: 26px; display: flex; gap: 5px; }
.cal-days, .cal-col { display: grid; grid-template-rows: 18px repeat(7, var(--cell)); gap: 5px; }
.cal-days span { padding-right: 4px; font-size: 11px; font-weight: 500; line-height: var(--cell); color: var(--ink-3); text-align: right; }
.cal-month { width: var(--cell); font-size: 11px; font-weight: 600; line-height: 18px; color: var(--ink-3); white-space: nowrap; }
.cal-cell { display: block; width: var(--cell); height: var(--cell); border-radius: 7px; background: var(--heat-0); }
.cal-cell[data-level="1"] { background: var(--heat-1); }
.cal-cell[data-level="2"] { background: var(--heat-2); }
.cal-cell[data-level="3"] { background: var(--heat-3); }
.cal-cell[data-level="4"] { background: var(--heat-4); }
.cal-cell[data-level="5"] { background: var(--heat-5); }
.cal-cell[data-level="-1"] { background: repeating-linear-gradient(135deg, var(--line) 0 1.5px, transparent 1.5px 5px); box-shadow: inset 0 0 0 1px var(--line); }
@container (min-width: 1040px) { .cal { --cell: 28px; } }
.cal-facts { display: grid; gap: 18px; margin: 0; }
@container (min-width: 640px) and (max-width: 1039px) { .cal-facts { grid-auto-flow: column; gap: 18px 40px; } }
.cal-facts dt { font-size: 13px; color: var(--ink-3); }
.cal-facts dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0 0; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.025em; }
.fact-unit { margin-left: -4px; font-family: var(--font); font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.delta {
  display: inline-flex; align-items: center; gap: 4px; align-self: center;
  height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
  font-family: var(--font); font-size: 12.5px; font-weight: 600; letter-spacing: 0;
}
.delta[data-direction="up"] { background: var(--success-soft); color: var(--success); }
.delta[data-direction="down"] { background: var(--danger-soft); color: var(--danger); }
.delta .icon { width: 14px; height: 14px; stroke-width: 2.25; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 20px; font-size: 12px; color: var(--ink-3); }
.cal-legend .cal-cell { width: 14px; height: 14px; border-radius: 4px; }
.cal-legend > span:first-child { margin-right: 4px; }
.cal-legend > .cal-cell + span { margin-left: 4px; }
.cal-legend-gap { width: 16px; }

/* ---------- Passoires à prospecter ---------- */

/* Rangées toujours complètes : 6 fiches sur 2 ou 3 colonnes, 8 sur 4 colonnes (la liste entière est dans le rapport). */
.prospects { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
@container (min-width: 800px) { .prospects { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 640px) and (max-width: 1039px) { .prospect:nth-child(n+7) { display: none; } }
@container (min-width: 1040px) { .prospects { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.prospect {
  display: flex; flex-direction: column; min-width: 0;
  padding: 16px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.prospect-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.prospect-kind {
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-soft);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.prospect-title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.prospect-note { margin-top: 2px; font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.prospect-place { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.prospect-meta { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.prospect-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 16px; }
/* Sur téléphone : carrousel horizontal, la fiche suivante dépasse pour inviter à faire défiler. */
@container (max-width: 639px) {
  .prospects {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%;
    margin: 0 -20px; padding: 0 20px 4px; scroll-padding: 0 20px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
  }
  .prospects::-webkit-scrollbar { display: none; }
  .prospect { scroll-snap-align: start; }
}

/* ---------- Période affichée (bandeau) ---------- */

.window { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 18px; }
.window-label { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; font-size: 12.5px; font-weight: 600; color: #C7D2FE; }
.window-chip {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.16); background: rgb(255 255 255 / 0.06); color: #E0E7FF;
  font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.window-chip:hover { background: rgb(255 255 255 / 0.14); }
.window-chip.is-active { background: #FFFFFF; border-color: #FFFFFF; color: #0B1020; }
.window-input {
  min-height: 30px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.16); background: rgb(255 255 255 / 0.06); color: #E0E7FF;
  font: 600 12.5px var(--font); color-scheme: dark;
}
.window-input:focus-visible { outline-color: var(--night-focus); }

/* ---------- Filtres de la carte ---------- */

.map-tools { display: grid; gap: 10px; margin-top: 14px; }
.map-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.map-filters .select { width: auto; flex: 1 1 150px; }
.map-count { flex: 1 1 100%; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@container (min-width: 640px) { .map-count { flex: 0 1 auto; margin-left: auto; } }

/* Curseur de dates : deux poignées sur la répartition des DPE jour par jour */
.map-dates { display: grid; gap: 6px; padding: 12px 14px 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.map-dates-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; font-size: 13px; }
.map-dates-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-2); }
.map-dates-value { font-weight: 600; color: var(--accent-ink); }
.map-dates-reset { padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.map-dates-reset:hover { color: var(--ink-1); }
.range { position: relative; height: 58px; }
.range-histo { position: absolute; left: 11px; right: 11px; top: 2px; height: 32px; display: flex; align-items: flex-end; gap: 2px; }
.range-histo span { flex: 1 1 0; min-height: 2px; border-radius: 2px 2px 0 0; background: var(--line); transition: background-color 160ms var(--ease); }
.range-histo span.is-in { background: color-mix(in srgb, var(--accent) 60%, transparent); }
.range-track { position: absolute; left: 11px; right: 11px; top: 42px; height: 4px; border-radius: 2px; background: var(--track); }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--accent); }
.range-input {
  position: absolute; left: 0; right: 0; top: 33px; width: 100%; height: 22px; margin: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.range-input:focus { outline: none; }
.range-input::-webkit-slider-runnable-track { height: 22px; background: none; border: 0; }
.range-input::-moz-range-track { height: 22px; background: none; border: 0; }
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgb(16 24 40 / 0.25); cursor: grab;
  transition: transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 160ms var(--ease);
}
.range-input::-moz-range-thumb {
  pointer-events: auto; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgb(16 24 40 / 0.25); cursor: grab;
}
.range-input:hover::-webkit-slider-thumb { transform: scale(1.1); }
.range-input:active::-webkit-slider-thumb { transform: scale(1.18); cursor: grabbing; box-shadow: 0 0 0 6px var(--accent-soft); }
.range-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--focus); }
.range-input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--focus); }
.range-scale { display: flex; justify-content: space-between; margin-top: -2px; font-size: 11.5px; color: var(--ink-3); }

/* ==========================================================================
   Suivi de prospection : étapes, entonnoir, pipeline
   ========================================================================== */

:root {
  --stage-repere: #5F6780; --stage-repere-soft: #ECEEF4;
  --stage-a_traiter: #4338CA; --stage-a_traiter-soft: #EEF0FF;
  --stage-contacte: #0369A1; --stage-contacte-soft: #E0F2FE;
  --stage-rdv: #6D28D9; --stage-rdv-soft: #EDE9FE;
  --stage-mandat: #067A53; --stage-mandat-soft: #E6F4EE;
  --stage-sans_suite: #5F6780; --stage-sans_suite-soft: #ECEEF4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --stage-repere: #B7BFD0; --stage-repere-soft: #1B2230;
    --stage-a_traiter: #A5B4FC; --stage-a_traiter-soft: #1A1F45;
    --stage-contacte: #7DD3FC; --stage-contacte-soft: #0C2A3A;
    --stage-rdv: #C4B5FD; --stage-rdv-soft: #2E1065;
    --stage-mandat: #4CD69B; --stage-mandat-soft: #0E2B20;
    --stage-sans_suite: #8B94A9; --stage-sans_suite-soft: #1B2230;
  }
}

/* Sélecteur d'étape : une pastille colorée selon l'étape en cours */
.stage-select, .select.stage-select { width: auto; max-width: 100%; font-weight: 600; border-radius: 999px; border-color: transparent; }
.stage-select[data-stage="repere"] { background-color: var(--stage-repere-soft); color: var(--stage-repere); }
.stage-select[data-stage="a_traiter"] { background-color: var(--stage-a_traiter-soft); color: var(--stage-a_traiter); }
.stage-select[data-stage="contacte"] { background-color: var(--stage-contacte-soft); color: var(--stage-contacte); }
.stage-select[data-stage="rdv"] { background-color: var(--stage-rdv-soft); color: var(--stage-rdv); }
.stage-select[data-stage="mandat"] { background-color: var(--stage-mandat-soft); color: var(--stage-mandat); }
.stage-select[data-stage="sans_suite"] { background-color: var(--stage-sans_suite-soft); color: var(--stage-sans_suite); text-decoration: line-through; }
.stage-select:disabled { opacity: 0.6; }
.table .stage-select { min-height: 30px; }

.stage-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--stage-repere); }
.stage-dot[data-stage="a_traiter"] { background: var(--stage-a_traiter); }
.stage-dot[data-stage="contacte"] { background: var(--stage-contacte); }
.stage-dot[data-stage="rdv"] { background: var(--stage-rdv); }
.stage-dot[data-stage="mandat"] { background: var(--stage-mandat); }
.stage-dot[data-stage="sans_suite"] { background: var(--stage-sans_suite); }

/* Entonnoir */
.funnel { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.funnel-step {
  --tone: var(--stage-repere);
  flex: 1 1 150px; display: grid; align-content: start; gap: 2px;
  padding: 14px 16px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-top: 3px solid var(--tone);
  color: inherit; text-decoration: none;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 150ms var(--ease);
}
.funnel-step:hover { background: var(--surface-3); transform: translateY(-1px); }
.funnel-step[data-stage="a_traiter"] { --tone: var(--stage-a_traiter); }
.funnel-step[data-stage="contacte"] { --tone: var(--stage-contacte); }
.funnel-step[data-stage="rdv"] { --tone: var(--stage-rdv); }
.funnel-step[data-stage="mandat"] { --tone: var(--stage-mandat); }
.funnel-count { font-family: var(--font-display); font-size: 32px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.funnel-label { margin-top: 6px; font-size: 14px; font-weight: 600; }
.funnel-hint { font-size: 12.5px; color: var(--ink-3); }
.funnel-arrow { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 40px; color: var(--ink-3); }
.funnel-rate { font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.funnel-aside { display: inline-flex; align-items: center; gap: 8px; align-self: center; padding: 8px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
@media (min-width: 720px) { .funnel-arrow { display: flex; } .funnel-aside { margin-left: auto; } }
.card-funnel { padding: 16px 18px; }

/* Tableau (pipeline) */
/* Flexbox plutôt que grille : une grille à colonnes implicites fait déborder la page entière dans Chromium. */
.board {
  position: relative; /* contient les libellés .sr-only (absolus) des fiches qui défilent */
  display: flex; gap: 16px;
  margin-top: 20px; padding-bottom: 8px; overflow-x: auto; scroll-snap-type: x proximity;
}
@media (max-width: 767px) {
  .board { margin: 20px -16px 0; padding: 0 16px 8px; scroll-padding: 0 16px; scroll-snap-type: x mandatory; }
  .board .column { flex: 0 0 86%; scroll-snap-align: start; }
}
.column {
  flex: 1 0 0; min-width: 250px;
  display: flex; flex-direction: column; min-height: 320px;
  padding: 14px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.column.is-over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.column[data-stage="sans_suite"] { opacity: 0.85; }
.column-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.column-title { font-size: 15px; font-weight: 600; }
.column-count { margin-left: auto; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.column-hint { margin: 2px 4px 12px; font-size: 12.5px; color: var(--ink-3); }
.column-cards { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.column-empty { margin: 10px 0 0; padding: 22px 12px; border: 1.5px dashed var(--line); border-radius: 14px; text-align: center; font-size: 13px; color: var(--ink-3); }
.column.is-over .column-empty { border-color: var(--accent); color: var(--accent-ink); }

.pcard {
  display: grid; gap: 6px; padding: 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  cursor: grab; transition: box-shadow 150ms var(--ease), transform 150ms var(--ease);
}
.pcard:hover { box-shadow: var(--shadow-md); }
.pcard.is-dragging { opacity: 0.45; cursor: grabbing; }
.pcard-top { display: flex; align-items: center; gap: 8px; }
.pcard-kind { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pcard-grip { margin-left: auto; color: var(--ink-3); }
.pcard-title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.pcard-sub { font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.pcard-place { font-size: 13.5px; color: var(--ink-2); }
.pcard-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: var(--warning-soft); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.pcard-note .icon { margin-top: 1px; color: var(--warning); }
.pcard-editor { display: grid; gap: 8px; margin-top: 4px; }
.pcard-editor .textarea { min-height: 64px; font-size: 14px; }
.pcard-editor-actions { display: flex; gap: 6px; }
.pcard-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; margin-top: 4px; }
.pcard-since { font-size: 12px; color: var(--ink-3); }
.pcard-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.btn-xs { min-height: 28px; padding: 0 8px; font-size: 12.5px; gap: 4px; border-radius: 8px; }
@media (max-width: 1023px) { .btn-xs { min-height: 34px; } }
.pcard-move, .select.pcard-move { width: 100%; margin-top: 4px; font-weight: 600; }

/* ---------- Alertes ciblées ---------- */

.alert-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.alert-card { display: grid; gap: 16px; }
@media (min-width: 900px) { .alert-card { grid-template-columns: minmax(0, 1fr) auto; align-items: start; } }
.alert-card.is-paused { background: var(--surface-2); }
.alert-card.is-paused .alert-name { color: var(--ink-2); }
.alert-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.alert-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.alert-criteria { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.alert-recipients { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.alert-recipients .icon { flex: none; margin-top: 3px; color: var(--ink-3); }
.alert-meta { margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.alert-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.alert-actions form { display: contents; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.toggle-group, .check-group { display: flex; flex-wrap: wrap; gap: 6px; }
.check-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.check-pill:hover { border-color: var(--ink-3); }
.check-pill:has(:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.check-pill:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.alert-preview { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px; font-weight: 500; }

/* ---------- Infobulle des petits repères (semaines, jours) ---------- */

.tip {
  position: fixed; left: 0; top: 0; z-index: var(--z-tooltip); pointer-events: none;
  max-width: 260px; padding: 7px 10px; border-radius: 8px;
  background: var(--tooltip); color: var(--on-tooltip); box-shadow: var(--shadow-lg);
  font-size: 12.5px; font-weight: 500; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 8px));
  opacity: 0; transition: opacity 100ms var(--ease);
}
.tip.is-visible { opacity: 1; }

/* ---------- Entrée en scène ---------- */

@media (prefers-reduced-motion: no-preference) {
  .page-dashboard .dash-head, .page-dashboard .banner { animation: rise 520ms var(--ease-out) backwards; }
  .page-dashboard .tile { --tile-delay: calc(60ms + var(--i, 0) * 70ms); animation: rise 720ms var(--ease-out) backwards; animation-delay: var(--tile-delay); }
  .page-dashboard .scale-arrow { animation: grow 820ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 360ms + var(--r, 0) * 50ms); }
  .page-dashboard .hero-number span { animation: shine 1.5s var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 1.05s); }
  /* Tuiles hors de l'écran : en attente jusqu'à ce qu'elles y entrent (classe posée par app.js) */
  .reveal-ready .page-dashboard .tile:not(.in-view), .reveal-ready .page-dashboard .tile:not(.in-view) * { animation-play-state: paused; }
  .main > .page-head, .main > .crumbs { animation: rise 480ms var(--ease-out) backwards; }
  .main > .stack > *, .main > .card, .main > form.card, .main > .board, .main > .stack .alert-card { animation: rise 620ms var(--ease-out) backwards; animation-delay: 90ms; }
  .main > .stack > :nth-child(2) { animation-delay: 160ms; }
  .main > .stack > :nth-child(3) { animation-delay: 230ms; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.985); } }
@keyframes grow { from { opacity: 0; transform: scaleX(0.2); } }
@keyframes shine { from { background-position: 100% 0; } to { background-position: 0% 0; } }

/* ==========================================================================
   Pages de détail
   ========================================================================== */

/* ---------- Chiffres ---------- */

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.stat-value { font-family: var(--font-display); font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--ink-3); }

/* ---------- Barres horizontales ---------- */

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 56px 48px; align-items: center; gap: 14px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }
.bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-share { text-align: right; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.passoires {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2);
  font-size: 14px; color: var(--ink-2);
}
.passoires-chips { display: flex; gap: 4px; }
.passoires strong { color: var(--ink-1); }

.rank { display: grid; margin: 0; padding: 0; list-style: none; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.rank-row:first-child { border-top: 0; padding-top: 0; }
.rank-name { min-width: 0; overflow-wrap: anywhere; }
.rank-code { color: var(--ink-3); font-size: 13px; margin-left: 4px; }
.rank-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.rank-track { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.rank-fill { height: 100%; border-radius: 3px; background: var(--bar); }

/* Mini-répartition A→G (liste des rapports) */
.spectrum { display: flex; gap: 2px; height: 8px; width: 100%; min-width: 120px; border-radius: 4px; overflow: hidden; }
.spectrum span { height: 100%; min-width: 2px; }

details.data-view { margin-top: 16px; }
details.data-view summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
}
details.data-view summary::-webkit-details-marker { display: none; }
details.data-view summary::before { content: ""; width: 7px; height: 7px; border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor; transform: rotate(-45deg); transition: transform 150ms var(--ease); margin-right: 4px; }
details.data-view[open] summary::before { transform: rotate(45deg); }
details.data-view .table-wrap { margin-top: 12px; }

/* ---------- Tableaux ---------- */

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; font-size: 14px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-align: left; white-space: nowrap;
}
.table tbody th { position: static; background: none; border-bottom: 1px solid var(--line-soft); font-size: 14px; font-weight: 500; color: var(--ink-1); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact td, .table-compact th { padding: 8px 12px; }
.table .center { text-align: center; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { display: block; font-size: 13px; color: var(--ink-3); font-weight: 400; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table .error-line td { padding-top: 0; color: var(--danger); font-size: 13px; }
.table-links { display: flex; gap: 4px; justify-content: flex-end; }

.sort-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit;
}
.sort-btn::after { content: "↕"; font-size: 11px; opacity: 0.45; }
th[aria-sort="ascending"] .sort-btn::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .sort-btn::after { content: "↓"; opacity: 1; }
th[aria-sort] { color: var(--ink-1); }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.pager-info { font-size: 13.5px; color: var(--ink-3); }
.pager-buttons { display: flex; gap: 8px; }

/* Liste des rapports */
.report-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.report-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center;
  padding: 16px 0; border-top: 1px solid var(--line-soft);
}
.report-item:first-child { border-top: 0; padding-top: 0; }
.report-title { font-weight: 600; text-decoration: none; }
.report-title:hover { text-decoration: underline; }
.report-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.report-count { text-align: right; }
.report-count strong { display: block; font-size: 20px; letter-spacing: -0.01em; }
.report-spectrum { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.report-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) {
  .report-item { grid-template-columns: minmax(0, 1.4fr) minmax(160px, 1fr) 96px auto; }
  .report-spectrum, .report-actions { grid-column: auto; }
}

/* ---------- Filtres ---------- */

.filters { display: grid; gap: 12px; margin-bottom: 16px; }
@media (min-width: 768px) {
  .filters { grid-template-columns: minmax(0, 1fr) repeat(3, minmax(0, 180px)); align-items: center; }
  .filters .label-filter { grid-column: 1 / -1; grid-row: 2; }
}
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.label-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.label-toggle {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--ink-2);
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.label-toggle:hover { border-color: var(--ink-3); }
.label-toggle:is([aria-pressed="true"], :has(:checked)) { border-color: transparent; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-A { background: #009C6D; color: #FFFFFF; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-B { background: #52B153; color: #0E1116; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-C { background: #A5CC74; color: #0E1116; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-D { background: #F4E70F; color: #0E1116; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-E { background: #F0B50F; color: #0E1116; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-F { background: #EB8235; color: #0E1116; }
.label-toggle:is([aria-pressed="true"], :has(:checked)).dpe-G { background: #D7221F; color: #FFFFFF; }
.label-toggle:not([aria-pressed="true"]):not(:has(:checked)) { background: var(--surface) !important; color: var(--ink-2) !important; }
.label-toggle:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.filter-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 13.5px; color: var(--ink-3); }

/* ---------- Formulaires ---------- */

.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink-1);
  font-size: 16px; line-height: 1.4;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
@media (min-width: 1024px) { .input, .textarea, .select { font-size: 15px; min-height: 42px; } }
.select-sm, .select.select-sm { min-height: 34px; padding: 5px 30px 5px 12px; font-size: 13.5px; border-radius: 10px; background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }
@media (max-width: 1023px) { .select-sm, .select.select-sm { min-height: 38px; } }
.textarea { resize: vertical; min-height: 88px; }
.select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input:hover, .textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--ink-3)); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 0.85; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent) !important; }

.form-sections { display: grid; gap: 16px; }
@media (min-width: 768px) { .form-sections { gap: 20px; } }
.form-section { display: grid; gap: 20px; }
@media (min-width: 1024px) { .form-section { grid-template-columns: 260px minmax(0, 1fr); gap: 32px; } }
.form-section-head h2 { font-size: 16px; font-weight: 600; }
.form-section-head p { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.form-fields { display: grid; gap: 18px; }
@media (min-width: 640px) { .form-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .field-wide { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; align-content: start; }
.field-label { font-size: 14px; font-weight: 600; }
.field-label .optional { font-weight: 400; color: var(--ink-3); }
.field-help { font-size: 13px; color: var(--ink-3); }
.field-error { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; font-weight: 500; color: var(--danger); }
.field-error .icon { width: 15px; height: 15px; margin-top: 2px; }
.field-count { font-size: 13px; color: var(--ink-3); }

.password-field { position: relative; }
.password-field .input { padding-right: 48px; }
.reveal {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer;
}
.reveal:hover { color: var(--ink-1); background: var(--surface-2); }
.reveal .icon-hide { display: none; }
.reveal[aria-pressed="true"] .icon-show { display: none; }
.reveal[aria-pressed="true"] .icon-hide { display: block; }

.switch-row { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start; cursor: pointer; }
.switch-row .field-help { grid-column: 2; }
.switch {
  appearance: none; -webkit-appearance: none; position: relative; margin: 1px 0 0;
  width: 40px; height: 24px; border-radius: 999px; flex: none; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--line);
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgb(16 24 40 / 0.25);
  transition: transform 180ms var(--ease);
}
.switch:checked { background: var(--primary); border-color: var(--primary); }
.switch:checked::after { transform: translateX(16px); background: var(--on-primary); }
.switch-label { font-weight: 600; font-size: 14px; }

.error-summary { padding: 16px; border-radius: var(--radius); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.error-summary:focus { outline: 2px solid var(--danger); outline-offset: 2px; }
.error-summary h2 { font-size: 15px; font-weight: 600; color: var(--danger); }
.error-summary ul { margin: 8px 0 0; padding-left: 18px; }
.error-summary a { color: var(--danger); font-weight: 500; }

.save-bar {
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: var(--z-sticky);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 4px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}
.save-bar .save-state { margin-right: auto; font-size: 13.5px; color: var(--ink-3); }
@media (min-width: 1024px) { .save-bar { bottom: 16px; } }

.account {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; align-items: center;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.account-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); }
.account[data-connected="oui"] .account-icon { background: var(--success-soft); color: var(--success); }
.account-title { font-weight: 600; overflow-wrap: anywhere; }
.account-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 768px) { .account { grid-template-columns: auto minmax(0, 1fr) auto; } .account-actions { grid-column: auto; } }
.copy-field { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); }
.copy-field code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
.guide { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.guide summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.guide ol { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
.guide a { color: var(--ink-1); }
.inline-result { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.inline-result.is-ok { color: var(--success); }
.inline-result.is-error { color: var(--danger); }
.inline-result .icon { width: 16px; height: 16px; margin-top: 2px; }

/* ---------- Dialogues ---------- */

.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100dvh - 48px));
  padding: 0; border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--ink-1); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgb(11 16 32 / 0.5); backdrop-filter: blur(3px); }
.dialog[open] { animation: dialog-in 180ms var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog-body { padding: 24px; display: grid; gap: 12px; }
.dialog-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-text { color: var(--ink-2); }
.dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 20px 20px; }

.steps { display: grid; gap: 2px; margin: 4px 0 0; padding: 0; list-style: none; max-height: 320px; overflow-y: auto; }
.step { display: grid; grid-template-columns: 64px 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 6px 0; font-size: 14px; }
.step-time { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.step-icon { width: 16px; height: 16px; margin-top: 2px; color: var(--ink-3); }
.step[data-level="ok"] .step-icon { color: var(--success); }
.step[data-level="warn"] .step-icon { color: var(--warning); }
.step[data-level="error"] .step-icon, .step[data-level="error"] .step-message { color: var(--danger); }
.step-message { overflow-wrap: anywhere; }
.progress-line { height: 3px; border-radius: 2px; background: var(--track); overflow: hidden; }
.progress-line span { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: progress 1.1s var(--ease) infinite; }
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.outcome { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 14px 16px; border-radius: var(--radius); }
.outcome .icon { width: 20px; height: 20px; }
.outcome.is-ok { background: var(--success-soft); color: var(--success); }
.outcome.is-error { background: var(--danger-soft); color: var(--danger); }
.outcome-title { font-weight: 600; }
.outcome-text { grid-column: 2; color: var(--ink-2); font-size: 14px; }

/* ---------- Message éphémère ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: var(--z-toast);
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--tooltip); color: var(--on-tooltip); box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { color: #34D399; }
.toast.is-error .icon { color: #F87171; }
@media (prefers-color-scheme: dark) { .toast .icon { color: #067A53; } .toast.is-error .icon { color: #B42318; } }
@media (min-width: 1024px) { .toast { left: auto; right: 32px; bottom: 32px; transform: translateY(12px); } .toast.is-visible { transform: none; } }

/* ---------- États vides ---------- */

.empty { display: grid; justify-items: start; gap: 8px; padding: 8px 0; }
.empty-title { font-weight: 600; }
.empty-text { color: var(--ink-3); max-width: 56ch; }

/* ---------- Connexion ---------- */

.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--page);
}
.login-card { width: min(400px, 100%); display: grid; gap: 24px; }
.login-panel { padding: 28px 24px; }
@media (min-width: 640px) { .login-panel { padding: 32px; } }
.login-brand { display: grid; justify-items: center; gap: 14px; text-align: center; }
.login-brand .brand-mark { height: 28px; gap: 3px; }
.login-brand .brand-mark span { width: 6px; height: 28px; border-radius: 2px; }
.login-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.login-sub { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.login-form { display: grid; gap: 16px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }

/* Page d'erreur autonome */
.plain { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.plain-card { width: min(440px, 100%); padding: 32px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); display: grid; gap: 12px; }
.plain-card h1 { font-size: 22px; letter-spacing: -0.02em; }
.plain-card p { color: var(--ink-2); }

/* ==========================================================================
   Mouvement : survols, apparitions, transitions entre pages
   Transformations et opacité uniquement ; tout s'éteint avec « réduire les animations ».
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  /* Tuiles et cartes : relèvement au survol, icône qui s'incline */
  @media (hover: hover) {
    .tile, .prospect, .pcard, .alert-card, .funnel-step { transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 260ms var(--ease-out), background-color 150ms var(--ease); }
    .tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
    .tile-hero:hover { border-color: transparent; box-shadow: 0 1px 2px rgb(11 16 32 / 0.18), 0 26px 48px -20px rgb(79 70 229 / 0.55); }
    .tile-icon { transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1); }
    .tile:hover .tile-icon { transform: rotate(-8deg) scale(1.08); }
    .prospect:hover, .alert-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
    .scale-arrow { transition: transform 200ms var(--ease-out), filter 200ms var(--ease-out); }
    .scale-row:hover .scale-arrow { transform: translateX(3px); filter: brightness(1.06) saturate(1.1); }
    .ranking-row:hover .ranking-track span, .parts li:hover .parts-track span { filter: brightness(1.15); }
    .nav-link .icon, .tab .icon { transition: transform 220ms var(--ease-out); }
    .nav-link:hover .icon { transform: translateX(2px) scale(1.1); }
    .brand:hover .brand-mark span { animation: equalizer 640ms var(--ease-out); animation-delay: calc(var(--k, 0) * 45ms); }
  }

  /* Barres qui poussent, cellules qui éclosent, étapes qui se déploient */
  .ranking-track span, .parts-track span, .split-part { transform-origin: left; animation: grow-x 900ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 300ms + var(--n, 0) * 70ms); }
  .cal-col .cal-cell { animation: pop 460ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 260ms + var(--d, 0) * 10ms); }
  .funnel-step { animation: rise 600ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 160ms + var(--n, 0) * 90ms); }
  .funnel-arrow { animation: fade 600ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 640ms); }
  .funnel-aside { animation: fade 600ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 760ms); }
  .cal-facts > div { animation: rise 600ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 300ms + var(--n, 0) * 90ms); }
  .legend-chip, .map-filters .select, .map-dates { animation: rise 520ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 360ms + var(--n, 0) * 40ms); }
  .prospect { animation: rise 620ms var(--ease-out) backwards; animation-delay: calc(var(--tile-delay, 0ms) + 200ms + var(--n, 0) * 60ms); }
  .pcard { animation: rise 560ms var(--ease-out) backwards; animation-delay: calc(140ms + var(--n, 0) * 50ms); }
  #dpe-rows tr { animation: row-in 380ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 22ms); }
  #dpe-rows.is-quiet tr { animation: none; }
  .login::before { animation: aurora 30s ease-in-out infinite alternate; }
  .login-brand { animation: rise 620ms var(--ease-out) backwards; }
  .login-panel { animation: rise 680ms var(--ease-out) 90ms backwards; }
  .login-foot { animation: fade 600ms var(--ease-out) 320ms backwards; }
  .login .brand-mark span { transform-origin: bottom; animation: equalizer-in 820ms var(--ease-out) backwards; animation-delay: calc(120ms + var(--k, 0) * 55ms); }

  /* Micro-interactions */
  .cal-col .cal-cell { transition: transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 160ms var(--ease); }
  .cal-col .cal-cell:hover { position: relative; z-index: 1; transform: scale(1.32); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
  .btn { transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 200ms var(--ease), transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1); }
  .btn:active:not(:disabled) { transform: scale(0.95); }
  .legend-chip, .check-pill, .window-chip, .label-toggle, .tab { transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease); }
  .legend-chip:active, .check-pill:active, .window-chip:active, .label-toggle:active { transform: scale(0.94); }
  .tab:active { transform: scale(0.9); }
  .stage-select.is-saved { animation: ring 720ms var(--ease-out); }
  .pcard.is-dragging { opacity: 0.55; transform: rotate(2deg) scale(1.02); }
  .pcard.is-dropped { animation: landed 560ms var(--ease-out); }
  .pcard-note { animation: rise 320ms var(--ease-out); }
  .toast { transition: opacity 220ms var(--ease), transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1); }
  .dialog[open] { animation: dialog-in 340ms cubic-bezier(0.34, 1.4, 0.64, 1); }
  .map-frame > .map { opacity: 0; transition: opacity 700ms var(--ease-out); }
  .map-frame.is-ready > .map { opacity: 1; }
  .map-message[data-loading]:not([hidden]) { background: linear-gradient(100deg, var(--surface-2) 35%, var(--surface-3) 50%, var(--surface-2) 65%); background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
  details.data-view[open] .table-wrap { animation: rise 360ms var(--ease-out); }
  .nav-link::before { transition: transform 260ms var(--ease-out); }
}

/* Indicateur de page : un trait qui glisse à gauche de l'entrée active */
.nav-link { position: relative; }
.nav-link::before { content: ""; position: absolute; left: -6px; top: 11px; bottom: 11px; width: 3px; border-radius: 2px; background: #A5B4FC; transform: scaleY(0); }
.nav-link[aria-current="page"]::before { transform: scaleY(1); }
.brand-mark span { transform-origin: bottom; }
.brand-mark span:nth-child(1) { --k: 0; } .brand-mark span:nth-child(2) { --k: 1; } .brand-mark span:nth-child(3) { --k: 2; } .brand-mark span:nth-child(4) { --k: 3; }
.brand-mark span:nth-child(5) { --k: 4; } .brand-mark span:nth-child(6) { --k: 5; } .brand-mark span:nth-child(7) { --k: 6; }
.ranking-row:nth-child(1), .parts li:nth-child(1), .funnel-step:nth-of-type(1), .cal-facts > div:nth-child(1), .legend-chip:nth-child(1), .prospect:nth-child(1), .pcard:nth-child(1), .map-filters .select:nth-of-type(1) { --n: 0; }
.ranking-row:nth-child(2), .parts li:nth-child(2), .funnel-step:nth-of-type(2), .cal-facts > div:nth-child(2), .legend-chip:nth-child(2), .prospect:nth-child(2), .pcard:nth-child(2), .map-filters .select:nth-of-type(2) { --n: 1; }
.ranking-row:nth-child(3), .parts li:nth-child(3), .funnel-step:nth-of-type(3), .cal-facts > div:nth-child(3), .legend-chip:nth-child(3), .prospect:nth-child(3), .pcard:nth-child(3), .map-filters .select:nth-of-type(3) { --n: 2; }
.ranking-row:nth-child(4), .funnel-step:nth-of-type(4), .legend-chip:nth-child(4), .prospect:nth-child(4), .pcard:nth-child(4) { --n: 3; }
.ranking-row:nth-child(5), .legend-chip:nth-child(5), .prospect:nth-child(5), .pcard:nth-child(5) { --n: 4; }
.ranking-row:nth-child(6), .legend-chip:nth-child(6), .prospect:nth-child(6), .pcard:nth-child(6) { --n: 5; }
.ranking-row:nth-child(7), .legend-chip:nth-child(7), .prospect:nth-child(7), .pcard:nth-child(7) { --n: 6; }
.ranking-row:nth-child(8), .prospect:nth-child(8), .pcard:nth-child(n+8) { --n: 7; }

/* Icônes des tuiles : léger relief */
.tile-icon { background: linear-gradient(140deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 50%, var(--surface))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
.tile-icon-hot { background: linear-gradient(140deg, var(--hot-soft), color-mix(in srgb, var(--hot-soft) 50%, var(--surface))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hot) 16%, transparent); }
@media (prefers-color-scheme: dark) {
  .tile:not(.tile-hero), .card { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.035); }
}

/* Pipeline : liseré de l'étape en tête de colonne */
.column { --tone: var(--stage-contacte); border-top: 3px solid var(--tone); }
.column[data-stage="rdv"] { --tone: var(--stage-rdv); }
.column[data-stage="mandat"] { --tone: var(--stage-mandat); }
.column[data-stage="sans_suite"] { --tone: var(--stage-sans_suite); }

/* Bandeau d'accueil (aucun rapport) : le liseré de l'étiquette DPE */
.tile-welcome { background: linear-gradient(90deg, #009C6D, #52B153, #A5CC74, #F4E70F, #F0B50F, #EB8235, #D7221F) bottom / 100% 4px no-repeat, #0B1020; }

/* Connexion : la même aurore que le bandeau, en plus discret */
.login { position: relative; isolation: isolate; overflow: hidden; }
.login::before {
  content: ""; position: absolute; inset: -30%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(30% 34% at 30% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(26% 30% at 72% 72%, rgb(16 185 129 / 0.13), transparent 70%);
}

/* Boutons : léger relief, lueur au survol, reflet qui traverse */
.btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgb(255 255 255 / 0.26) 50%, transparent 65%);
  transform: translateX(-130%);
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .btn-primary::before { transition: transform 750ms var(--ease-out); }
  .btn-primary:hover::before { transform: translateX(130%); }
}
.btn-primary { background-image: linear-gradient(180deg, rgb(255 255 255 / 0.14), rgb(255 255 255 / 0)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 1px 2px rgb(16 24 40 / 0.12); }
.btn-primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 8px 18px -8px color-mix(in srgb, var(--primary) 75%, transparent); }
.sidebar .btn-primary:hover:not(:disabled) { box-shadow: 0 0 0 4px rgb(99 102 241 / 0.22), 0 12px 24px -10px rgb(99 102 241 / 0.9), inset 0 1px 0 rgb(255 255 255 / 0.16); }
.board { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* Transitions entre pages (navigateurs compatibles) : fondu et glissement, barres fixes */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 160ms var(--ease) both; }
::view-transition-new(root) { animation: vt-in 300ms var(--ease-out) both; }
.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }
.tabbar { view-transition-name: tabbar; }
::view-transition-group(sidebar), ::view-transition-group(topbar), ::view-transition-group(tabbar) { animation-duration: 0s; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes pop { from { opacity: 0; transform: scale(0.4); } }
@keyframes fade { from { opacity: 0; } }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
@keyframes landed { 0% { transform: scale(0.96); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { transform: none; box-shadow: 0 0 0 14px transparent; } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes equalizer { 0%, 100% { transform: scaleY(1); } 40% { transform: scaleY(0.35); } 70% { transform: scaleY(1.08); } }
@keyframes equalizer-in { from { opacity: 0; transform: scaleY(0.2); } }

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .progress-line span { width: 100%; animation: none; opacity: 0.4; }
  *, *::before, *::after { animation-delay: 0ms !important; transition-delay: 0ms !important; }
  .tile-hero::after, .login::before { animation: none; }
  .map-frame > .map { opacity: 1; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sidebar, .topbar, .tabbar, .page-actions, .filters, .pager, .save-bar, .map-legend, .map-filters, .map-dates, .hero-actions, .window { display: none !important; }
  .main { margin: 0; padding: 0; max-width: none; width: auto; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
}
