/* Dashboard : direction artistique inspirée de l'administration Shopify (Polaris).
   Toutes les couleurs sont des variables ; les graphiques utilisent une palette validée
   (contraste et daltonisme) : --series-1 pour la période en cours, --series-prev pour la comparaison. */

:root {
  color-scheme: light;
  --font: Inter, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f1f1f1;
  --surface: #ffffff;
  --surface-secondary: #f7f7f7;
  --surface-hover: #f7f7f7;
  --surface-pressed: #f0f0f0;
  --surface-selected: #f1f1f1;
  --nav-bg: #ebebeb;
  --nav-hover: rgba(0, 0, 0, 0.05);
  --nav-selected: #fafafa;
  --topbar: #1a1a1a;
  --topbar-field: #303030;
  --topbar-text: #e3e3e3;

  --text: #303030;
  --text-secondary: #616161;
  --text-disabled: #b5b5b5;
  --text-link: #005bd3;
  --text-success: #0c5132;
  --text-critical: #8e0b21;

  --border: #e3e3e3;
  --border-secondary: #ebebeb;
  --border-input: #8a8a8a;
  --focus: #005bd3;

  --primary: #303030;
  --primary-hover: #1a1a1a;
  --critical: #c70a24;
  --critical-hover: #a3081e;

  --radius-card: 12px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 0 0 rgba(26, 26, 26, 0.07);
  --bevel-card: inset 1px 0 0 0 rgba(0, 0, 0, 0.13), inset -1px 0 0 0 rgba(0, 0, 0, 0.13), inset 0 -1px 0 0 rgba(0, 0, 0, 0.17), inset 0 1px 0 0 rgba(204, 204, 204, 0.5);
  --shadow-popover: 0 8px 16px -4px rgba(26, 26, 26, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-modal: 0 26px 32px -8px rgba(26, 26, 26, 0.32), 0 0 0 1px rgba(0, 0, 0, 0.06);

  --series-1: #2a78d6;
  --series-prev: #8a8a8a;
  --series-track: #cde2fb;
  --grid: #ebebeb;
  --axis: #616161;
  /* Palette d'état validée, pour les points VERIF et LOCK des comptes Stripe : toujours avec icône et libellé */
  --status-good: #0ca30c;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  /* Calendrier des versements : confirmé (bleu 600) et estimé (bleu 300), une paire validée par l'outil de validation
     des palettes (écart daltonien 28,8) ; l'estimé, peu contrasté sur le fond, va toujours avec sa légende et son montant écrit */
  --payout-confirmed: #184f95;
  --payout-estimated: #6da7ec;

  /* Couleurs des composants : en variables pour être redéfinies en mode sombre (bloc suivant) */
  --text-placeholder: #8a8a8a;
  --text-warning: #8a6116;
  --icon: #4a4a4a;
  --icon-success: #1f8a4c;
  --icon-warning: #b7791f;
  --border-strong: #b5b5b5;
  --input-bg: #fdfdfd;
  --input-bg-invalid: #fff4f4;
  --input-border-hover: #616161;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%234a4a4a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --btn-bg: #ffffff;
  --btn-hover: #fafafa;
  --btn-bevel: inset 0 -1px 0 0 #b5b5b5, inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0.5px 0 1.5px #fff;
  --btn-pressed: inset 0 2px 1px 0 rgba(26, 26, 26, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  --on-primary: #ffffff;
  --btn-primary-bevel: inset 0 -1px 0 1px rgba(0, 0, 0, 0.8), inset 0 0 0 1px #303030, inset 0 0.5px 0 1.5px rgba(255, 255, 255, 0.25);
  --btn-primary-active: #1a1a1a;
  --btn-primary-pressed: inset 0 3px 0 0 #000;
  --hover-overlay: rgba(0, 0, 0, 0.05);
  --pressed-overlay: rgba(0, 0, 0, 0.08);
  --chip-bg: rgba(0, 0, 0, 0.06);
  --badge-success-bg: #affebf;
  --badge-success-ink: #014b40;
  --badge-info-bg: #e0f0ff;
  --badge-info-ink: #00527c;
  --badge-attention-bg: #ffef9d;
  --badge-attention-ink: #4f4700;
  --badge-warning-bg: #ffd6a4;
  --badge-warning-ink: #5e4200;
  --badge-critical-bg: #fed3d1;
  --badge-critical-ink: #8e0b21;
  --banner-info-bg: #eaf4ff;
  --banner-info-icon: #00527c;
  --banner-warning-bg: #fff1d6;
  --banner-critical-bg: #fee9e8;
  --banner-success-bg: #e3fceb;
  --overlay: rgba(0, 0, 0, 0.5);
  --toast-bg: #303030;
  --toast-text: #ffffff;
  --toast-hover: rgba(255, 255, 255, 0.12);
  --skeleton: #ebebeb;
  --skeleton-shine: #f3f3f3;
  --tree-line: #c9c9c9;
  --float-bg: rgba(255, 255, 255, 0.94);
  --drop-over: #f2f7fe;
  --map-bg: #f7f9fe;
  --auth-glow-1: #e9e1ff;
  --auth-glow-2: #dbeafe;
  --baseline: #d4d4d4;
  --crosshair: #8a8a8a;

  --topbar-h: 56px;
  --sidebar-w: 240px;
}

/* Mode sombre : choisi dans le menu du compte ou sur la page Mon compte, « Automatique » suivant l'appareil. Le script
   js/theme-init.js pose data-theme sur <html> avant le premier affichage, sans clignotement. Les couleurs des graphiques
   sont les pas sombres de la même palette, validés sur la surface sombre (#1a1a19) par l'outil de validation des
   palettes : flux, toutes vérifications passées ; versements, paire ordonnée (confirmé #6da7ec, estimé #256abf, écart
   daltonien 19,1, contraste >= 3:1). Les couleurs d'état (VERIF, LOCK) ne changent jamais. La barre du haut et la carte
   « en direct » restent sombres dans les deux modes. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0e;
  --surface: #1a1a19;
  --surface-secondary: #222221;
  --surface-hover: #262625;
  --surface-pressed: #2d2d2b;
  --surface-selected: #2a2a28;
  --nav-bg: #151514;
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-selected: #262625;
  --topbar: #0a0a0a;
  --topbar-field: #1f1f1e;

  --text: #ededea;
  --text-secondary: #c3c2b7;
  --text-disabled: #6b6a65;
  --text-link: #7ab3ff;
  --text-success: #4cc27a;
  --text-critical: #ff8f87;

  --border: #333331;
  --border-secondary: #2a2a28;
  --border-input: #5c5b56;
  --focus: #6aa8ff;

  --primary: #ececea;
  --primary-hover: #ffffff;
  --critical: #d4303c;
  --critical-hover: #e2434e;

  --shadow-card: 0 1px 0 0 rgba(0, 0, 0, 0.6);
  --bevel-card: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-popover: 0 8px 16px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-modal: 0 26px 32px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);

  --series-1: #3987e5;
  --series-prev: #898781;
  --series-track: #0d366b;
  --grid: #2c2c2a;
  --axis: #898781;
  --payout-confirmed: #6da7ec;
  --payout-estimated: #256abf;
  --flux-ads: #d95926;
  --flux-expense: #9085e9;
  --flux-crypto: #c98500;
  --flux-invest: #199e70;
  --flux-bank: #3987e5;
  --flux-other: #008300;
  --flux-fees: #898781;
  --flux-waiting: #4a4a46;
  --flux-stripe: #d4d4d1;

  --text-placeholder: #898781;
  --text-warning: #f0c36d;
  --icon: #c3c2b7;
  --icon-success: #4cc27a;
  --icon-warning: #e3a84d;
  --border-strong: #5c5b56;
  --input-bg: #141413;
  --input-bg-invalid: #2e1517;
  --input-border-hover: #8a8983;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%23c3c2b7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --btn-bg: #262625;
  --btn-hover: #2d2d2b;
  --btn-bevel: inset 0 -1px 0 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  --btn-pressed: inset 0 2px 1px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  --on-primary: #1a1a19;
  --btn-primary-bevel: inset 0 -1px 0 1px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  --btn-primary-active: #d6d6d3;
  --btn-primary-pressed: inset 0 2px 0 0 rgba(0, 0, 0, 0.25);
  --hover-overlay: rgba(255, 255, 255, 0.06);
  --pressed-overlay: rgba(255, 255, 255, 0.1);
  --chip-bg: rgba(255, 255, 255, 0.08);
  --badge-success-bg: #12402a;
  --badge-success-ink: #8fe3ad;
  --badge-info-bg: #10304f;
  --badge-info-ink: #9cccff;
  --badge-attention-bg: #3d3604;
  --badge-attention-ink: #f2df72;
  --badge-warning-bg: #4a2e08;
  --badge-warning-ink: #ffc98b;
  --badge-critical-bg: #4f1518;
  --badge-critical-ink: #ffb1ab;
  --banner-info-bg: #0f263d;
  --banner-info-icon: #8cc4ff;
  --banner-warning-bg: #33260b;
  --banner-critical-bg: #3a1416;
  --banner-success-bg: #0f2e1d;
  --overlay: rgba(0, 0, 0, 0.65);
  --toast-bg: #ececea;
  --toast-text: #1a1a19;
  --toast-hover: rgba(0, 0, 0, 0.08);
  --skeleton: #252524;
  --skeleton-shine: #2e2e2c;
  --tree-line: #4a4a46;
  --float-bg: rgba(26, 26, 25, 0.92);
  --drop-over: rgba(57, 135, 229, 0.14);
  --map-bg: #121a2e;
  --auth-glow-1: rgba(139, 92, 246, 0.2);
  --auth-glow-2: rgba(57, 135, 229, 0.14);
  --baseline: #383835;
  --crosshair: #898781;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13px/20px var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--mono); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-secondary); }
.subdued { color: var(--text-secondary); font-size: 12px; line-height: 16px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Structure : barre du haut, navigation, contenu ---------- */

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 12px 0 16px;
  background: var(--topbar); color: var(--topbar-text);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: calc(var(--sidebar-w) - 28px); color: #fff; font-weight: 650; font-size: 14px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #8b5cf6, #5b21b6); color: #fff; font-size: 14px; font-weight: 700; }
.topbar-search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.topbar-search input {
  width: 100%; height: 36px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid #4a4a4a;
  background: var(--topbar-field); color: #fff;
}
.topbar-search input::placeholder { color: #a8a8a8; }
.topbar-search input:focus { outline: 2px solid #4a90e2; outline-offset: 0; border-color: transparent; }
.topbar-search .icon { position: absolute; left: 10px; top: 8px; color: #a8a8a8; }
.topbar-user {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border: 0; border-radius: 10px;
  background: transparent; color: var(--topbar-text); cursor: pointer;
}
.topbar-user:hover { background: #303030; }
.avatar {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: #2a78d6; color: #fff; font-size: 12px; font-weight: 650;
}
.topbar .menu-toggle { display: none; color: #e3e3e3; }
.topbar .menu-toggle:hover { background: #303030; }
/* Recherche globale : résultats groupés sous le champ ; sur téléphone, la loupe ouvre le champ sous la barre du haut */
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px;
  background: var(--surface); color: var(--text); border-radius: var(--radius-card); box-shadow: var(--shadow-popover);
}
.search-group + .search-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.search-group-label { padding: 6px 8px 2px; font-size: 12px; font-weight: 650; color: var(--text-secondary); }
.search-option { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; }
.search-option:hover, .search-option[aria-selected="true"] { background: var(--surface-hover); }
.search-title { font-weight: 550; overflow-wrap: anywhere; }
.search-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); overflow-wrap: anywhere; }
.search-empty { padding: 10px 8px; color: var(--text-secondary); }
.search-all .search-title { color: var(--text-link); font-weight: 450; }
.topbar .search-toggle { display: none; color: var(--topbar-text); }
.topbar .search-toggle:hover { background: var(--topbar-field); }
.kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-secondary); font: 600 12px/18px var(--mono); text-align: center; }

/* Cloche des notifications : le nombre de non lues, toujours écrit */
.topbar-bell {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px;
  background: transparent; color: var(--topbar-text); cursor: pointer;
}
.topbar-bell:hover { background: var(--topbar-field); }
.bell-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--critical); color: #fff; font-size: 11px; line-height: 18px; font-weight: 650; text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--topbar);
}

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 20;
  display: flex; flex-direction: column; padding: 12px 8px; overflow-y: auto; background: var(--nav-bg);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--radius);
  color: var(--text); font-weight: 550;
}
.nav-item:hover { background: var(--nav-hover); text-decoration: none; }
.nav-item .icon { color: var(--icon); }
.nav-item[aria-current="page"] { background: var(--nav-selected); font-weight: 650; box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.05); }
.nav-item[aria-current="page"] .icon { color: var(--text); }
.nav-section { margin: 14px 8px 4px; font-size: 12px; font-weight: 650; color: var(--text-secondary); }
.nav-bottom { margin-top: auto; padding-top: 12px; }
.nav-footer { padding: 8px; font-size: 11px; color: var(--text-secondary); }

.main { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 20px) 32px 48px; min-height: 100vh; }
.page { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-narrow { max-width: 760px; }
.page-header { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.page-header .back { margin-top: 2px; }
.page-title { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.page-title h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 20px; line-height: 28px; font-weight: 700; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page.is-loading .page-body { opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
.page-body { display: flex; flex-direction: column; gap: 16px; }
.stats.is-loading .page-body { opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
.card-header + .table-wrap { margin-top: 12px; }

.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.layout > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* ---------- Cartes ---------- */

.card {
  position: relative; background: var(--surface); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--bevel-card);
  pointer-events: none; z-index: 2;
}
.card-section { padding: 16px; }
.card-section + .card-section { border-top: 1px solid var(--border); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 0; }
.card-header + .card-section { padding-top: 12px; }
.card-title { font-size: 14px; line-height: 20px; font-weight: 650; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.details dt { color: var(--text-secondary); }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 28px; padding: 4px 12px; border: 0; border-radius: var(--radius);
  font-size: 12px; line-height: 16px; font-weight: 550; white-space: nowrap; cursor: pointer;
  background: var(--btn-bg); color: var(--text); text-decoration: none;
  box-shadow: var(--btn-bevel);
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active { background: var(--surface-pressed); box-shadow: var(--btn-pressed); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: default; opacity: 0.55; pointer-events: none; }
.btn-primary {
  background: linear-gradient(180deg, rgba(48, 48, 48, 0) 63.53%, rgba(255, 255, 255, 0.15) 100%), var(--primary); color: var(--on-primary);
  box-shadow: var(--btn-primary-bevel);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--btn-primary-active); box-shadow: var(--btn-primary-pressed); }
.btn-critical {
  background: linear-gradient(180deg, rgba(229, 28, 0, 0) 63.53%, rgba(255, 255, 255, 0.15) 100%), var(--critical); color: #fff;
  box-shadow: inset 0 -1px 0 1px rgba(142, 31, 11, 0.8), inset 0 0 0 1px rgba(181, 38, 11, 0.8), inset 0 0.5px 0 1.5px rgba(255, 255, 255, 0.35);
}
.btn-critical:hover { background: var(--critical-hover); }
.btn-plain { background: transparent; box-shadow: none; color: var(--text-link); padding: 2px 4px; min-height: 0; font-weight: 450; font-size: 13px; }
.btn-plain:hover { background: transparent; text-decoration: underline; }
.btn-plain:active { background: transparent; box-shadow: none; }
.btn-tertiary { background: transparent; box-shadow: none; }
.btn-tertiary:hover { background: var(--hover-overlay); }
.btn-tertiary:active { background: var(--pressed-overlay); box-shadow: none; }
.btn-icon { padding: 4px; min-width: 28px; }
.btn-large { min-height: 36px; padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }
.btn.is-busy { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-placeholder) var(--text-placeholder) transparent transparent; animation: spin 0.7s linear infinite;
}
.btn-primary.is-busy::after { border-color: var(--on-primary) var(--on-primary) transparent transparent; }
.btn-critical.is-busy::after { border-color: #fff #fff transparent transparent; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px;
  font-size: 12px; line-height: 16px; font-weight: 550; white-space: nowrap;
  background: var(--chip-bg); color: var(--text-secondary);
}
.badge .icon { width: 14px; height: 14px; }
.badge-success { background: var(--badge-success-bg); color: var(--badge-success-ink); }
.badge-info { background: var(--badge-info-bg); color: var(--badge-info-ink); }
.badge-attention { background: var(--badge-attention-bg); color: var(--badge-attention-ink); }
.badge-warning { background: var(--badge-warning-bg); color: var(--badge-warning-ink); }
.badge-critical { background: var(--badge-critical-bg); color: var(--badge-critical-ink); }

/* ---------- Champs ---------- */

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-weight: 450; }
.field-help { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.field-error { font-size: 12px; line-height: 16px; color: var(--text-critical); display: flex; gap: 4px; align-items: flex-start; }
.input, .select {
  width: 100%; min-height: 32px; padding: 5px 12px; border: 1px solid var(--border-input); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text); line-height: 20px;
}
.input:hover, .select:hover { border-color: var(--input-border-hover); }
.input:focus, .select:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--border-input); }
.input[aria-invalid="true"] { border-color: var(--critical); background: var(--input-bg-invalid); }
.input::placeholder { color: var(--text-placeholder); }
.input[readonly] { background: var(--surface-secondary); }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--input-bg) var(--select-arrow) no-repeat right 8px center / 18px;
}
.select-slim { min-height: 28px; padding-top: 3px; padding-bottom: 3px; font-size: 12px; width: auto; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.form { display: flex; flex-direction: column; gap: 16px; }
.choice { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.choice input { margin: 3px 0 0; accent-color: var(--primary); width: 16px; height: 16px; }
.choice-help { display: block; color: var(--text-secondary); font-size: 12px; line-height: 16px; }
/* Sites vitrines d'un site : une ligne par site vitrine, avec sa part des nouveaux clients */
.route-list { display: flex; flex-direction: column; gap: 12px; }
.route-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.route-percent { flex: none; min-width: 56px; text-align: end; }

/* ---------- Bandeaux ---------- */

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-card); background: var(--banner-info-bg); }
.banner .icon { margin-top: 0; color: var(--banner-info-icon); }
.banner-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.banner-title { font-weight: 650; }
.banner-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.banner-warning { background: var(--banner-warning-bg); }
.banner-warning .icon { color: var(--text-warning); }
.banner-critical { background: var(--banner-critical-bg); }
.banner-critical .icon { color: var(--text-critical); }
.banner-success { background: var(--banner-success-bg); }
.banner-success .icon { color: var(--text-success); }

/* ---------- Tableaux ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 6px 12px; text-align: left; white-space: nowrap; background: var(--surface-secondary);
  font-size: 12px; line-height: 16px; font-weight: 550; color: var(--text-secondary); border-bottom: 1px solid var(--border);
}
.table td { padding: 8px 12px; border-top: 1px solid var(--border-secondary); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table .align-end { text-align: right; }
.table .num { white-space: nowrap; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-hover); }
.table tbody tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cell-title { font-weight: 650; }
.cell-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); }

.toolbar { display: flex; gap: 8px; padding: 8px 12px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.toolbar .search { position: relative; flex: 1; min-width: 200px; }
.toolbar .search .icon { position: absolute; left: 8px; top: 6px; color: var(--text-placeholder); }
.toolbar .search .input { padding-left: 32px; min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
.tabs { display: flex; gap: 4px; padding: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tab {
  border: 0; background: transparent; padding: 4px 12px; border-radius: var(--radius); cursor: pointer;
  font-size: 12px; line-height: 20px; font-weight: 550; color: var(--text-secondary);
}
.tab:hover { background: var(--hover-overlay); color: var(--text); }
.tab[aria-selected="true"] { background: var(--pressed-overlay); color: var(--text); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--border); }

/* ---------- Fenêtres, menus, messages ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 620px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-modal); overflow: hidden;
}
.modal-small { max-width: 440px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-secondary); }
.modal-title { font-size: 14px; font-weight: 650; }
.modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

.popover {
  position: absolute; z-index: 60; min-width: 220px; max-width: 320px; padding: 6px;
  background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-popover);
}
.popover-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radius);
  background: transparent; text-align: left; cursor: pointer; color: var(--text); font-size: 13px;
}
.popover-item:hover, .popover-item:focus-visible { background: var(--surface-hover); text-decoration: none; }
.popover-item .check { width: 16px; height: 16px; color: var(--text); visibility: hidden; }
.popover-item[aria-checked="true"] { font-weight: 650; }
.popover-item[aria-checked="true"] .check { visibility: visible; }
.popover-item.critical { color: var(--text-critical); }
.popover-separator { height: 1px; margin: 6px -6px; background: var(--border); }
.popover-heading { padding: 6px 8px 2px; font-size: 12px; color: var(--text-secondary); }

/* Panneau de la cloche : dernières notifications, non lues marquées d'un point et d'un fond */
.popover.notif-popover { width: 400px; max-width: calc(100vw - 16px); padding: 0; overflow: hidden; }
.notif-panel { display: flex; flex-direction: column; max-height: min(72vh, 600px); }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--border); }
.notif-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.notif-loading { padding: 10px; }
.notif-foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; }
.notif-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 24px 16px; color: var(--text-secondary); }
.notif-item { align-items: flex-start; gap: 10px; padding: 8px 10px; }
.notif-item.is-unread { background: var(--surface-secondary); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.notif-title { font-weight: 650; overflow-wrap: anywhere; }
.notif-text { color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.notif-meta { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.notif-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--text-link); }
.notif-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--chip-bg); }
.notif-icon .icon { width: 18px; height: 18px; }
.notif-critical { background: var(--badge-critical-bg); color: var(--badge-critical-ink); }
.notif-warning { background: var(--badge-warning-bg); color: var(--badge-warning-ink); }
.notif-success { background: var(--badge-success-bg); color: var(--badge-success-ink); }
.notif-info { background: var(--badge-info-bg); color: var(--badge-info-ink); }
.notif-row { align-items: flex-start; }
.notif-row.is-unread { background: var(--surface-secondary); }
.route-table .align-center { text-align: center; }
.route-table input { width: 16px; height: 16px; accent-color: var(--primary); }
.narrow-grid { max-width: 360px; }
.threshold-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.threshold-input { flex-wrap: nowrap; }
.threshold-input .input { width: 96px; }
.threshold-input .subdued { min-width: 76px; }
.site-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; padding-left: 24px; }

/* Disponibilité d'un checkout : un trait par jour, couleurs d'état validées (toujours avec leur libellé : légende,
   infobulle, vue tableau) */
.uptime-bar { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 32px; }
.uptime-day { border-radius: 3px; background: var(--border); }
.uptime-day:hover, .uptime-day:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.uptime-good { background: var(--status-good); }
.uptime-serious { background: var(--status-serious); }
.uptime-critical { background: var(--status-critical); }
.uptime-none { background: var(--border); }
.uptime-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.uptime-axis { display: flex; justify-content: space-between; }
.audit-list .item-row { padding-top: 10px; padding-bottom: 10px; }
.notif-full, .summary-text { white-space: pre-line; overflow-wrap: anywhere; }
.summary-preview { padding: 12px; border-radius: var(--radius); background: var(--surface-secondary); display: flex; flex-direction: column; gap: 6px; }
a.item-link { color: inherit; }
a.item-link:hover { background: var(--surface-hover); text-decoration: none; }

/* Rapports : synthèse en tuiles, tableaux ; à l'impression, le rapport seul, en A4 et en thème clair (voir reports.js) */
.report { display: flex; flex-direction: column; gap: 16px; }
.report-head h1 { font-size: 20px; line-height: 28px; font-weight: 700; }
.report-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.report-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.amount-in { color: var(--text-success); }
.cell-wrap { display: inline-block; max-width: 420px; overflow-wrap: anywhere; }
@media print {
  @page { size: A4; margin: 14mm; }
  .topbar, .sidebar, .no-print, .toasts, .page > .banner { display: none !important; }
  .main { margin: 0; padding: 0; min-height: 0; }
  body { background: var(--surface); }
  .page { max-width: none; }
  .card { box-shadow: none; border: 1px solid var(--border); break-inside: avoid; }
  .card::after { display: none; }
  .report-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-overlay, .chart-tooltip { display: none; }
}

/* Prévisions : aujourd'hui, cette semaine, ce mois */
.forecast-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.forecast-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (max-width: 768px) { .forecast-grid { grid-template-columns: minmax(0, 1fr); } }
.audit-list + .card-section, .card-section + .audit-list { border-top: 1px solid var(--border); }

.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: var(--radius);
  background: var(--toast-bg); color: var(--toast-text); font-weight: 550; box-shadow: var(--shadow-popover); animation: toast-in 0.2s ease-out;
}
.toast-error { background: var(--critical); color: #fff; }
.toast .btn { color: inherit; min-height: 24px; }
.toast .btn:hover { background: var(--toast-hover); }

/* ---------- États vides et chargement ---------- */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 24px; }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-secondary); color: var(--icon); margin-bottom: 4px; }
.empty-icon .icon { width: 28px; height: 28px; }
.empty h2 { font-size: 16px; line-height: 24px; font-weight: 650; }
.empty p { max-width: 420px; color: var(--text-secondary); }
.empty .page-actions { margin-top: 8px; justify-content: center; }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-shine) 40%, var(--skeleton) 80%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton-text { height: 12px; }
.skeleton-title { height: 20px; width: 40%; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-disabled); border-right-color: transparent; animation: spin 0.7s linear infinite; }
.center { display: grid; place-items: center; min-height: 160px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .skeleton, .spinner, .btn.is-busy::after, .toast { animation-duration: 0s; animation-iteration-count: 1; }
}

/* ---------- Accueil : filtres, indicateurs, graphiques ---------- */

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.filter-btn .icon { width: 16px; height: 16px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px; }
.metric {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 0; border-radius: var(--radius);
  background: transparent; text-align: left; cursor: pointer; min-width: 0;
}
.metric:hover { background: var(--surface-hover); }
.metric[aria-selected="true"] { background: var(--surface-selected); }
.metric-label { font-size: 12px; line-height: 16px; font-weight: 550; color: var(--text-secondary); text-decoration: underline dotted var(--text-disabled); text-underline-offset: 3px; }
.metric-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.metric-value { font-size: 20px; line-height: 28px; font-weight: 650; color: var(--text); white-space: nowrap; }
.metric-spark { width: 72px; height: 28px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; line-height: 16px; font-weight: 550; color: var(--text-secondary); white-space: nowrap; }
.delta .icon { width: 14px; height: 14px; }
.delta-good { color: var(--text-success); }
.delta-bad { color: var(--text-critical); }

.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.legend-key { display: inline-flex; align-items: center; gap: 6px; }
.legend-key svg { width: 18px; height: 8px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font: 400 11px/1 var(--font); fill: var(--axis); font-variant-numeric: tabular-nums; }
.chart-tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 160px; padding: 8px 12px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-popover); font-size: 12px; line-height: 16px;
}
.chart-tooltip-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.chart-tooltip-row strong { font-size: 13px; font-weight: 650; color: var(--text); }
.chart-tooltip-row span { color: var(--text-secondary); }
.chart-tooltip svg { width: 14px; height: 6px; }
.chart-overlay { cursor: crosshair; }
.chart-overlay:focus { outline: none; }
.chart-overlay:focus-visible { outline: 2px solid var(--focus); }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.bar-name { min-width: 0; }
.bar-track { height: 12px; }
.bar-fill { height: 12px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.bar-row.other .bar-fill { background: var(--series-prev); }

.meter { height: 12px; border-radius: 4px; background: var(--series-track); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.meter-fill.is-full { background: var(--critical); }
/* Plafond par jour d'un compte Stripe : jauge fine, sous « encaissé / plafond » */
.limit-bar { height: 6px; margin: 4px 0 2px; }
.limit-cell .limit-bar { margin-left: auto; width: 140px; max-width: 100%; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv + .kv { border-top: 1px solid var(--border-secondary); }
.kv.total { font-weight: 650; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-placeholder); }

/* ---------- Comptes Stripe ---------- */

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.tile-label { font-size: 12px; line-height: 16px; font-weight: 550; color: var(--text-secondary); }
.tile-label[title] { text-decoration: underline dotted var(--text-disabled); text-underline-offset: 3px; cursor: help; }
.tile-value { font-size: 20px; line-height: 28px; font-weight: 650; font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; }
.tile-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.tab-count { margin-left: 6px; color: var(--text-secondary); font-weight: 450; font-variant-numeric: tabular-nums; }
.charges { margin-top: 8px; border-top: 1px solid var(--border); }
.sub-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.plain-list { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.phone-only { display: none; }

/* Graphique d'un compte Stripe depuis son ajout, et ses points VERIF (vert, orange) et LOCK (rouge) : teintes et encres
   des badges pour les étiquettes ; la couleur ne suffit jamais, chaque point a aussi son icône et son nom */
.marker-green { --marker: var(--status-good); --marker-tint: var(--badge-success-bg); --marker-ink: var(--badge-success-ink); }
.marker-orange { --marker: var(--status-serious); --marker-tint: var(--badge-warning-bg); --marker-ink: var(--badge-warning-ink); }
.marker-red { --marker: var(--status-critical); --marker-tint: var(--badge-critical-bg); --marker-ink: var(--badge-critical-ink); }
.marker-chip, .chart-tooltip-row .marker-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 4px; white-space: nowrap;
  background: var(--marker-tint); color: var(--marker-ink); font-size: 11px; line-height: 16px; font-weight: 650; letter-spacing: 0.02em;
}
.marker-chip .icon { width: 12px; height: 12px; }
.marker-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--marker); }
.chart .chart-marker .marker-rule { stroke: var(--marker); opacity: 0.75; }
.chart .chart-marker .marker-pill { fill: var(--marker-tint); }
.chart .chart-marker .icon { width: 10px; height: 10px; color: var(--marker-ink); }
.chart .chart-marker text { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; fill: var(--marker-ink); }
.chart .chart-marker .marker-dot { fill: var(--marker); stroke: var(--surface); }
.chart .chart-marker.is-active .marker-rule { opacity: 1; }
.chart .chart-marker.is-active .marker-pill { stroke: var(--marker-ink); stroke-width: 1; }
.chart .chart-empty { fill: var(--text-secondary); font-size: 12px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.marker-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.marker-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.marker-row + .marker-row { border-top: 1px solid var(--border-secondary); }
.marker-info { flex: 1; min-width: 0; }

/* ---------- Gestion : tableur des fiches, contacts, arborescences ---------- */

a.tab, a.tab:hover { display: inline-flex; align-items: center; text-decoration: none; }
.tab[aria-current="page"] { background: var(--pressed-overlay); color: var(--text); }
.th-sort {
  display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; white-space: nowrap;
}
.th-sort:hover { color: var(--text); }
.table.sheet tbody tr.is-editing td { background: var(--surface-selected); }
/* La ligne en cours et sa fiche, reliées par un trait à gauche */
.table.sheet tbody tr.is-editing td:first-child, .table.sheet .sheet-editor > td { box-shadow: inset 3px 0 0 var(--focus); }
.table.sheet .sheet-editor > td { padding: 0; border-top: 0; background: var(--surface-secondary); }
/* La fiche garde la largeur visible du tableau, même quand il défile de côté : ses boutons restent à l'écran */
.sheet-wrap { container-type: inline-size; }
.sheet-editor .sheet-form { position: sticky; left: 0; width: 100cqw; }
.sheet-form { display: flex; flex-direction: column; gap: 16px; padding: 16px 16px 16px 19px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.sheet-title { font-size: 14px; line-height: 20px; font-weight: 650; }
.sheet-columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px 24px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; align-items: start; }
.sheet-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-actions .spacer { flex: 1; }
.input-mono { font-family: var(--mono); font-size: 12px; }
/* Cellules d'une ligne : chaque texte sur une ligne, coupé au besoin (en entier au survol) */
.account-cell { min-width: 150px; max-width: 280px; }
.cell-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cell-line > .cell-title { min-width: 0; }
.table.sheet .cell-clip { display: block; max-width: 180px; }
/* Filtre d'un onglet : boutons segmentés avec le nombre de lignes */
.toolbar-filter:empty { display: none; }
.filter-switch { flex-wrap: wrap; }
.filter-switch .segmented-item { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; }
.segmented-count { color: var(--text-secondary); font-weight: 450; font-variant-numeric: tabular-nums; }
.segmented-count.is-todo { padding: 0 6px; border-radius: 6px; background: var(--badge-attention-bg); color: var(--badge-attention-ink); font-weight: 550; }
/* Choix dans un formulaire (type du titulaire) : boutons radio en segments, à la hauteur d'un champ */
.segmented-field { display: flex; min-height: 32px; }
.segmented-field .segmented-item { flex: 1; display: flex; align-items: center; justify-content: center; padding: 4px 10px; font-size: 13px; }
.segmented-field .segmented-item:has(input:checked) { background: var(--btn-bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.segmented-field .segmented-item:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.contact-lines { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.contact-line { display: flex; align-items: center; gap: 8px; }
.contact-line > .select { flex: 0 0 150px; width: 150px; }
.contact-line > .input { flex: 1; min-width: 0; }
.contact-new-type .input { width: 170px; }
.suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.suggestion {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text-link); font-size: 12px; line-height: 18px; cursor: pointer;
}
.suggestion:hover { background: var(--surface-hover); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 4px; max-width: 220px; padding: 2px 8px; border-radius: 8px;
  background: var(--chip-bg); font-size: 12px; line-height: 16px;
}
.chip-type { flex: none; color: var(--text-secondary); font-weight: 550; }
.chip-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips-line { flex-wrap: nowrap; }
.chips-line .chip { max-width: 170px; }
.chip-more { flex: none; }
/* Tableau étroit (fenêtre de portable) : textes coupés plus tôt, pour que tout tienne sans défiler de côté */
@container (max-width: 1040px) {
  .account-cell { max-width: 200px; }
  .chips-line .chip { max-width: 140px; }
  .table.sheet .cell-clip { max-width: 140px; }
}
.iban { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.iban-title { font-family: var(--mono); font-size: 18px; overflow-wrap: anywhere; }
.iban-editor { display: flex; flex-direction: column; gap: 4px; min-width: 340px; }
.iban-editor .input { font-family: var(--mono); font-size: 12px; }
.type-list { display: flex; flex-direction: column; }
.type-row { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 0; }
.type-row + .type-row { border-top: 1px solid var(--border-secondary); }
.type-label { flex: 1; min-width: 0; font-weight: 550; overflow-wrap: anywhere; }
.type-row > .input-group { flex: 1; }
/* Arborescence : un trait relie chaque élément à son parent */
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 26px; }
.tree li { position: relative; }
.tree ul ul > li::before { content: ""; position: absolute; left: -14px; top: 0; bottom: 0; border-left: 1px solid var(--tree-line); }
.tree ul ul > li:first-child::before { top: -4px; }
.tree ul ul > li:last-child::before { bottom: auto; height: 16px; }
.tree ul ul > li:first-child:last-child::before { height: 20px; }
.tree ul ul > li::after { content: ""; position: absolute; left: -14px; top: 16px; width: 12px; border-top: 1px solid var(--tree-line); }
.tree-node { display: flex; align-items: flex-start; gap: 8px; min-height: 32px; padding: 4px 0; }
.tree-icon {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px;
  background: var(--surface-secondary); color: var(--icon); box-shadow: inset 0 0 0 1px var(--border);
}
.tree-text { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; min-height: 24px; }
.tree-label { font-weight: 650; overflow-wrap: anywhere; }
.tree-value { overflow-wrap: anywhere; }
.tree-meta { color: var(--text-secondary); font-size: 12px; line-height: 16px; }
@media (max-width: 1040px) {
  .sheet-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .contact-line > .select { flex-basis: 116px; width: 116px; }
  .iban-editor { min-width: 0; }
  .account-cell { min-width: 0; max-width: 170px; }
  .table.sheet .iban { white-space: normal; }
  .iban-editor .input-group { flex-wrap: wrap; }
  .iban-editor .input-group .input { flex-basis: 100%; }
}

/* ---------- Gestion : flux financiers ---------- */

/* Couleur de chaque type de compte, validées dans l'ordre de la barre (publicité, dépense, crypto, investissement,
   compte bancaire, autre : voisines bien distinctes, daltoniens compris) ; frais et attente en gris. Toujours avec le
   nom du type, jamais la couleur seule. */
:root {
  --flux-ads: #eb6834;
  --flux-expense: #4a3aa7;
  --flux-crypto: #eda100;
  --flux-invest: #1baf7a;
  --flux-bank: #2a78d6;
  --flux-other: #008300;
  --flux-fees: #8a8a8a;
  --flux-waiting: #d4d4d4;
  --flux-stripe: #303030;
}
.kind-ads { --kind: var(--flux-ads); }
.kind-expense { --kind: var(--flux-expense); }
.kind-crypto { --kind: var(--flux-crypto); }
.kind-invest { --kind: var(--flux-invest); }
.kind-bank { --kind: var(--flux-bank); }
.kind-other { --kind: var(--flux-other); }
.kind-fees { --kind: var(--flux-fees); }
.kind-waiting { --kind: var(--flux-waiting); }
.kind-stripe { --kind: var(--flux-stripe); }

.flux { display: flex; flex-direction: column; }
.flux.is-loading .flux-section { opacity: 0.55; transition: opacity 0.15s; }
.flux-toolbar { justify-content: space-between; }
.flux-start { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.flux-notices { padding: 12px 16px 0; }
.flux-warnings { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.flux-section { padding: 16px; }
.flux-section + .flux-section { border-top: 1px solid var(--border); }
.flux-section-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.flux-title { display: inline-flex; align-items: center; font-size: 14px; line-height: 20px; font-weight: 650; }
.flux-search { position: relative; margin-left: auto; min-width: 220px; flex: 0 1 320px; }
.flux-search .icon { position: absolute; left: 8px; top: 6px; color: var(--text-placeholder); }
.flux-search .input { padding-left: 32px; min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
.flux-filter:empty { display: none; }
.flux-more { display: flex; justify-content: center; padding-top: 12px; }

/* Chiffres de la période */
.flux-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 24px; }
.flux-metric { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flux-metric-value { font-size: 20px; line-height: 28px; font-weight: 650; overflow-wrap: anywhere; }

/* Barre « où est allé l'argent » : un segment par type, séparés par 2 px de fond, bout arrondi à droite seulement */
.flux-split { display: flex; flex-direction: column; gap: 10px; }
.flux-split-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.flux-bar-host { position: relative; }
.flux-bar { display: flex; gap: 2px; height: 20px; }
.flux-segment { flex-basis: 0; min-width: 3px; background: var(--kind); }
.flux-segment:last-child { border-radius: 0 4px 4px 0; }
.flux-segment:hover, .flux-segment:focus-visible { filter: brightness(1.1); }
.flux-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 24px; }
.flux-legend-group { display: flex; flex-direction: column; min-width: 0; }
.flux-legend-row { display: flex; align-items: center; gap: 8px; min-height: 24px; font-size: 12px; line-height: 16px; }
.flux-legend-row.is-sub { min-height: 20px; padding-left: 18px; color: var(--text-secondary); }
.flux-legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flux-legend-row:not(.is-sub) .flux-legend-label { white-space: normal; }
.flux-legend-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.flux-legend-share { width: 36px; text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.flux-dot { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--kind); }

/* Topologie : colonnes de cartes, flux dessinés dessous (SVG), montants des plus gros flux par-dessus */
.flux-map { padding-left: 0; padding-right: 0; }
.flux-map .flux-section-head { padding: 0 16px; }
.flow-scroll { overflow-x: auto; }
.flow-canvas { position: relative; min-width: 100%; width: max-content; }
.flow-edges { position: absolute; left: 0; top: 0; overflow: visible; }
.flow-columns { position: relative; display: flex; align-items: center; column-gap: 64px; padding: 8px 16px 40px; pointer-events: none; }
.flow-column { display: flex; flex-direction: column; gap: 16px; flex: none; width: var(--flow-card, 216px); }
.flow-line { fill: none; stroke: var(--kind); opacity: 0.5; transition: opacity 0.15s; }
.flow-hit { fill: none; stroke: transparent; pointer-events: stroke; cursor: pointer; }
.flow-edge:hover .flow-line, .flow-edge.is-on .flow-line { opacity: 0.9; }
.flow-edge.is-dim .flow-line { opacity: 0.1; }
.flow-labels { position: absolute; inset: 0; pointer-events: none; }
.flow-label {
  position: absolute; transform: translate(-50%, -50%); padding: 0 6px; border-radius: 999px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--border); font-size: 11px; line-height: 18px; font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.flow-tooltip { white-space: nowrap; }
.flow-card {
  position: relative; display: flex; border-radius: var(--radius); background: var(--surface); pointer-events: auto;
  box-shadow: inset 3px 0 0 var(--kind), 0 0 0 1px var(--border), 0 1px 0 rgba(26, 26, 26, 0.07); transition: opacity 0.15s;
}
.flow-card.is-selected { box-shadow: inset 3px 0 0 var(--kind), 0 0 0 2px var(--focus); }
.flow-card.is-dim { opacity: 0.45; }
.flow-card-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 10px 12px 14px;
  border: 0; border-radius: var(--radius); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.flow-card-main:hover { background: var(--surface-hover); }
.flow-card-more { position: absolute; top: 4px; right: 4px; }
.flow-card-head { display: flex; align-items: center; gap: 6px; max-width: calc(100% - 26px); }
.flow-card-icon {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px;
  background: var(--surface-secondary); color: var(--icon); box-shadow: inset 0 0 0 1px var(--border);
}
.flow-card-name { font-weight: 650; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.flow-card-sub { max-width: 100%; font-size: 12px; line-height: 16px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-card-holder { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 12px; line-height: 16px; color: var(--text); }
.flow-card-holder .icon { flex: none; color: var(--text-secondary); }
.flow-card-holder.is-missing { color: var(--text-secondary); font-style: italic; }
.flow-card-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
/* Page d'un compte des flux : fiche du titulaire, comme dans Gestion */
.holder-form { display: flex; flex-direction: column; gap: 16px; }
.flux-account-since { margin-top: 8px; }
/* Comptes d'une personne ou d'une société (onglets Personnes et Sociétés) : icône du type, puis le nom */
.account-link { display: flex; align-items: center; gap: 6px; min-width: 0; }
.account-link .icon { flex: none; color: var(--text-secondary); }
.flow-card-value { margin-top: 6px; font-size: 18px; line-height: 24px; font-weight: 650; }
.flow-card-value.is-negative { color: var(--text-critical); }
.flow-card-label { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.flow-card-lines { display: flex; flex-direction: column; gap: 1px; width: 100%; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-secondary); }
.flow-card-line { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.flow-card-line > span { min-width: 0; }
.flow-card-line strong { color: var(--text); font-weight: 550; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Liste des mouvements */
.flux-route { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.flux-route > .icon { flex: none; color: var(--text-secondary); }
.flux-place { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 200px; }
@media (max-width: 1040px) {
  .flux-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .flux-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flux-search { margin-left: 0; flex-basis: 100%; }
  .flux-place { max-width: 110px; }
}

/* ---------- Comptes Stripe : grille de cartes carrées et alertes ---------- */

.text-warning { color: var(--text-warning); }
.stripe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
/* Carrée : une cale invisible (::before, aussi haute que la carte est large) et le contenu occupent la même case ; la
   carte grandit seulement si son contenu dépasse, et les cartes d'une même ligne ont la même hauteur */
.stripe-tile { display: grid; min-width: 0; padding: 16px; cursor: pointer; overflow: visible; }
.stripe-tile::before { content: ""; grid-area: 1 / 1; padding-bottom: 100%; }
.stripe-tile-body { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stripe-tile.card:hover { box-shadow: var(--shadow-card), 0 0 0 1px var(--border-input); }
.stripe-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.stripe-tile.has-alert-red { box-shadow: inset 0 3px 0 var(--status-critical), var(--shadow-card); }
.stripe-tile.has-alert-orange { box-shadow: inset 0 3px 0 var(--status-serious), var(--shadow-card); }
.stripe-tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.stripe-tile-name { min-width: 0; }
.stripe-tile-title { font-size: 15px; line-height: 20px; font-weight: 650; }
.stripe-tile-stats { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.stripe-tile-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stripe-tile-stat dt { font-size: 12px; line-height: 16px; font-weight: 550; color: var(--text-secondary); }
.stripe-tile-stat dt[title] { text-decoration: underline dotted var(--text-disabled); text-underline-offset: 3px; cursor: help; align-self: flex-start; }
.stripe-tile-stat dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.stripe-tile-limit .limit-bar { width: 100%; }
.stripe-tile-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-secondary); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stripe-tile-foot > .cell-sub { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.stripe-tile-add { border: 1px dashed var(--border-input); border-radius: var(--radius-card); background: transparent; color: var(--text-secondary); font: inherit; font-weight: 550; }
.stripe-tile-add .stripe-tile-body { align-items: center; justify-content: center; gap: 8px; }
.stripe-tile-add:hover { background: var(--surface-hover); color: var(--text); }

/* Alerte d'un compte : rouge (paiements bloqués, exclu des checkouts) ou orange (demande de Stripe), avec icône et titre */
.account-alert { display: flex; gap: 8px; padding: 8px 10px; border-radius: var(--radius); font-size: 12px; line-height: 16px; }
.account-alert > .icon { flex: none; margin-top: 1px; }
.account-alert-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.account-alert-title { font-weight: 650; font-size: 13px; line-height: 18px; }
.account-alert ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.account-alert-red { background: var(--banner-critical-bg); box-shadow: inset 3px 0 0 var(--status-critical); }
.account-alert-red > .icon { color: var(--text-critical); }
.account-alert-orange { background: var(--banner-warning-bg); box-shadow: inset 3px 0 0 var(--status-serious); }
.account-alert-orange > .icon { color: var(--text-warning); }
.page-body > .account-alert { padding: 12px 16px; font-size: 13px; line-height: 20px; }

/* ---------- Gestion, onglet Calendrier : versements de J à J+7 ---------- */

.calendar-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.calendar-figure { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-plot { position: relative; }
.calendar-days { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.calendar-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 10px 6px; border: 0;
  border-radius: var(--radius); background: var(--surface-secondary); font: inherit; color: inherit; text-align: center; cursor: pointer;
}
.calendar-day:hover { background: var(--surface-pressed); }
.calendar-day[aria-pressed="true"] { background: var(--surface); box-shadow: 0 0 0 2px var(--focus); }
.calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--border-input); }
.calendar-day.is-today[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--focus); }
.calendar-day-name { font-weight: 650; }
.calendar-day-date, .calendar-day-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.calendar-day-amount { font-weight: 650; font-size: 13px; overflow-wrap: anywhere; }
.calendar-day.is-empty .calendar-day-amount { color: var(--text-secondary); font-weight: 450; }
/* Barre d'un jour : estimé au-dessus du confirmé, 2 px de fond entre les deux, bout arrondi en haut seulement */
.calendar-bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 100%; margin: 6px 0 4px; border-bottom: 1px solid var(--border); }
.calendar-segment { display: block; width: 24px; max-width: 70%; }
.calendar-segment:first-child { border-radius: 4px 4px 0 0; }
.calendar-segment.is-confirmed { background: var(--payout-confirmed); }
.calendar-segment.is-estimated { background: var(--payout-estimated); }
.calendar-gap { display: block; height: 2px; flex: none; }
.calendar-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.calendar-swatch.is-confirmed { background: var(--payout-confirmed); }
.calendar-swatch.is-estimated { background: var(--payout-estimated); }
.calendar-tooltip { pointer-events: none; white-space: nowrap; }
.calendar-group + .calendar-group { margin-top: 16px; }
.calendar-group-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.calendar-group-total { margin-left: auto; }
.calendar .table-wrap { border: 1px solid var(--border-secondary); border-radius: var(--radius); }
/* Tableaux des jours alignés les uns sur les autres */
.calendar-group .table { table-layout: fixed; min-width: 520px; }
.calendar-group .table th:nth-child(1) { width: 32%; }
.calendar-group .table th:nth-child(2) { width: 34%; }
.calendar-group .table th:nth-child(3) { width: 16%; }
@media (max-width: 1040px) {
  .calendar-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .stripe-tile::before { display: none; }
  .calendar-group .table { table-layout: auto; min-width: 0; }
  .calendar-figures { grid-template-columns: minmax(0, 1fr); }
  .calendar-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Connexion ---------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, var(--auth-glow-1) 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, var(--auth-glow-2) 0%, transparent 55%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.auth-title h1 { font-size: 20px; line-height: 28px; font-weight: 700; }
.auth-footer { text-align: center; font-size: 12px; color: var(--text-secondary); display: flex; gap: 6px; justify-content: center; align-items: center; }

/* ---------- Partage : statistiques partagées (partage.html) et liens de partage ---------- */

.share-page { max-width: 1080px; margin: 0 auto; padding: 32px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.share-page.is-loading > .card { opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
.share-page .metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.share-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.share-header .page-title h1 { font-size: 24px; line-height: 32px; }
.share-foot { display: flex; align-items: center; gap: 6px; }
.share-error { width: 100%; max-width: 480px; margin: 12vh auto 0; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.share-row:first-child { border-top: 0; padding-top: 0; }
.share-row.is-ended .cell-title { color: var(--text-secondary); }
.share-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.key-box { display: flex; gap: 8px; align-items: stretch; }
.key-box .input { font-family: var(--mono); font-size: 12px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.code { font-family: var(--mono); font-size: 12px; background: var(--surface-secondary); border-radius: 4px; padding: 1px 4px; overflow-wrap: anywhere; }

/* ---------- Petits écrans ---------- */

@media (max-width: 1040px) {
  .layout, .grid-2, .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .topbar .menu-toggle { display: inline-flex; }
  .brand { min-width: 0; }
  .brand-name { display: none; }
  .topbar-search { display: none; }
  .topbar .search-toggle { display: inline-flex; margin-left: auto; }
  .topbar.search-open .topbar-search { display: block; position: absolute; left: 8px; right: 8px; top: calc(var(--topbar-h) + 4px); max-width: none; margin: 0; }
  .topbar-user .user-name { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; box-shadow: var(--shadow-modal); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + 16px) 12px 40px; }
  .page-title h1 { font-size: 18px; }
  .metric-spark { display: none; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 8px; }
  .hide-phone { display: none; }
  .phone-only { display: block; }
  .phone-only .badge { white-space: normal; }
}
@media (max-width: 340px) {
  .metrics, .tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Clients : en direct, visites, conversion, acheteurs ---------- */

.clients-nav .tabs { border-bottom: 0; }
.clients-credits { margin: 4px 0 0; text-align: center; }
.clients-credits a { color: inherit; }
a.tab { display: inline-flex; align-items: center; text-decoration: none; }
a.tab:hover { text-decoration: none; }
.subheading { font-size: 12px; line-height: 16px; font-weight: 650; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 8px; }

/* Point « en direct » qui pulse */
.live-dot { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #29b36a; flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #29b36a; opacity: 0; animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse { 0% { transform: scale(0.4); opacity: 0.8; } 100% { transform: scale(1.4); opacity: 0; } }
.live-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 550; color: var(--text-success); }
.live-status.offline { color: var(--text-secondary); }
.live-status.offline .live-dot { background: var(--text-disabled); }
.live-status.offline .live-dot::after { animation: none; }

.live-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Carte en direct, sur fond sombre comme la « Vue en direct » de Shopify */
.live-card { background: #0b1330; color: #e8edff; }
.live-card .card-title { color: #fff; }
.live-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 16px 16px 0; }
.live-map { position: relative; height: 440px; }
.globe, .france-map { position: relative; width: 100%; height: 100%; }
.globe-canvas, .france-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.globe-canvas { cursor: grab; }
.globe-canvas:active { cursor: grabbing; }
.map-tooltip {
  position: absolute; z-index: 2; max-width: 240px; padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: pre-line;
  background: rgba(255, 255, 255, 0.96); color: #1a1a1a; font-size: 12px; line-height: 16px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.live-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 0 16px 14px; font-size: 12px; color: #b9c4e8; }
.live-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.visitor { background: #3ce39b; box-shadow: 0 0 8px #3ce39b; }
.legend-dot.paying { background: #ffb547; box-shadow: 0 0 8px #ffb547; }
.legend-dot.paid { background: #ffd65a; box-shadow: 0 0 8px #ffd65a; }

/* Boutons groupés (Monde / Europe / France, Villes / Régions / Pays) */
.segmented { display: inline-flex; padding: 2px; border-radius: var(--radius); background: var(--chip-bg); gap: 2px; }
.segmented-item { border: 0; background: transparent; padding: 3px 10px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 550; color: var(--text-secondary); cursor: pointer; }
.segmented-item[aria-pressed="true"] { background: var(--btn-bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.live-card .segmented { background: rgba(255, 255, 255, 0.1); }
.live-card .segmented-item { color: #b9c4e8; }
.live-card .segmented-item[aria-pressed="true"] { background: rgba(255, 255, 255, 0.92); color: #0b1330; }

/* Parcours (en direct et conversion) */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel-step { display: flex; flex-direction: column; gap: 4px; }
.meter-fill.fill-visitor { background: #29b36a; }
.meter-fill.fill-paying { background: #e8a33d; }
.meter-fill.fill-paid { background: #d4a106; }

/* Activité en direct */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.activity-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.activity-item > .icon { margin-top: 2px; color: var(--text-secondary); }
.activity-paid > .icon { color: var(--icon-success); }
.activity-checkout > .icon { color: var(--icon-warning); }
.activity-abandon > .icon { color: var(--critical); }
.activity-body { min-width: 0; }
.activity-title { font-weight: 550; }

/* Lieux : carte de France et liste */
.geo-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.geo-grid .france-map { height: 380px; border-radius: var(--radius); background: var(--map-bg); }

/* Heures d'affluence : 7 jours × 24 heures */
.heatmap { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.heatmap-row { display: grid; grid-template-columns: 36px repeat(24, minmax(14px, 1fr)); gap: 3px; align-items: center; }
.heatmap-row > span:first-child { font-size: 12px; color: var(--text-secondary); }
.heatmap-head span { font-size: 11px; color: var(--text-secondary); text-align: left; }
.heatmap-cell { height: 18px; border-radius: 3px; background: var(--surface-secondary); }

/* Alertes et son */
.alert-list { gap: 14px; }
.alert-row { display: flex; flex-direction: column; gap: 6px; }
.alert-threshold-row { display: flex; align-items: center; gap: 8px; margin-left: 24px; }
.alert-threshold { width: 100px; min-height: 28px; padding-top: 3px; padding-bottom: 3px; }

/* Clone : progression de Claude Code, plan, rapport, aperçu */
textarea.input { min-height: 88px; resize: vertical; }
.clone-cell { max-width: 420px; }
.clone-now { display: flex; align-items: center; gap: 10px; }
.clone-action { overflow-wrap: anywhere; }
.clone-pages { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.clone-rich { overflow-wrap: anywhere; }
.clone-rich p { margin: 0 0 6px; }
.clone-rich ul { margin: 0 0 8px; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.clone-rich > :last-child { margin-bottom: 0; }
.clone-activity { max-height: 640px; }
.activity-success > .icon { color: var(--icon-success); }
.activity-warning > .icon { color: var(--icon-warning); }
.activity-error > .icon { color: var(--critical); }
.clone-plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clone-plan li { display: flex; align-items: flex-start; gap: 8px; }
.clone-plan li > .icon { flex: none; margin-top: 2px; color: var(--text-secondary); }
.clone-plan .is-completed { color: var(--text-secondary); }
.clone-plan .is-completed > .icon { color: var(--icon-success); }
.clone-plan .is-in_progress { font-weight: 550; }
.clone-plan .is-in_progress > .icon { color: var(--series-1); }
.clone-report { max-height: 520px; overflow-y: auto; }
.clone-older { margin-top: 12px; }
.clone-log {
  margin: 0; padding: 8px; max-height: 240px; overflow-y: auto; font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-secondary); border-radius: var(--radius-sm);
}
.clone-copy { display: flex; align-items: center; gap: 4px; min-width: 0; }
.page-tabs .tabs { border-bottom: 0; }
.clone-modes { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text-secondary); font-size: 12px; line-height: 16px; }
.clone-modes strong { color: var(--text); font-weight: 600; }

/* Clone, onglet Contenu : modèles, entrées et formulaire d'une entrée */
.content-intro { padding-bottom: 12px; }
.content-intro + .toolbar { border-top: 1px solid var(--border); }
.content-intro + .table-wrap { border-top: 1px solid var(--border); }
.content-thumb-cell { width: 56px; }
.content-thumb {
  display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; vertical-align: middle;
  border-radius: var(--radius-sm); background: var(--surface-secondary); border: 1px solid var(--border-secondary); color: var(--text-disabled);
}
.content-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.entry-actions { margin-top: 16px; }
.entry-actions .spacer { flex: 1; }
.entry-path { font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--text-secondary); overflow-wrap: anywhere; }
.btn-danger-text { color: var(--text-critical); }
.input-affix { position: relative; }
.input-affix .input { padding-right: 40px; }
.input-affix .affix { position: absolute; right: 12px; top: 6px; color: var(--text-secondary); pointer-events: none; }
/* Éléments d'une liste, avec un bouton pour retirer chacun (les pastilles de contact de Gestion gardent leur style) */
.chips:has(> .chip-removable) { gap: 6px; }
.chip.chip-removable {
  align-items: center; gap: 2px; max-width: none; padding: 1px 2px 1px 10px; border-radius: 999px;
  background: var(--surface-selected); border: 1px solid var(--border); line-height: 20px;
}
.chip-removable .btn { min-height: 22px; min-width: 22px; padding: 2px; }
.check-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.image-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface-secondary); border: 1px solid var(--border); }
.image-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-tile.is-pending { display: flex; align-items: center; justify-content: center; }
.image-tile .badge { position: absolute; left: 6px; bottom: 6px; }
.image-tile .badge, .product-photo .badge { background: var(--float-bg); color: var(--text); }
.image-tile-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.image-tile-actions .btn { min-height: 28px; min-width: 28px; padding: 3px; background: var(--float-bg); }
.image-external { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; color: var(--text-secondary); font-size: 12px; }
.image-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; text-align: center;
  border: 1px dashed var(--border-input); border-radius: var(--radius);
}
.image-drop.is-over { background: var(--drop-over); border-color: var(--focus); }

/* Clone, onglet Catalogue : produits du site d'origine */
.catalogue-progress { display: flex; align-items: center; gap: 10px; }
.catalogue-all { align-items: center; white-space: nowrap; }
.catalogue-all input { margin: 0; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 16px; }
.product-tile {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.product-tile:hover { border-color: var(--border-strong); }
.product-tile.is-selected { outline: 2px solid var(--focus); outline-offset: -1px; }
.product-check { position: absolute; top: 8px; left: 8px; z-index: 1; display: flex; padding: 4px; border-radius: var(--radius-sm); background: var(--float-bg); }
.product-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.product-photo { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--surface-secondary); color: var(--text-disabled); }
.product-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-photo .badge { position: absolute; right: 8px; bottom: 8px; }
.product-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; min-width: 0; overflow-wrap: anywhere; }
.product-price { display: flex; align-items: baseline; gap: 6px; font-weight: 550; font-variant-numeric: tabular-nums; }
.product-desc {
  font-size: 12px; line-height: 16px; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 768px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
}

@media (max-width: 1280px) {
  .live-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1040px) {
  .geo-grid { grid-template-columns: minmax(0, 1fr); }
  .live-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .live-map { height: 340px; }
  .geo-grid .france-map { height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot::after { animation: none; }
}

/* Clone, promo : idées de nom et de réduction, exemples de prix */
.field > .suggestions { margin-top: 2px; }
.promo-examples {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-secondary);
}
.promo-examples-title { margin: 0; font-weight: 550; }
/* Promo programmée : une réduction par jour dans la fenêtre, et le programme sur la carte (administrateur seulement) */
.promo-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.promo-day { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.promo-day-name { font-size: 12px; line-height: 16px; color: var(--text-secondary); white-space: nowrap; }
.promo-schedule { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.promo-schedule li { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.promo-schedule li > span:first-child { min-width: 150px; }
.promo-schedule .is-past { color: var(--text-disabled); }
.promo-example { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; }
.promo-example s { margin-right: 4px; }

/* Clone, mise en ligne : étapes, dossier à envoyer, vérifications */
.launch-plan { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.launch-plan .clone-copy { margin-top: 4px; }
/* Choix « Mettre le site en ligne » / « Mettre le site vitrine en ligne » */
.launch-choice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.launch-choice > .stack-sm { flex: 1 1 320px; min-width: 0; }
.launch-choice p { margin: 0; }
.launch-steps, .launch-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.launch-steps li, .launch-checks li { display: flex; align-items: flex-start; gap: 8px; }
.launch-steps li > .icon, .launch-checks li > .icon { flex: none; margin-top: 2px; color: var(--text-secondary); }
.launch-steps .is-done > .icon, .launch-checks .is-ok > .icon { color: var(--icon-success); }
.launch-steps .is-running > .icon { color: var(--series-1); }
.launch-steps .is-failed > .icon, .launch-checks .is-ko > .icon { color: var(--critical); }
.launch-steps .is-waiting > .icon { color: var(--icon-warning); }
.launch-steps .activity-body, .launch-checks .activity-body { flex: 1; min-width: 0; }
.launch-error { margin: 2px 0 0; font-size: 12px; line-height: 16px; color: var(--text-critical); overflow-wrap: anywhere; }

/* ---------- A2F et numéros : lignes des clés et des numéros, carte « Connexion » des pages de comptes ---------- */

/* Une ligne par clé ou par numéro : icône, nom et détails, puis à droite le code (ou l'état du numéro) et le menu ⋯, qui
   restent ensemble sur un écran étroit */
.item-list { display: flex; flex-direction: column; }
.item-row { display: flex; align-items: center; gap: 8px 12px; padding: 12px 16px; flex-wrap: wrap; }
.item-row + .item-row { border-top: 1px solid var(--border-secondary); }
.item-icon {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius);
  background: var(--surface-secondary); color: var(--icon); box-shadow: inset 0 0 0 1px var(--border);
}
.item-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-name { font-weight: 650; overflow-wrap: anywhere; }
.item-meta { font-size: 12px; line-height: 16px; color: var(--text-secondary); overflow-wrap: anywhere; }
.item-side { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.link-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.link-chip { align-items: center; color: var(--text-link); }
.link-chip .icon { flex: none; color: var(--icon); }

/* Code A2F : un clic le copie. Les 5 dernières secondes, le code et le décompte passent en rouge ; le temps restant reste
   écrit. */
.otp-block { display: flex; align-items: center; justify-content: flex-end; gap: 4px 8px; flex-wrap: wrap; }
.otp-code {
  border: 0; margin: 0; padding: 0 6px; border-radius: var(--radius-sm); background: transparent; color: var(--text); cursor: pointer;
  font: 650 24px/32px var(--mono); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.otp-code:hover { background: var(--hover-overlay); }
.otp-code:active { background: var(--pressed-overlay); }
.otp-code:disabled { background: transparent; color: var(--text-disabled); cursor: default; }
.otp-timer {
  display: inline-flex; align-items: center; gap: 6px; min-width: 52px; white-space: nowrap;
  font-size: 12px; line-height: 16px; color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.otp-ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.otp-ring circle { fill: none; stroke-width: 3; }
.otp-ring-track { stroke: var(--series-track); }
.otp-ring-value { stroke: var(--series-1); }
.otp-block.is-ending .otp-code, .otp-block.is-ending .otp-timer { color: var(--text-critical); }
.otp-block.is-ending .otp-ring-value { stroke: var(--critical); }
.otp-backup { display: inline-flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.otp-backup .icon { color: var(--icon); }
.otp-backup .btn-plain { font-size: 12px; line-height: 16px; }

/* Codes de secours (et actions notées d'un numéro) : une ligne par code, barré une fois utilisé */
.backup-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); max-height: 360px; overflow-y: auto; }
.backup-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; }
.backup-row + .backup-row { border-top: 1px solid var(--border-secondary); }
.backup-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.backup-check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.backup-code { font: 550 14px/20px var(--mono); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.backup-row.is-used .backup-code { text-decoration: line-through; color: var(--text-disabled); }
/* Mots de passe (onglet de la page A2F / MDP) : masqué, puis affiché sur demande */
.password-value { font: 550 14px/20px var(--mono); color: var(--text-secondary); max-width: 260px; overflow-wrap: anywhere; user-select: none; }
.password-value.is-shown { color: var(--text); user-select: all; }
.history-text { flex: 1; min-width: 0; }

/* Numéros : nom et numéro copiable, état toujours écrit, jauge des jours restants avant l'expiration */
.sim-title { display: flex; align-items: center; gap: 2px 8px; flex-wrap: wrap; min-width: 0; }
.sim-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sim-title .btn { min-height: 24px; min-width: 24px; padding: 2px; }
.sim-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sim-meter { width: 120px; height: 6px; }
.sim-meter.is-soon .meter-fill { background: var(--icon-warning); }
.sim-meter.is-critical .meter-fill { background: var(--critical); }
.phone-group + .phone-group { border-top: 1px solid var(--border); }
.phone-head { display: flex; align-items: center; gap: 8px 12px; padding: 12px 16px; flex-wrap: wrap; background: var(--surface-secondary); }
.phone-group .item-list { padding-left: 24px; }
.phone-empty { padding: 12px 16px 12px 40px; }
/* Fenêtre des alertes : un encadré par canal */
.channel-box { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.channel-title { padding: 0 4px; font-weight: 650; }

/* Carte « Connexion » d'un compte : une section par sorte (codes A2F, numéros), chacune avec son titre */
.access-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 0; }
.access-section:not([hidden]) ~ .access-section:not([hidden]) { border-top: 1px solid var(--border); }

/* Fenêtre d'une clé : comptes à cocher par sorte, réglages avancés repliés */
.check-heading { margin: 6px 0 0; font-size: 12px; line-height: 16px; font-weight: 550; color: var(--text-secondary); }
.check-heading:first-child { margin-top: 0; }
.a2f-advanced { border: 1px solid var(--border); border-radius: var(--radius); }
.a2f-advanced > summary { padding: 8px 12px; cursor: pointer; font-weight: 550; }
.a2f-advanced[open] > summary { border-bottom: 1px solid var(--border); }
.a2f-advanced > .stack { padding: 12px; }
@media (max-width: 768px) {
  .item-side { margin-left: 44px; }
  .otp-block { justify-content: flex-start; }
  .sim-status { align-items: flex-start; }
  .phone-group .item-list { padding-left: 0; }
}

/* ---------- Onglet Claude (pages/claude.js) ---------- */
.claude-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.claude-sidebar { position: sticky; top: 72px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; overflow: hidden; }
.claude-sidebar-head { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border-secondary); }
.claude-sidebar-head p { margin: 0; overflow-wrap: anywhere; }
.claude-small { font-size: 12px; }
.claude-usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; padding: 12px 16px; margin-bottom: 16px; }
.claude-usage-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.claude-usage-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.claude-usage .meter { height: 8px; }
.claude-usage .meter-fill.is-high { background: var(--status-serious); }
.claude-usage-note { margin: 0 0 12px; }
.claude-list { display: flex; flex-direction: column; overflow-y: auto; padding: 6px; gap: 2px; }
.claude-list-item { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.claude-list-item:hover { background: var(--surface-hover); }
.claude-list-item.is-current { background: var(--surface-selected); box-shadow: inset 3px 0 0 var(--focus); }
.claude-list-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claude-list-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.claude-main { display: flex; flex-direction: column; min-height: 560px; height: calc(100vh - 150px); }
.claude-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.claude-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 0; }
.claude-head-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.claude-head-title .card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claude-head-meta { margin: 4px 16px 0; padding-bottom: 12px; border-bottom: 1px solid var(--border-secondary); overflow-wrap: anywhere; }
.claude-resume { font-family: var(--mono); }
.claude-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.claude-message { display: flex; flex-direction: column; gap: 4px; max-width: min(860px, 92%); }
.claude-user { align-self: flex-end; align-items: flex-end; }
.claude-assistant { align-self: flex-start; }
.claude-meta { font-size: 12px; color: var(--text-secondary); }
.claude-bubble { padding: 10px 12px; border-radius: var(--radius-card); background: var(--surface-secondary); border: 1px solid var(--border-secondary); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.claude-user .claude-bubble { background: var(--surface-selected); border-color: var(--border); }
.claude-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.claude-code { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre; }
.claude-tools { align-self: flex-start; max-width: min(860px, 92%); font-size: 13px; color: var(--text-secondary); }
.claude-tools summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; padding: 2px 0; }
.claude-tools summary::-webkit-details-marker { display: none; }
.claude-tools summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claude-tools ul { margin: 4px 0 0; padding-left: 26px; display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.claude-tools li.is-denied { color: var(--text-critical); }
.claude-note { align-self: center; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); max-width: 92%; }
.claude-note.is-error { color: var(--text-critical); }
.claude-working { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.claude-working .spinner { width: 14px; height: 14px; flex: none; }
.claude-composer { border-top: 1px solid var(--border-secondary); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.claude-input { min-height: 72px; max-height: 280px; }
.claude-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .claude-layout { grid-template-columns: minmax(0, 1fr); }
  .claude-sidebar { position: static; max-height: 280px; }
  .claude-main { height: auto; min-height: 70vh; }
  .claude-messages { max-height: 65vh; }
}

/* ---------- Serveurs (pages/servers.js) et hébergement de la mise en ligne ---------- */
.server-copy { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.server-pre { flex: 1; min-width: 0; margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-secondary); border: 1px solid var(--border-secondary); font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; }
.server-sites { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.server-sites li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.server-fingerprints { margin: 6px 0 0; padding-left: 18px; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.launch-hosting { align-items: flex-end; }
.launch-hosting > .field { flex: 1 1 260px; min-width: 0; }
