/* ==========================================================================
   Éolienne Collège Saint Gildas — feuille de style
   ========================================================================== */

/* ------------------------------ Jetons ---------------------------------- */
:root {
  --navy-950: #071528;
  --navy-900: #0b1f3a;
  --navy-800: #10284a;
  --navy-700: #17355c;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --cyan-600: #0891b2;
  --cyan-500: #06b6d4;
  --cyan-300: #67e8f9;
  --teal-600: #0d9488;
  --green-600: #059669;
  --green-500: #10b981;
  --amber-500: #f59e0b;
  --red-500: #ef4444;
  --indigo-500: #6366f1;

  --bg: #eef4fb;
  --card: #ffffff;
  --line: #d8e4f2;
  --line-strong: #c3d4e8;
  --text: #0d2340;
  --muted: #5a7189;
  --muted-2: #7d92a8;

  --shadow-xs: 0 1px 2px rgba(13, 35, 64, 0.06);
  --shadow-sm: 0 4px 12px -6px rgba(13, 35, 64, 0.18);
  --shadow: 0 18px 40px -20px rgba(13, 35, 64, 0.28), 0 2px 6px rgba(13, 35, 64, 0.04);
  --shadow-lg: 0 40px 80px -32px rgba(8, 30, 60, 0.4);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --font: "Segoe UI", "Aptos", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --topbar-h: 64px;
}

/* ------------------------------ Reset ----------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 8% -12%, #dbeafe 0%, rgba(219, 234, 254, 0) 62%),
    radial-gradient(900px 480px at 102% -4%, #cffafe 0%, rgba(207, 250, 254, 0) 58%),
    var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
}

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

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--blue-600);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

::selection {
  background: #bfdbfe;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--navy-900);
  color: #fff;
  border-radius: 0 0 10px 10px;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  text-decoration: none;
}

/* ------------------------------ Utilitaires ----------------------------- */
.ico {
  width: 20px;
  height: 20px;
  flex: none;
}

.ico-sm { width: 16px; height: 16px; }
.ico-xs { width: 13px; height: 13px; }

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-600);
}

.muted { color: var(--muted-2); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.strong { font-weight: 700; }

.hint {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dot-sep { opacity: 0.5; }

/* ------------------------------ Boutons --------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-600));
  box-shadow: 0 10px 20px -10px rgba(8, 145, 178, 0.7);
}

.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 14px 26px -12px rgba(8, 145, 178, 0.8);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.btn-secondary {
  color: var(--navy-800);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  border-color: var(--line-strong);
  background: #f8fbff;
}

.btn-quiet {
  color: var(--navy-700);
  background: transparent;
}

.btn-quiet:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12.5px;
}

.link-btn {
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  background: #eef4fb;
  color: var(--navy-900);
}

/* ------------------------------ Badges / pills -------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: #eef3fa;
}

.badge-soft {
  background: #eef4fb;
  color: var(--muted);
  font-weight: 600;
}

.badge-ok { background: #d1fae5; color: #047857; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #dbeafe; color: #1d4ed8; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-ok { background: #d1fae5; color: #047857; }
.pill-warning { background: #fef3c7; color: #b45309; }
.pill-danger { background: #fee2e2; color: #b91c1c; }
.pill-info { background: #dbeafe; color: #1d4ed8; }

.student-tag {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--navy-900);
  color: #e0f2fe;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* ------------------------------ Champs ---------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field > span em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted-2);
}

.field input,
.field textarea,
.filter-form input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9db0c4;
}

.field input:focus,
.field textarea:focus,
.filter-form input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.field textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-code input {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  padding: 14px 10px 14px 22px;
  color: var(--navy-900);
}

/* ------------------------------ Cartes ---------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ------------------------------ Barre supérieure ------------------------ */
.topbar {
  position: relative;
  z-index: 30;
  height: var(--topbar-h);
  background: linear-gradient(120deg, #0a1c34 0%, #0e2a4d 45%, #0b3a5c 100%);
  color: #eaf3ff;
  box-shadow: 0 10px 30px -20px rgba(3, 18, 38, 0.9);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.5), transparent);
}

.topbar-inner {
  max-width: 1800px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  flex: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: none;
  filter: drop-shadow(0 6px 12px rgba(6, 182, 212, 0.3));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-mark-lg {
  width: 54px;
  height: 54px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-text small {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8fb4d6;
  margin-top: 4px;
}

.brand-blades {
  animation: brand-spin 16s linear infinite;
  transform-box: view-box;
}

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

.mainnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.mainnav::-webkit-scrollbar { display: none; }

.mainnav a {
  position: relative;
  padding: 8px 14px;
  border-radius: 9px;
  color: #a9c4dd;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.mainnav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.mainnav a.is-active {
  color: #fff;
  background: rgba(56, 189, 248, 0.14);
}

.mainnav a.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan-400, #22d3ee), #60a5fa);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.topbar .btn-quiet {
  color: #cfe3f6;
}

.topbar .btn-quiet:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #dbeafe;
  font-size: 12px;
}

.user-chip strong {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  font-size: 12.5px;
}

.user-chip .ico { color: #7dd3fc; }

/* ------------------------------ Messages -------------------------------- */
.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.flash {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid transparent;
}

.flash-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.flash-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.flash-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.flash-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ==========================================================================
   Page de connexion
   ========================================================================== */
.login-page {
  overflow-x: hidden;
}

.login-page .site-footer {
  display: none;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.88fr);
}

.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 56px clamp(28px, 5vw, 72px) 56px;
  background: linear-gradient(180deg, #5cb8e8 0%, #a7dcf6 42%, #e3f5ff 78%, #f2fbff 100%);
  isolation: isolate;
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 80% 8%, rgba(255, 255, 255, 0.55), transparent 65%),
    linear-gradient(180deg, rgba(7, 21, 40, 0.05), transparent 30%);
  z-index: -1;
}

.hero-sky {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.hero-sun {
  position: absolute;
  top: 9%;
  right: 14%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe8, #ffe9a3 55%, rgba(255, 222, 128, 0.4) 72%, transparent 73%);
  filter: blur(0.3px);
  box-shadow: 0 0 90px 40px rgba(255, 236, 165, 0.45);
}

.hero-cloud {
  position: absolute;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  filter: blur(0.4px);
  animation: cloud-drift 28s ease-in-out infinite alternate;
}

.hero-cloud::before,
.hero-cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.hero-cloud::before {
  width: 34px;
  height: 34px;
  left: 18px;
  top: -16px;
}

.hero-cloud::after {
  width: 24px;
  height: 24px;
  left: 54px;
  top: -10px;
}

.cloud-a { width: 128px; top: 18%; left: 12%; }
.cloud-b { width: 92px; top: 27%; left: 46%; opacity: 0.7; animation-delay: -9s; }
.cloud-c { width: 150px; top: 12%; right: 32%; opacity: 0.55; animation-delay: -16s; }

@keyframes cloud-drift {
  from { transform: translateX(-14px); }
  to { transform: translateX(26px); }
}

.hero-turbine {
  position: absolute;
  right: max(-40px, -2vw);
  bottom: 4%;
  height: min(88%, 760px);
  width: auto;
  filter: drop-shadow(0 30px 40px rgba(9, 46, 44, 0.16));
}

.hero-rotor {
  transform-origin: 269px 259px;
  transform-box: view-box;
  animation: hero-spin 11s linear infinite;
}

.hero-blade-2,
.hero-blade-3 {
  transform-box: view-box;
  transform-origin: 269px 259px;
}

.hero-blade-2 { transform: rotate(120deg); }
.hero-blade-3 { transform: rotate(240deg); }

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

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 560px;
  color: #082038;
}

.hero-copy .eyebrow {
  color: #075985;
  margin-bottom: 12px;
}

.hero-copy h2 {
  font-size: clamp(26px, 3.1vw, 42px);
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #071f38;
  text-wrap: balance;
}

.hero-copy p {
  margin-top: 14px;
  font-size: 14.5px;
  line-height: 1.65;
  color: #1e4a66;
  max-width: 470px;
}

.hero-points {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 22px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0b3d55;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
}

.hero-points .ico { color: #0e7490; }

.hero-chip {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 30px -18px rgba(6, 50, 80, 0.45);
  backdrop-filter: blur(10px);
  animation: chip-float 7s ease-in-out infinite;
}

.hero-chip span {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4a7c96;
}

.hero-chip strong {
  font-size: 14px;
  color: #082f49;
  font-variant-numeric: tabular-nums;
}

.hero-chip-a { top: 15%; left: 8%; }
.hero-chip-b { top: 35%; left: 56%; animation-delay: -2.6s; }
.hero-chip-c { top: 24%; right: 6%; animation-delay: -4.8s; }

@keyframes chip-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.login-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px clamp(20px, 4vw, 56px);
  background:
    radial-gradient(700px 400px at 100% 0%, #e0f2fe 0%, transparent 60%),
    radial-gradient(500px 400px at 0% 100%, #d1fae5 0%, transparent 55%),
    #f4f8fd;
}

.login-card {
  width: min(440px, 100%);
  padding: clamp(24px, 3vw, 36px);
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(216, 228, 242, 0.9);
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.login-brand h1 {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--navy-900);
}

.login-brand .eyebrow {
  margin-bottom: 5px;
  font-size: 10px;
}

.login-school {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.login-intro {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 20px;
}

.login-intro strong {
  color: var(--navy-800);
}

.login-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #eef4fb;
  margin-bottom: 16px;
}

.login-tabs button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.login-tabs button.is-active {
  background: #fff;
  color: var(--navy-900);
  box-shadow: var(--shadow-xs);
}

.login-panel {
  margin-bottom: 16px;
}

.code-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, #f8fbff, #f2f8ff);
}

.code-preview span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.code-preview strong {
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 0.2em;
  color: var(--blue-700);
  transition: color 0.2s ease;
}

.code-preview.is-empty strong { color: #b9c8d8; }

.login-form .btn-block {
  margin-top: 4px;
  padding: 13px 18px;
  font-size: 14px;
}

.privacy-note {
  display: flex;
  gap: 7px;
  margin-top: 16px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted-2);
}

.privacy-note .ico {
  margin-top: 1px;
  color: var(--green-600);
}

.login-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.login-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

.login-links a:hover { color: var(--blue-600); text-decoration: none; }

.login-footnote {
  font-size: 10.5px;
  color: var(--muted-2);
  text-align: center;
}

/* Connexion professeur */
.login-shell-simple {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(800px 500px at 12% 0%, #dbeafe 0%, transparent 62%),
    radial-gradient(700px 400px at 100% 100%, #ccfbf1 0%, transparent 58%),
    var(--bg);
  padding: 32px 20px;
}

.login-side-center { background: none; padding: 0; }
.teacher-card { width: min(430px, 100%); }

/* ==========================================================================
   Application — atelier
   ========================================================================== */
.app-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.workspace {
  flex: 1;
  min-height: 0;
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr) 348px;
  gap: 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #c3d4e8 transparent;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #c3d4e8; border-radius: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.center {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  min-width: 0;
}

/* ------------------------------ Commandes ------------------------------- */
.controls-card .card-head { margin-bottom: 16px; }

.control + .control {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.control-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.control-head label {
  font-size: 13px;
  font-weight: 650;
}

.label-note {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-2);
  text-transform: lowercase;
}

.control-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.control-value small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

/* Curseurs */
.range {
  --fill: 50%;
  --accent: var(--blue-600);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  cursor: pointer;
  margin: 2px 0 0;
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) var(--fill), #e2eaf4 var(--fill));
  border: 1px solid rgba(13, 35, 64, 0.04);
}

.range::-moz-range-track {
  height: 6px;
  border-radius: 99px;
  background: #e2eaf4;
}

.range::-moz-range-progress {
  height: 6px;
  border-radius: 99px;
  background: var(--accent);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--accent);
  box-shadow: 0 2px 6px rgba(13, 35, 64, 0.25);
  transition: transform 0.15s ease;
}

.range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--accent);
  box-shadow: 0 2px 6px rgba(13, 35, 64, 0.25);
}

.range:hover::-webkit-slider-thumb { transform: scale(1.12); }
.range:active::-webkit-slider-thumb { transform: scale(1.2); }

.range-wind { --accent: #0ea5e9; }
.range-nacelle { --accent: #6366f1; }
.range-pitch { --accent: #f59e0b; }

.range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  margin-top: -2px;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin: 8px 0 6px;
}

.preset {
  min-width: 0;
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: all 0.15s ease;
}

.preset:hover {
  border-color: #93c5fd;
  color: var(--blue-700);
  background: #eff6ff;
}

.preset.is-active {
  border-color: transparent;
  background: var(--navy-900);
  color: #fff;
}

/* Boussole / nacelle */
.alignment {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 13px;
  background: linear-gradient(180deg, #f8fbff, #f2f8ff);
  border: 1px solid var(--line);
}

.alignment-svg {
  width: 104px;
  height: 104px;
  flex: none;
}

.align-ring {
  fill: none;
  stroke: #d7e4f2;
  stroke-width: 1.4;
}

.align-ring-inner { stroke-dasharray: 2 4; stroke-width: 1; }

.align-tick {
  stroke: #c0d3e6;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.align-n {
  fill: #93a9bf;
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
}

.align-caption {
  fill: #a6b8ca;
  font-size: 8px;
  text-anchor: middle;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.align-wind-line {
  stroke: #38bdf8;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.align-needle line {
  stroke: #4f46e5;
  stroke-width: 4.5;
  stroke-linecap: round;
}

.align-needle circle {
  fill: #4f46e5;
}

.align-needle {
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.alignment-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.alignment-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.alignment-side strong {
  font-size: 22px;
  line-height: 1.1;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.alignment-note {
  font-size: 11px;
  color: var(--muted);
}

/* Aperçu du pitch */
.pitch-visual {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #f8fbff;
  border: 1px solid var(--line);
}

.pitch-visual svg {
  width: 100%;
  height: 38px;
}

.pv-wind,
.pv-arrow {
  stroke: #7dd3fc;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.pv-arrow { stroke: #94a3b8; }

.pv-blade {
  fill: #cfe0f2;
  stroke: #93b4d4;
  stroke-width: 1.4;
}

.pv-axis {
  stroke: #94a3b8;
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

#pitch-blade {
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.controls-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* Carte conseil */
.tip-card {
  background: linear-gradient(160deg, #0c2340, #113a5c);
  border-color: transparent;
  color: #cfe3f6;
}

.tip-card p,
.tip-card li {
  font-size: 11.5px;
  line-height: 1.55;
  color: #a9c7e2;
}

.tip-card strong { color: #e0f2fe; }

.tip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #67e8f9;
}

.tip-head h2 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tip-list {
  margin-top: 10px;
  padding-left: 16px;
  display: grid;
  gap: 6px;
  list-style: disc;
}

.tip-list::marker { color: #67e8f9; }

/* ------------------------------ Scène 3D -------------------------------- */
.stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: linear-gradient(180deg, #4f9fda 0%, #9fd3f2 55%, #dff1ff 100%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene:active { cursor: grabbing; }

.stage-top {
  position: absolute;
  inset: 14px 14px auto;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.stage-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px -18px rgba(6, 40, 70, 0.6);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 650;
  color: #0b2d4a;
  pointer-events: auto;
}

.stage-title em {
  font-style: normal;
  font-weight: 500;
  color: #5b7f9c;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
  animation: live-pulse 2.4s ease-in-out infinite;
}

.live-dot.is-stopped {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
  animation-duration: 1s;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.05); }
}

.stage-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px -18px rgba(6, 40, 70, 0.6);
}

.segmented button {
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: #43678a;
  transition: all 0.15s ease;
}

.segmented button:hover { color: #0b2d4a; }

.segmented button.is-active {
  background: #0b2d4a;
  color: #fff;
}

.stage-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px -18px rgba(6, 40, 70, 0.6);
  font-size: 11.5px;
  font-weight: 600;
  color: #43678a;
  transition: all 0.15s ease;
}

.stage-tool:hover { color: #0b2d4a; background: #fff; }
.stage-tool[aria-pressed="false"] { opacity: 0.6; }

.alerts {
  position: absolute;
  top: 66px;
  left: 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(330px, 60%);
  pointer-events: none;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: 550;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-left: 3px solid var(--amber-500);
  color: #7c4a03;
  box-shadow: 0 10px 24px -18px rgba(6, 40, 70, 0.6);
  backdrop-filter: blur(10px);
  animation: alert-in 0.25s ease;
}

.alert-danger {
  border-left-color: var(--red-500);
  color: #991b1b;
}

.alert-info {
  border-left-color: var(--blue-500);
  color: #1e40af;
}

.alert .ico { flex: none; margin-top: 1px; }

@keyframes alert-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.power-hud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 190px;
  padding: 12px 18px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px -24px rgba(6, 40, 70, 0.65);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.power-hud-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #5b7f9c;
}

.power-hud-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
}

.power-hud-value strong {
  font-size: clamp(30px, 3.4vw, 42px);
  font-weight: 750;
  letter-spacing: -0.03em;
  color: #082f49;
  font-variant-numeric: tabular-nums;
}

.power-unit {
  font-size: 13px;
  font-weight: 700;
  color: #0e7490;
}

.power-hud-sub {
  font-size: 10.5px;
  color: #4b6f8c;
  font-variant-numeric: tabular-nums;
}

.power-hud-sub strong { color: #0e7490; }

.stage-legend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.stage-save-mobile {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-600));
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 10px 22px -12px rgba(8, 145, 178, 0.9);
  pointer-events: auto;
}

.stage-save-mobile:hover { filter: brightness(1.06); }

@media (max-width: 700px) {
  .stage-save-mobile { display: inline-flex; }
}

.wind-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  font-size: 11px;
  color: #28597d;
  font-variant-numeric: tabular-nums;
}

.wind-pill .ico { color: #0ea5e9; }

.stage-hint {
  font-size: 10px;
  color: rgba(8, 47, 73, 0.6);
  background: rgba(255, 255, 255, 0.5);
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.stage-noscript {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: rgba(238, 244, 251, 0.94);
  font-weight: 600;
  color: var(--navy-800);
}

/* Repères 3D */
.labels {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.label-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.95);
  color: #0b2d4a;
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 8px 18px -12px rgba(6, 40, 70, 0.8);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.label-pin::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.18);
}

.label-pin:hover {
  transform: translate(-50%, -50%) scale(1.05);
  background: #fff;
}

.label-pin.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.label-pin[data-part="generateur"]::before { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.label-pin[data-part="multiplicateur"]::before { background: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); }
.label-pin[data-part="transformateur"]::before { background: #0d9488; box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18); }

/* ------------------------------ Courbe ---------------------------------- */
.chart-card {
  flex: none;
  height: 214px;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 10px;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.chart-head h2 {
  font-size: 13.5px;
  font-weight: 700;
}

.chart-head p {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.chart-current {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex: none;
}

.chart-current span {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.chart-current strong {
  font-size: 13px;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

#power-chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ------------------------------ Chaîne ---------------------------------- */
.chain {
  list-style: none;
  display: grid;
  gap: 7px;
  counter-reset: chain;
}

.chain li { position: relative; }

.chain li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 27px;
  top: calc(100% - 1px);
  height: 9px;
  border-left: 2px dotted #c9d9ea;
  z-index: 0;
}

.chain-item {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f7fafd;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.chain-item:hover {
  background: #fff;
  border-color: var(--line);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chain-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.chain-ico .ico { width: 19px; height: 19px; }

.tone-sky { background: #e0f2fe; color: #0369a1; }
.tone-cyan { background: #cffafe; color: #0e7490; }
.tone-indigo { background: #e0e7ff; color: #4338ca; }
.tone-amber { background: #fef3c7; color: #b45309; }
.tone-teal { background: #ccfbf1; color: #0f766e; }
.tone-green { background: #d1fae5; color: #047857; }

.chain-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.chain-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--navy-900);
}

.chain-sub {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex: none;
}

.chain-value strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.chain-value small {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted-2);
}

.chain-card .btn-block { margin-top: 14px; }
.chain-card .hint { margin-top: 8px; }

/* ------------------------------ État / métriques ------------------------ */
.status-list {
  list-style: none;
  display: grid;
  gap: 2px;
}

.status-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  font-size: 12px;
}

.status-list li + li { border-top: 1px dashed #e7eef7; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.status-dot.is-ok { background: var(--green-500); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.status-dot.is-warning { background: var(--amber-500); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16); }
.status-dot.is-danger { background: var(--red-500); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); animation: dot-blink 1.1s ease-in-out infinite; }
.status-dot.is-idle { background: #94a3b8; }

@keyframes dot-blink {
  50% { opacity: 0.35; }
}

.status-label {
  color: var(--muted);
  flex: 1;
}

.status-list strong {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--navy-800);
  font-weight: 650;
}

.metrics {
  display: grid;
  gap: 1px;
}

.metrics > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px;
}

.metrics > div + div { border-top: 1px dashed #e7eef7; }

.metrics dt {
  font-size: 11.5px;
  color: var(--muted);
}

.metrics dd {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.metrics dd small {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--muted-2);
}

.metrics-card .hint { margin-top: 10px; }

/* ------------------------------ Dialogues ------------------------------- */
.dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.22s ease;
}

.dialog::backdrop {
  background: rgba(6, 21, 40, 0.5);
  backdrop-filter: blur(3px);
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.dialog-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 20px 22px 14px;
  flex: none;
}

.dialog-heading { flex: 1; min-width: 0; }
.dialog-heading h2 { font-size: 20px; letter-spacing: -0.01em; }
.dialog-heading .eyebrow { margin-bottom: 2px; }

.dialog-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex: none;
}

.dialog-ico .ico { width: 23px; height: 23px; }

.dialog-body {
  padding: 4px 22px 20px;
  overflow-y: auto;
  min-height: 0;
}

.dialog-body > p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 14px;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
  flex: none;
}

.dialog-foot .btn-secondary { order: 0; }

.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.part-metric {
  padding: 10px 12px;
  border-radius: 11px;
  background: #f7fafd;
  border: 1px solid #e7eef7;
}

.part-metric span {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.part-metric strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.part-metric small {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}

.part-formula {
  padding: 12px 14px;
  border-radius: 11px;
  background: #0b1f3a;
  color: #cfe6ff;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  margin-bottom: 14px;
}

.part-note {
  display: flex;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #075985;
  font-size: 11.5px;
  line-height: 1.5;
}

.part-note .ico { flex: none; margin-top: 1px; }

/* Dialogue d'enregistrement */
.save-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.save-summary > div {
  padding: 10px 12px;
  border-radius: 11px;
  background: #f7fafd;
  border: 1px solid #e7eef7;
}

.save-summary span {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.save-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.save-summary small { font-size: 9.5px; color: var(--muted); font-weight: 500; }

/* ------------------------------ Toasts ---------------------------------- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  line-height: 1.45;
  animation: toast-in 0.25s ease;
}

.toast-success { border-left: 3px solid var(--green-500); }
.toast-danger { border-left: 3px solid var(--red-500); }
.toast-info { border-left: 3px solid var(--blue-500); }

.toast .ico { flex: none; margin-top: 1px; }
.toast-success .ico { color: var(--green-600); }
.toast-danger .ico { color: var(--red-500); }
.toast-info .ico { color: var(--blue-600); }

.toast.is-leaving { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ==========================================================================
   Pages secondaires
   ========================================================================== */
.page {
  flex: 1;
  padding: 26px 20px 40px;
}

.page-inner {
  max-width: 1220px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: clamp(26px, 2.6vw, 34px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--navy-900);
}

.page-head .eyebrow { margin-bottom: 6px; }

.page-sub {
  margin-top: 7px;
  font-size: 13px;
  color: var(--muted);
  max-width: 62ch;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form { display: inline-flex; }

.page-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #e8f2fd;
  color: #33587a;
  font-size: 11.5px;
  line-height: 1.5;
}

.page-note .ico { flex: none; margin-top: 1px; }

/* Statistiques */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.stat-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: none;
}

.stat-ico .ico { width: 20px; height: 20px; }

.stat-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-2);
}

.stat-value-sm { font-size: 13px; line-height: 1.35; letter-spacing: 0; }

/* Tables */
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head { padding: 18px 18px 0; margin-bottom: 14px; }
.table-card .empty-state { padding: 20px 18px 34px; }

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

.table-wrap.table-tall { max-height: 58vh; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  background: #f6f9fd;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #edf3fa;
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #fafdff; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table .num small {
  font-size: 9px;
  color: var(--muted-2);
  font-weight: 500;
}

.data-table td.strong { font-weight: 700; color: var(--navy-900); }

.note-cell {
  max-width: 250px;
  color: var(--muted);
  font-size: 11.5px;
}

.data-table.compact td,
.data-table.compact th { padding: 8px 10px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.empty-ico {
  width: 42px;
  height: 42px;
  color: #94a9c0;
  margin-bottom: 10px;
}

.empty-state h3 {
  font-size: 15px;
  color: var(--navy-800);
}

.empty-state p {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 46ch;
}

.empty-actions { text-align: center; padding: 0 0 24px; }

.filter-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-form input {
  width: 130px;
  padding: 8px 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

/* Deux colonnes */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.visit-list {
  list-style: none;
  display: grid;
  gap: 1px;
}

.visit-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.visit-list li + li { border-top: 1px dashed #e7eef7; }

.admin-card .rich-list { margin-top: 0; }

.rich-list {
  display: grid;
  gap: 9px;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  list-style: disc;
}

.rich-list::marker { color: var(--cyan-600); }
.rich-list strong { color: var(--navy-800); }
.rich-list.compact { font-size: 11.5px; gap: 7px; }

/* ==========================================================================
   Documentation
   ========================================================================== */
.doc-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 20px;
}

.doc-toc nav {
  display: grid;
  gap: 1px;
  margin: 12px 0 16px;
}

.doc-toc nav a {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  text-decoration: none;
}

.doc-toc nav a:hover {
  background: #f1f7fe;
  color: var(--blue-700);
}

.doc-content { min-width: 0; }

.doc-section {
  padding: 24px;
  margin-bottom: 16px;
  scroll-margin-top: 20px;
}

.doc-section h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.doc-section h2 .ico { color: var(--cyan-600); }

.doc-section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  margin-bottom: 7px;
}

.doc-section h3 .ico { color: var(--blue-600); }

.doc-section p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.doc-section p + p { margin-top: 9px; }

.doc-section p strong { color: var(--navy-800); }

.doc-intro { margin-bottom: 16px; }

.steps {
  display: grid;
  gap: 9px;
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 38px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11.5px;
  font-weight: 700;
}

.steps li strong { color: var(--navy-800); }

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

.doc-item {
  padding: 14px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #e7eef7;
}

.doc-item p { font-size: 12px; line-height: 1.6; }

.doc-note {
  margin-top: 7px;
  font-size: 11px !important;
  color: var(--muted-2);
}

.callout {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 11px;
  margin-top: 16px;
  font-size: 12.5px;
  line-height: 1.6;
}

.callout p { font-size: 12.5px; color: inherit; margin: 0; }
.callout .ico { flex: none; margin-top: 1px; }
.callout-info { background: #e0f2fe; color: #075985; }
.callout-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.energy-chain {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.energy-step {
  flex: 1;
  min-width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 8px;
  border-radius: 11px;
  background: #f8fbff;
  border: 1px solid #e7eef7;
  text-align: center;
}

.energy-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  margin-bottom: 2px;
}

.energy-ico .ico { width: 18px; height: 18px; }

.energy-step strong { font-size: 11px; color: var(--navy-800); }

.energy-step small {
  font-size: 9px;
  color: var(--muted-2);
  line-height: 1.2;
}

.energy-arrow {
  display: flex;
  align-items: center;
  color: #a9bdd2;
}

.formula-list {
  display: grid;
  gap: 0;
}

.formula-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 13px 0;
  border-top: 1px dashed #e2ebf5;
}

.formula-row:first-child { border-top: 0; padding-top: 4px; }

.formula-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.formula-row code {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 7px;
  background: #0b1f3a;
  color: #d7ecff;
  font-size: 12.5px;
  line-height: 1.7;
}

.formula-row code sub,
.formula-row code sup {
  font-size: 0.72em;
}

.formula-row code + code { margin-top: 4px; }

.formula-note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted-2);
}

.formula-note code {
  display: inline;
  padding: 1px 5px;
  background: #f1f6fc;
  color: var(--navy-800);
  font-size: 10.5px;
}

/* ==========================================================================
   Pied de page
   ========================================================================== */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid rgba(216, 228, 242, 0.8);
  background: rgba(255, 255, 255, 0.55);
  font-size: 10.5px;
  color: var(--muted-2);
  margin-top: auto;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1480px) {
  .workspace { grid-template-columns: 296px minmax(0, 1fr) 334px; }
}

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 280px minmax(0, 1fr) 318px; gap: 12px; padding: 12px; }
  .card { padding: 15px; }
  .chain-item { padding: 8px; gap: 8px; }
  .chain-value strong { font-size: 14px; }
}

@media (min-width: 960px) and (min-height: 640px) {
  .app-page { height: 100dvh; overflow: hidden; }
  .app-page .site-footer { display: none; }
}

@media (min-width: 1180px) and (max-height: 820px) {
  .alignment { margin-top: 6px; padding: 6px 8px; }
  .alignment-svg { width: 86px; height: 86px; }
  .alignment-side strong { font-size: 19px; }
  .pitch-visual { display: none; }
  .control + .control { margin-top: 11px; padding-top: 11px; }
  .controls-actions { margin-top: 10px; padding-top: 10px; }
  .tip-card { display: none; }
}

@media (max-width: 1179px) and (min-width: 960px) {
  .workspace {
    grid-template-columns: 252px minmax(0, 1fr) 292px;
    gap: 10px;
    padding: 12px;
  }
  .card { padding: 14px; }
  .stage { min-height: 300px; }
  .stage-title { font-size: 11px; }
  .segmented { display: none; }
  .alerts { top: 60px; }
  .alignment { gap: 8px; padding: 8px; }
  .alignment-svg { width: 94px; height: 94px; }
  .alignment-side strong { font-size: 19px; }
  .control-value { font-size: 17px; }
  .preset { font-size: 10.5px; }
  .chain-item { padding: 7px 8px; gap: 7px; }
  .chain-ico { width: 33px; height: 33px; }
  .chain-value strong { font-size: 13px; }
  .chain-sub { font-size: 9px; }
  .chain-card .btn-block { font-size: 12px; padding: 9px 10px; }
  .chart-card { height: 200px; }
  .stage-tools .stage-tool span { display: none; }
}

@media (max-width: 959px) {
  .workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "stage stage"
      "left right";
    height: auto;
  }
  .center { grid-area: stage; }
  .sidebar-left { grid-area: left; }
  .sidebar-right { grid-area: right; }
  .sidebar { overflow: visible; }
  .stage { height: 58vh; min-height: 420px; }
  .site-footer { display: flex; }
}

@media (max-width: 1179px) {
  .hero-chip { display: none; }
}

@media (max-width: 1179px) {
  .login-shell { grid-template-columns: minmax(0, 1fr) minmax(440px, 0.9fr); }
  .login-hero { padding: 32px 30px 40px; justify-content: flex-start; }
  .hero-copy { max-width: 270px; }
  .hero-copy h2 { font-size: 25px; }
  .hero-copy p { font-size: 12.5px; max-width: 262px; }
  .hero-points { display: none; }
  .hero-turbine { height: 86%; right: -60px; }
  .login-side { padding: 24px; }
  .eyebrow-extra { display: none; }
}

@media (max-width: 1024px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { position: static; }
  .doc-toc nav { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .doc-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .alerts { max-width: 76%; }

  .login-shell { display: flex; flex-direction: column; }
  .login-hero { min-height: 340px; padding: 30px 24px; }
  .hero-copy { max-width: 430px; }
  .hero-copy h2 { font-size: 27px; }
  .hero-copy p { font-size: 13px; max-width: 390px; }
  .hero-turbine { height: 320px; right: -34px; bottom: 0; }
  .login-side { padding: 30px 20px 46px; }

  .topbar-inner { gap: 12px; padding: 0 14px; }
  .brand-text small { display: none; }
  .page { padding: 20px 14px 32px; }
  .page-head { align-items: flex-start; }
  .formula-row { grid-template-columns: 1fr; gap: 6px; }
  .data-table { font-size: 11px; }
}

@media (max-width: 700px) {
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .center { order: -1; }
  .stage { height: 56vh; min-height: 380px; }
  .chart-card { height: 220px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 58px; }

  .login-hero { display: none; }
  .login-shell { min-height: 100dvh; }
  .login-side { padding: 18px 14px 30px; justify-content: flex-start; }
  .login-card { margin-top: 6px; }

  .topbar-inner { padding: 0 12px; }
  .brand-text strong { font-size: 15px; }
  .brand-mark { width: 34px; height: 34px; }
  .mainnav a { padding: 7px 10px; font-size: 12.5px; }
  .user-chip { padding: 5px 8px; }
  .user-chip .ico { display: none; }
  .topbar-right .btn-quiet span { display: none; }
  .topbar-right .btn-quiet { padding: 8px; }

  .workspace { padding: 10px; gap: 10px; }
  .card { border-radius: 14px; padding: 14px; }
  .stage { border-radius: 16px; height: 46vh; min-height: 300px; }
  .stage-top { inset: 9px 9px auto; flex-direction: column; align-items: stretch; }
  .stage-title { align-self: flex-start; }
  .stage-tools { justify-content: flex-start; flex-wrap: wrap; }
  .segmented button { padding: 5px 8px; font-size: 10.5px; }
  .stage-tool { padding: 6px 9px; font-size: 10.5px; }
  .alerts { top: 104px; left: 9px; max-width: 88%; }
  .power-hud { left: 10px; bottom: 10px; padding: 9px 13px; min-width: 150px; }
  .power-hud-value strong { font-size: 30px; }
  .stage-legend { right: 10px; bottom: 10px; }
  .stage-hint { display: none; }
  .chart-card { height: 210px; padding: 12px 14px 8px; }
  .chart-head p { display: none; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 11px 12px; gap: 9px; }
  .stat-ico { width: 36px; height: 36px; }
  .stat-value { font-size: 18px; }
  .page-head h1 { font-size: 24px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .filter-form { width: 100%; flex-wrap: wrap; }
  .filter-form input { flex: 1; width: auto; }
  .table-card .card-head { flex-direction: column; align-items: flex-start; }

  .login-hero { min-height: 250px; padding: 26px 20px 22px; }
  .hero-copy h2 { font-size: 22px; }
  .hero-copy p, .hero-points { display: none; }
  .hero-turbine { height: 250px; opacity: 0.9; }
  .hero-chip { display: none; }
  .login-card { padding: 22px 18px; border-radius: 18px; }
  .login-brand h1 { font-size: 26px; }
  .field-row { grid-template-columns: 1fr; }
  .login-links { flex-direction: column; gap: 8px; }

  .save-summary { grid-template-columns: 1fr 1fr; }
  .dialog { border-radius: 16px; }
  .dialog-head { padding: 16px 16px 10px; }
  .dialog-body { padding: 2px 16px 16px; }
  .dialog-foot { padding: 12px 16px 16px; }

  .doc-section { padding: 18px 16px; }
  .energy-arrow { display: none; }
  .energy-step { min-width: calc(33.333% - 6px); }
  .site-footer { padding: 14px; font-size: 9.5px; }
}

@media (max-width: 480px) {
  .brand-text { display: none; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .energy-step { min-width: calc(50% - 6px); }
}

/* ==========================================================================
   Impression
   ========================================================================== */
@media print {
  body {
    background: #fff;
    font-size: 11px;
  }

  .topbar,
  .site-footer,
  .page-actions,
  .flash-stack,
  .doc-toc,
  .empty-actions,
  .toast-stack {
    display: none !important;
  }

  .page { padding: 0; }
  .page-inner { max-width: none; }
  .card,
  .stat-card {
    box-shadow: none;
    border-color: #ccc;
    break-inside: avoid;
  }

  .table-wrap,
  .table-wrap.table-tall {
    max-height: none;
    overflow: visible;
  }

  .data-table thead th { position: static; }

  .data-table {
    font-size: 9px;
  }

  .data-table td,
  .data-table th {
    padding: 4px 5px;
  }

  .pill,
  .student-tag {
    border: 1px solid #999;
    background: #fff !important;
    color: #000 !important;
  }

  .stat-grid { grid-template-columns: repeat(4, 1fr); }

  .note-cell { max-width: none; }

  .doc-section { break-inside: auto; }
  .doc-section h2 { break-after: avoid; }
}

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

  .hero-rotor,
  .brand-blades {
    animation: none !important;
  }
}
