/* ===== ASTEM — Création d'un cas ===== */
:root {
  --bg-grad-1: #F1EEFB;
  --bg-grad-2: #E2DCF4;
  --surface: #FFFFFF;
  --surface-soft: #F6F3FE;
  --surface-tint: #EDE8FB;

  --ink: #1B0F8A;         /* deep indigo, primary text + accents */
  --ink-2: #3D2EB8;
  --ink-3: #6A5FCC;
  --ink-mute: #8C84B5;
  --ink-faint: #C9C2E3;

  --accent: #1FE0A8;      /* mint */
  --accent-2: #00C691;
  --accent-soft: #C9F7E7;

  --alert: #FF6E4A;
  --alert-2: #E85029;
  --alert-soft: #FFE0D6;

  --line: #DDD6F2;
  --line-2: #ECE6FA;

  --shadow-soft: 0 10px 30px -16px rgba(43, 30, 178, 0.22);
  --shadow-card: 0 14px 40px -18px rgba(43, 30, 178, 0.28);
  --shadow-lifted: 0 22px 60px -22px rgba(43, 30, 178, 0.35);

  --grid-line: rgba(255,255,255,0.55);
  --chart3d-bg-1: rgba(255,255,255,0.5);
  --chart3d-bg-2: rgba(255,255,255,0.15);

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

  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
}

/* ===== Dark theme ===== */
html[data-theme="dark"] {
  --bg-grad-1: #11102A;
  --bg-grad-2: #1A1740;
  --surface: #221F47;
  --surface-soft: #1B1839;
  --surface-tint: #2E2A5A;

  --ink: #F2EEFC;
  --ink-2: #D5CFF0;
  --ink-3: #9D95D0;
  --ink-mute: #6A639A;
  --ink-faint: #3A346A;

  --accent: #1FE0A8;
  --accent-2: #2BF1B8;
  --accent-soft: rgba(31, 224, 168, 0.18);

  --alert: #FF8865;
  --alert-2: #FF6E4A;
  --alert-soft: rgba(255, 110, 74, 0.18);

  --line: #2E2A5A;
  --line-2: #262247;

  --shadow-soft: 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 14px 40px -18px rgba(0, 0, 0, 0.65);
  --shadow-lifted: 0 22px 60px -22px rgba(0, 0, 0, 0.75);

  --grid-line: rgba(157, 149, 208, 0.12);
  --chart3d-bg-1: rgba(34, 31, 71, 0.6);
  --chart3d-bg-2: rgba(34, 31, 71, 0.2);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100vw; height: 100vh; overflow: hidden; }

/* ===== Perspective grid backdrop ===== */
.grid-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.grid-bg::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -8%;
  height: 62%;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 70px 70px;
  transform: perspective(700px) rotateX(58deg);
  transform-origin: 50% 0%;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1) 35%, rgba(0,0,0,1) 80%, rgba(0,0,0,0));
}

/* ===== Shell layout ===== */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header-left { display: flex; align-items: center; }
.crumb-tab {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 12px 22px 12px 12px;
  box-shadow: 0 -2px 0 var(--accent) inset;
}
.crumb-tab .ic {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--ink);
}
html[data-theme="dark"] .crumb-tab .ic { color: #11102A; }
.crumb-tab .label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.header-patient {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.header-patient .avatar-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  display: grid; place-items: center;
  color: var(--surface);
  flex: 0 0 auto;
}
html[data-theme="dark"] .header-patient .avatar-circle {
  background: var(--accent);
  color: #11102A;
}
.header-patient .info { font-size: 12px; line-height: 1.3; }
.header-patient .info .nom { font-weight: 700; color: var(--ink); font-size: 13px; }
.header-patient .info .ne { color: var(--ink-3); font-size: 11px; }

.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 6px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.lang-pill .flag {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.lang-pill .flag.fr { background: linear-gradient(to right, #0055A4 33%, #FFF 33%, #FFF 66%, #EF4135 66%); }
.lang-pill .flag.en { background: linear-gradient(135deg, #012169 35%, #FFF 35%, #FFF 55%, #C8102E 55%); }

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: all .2s;
}
.theme-toggle:hover { background: var(--surface-tint); }

.tenant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  font-size: 13px;
  cursor: pointer;
}
.tenant .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #4FE3B6, #1FA98C 60%, #136B5A);
  display: grid; place-items: center; color: white;
  font-size: 14px; font-weight: 700;
}

/* (legacy patient card – kept for compat, unused) */
.patient-card { display: none; }

/* ===== Top stepper ===== */
.stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin: 8px 0 0;
  padding: 30px 36px 18px;
  position: relative;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
  flex: 0 0 auto;
}
.step .dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
  background: var(--surface);
  color: var(--ink);
  display: grid; place-items: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 16px;
  transition: all .2s ease;
  position: relative;
  z-index: 2;
}
.step.done .dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.step.done .dot::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 18px; font-weight: 800;
}
.step.done .dot span { display: none; }
.step.active .dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 6px rgba(31, 224, 168, 0.18);
}
.step.warn .dot::before {
  content: "";
  position: absolute;
  top: -8px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 18px;
  background: var(--alert);
  border: 2px solid var(--bg-grad-1);
  border-radius: 50%;
  z-index: 3;
}
.step .lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-align: center;
  max-width: 110px;
  line-height: 1.25;
  white-space: pre-line;
}
.step.active .lbl { color: var(--ink); font-weight: 700; }
.step.done .lbl { color: var(--ink); }
.step-link {
  flex: 0 0 auto;
  width: 80px;
  height: 2px;
  background: var(--line);
  margin: 18px -2px 0;
  border-radius: 2px;
  transition: background .25s;
}
.step-link.done { background: var(--accent); }

/* ===== Page area ===== */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 48px 24px;
  min-height: 0;
  overflow: hidden;
}
.page-head { padding: 12px 0 14px; }
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.page-head p {
  margin: 0;
  color: var(--ink-3);
  max-width: 540px;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.choice-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  min-height: 168px;
  justify-content: center;
}
.choice-card:hover {
  border-color: var(--ink-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lifted);
}
.choice-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, #EFFCF6 0%, #FFFFFF 60%);
  box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow-card);
}
.choice-card.alert {
  border-color: var(--alert);
  background: linear-gradient(180deg, #FFF3EE 0%, #FFFFFF 60%);
}
.choice-card .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}
.choice-card .sub {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.4;
}
.choice-card .help {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
  color: var(--ink-3);
  display: grid; place-items: center;
  font-size: 12px;
  background: var(--surface);
  cursor: help;
}
.choice-card .alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--alert);
  color: white;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
}
.choice-card .alert-pill .num {
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 11px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--ink);
  color: white;
}
.btn-primary:hover { background: var(--ink-2); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink-faint);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--ink-3); }
.btn-accent {
  background: var(--accent);
  color: var(--ink);
}
.btn-accent:hover { background: var(--accent-2); color: white; }

/* ===== Summary side panel ===== */
.summary-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 280px;
  max-height: 100%;
  overflow-y: auto;
  position: relative;
}
.summary-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-2);
}
.summary-panel .panel-header .label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.summary-row .icn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface-tint);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.summary-row .content { flex: 1; min-width: 0; }
.summary-row .lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.tooth-pill {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink);
  color: white;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  height: 22px;
  min-width: 28px;
  padding: 0 8px;
  margin: 2px 4px 2px 0;
}
.tooth-pill.green { background: var(--accent); color: var(--ink); }
.tooth-pill.alert { background: var(--alert); color: white; }
.tooth-pill.outline { background: white; color: var(--ink); border: 1.5px solid var(--ink); }
.tooth-pill.muted { background: var(--surface-tint); color: var(--ink-3); border: 1.5px solid var(--line); }

/* ===== Side planning panel (left) ===== */
.planning-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-card);
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}

/* ===== Dent detail panel (new) ===== */
.dent-detail {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 420px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.dent-detail.empty { width: 360px; }
.dent-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line-2);
  flex: 0 0 auto;
}
.dent-num-big {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: white;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  flex: 0 0 auto;
  box-shadow: 0 6px 14px -6px rgba(43, 30, 178, 0.5);
}
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.state-badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}

.dent-detail-body {
  padding: 8px 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
}
.dent-detail-body::-webkit-scrollbar { width: 0; }
.dent-detail-body { -ms-overflow-style: none; scrollbar-width: none; }
.dent-detail-body::-webkit-scrollbar { width: 6px; }
.dent-detail-body::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 3px; }

.detail-section-h {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-section-n {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-tint);
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
}
.detail-section-pill {
  margin-left: auto;
  padding: 3px 8px;
  background: var(--surface-tint);
  color: var(--ink-3);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.option-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.option-grid.four  { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

.option-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: white;
  cursor: pointer;
  transition: all .12s ease;
  text-align: center;
  height: 46px;
  font-family: var(--font-body);
}
.option-chip:hover { border-color: var(--ink-3); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.option-chip.active {
  border-color: var(--accent-2);
  background: linear-gradient(180deg, #F0FBF5 0%, #FFFFFF 70%);
  box-shadow: 0 0 0 1.5px var(--accent-2) inset;
}
.option-chip.alert.active {
  border-color: var(--alert);
  background: linear-gradient(180deg, #FFF1EC 0%, #FFFFFF 70%);
  box-shadow: 0 0 0 1.5px var(--alert) inset;
}
.option-chip-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.option-chip-ic svg { width: 22px; height: 22px; }
.option-chip-lbl { font-size: 10.5px; line-height: 1.1; font-weight: 600; color: var(--ink); }
.option-chip-check {
  position: absolute;
  top: 3px; right: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  display: grid; place-items: center;
}
.option-chip.alert.active .option-chip-check { background: var(--alert); }
.option-chip-check {
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
}
.option-chip-check svg { width: 12px; height: 12px; }
.option-chip-body { width: 100%; text-align: center; }
.option-chip-lbl {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.2;
}
.option-chip-sub {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.2;
}
.option-chip-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent-2);
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,198,145,0.5);
}
.option-chip.alert.active .option-chip-check { background: var(--alert); }

.source-toggle {
  margin-top: 10px;
  display: flex;
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.src-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-3);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.src-btn.active { background: white; color: var(--ink); box-shadow: 0 2px 6px -2px rgba(0,0,0,0.15); }

.dent-arbre-btn {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
  font-size: 12px;
  padding: 8px 22px;
}

/* Implant type buttons + plural picker */
.implant-type-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.type-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: white;
  cursor: pointer;
  transition: all .12s ease;
  text-align: left;
  font-family: var(--font-body);
  height: 38px;
}
.type-btn:hover { border-color: var(--ink-3); }
.type-btn.active {
  border-color: var(--accent-2);
  background: linear-gradient(180deg, #F0FBF5 0%, #FFFFFF 70%);
  box-shadow: 0 0 0 1.5px var(--accent-2) inset;
}
.type-btn-ic { flex: 0 0 auto; display: grid; place-items: center; width: 22px; height: 22px; }
.type-btn-ic svg { width: 22px; height: 22px; }
.type-btn-lbl { font-weight: 700; font-size: 11px; color: var(--ink); line-height: 1.1; }
.type-btn-sub { font-size: 9.5px; color: var(--ink-3); line-height: 1.1; margin-top: 1px; }

.plural-picker {
  margin-top: 4px;
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 6px 8px;
}
.plural-picker-h {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; color: var(--ink-3); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.plural-count {
  background: var(--ink);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}
.plural-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.plural-chip {
  min-width: 32px; height: 26px;
  padding: 0 6px;
  border: 1.5px solid var(--line);
  background: white;
  border-radius: 7px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: all .1s;
}
.plural-chip:hover:not(.disabled) { border-color: var(--ink-3); transform: translateY(-1px); }
.plural-chip.active {
  background: var(--accent);
  border-color: var(--accent-2);
  color: var(--ink);
  box-shadow: 0 2px 6px -1px rgba(0,198,145,0.4);
}
.plural-chip.disabled { opacity: 0.4; cursor: not-allowed; }
.plural-hint { margin-top: 6px; font-size: 11px; color: var(--alert); font-weight: 500; }

/* Pill bar — compact horizontal selector */
.pill-bar {
  display: flex;
  gap: 3px;
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 3px;
}
.pill-bar-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 9px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .12s;
  min-height: 30px;
}
.pill-bar-btn:hover { color: var(--ink); }
.pill-bar-btn.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 2px 6px -2px rgba(43, 30, 178, 0.2);
}
.pill-bar-btn.active.alert { color: var(--alert); }
.pill-bar-btn .pill-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pill-bar-btn .pill-ic svg { width: 18px; height: 18px; }
.planning-panel .pp-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 6px;
}
.pp-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background .15s;
  border-radius: 10px;
}
.pp-item:last-child { border-bottom: none; }
.pp-item:hover { background: var(--surface-soft); }
.pp-item.active { background: var(--surface-tint); }
.pp-item .num {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
  color: var(--ink-3);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--font-display);
  flex: 0 0 auto;
}
.pp-item.active .num,
.pp-item.has-data .num {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.pp-item .lbl {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}
.pp-item .chev { color: var(--ink-3); }
.pp-item.locked { opacity: 0.55; pointer-events: none; }

/* ===== Tooth chart ===== */
.chart-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}
/* ===== Tooth options column (between planning panel and chart) ===== */
.tooth-options {
  width: 220px;
  flex: 0 0 auto;
  padding: 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 4;
}
.opt-group { margin-bottom: 12px; }
.opt-group .opt {
  font-size: 14px;
  color: var(--ink);
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.opt-group .opt:hover { background: var(--surface-soft); }
.opt-group .opt.active {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  font-weight: 600;
}
.opt-group .opt.disabled { color: var(--ink-faint); cursor: default; }

/* ===== Tree-step layout ===== */
.tree-layout {
  display: flex;
  gap: 28px;
  flex: 1;
  min-height: 0;
}
.tree-main { flex: 1; min-width: 0; overflow-y: auto; padding-right: 6px; padding-top: 6px; }
.tree-main::-webkit-scrollbar { width: 8px; }
.tree-main::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 4px; }
.tree-main h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  max-width: 760px;
}
.tree-main .lede {
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.55;
  max-width: 620px;
  margin: 0 0 28px;
  white-space: pre-line;
}
.choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  max-width: 780px;
}
.choices-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); max-width: 560px; }

/* ===== Recap rail (right side of tree) ===== */
.recap-rail {
  width: 270px;
  flex: 0 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  position: relative;
}
.recap-rail .head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}
.recap-rail .head .num {
  background: var(--surface-tint);
  color: var(--ink);
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  font-family: var(--font-display);
}
.recap-rail .head .ttl {
  font-family: var(--font-display);
  font-weight: 700; font-size: 16px;
  color: var(--ink);
}
.recap-rail .head .doc-ic {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--ink);
}

.recap-section {
  position: relative;
  padding-left: 22px;
}
.recap-section .label {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 8px;
}
.recap-section .row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.recap-section .marker {
  position: absolute;
  left: 0;
  top: 22px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid white;
  box-shadow: 0 0 0 1.5px var(--accent);
  display: grid; place-items: center;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}
.recap-section .marker.alert {
  background: var(--alert);
  box-shadow: 0 0 0 1.5px var(--alert);
  color: white;
}
.recap-section.line::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 30px;
  bottom: -10px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--alert));
  z-index: 0;
}
.recap-section .marker.warn {
  background: var(--alert);
  box-shadow: 0 0 0 1.5px var(--alert);
  color: white;
}
.pill-prev {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-tint);
  color: var(--ink);
}
.pill-curr {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--ink);
  color: white;
}
.pill-curr.alert { background: var(--alert); }
.pill-curr.accent { background: var(--accent); color: var(--ink); }
.pill-curr .check { font-size: 12px; }
.pill-curr .num {
  background: rgba(255,255,255,0.22);
  border-radius: 999px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 11px;
}

/* ===== Implant tabs (within decision tree page) ===== */
.implant-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.implant-tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
}
.implant-tabs .tab.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.implant-tabs .tab.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.implant-tabs .tab .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.implant-tabs .add {
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  border: 1.5px dashed var(--ink-faint);
  color: var(--ink-3);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* ===== 3D tooth chart ===== */
.chart3d-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tooth-chart-3d {
  width: 100%;
  height: 100%;
  min-height: 520px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--chart3d-bg-1) 0%, var(--chart3d-bg-2) 100%);
  border: 1px solid var(--line);
  cursor: grab;
  overflow: hidden;
}
.chart3d-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 24px);
}
.chart3d-presets {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 4px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255,255,255,0.8);
  max-width: 100%;
}
.chart3d-actions {
  position: absolute;
  bottom: 56px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 4px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255,255,255,0.8);
  z-index: 5;
}
.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 9px;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.preset-btn span { display: inline-block; }
.preset-btn svg { flex: 0 0 auto; }
.preset-btn:hover { background: var(--surface-soft); color: var(--ink); }
.preset-btn.active {
  background: var(--ink);
  color: white;
}
.preset-btn.icon {
  padding: 7px 9px;
  color: var(--ink-3);
}
.preset-btn.icon.active { background: var(--accent); color: var(--ink); }
.chart3d-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(27, 15, 138, 0.78);
  backdrop-filter: blur(6px);
  color: white;
  font-size: 12px;
  font-weight: 500;
  z-index: 5;
  pointer-events: none;
}

/* 2D/3D mode pill (in page head) */
.view-mode-toggle {
  display: inline-flex;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255,255,255,0.8);
}
.view-mode-toggle button {
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.view-mode-toggle button.active {
  background: var(--ink);
  color: white;
}
/* ===== Tooth chart SVG ===== */
.tooth-chart {
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 280px);
  display: block;
}
.tooth-num {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  fill: var(--ink-2);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.tooth-num-bg {
  fill: var(--surface-tint);
  stroke: none;
}
.tooth-shape {
  cursor: pointer;
  transition: all .15s ease;
}
.tooth-shape:hover { filter: brightness(0.95); }
.tooth-state-natural .tooth-body { fill: url(#tooth-grad); stroke: #A39BC2; stroke-width: 1.3; }
.tooth-state-absent .tooth-body { fill: var(--surface-tint); stroke: var(--ink-faint); stroke-dasharray: 3 3; stroke-width: 1.5; }
.tooth-state-extraction .tooth-body { fill: #FFD9CB; stroke: var(--alert); stroke-width: 2; }
.tooth-state-implant .tooth-body { fill: #C8F5E2; stroke: var(--accent-2); stroke-width: 2; }
.tooth-state-crown .tooth-body { fill: #E0D8F6; stroke: var(--ink-2); stroke-width: 2; }
.tooth-state-bridge .tooth-body { fill: #E0D8F6; stroke: var(--ink-2); stroke-width: 2; }

.tooth-selected .tooth-body {
  stroke: var(--accent-2) !important;
  stroke-width: 3 !important;
  filter: drop-shadow(0 0 4px var(--accent));
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 80, 0.35);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  width: 540px;
  max-width: 92vw;
  box-shadow: 0 30px 80px -20px rgba(20, 10, 80, 0.4);
  animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.modal h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--ink);
}
.modal .modal-sub {
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 18px;
}

/* ===== Bottom bar (navigation) ===== */
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 6px;
  gap: 12px;
  margin-top: 8px;
}

/* ===== Misc ===== */
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--ink-3); }
.tooltip {
  position: absolute;
  background: var(--ink);
  color: white;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  transform: translateY(-100%);
  box-shadow: 0 6px 20px -6px rgba(0,0,0,.3);
}
.tooltip::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--ink);
}

.legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius);
  font-size: 12px;
}
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch {
  width: 14px; height: 14px; border-radius: 4px;
  border: 1.5px solid var(--ink-faint);
}

/* utility */
.grow { flex: 1; }
.center { display: flex; align-items: center; justify-content: center; }

/* keyframes */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(31, 224, 168, 0.18); }
  50% { box-shadow: 0 0 0 10px rgba(31, 224, 168, 0.08); }
}

/* ===== Mini dental chart (in decision tree page) ===== */
.mini-chart {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 12px 16px;
  margin-top: 10px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.mini-chart-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 4px 0;
}
.mini-chart-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 14px;
}
.mini-chart-row {
  display: grid;
  grid-template-columns: 28px repeat(16, minmax(0, 1fr));
  align-items: center;
  gap: 3px;
}
.mini-chart-row .row-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  padding-right: 4px;
}
.mini-tooth {
  position: relative;
  height: 44px;
  border-radius: 6px;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: default;
  transition: all .15s;
  color: var(--ink-3);
  letter-spacing: -0.02em;
  overflow: visible;
  padding: 3px 0;
}
.mini-tooth.midline-left { margin-right: 5px; }
.mini-tooth.is-selectable { cursor: pointer; }
.mini-tooth.is-selectable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
.mini-tooth.is-selected {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  z-index: 2;
}
/* State styling — color only, no border/bg (form is in the SVG) */
.mini-tooth.state-implant    { color: var(--accent-2); }
.mini-tooth.state-crown      { color: var(--ink); }
.mini-tooth.state-bridge     { color: var(--ink); }
.mini-tooth.state-extraction { color: var(--alert-2); }
.mini-tooth.state-absent     { opacity: 0.5; }
.mini-tooth .tree-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink-faint);
  border: 2px solid var(--surface);
  display: grid;
  place-items: center;
  color: white;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}
.mini-tooth .tree-badge.done { background: var(--accent-2); }
.mini-tooth .tree-badge.todo { background: var(--alert); }
.mini-tooth .tree-badge.partial { background: #FFB22C; }
.mini-tooth .tree-badge.blocking { background: var(--alert-2); }
.mini-tooth .tree-badge svg { width: 8px; height: 8px; }
.mini-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  flex: 0 0 auto;
  align-self: stretch;
  border-left: 1px solid var(--line-2);
  padding-left: 16px;
  font-size: 10.5px;
  color: var(--ink-3);
  align-content: center;
  align-items: center;
  max-width: 200px;
}
.mini-chart-legend .item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mini-chart-legend .sw {
  width: 12px; height: 12px;
  border-radius: 4px;
  border: 1.4px solid var(--line);
}
.mini-chart-legend .sw.implant { background: var(--accent-soft); border-color: var(--accent-2); }
.mini-chart-legend .sw.crown { background: var(--surface-tint); border-color: var(--ink-2); }
.mini-chart-legend .sw.bridge { background: var(--surface-tint); border-color: var(--ink-2); border-style: dashed; }
.mini-chart-legend .sw.extract { background: var(--alert-soft); border-color: var(--alert); }
.mini-chart-legend .badge-demo {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  outline: 1px solid var(--line);
}
.mini-chart-legend .badge-demo.done { background: var(--accent-2); }
.mini-chart-legend .badge-demo.todo { background: var(--alert); }
.mini-chart-legend .badge-demo.blocking { background: var(--alert-2); }

/* ===== Dark-theme polish (override hardcoded whites) ===== */
html[data-theme="dark"] .option-chip,
html[data-theme="dark"] .plural-chip,
html[data-theme="dark"] .type-btn { background: var(--surface-soft); }

html[data-theme="dark"] .option-chip.active {
  background: linear-gradient(180deg, rgba(31,224,168,0.15) 0%, var(--surface-soft) 70%);
}
html[data-theme="dark"] .option-chip.alert.active {
  background: linear-gradient(180deg, rgba(255,110,74,0.15) 0%, var(--surface-soft) 70%);
}
html[data-theme="dark"] .type-btn.active {
  background: linear-gradient(180deg, rgba(31,224,168,0.15) 0%, var(--surface-soft) 70%);
}
html[data-theme="dark"] .choice-card { background: var(--surface); }
html[data-theme="dark"] .choice-card.selected {
  background: linear-gradient(180deg, rgba(31,224,168,0.12) 0%, var(--surface) 60%);
}
html[data-theme="dark"] .choice-card.alert {
  background: linear-gradient(180deg, rgba(255,110,74,0.10) 0%, var(--surface) 60%);
}
html[data-theme="dark"] .src-btn.active { background: var(--surface-tint); }
html[data-theme="dark"] .chart3d-presets,
html[data-theme="dark"] .chart3d-actions {
  background: rgba(34, 31, 71, 0.92);
  border-color: var(--line);
}
html[data-theme="dark"] .preset-btn.active { background: var(--accent); color: #11102A; }
html[data-theme="dark"] .preset-btn:hover { background: var(--surface-tint); }
html[data-theme="dark"] .view-mode-toggle { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .view-mode-toggle button.active { background: var(--accent); color: #11102A; }
html[data-theme="dark"] .pill-bar-btn.active { background: var(--surface-tint); }
html[data-theme="dark"] .recap-section .marker { border-color: var(--surface); }
html[data-theme="dark"] .modal { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .step.done .dot,
html[data-theme="dark"] .step.active .dot { color: #11102A; }
html[data-theme="dark"] .step.warn .dot::before { border-color: var(--bg-grad-1); }
html[data-theme="dark"] .recap-rail .head .doc-ic { color: #11102A; }
html[data-theme="dark"] .crumb-tab .ic svg { stroke: #11102A; }
html[data-theme="dark"] .tooth-num { fill: var(--ink-2); }
html[data-theme="dark"] .tooth-num-bg { fill: var(--surface-tint); }
html[data-theme="dark"] .tooth-state-natural .tooth-body { stroke: var(--ink-3); }
html[data-theme="dark"] .tooth-state-absent .tooth-body { stroke: var(--ink-mute); fill: var(--surface-soft); }
html[data-theme="dark"] .btn-accent { color: #11102A; }
html[data-theme="dark"] .btn-accent:hover { color: #11102A; }

/* Plural-chip disabled state — clearer "not yet available" */
.plural-chip.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
  color: var(--ink-mute);
  border-style: dashed;
}

/* Recap page — override summary panel fixed width */
.recap-card .summary-panel,
.recap-rail .summary-panel {
  width: auto;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  max-height: none;
}

/* ===== File upload zones (données d'entrée) ===== */
.data-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.data-group-badge {
  background: var(--ink);
  color: white;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.data-group-badge--opt {
  background: var(--ink-faint);
  color: var(--ink-3);
}
.file-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}
.file-label .req {
  color: var(--alert);
  margin-left: 2px;
}
.file-zone {
  border: 1.8px dashed var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  min-height: 72px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 12px;
}
.file-zone:hover { border-color: var(--ink-3); background: var(--surface-soft); }
.file-zone.drag {
  border-color: var(--accent-2);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.file-zone.has-file {
  border-style: solid;
  border-color: var(--accent-2);
  background: var(--surface);
}
.file-zone-empty { display: flex; align-items: center; gap: 12px; width: 100%; }
.file-zone-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface-tint);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.file-zone-icon.ok {
  background: var(--accent-soft);
}
.file-zone-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-zone-drop { font-size: 13px; font-weight: 600; color: var(--ink); }
.file-zone-link { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--ink-faint); }
.file-zone-hint { font-size: 11px; color: var(--ink-3); }
.file-zone-done { display: flex; align-items: center; gap: 10px; width: 100%; }
.file-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.file-meta { font-size: 11px; color: var(--ink-3); }
.file-zone-info { flex: 1; min-width: 0; }
.file-zone-clear {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1.5px solid var(--line);
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--ink-3);
  transition: all .12s;
}
.file-zone-clear:hover { background: var(--alert-soft); border-color: var(--alert); color: var(--alert); }

/* ===== Header stepper (inline in header) ===== */
.app-header {
  display: flex;
  align-items: center;
  padding: 12px 24px 0;
  position: relative;
  z-index: 5;
  gap: 12px;
}
.header-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.header-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-radius: 999px;
  padding: 0 8px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
  height: 44px;
}
.hs-link {
  width: 18px; height: 1.5px;
  background: var(--line); flex-shrink: 0;
  transition: background .2s;
}
.hs-link.done { background: var(--accent-2); }
.hs-step {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 4px 7px; border-radius: 999px;
  transition: background .12s; white-space: nowrap;
}
.hs-step:hover { background: var(--surface-tint); }
.hs-step.active { background: var(--ink); }
.hs-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-tint); color: var(--ink-3);
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.hs-step.active .hs-dot { background: rgba(255,255,255,0.2); color: white; }
.hs-step.done .hs-dot { background: var(--accent-soft); color: var(--accent-2); }
.hs-lbl {
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  white-space: nowrap;
}
.hs-step.active .hs-lbl { color: white; }
.hs-step.done .hs-lbl { color: var(--ink-2); }

/* ===== User menu dropdown ===== */
.user-menu { position: relative; flex-shrink: 0; }
.user-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 44px; padding: 0 10px 0 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: border-color .12s;
}
.user-btn:hover { border-color: var(--ink-3); }
.user-btn .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--surface);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.user-btn span { font-size: 12px; font-weight: 600; color: var(--ink); }
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 160px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lifted);
  padding: 6px; z-index: 200;
}
.ud-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--ink);
  cursor: pointer; transition: background .1s;
}
.ud-item:hover { background: var(--surface-soft); }

/* ===== Tree stepper column (nom dent + stepper vertical) ===== */
.tree-stepper-column {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}
.tooth-name-display {
  padding: 2px 6px 12px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 10px;
}
.tooth-name-display .tnd-lbl {
  font-size: 9px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  margin-bottom: 2px;
}
.tooth-name-display .tnd-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  color: var(--ink);
  line-height: 1.1;
}
.tooth-name-display .tnd-name {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.3;
}

/* ===== Vertical tree stepper ===== */
.tree-stepper-v {
  width: 130px; flex: 0 0 auto;
  display: flex; flex-direction: column;
  padding: 0; overflow-y: auto;
  scrollbar-width: none;
}
.tree-stepper-v::-webkit-scrollbar { display: none; }
.tsv-step { cursor: pointer; position: relative; }
.tsv-connector {
  width: 1.5px; height: 12px;
  background: var(--line);
  margin: 0 auto 0 18px;
  transition: background .2s;
}
.tsv-connector.done { background: var(--accent-2); }
.tsv-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 10px;
  transition: background .12s;
}
.tsv-step:hover .tsv-row { background: var(--surface-soft); }
.tsv-step.active .tsv-row { background: var(--ink); }
.tsv-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink-3);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0; transition: all .15s;
}
.tsv-step.done .tsv-dot { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-2); }
.tsv-step.warn .tsv-dot { background: var(--alert-soft); color: var(--alert); border-color: var(--alert); }
.tsv-step.active .tsv-dot { background: rgba(255,255,255,0.15); color: white; border-color: transparent; }
.tsv-label {
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  line-height: 1.2; flex: 1; min-width: 0;
}
.tsv-step.done .tsv-label { color: var(--ink-2); }
.tsv-step.active .tsv-label { color: white; }
.tsv-warn { font-size: 10px; color: var(--alert); flex-shrink: 0; }

/* ===== Summary bar (horizontal, schema top) ===== */
.summary-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 14px;
  background: var(--surface);
  border-radius: 14px; padding: 8px 16px;
  margin-bottom: 10px; flex-shrink: 0;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
  min-height: 40px;
}
.sb-group {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px;
}
.sb-lbl {
  font-weight: 700; color: var(--ink-3); font-size: 11px;
  margin-right: 2px; white-space: nowrap;
}

