@import url("/assets/css/brand-tokens.css");

/* APPLAT — espace connecté
   Design system issu de brand/metier/APPLAT_PRODUCT_DESIGN_DEMO.html.
   Toute apparence de l'espace connecté doit venir d'ici.
   Les couleurs de marque sont reprises de brand-tokens.css : mêmes
   valeurs qu'avant, source unique partagée avec la vitrine. */

:root {
  --blue: var(--applat-blue);
  --blue-700: var(--applat-blue-700);
  --blue-100: var(--applat-blue-100);
  --blue-50: var(--applat-blue-soft);
  --navy: var(--applat-navy);
  --text: var(--applat-text);
  --muted: var(--applat-muted);
  --muted-2: #8b98aa;
  --line: var(--applat-line);
  --line-soft: #edf1f6;
  --surface: var(--applat-surface);
  --surface-2: #f8fafd;
  --bg: var(--applat-bg);
  --green: #168a4a;
  --green-bg: #eaf8f0;
  --amber: #a96400;
  --amber-bg: #fff4da;
  --red: #c9342c;
  --red-bg: #fff0ef;
  --purple: #7048c8;
  --purple-bg: #f2edff;
  --shadow: 0 14px 38px rgba(28, 42, 66, 0.07);
  --shadow-soft: 0 5px 18px rgba(28, 42, 66, 0.055);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 226px;
  --topbar: 68px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

svg {
  display: block;
}

body.is-modal-open {
  overflow: hidden;
}

/* display:flex / grid sur un élément écrase le [hidden] natif du navigateur */
[hidden] {
  display: none !important;
}

.app {
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */

.topbar {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  height: var(--topbar);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  width: calc(var(--sidebar) - 22px);
}

.brand img {
  width: 126px;
  height: auto;
}

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

.top-link,
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.top-link {
  padding: 0 10px;
}

.icon-btn {
  width: 36px;
  position: relative;
}

.top-link:hover,
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--navy);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 7px 4px 5px;
  border-radius: 10px;
  text-decoration: none;
}

.user:hover {
  background: var(--surface-2);
}

.user-copy {
  line-height: 1.15;
  min-width: 0;
}

.user-copy strong {
  display: block;
  font-size: 12px;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-copy span {
  font-size: 10px;
  color: var(--muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* Notifications */

.notify-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}

.notify {
  position: relative;
}

.notify-panel {
  position: absolute;
  right: 0;
  top: 44px;
  width: 306px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 18px 40px rgba(20, 36, 62, 0.15);
  overflow: hidden;
  z-index: 60;
}

.notify-panel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  font-weight: 780;
  color: var(--navy);
}

.notify-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 330px;
  overflow: auto;
}

.notify-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 3px;
}

.notify-item:last-child {
  border-bottom: 0;
}

.notify-item strong {
  font-size: 12px;
  color: var(--navy);
  font-weight: 720;
}

.notify-item span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.notify-item time {
  font-size: 9px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.notify-item.is-unread {
  background: var(--blue-50);
}

.notify-empty {
  padding: 18px 14px;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

/* ── Sidebar ────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: var(--topbar);
  bottom: 0;
  left: 0;
  width: var(--sidebar);
  z-index: 40;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 13px 14px;
  display: flex;
  flex-direction: column;
}

.side-label {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 800;
  padding: 8px 10px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-btn {
  width: 100%;
  height: 40px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #526178;
  font-weight: 650;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
}

.nav-btn:hover {
  background: #f7f9fc;
  color: var(--navy);
}

.nav-btn.active {
  background: var(--blue-50);
  color: var(--blue);
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.92;
  flex: none;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.side-spacer {
  flex: 1;
}

.side-footer {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

/* Consommation du plan : information réelle, rendue sobre. */
.side-plan {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.side-plan b {
  display: block;
  font-size: 11px;
  color: var(--navy);
  font-weight: 780;
}

.side-plan p {
  margin: 3px 0 0;
  font-size: 10px;
  color: var(--muted);
}

.meter {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin-top: 8px;
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
}

.meter.is-full i {
  background: var(--amber);
}

.side-plan a {
  display: inline-block;
  margin-top: 9px;
  font-size: 10px;
  font-weight: 780;
  color: var(--blue);
  text-decoration: none;
}

.side-plan a:hover {
  text-decoration: underline;
}

/* ── Zone principale ────────────────────────────────────── */

.main {
  padding: calc(var(--topbar) + 28px) 34px 50px calc(var(--sidebar) + 34px);
  min-height: 100vh;
}

.container {
  max-width: 1490px;
  margin: 0 auto;
}

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

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 9px;
}

.breadcrumbs a,
.breadcrumbs button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--blue);
  font-weight: 650;
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: 0;
  color: var(--navy);
}

.subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

/* ── Boutons ────────────────────────────────────────────── */

.btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  border-color: #bfc9d8;
  background: #fbfcfe;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 5px 14px rgba(47, 107, 255, 0.17);
}

.btn.primary:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.btn.danger {
  color: var(--red);
  border-color: #f2c3c0;
  background: #fff;
}

.btn.danger:hover {
  background: var(--red-bg);
  border-color: #e6a9a5;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.icon {
  width: 40px;
  padding: 0;
}

.btn.small {
  height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.btn.small.icon {
  width: 32px;
}

.btn.primary[data-dirty="1"] {
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.25);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:disabled:hover {
  border-color: var(--line);
  background: #fff;
}

.btn.primary:disabled:hover {
  background: var(--blue);
}

/* ── Éléments communs ───────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 800;
}

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

.badge.ready {
  color: var(--green);
  background: var(--green-bg);
}

.badge.draft {
  color: var(--blue);
  background: var(--blue-50);
}

.badge.warning {
  color: var(--amber);
  background: var(--amber-bg);
}

.badge.error {
  color: var(--red);
  background: var(--red-bg);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 800;
  color: var(--blue);
  background: var(--blue-50);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel-title {
  font-size: 14px;
  color: var(--navy);
  font-weight: 780;
}

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

.muted {
  color: var(--muted);
  font-size: 12px;
}

.divider {
  height: 1px;
  background: var(--line-soft);
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.ico-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Bandeau d'information (email non confirmé, facturation incomplète…) */

.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 12px;
  border: 1px solid var(--amber-bg);
  background: var(--amber-bg);
  color: #6d4200;
}

.strip p {
  margin: 0;
}

.strip a {
  color: inherit;
  font-weight: 750;
}

.strip.info {
  border-color: var(--blue-100);
  background: var(--blue-50);
  color: #2a4894;
}

/* ── Onglets ────────────────────────────────────────────── */

.tabs {
  height: 49px;
  display: flex;
  align-items: flex-end;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab {
  height: 49px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  padding: 0 2px;
  position: relative;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

.tab.active {
  color: var(--blue);
}

.tab.active:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
}

/* ── Bibliothèque de produits ───────────────────────────── */

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(270px, 1fr) auto auto;
  gap: 12px;
  margin-bottom: 18px;
}

.control {
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.control.search {
  color: var(--muted);
}

.control input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.control select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 650;
  font-size: 12px;
}

.filter-row {
  display: flex;
  gap: 8px;
}

.filter-row .control {
  cursor: pointer;
}

.filter-row .control:disabled {
  cursor: default;
  opacity: 0.7;
}

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

.product-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  transition: 0.18s ease;
  cursor: pointer;
  min-width: 0;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: #c6d1e1;
  box-shadow: var(--shadow);
}

.product-visual {
  height: 176px;
  background: linear-gradient(180deg, #fafbfd, #f4f7fb);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.product-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-visual .td {
  width: 78%;
  height: auto;
}

.td-part {
  fill: none;
  stroke: #8b98aa;
  stroke-width: 2;
}

.td-fold {
  stroke: #c3ccd9;
  stroke-width: 1.4;
  stroke-dasharray: 6 5;
}

.td-axis {
  stroke: #dbe2ec;
  stroke-width: 1.2;
}

.td-node {
  fill: #b9c4d3;
}

.kebab {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(218, 225, 235, 0.85);
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  color: #67768c;
  z-index: 3;
}

.kebab:hover {
  color: var(--navy);
  background: #fff;
}

.card-menu {
  display: none;
  position: absolute;
  right: 10px;
  top: 48px;
  width: 172px;
  z-index: 10;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(20, 36, 62, 0.13);
  padding: 6px;
}

.card-menu.open {
  display: block;
}

.card-menu a,
.card-menu button {
  height: 36px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  font-size: 12px;
  color: #42516a;
  text-decoration: none;
}

.card-menu a:hover,
.card-menu button:hover {
  background: #f5f8fc;
  color: var(--navy);
}

.card-menu .delete {
  color: var(--red);
}

.card-body {
  padding: 14px 15px 15px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.product-name {
  font-size: 14px;
  font-weight: 780;
  color: var(--navy);
  margin-top: 9px;
}

.product-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.48;
  margin-top: 5px;
  height: 33px;
  overflow: hidden;
}

.product-meta {
  font-size: 10px;
  color: #96a1b2;
  margin-top: 13px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.empty-card {
  min-height: 292px;
  border: 1.5px dashed #c8d3e2;
  background: rgba(255, 255, 255, 0.48);
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}

.empty-card:hover {
  border-color: #9eb7ef;
  background: var(--blue-50);
  color: var(--blue);
}

.empty-plus {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 22px;
}

/* États vides et chargement */

.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 46px 30px;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.empty-state h2 {
  margin: 0;
  font-size: 17px;
  color: var(--navy);
}

.empty-state p {
  margin: 9px auto 18px;
  max-width: 430px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

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

.skeleton-card {
  height: 292px;
  border-radius: 13px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(100deg, #f6f8fb 30%, #eef2f7 50%, #f6f8fb 70%);
  background-size: 220% 100%;
  animation: shimmer 1.25s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -60% 0;
  }
}

/* ── En-tête contextuel produit ─────────────────────────── */

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

.product-context-img {
  width: 58px;
  height: 58px;
  border-radius: 11px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #f7f9fc;
  display: grid;
  place-items: center;
  flex: none;
}

.product-context-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-context-copy h1 {
  font-size: 26px;
}

.context-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
}

/* ── Formulaires ────────────────────────────────────────── */

.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.form-panel {
  padding: 22px;
}

.form-title {
  font-size: 15px;
  color: var(--navy);
  font-weight: 780;
  margin-bottom: 19px;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: #536178;
  font-size: 11px;
  font-weight: 720;
}

.field-head em {
  font-style: normal;
  color: var(--muted-2);
  font-weight: 650;
}

.char-count {
  color: var(--muted-2);
  font-weight: 650;
}

.input,
textarea.input,
select.input {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  padding: 0 12px;
  outline: 0;
  font-size: 13px;
  transition: 0.15s;
}

textarea.input {
  height: 104px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus {
  border-color: #8cabfa;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.09);
}

.input:disabled {
  background: #f4f6f9;
  color: var(--muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.form-notice,
.form__notice {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  background: var(--green-bg);
  color: #26603f;
  border: 1px solid #cfe9da;
}

.form-notice--error,
.form__notice--error {
  background: var(--red-bg);
  color: #8c2a24;
  border-color: #f2c9c6;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 3px;
}

.upload-thumb {
  width: 86px;
  height: 76px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #f8fafc;
  display: grid;
  place-items: center;
  flex: none;
}

.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-copy strong {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  display: block;
}

.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.info-panel {
  padding: 18px;
}

.info-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.info-row {
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.info-row:first-child {
  border-top: 0;
}

.info-key {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
}

.info-value {
  text-align: right;
  font-size: 12px;
  color: var(--navy);
  font-weight: 650;
  min-width: 0;
}

.info-value.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  word-break: break-all;
}

.danger-zone {
  border-top: 1px solid #f2d3d0;
  margin-top: 13px;
  padding-top: 16px;
}

.danger-zone strong {
  display: block;
  color: var(--red);
  font-size: 11px;
  margin-bottom: 6px;
}

.danger-zone p {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 12px;
}

/* ── Constructeur d'interface ───────────────────────────── */

.builder {
  display: grid;
  grid-template-columns: 260px minmax(480px, 1fr) 344px;
  gap: 15px;
  align-items: start;
}

.builder-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  overflow: hidden;
}

.builder-head {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.builder-head strong {
  font-size: 13px;
  color: var(--navy);
}

.builder-body {
  padding: 12px;
}

.var-list {
  display: grid;
  gap: 7px;
}

.var-row {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 10px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.var-row:hover {
  border-color: #bfcbe0;
}

.var-row.active {
  border-color: #91afff;
  background: #f8faff;
  box-shadow: 0 0 0 1px rgba(47, 107, 255, 0.09);
}

.drag {
  color: #a7b1c0;
  font-size: 14px;
  letter-spacing: -1px;
}

.var-name {
  font-size: 12px;
  font-weight: 760;
  color: var(--navy);
}

.var-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.type-tag {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.type-number {
  background: var(--blue-50);
  color: var(--blue);
}

.type-list {
  background: var(--green-bg);
  color: var(--green);
}

.type-bool {
  background: var(--purple-bg);
  color: var(--purple);
}

.center-work {
  padding: 12px;
}

.ui-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.ui-section-head {
  padding: 12px 13px;
  background: #fbfcfe;
  display: flex;
  align-items: center;
  gap: 9px;
}

.ui-section-head strong {
  font-size: 12px;
  color: var(--navy);
}

.ui-section-head span {
  font-size: 10px;
  color: var(--muted);
}

.grow {
  flex: 1;
}

.variable-config {
  border-top: 1px solid var(--line-soft);
  padding: 14px;
}

.config-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.config-title strong {
  font-size: 12px;
  color: var(--navy);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mini-field label {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-weight: 720;
  margin-bottom: 5px;
}

.mini-input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 9px;
  font-size: 11px;
  color: var(--text);
  width: 100%;
}

.form-line {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
}

.form-line:first-of-type {
  border-top: 0;
}

.form-line strong {
  color: var(--navy);
}

.form-line span {
  color: var(--muted);
}

.toggle {
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: #c9d2df;
  position: relative;
  display: inline-block;
  border: 0;
  padding: 0;
  flex: none;
}

.toggle:after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: 0.15s;
}

.toggle.on {
  background: var(--blue);
}

.toggle.on:after {
  left: 17px;
}

.preview-panel {
  position: sticky;
  top: calc(var(--topbar) + 20px);
}

.preview-card {
  padding: 17px;
}

.preview-product {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
}

.preview-product img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.preview-product strong {
  font-size: 13px;
  color: var(--navy);
}

.preview-form {
  display: grid;
  gap: 13px;
}

.preview-field label {
  font-size: 10px;
  color: #59677d;
  font-weight: 700;
  display: block;
  margin-bottom: 5px;
}

.preview-field .input {
  min-height: 39px;
  height: 39px;
  font-size: 12px;
}

.preview-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  color: var(--muted);
}

.note {
  margin-top: 12px;
  border-radius: 8px;
  background: #f7f9fc;
  padding: 10px 11px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

/* ── Développés ─────────────────────────────────────────── */

.dev-list {
  display: grid;
  gap: 11px;
}

.dev-row {
  display: grid;
  grid-template-columns: 82px minmax(160px, 1.4fr) minmax(180px, 1fr) 150px auto;
  gap: 16px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
}

.dev-row:hover {
  border-color: #c5d0df;
  box-shadow: var(--shadow-soft);
}

.dev-thumb {
  height: 64px;
  border-radius: 8px;
  background-color: #fcfdfe;
  background-image: linear-gradient(rgba(49, 84, 135, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 84, 135, 0.06) 1px, transparent 1px);
  background-size: 12px 12px;
  border: 1px solid var(--line);
  position: relative;
}

.dev-shape {
  position: absolute;
  left: 16px;
  top: 15px;
  width: 48px;
  height: 33px;
  border: 2px solid #66758c;
  border-radius: 2px;
}

.dev-shape:before,
.dev-shape:after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1.5px solid #66758c;
  border-radius: 50%;
  top: 11px;
}

.dev-shape:before {
  left: 7px;
}

.dev-shape:after {
  right: 7px;
}

.dev-name {
  font-size: 13px;
  font-weight: 780;
  color: var(--navy);
}

.dev-desc {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.formula {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  background: #f7f9fc;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 10px;
  color: #40506b;
  display: inline-block;
}

.dev-meta label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 800;
  margin-bottom: 5px;
}

.add-dev {
  border: 1.5px dashed #c8d3e1;
  border-radius: 11px;
  padding: 21px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.42);
  margin-top: 11px;
  width: 100%;
}

.add-dev:hover {
  border-color: #9cb5ef;
  background: var(--blue-50);
  color: var(--blue);
}

/* ── Utilisation d'un produit ───────────────────────────── */

.use-grid {
  display: grid;
  grid-template-columns: 520px minmax(540px, 1fr);
  gap: 18px;
  align-items: start;
}

.use-panel {
  overflow: hidden;
}

.use-product-head {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 14px;
  align-items: center;
}

.use-product-head .thumb {
  width: 70px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #f8fafc;
  flex: none;
}

.use-product-head .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.use-product-head h2 {
  font-size: 17px;
  margin: 0;
  color: var(--navy);
}

.use-product-head p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
  margin: 5px 0 0;
}

.use-form {
  padding: 18px;
}

.use-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  font-weight: 820;
  margin: 2px 0 13px;
}

.param {
  display: grid;
  grid-template-columns: 30px 1fr 180px;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  border-top: 1px solid var(--line-soft);
}

.param:first-of-type {
  border-top: 0;
}

.param-name {
  font-size: 11px;
  font-weight: 700;
  color: #4b5a71;
}

.param .input {
  height: 37px;
  min-height: 37px;
  font-size: 11px;
}

.param-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f5f7fa;
  display: grid;
  place-items: center;
  color: #68768b;
}

.generated-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 14px;
}

.generated-item {
  font-size: 10px;
  color: #536178;
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.viewport {
  height: 385px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fff, #f9fbfd);
}

.viewport img {
  max-height: 330px;
  max-width: 78%;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(35, 51, 76, 0.12));
}

.viewport-label {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 11px;
  font-weight: 780;
  color: var(--navy);
}

.dim-pill {
  position: absolute;
  border: 1px solid var(--blue-100);
  background: rgba(238, 244, 255, 0.93);
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
  padding: 4px 7px;
  border-radius: 999px;
}

.dim-width {
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
}

.dim-height {
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
}

.result {
  margin-top: 12px;
  overflow: hidden;
}

.generate-area {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.generate-area span {
  font-size: 10px;
  color: var(--muted);
}

.success {
  display: none;
  border-top: 1px solid #d5ecdd;
  background: #f4fbf6;
  padding: 12px 15px;
  align-items: center;
  gap: 10px;
}

.success.show {
  display: flex;
}

.success-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}

.success strong {
  display: block;
  font-size: 11px;
  color: #315c40;
}

.success span {
  font-size: 9px;
  color: #66816f;
}

.file-table {
  display: none;
  padding: 0 15px 12px;
}

.file-table.show {
  display: block;
}

.file-row {
  height: 37px;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr 60px 65px 30px;
  gap: 8px;
  align-items: center;
  font-size: 10px;
  color: #526078;
}

.file-row strong {
  color: var(--navy);
  font-weight: 650;
}

/* ── Éditeur paramétrique ───────────────────────────────── */

.editor-page .main {
  padding: 0;
}

.main-editor {
  position: fixed;
  left: var(--sidebar);
  right: 0;
  top: var(--topbar);
  bottom: 0;
  background: var(--bg);
  z-index: 30;
  display: grid;
  grid-template-rows: 66px minmax(0, 1fr);
}

.editor-top {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-title a,
.editor-title button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.editor-title a:hover,
.editor-title button:hover {
  background: #f5f7fa;
  color: var(--navy);
}

.editor-title strong {
  font-size: 14px;
  color: var(--navy);
}

.editor-title span {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 148px minmax(600px, 1fr) 354px;
  grid-template-rows: minmax(0, 1fr) 172px;
  gap: 0;
  min-height: 0;
}

.toolrail {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 12px;
  grid-row: 1 / 3;
  overflow: auto;
}

.toolrail .side-label {
  padding-left: 7px;
}

.tool {
  height: 38px;
  border: 0;
  background: transparent;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  border-radius: 7px;
  color: #536178;
  font-size: 11px;
  font-weight: 650;
}

.tool:hover {
  background: #f6f8fb;
  color: var(--navy);
}

.tool.active {
  background: var(--blue-50);
  color: var(--blue);
}

.canvas {
  position: relative;
  overflow: hidden;
  background-color: #fff;
  background-image: linear-gradient(rgba(47, 88, 145, 0.052) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 88, 145, 0.052) 1px, transparent 1px);
  background-size: 16px 16px;
  border-right: 1px solid var(--line);
}

.canvas-toolbar {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: flex;
  overflow: hidden;
}

.canvas-toolbar button {
  width: 37px;
  height: 35px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: #fff;
  color: #66758b;
  display: grid;
  place-items: center;
}

.canvas-toolbar button:last-child {
  border-right: 0;
}

.canvas-toolbar button:hover {
  background: #f6f8fb;
  color: var(--blue);
}

.canvas > svg {
  width: 100%;
  height: 100%;
}

.eq-panel {
  background: #fff;
  overflow: auto;
}

.eq-head {
  height: 49px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.eq-head strong {
  font-size: 12px;
  color: var(--navy);
}

.formula-bar {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.formula-name {
  font-size: 9px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 5px;
}

.formula-input {
  display: grid;
  grid-template-columns: 25px 1fr;
  border: 1px solid #afc0e8;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.fx {
  display: grid;
  place-items: center;
  background: var(--blue-50);
  color: var(--blue);
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 11px;
  border-right: 1px solid var(--blue-100);
}

.formula-input input {
  height: 34px;
  border: 0;
  outline: 0;
  padding: 0 8px;
  font: 11px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #30415e;
}

.eq-list-head,
.eq-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr 0.75fr 24px;
  gap: 7px;
  align-items: center;
  padding: 0 10px;
}

.eq-list-head {
  height: 31px;
  color: var(--muted-2);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.eq-row {
  min-height: 42px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  cursor: pointer;
}

.eq-row:hover {
  background: #fafbfd;
}

.eq-row.active {
  background: #f6f9ff;
}

.eq-name {
  font-weight: 730;
  color: var(--navy);
}

.eq-expr {
  font: 9.5px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #465773;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eq-val {
  color: #5b6b82;
  text-align: right;
}

.eq-foot {
  padding: 15px;
  border-top: 1px solid var(--line);
}

.eq-foot .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.inspector {
  background: #fff;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 16px;
}

.inspector-tabs {
  height: 39px;
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.inspector-tabs button {
  border: 0;
  background: transparent;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  position: relative;
}

.inspector-tabs button.active {
  color: var(--blue);
}

.inspector-tabs button.active:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
}

.inspector-body {
  display: grid;
  grid-template-columns: 110px repeat(4, minmax(100px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 13px 0;
}

.entity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.entity-preview {
  width: 44px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--blue);
}

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

.prop .input {
  height: 35px;
  min-height: 35px;
  font-size: 10px;
}

.statusbar {
  position: absolute;
  left: 0;
  right: 354px;
  bottom: 0;
  height: 25px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 9px;
  color: var(--muted);
  z-index: 3;
}

.ok {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ok:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #20a65a;
}

/* ── Compte ─────────────────────────────────────────────── */

.section {
  margin-bottom: 26px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 13px;
}

.section-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--blue-50);
  color: var(--blue);
  display: grid;
  place-items: center;
  flex: none;
}

.section-badge svg {
  width: 18px;
  height: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 14px;
  color: var(--navy);
  font-weight: 780;
}

.section-head p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.section.danger .section-badge {
  background: var(--red-bg);
  color: var(--red);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.rows {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
}

.row:first-child {
  border-top: 0;
}

.row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: none;
}

.row-icon svg {
  width: 17px;
  height: 17px;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-label {
  font-size: 12.5px;
  color: var(--navy);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 3px;
}

.row-value {
  font-size: 12px;
  color: var(--navy);
  font-weight: 650;
  text-align: right;
}

.row-value.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.04em;
}

.radio-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.radio-group legend {
  font-size: 11px;
  font-weight: 720;
  color: #536178;
  margin-bottom: 8px;
  padding: 0;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  cursor: pointer;
  background: #fff;
}

.radio-card:hover {
  border-color: #bfcbe0;
}

.radio-card input {
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.radio-card strong {
  display: block;
  font-size: 12px;
  color: var(--navy);
  font-weight: 730;
}

.radio-card em {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.radio-card:has(input:checked) {
  border-color: #91afff;
  background: #f8faff;
  box-shadow: 0 0 0 1px rgba(47, 107, 255, 0.09);
}

.siret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.field-hint {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 6px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

/* Plans */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 15px;
}

.plan-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
}

.plan-card.current {
  border-color: #91afff;
  box-shadow: 0 0 0 1px rgba(47, 107, 255, 0.12), var(--shadow-soft);
}

.plan-flag {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  font-weight: 800;
  color: var(--blue);
  background: var(--blue-50);
  border-radius: 999px;
  padding: 4px 9px;
}

.plan-card h3 {
  margin: 0;
  font-size: 14px;
  color: var(--navy);
  font-weight: 780;
}

.plan-price {
  margin: 12px 0 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
}

.plan-price span {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 4px;
}

.plan-tagline {
  margin: 7px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.plan-list {
  list-style: none;
  margin: 15px 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  flex: 1;
}

.plan-list li {
  position: relative;
  padding-left: 20px;
  font-size: 11.5px;
  color: #4b5a71;
  line-height: 1.45;
}

.plan-list li:before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green-bg);
  border: 1px solid #bfe4cf;
}

/* Factures */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: auto;
}

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

table.table th {
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 800;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.table td {
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  color: #46556d;
}

table.table tr:first-child td {
  border-top: 0;
}

table.table td.num {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--navy);
  white-space: nowrap;
}

table.table td:last-child {
  text-align: right;
}

.legal-links {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.legal-links a {
  color: var(--blue);
  font-weight: 650;
  text-decoration: none;
}

.legal-links a:hover {
  text-decoration: underline;
}

/* ── Modales ────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 32, 0.35);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal[hidden] {
  display: none;
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(11, 18, 32, 0.22);
  padding: 22px;
}

.modal__panel h2 {
  margin: 0 30px 0 0;
  color: var(--navy);
  font-size: 16px;
  letter-spacing: -0.02em;
}

.modal__lead {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0 16px;
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.modal__close:hover {
  background: var(--surface-2);
  color: var(--navy);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

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

.modal__actions--stack .btn {
  width: 100%;
  justify-content: center;
}

.modal__panel.danger {
  border-color: #f2c3c0;
}

/* ── Toasts ─────────────────────────────────────────────── */

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.toast {
  background: var(--navy);
  color: #fff;
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 650;
  box-shadow: 0 12px 32px rgba(11, 18, 32, 0.19);
  max-width: 330px;
  animation: toast-in 0.2s ease;
}

.toast.toast--error {
  background: var(--red);
}

.toast.is-out {
  opacity: 0;
  transform: translateY(7px);
  transition: 0.25s;
}

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

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1280px) {
  .product-grid,
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .builder {
    grid-template-columns: 235px 1fr;
  }
  .preview-panel {
    grid-column: 1 / -1;
    position: static;
  }
  .editor-grid {
    grid-template-columns: 125px minmax(520px, 1fr) 315px;
  }
  .statusbar {
    right: 315px;
  }
}

@media (max-width: 940px) {
  :root {
    --sidebar: 0px;
  }
  .sidebar {
    display: none;
  }
  .brand {
    width: auto;
  }
  .main {
    padding-left: 22px;
    padding-right: 22px;
  }
  .product-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .library-toolbar {
    grid-template-columns: 1fr;
  }
  .edit-layout,
  .use-grid,
  .radio-group,
  .form-row,
  .form-row.three {
    grid-template-columns: 1fr;
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .user-copy {
    display: none;
  }
  .dev-row {
    grid-template-columns: 82px 1fr;
    row-gap: 10px;
  }
  .iface-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    row-gap: 6px;
  }
  .iface-row-meta {
    display: none;
  }
  .iface-layout {
    grid-template-columns: 1fr;
  }
  .iface-side {
    position: static;
    max-height: none;
  }
}

/* ── Configurateur d'interface : liste 2/3 + panneau 1/3 ── */

.container--iface {
  max-width: 1600px;
}

.iface-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.iface-main {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.iface-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.iface-workspace > .iface-empty-start {
  margin-bottom: 14px;
}

.iface-side {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  max-height: calc(100vh - var(--topbar) - 36px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.iface-side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar) - 36px);
  overflow: hidden;
}

.iface-side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: none;
  border-bottom: 1px solid var(--line-soft);
  background: #f7f9fc;
}

.iface-side-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 12px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.iface-side-tab:hover {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.55);
}

.iface-side-tab.active {
  color: var(--navy);
  background: var(--surface);
  border-bottom-color: var(--blue);
  font-weight: 780;
}

.iface-side-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.iface-side-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex: none;
}

.iface-side-head strong {
  display: block;
  font-size: 13px;
  color: var(--navy);
  font-weight: 780;
}

.iface-side-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.iface-side-foot {
  border-top: 1px solid var(--line-soft);
  padding: 14px 16px;
  background: #fbfcfe;
  flex: none;
  max-height: 42%;
  overflow: auto;
}

.iface-side-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
}

.iface-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.iface-group.is-internal {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.72);
}

.iface-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 13px 15px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line-soft);
}

.iface-group-head .group-drag {
  color: #a7b1c0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.iface-group-head .group-drag:active {
  cursor: grabbing;
}

.iface-group-head.is-dragging {
  opacity: 0.55;
}

.iface-group.is-drop-before {
  box-shadow: inset 0 2px 0 var(--blue);
}

.iface-group.is-group-ghost {
  opacity: 0.92;
  box-shadow: 0 12px 32px rgba(20, 36, 68, 0.22);
  cursor: grabbing;
  border-color: var(--blue);
}

.iface-group-placeholder {
  box-sizing: border-box;
  border: 2px dashed var(--blue);
  border-radius: var(--radius);
  background: rgba(47, 107, 255, 0.07);
  pointer-events: none;
}

body.is-group-dragging {
  cursor: grabbing;
  user-select: none;
}

body.is-group-dragging .iface-add-rail {
  opacity: 0.35;
}

.iface-group-delete {
  margin-left: auto;
  opacity: 0.55;
}

.iface-group-head:hover .iface-group-delete,
.iface-group-delete:focus {
  opacity: 1;
}

.iface-radio-stack {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.iface-radio {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--navy);
  font-weight: 650;
  cursor: pointer;
}

.iface-radio input {
  margin-top: 2px;
  accent-color: var(--blue);
}

.iface-help {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  line-height: 1;
  padding: 0;
  cursor: help;
}

.iface-help:hover {
  color: var(--navy);
  border-color: var(--blue);
}

.iface-help-tip {
  flex: 1 1 100%;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef3ff;
  color: #2f4f9a;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 550;
  text-transform: none;
  letter-spacing: 0;
}

.iface-group-head strong {
  font-size: 12px;
  color: var(--navy);
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.iface-group-head span:not(.iface-help-tip) {
  font-size: 11px;
  color: var(--muted);
}

.iface-group-body {
  display: grid;
}

.iface-item {
  display: grid;
}

.iface-item + .iface-item .iface-row {
  border-top: 1px solid var(--line-soft);
}

.iface-row-dropdown {
  border-top: 1px solid var(--line-soft);
  background: #f7f9fc;
  padding: 0;
}

.iface-editor {
  padding: 10px 12px 12px;
  display: grid;
  gap: 8px;
  border-left: 3px solid var(--blue);
  background: #f8fafc;
}

.iface-editor-toolbar,
.iface-editor-toolbar-left,
.iface-editor-toolbar-right {
  display: none;
}

.iface-editor #var-form {
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.iface-editor .field {
  margin-bottom: 0;
}

.iface-editor .field-head {
  margin-bottom: 4px;
  font-size: 10px;
}

.iface-editor .input,
.iface-editor textarea.input,
.iface-editor select.input {
  min-height: 34px;
  height: 34px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 7px;
}

.iface-editor .form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.iface-editor .iface-name-row {
  grid-template-columns: 130px minmax(0, 1fr) 110px;
}

.iface-editor .iface-name-row:has(> [data-field="type-field"][hidden]) {
  grid-template-columns: minmax(0, 1fr) 110px;
}

.iface-editor .iface-name-row:has(> .field[hidden]:not([data-field="type-field"])) {
  grid-template-columns: 130px minmax(0, 1fr);
}

.iface-editor .iface-name-row:has(> [data-field="type-field"][hidden]):has(> .field[hidden]:not([data-field="type-field"])) {
  grid-template-columns: 1fr;
}

.iface-editor .form-row:has(> .field[hidden]):not(.iface-name-row) {
  grid-template-columns: 1fr;
}

.iface-editor .form-row[data-show="number"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.iface-editor .form-row[data-show="boolean"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.iface-editor .check-row {
  margin: 0;
  font-size: 12px;
  gap: 7px;
}

.iface-editor .field-hint {
  margin: 0;
  font-size: 11px;
}

.iface-editor .field-hint.compact {
  margin-top: -2px;
}

.vis-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 0 12px;
}

.vis-head-text {
  min-width: 0;
  flex: 1;
}

.vis-head .field-hint {
  margin-top: 2px;
}

.vis-head .toggle {
  margin-top: 2px;
}

.vis-editor {
  margin-top: 4px;
  margin-bottom: 8px;
  display: grid;
  gap: 8px;
}

.vis-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 8px 10px;
  border: 1px solid #afc0e8;
  border-radius: 8px;
  background: #fff;
}

.vis-fx {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #eef3ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 780;
}

.vis-eq,
.vis-paren,
.vis-semi {
  color: #536178;
  font-weight: 700;
  font-size: 13px;
}

.vis-cond {
  flex: 1 1 140px;
  min-width: 120px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px dashed #c5d0e0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}

.vis-cond:focus {
  outline: 2px solid rgba(47, 107, 255, 0.25);
  border-style: solid;
  border-color: var(--blue);
}

.vis-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.vis-tools .fx-insert {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 280px;
}

.vis-invert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--navy);
  cursor: pointer;
  user-select: none;
}

.vis-invert em {
  font-style: normal;
  color: var(--muted);
  font-weight: 550;
}

.vis-formula .fx-chip--vis {
  background: #e8f7ef;
  color: #1f7a4d;
  border-color: #b7e0c8;
}

.iface-editor .fx-field {
  min-height: 34px;
}

.iface-editor .fx-field .fx {
  min-height: 34px;
  padding: 0 8px;
  font-size: 11px;
}

.iface-editor .fx-compose {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 12px;
}

.iface-editor .fx-tools .fx-insert {
  height: 30px;
  font-size: 11px;
  flex: 1 1 140px;
  max-width: none;
}

.iface-editor .fx-editor {
  gap: 6px;
}

.iface-editor .fx-live {
  font-size: 10px;
  min-height: 0;
}

.iface-editor .usage-box {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.iface-editor .usage-box-title {
  margin-bottom: 0;
}

.iface-editor .options-table {
  font-size: 11px;
}

.iface-editor .options-table .input {
  min-height: 30px;
  height: 30px;
}

.iface-editor #add-option {
  margin-top: 6px;
}

.iface-inline-row {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.iface-row {
  min-height: 42px;
}

.iface-row-actions .btn.icon.is-open {
  background: #e8f0ff;
  color: var(--blue);
}

.iface-group.is-creating {
  border-style: dashed;
}

.iface-side-tabs {
  display: none;
}

@media (max-width: 900px) {
  .iface-editor .iface-name-row {
    grid-template-columns: 1fr;
  }

  .iface-editor .form-row,
  .iface-editor .form-row[data-show="number"],
  .iface-editor .form-row[data-show="boolean"] {
    grid-template-columns: 1fr;
  }
}

.iface-row {
  display: grid;
  grid-template-columns: 22px minmax(120px, 1.2fr) 110px 70px minmax(90px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}

.iface-row:first-child {
  border-top: 0;
}

.iface-item:first-child > .iface-row {
  border-top: 0;
}

.iface-item + .iface-item > .iface-row {
  border-top: 1px solid var(--line-soft);
}

.iface-row:hover {
  background: #fafbfd;
}

.iface-row.active {
  background: #f6f9ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.iface-row--empty {
  cursor: default;
  color: var(--muted);
  font-size: 12px;
}

.iface-row .drag {
  color: #a7b1c0;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.iface-row .drag:active {
  cursor: grabbing;
}

.iface-row .drag.is-disabled {
  opacity: 0.35;
  cursor: default;
}

.iface-item.is-dragging {
  opacity: 0.45;
}

.iface-group-body.is-drop-target {
  outline: 2px dashed var(--blue);
  outline-offset: -2px;
  background: rgba(47, 107, 255, 0.04);
  border-radius: 0 0 var(--radius) var(--radius);
}

.iface-item.is-drop-before {
  box-shadow: inset 0 2px 0 var(--blue);
}

.iface-drop-hint {
  color: var(--muted);
  font-style: italic;
}

.iface-row-name {
  font-size: 12.5px;
  font-weight: 760;
  color: var(--navy);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.iface-row-meta {
  font-size: 11px;
  color: #536178;
  font-weight: 650;
}

.iface-row-value.is-calc {
  font-weight: 720;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.iface-row-value.is-error {
  color: #a0332b;
  font-weight: 700;
}

.iface-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
  min-width: 96px;
  height: 100%;
}

.iface-row-act {
  display: inline-grid !important;
  place-items: center;
  opacity: 0.55;
  color: #5c6b80 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 15px !important;
  line-height: 1 !important;
  flex: none;
}

.iface-row:hover .iface-row-act,
.iface-row.active .iface-row-act,
.iface-row-act:focus {
  opacity: 1;
}

.iface-row-act.danger:hover,
.iface-row-act.danger:focus {
  color: #a0332b !important;
}

.iface-chevron {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  color: #5c6b80;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.iface-chevron::before {
  content: "›";
  display: block;
  line-height: 1;
}

.iface-row.is-expanded .iface-chevron::before,
.iface-row.active .iface-chevron::before {
  content: "∨";
  font-size: 14px;
}

.iface-foot {
  display: none;
}

.iface-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1.5px solid #c5d0e0;
  border-radius: 50%;
  background: #fff;
  color: #5c6b80;
  font-size: 20px;
  font-weight: 400;
  line-height: 0;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s, transform 0.12s;
}

/* Centrage optique du « + » dans le cercle */
.iface-plus::before {
  content: "+";
  display: block;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  transform: translateY(-0.05em);
}

.iface-plus:hover,
.iface-plus:focus {
  border-color: var(--blue);
  color: var(--blue);
  background: #f6f9ff;
  outline: none;
}

.iface-plus--lg {
  width: 44px;
  height: 44px;
  font-size: 30px;
  border-width: 2px;
}

/* + entre groupes : espace dédié pour ne pas toucher les cadres */
.iface-add-rail {
  position: relative;
  z-index: 3;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  pointer-events: none;
}

.iface-add-rail .iface-plus {
  pointer-events: auto;
  position: absolute;
  left: 0;
  top: 50%;
  width: 24px;
  height: 24px;
  font-size: 17px;
  opacity: 0.65;
  box-shadow: 0 1px 3px rgba(20, 36, 68, 0.12);
  transform: translate(-50%, -50%);
}

.iface-add-rail .iface-plus:hover,
.iface-add-rail .iface-plus:focus {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.08);
}

.iface-group-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 14px;
  border-top: 1px dashed var(--line-soft);
  background: rgba(255, 255, 255, 0.45);
}

.iface-group-add .iface-plus:hover,
.iface-group-add .iface-plus:focus {
  transform: scale(1.06);
}

.iface-group-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
  text-align: center;
}

.iface-plus-hint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.iface-empty-start {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 20px;
  margin-bottom: 12px;
  border: 1px dashed #c5d0e0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
  text-align: center;
}

.iface-empty-start strong {
  font-size: 14px;
  color: var(--navy);
  font-weight: 780;
}

.iface-empty-start p {
  margin: 0;
  max-width: 320px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.iface-group.is-internal .iface-group-add {
  background: rgba(248, 250, 252, 0.8);
}

.fx-field {
  display: grid;
  grid-template-columns: 34px 1fr;
  border: 1px solid #afc0e8;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.fx-field .fx {
  display: grid;
  place-items: center;
  background: var(--blue-50);
  color: var(--blue);
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 12px;
  border-right: 1px solid var(--blue-100);
}

.fx-field input {
  height: 40px;
  border: 0;
  outline: 0;
  padding: 0 10px;
  font: 12px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #30415e;
  width: 100%;
}

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

.options-table th {
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  padding: 6px 0;
}

.options-table td {
  padding: 4px 6px 4px 0;
}

.options-table .opt-default-col {
  width: 52px;
  text-align: center;
  padding-right: 8px;
  vertical-align: middle;
}

.options-table .opt-default-col input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

.options-table .input {
  min-height: 36px;
  height: 36px;
  font-size: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--navy);
  font-weight: 650;
  margin-top: 4px;
}

.check-row input {
  accent-color: var(--blue);
}

.preview-block {
  margin-bottom: 18px;
}

.preview-block-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  font-weight: 820;
  margin-bottom: 12px;
}

.preview-field {
  margin-bottom: 14px;
}

.preview-field label {
  display: block;
  font-size: 11px;
  font-weight: 720;
  color: #536178;
  margin-bottom: 6px;
}

.preview-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.preview-input-row .unit {
  font-size: 11px;
  color: var(--muted);
  font-weight: 650;
}

.preview-bool {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.preview-field--display .preview-display {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f7fb;
  border: 1px solid var(--line-soft, #e6ebf2);
  color: var(--ink, #0f172a);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.45em;
}

.preview-field--display label {
  color: #64748b;
}

.fx-results {
  display: grid;
  gap: 8px;
}

.fx-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
}

.fx-result-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.fx-result-name {
  font-size: 12px;
  font-weight: 750;
  color: var(--navy);
}

.fx-result-formula {
  font: 10px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--muted);
  margin-top: 2px;
}

.fx-result-value {
  font-size: 12px;
  color: var(--navy);
  text-align: right;
  white-space: nowrap;
}

.fx-error {
  color: var(--red);
  font-size: 11px;
  font-weight: 650;
}

/* ── Santé / usagés / ID auto ───────────────────────────── */

.iface-health {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid #f0c4bf;
  background: #fff7f6;
  border-radius: var(--radius-sm);
  color: #8a2f28;
  font-size: 12px;
  line-height: 1.45;
}

.iface-health strong {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}

.iface-health span:last-child {
  color: #a04a44;
}

.iface-health-icon {
  flex: none;
  font-size: 14px;
  line-height: 1.2;
}

.id-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}

.id-chip code {
  font: 600 12px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--navy);
}

.iface-row-id {
  margin-top: 2px;
}

.iface-row-id code {
  font: 10px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--muted-2);
}

.iface-row.is-broken {
  background: #fff8f7;
  box-shadow: inset 3px 0 0 #d95c52;
}

.iface-row-name .tag {
  margin-left: 6px;
  vertical-align: middle;
}

.tag-usage {
  background: #eef3ff;
  color: #2f4f9a;
}

.tag-warn {
  background: #ffe8e5;
  color: #a0332b;
}

.usage-box {
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.usage-box-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.usage-box-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 820;
  color: var(--muted-2);
  margin: 0;
}

.usage-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e8eef8;
  color: #3a4d6e;
  font-size: 10px;
  font-weight: 780;
  line-height: 1;
}

.usage-box.is-empty .usage-box-head {
  margin-bottom: 2px;
}

.usage-empty {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 550;
}

.usage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.usage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px 3px 4px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s;
}

.usage-chip:hover,
.usage-chip:focus {
  border-color: #afc0e8;
  background: #f6f9ff;
  outline: none;
}

.usage-chip .fx-chip {
  margin: 0;
}

.usage-chip-meta {
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

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

.usage-list li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line-soft);
  font-size: 12px;
}

.usage-list li.is-warn {
  border-color: #f0c4bf;
  background: #fff7f6;
}

.usage-list strong {
  color: var(--navy);
}

.usage-meta {
  color: var(--muted);
  font-size: 11px;
}

.usage-list code {
  font: 10px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--muted);
  word-break: break-all;
}

.fx-editor {
  display: grid;
  gap: 8px;
}

.fx-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fx-tools .fx-insert {
  font-size: 12px;
  height: 34px;
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 280px;
}

.fx-fn-trigger {
  cursor: pointer;
  text-align: left;
  appearance: none;
}

.fx-fn-menu {
  position: fixed;
  z-index: 130;
  max-height: min(420px, calc(100vh - 16px));
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(11, 18, 32, 0.16);
  padding: 6px;
}

.fx-fn-group + .fx-fn-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.fx-fn-group-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px 6px;
}

.fx-fn-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
  font: inherit;
}

.fx-fn-item:hover,
.fx-fn-item:focus-visible {
  background: #f3f6ff;
  outline: none;
}

.fx-fn-item-hint {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-fn-tip {
  position: fixed;
  z-index: 131;
  max-height: min(70vh, calc(100vh - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(11, 18, 32, 0.28);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

.fx-fn-tip-name {
  font-weight: 780;
  font-size: 13px;
}

.fx-fn-tip-cat {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 2px 0 10px;
}

.fx-fn-tip-dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.fx-fn-tip-dl dt {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #94a3b8;
}

.fx-fn-tip-dl dd {
  margin: 2px 0 0;
  color: #e2e8f0;
}

.fx-fn-tip-dl code {
  font: 11px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #bfdbfe;
  word-break: break-word;
}

.fx-live {
  min-height: 0;
  font-size: 11px;
  line-height: 1.4;
}

.fx-live-ok {
  color: #2f6a45;
  font-weight: 650;
}

.fx-field {
  display: flex;
  align-items: flex-start;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
  min-height: 42px;
}

.fx-field .fx {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 10px;
  min-height: 42px;
  background: #f3f6fb;
  border-right: 1px solid var(--line-soft);
  color: var(--blue);
  font-weight: 780;
  font-size: 12px;
}

.fx-compose {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--navy);
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.fx-compose:empty::before,
.fx-compose.is-empty:not(:focus)::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.fx-compose.is-invalid {
  box-shadow: inset 0 0 0 2px rgba(217, 92, 82, 0.35);
  background: #fff8f7;
}

.fx-compose .fx-chip {
  margin: 0 2px;
  vertical-align: baseline;
}

.fx-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.45;
  white-space: nowrap;
  user-select: none;
  cursor: default;
}

.fx-chip--mini {
  padding: 1px 8px;
  font-size: 11px;
}

.fx-chip--c0 { background: #e8f1ff; color: #1f4f9c; }
.fx-chip--c1 { background: #e9f8f0; color: #1f6a45; }
.fx-chip--c2 { background: #fff0e4; color: #9a4d12; }
.fx-chip--c3 { background: #f3e9ff; color: #6a3aa0; }
.fx-chip--c4 { background: #ffe8ef; color: #9a2f55; }
.fx-chip--c5 { background: #e8f7fb; color: #1b6c7a; }
.fx-chip--c6 { background: #f4f0e6; color: #6d5a2c; }
.fx-chip--c7 { background: #eef0f7; color: #3d4a6b; }

.fx-chip--fn {
  background: #eef2f7;
  color: #445166;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 650;
  border-radius: 6px;
}

.fx-chip.is-broken {
  background: #ffe8e5;
  color: #a0332b;
}

.usage-formula {
  font-size: 11px;
  color: var(--muted);
  word-break: break-word;
}

.usage-list code {
  display: none;
}

.fx-suggest {
  position: fixed;
  z-index: 120;
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(11, 18, 32, 0.16);
  padding: 4px;
}

.fx-suggest-item {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}

.fx-suggest-item:hover,
.fx-suggest-item.is-active {
  background: #f3f6ff;
}

.fx-suggest-main {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 12px;
}

.fx-suggest-meta {
  font-size: 10px;
  color: var(--muted);
}

.fx-result-row.is-broken {
  background: #fff7f6;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 8px;
}

.iface-row-name .fx-chip {
  margin-right: 6px;
}

.iface-row-name .tag {
  margin-left: 4px;
  vertical-align: middle;
}

#delete-var-modal .modal__panel {
  max-width: 520px;
}

#delete-var-modal .modal__actions {
  flex-wrap: wrap;
}
