/* ==========================================================================
   Studio Fiches — feuille de style de base (même famille visuelle que Revendoz)
   --------------------------------------------------------------------------
   1. Tokens (clair / sombre)     5. Données (graphiques, grille, jauges)
   2. Base                        6. Blocs d'écran
   3. Structure (barre, page)     7. Responsive
   4. Composants

   Thème : data-theme="light" | "dark" sur .sf-app (ou sur <html>).
   Aucune couleur en dur dans les composants : tout passe par les variables.
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */

:root {
  /* Typo */
  --font-title: "Inter", system-ui, -apple-system, sans-serif;
  --font-text: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Rayons, espacements, tailles */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 28px;
  --r-pill: 999px;
  --gap: 16px;
  --tap: 40px;               /* cible tactile minimale */
  --side-w: 248px;
  --side-max-h: 1040px;      /* plafond pour les maquettes ; en production : 100vh */
  --blur: 0px;

  /* Marque */
  --brand-blue: #2E5AC8;
}

:root,
[data-theme="light"] {
  color-scheme: light;

  /* Surfaces */
  --bg: #FFFFFF;
  --glow-1: transparent;
  --glow-2: transparent;
  --glow-3: transparent;
  --surface: #F7F7F8;          /* blocs (cartes) */
  --surface-2: #FFFFFF;        /* éléments posés sur un bloc */
  --surface-solid: #FFFFFF;                   /* menus, infobulles, barre collante */
  --surface-sunken: #F0F0F2;   /* pistes, fonds de sélecteur */
  --surface-hover: #F2F2F4;
  --field: #FFFFFF;
  --border: #ECECEE;
  --border-strong: #DCDCE0;
  --glass-edge: transparent;

  /* Texte (AA sur toutes les surfaces) */
  --text: #111113;
  --text-2: #45454D;
  --text-3: #5C5C66;
  --text-on-accent: #FFFFFF;

  /* Accent */
  --accent: #2E5AC8;
  --accent-hover: #244CB0;
  --accent-text: #2A52B8;                     /* violet lisible en texte */
  --accent-soft: rgba(46, 90, 200, .08);
  --accent-soft-2: rgba(46, 90, 200, .18);
  --focus: #2A52B8;

  /* États : couleur pleine, variante texte (AA), fond doux */
  --success: #12936A;
  --success-text: #0B7553;
  --success-soft: rgba(18, 147, 106, .12);
  --warning: #C46A12;
  --warning-text: #9A4F08;
  --warning-soft: rgba(196, 106, 18, .13);
  --danger: #E5484D;
  --danger-text: #C02A30;
  --danger-soft: rgba(229, 72, 77, .11);

  /* Contrôles */
  --track-off: #8E8E8E;
  --toast-bg: #1A1D2E;
  --toast-text: #FFFFFF;
  --toast-accent: #C3BDFF;

  /* Graphiques */
  --chart-1: #2E5AC8;
  --chart-2: #B8577A;
  --chart-muted: #B3B3B3;
  --chart-grid: #ECECEE;
  --heat-0: #F0F0F2;
  --heat-1: rgba(46, 90, 200, .16);
  --heat-2: rgba(46, 90, 200, .36);
  --heat-3: rgba(46, 90, 200, .64);
  --heat-4: #2A52B8;

  /* Emplacements photo */
  --ph-1: #D6E0F2;
  --ph-2: #F2D9CF;
  --ph-3: #DCE4CC;
  --ph-4: #E6E1D8;
  --ph-5: #F3E8D6;
  --ph-6: #DFE4EB;
  --ph-ink: rgba(255, 255, 255, .6);

  /* Ombres */
  --shadow-1: none;
  --shadow-2: 0 20px 48px -16px rgba(0, 0, 0, .22);
  --shadow-accent: none;
  --raised: #FFFFFF;
  --btn-bg: #F0F0F2;
  --btn-hover: #E6E6EA;
  --btn-on-well: #FFFFFF;
  --btn-on-well-hover: #EDEDF0;
  --nav-active: #F2F2F4;
  --line: #EBEBEE;
  --tile-ring: #E8E8EB;
  --grad-brand: linear-gradient(135deg, #1E3FA0 0%, #2E5AC8 50%, #6E9BF2 100%);
  --acct-1: #2E5AC8;
  --acct-2: #B8577A;
  --acct-3: #B5532E;
  --shadow-lift: 0 14px 30px -14px rgba(0, 0, 0, .22);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #1C1B1A;
  --glow-1: transparent;
  --glow-2: transparent;
  --glow-3: transparent;
  --surface: #252423;
  --surface-2: #2E2D2B;
  --surface-solid: #2E2D2B;
  --surface-sunken: #2B2A28;
  --surface-hover: #32312F;
  --field: rgba(0, 0, 0, .24);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .15);
  --glass-edge: transparent;

  --text: #EDECEA;
  --text-2: #C2BFBA;
  --text-3: #9A968F;
  --text-on-accent: #FFFFFF;

  --accent: #3D6AD8;
  --accent-hover: #4A76E0;
  --accent-text: #93B2FF;
  --accent-soft: rgba(99, 140, 240, .16);
  --accent-soft-2: rgba(99, 140, 240, .28);
  --focus: #93B2FF;

  --success: #2BB98A;
  --success-text: #5AD6AB;
  --success-soft: rgba(43, 185, 138, .16);
  --warning: #E08A32;
  --warning-text: #F2AE6A;
  --warning-soft: rgba(224, 138, 50, .17);
  --danger: #F0666B;
  --danger-text: #FF9498;
  --danger-soft: rgba(240, 102, 107, .17);

  --track-off: #6E6B66;
  --toast-bg: #ECEEF8;
  --toast-text: #1A1D2E;
  --toast-accent: #5546E0;

  --chart-1: #5A84E6;
  --chart-2: #CC6E92;
  --chart-muted: #6E6B66;
  --chart-grid: rgba(255, 255, 255, .07);
  --heat-0: #2B2A28;
  --heat-1: rgba(90, 132, 230, .22);
  --heat-2: rgba(90, 132, 230, .45);
  --heat-3: rgba(90, 132, 230, .72);
  --heat-4: #93B2FF;

  --ph-1: #34405A;
  --ph-2: #5A3E36;
  --ph-3: #454C38;
  --ph-4: #3F3B35;
  --ph-5: #57493A;
  --ph-6: #3B414B;
  --ph-ink: rgba(255, 255, 255, .22);

  --shadow-1: none;
  --shadow-2: 0 20px 48px -16px rgba(0, 0, 0, .6);
  --shadow-accent: none;
  --raised: #2E2D2B;
  --btn-bg: #32312F;
  --btn-hover: #3B3A37;
  --btn-on-well: #34332F;
  --btn-on-well-hover: #3D3C39;
  --nav-active: #2B2A28;
  --line: rgba(255, 255, 255, .07);
  --tile-ring: rgba(255, 255, 255, .08);
  --grad-brand: linear-gradient(135deg, #2E5AC8 0%, #5A84E6 55%, #93B2FF 100%);
  --acct-1: #3D6AD8;
  --acct-2: #B8577A;
  --acct-3: #B5532E;
  --shadow-lift: 0 14px 30px -14px rgba(0, 0, 0, .5);
}

/* 2. BASE ------------------------------------------------------------------ */

:is(.sf-app, .sf-side-in),
:is(.sf-app, .sf-side-in) *,
:is(.sf-app, .sf-side-in) *::before,
:is(.sf-app, .sf-side-in) *::after { box-sizing: border-box; }

.sf-app,
.sf-side-in {
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:is(.sf-app, .sf-side-in) :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure) { margin: 0; padding: 0; }
:is(.sf-app, .sf-side-in) :where(ul, ol) { list-style: none; }
:is(.sf-app, .sf-side-in) :where(button, input, select, textarea) { font: inherit; color: inherit; margin: 0; }
:is(.sf-app, .sf-side-in) :where(a) { color: inherit; text-decoration: none; }
:is(.sf-app, .sf-side-in) :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Balises de gabarit des maquettes : sans effet sur la mise en page */
sc-for, sc-if, dc-import { display: contents; }

.sf-ico {
  width: 18px; height: 18px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.sf-ico.sm { width: 14px; height: 14px; stroke-width: 2; }
.sf-ico.lg { width: 22px; height: 22px; }
.sf-ico.dots { stroke-width: 2.6; }

/* Utilitaires */
.sf-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sf-row.wrap { flex-wrap: wrap; }
.sf-row.top { align-items: flex-start; }
.sf-row.tight { gap: 6px; }
.sf-row.tap { min-height: var(--tap); }
.sf-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sf-col.tight { gap: 2px; }
.sf-col.loose { gap: 16px; }
.sf-between { justify-content: space-between; }
.sf-grow { flex: 1 1 0; min-width: 0; }
.sf-end { margin-left: auto; }
.sf-t2 { color: var(--text-2); }
.sf-t3 { color: var(--text-3); }
.sf-small { font-size: 12px; line-height: 1.35; }
.sf-strong { font-weight: 600; }
.sf-nw { white-space: nowrap; }
.sf-tnum { font-variant-numeric: tabular-nums; }
.sf-fig { font-family: var(--font-title); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.sf-fig.md { font-size: 22px; }
.sf-fig.lg { font-size: 30px; }
.sf-mono { font-family: var(--font-mono); font-size: 12px; }
.sf-trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-block { display: block; }
.sf-w-80 { width: 80px; flex: none; }
.sf-w-104 { width: 104px; flex: none; }
.sf-w-140 { width: 140px; flex: none; }
.sf-w-200 { width: 200px; flex: none; }
.sf-divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.sf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sf-est {
  display: inline-block; padding: 0 6px; border-radius: var(--r-pill); border: 1px dashed var(--border-strong);
  font-size: 12px; font-weight: 500; line-height: 16px; color: var(--text-3); white-space: nowrap; font-family: var(--font-text); letter-spacing: 0;
}
.sf-good { color: var(--success-text); }
.sf-bad { color: var(--danger-text); }

/* 3. STRUCTURE ------------------------------------------------------------- */

.sf-app {
  display: flex; flex-wrap: wrap; align-content: flex-start;
  min-height: 100vh;
  container: sfapp / inline-size;
  background:
    radial-gradient(900px 620px at 0% 0%, var(--glow-1), transparent 62%),
    radial-gradient(820px 600px at 100% 8%, var(--glow-3), transparent 60%),
    radial-gradient(900px 700px at 62% 100%, var(--glow-2), transparent 60%),
    var(--bg);
}

/* Barre latérale */
.sf-side {
  flex: 0 0 var(--side-w); min-width: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
}
.sf-side-in {
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 14px;
  height: min(100vh, var(--side-max-h));
  padding: 18px 14px 14px;
}
.sf-side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px; min-height: 40px; }
.sf-burger { display: none; }

.sf-logo { display: inline-flex; align-items: center; gap: 11px; min-height: 40px; }
.sf-logo-tag {
  position: relative; flex: none; width: 22px; height: 28px;
  background: var(--grad-brand);
  clip-path: path("M9.6 1.2Q11 0 12.4 1.2L20.3 8Q22 9.5 22 11.6V24a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V11.6Q0 9.5 1.7 8Z");
  transform: rotate(18deg);
}
.sf-logo-tag::after { content: ""; position: absolute; left: 8px; top: 8.5px; width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .95; }
.sf-logo-word { font-family: var(--font-title); font-weight: 700; font-size: 23px; letter-spacing: -.035em; line-height: 1; }
.sf-logo.lg .sf-logo-tag { transform: rotate(18deg) scale(1.5); margin: 0 8px; }
.sf-logo.lg .sf-logo-word { font-size: 34px; }

.sf-acct {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  text-align: left; cursor: pointer;
}
.sf-acct:hover { border-color: var(--border-strong); }
.sf-acct-name { display: block; font-weight: 600; font-size: 13px; line-height: 1.25; }
.sf-acct-sub { display: block; font-size: 12px; color: var(--text-3); line-height: 1.3; }
.sf-avatars { display: flex; flex: none; }
.sf-avatars .sf-avatar + .sf-avatar { margin-left: -9px; }
.sf-avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 600 12px/1 var(--font-title); color: #fff; background: var(--acct-1);
  box-shadow: 0 0 0 2px var(--surface-solid);
}
.sf-avatar.a2 { background: var(--acct-2); }
.sf-avatar.a3 { background: var(--acct-3); }
.sf-avatar.mute { background: var(--surface-sunken); color: var(--text-2); box-shadow: none; }
.sf-avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.sf-acct-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--acct-1); }
.sf-acct-dot.a2 { background: var(--acct-2); }
.sf-acct-dot.a3 { background: var(--acct-3); }

.sf-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sf-nav-group { padding: 12px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.sf-nav-item {
  display: flex; align-items: center; gap: 10px; flex: none; min-height: var(--tap); padding: 0 10px;
  border-radius: var(--r-sm); color: var(--text-2); font-weight: 500;
}
.sf-nav-item:hover { background: var(--surface-hover); color: var(--text); }
.sf-nav-item.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sf-nav-badge {
  margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--text-on-accent); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.sf-nav-badge.warn { background: var(--warning-soft); color: var(--warning-text); }

.sf-side-foot { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.sf-engine { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--success-soft); }
.sf-engine-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--success); animation: sf-pulse 2.2s ease-out infinite; }
.sf-engine-title { display: block; font-weight: 600; font-size: 13px; line-height: 1.25; color: var(--success-text); }
.sf-engine-sub { display: block; font-size: 12px; line-height: 1.3; color: var(--text-2); }
.sf-engine.paused { background: var(--warning-soft); }
.sf-engine.paused .sf-engine-dot { background: var(--warning); animation: none; }
.sf-engine.paused .sf-engine-title { color: var(--warning-text); }
@keyframes sf-pulse {
  0% { box-shadow: 0 0 0 0 rgba(18, 147, 106, .45); }
  100% { box-shadow: 0 0 0 9px rgba(18, 147, 106, 0); }
}
.sf-theme-btn .when-dark { display: none; }
[data-theme="dark"] .sf-theme-btn .when-dark { display: block; }
[data-theme="dark"] .sf-theme-btn .when-light { display: none; }

/* Page */
.sf-main {
  flex: 999 1 560px; min-width: 0; min-height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 26px 30px 36px;
}
.sf-main.is-fixed { height: 100vh; overflow: hidden; }
.sf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.sf-title { font: 700 28px/1.15 var(--font-title); letter-spacing: -.02em; }
.sf-sub { margin-top: 4px; color: var(--text-2); }
.sf-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.sf-grid { display: grid; gap: var(--gap); }
.sf-g4 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.sf-g3 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.sf-g2 { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.sf-g-main { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }
.sf-g-rail { grid-template-columns: 272px minmax(0, 1fr); }
.sf-g-editor { grid-template-columns: minmax(0, 1fr) 360px; }
.sf-g-fields { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 14px; }
.sf-top { align-items: start; }

/* 4. COMPOSANTS ------------------------------------------------------------ */

/* Carte (verre dépoli) */
.sf-card {
  position: relative; min-width: 0; padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--glass-edge);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.3); backdrop-filter: blur(var(--blur)) saturate(1.3);
}
.sf-card.flush { padding: 0; overflow: hidden; }
.sf-card.colflex { display: flex; flex-direction: column; }
.sf-card.sub {
  padding: 14px; background: var(--surface-2); border-radius: var(--r-md); box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.sf-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.sf-card.flush > .sf-card-head { padding: 16px 20px 0; margin-bottom: 12px; }
.sf-card-title { font: 600 16px/1.25 var(--font-title); letter-spacing: -.01em; }
.sf-card-note { font-size: 13px; color: var(--text-2); }
.sf-card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }

/* Carte chiffre clé */
.sf-kpi { display: flex; flex-direction: column; gap: 6px; }
.sf-kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.sf-kpi-value { font: 700 30px/1.1 var(--font-title); letter-spacing: -.02em; }
.sf-kpi-value small { font-size: 16px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.sf-kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.sf-spark { position: absolute; right: 18px; top: 18px; width: 84px; height: 32px; overflow: visible; }
.sf-spark polyline { fill: none; stroke: var(--chart-muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sf-spark circle { fill: var(--chart-1); stroke: var(--surface-solid); stroke-width: 2; }
.sf-delta {
  display: inline-flex; align-items: center; padding: 2px 7px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--surface-sunken); color: var(--text-2);
}
.sf-delta.good { background: var(--success-soft); color: var(--success-text); }
.sf-delta.bad { background: var(--danger-soft); color: var(--danger-text); }

/* Boutons */
.sf-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.sf-btn:hover { background: var(--surface-solid); border-color: var(--text-3); }
.sf-btn.primary { background: var(--accent); border-color: transparent; color: var(--text-on-accent); box-shadow: var(--shadow-accent); }
.sf-btn.primary:hover { background: var(--accent-hover); }
.sf-btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.sf-btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.sf-btn.danger { color: var(--danger-text); }
.sf-btn.brand {
  border: 2px solid transparent; color: var(--text);
  background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--grad-brand) border-box;
  box-shadow: 0 8px 22px -10px rgba(232, 111, 167, .7);
}
.sf-btn.brand .sf-ico { color: var(--accent-text); }
.sf-btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.sf-btn.sm::after { content: ""; position: absolute; inset: -4px -2px; }   /* cible 40 px */
.sf-btn.icon { width: var(--tap); padding: 0; }
.sf-btn.icon.sm { width: 32px; }
.sf-btn.block { width: 100%; }
.sf-btn.start { justify-content: flex-start; }
.sf-btn.dashed { border-style: dashed; background: transparent; color: var(--text-2); }
.sf-btn:disabled { opacity: .5; cursor: not-allowed; }
.sf-link { color: var(--accent-text); font-weight: 600; }
.sf-link:hover { text-decoration: underline; }

/* Pastille de statut : point + libellé, jamais la couleur seule */
.sf-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-sunken); color: var(--text-2);
}
.sf-pill::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sf-pill.plain::before { display: none; }
.sf-pill.ok { background: var(--success-soft); color: var(--success-text); }
.sf-pill.warn { background: var(--warning-soft); color: var(--warning-text); }
.sf-pill.err { background: var(--danger-soft); color: var(--danger-text); }
.sf-pill.info { background: var(--accent-soft); color: var(--accent-text); }

/* Onglets */
.sf-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.sf-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: var(--tap); padding: 0 12px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.sf-tab:hover { color: var(--text); }
.sf-tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }
.sf-count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--surface-sunken); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.sf-tab.is-active .sf-count { background: var(--accent-soft); color: var(--accent-text); }

/* Sélecteur segmenté : boutons avec aria-pressed */
.sf-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--surface-sunken); border: 1px solid var(--border); }
.sf-seg button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: none;
  color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.sf-seg button::after { content: ""; position: absolute; inset: -4px 0; }   /* cible 40 px */
.sf-seg button:hover { color: var(--text); }
.sf-seg button.is-active { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(10, 12, 28, .18); }

/* Interrupteur : <button role="switch" aria-checked> */
.sf-switch {
  position: relative; flex: none; width: 40px; height: 24px; padding: 0; border: 0; border-radius: var(--r-pill);
  background: var(--track-off); cursor: pointer; transition: background .15s;
}
.sf-switch::before { content: ""; position: absolute; inset: -8px 0; }       /* cible 40 px */
.sf-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s;
}
.sf-switch[aria-checked="true"] { background: var(--accent); }
.sf-switch[aria-checked="true"]::after { transform: translateX(16px); }
.sf-switch:disabled { opacity: .5; cursor: not-allowed; }

/* Champs */
.sf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sf-label { font-size: 13px; font-weight: 600; }
.sf-hint { font-size: 12px; color: var(--text-3); }
.sf-hint.err { color: var(--danger-text); }
.sf-input,
.sf-select,
.sf-textarea {
  width: 100%; min-height: var(--tap); padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background-color: var(--field); color: var(--text); font-size: 14px;
}
.sf-input::placeholder,
.sf-textarea::placeholder { color: var(--text-3); opacity: 1; }
.sf-textarea { padding: 10px 12px; min-height: 112px; line-height: 1.5; resize: vertical; }
.sf-select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.sf-input:hover,
.sf-select:hover,
.sf-textarea:hover { border-color: var(--text-3); }
.sf-input:focus,
.sf-select:focus,
.sf-textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft-2); outline-offset: 0; }
.sf-select.quiet { background-color: transparent; border-color: var(--border); font-size: 13px; font-weight: 500; }
.sf-search { position: relative; min-width: 0; }
.sf-search .sf-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.sf-search .sf-input { padding-left: 38px; }

/* Champ avec unité */
.sf-unit {
  display: flex; align-items: center; min-height: var(--tap);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--field);
}
.sf-unit input {
  flex: 1; min-width: 0; width: 100%; height: 38px; padding: 0 2px 0 10px; border: 0; background: none; outline: none;
  text-align: right; font-variant-numeric: tabular-nums; font-weight: 500;
}
.sf-unit span { flex: none; padding: 0 11px 0 4px; color: var(--text-3); font-weight: 500; }
.sf-unit:hover { border-color: var(--text-3); }
.sf-unit:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft-2); }
.sf-unit.err { border-color: var(--danger); }

/* Case à cocher */
.sf-check { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); cursor: pointer; }
.sf-check.solo { width: var(--tap); justify-content: center; }
.sf-check input {
  -webkit-appearance: none; appearance: none; flex: none; display: grid; place-content: center;
  width: 20px; height: 20px; border: 1.5px solid var(--text-3); border-radius: 6px; background: var(--field); cursor: pointer;
}
.sf-check input::after {
  content: ""; width: 10px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg); opacity: 0;
}
.sf-check input:checked { background: var(--accent); border-color: var(--accent); }
.sf-check input:checked::after { opacity: 1; }

/* Puces (filtres, réponses rapides) */
.sf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sf-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.sf-chip::after { content: ""; position: absolute; inset: -4px 0; }          /* cible 40 px */
.sf-chip:hover { border-color: var(--text-3); }
.sf-chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

/* Bandeau */
.sf-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--accent-soft);
}
.sf-banner > .sf-ico { color: var(--accent-text); }
.sf-banner.ok { background: var(--success-soft); }
.sf-banner.ok > .sf-ico { color: var(--success-text); }
.sf-banner.warn { background: var(--warning-soft); }
.sf-banner.warn > .sf-ico { color: var(--warning-text); }
.sf-banner.err { background: var(--danger-soft); }
.sf-banner.err > .sf-ico { color: var(--danger-text); }
.sf-banner-text { flex: 1 1 220px; min-width: 0; }
.sf-banner-title { font-weight: 600; }

/* Toast */
.sf-toast {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 8px 6px 14px;
  border-radius: var(--r-md); background: var(--toast-bg); color: var(--toast-text);
  box-shadow: var(--shadow-2); font-weight: 500;
}
.sf-toast > .sf-ico { color: var(--toast-accent); }
.sf-toast-action {
  min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none;
  color: var(--toast-accent); font-weight: 600; cursor: pointer;
}
.sf-toast-action:hover { text-decoration: underline; }

/* État vide */
.sf-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 24px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); color: var(--text-2);
}
.sf-empty-title { font: 600 16px/1.3 var(--font-title); color: var(--text); }

/* Pavé d'icône */
.sf-tile { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.sf-tile.ok { background: var(--success-soft); color: var(--success-text); }
.sf-tile.warn { background: var(--warning-soft); color: var(--warning-text); }
.sf-tile.err { background: var(--danger-soft); color: var(--danger-text); }
.sf-tile.mute { background: var(--surface-sunken); color: var(--text-2); }
.sf-tile.lg { width: 48px; height: 48px; border-radius: 14px; }

/* Tableau */
.sf-table-wrap { overflow-x: auto; }
.sf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sf-table th {
  padding: 10px 10px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.sf-table td { height: 56px; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sf-table tbody tr:hover { background: var(--surface-hover); }
.sf-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sf-table th:first-child,
.sf-table td:first-child { padding-left: 20px; }
.sf-table th:last-child,
.sf-table td:last-child { padding-right: 20px; }
.sf-table tfoot td { height: 52px; border-top: 1px solid var(--border-strong); border-bottom: 0; background: var(--surface-2); font-weight: 600; }

/* Listes en lignes */
.sf-list { display: flex; flex-direction: column; }
.sf-li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 20px; border-top: 1px solid var(--border); }
.sf-li:first-child { border-top: 0; }
.sf-li-title { font-weight: 600; line-height: 1.3; }
.sf-li-sub { font-size: 12px; line-height: 1.35; color: var(--text-3); }
.sf-li.compact { min-height: 36px; padding: 4px 0; }

/* Emplacement photo (silhouette dessinée en CSS, aucune image requise) */
.sf-ph {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  width: 44px; height: 44px; border-radius: 10px; background: var(--ph-1);
}
.sf-ph::after {
  content: ""; width: 48%; aspect-ratio: 1; background: var(--ph-ink);
  clip-path: polygon(30% 4%, 42% 12%, 58% 12%, 70% 4%, 100% 26%, 87% 44%, 76% 37%, 76% 96%, 24% 96%, 24% 37%, 13% 44%, 0 26%);
}
.sf-ph.t1 { background: var(--ph-1); }
.sf-ph.t2 { background: var(--ph-2); }
.sf-ph.t3 { background: var(--ph-3); }
.sf-ph.t4 { background: var(--ph-4); }
.sf-ph.t5 { background: var(--ph-5); }
.sf-ph.t6 { background: var(--ph-6); }
.sf-ph.sm { width: 36px; height: 36px; border-radius: 8px; }
.sf-ph.lg { width: 56px; height: 56px; border-radius: 12px; }
.sf-ph.fill { width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: var(--r-md); }
.sf-ph.fill::after { width: 34%; }
.sf-ph.wide { aspect-ratio: 4 / 3; }
.sf-ph-stack { position: relative; flex: none; }
.sf-ph-stack::before {
  content: ""; position: absolute; inset: 0; border-radius: 10px; background: var(--ph-6);
  transform: translate(5px, -4px) rotate(7deg); border: 1px solid var(--border);
}
.sf-ph-count {
  position: absolute; right: -8px; bottom: -6px; z-index: 1; min-width: 22px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface-solid);
}

/* Bloc repliable (<details>) */
.sf-fold > summary {
  display: flex; align-items: center; gap: 8px; min-height: var(--tap); cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.sf-fold > summary::-webkit-details-marker { display: none; }
.sf-fold > summary .sf-ico { transition: transform .15s; }
.sf-fold[open] > summary .sf-ico { transform: rotate(90deg); }
.sf-fold > summary:hover { color: var(--text); }

/* Barre collante */
.sf-stickybar {
  position: sticky; bottom: 16px; z-index: 10; margin-top: auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px 10px 18px;
  border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-solid); box-shadow: var(--shadow-2);
}

/* 5. DONNÉES --------------------------------------------------------------- */

/* Légende : trait pour une courbe, texte toujours en couleur de texte */
.sf-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-2); }
.sf-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sf-key::before { content: ""; width: 14px; height: 0; border-top: 2px solid var(--chart-1); border-radius: 2px; }
.sf-key.k2::before { border-top-color: var(--chart-2); }
.sf-key.kprev::before { border-top: 2px dashed var(--chart-muted); }
.sf-key.kfloor::before { border-top: 2px dashed var(--warning); }
.sf-key.kme::before { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--accent); }
.sf-key.kband::before { height: 8px; border: 0; border-radius: var(--r-pill); background: var(--accent-soft-2); }
.sf-key.kmid::before { width: 2px; height: 12px; border: 0; background: var(--text-3); }
.sf-key.kmark::before { width: 10px; height: 10px; border: 2px solid var(--chart-1); border-radius: 50%; background: var(--surface-solid); }

/* Courbe : SVG étiré + axes et repères en HTML */
.sf-chart { position: relative; }
.sf-chart.grow { flex: 1; display: flex; flex-direction: column; }
.sf-chart-plot { position: relative; height: 230px; margin: 8px 0 0 44px; }
.sf-chart.grow .sf-chart-plot { flex: 1; height: auto; min-height: 220px; }
.sf-chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sf-chart-plot svg * { vector-effect: non-scaling-stroke; fill: none; }
.sf-chart-plot .grid { stroke: var(--chart-grid); stroke-width: 1; }
.sf-chart-plot .s1 { stroke: var(--chart-1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sf-chart-plot .s1-area { fill: var(--chart-1); opacity: .1; }
.sf-chart-plot .s2 { stroke: var(--chart-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sf-chart-plot .prev { stroke: var(--chart-muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.sf-chart-plot .floor { stroke: var(--warning); stroke-width: 1.5; stroke-dasharray: 5 4; }
.sf-chart-y {
  position: absolute; left: -44px; top: 0; bottom: 0; width: 36px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums;
}
.sf-chart-y span { height: 0; display: flex; align-items: center; justify-content: flex-end; white-space: nowrap; }
.sf-chart-x { display: flex; justify-content: space-between; margin: 8px 0 0 44px; font-size: 12px; color: var(--text-3); }
.sf-dot {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--chart-1); box-shadow: 0 0 0 2px var(--surface-solid);
}
.sf-dot.d2 { background: var(--chart-2); }
.sf-dot.mark { background: var(--surface-solid); box-shadow: 0 0 0 2px var(--chart-1); }
.sf-chart-tag {
  position: absolute; transform: translate(-50%, -100%); margin-top: -10px; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--surface-solid); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.sf-chart-tag.right { transform: translate(-100%, -100%); margin: -3px 0 0; padding: 0; background: none; border: 0; color: var(--warning-text); }

/* Survol : une colonne par point, réticule + infobulle (CSS seul) */
.sf-hits { position: absolute; top: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.sf-hit { position: relative; }
.sf-hit::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border-strong); opacity: 0; }
.sf-hit .sf-dot { left: 50%; opacity: 0; }
.sf-tip {
  display: none; position: absolute; z-index: 6; top: 6px; left: calc(50% + 12px); min-width: 168px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-solid); box-shadow: var(--shadow-2);
  font-size: 12px; pointer-events: none;
}
.sf-hit.flip .sf-tip { left: auto; right: calc(50% + 12px); }
.sf-tip-title { margin-bottom: 6px; font-weight: 600; color: var(--text-2); }
.sf-tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; line-height: 20px; color: var(--text-2); }
.sf-tip-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.sf-hit:hover::before,
.sf-hit.is-on::before { opacity: 1; }
.sf-hit:hover .sf-dot,
.sf-hit.is-on .sf-dot { opacity: 1; }
.sf-hit:hover .sf-tip,
.sf-hit.is-on .sf-tip { display: block; }
.sf-hits:hover .sf-hit.is-on:not(:hover)::before,
.sf-hits:hover .sf-hit.is-on:not(:hover) .sf-dot { opacity: 0; }
.sf-hits:hover .sf-hit.is-on:not(:hover) .sf-tip { display: none; }

/* Jauge : la piste est un pas plus clair de la même teinte */
.sf-meter { height: 8px; border-radius: var(--r-pill); background: var(--accent-soft-2); overflow: hidden; }
.sf-meter > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); }
.sf-meter.thin { height: 4px; }
.sf-meter.ok { background: var(--success-soft); }
.sf-meter.ok > span { background: var(--success); }
.sf-meter.warn { background: var(--warning-soft); }
.sf-meter.warn > span { background: var(--warning); }

/* Grille jour × heure : une seule teinte, du clair au foncé */
.sf-heat { display: grid; grid-template-columns: 40px repeat(16, minmax(0, 1fr)); gap: 3px; align-items: center; }
.sf-heat-lab { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.sf-heat-lab.hour { text-align: center; padding-bottom: 2px; }
.sf-heat-cell { position: relative; height: 26px; border-radius: 6px; background: var(--heat-0); }
.sf-heat-cell.h1 { background: var(--heat-1); }
.sf-heat-cell.h2 { background: var(--heat-2); }
.sf-heat-cell.h3 { background: var(--heat-3); }
.sf-heat-cell.h4 { background: var(--heat-4); }
.sf-heat-cell.best { box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 4px var(--text); z-index: 1; }
.sf-heat-cell:hover { outline: 2px solid var(--text); outline-offset: 1px; z-index: 2; }
.sf-heat-cell:hover::after {
  content: attr(data-tip); position: absolute; z-index: 6; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  padding: 5px 9px; border-radius: 8px; background: var(--toast-bg); color: var(--toast-text);
  font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none;
}
.sf-heat-scale { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }
.sf-heat-scale i { width: 18px; height: 12px; border-radius: 4px; background: var(--heat-0); }
.sf-heat-scale i.h1 { background: var(--heat-1); }
.sf-heat-scale i.h2 { background: var(--heat-2); }
.sf-heat-scale i.h3 { background: var(--heat-3); }
.sf-heat-scale i.h4 { background: var(--heat-4); }

/* Position de prix : fourchette du marché, médiane, ton prix */
.sf-range { position: relative; height: 8px; border-radius: var(--r-pill); background: var(--surface-sunken); }
.sf-range-band { position: absolute; top: 0; bottom: 0; border-radius: var(--r-pill); background: var(--accent-soft-2); }
.sf-range-mid { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text-3); }
.sf-range-me {
  position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface-solid);
}
.sf-range-me.high { background: var(--warning); }

/* Petites statistiques alignées */
.sf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sf-stats.auto { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px 20px; }
.sf-stat-l { display: block; font-size: 12px; line-height: 1.3; color: var(--text-3); }
.sf-stat-v { display: block; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 6. BLOCS D'ÉCRAN --------------------------------------------------------- */

/* Radar — tri des boosts */
.sf-verdict { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.sf-verdict.ok { background: var(--success-soft); }
.sf-verdict.warn { background: var(--warning-soft); }
.sf-boost { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-solid); }

/* Stratégies — étapes */
.sf-step { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.sf-step-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; }
.sf-step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font: 600 13px/1 var(--font-title); }
.sf-step-more { padding: 0 12px 10px 48px; border-top: 1px dashed var(--border); }
.sf-pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 8px 14px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.sf-pick:first-child { border-top: 0; }
.sf-pick:hover { background: var(--surface-hover); }
.sf-pick.is-active { background: var(--accent-soft); }
.sf-pick.is-active .sf-li-title { color: var(--accent-text); }

/* Messagerie */
.sf-msg { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr) 312px; gap: var(--gap); }
.sf-msg > .sf-card { display: flex; flex-direction: column; min-height: 0; }
.sf-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.sf-pad { padding: 14px 16px; }
.sf-bb { border-bottom: 1px solid var(--border); }
.sf-conv { display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 68px; padding: 12px 16px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.sf-conv:hover { background: var(--surface-hover); }
.sf-conv.is-active { background: var(--accent-soft); }
.sf-conv-name { font-weight: 500; }
.sf-conv.unread .sf-conv-name { font-weight: 700; }
.sf-conv.unread .sf-conv-last { color: var(--text); font-weight: 500; }
.sf-conv-last { font-size: 13px; color: var(--text-2); }
.sf-unread { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.sf-thread { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; }
.sf-bubble { align-self: flex-start; max-width: 72%; padding: 10px 14px; border-radius: 16px 16px 16px 6px; background: var(--surface-sunken); line-height: 1.45; }
.sf-bubble.out { align-self: flex-end; border-radius: 16px 16px 6px 16px; background: var(--accent); color: var(--text-on-accent); }
.sf-bubble-meta { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12px; color: var(--text-3); }
.sf-bubble-meta.out { align-self: flex-end; }
.sf-thread-day { align-self: center; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-sunken); font-size: 12px; color: var(--text-2); }
.sf-offer { align-self: flex-start; width: min(100%, 360px); }
.sf-composer { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px; border-top: 1px solid var(--border); }
.sf-composer .sf-textarea { min-height: 44px; }
.sf-quick { display: block; width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); text-align: left; cursor: pointer; }
.sf-quick:hover { border-color: var(--accent); }

/* Journal */
.sf-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.sf-week-day { display: flex; flex-direction: column; gap: 2px; min-height: 60px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); text-align: left; cursor: pointer; }
.sf-week-day:hover { border-color: var(--border-strong); }
.sf-week-day.is-active { border-color: var(--accent); background: var(--accent-soft); }
.sf-day { display: flex; align-items: baseline; gap: 10px; padding: 4px 4px 0; }
.sf-day-title { font: 600 15px/1.3 var(--font-title); }
.sf-time { flex: none; width: 104px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sf-time.soft { font-size: 12px; font-weight: 500; color: var(--text-3); }

/* Dressing */
.sf-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: var(--gap); }
.sf-item { display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 12px; }
.sf-item.is-sel, .sf-lrow.is-sel { border-color: var(--accent); background: var(--accent-soft); }
.sf-item.is-sel { box-shadow: 0 0 0 2px var(--accent-soft-2), var(--shadow-1); }
.sf-item-check { position: absolute; top: 16px; left: 16px; z-index: 1; width: 32px; min-height: 32px; justify-content: center; border-radius: 9px; background: var(--surface-solid); box-shadow: var(--shadow-1); }
.sf-item-check::after { content: ""; position: absolute; inset: -4px; }   /* cible 40 px */
.sf-pill.sf-item-pill { position: absolute; top: 20px; right: 18px; z-index: 1; background: var(--surface-solid); box-shadow: var(--shadow-1); }
.sf-lrow {
  display: grid; align-items: center; gap: 12px; min-height: 64px; padding: 6px 16px 6px 8px; border-top: 1px solid var(--border);
  grid-template-columns: 40px 44px minmax(160px, 2fr) 150px 72px 64px 64px 64px minmax(170px, 1.2fr) 40px;
}
.sf-lrow.head { min-height: 40px; border-top: 0; font-size: 12px; font-weight: 600; color: var(--text-3); }
.sf-lrow .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Publier */
.sf-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.sf-photo { position: relative; cursor: grab; }
.sf-photo-n { position: absolute; top: 6px; left: 6px; z-index: 1; min-width: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-solid); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; box-shadow: var(--shadow-1); }
.sf-photo-grip { position: absolute; right: 6px; bottom: 6px; z-index: 1; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-solid); color: var(--text-2); box-shadow: var(--shadow-1); }
.sf-photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 4 / 5; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); background: none; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.sf-photo-add:hover { border-color: var(--accent); color: var(--accent-text); }
.sf-choice { display: flex; flex-direction: column; gap: 2px; min-height: 60px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--field); text-align: left; cursor: pointer; }
.sf-choice:hover { border-color: var(--text-3); }
.sf-choice.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.sf-sticky-top { position: sticky; top: 16px; }
.sf-thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sf-thumbs .sf-ph { width: 100%; height: auto; aspect-ratio: 1; }

/* Bibliothèque de composants */
.sf-spec { display: flex; flex-direction: column; gap: 14px; }
.sf-spec-name { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }
.sf-swatch { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.sf-swatch i { height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); }
.sf-swatch i.c-surface { background: var(--surface-solid); }
.sf-swatch i.c-accent { background: var(--accent); }
.sf-swatch i.c-success { background: var(--success); }
.sf-swatch i.c-warning { background: var(--warning); }
.sf-swatch i.c-danger { background: var(--danger); }
.sf-swatch i.c-grad { background: var(--grad-brand); }
.sf-swatch i.c-text { background: var(--text); }

/* 7. RESPONSIVE ------------------------------------------------------------ */

@container sfapp (max-width: 1080px) {
  .sf-g-main, .sf-g-rail, .sf-g-editor { grid-template-columns: minmax(0, 1fr); }
  .sf-msg { grid-template-columns: 280px minmax(0, 1fr); }
  .sf-msg > .sf-card:last-child { display: none; }
  .sf-sticky-top { position: static; }
}

@container sfapp (max-width: 860px) {
  /* La barre latérale devient un bandeau repliable (classe .is-open) */
  .sf-side { flex: 1 1 100%; position: sticky; top: 0; z-index: 20; border-right: 0; border-bottom: 1px solid var(--border); background: var(--surface-solid); }
  .sf-side-in { position: static; height: auto; max-height: 100vh; padding: 8px 12px; gap: 10px; }
  .sf-side-in:not(.is-open) > :not(.sf-side-top) { display: none; }
  .sf-side-in.is-open { padding-bottom: 14px; }
  .sf-burger { display: inline-flex; }
  .sf-main { flex-basis: 100%; min-height: 0; padding: 16px 14px 28px; gap: 14px; }
  .sf-main.is-fixed { height: auto; overflow: visible; }
  .sf-title { font-size: 24px; }
  .sf-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sf-card { padding: 14px; }
  .sf-card.flush { padding: 0; }
  .sf-card.flush > .sf-card-head { padding: 14px 14px 0; }
  .sf-kpi-value { font-size: 24px; }
  .sf-spark { display: none; }
  .sf-li { padding: 8px 14px; }
  .sf-chart-plot { margin-left: 36px; }
  .sf-chart-y { left: -36px; width: 30px; }
  .sf-chart-x { margin-left: 36px; }
  .sf-msg { grid-template-columns: minmax(0, 1fr); }
  .sf-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sf-lrow { grid-template-columns: 40px 44px minmax(0, 1fr) 72px; }
  .sf-time { width: 64px; }
  .sf-heat { grid-template-columns: 30px repeat(16, minmax(0, 1fr)); gap: 2px; }
  .sf-heat-cell { height: 20px; border-radius: 4px; }
  .sf-hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  :is(.sf-app, .sf-side-in) * { animation: none !important; transition: none !important; }
}

/* 8. DIRECTION « GALERIE » — réglages des composants ----------------------
   Blanc, aplats gris clair, accent bleu ; la couleur vient des contenus.      */





.sf-app .sf-side-in { font-size: 15px; }

/* Matières : des aplats gris, ni filet ni ombre */
.sf-app .sf-card { border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.sf-app .sf-card.sub { background: var(--raised); border-radius: var(--r-md); }
.sf-app .sf-card-foot { border-top-color: var(--line); }
.sf-app .sf-li { border-top-color: var(--line); }
.sf-app .sf-side { background: var(--bg); border-right-color: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Typographie : grande, serrée, assurée */
.sf-app .sf-title { font-size: 44px; font-weight: 600; letter-spacing: -.045em; line-height: 1.05; }
.sf-app .sf-sub { font-size: 17px; margin-top: 8px; }
.sf-app .sf-kpi-value { font-size: 38px; font-weight: 600; letter-spacing: -.045em; }
.sf-app .sf-fig { font-weight: 600; letter-spacing: -.04em; }
.sf-app .sf-card-title { font-size: 19px; font-weight: 600; letter-spacing: -.025em; }
.sf-app .sf-kpi-label { font-size: 15px; }
.sf-app .sf-logo-word { letter-spacing: -.05em; }

/* Navigation en pilules */
.sf-app .sf-nav-item { border-radius: 999px; padding: 0 14px; color: var(--text-2); transition: background .15s, color .15s; }
.sf-app .sf-nav-item.is-active { background: var(--nav-active); color: var(--text); font-weight: 600; }
.sf-app .sf-nav-group { padding-left: 14px; }
.sf-app .sf-nav-badge { background: var(--accent); color: #FFFFFF; }
.sf-app .sf-acct { background: var(--surface); border: 0; border-radius: 18px; }
.sf-app .sf-avatar { border-radius: 30%; }

/* Boutons-pilules, onglets en texte */
.sf-app .sf-btn { border-radius: 999px; border: 0; background: var(--btn-bg); color: var(--text); font-weight: 600; padding: 0 18px; transition: background .15s, transform .1s; }
.sf-app .sf-btn:hover { background: var(--btn-hover); }
.sf-app .sf-btn:active { transform: scale(.97); }
.sf-app .sf-btn.primary { background: var(--accent); color: #FFFFFF; }
.sf-app .sf-btn.primary:hover { background: var(--accent-hover); }
.sf-app .sf-btn.ghost { background: transparent; }
.sf-app .sf-btn.sm { padding: 0 14px; border-radius: 999px; }
.sf-app .sf-card .sf-btn:not(.primary):not(.ghost) { background: var(--btn-on-well); }
.sf-app .sf-card .sf-btn:not(.primary):hover { background: var(--btn-on-well-hover); }
.sf-app .sf-seg { background: transparent; border: 0; padding: 0; gap: 4px; }
.sf-app .sf-seg button { border-radius: 999px; min-height: 40px; padding: 0 16px; font-size: 15px; font-weight: 500; color: var(--text-3); transition: background .2s, color .2s; }
.sf-app .sf-seg button::after { display: none; }
.sf-app .sf-seg button:hover { background: var(--nav-active); color: var(--text); }
.sf-app .sf-seg button.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: none; }
.sf-app .sf-tabs { border-bottom: 0; gap: 18px; }
.sf-app .sf-tab { padding: 0 2px; font-size: 16px; font-weight: 500; color: var(--text-3); transition: color .15s, border-color .25s; }
.sf-app .sf-tab:hover { color: var(--text); }
.sf-app .sf-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.sf-app .sf-count { background: transparent; color: inherit; padding: 0 2px; min-width: 0; }
.sf-app .sf-tab.is-active .sf-count { background: transparent; color: inherit; }

/* Pastilles, pavés « icône d'app », jauges */
.sf-app :is(.sf-pill, .sf-delta) { background: var(--raised); border-radius: 999px; }
.sf-app .sf-pill.ok { color: var(--success-text); }
.sf-app .sf-pill.warn { color: var(--warning-text); }
.sf-app .sf-pill.err { color: var(--danger-text); }
.sf-app .sf-pill.info { color: var(--accent-text); }
.sf-app .sf-tile { width: 40px; height: 40px; border-radius: 12px; background: var(--raised); color: var(--accent-text); box-shadow: 0 0 0 1px var(--tile-ring); }
.sf-app .sf-tile.warn { background: var(--warning-soft); box-shadow: none; }
.sf-app .sf-meter { background: var(--accent-soft-2); }
.sf-app .sf-switch[aria-checked="true"] { background: var(--accent); }
.sf-app .sf-chart-plot .s1-area { opacity: .05; }
.sf-app .sf-engine { border-radius: 18px; }
.sf-app { background: var(--bg); font-size: 15px; }
.sf-app :is(.sf-small, .sf-li-sub, .sf-stat-l, .sf-hint, .sf-kpi-foot, .sf-card-note) { font-size: 13px; }
.sf-app .sf-table { font-size: 14px; }
.sf-app .sf-table th { font-size: 13px; color: var(--text-2); font-weight: 500; }
.sf-app .sf-nav-group { font-size: 12.5px; color: var(--text-3); }
.sf-app .sf-chart-y, .sf-app .sf-chart-x { color: var(--text-3); }

/* 9. ANIMATIONS (direction Galerie) ------------------------------------------
   Survols, appuis, entrées en scène. Coupées si « réduire les animations ».      */

/* Cartes : légère montée au survol */
.sf-app :is(.sf-kpi, .sf-card.sub) { transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s; }
.sf-app :is(.sf-kpi, .sf-card.sub):hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.sf-app .sf-card.sub { background: var(--raised); border-color: var(--border); box-shadow: var(--shadow-1); }
.sf-app .sf-li { transition: background .15s; }
.sf-app .sf-li:hover { background: var(--surface-hover); }

/* Entrées en scène (une seule fois, à l'ouverture) */
@keyframes sf-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes sf-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes sf-grow { from { transform: scaleX(0); } }
@keyframes sf-fade { from { opacity: 0; } }
.sf-app .sf-main > *,
.sf-app .sf-g4 > *,
.sf-app .sf-g3 > .sf-card.sub { animation: sf-rise .6s cubic-bezier(.2, .7, .2, 1) backwards; }
.sf-app .sf-main > :nth-child(2) { animation-delay: .06s; }
.sf-app .sf-main > :nth-child(3) { animation-delay: .14s; }
.sf-app .sf-main > :nth-child(4) { animation-delay: .22s; }
.sf-app .sf-main > :nth-child(n+5) { animation-delay: .3s; }
.sf-app .sf-g4 > :nth-child(2), .sf-app .sf-g3 > .sf-card.sub:nth-child(2) { animation-delay: .12s; }
.sf-app .sf-g4 > :nth-child(3), .sf-app .sf-g3 > .sf-card.sub:nth-child(3) { animation-delay: .18s; }
.sf-app .sf-g4 > :nth-child(4), .sf-app .sf-g3 > .sf-card.sub:nth-child(4) { animation-delay: .24s; }
.sf-app .sf-g3 > .sf-card.sub:nth-child(n+5) { animation-delay: .3s; }
.sf-app .sf-chart-plot svg { animation: sf-draw 1.3s .35s cubic-bezier(.6, 0, .2, 1) backwards; }
.sf-app .sf-spark { animation: sf-draw 1s .5s cubic-bezier(.6, 0, .2, 1) backwards; }
.sf-app .sf-meter > span { transform-origin: left center; animation: sf-grow 1.1s .55s cubic-bezier(.2, .7, .2, 1) backwards; }
.sf-app .sf-tip { animation: sf-fade .15s ease-out; }

/* 10. ANIMATIONS SIGNATURE — app ---------------------------------------------- */

/* Fil d'activité en direct (en-tête de l'Accueil) */
.sf-live {
  display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px 0 12px; margin-top: 14px;
  border-radius: 999px; background: var(--surface); font-size: 14px; color: var(--text-2); max-width: 100%;
}
.sf-live-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.sf-live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--success); opacity: 0; animation: sf-ping 2s cubic-bezier(0, 0, .2, 1) infinite; }
.sf-live-win { position: relative; height: 20px; overflow: hidden; min-width: 0; flex: 1; }
.sf-live-rail { display: flex; flex-direction: column; animation: sf-ticker 12s cubic-bezier(.7, 0, .3, 1) infinite; }
.sf-live-rail > span { height: 20px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-live-rail b { color: var(--text); font-weight: 600; }
@keyframes sf-ping { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes sf-ticker {
  0%, 22% { transform: translateY(0); }
  25%, 47% { transform: translateY(-20px); }
  50%, 72% { transform: translateY(-40px); }
  75%, 97% { transform: translateY(-60px); }
  100% { transform: translateY(-80px); }
}

/* Chiffres clés : montée des valeurs */
@keyframes sf-roll { from { clip-path: inset(0 0 100% 0); transform: translateY(.45em); } to { clip-path: inset(0 0 -10% 0); transform: none; } }
.sf-app .sf-kpi-value { animation: sf-roll .9s cubic-bezier(.2, .8, .2, 1) backwards; }
.sf-app .sf-g4 > :nth-child(1) .sf-kpi-value { animation-delay: .25s; }
.sf-app .sf-g4 > :nth-child(2) .sf-kpi-value { animation-delay: .33s; }
.sf-app .sf-g4 > :nth-child(3) .sf-kpi-value { animation-delay: .41s; }
.sf-app .sf-g4 > :nth-child(4) .sf-kpi-value { animation-delay: .49s; }
.sf-app .sf-delta { animation: sf-fade .5s .8s backwards; }

/* Dernier point de la courbe : il « respire » */
.sf-app .sf-hit.is-on .sf-dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--chart-1); opacity: 0; animation: sf-ping 2.4s 1.6s cubic-bezier(0, 0, .2, 1) infinite; }

/* Moteur en marche : reflet qui passe */
.sf-app .sf-engine { position: relative; overflow: hidden; }
.sf-app .sf-engine:not(.paused)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
  transform: translateX(-120%); animation: sf-sheen 5s 1.5s ease-in-out infinite;
}
[data-theme="dark"] .sf-engine:not(.paused)::after { background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .08) 50%, transparent 65%); }
@keyframes sf-sheen { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }

/* Logo : petit balancement au survol */
.sf-logo-tag { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.sf-logo:hover .sf-logo-tag { transform: rotate(-6deg) scale(1.08); }

/* Radar : la grille jour × heure apparaît en vague */
@keyframes sf-pop { from { opacity: 0; transform: scale(.4); } }
.sf-app .sf-heat-cell { animation: sf-pop .45s cubic-bezier(.3, 1.4, .5, 1) backwards; animation-delay: calc(.3s + var(--i, 0) * 12ms); }

/* Lignes de liste : la flèche d'action glisse */
.sf-app .sf-li .sf-btn.sm { transition: background .15s, transform .2s cubic-bezier(.2, .7, .2, 1); }
.sf-app .sf-li:hover .sf-btn.sm { transform: translateX(-3px); }

/* Pastilles « Programmée » / statut info : léger battement */
.sf-app .sf-nav-badge { animation: sf-pop .5s .9s cubic-bezier(.3, 1.6, .5, 1) backwards; }
