/*
 * DiagSAV — design 2026
 * Bleu nuit + bordeaux, Poppins pour les titres, Open Sans pour la lecture,
 * JetBrains Mono pour les codes. Fond gris-bleu, cartes blanches arrondies,
 * en-têtes en dégradé bleu nuit. Les capsules (badges, pastilles) restent
 * rectangulaires.
 */
:root {
  --navy: #17384c;
  --navy-deep: #102a3a;
  --navy-mid: #24506a;
  --navy-soft: #e8eff3;
  --accent: #9b484d;
  --accent-dark: #7d373d;
  --accent-soft: #f8eeee;
  --accent-light: #f0c9cc;

  --background: #eef2f4;
  --surface: #ffffff;
  --surface-soft: #f5f7f8;
  --text: #1d2b34;
  --text-muted: #66757e;
  --border: #e3e8eb;
  --border-strong: #cfd8dc;

  --success: #1f7a4c;
  --success-soft: #e9f6ef;
  --warning: #8a5a1c;
  --warning-soft: #fdf5e6;
  --danger: #a3343c;
  --danger-soft: #fbecec;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(16, 42, 58, 0.05);
  --shadow: 0 1px 2px rgba(16, 42, 58, 0.04), 0 12px 28px -18px rgba(16, 42, 58, 0.28);
  --shadow-hover: 0 1px 2px rgba(16, 42, 58, 0.04), 0 18px 36px -18px rgba(16, 42, 58, 0.38);
  --shadow-lg: 0 24px 48px -28px rgba(16, 42, 58, 0.45);
  --gradient: linear-gradient(135deg, #102a3a 0%, #17384c 58%, #24506a 100%);
  --ring: 0 0 0 4px rgba(23, 56, 76, 0.12);

  --font-title: "Poppins", Arial, sans-serif;
  --font-text: "Open Sans", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Alias conservés pour les vues existantes */
  --red-dark: var(--navy-deep);
  --red-mid: var(--navy);
  --red: var(--accent);
  --red-light: #cfb0b3;
  --red-pale: var(--accent-soft);
  --ink: var(--text);
  --ink-soft: var(--text-muted);
  --paper: var(--surface);
  --paper-soft: var(--surface-soft);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  color: var(--navy-deep);
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--accent-light);
  color: var(--navy-deep);
}

:focus-visible {
  outline: 3px solid rgba(155, 72, 77, 0.28);
  outline-offset: 2px;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

/* ------------------------------------------------------------------ */
/* Navigation                                                          */
/* ------------------------------------------------------------------ */
.nav {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(207, 216, 220, 0.6);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}

.nav-inner {
  display: flex;
  width: min(1120px, calc(100% - 40px));
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--navy-deep);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: var(--gradient);
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 14px -6px rgba(16, 42, 58, 0.55);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
}

.brand-domain {
  color: var(--accent);
}

.brand-context {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--surface-soft);
  color: var(--navy-deep);
}

.nav-link--active {
  background: var(--navy-soft);
  color: var(--navy-deep);
  font-weight: 600;
}

.nav-link--accent {
  color: var(--accent-dark);
}

/* ------------------------------------------------------------------ */
/* En-têtes : bandeau bleu nuit arrondi                                */
/* ------------------------------------------------------------------ */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(1120px, calc(100% - 40px));
  margin: 20px auto 0;
  padding: 56px 28px 96px;
  border-radius: var(--radius-xl);
  background: var(--gradient);
  color: #ffffff;
  text-align: center;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.hero::before {
  top: -140px;
  right: -90px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13), transparent 68%);
}

.hero::after {
  bottom: -180px;
  left: -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(155, 72, 77, 0.32), transparent 70%);
}

.hero .eyebrow,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-light);
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 820px;
  margin: 16px auto 14px;
  color: #ffffff;
  font-size: clamp(2rem, 4.6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.hero p {
  max-width: 660px;
  margin-inline: auto;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.02rem;
}

.hero-compact {
  padding: 30px 30px 32px;
  text-align: left;
}

.container > .hero-compact {
  width: 100%;
  margin: 0;
}

.hero-compact h1,
.hero-compact p {
  max-width: none;
  margin-inline: 0;
}

.hero-compact h1 {
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  letter-spacing: -0.02em;
}

.hero-compact p {
  font-size: 0.95rem;
}

/* Avertissement (chevauche le bas de l'en-tête) */
.disclaimer {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(980px, calc(100% - 72px));
  align-items: flex-start;
  gap: 12px;
  margin: -52px auto 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-lg);
  color: #4a5a63;
  font-size: 0.86rem;
  line-height: 1.5;
}

.notice-icon {
  display: inline-flex;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--warning-soft);
  color: var(--warning);
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* Outil de recherche                                                  */
/* ------------------------------------------------------------------ */
.tool {
  width: min(980px, calc(100% - 40px));
  margin: 22px auto 0;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--background);
}

.tab {
  display: inline-flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.25;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab:hover {
  color: var(--navy-deep);
}

.tab.active {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 42, 58, 0.08), 0 6px 14px -8px rgba(16, 42, 58, 0.3);
  color: var(--navy-deep);
  font-weight: 600;
}

.field {
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  margin-bottom: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select.field {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%2366757e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 15px center;
  background-repeat: no-repeat;
}

.field::placeholder {
  color: #8a979e;
}

.field:hover {
  border-color: #b9c5cb;
}

.field:focus {
  border-color: var(--navy);
  box-shadow: var(--ring);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.photo-drop {
  display: flex;
  min-height: 200px;
  align-items: center;
  justify-content: center;
  padding: 30px 18px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  color: var(--navy);
  font-family: var(--font-title);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.photo-drop:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.photo-drop img {
  max-height: 260px;
  margin-inline: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------------------ */
/* Boutons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: none;
}

.btn-primary {
  min-width: 220px;
  background: var(--accent);
  box-shadow: 0 10px 22px -12px rgba(155, 72, 77, 0.7);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-primary:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.btn-outline {
  border-color: var(--border-strong);
  background: #ffffff;
  color: var(--navy-deep);
}

.btn-outline:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
}

.btn-accent:hover {
  background: var(--accent-dark);
}

.btn-small {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
}

/* ------------------------------------------------------------------ */
/* Messages                                                            */
/* ------------------------------------------------------------------ */
.error-box,
.success-box {
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.error-box {
  margin-top: 12px;
  border: 1px solid #efc9cc;
  background: var(--danger-soft);
  color: var(--danger);
  white-space: pre-wrap;
}

.success-box {
  margin-bottom: 16px;
  border: 1px solid #bfe2cf;
  background: var(--success-soft);
  color: var(--success);
}

.safety {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-top: 14px;
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.86rem;
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Résultats (ancien affichage en liste, gardé pour les autres pages)  */
/* ------------------------------------------------------------------ */
.result {
  width: min(980px, calc(100% - 40px));
  margin: 22px auto 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.result .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  margin-bottom: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result h2 {
  margin-bottom: 20px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

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

.code-card .code {
  margin-bottom: 4px;
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
}

.code-card .desc,
.code-card .sol {
  font-size: 0.9rem;
}

.code-card .desc {
  margin-bottom: 6px;
  color: var(--text-muted);
}

.code-card .sol {
  color: var(--text);
  font-weight: 600;
}

.code-card .piece {
  padding-top: 9px;
  margin-top: 9px;
  border-top: 1px dashed var(--border-strong);
  color: var(--navy-deep);
  font-size: 0.84rem;
  font-weight: 600;
}

.code-card .piece a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.doc-links a,
.export-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #ffffff;
  color: var(--navy-deep);
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.doc-links a:hover,
.export-link:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

/* ------------------------------------------------------------------ */
/* Codes erreur : grille, filtres, panneau de détail                   */
/* ------------------------------------------------------------------ */
.result.dc {
  width: min(1120px, calc(100% - 40px));
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.dc-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 20px;
  overflow: hidden;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--gradient);
  color: #ffffff;
}

.dc-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -70px;
  right: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13), transparent 70%);
}

.dc-hero-icon {
  display: grid;
  width: 54px;
  height: 54px;
  flex: none;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
}

.dc-hero-text {
  min-width: 0;
  flex: 1 1 260px;
}

.dc-type {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  opacity: 0.75;
  text-transform: uppercase;
}

.dc-name {
  margin: 2px 0 4px;
  color: #ffffff;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  overflow-wrap: anywhere;
}

.dc-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
}

.dc-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #4cd18a;
  box-shadow: 0 0 0 4px rgba(76, 209, 138, 0.2);
}

.dc-dot--busy {
  background: #f2c14e;
  box-shadow: 0 0 0 4px rgba(242, 193, 78, 0.25);
  animation: dc-pulse 1.2s ease-in-out infinite;
}

.dc-dot--stop {
  background: #e7a0a5;
  box-shadow: 0 0 0 4px rgba(231, 160, 165, 0.25);
}

@keyframes dc-pulse {
  50% { box-shadow: 0 0 0 7px rgba(242, 193, 78, 0.05); }
}

.dc-retry {
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
}

.dc-stats {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.dc-stat {
  min-width: 96px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.dc-stat b {
  display: block;
  font-family: var(--font-title);
  font-size: 1.35rem;
  line-height: 1.15;
}

.dc-stat span {
  font-size: 0.74rem;
  opacity: 0.8;
}

.dc-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}

.dc.is-loading .dc-progress {
  opacity: 1;
}

.dc-progress span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  background: linear-gradient(90deg, transparent, #f2c14e, transparent);
  animation: dc-slide 1.4s linear infinite;
}

@keyframes dc-slide {
  from { left: -35%; }
  to { left: 100%; }
}

.dc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.dc-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--navy-deep);
  font-size: 0.8rem;
  font-weight: 600;
}

.dc-links a:hover {
  border-color: var(--navy);
}

.dc-toolbar {
  position: sticky;
  z-index: 5;
  top: var(--dc-top, 0px);
  padding: 12px 0 10px;
  margin-top: 4px;
  background: rgba(238, 242, 244, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.device-card .dc-toolbar {
  background: rgba(255, 255, 255, 0.9);
}

.dc-search {
  display: flex;
  height: 48px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
}

.dc-search:focus-within {
  border-color: var(--navy);
  box-shadow: var(--ring);
}

.dc-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: 0.95rem;
}

.dc-search kbd {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font: 600 0.72rem var(--font-mono);
}

.dc-chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dc-chips::-webkit-scrollbar {
  display: none;
}

.dc-chip {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 0; /* capsules rectangulaires */
  background: #ffffff;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.dc-chip em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 500;
}

.dc-chip.is-on {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.dc-chip.is-on em {
  color: #c9d6de;
}

.dc-fdot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}

.dc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
  margin-top: 6px;
}

.dc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.dc-tile {
  position: relative;
  display: flex;
  min-height: 116px;
  flex-direction: column;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  color: inherit;
  font: inherit;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

button.dc-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.dc-tile.is-open {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(23, 56, 76, 0.14), var(--shadow-hover);
  transform: none;
}

.dc-code {
  padding-right: 16px;
  color: var(--navy-deep);
  font: 700 1.45rem/1.05 var(--font-mono);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.dc-tile.is-open .dc-code {
  color: var(--accent);
}

.dc-desc {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dc-fam {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dc-sev {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
}

.dc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dc-tile .dc-sev {
  position: absolute;
  top: 12px;
  right: 12px;
}

.dc-sev--securite { background: #d64545; box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.15); }
.dc-sev--alerte { background: #e0a030; box-shadow: 0 0 0 3px rgba(224, 160, 48, 0.18); }
.dc-sev--info { background: #9aa6ad; box-shadow: 0 0 0 3px rgba(154, 166, 173, 0.18); }

.dc-tile--skeleton {
  pointer-events: none;
  background: linear-gradient(100deg, #ffffff 30%, #f1f4f6 50%, #ffffff 70%);
  background-size: 300% 100%;
  animation: dc-shimmer 1.3s linear infinite;
}

.dc-tile--skeleton span {
  display: block;
  height: 22px;
  width: 46px;
  border-radius: 6px;
  background: #e8edf0;
}

.dc-tile--skeleton span + span {
  width: 90%;
  height: 10px;
  margin-top: 12px;
}

.dc-tile--skeleton span + span + span {
  width: 60%;
  margin-top: 6px;
}

@keyframes dc-shimmer {
  to { background-position: -150% 0; }
}

.dc-empty {
  padding: 34px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.dc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 2px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.dc-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dc-panel {
  position: sticky;
  top: calc(var(--dc-top, 0px) + 124px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.dc-panel-empty {
  padding: 40px 26px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.dc-panel-empty svg {
  margin: 0 auto;
  color: #9aa6ad;
}

.dc-panel-empty b {
  display: block;
  margin: 12px 0 4px;
  color: var(--text);
  font-family: var(--font-title);
  font-size: 1rem;
}

.dc-handle {
  display: none;
}

.dc-panel-head {
  position: relative;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.dc-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text-muted);
}

.dc-close:hover {
  background: var(--navy-soft);
  color: var(--navy-deep);
}

.dc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 40px;
}

.dc-tag {
  padding: 4px 8px;
  border-radius: 0; /* capsules rectangulaires */
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dc-tag--securite { background: #fbe9e9; color: #b23434; }
.dc-tag--alerte { background: #fdf3e1; color: #8f620f; }
.dc-tag--info { background: #eef1f3; color: #5c676e; }
.dc-tag--fam { background: var(--navy-soft); color: var(--navy); }

.dc-bigcode {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}

.dc-bigcode b {
  color: var(--navy-deep);
  font: 700 2.5rem/1 var(--font-mono);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.dc-copy {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.dc-copy:hover {
  border-color: var(--navy);
  color: var(--navy-deep);
}

.dc-title {
  margin-top: 10px;
  font-size: 1.06rem;
  line-height: 1.35;
}

.dc-panel-body {
  padding: 18px 22px 20px;
}

.dc-label {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dc-steps {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: dcstep;
}

.dc-steps li {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.9rem;
  line-height: 1.45;
  counter-increment: dcstep;
}

.dc-steps li:last-child {
  border-bottom: 0;
}

.dc-steps li::before {
  content: counter(dcstep);
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #ffffff;
  font: 600 0.75rem var(--font-title);
}

.dc-part {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--background);
}

.dc-part > div:nth-child(2) {
  min-width: 0;
  flex: 1 1 140px;
}

.dc-part-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border-radius: 10px;
  background: #ffffff;
  color: var(--navy);
}

.dc-part small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.dc-part strong {
  font-size: 0.9rem;
}

.dc-part a {
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.dc-part a:hover {
  background: var(--accent-dark);
}

.dc-safety {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.8rem;
  line-height: 1.45;
}

.dc-safety svg {
  flex: none;
  margin-top: 1px;
}

.dc-nav {
  display: flex;
  border-top: 1px solid var(--border);
}

.dc-nav button {
  flex: 1;
  padding: 13px;
  border: 0;
  background: #ffffff;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 600;
}

.dc-nav button:hover {
  background: var(--surface-soft);
}

.dc-nav button + button {
  border-left: 1px solid var(--border);
}

.dc-scrim {
  display: none;
}

@media (max-width: 860px) {
  .dc-hero {
    padding: 18px;
    border-radius: 16px;
  }

  .dc-hero-icon {
    width: 44px;
    height: 44px;
  }

  .dc-stats {
    width: 100%;
    margin-left: 0;
  }

  .dc-stat {
    min-width: 0;
    flex: 1;
    padding: 8px 12px;
  }

  .dc-stat b {
    font-size: 1.15rem;
  }

  .dc-search kbd {
    display: none;
  }

  .dc-layout {
    display: block;
  }

  .dc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .dc-tile {
    min-height: 94px;
    padding: 11px 10px 9px;
    border-radius: 12px;
  }

  .dc-code {
    font-size: 1.15rem;
  }

  .dc-desc {
    margin-top: 6px;
    font-size: 0.72rem;
  }

  .dc-fam {
    display: none;
  }

  .dc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dc-tile .dc-sev {
    top: 10px;
    right: 10px;
    width: 7px;
    height: 7px;
  }

  .dc-panel {
    position: fixed;
    z-index: 60;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: 86vh;
    overflow: auto;
    border: 0;
    border-radius: 22px 22px 0 0;
    overscroll-behavior: contain;
    transform: translateY(105%);
    transition: transform 0.25s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .dc-panel.is-open {
    transform: none;
  }

  .dc-handle {
    display: block;
    width: 40px;
    height: 5px;
    margin: 10px auto 0;
    border-radius: 3px;
    background: #d3dade;
  }

  .dc-panel-head {
    padding-top: 12px;
  }

  .dc-scrim {
    position: fixed;
    z-index: 55;
    inset: 0;
    display: block;
    background: rgba(16, 42, 58, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .dc-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  html.dc-sheet-open,
  html.dc-sheet-open body {
    overflow: hidden;
  }
}

@media (max-width: 350px) {
  .dc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------ */
/* Cartes génériques                                                   */
/* ------------------------------------------------------------------ */
.card,
.auth-card,
.device-card,
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  padding: 24px;
  margin-bottom: 16px;
}

.card h2 {
  margin-bottom: 16px;
  font-size: 1.05rem;
}

/* ------------------------------------------------------------------ */
/* Connexion, inscription, mot de passe                                */
/* ------------------------------------------------------------------ */
.auth-shell {
  display: grid;
  width: min(1040px, calc(100% - 40px));
  min-height: 560px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  margin: 36px auto 56px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-aside {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 40px 38px;
  background: var(--gradient);
  color: #ffffff;
}

.auth-aside::before,
.auth-aside::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.auth-aside::before {
  top: -120px;
  right: -120px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 68%);
}

.auth-aside::after {
  bottom: -160px;
  left: -100px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(155, 72, 77, 0.35), transparent 70%);
}

.auth-aside h2 {
  margin-top: 16px;
  color: #ffffff;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.auth-aside p {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
}

.auth-points {
  display: grid;
  gap: 12px;
  list-style: none;
}

.auth-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-points strong {
  display: block;
  color: #ffffff;
  font-family: var(--font-title);
  font-weight: 600;
}

.auth-points .auth-ico {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-shell .auth-wrap {
  display: flex;
  width: auto;
  align-items: center;
  margin: 0;
  padding: 40px 38px;
}

.auth-shell .auth-card {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.auth-wrap {
  width: min(440px, calc(100% - 40px));
  margin: 56px auto;
}

.auth-card {
  position: relative;
  padding: 32px 30px;
}

.auth-card h1 {
  margin-bottom: 6px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-card p.sub {
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.auth-card .field {
  margin-bottom: 12px;
}

.auth-card .btn-primary {
  width: 100%;
  margin-top: 4px;
}

.auth-switch {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.auth-switch + .auth-switch {
  margin-top: 8px;
}

.auth-switch a {
  color: var(--accent-dark);
  font-weight: 700;
}

.auth-switch a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ */
/* Profil                                                              */
/* ------------------------------------------------------------------ */
.profile-wrap {
  width: min(720px, calc(100% - 40px));
  margin: 24px auto 56px;
}

.profile-head {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  padding: 26px;
  margin-bottom: 18px;
  border-radius: var(--radius-xl);
  background: var(--gradient);
  color: #ffffff;
}

.profile-head::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -90px;
  right: -70px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13), transparent 70%);
}

.profile-head h1 {
  color: #ffffff;
  font-size: 1.45rem;
  overflow-wrap: anywhere;
}

.profile-head p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.875rem;
}

.avatar,
.avatar-placeholder {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: var(--navy-soft);
}

.avatar {
  object-fit: cover;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 700;
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.row input[type="file"] {
  min-width: 0;
  flex: 1;
  color: var(--text-muted);
  font-size: 0.875rem;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--navy-deep);
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.sub-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 0; /* capsules rectangulaires */
  font-size: 0.75rem;
  font-weight: 700;
}

.pill-active { background: var(--success-soft); color: var(--success); }
.pill-free { background: var(--surface-soft); color: var(--text-muted); }
.pill-canceled { background: var(--danger-soft); color: var(--danger); }
.pill-admin { background: var(--navy-soft); color: var(--navy-deep); }

/* ------------------------------------------------------------------ */
/* Base de données des codes                                           */
/* ------------------------------------------------------------------ */
.db-header {
  padding-top: 20px;
}

.db-search {
  display: flex;
  width: min(1120px, calc(100% - 40px));
  align-items: stretch;
  gap: 10px;
  margin: 18px auto 18px;
}

.db-search form {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 10px;
}

.db-search .field {
  min-width: 180px;
  flex: 1;
  margin: 0;
}

.export-link {
  justify-content: center;
  color: var(--accent-dark);
}

.device-card {
  width: min(1120px, calc(100% - 40px));
  padding: 18px 22px;
  margin: 0 auto 12px;
  transition: box-shadow 0.15s ease;
}

.device-card:hover {
  box-shadow: var(--shadow-hover);
}

.device-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  list-style: none;
  color: var(--navy-deep);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.device-card summary::-webkit-details-marker {
  display: none;
}

.device-card summary::after {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  margin-left: -8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.15s ease;
}

.device-card[open] summary::after {
  transform: rotate(-135deg) translateY(-3px);
}

.device-card .meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: 0.8rem;
  font-weight: 500;
}

.device-card .count-badge {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 0; /* capsules rectangulaires */
  background: var(--navy-soft);
  color: var(--navy);
  font-family: var(--font-text);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.device-card .codes,
.device-card .dc-mount {
  margin-top: 16px;
}

.empty-state {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
  padding: 64px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Administration                                                      */
/* ------------------------------------------------------------------ */
.admin-wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 28px auto 56px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 20px;
}

.stat-card .num {
  color: var(--navy-deep);
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .lbl {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

table.admin-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

table.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.admin-table tbody tr:hover {
  background: var(--surface-soft);
}

/* ------------------------------------------------------------------ */
/* Pied de page                                                        */
/* ------------------------------------------------------------------ */
footer {
  margin-top: 56px;
  padding: 28px 20px;
  border-top: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: center;
}

footer a {
  color: var(--navy-deep);
  font-weight: 700;
}

footer a:hover {
  color: var(--accent-dark);
}

.hidden {
  display: none !important;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/* Tablette et téléphone                                               */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .auth-shell {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .auth-aside {
    gap: 0;
    padding: 26px 24px;
  }

  .auth-aside h2 {
    margin-top: 10px;
    font-size: 1.35rem;
  }

  .auth-points {
    display: none;
  }

  .auth-shell .auth-wrap {
    padding: 28px 24px 30px;
  }
}

@media (max-width: 820px) {
  .nav-inner {
    width: min(1120px, calc(100% - 28px));
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 10px 0 8px;
    min-height: 0;
  }

  .nav-links {
    width: calc(100% + 28px);
    margin: 0 -14px;
    padding: 0 14px 2px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .container,
  .tool,
  .result,
  .result.dc,
  .db-search,
  .device-card,
  .empty-state,
  .profile-wrap,
  .admin-wrap,
  .hero,
  .auth-shell {
    width: calc(100% - 28px);
  }

  .hero {
    margin-top: 14px;
    padding: 40px 18px 84px;
    border-radius: 20px;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 8.5vw, 2.2rem);
  }

  .hero p {
    font-size: 0.94rem;
  }

  .hero-compact {
    padding: 24px 20px 26px;
  }

  .container > .hero-compact {
    width: 100%;
  }

  .disclaimer {
    width: calc(100% - 52px);
    margin-top: -56px;
    padding: 13px 14px;
    font-size: 0.82rem;
  }

  .tool,
  .result {
    padding: 18px;
    border-radius: 20px;
  }

  .result.dc {
    padding: 0;
  }

  .tab {
    min-height: 48px;
    padding: 8px 6px;
    font-size: 0.78rem;
    white-space: normal;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .btn-primary {
    width: 100%;
    min-width: 0;
  }

  .db-search,
  .db-search form {
    flex-direction: column;
  }

  .db-search .btn,
  .export-link {
    width: 100% !important;
  }

  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .row .btn,
  .card .btn {
    width: 100% !important;
  }

  .auth-shell {
    margin: 16px auto 32px;
    border-radius: 20px;
  }

  .auth-wrap {
    width: calc(100% - 28px);
    margin: 28px auto;
  }

  .auth-card,
  .card {
    padding: 20px;
  }

  .profile-head {
    padding: 20px;
    border-radius: 20px;
  }

  .avatar,
  .avatar-placeholder {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
  }

  .device-card {
    padding: 16px;
  }

  .device-card summary {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* En-tête compact suivi d'un avertissement : pas de chevauchement */
.hero-compact + .disclaimer {
  margin-top: 16px;
}

/* ===============================================================
   Motion — flamme du bandeau, chargement IA, bouton occupé
   (tout est coupé si le téléphone demande moins d'animations)
   =============================================================== */

/* --- Flamme animée du bandeau d'accueil --- */
.hero-flame {
  position: absolute;
  z-index: -1;
  right: clamp(16px, 5vw, 64px);
  bottom: 84px;
  width: clamp(90px, 11vw, 128px);
  height: auto;
  opacity: 0.92;
  pointer-events: none;
}

.hf-body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: hf-flicker 2.6s ease-in-out infinite;
}

.hf-inner {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: hf-inner 1.7s ease-in-out infinite;
}

.hf-glow {
  transform-box: fill-box;
  transform-origin: 50% 60%;
  animation: hf-glow 2.6s ease-in-out infinite;
}

.hf-ember {
  fill: #f0c9cc;
  opacity: 0;
  animation: hf-ember 3.2s ease-out infinite;
}

.hf-ember--2 { animation-delay: 1.1s; }
.hf-ember--3 { animation-delay: 2.1s; }

@keyframes hf-flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  20%      { transform: scale(0.97, 1.04) skewX(-2deg); }
  45%      { transform: scale(1.02, 0.97) skewX(1.5deg); }
  70%      { transform: scale(0.98, 1.03) skewX(-1deg); }
}

@keyframes hf-inner {
  0%, 100% { transform: scale(1, 1) translateX(0); }
  35%      { transform: scale(0.93, 1.08) translateX(-1.5px); }
  65%      { transform: scale(1.05, 0.94) translateX(1.5px); }
}

@keyframes hf-glow {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.06); }
}

@keyframes hf-ember {
  0%   { opacity: 0; transform: translate(0, 0); }
  15%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(6px, -46px); }
}

@media (max-width: 680px) {
  .hero-flame {
    right: 10px;
    top: 14px;
    bottom: auto;
    width: 54px;
    opacity: 0.8;
  }
}

/* --- Bouton « en cours » : petit anneau qui tourne --- */
.btn.is-busy {
  position: relative;
  gap: 10px;
}

.btn.is-busy::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}

/* --- Carte de chargement pendant l'analyse IA --- */
.ai-loader {
  display: flex;
  width: min(1120px, calc(100% - 40px));
  margin: 22px auto 0;
  padding: 22px;
  align-items: center;
  gap: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tool .ai-loader {
  width: 100%;
}

.ai-loader.is-visible {
  opacity: 1;
  transform: none;
}

.ai-loader.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.ai-loader-visual {
  position: relative;
  flex: 0 0 132px;
  width: 132px;
  height: 132px;
}

/* Photo scannée */
.ai-scan {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--navy-deep);
}

.ai-scan img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.7) brightness(0.85);
}

.ai-scan::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(240, 201, 204, 0.12) 1px, transparent 1px) 0 0 / 100% 12px;
  mix-blend-mode: screen;
}

.ai-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 34px;
  background: linear-gradient(to bottom, transparent, rgba(240, 201, 204, 0.55) 80%, #ffffff);
  box-shadow: 0 6px 14px rgba(155, 72, 77, 0.5);
  animation: ai-scan 1.9s ease-in-out infinite alternate;
}

.ai-scan-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  animation: ai-corner 1.9s ease-in-out infinite alternate;
}

.ai-scan-corner--tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.ai-scan-corner--tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.ai-scan-corner--bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.ai-scan-corner--br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

/* Sans photo : petite flamme vivante */
.ai-loader-visual--flame {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--gradient);
}

.ai-flame {
  width: 58px;
  height: auto;
}

.ai-flame-outer {
  fill: #e0868c;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: hf-flicker 1.4s ease-in-out infinite;
}

.ai-flame-inner {
  fill: #ffffff;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: hf-inner 0.9s ease-in-out infinite;
}

/* Étapes */
.ai-loader-body {
  min-width: 0;
  flex: 1 1 auto;
}

.ai-loader-title {
  margin: 0 0 12px;
  color: var(--navy-deep);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
}

.ai-loader-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.ai-step-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.ai-step.is-active {
  color: var(--text);
  font-weight: 600;
}

.ai-step.is-active .ai-step-dot {
  border-color: var(--navy-soft);
  border-top-color: var(--accent);
  animation: ai-spin 0.9s linear infinite;
}

.ai-step.is-done {
  color: var(--success);
}

.ai-step.is-done .ai-step-dot {
  border-color: var(--success);
  background: var(--success);
}

.ai-step.is-done .ai-step-dot::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: ai-pop 0.25s ease-out;
}

.ai-loader-bar {
  position: relative;
  height: 6px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--navy-soft);
}

.ai-loader-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy-mid), var(--accent));
  animation: ai-bar 1.6s ease-in-out infinite;
}

.ai-loader-hint {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  animation: ai-pop 0.3s ease-out;
}

@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-scan { from { transform: translateY(-34px); } to { transform: translateY(132px); } }
@keyframes ai-corner { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes ai-bar { from { left: -40%; } to { left: 100%; } }
@keyframes ai-pop { from { opacity: 0; transform: scale(0.6) rotate(45deg); } to { opacity: 1; } }

@media (max-width: 680px) {
  .ai-loader {
    padding: 16px;
    gap: 16px;
    align-items: flex-start;
  }

  .ai-loader-visual {
    flex-basis: 84px;
    width: 84px;
    height: 84px;
  }

  @keyframes ai-scan { from { transform: translateY(-34px); } to { transform: translateY(84px); } }
}

@media (prefers-reduced-motion: reduce) {
  .hf-body,
  .hf-inner,
  .hf-glow,
  .hf-ember,
  .ai-flame-outer,
  .ai-flame-inner,
  .ai-scan-line,
  .ai-scan-corner,
  .ai-loader-bar span,
  .ai-step-dot,
  .ai-step.is-done .ai-step-dot::after,
  .ai-loader-hint,
  .btn.is-busy::before {
    animation: none !important;
  }

  .hf-ember { opacity: 0; }
  .ai-scan-line { top: 45%; }
  .ai-loader-bar span { left: 0; width: 100%; opacity: 0.5; }
  .ai-loader { transition: none; }
}
