/*
 * Iwego CRM — feuille unique.
 * 1. Tokens (copie de Docs/iwego-crm-design/tokens/tokens.css, source de vérité)
 * 2. Base   3. Layout (menu, page)   4. Composants   5. Utilitaires
 *
 * Règle : aucune couleur en dur dans les vues ni dans le JS — uniquement les
 * variables ci-dessous et les classes « tone-* » pour les états.
 * Le catalogue des composants est décrit dans backend/COMPONENTS.md.
 */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --font-sans: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
  --brand-logo: #039E8A;

  --canvas: #F7F7F8;
  --surface: #FFFFFF;
  --sunken: #F1F1F3;
  --border: #E6E6E9;
  --line: #EFEFF1;
  --text: #0A0A0B;
  --muted: #55555E;
  --faint: #6E6E78;
  --nav: #3F3F46;
  --primary: #047C6E;
  --on-primary: #FFFFFF;
  --selected-row: #EEF7F5;
  --chip: #F1F1F3;

  --red: #B42318;   --red-bg: #FEECEB;
  --amber: #A15C07; --amber-bg: #FEF4E2;
  --green: #067647; --green-bg: #E7F6EE;
  --blue: #1D4ED8;  --blue-bg: #EAF0FE;
  --on-red: #FFFFFF;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --control-h: 40px;
  --sidebar-w: 256px;
  --page-pad-x: 40px;
  --icon-stroke: 1.8;
  --shadow-pop: 0 12px 40px rgba(10, 10, 11, .14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0A0A0B;
  --surface: #131316;
  --sunken: #1B1B1F;
  --border: #26262B;
  --line: #1F1F23;
  --text: #F4F4F5;
  --muted: #A1A1AA;
  --faint: #8A8A93;
  --nav: #C4C4CC;
  --primary: #F4F4F5;
  --on-primary: #0A0A0B;
  --selected-row: #1B1F1E;
  --chip: #1F1F23;
  --red: #F97066;   --red-bg: rgba(249,112,102,.14);
  --amber: #FDB022; --amber-bg: rgba(253,176,34,.13);
  --green: #47CD89; --green-bg: rgba(71,205,137,.13);
  --blue: #84ADFF;  --blue-bg: rgba(132,173,255,.14);
  --on-red: #0A0A0B;
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .5);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 3. Layout ---------------------------------------------------------------- */
body.layout-app { display: flex; min-height: 100vh; }
.page {
  flex: 1 1 auto;
  min-width: 0;
  padding: 28px var(--page-pad-x) 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
body.layout-bare .page { max-width: 1120px; margin: 0 auto; }
/* Pages à en-tête pleine largeur (fiche client, fiche projet) : la vue gère ses marges. */
.page.page-flush { padding: 0; gap: 0; }
.page-body { padding: 28px var(--page-pad-x) 56px; display: flex; flex-direction: column; gap: 20px; }

/* Menu latéral */
.sidebar {
  position: sticky; top: 0;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 18px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
}
.brand-mark i { width: 4px; height: 4px; border-radius: 4px; background: var(--on-primary); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-tag { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.sidebar .sidebar-toggle { display: none; }
.sidebar-search {
  display: flex; align-items: center; gap: 8px; width: 100%;
  height: var(--control-h); padding: 0 10px;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--muted); cursor: pointer; text-align: left;
}
.sidebar-search span { flex: 1; }
kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; color: var(--muted); }
.sidebar-groups { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 8px; text-decoration: none; color: var(--nav); font-weight: 500;
}
.nav-item:hover { background: var(--sunken); }
.nav-item.is-active { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.nav-label { flex: 1; }
.nav-badge { font-size: 11px; font-weight: 600; border-radius: 20px; padding: 1px 7px; }
.nav-item.is-active .nav-badge { background: var(--on-primary); }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.theme-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 3px;
}
.theme-switch button {
  height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; font-weight: 500; }

/* En-tête de page */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.page-heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-eyebrow { font-size: 13px; color: var(--muted); }
.page-title { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.page-title .count { color: var(--muted); font-weight: 400; }
.page-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb { font-size: 13px; color: var(--muted); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* En-tête d'entité (fiche client, fiche projet) : bandeau blanc + onglets */
.entity-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 22px var(--page-pad-x) 0; display: flex; flex-direction: column; gap: 18px;
}
.entity-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.entity-title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }

/* Grilles de mise en page */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-main { flex: 3 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split-side-wide { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.grid-auto-sm { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section-title-row { display: flex; align-items: baseline; gap: 10px; }
.section-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.section-sub { font-size: 13px; color: var(--muted); }
.section-link { margin-left: auto; font-size: 13px; color: var(--muted); text-decoration: none; }
.section-link:hover { color: var(--text); }

/* 4. Composants ------------------------------------------------------------ */

/* Boutons — 40 px, rayon 10 */
.btn {
  height: var(--control-h); padding: 0 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: var(--sunken); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { border-color: transparent; background: var(--primary); color: var(--on-primary); font-weight: 600; padding: 0 16px; }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-danger { border-color: transparent; background: var(--red); color: var(--on-red); font-weight: 600; }
.btn-danger:hover { background: var(--red); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon {
  width: var(--control-h); height: var(--control-h); padding: 0; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--text); background: var(--sunken); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--muted); border-right-color: transparent; animation: spin .7s linear infinite;
}
.link-muted { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; cursor: pointer; text-align: left; }
.link-muted:hover { color: var(--text); text-decoration: underline; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.card-pad { padding: 20px 22px; }
.card-clip { overflow: hidden; }
.card-header { padding: 18px 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--muted); }
.card-eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
a.card { text-decoration: none; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius-lg); }
a.card:hover { border-color: var(--muted); }

/* Liste de lignes dans une carte (priorités, projets, domaines…) */
.list-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 14px 22px; border-top: 1px solid var(--line); text-decoration: none;
}
.card > .list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--sunken); }
.list-row-main { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row-title { font-weight: 600; }
.list-row-sub { font-size: 13px; color: var(--muted); }
.list-compact .list-row { padding: 10px 0; }
.list-compact .list-row:first-child { border-top: 1px solid var(--line); }

/* Bande de KPI : grands chiffres sans décoration */
.kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.kpi { padding: 18px 16px 18px 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
a.kpi:hover .kpi-label { color: var(--text); }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.kpi-label { font-size: 13px; color: var(--muted); }
/* Variante tuiles (panneaux d'aperçu, fiche projet) */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--sunken); border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; }
.stat-value { font-size: 18px; font-weight: 600; }
.stat-label { font-size: 12px; color: var(--muted); }

/* Étiquettes d'état (tags), pastilles (chips) et points */
.tag {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 600; border-radius: var(--radius-sm); padding: 3px 8px; white-space: nowrap;
  background: var(--chip); color: var(--text);
}
.tag-sm { font-size: 11px; padding: 2px 7px; border-radius: 5px; }
.tag-wide { min-width: 64px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; background: var(--chip); border-radius: var(--radius-sm); padding: 2px 8px; white-space: nowrap; }
.chip.mono { font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.dot-sm { width: 7px; height: 7px; }
.tone-red { color: var(--red); background-color: var(--red-bg); }
.tone-amber { color: var(--amber); background-color: var(--amber-bg); }
.tone-green { color: var(--green); background-color: var(--green-bg); }
.tone-blue { color: var(--blue); background-color: var(--blue-bg); }
.tone-neutral { color: var(--text); background-color: var(--chip); }
.text-red { color: var(--red); } .text-amber { color: var(--amber); }
.text-green { color: var(--green); } .text-blue { color: var(--blue); }
.dot.tone-red { background: var(--red); } .dot.tone-amber { background: var(--amber); }
.dot.tone-green { background: var(--green); } .dot.tone-blue { background: var(--blue); }
.dot.tone-neutral { background: var(--faint); }
.status.tone-red, .status.tone-amber, .status.tone-green, .status.tone-blue, .status.tone-neutral { background: none; }

/* Avatar à initiales */
.avatar {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; background: var(--chip);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600;
}
.avatar-round { border-radius: 50%; }
.avatar-inv { background: var(--primary); color: var(--on-primary); }
.avatar-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.avatar-xl { width: 56px; height: 56px; border-radius: var(--radius-lg); font-size: 18px; font-weight: 700; }
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; }
.identity-text { display: flex; flex-direction: column; min-width: 0; }
.identity-name { font-weight: 600; }
.identity-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
button.identity { border: 0; background: transparent; padding: 0; cursor: pointer; }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; }
.field-label .required { color: var(--red); }
.field-help { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--red); }
.input, .select, .textarea {
  width: 100%; height: var(--control-h); padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text); outline: none;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--selected-row); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--red); }
.input:disabled, .input[readonly], .select:disabled { background: var(--sunken); color: var(--muted); }
.input.mono { font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.form-grid .span-all { grid-column: 1 / -1; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
/* État d'enregistrement automatique (autosave) à côté du libellé */
.save-state { font-size: 11px; color: var(--muted); }
.save-state.is-saving::before { content: "Enregistrement…"; }
.save-state.is-saved::before { content: "Enregistré"; color: var(--green); }
.save-state.is-error::before { content: "Non enregistré"; color: var(--red); }

/* Recherche */
.search {
  display: flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.search:focus-within { border-color: var(--primary); }
.search-lg { height: 60px; padding: 0 18px; gap: 12px; border-radius: var(--radius-lg); }
.search-lg input { font-size: 17px; }

/* Barre d'outils de liste */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .search { flex: 1 1 280px; }

/* Segments (filtres en pastilles) et pastilles de raccourci */
.segments { display: flex; flex-wrap: wrap; gap: 6px; }
.segment, .pill {
  height: 34px; padding: 0 12px; border-radius: 34px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.pill { height: 32px; font-weight: 400; }
.segment:hover, .pill:hover { background: var(--sunken); }
.segment[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.segment .count { opacity: .7; }

/* Onglets (fiche client, abonnements) */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); }
.entity-header .tabs { border-bottom: 0; }
.tab {
  height: 44px; padding: 0 12px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tab .count { color: var(--muted); font-weight: 400; }

/* Tableaux de données (dans une carte .card-clip) */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted); background: var(--sunken);
  padding: 10px 12px; white-space: nowrap;
}
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table th.is-num, .table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th[aria-sort="ascending"]::after { content: " ↑"; }
.table th[aria-sort="descending"]::after { content: " ↓"; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover { background: var(--sunken); }
.table tbody tr.is-selected { background: var(--selected-row); }
.table-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.pagination { margin-left: auto; display: flex; gap: 6px; }

/* Panneau d'aperçu / de détail à droite d'une liste */
.panel { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }
.panel-head { display: flex; align-items: center; gap: 12px; }
.panel-empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv-label { font-size: 12px; color: var(--muted); }
.kv-list { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 14px; font-size: 13px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Jauges : simple (progress) et forfait (inclus + dépassement) */
.progress { height: 8px; border-radius: 8px; background: var(--sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.progress-sm { height: 6px; }
.progress.tone-red > span { background: var(--red); }
.progress.tone-amber > span { background: var(--amber); }
.progress.tone-red, .progress.tone-amber { background-color: var(--sunken); }
.gauge { display: flex; flex-direction: column; gap: 8px; }
.gauge-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gauge-value strong { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.gauge-bar { display: flex; height: 12px; border-radius: 12px; overflow: hidden; background: var(--sunken); gap: 2px; }
.gauge-bar .used { background: var(--primary); }
.gauge-bar .over { background: var(--red); }
.gauge-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter .progress { flex: 1; }
.meter-label { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }

/* Grille de points « 1 point = 1 élément » (santé du parc) */
.dot-grid { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 5px; }
.dot-grid > span { aspect-ratio: 1; border-radius: 4px; background: var(--green); }
.dot-grid > span.tone-red { background: var(--red); }
.dot-grid > span.tone-amber { background: var(--amber); }
.dot-grid > span.tone-blue { background: var(--blue); }
.dot-grid > span.tone-neutral { background: var(--border); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.tone-red { background: var(--red); } .legend i.tone-amber { background: var(--amber); }
.legend i.tone-green { background: var(--green); } .legend i.tone-blue { background: var(--blue); }
.legend i.tone-neutral { background: var(--border); }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .progress { flex: 1; }

/* Kanban (projets, métiers) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--sunken); border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.kanban-col-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 2px 4px; }
.kanban-col-head .count { color: var(--muted); font-weight: 400; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.kanban-card:hover { border-color: var(--muted); }

/* Frise d'étapes (fiche projet) */
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.step { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.step::before { content: ""; height: 6px; border-radius: 6px; background: var(--sunken); }
.step.is-done::before { background: var(--primary); }
.step.is-current { color: var(--text); font-weight: 600; }
.step.is-current::before { background: var(--primary); opacity: .55; }

/* Fil d'activité / notes */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; }
.timeline-item:first-child { border-top: 0; }
.timeline-meta { font-size: 12px; color: var(--muted); }

/* États vides, chargement, erreurs */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.skeleton { background: linear-gradient(90deg, var(--sunken), var(--line), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-md); font-size: 13px; }

/* Modale */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 11, .45); }
.modal-content {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop);
}
.modal-lg .modal-content { max-width: 820px; }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-header h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* Palette de commandes (⌘K) */
.command .modal-content { max-width: 640px; align-self: flex-start; margin-top: 10vh; }
.command-input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; height: 56px; font-size: 16px; padding: 0 20px; width: 100%; outline: none; background: transparent; }
.command-results { max-height: 420px; overflow-y: auto; padding: 6px; }
.command-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.command-item[aria-selected="true"], .command-item:hover { background: var(--sunken); }
.command-type { margin-left: auto; font-size: 11px; color: var(--muted); }

/* Menu déroulant d'actions */
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  display: none; flex-direction: column;
}
.menu.open .menu-list { display: flex; }
.menu-list button, .menu-list a { border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 7px; cursor: pointer; text-decoration: none; font-size: 13px; }
.menu-list button:hover, .menu-list a:hover { background: var(--sunken); }
.menu-list .is-danger { color: var(--red); }

/* Notifications éphémères */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: var(--canvas); border-radius: var(--radius-md); padding: 12px 16px;
  font-size: 13px; box-shadow: var(--shadow-pop); max-width: 380px; animation: toast-in .18s ease-out;
}
.toast.tone-red { background: var(--red); color: var(--on-red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* Connexion */
.auth-card { width: 100%; max-width: 400px; margin: 12vh auto 0; padding: 32px; display: flex; flex-direction: column; gap: 20px; }

/* Ajouts de la passe d'intégration : composants recréés par plusieurs écrans. */
.link { text-decoration: none; }
.link:hover { text-decoration: underline; }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }

/* Interrupteur : <label class="switch"><input type="checkbox" role="switch"> Libellé</label> */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--border); position: relative; cursor: pointer; flex: 0 0 auto; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }

/* Bascule à deux positions (Tableau / Liste) : même dessin que le sélecteur de thème */
.toggle-group { display: inline-grid; grid-auto-flow: column; gap: 4px; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 3px; }
.toggle-group button, .toggle-group a { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.toggle-group [aria-pressed="true"], .toggle-group [aria-current="page"] { background: var(--surface); color: var(--text); }

/* Histogramme simple (UI.bars) */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; }
.bar { border: 0; background: transparent; padding: 4px 0; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; min-width: 0; text-decoration: none; }
button.bar, a.bar { cursor: pointer; }
button.bar:hover, a.bar:hover { background: var(--sunken); }
.bar-value { min-height: 16px; font-size: 11px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { width: 100%; max-width: 36px; height: 150px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.bar-fill { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 1px; }
.bar-fill.tone-red { background: var(--red); } .bar-fill.tone-amber { background: var(--amber); }
.bar.is-selected .bar-fill { opacity: .7; }

/* Valeur copiable (lien, URI de redirection) */
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--font-mono); font-size: 12.5px; }

/* 5. Utilitaires ----------------------------------------------------------- */
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.gap-sm { gap: 6px; }

/* Responsive : sous ~800 px, le menu passe au-dessus du contenu */
@media (max-width: 800px) {
  :root { --page-pad-x: 18px; }
  body.layout-app { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex-basis: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .sidebar-toggle { display: inline-flex; margin-left: 4px; width: 36px; height: 36px; }
  .sidebar:not(.is-open) .sidebar-groups, .sidebar:not(.is-open) .sidebar-footer { display: none; }
  .page-title { font-size: 24px; }
  .panel { position: static; }
}

/* Écran : accueil (lot 1) ---------------------------------------------------- */
.accueil-shortcuts { gap: 8px; }
.accueil-columns { gap: 24px; }
.accueil-health-head { align-items: baseline; gap: 8px; }
.accueil-health-head .kpi-value { font-size: 28px; }
.accueil-health .legend i.tone-neutral { background: var(--border); }
.accueil-prio .tag { min-width: 88px; }
.accueil-health .legend i.tone-amber { background: var(--amber); }
.accueil-health .legend i.tone-blue { background: var(--blue); }
.accueil-health .legend i.tone-red { background: var(--red); }
.accueil-servers { border-top: 1px solid var(--line); padding-top: 14px; gap: 10px; }
.accueil-servers .bar-row { text-decoration: none; border-radius: var(--radius-sm); }
.accueil-servers .bar-row:hover .mono { text-decoration: underline; }
.accueil-server { width: 118px; flex: 0 0 auto; display: flex; flex-direction: column; line-height: 1.25; }
.accueil-server .mono { font-size: 12px; }
.accueil-server-count { width: 58px; text-align: right; flex: 0 0 auto; }

/* Écran : tâches planifiées (lot 1) ------------------------------------------- */
.taches-list { display: flex; flex-direction: column; gap: 12px; }
.taches-task { display: flex; flex-direction: column; gap: 12px; }
.taches-task-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.taches-task-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.taches-task-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.taches-task-name .mono { font-size: 13px; font-weight: 600; }
.taches-log summary { cursor: pointer; font-size: 12px; font-weight: 500; color: var(--muted); }
.taches-log pre {
  margin: 8px 0 0; max-height: 260px; overflow: auto; padding: 12px 14px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-md);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Écran : infra (serveurs, domaines, boîtes mail, comptes GSC, utilisateurs — lot 5) */
.infra-link { text-decoration: none; }
.infra-link:hover { text-decoration: underline; }
.infra-alert { border: 1px solid var(--border); }
.infra-alert .btn { margin-left: auto; }
.infra-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.infra-filters .select { width: auto; min-width: 180px; height: 34px; font-size: 13px; }
.infra-ellipsis { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Écran : abonnements (lot 3 — /abonnements, /abonnements/{id}, /factures) */
.abo-filter { width: auto; flex: 0 1 220px; min-width: 160px; }
.abo-panel-title { font-size: 18px; font-weight: 600; }
.abo-facts { margin: 0; gap: 12px 16px; }
.abo-facts dd { margin: 0; font-weight: 500; }
.abo-pack { padding: 14px; background: var(--sunken); border-radius: 12px; }
.abo-pack .gauge-value strong { font-size: 22px; }
.abo-pack .gauge-bar { height: 8px; }
.abo-chart { padding: 0 22px 18px; }
.abo-bottom { gap: 20px; }
.abo-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; }
.abo-bar { border: 0; background: transparent; padding: 4px 0; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; min-width: 0; }
.abo-bar:hover { background: var(--sunken); }
.abo-bar-value { min-height: 16px; font-size: 11px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.abo-bar-track { width: 100%; max-width: 36px; height: 150px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.abo-bar-fill { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; }
.abo-bar.is-active .abo-bar-label { color: var(--text); font-weight: 600; }
.abo-bar.is-active .abo-bar-track { box-shadow: inset 0 -2px 0 var(--primary); }
.abo-bar-sub { font-size: 11px; color: var(--faint); }
.abo-chart-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.abo-items .list-row { align-items: flex-end; }
.abo-item-form { flex: 1 1 auto; display: grid; grid-template-columns: minmax(220px, 3fr) minmax(80px, 1fr) minmax(150px, 1.4fr); gap: 10px 12px; min-width: 0; }
.abo-item-form .span-all { grid-column: 1 / -1; }
.abo-item-form .textarea { min-height: 40px; height: 40px; }
.abo-item-amount { min-width: 96px; text-align: right; font-family: var(--font-mono); font-size: 12.5px; padding-bottom: 10px; }
.abo-expand { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.abo-expand:hover { background: var(--sunken); color: var(--text); }
.abo-expand[aria-expanded="true"] { transform: rotate(90deg); }
.abo-detail-row > td { background: var(--sunken); }
.abo-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 24px; padding: 6px 0; }
.abo-task { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.abo-task-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 500; }
.abo-task-lines { margin: 0; padding: 0 0 0 12px; list-style: none; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.abo-task-lines li { display: flex; justify-content: space-between; gap: 10px; }
.abo-section { padding: 0 22px 18px; }
@media (max-width: 800px) {
  .abo-bars { gap: 2px; }
  .abo-bar-value { display: none; }
  .abo-item-form { grid-template-columns: 1fr 1fr; }
  .abo-item-form > .field:first-child { grid-column: 1 / -1; }
}
.accueil-health .dot-grid { grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); }
.infra-p { margin: 0; }
.infra-pre-line { white-space: pre-line; }
.infra-bar-label { min-width: 72px; font-size: 12px; }
.infra-log pre {
  margin: 6px 0 0; max-height: 220px; overflow: auto; padding: 10px 12px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-md);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.abo-panel-items .list-row-main { flex-basis: 0; }
.abo-items .list-row { flex-wrap: nowrap; }
@media (max-width: 800px) { .abo-items .list-row { flex-wrap: wrap; } }
.infra-filters .select { max-width: 260px; }

/* Écran : sites (liste, fiche, audit SEO) */
.sites-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }
.sites-filters .field-label { font-size: 12px; color: var(--muted); }
.sites-filters-reset { justify-content: flex-end; }
.sites-columns { max-height: 420px; overflow-y: auto; gap: 2px; }
.sites-columns .checkbox { padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.sites-columns .checkbox:hover { background: var(--sunken); }
.sites-link { text-decoration: none; }
.sites-link:hover { text-decoration: underline; }
a.sites-plain { text-decoration: none; }
.sites-panel-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sites-panel-empty p { margin: 0; }
.mono-title { font-family: var(--font-mono); font-weight: 500; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sites-big { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.sites-grow { flex: 1 1 320px; min-width: 0; }
.sites-score-row { gap: 8px 20px; }
.sites-score { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.sites-score small { font-size: 12px; font-weight: 400; color: var(--faint); margin-left: 2px; }
.sites-delta { min-width: 34px; text-align: right; }
.sites-inner { border-radius: var(--radius-md); }
.sites-text { margin: 0; line-height: 1.6; color: var(--muted); max-width: 78ch; }
.sites-details summary { cursor: pointer; font-size: 13px; }
.sites-details[open] summary { margin-bottom: 6px; }
/* Histogramme une série (score, clics) : barres fines, coins arrondis en haut, 2 px d'écart */
.sites-chart { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sites-bars { display: flex; align-items: flex-end; gap: 2px; height: 64px; border-bottom: 1px solid var(--line); }
.sites-bar { flex: 1 1 0; max-width: 28px; min-width: 3px; background: var(--primary); border-radius: 4px 4px 0 0; }
.sites-bar:hover { opacity: .75; }
.sites-chart-scale { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
/* Disponibilité : une case par jour sur 30 jours */
.sites-days { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; }
.sites-days > span { height: 28px; border-radius: 4px; }
.sites-days > span.tone-green, .sites-legend.tone-green { background: var(--green); }
.sites-days > span.tone-amber, .sites-legend.tone-amber { background: var(--amber); }
.sites-days > span.tone-red, .sites-legend.tone-red { background: var(--red); }
.sites-days > span.tone-neutral, .sites-legend.tone-neutral { background: var(--border); }
/* Rapport d'audit : sections par catégorie, lignes dépliables */
.sites-audit tr.sites-audit-group th { background: var(--canvas); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 8px; padding-bottom: 8px; border-top: 1px solid var(--line); }
.sites-audit-toggle { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--text); }
.sites-audit-toggle .icon { margin-right: 2px; }
.sites-chevron { display: inline-block; color: var(--muted); transition: transform .15s; }
.sites-chevron.is-open { transform: rotate(180deg); }
.sites-audit tr.sites-audit-detail > td { background: var(--canvas); padding-top: 16px; padding-bottom: 18px; }
.sites-audit-body { max-width: 920px; }
.sites-occurrences { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sites-occurrences li { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.sites-occurrences input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex: 0 0 auto; }
.sites-occurrence { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.sites-occurrence a { text-decoration: none; }
.sites-occurrence a:hover { text-decoration: underline; }
.sites-done { color: var(--faint); text-decoration: line-through !important; }
.sites-detail-item { margin-right: 12px; }
.sites-page { max-width: 460px; }
.sites-page .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sites-headings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sites-h3 { padding-left: 16px; } .sites-h4 { padding-left: 32px; } .sites-h5, .sites-h6 { padding-left: 48px; }
.sites-form-1 { grid-template-columns: 1fr; }
.infra-narrow { max-width: 170px; }
.sites-table .table td { white-space: nowrap; }
.infra-meter { display: block; min-width: 190px; }
.infra-meter .progress { min-width: 56px; }
.infra-meter .meter-label { white-space: nowrap; }
.abo-items .btn-icon { flex: 0 0 auto; }
.sites-table .identity-text { align-items: flex-start; }
.sites-table .sites-link { display: block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; }

/* Écran : clients (liste, fiche 360°) — préfixe cli- */
.cli-filter { width: auto; min-width: 170px; }
.cli-abo { display: inline-flex; align-items: baseline; gap: 4px; max-width: 135px; white-space: nowrap; }
.cli-toolbar .search { flex: 1 1 220px; }
td.cli-col-client .identity-name, td.cli-col-client .identity-sub { display: block; max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli-abo .truncate { min-width: 0; }
.cli-panel-name { font-size: 16px; }
.cli-modal-intro { margin: 0; }
.cli-results { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; }
.cli-result { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.cli-result:hover:not(:disabled), .cli-result[aria-selected="true"] { background: var(--selected-row); }
.cli-result:disabled { opacity: .6; cursor: not-allowed; }
.cli-result .identity-text { flex: 1; }
.cli-results-empty { padding: 14px 10px; text-align: center; }
.abo-table a.identity-name, .abo-table a.identity-sub { text-decoration: none; }
.abo-table a.identity-name:hover, .abo-table a.identity-sub:hover { text-decoration: underline; }

/* Écran : projets (portefeuille, fiche projet, vue métier, étapes Odoo) */
.prj-switch { display: flex; gap: 3px; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 3px; }
.prj-switch button { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.prj-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.prj-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.prj-summary > .segments { margin-left: auto; }
.prj-summary-figures { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.prj-figure { display: inline-flex; align-items: baseline; gap: 6px; border: 0; background: none; padding: 4px 0; cursor: pointer; border-bottom: 2px solid transparent; }
.prj-figure[aria-pressed="true"] { border-bottom-color: var(--primary); }
.prj-figure-value { font-size: 20px; font-weight: 600; }
.prj-figure-label { font-size: 13px; color: var(--muted); }
.prj-figure:hover .prj-figure-label { color: var(--text); }
.prj-kanban { grid-auto-columns: minmax(248px, 1fr); align-items: start; }
.prj-kanban .kanban-col { padding: 10px; gap: 8px; }
.prj-col-todo { background: var(--amber-bg); }
.prj-col-empty { border: 1px dashed var(--border); border-radius: 12px; padding: 18px 12px; text-align: center; font-size: 12px; color: var(--muted); }
.prj-card { border-radius: 12px; gap: 9px; }
.prj-card-eyebrow { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prj-card-title { font-weight: 600; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.prj-card-client { font-size: 12px; color: var(--muted); margin-top: -5px; }
.prj-card-flag { display: flex; }
.prj-card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.prj-av { flex: 0 0 auto; }
.prj-av-sm { width: 24px; height: 24px; font-size: 10px; }
.prj-av-md { width: 30px; height: 30px; font-size: 11px; }
.prj-av-none { background: transparent; border: 1px dashed var(--amber); color: var(--amber); }
.prj-row-link { text-decoration: none; display: block; }
.prj-row-link:hover .identity-name { text-decoration: underline; }
/* Fiche projet */
.prj-header { padding-bottom: 24px; }
.prj-title-row { align-items: flex-start; }
.prj-heading { gap: 8px; min-width: 0; }
.prj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.prj-meta a, .prj-meta strong { color: var(--text); font-weight: 500; }
.prj-meta .prj-who { display: inline-flex; align-items: center; gap: 6px; }
.prj-steps .step { font-size: 13px; font-weight: 500; }
.prj-steps .step.is-current { font-weight: 600; }
.prj-steps .step.is-current::before { opacity: 1; }
.prj-task-group { border-top: 1px solid var(--line); }
.prj-task-group-head { padding: 10px 22px; background: var(--sunken); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; gap: 8px; }
.prj-task { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 11px 22px; border-top: 1px solid var(--line); }
.prj-task input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex: 0 0 auto; }
.prj-task-name { flex: 1 1 220px; min-width: 0; text-decoration: none; }
.prj-task-name:hover { text-decoration: underline; }
.prj-task.is-closed .prj-task-name { color: var(--muted); text-decoration: line-through; }
.prj-task-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.prj-task-due { width: 84px; text-align: right; }
.prj-more { padding: 10px 22px; border-top: 1px solid var(--line); }
.prj-ticket { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 22px; border-top: 1px solid var(--line); text-decoration: none; }
.prj-ticket:hover { background: var(--sunken); }
.prj-ticket-src { font-size: 11px; font-weight: 600; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; min-width: 56px; text-align: center; }
.prj-ticket-key { width: 82px; color: var(--muted); }
.prj-ticket-title { flex: 1 1 220px; min-width: 0; }
.prj-link { margin-left: 0; color: var(--text); font-weight: 500; }
.prj-linked { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.prj-linked-kind { font-size: 12px; color: var(--muted); width: 76px; flex: 0 0 auto; }
.prj-linked-value { flex: 1; min-width: 0; }
.prj-linked:hover .prj-linked-value { text-decoration: underline; }
.prj-member { display: flex; align-items: center; gap: 10px; }
.prj-note-input { min-height: 76px; background: var(--sunken); }
.prj-notes-text { white-space: pre-line; overflow-wrap: anywhere; }
/* Vue métier, étapes */
.prj-owner { width: auto; min-width: 210px; }
.prj-owner-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.prj-owner-name { width: 170px; flex: 0 0 auto; }
.prj-owner-row .progress { flex: 1; }
.prj-owner-row.is-none .progress > span { background: var(--amber); }
.prj-owner-n { width: 28px; text-align: right; font-weight: 600; }
.prj-intro { margin: 0; max-width: 820px; font-size: 13px; }
.prj-stage-select { min-width: 170px; height: 34px; }
@media (max-width: 800px) {
  .prj-summary > .segments { margin-left: 0; }
  .prj-owner-name { width: 120px; }
  .prj-task-due { width: auto; }
}
.infra-scroll { max-height: 380px; overflow-y: auto; }

/* Écran : intégrations (lot 7 — /connecteurs, /projets/{id}/integrations) */
.intg-tabs .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }
.intg-icon { width: 40px; height: 40px; flex: 0 0 auto; border-radius: var(--radius-md); background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; }
.intg-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.intg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.intg-head > .tag { margin-left: auto; }
.intg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.intg-foot > .row { margin-left: auto; }
.intg-rule { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.intg-rule input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
.intg-rule.is-disabled { cursor: not-allowed; opacity: .6; }
.intg-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.intg-ticket { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; text-decoration: none; }
.intg-ticket:hover .truncate { text-decoration: underline; }
.intg-src { font-size: 11px; font-weight: 600; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; flex: 0 0 auto; }
.intg-copy { display: flex; gap: 6px; align-items: center; min-width: 0; }
.intg-copy code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--sunken); border-radius: var(--radius-sm); padding: 6px 8px; }
.prj-stats .stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; gap: 4px; }
.prj-stats .stat-label { order: -1; font-size: 13px; }
.prj-stats .stat-value { font-size: 26px; letter-spacing: -0.02em; }
.sites-page .identity-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prj-steps { list-style: none; margin: 0; padding: 0; }
.prj-heading { flex: 1 1 420px; }
.infra-mid { max-width: 210px; }
.infra-meter { min-width: 150px; } .infra-meter .progress { min-width: 36px; }
.cli-skel-title { display: inline-block; width: 260px; height: 26px; }
.cli-p { margin: 0; }
.cli-tight { gap: 2px; }
.cli-abo-card { display: flex; flex-direction: column; gap: 18px; }
.cli-abo-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.cli-abo-title { font-size: 18px; font-weight: 600; }
.cli-abo-title a { text-decoration: none; }
.cli-abo-title a:hover { text-decoration: underline; }
.cli-tab-link { font-size: 13px; }
.cli-meter { width: 130px; }
.cli-due { width: 80px; text-align: right; }
.cli-big { display: flex; align-items: baseline; gap: 8px; }
.cli-big strong { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.cli-metier { font-size: 12px; font-weight: 500; border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px; }
.cli-act-title { margin-bottom: 6px; }
.cli-act-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: 0 0 auto; border: 2px solid var(--faint); }
.cli-act-red { border-color: var(--red); }
.cli-act-amber { border-color: var(--amber); }
.cli-act-text { border-color: var(--text); }
.cli-icon-sm { width: 30px; height: 30px; }
.cli-copy { flex-wrap: nowrap; }
.cli-copy .input { flex: 1; min-width: 0; }
.cli-periods { display: flex; flex-direction: column; }
.cli-period { border-top: 1px solid var(--line); }
.cli-period > summary { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; list-style: none; }
.cli-period > summary::-webkit-details-marker { display: none; }
.cli-period-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.cli-period-types { margin-left: auto; }
.cli-period[open] > summary .icon { color: var(--primary); }
.cli-type { padding: 0 0 12px 22px; display: flex; flex-direction: column; gap: 6px; }
.cli-type-head { display: flex; justify-content: space-between; gap: 10px; }
.cli-task { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.cli-task-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cli-lines { margin: 0; padding: 0 0 0 12px; list-style: none; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.cli-lines li { display: grid; grid-template-columns: 84px 1fr auto 56px; gap: 10px; }
.cli-lines li .mono { text-align: right; }
@media (max-width: 800px) {
  .cli-lines li { grid-template-columns: 76px 1fr 50px; }
  .cli-lines li > :nth-child(3) { display: none; }
  .cli-period-types { display: none; }
  .cli-meter { width: 100px; }
}
.intg-head > .identity-text { flex: 1 1 200px; min-width: 0; }
.cli-dom-row { flex-wrap: nowrap; }
.cli-dom-row .list-row-main { flex: 1 1 auto; }
.cli-body .table td { white-space: nowrap; }
.cli-body .table a { text-decoration: none; }
.cli-body .table a:hover { text-decoration: underline; }

/* Écran : espace client public (/espace/{jeton}) — préfixe esp- */
body.layout-bare:has(.esp-header) { overflow-x: hidden; font-size: 15px; line-height: 1.5; }
body.layout-bare .page:has(.esp-header) { max-width: none; }
.esp-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.esp-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.esp-header-row { min-height: 68px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.esp-brand { display: flex; align-items: center; gap: 10px; }
.esp-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-logo); display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.esp-mark i { width: 4px; height: 4px; border-radius: 4px; background: var(--surface); }
:root:not([data-theme="dark"]) .esp-mark i { background: var(--on-primary); }
.esp-brand .brand-name { font-size: 17px; }
.esp-brand-tag { font-size: 13px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 10px; }
.esp-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.esp-main { padding-top: 36px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 24px; }
.esp-skel-sm { width: 180px; }
.esp-skel-lg { width: 420px; height: 34px; }
.esp-tight { gap: 2px; }
.esp-p { margin: 0; }
.esp-client { font-size: 14px; }
.esp-title { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.esp-h1b { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.esp-h2 { font-size: 20px; font-weight: 600; }
.esp-h3 { font-size: 16px; font-weight: 600; }
.esp-card { border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 22px; }
.esp-card-flat { border-radius: 20px; }
.esp-invalid { max-width: 560px; }
.esp-pack-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.esp-pill { margin-left: auto; font-size: 13px; padding: 4px 10px; border-radius: 8px; }
.esp-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.esp-figure { display: flex; flex-direction: column; font-size: 13px; }
.esp-figure strong { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.esp-bar { display: flex; height: 14px; border-radius: 14px; overflow: hidden; gap: 2px; background: var(--sunken); }
.esp-bar .used { background: var(--primary); }
.esp-bar .over { flex: 1 1 auto; background: var(--red); }
.esp-scale { font-size: 13px; }
.esp-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.esp-btn { height: 44px; padding: 0 18px; border-radius: 12px; }
.esp-section { gap: 14px; }
.esp-section-title { align-items: baseline; }
.esp-site { padding: 24px; gap: 20px; }
.esp-site-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.esp-site-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; }
.esp-site-link { font-size: 18px; font-weight: 600; text-decoration: none; }
.esp-site-link:hover { text-decoration: underline; }
.esp-status { gap: 6px; }
.esp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.esp-stat { background: var(--sunken); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.esp-stat strong { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.esp-chart-title { gap: 8px; align-items: baseline; }
.esp-chart { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 120px; border-bottom: 1px solid var(--border); }
.esp-col { height: 100%; display: flex; align-items: flex-end; }
.esp-col-bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; }
.esp-col-skel { background: var(--border); }
.esp-chart-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
.esp-chart-note::before { content: ""; position: absolute; inset: 30% 25%; background: var(--surface); opacity: .85; border-radius: 10px; z-index: -1; }
.esp-chart-note { z-index: 1; }
.esp-chart-axis { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; font-size: 11px; color: var(--muted); text-align: center; }
.esp-care { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; }
.esp-care li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.esp-care-label { flex: 1; }
.esp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.esp-small { padding: 22px 24px; gap: 12px; }
.esp-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.esp-domain { flex: 1 1 180px; font-size: 13.5px; }
.esp-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.esp-big strong { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.esp-details summary { cursor: pointer; font-size: 14px; font-weight: 500; list-style: none; }
.esp-details summary::-webkit-details-marker { display: none; }
.esp-mail-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.esp-mail-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.esp-entries-head { padding: 20px 24px; }
.esp-period { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.esp-period .select { height: 36px; width: auto; }
.esp-table { font-size: 14px; }
.esp-table td { padding-top: 14px; padding-bottom: 14px; }
.esp-table th:first-child, .esp-table td:first-child { padding-left: 24px; }
.esp-table th:last-child, .esp-table td:last-child { padding-right: 24px; }
.esp-total td { font-weight: 600; border-top: 1px solid var(--border); }
.esp-solved { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.esp-solved li { display: flex; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.esp-note { background: var(--sunken); border-radius: 20px; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.esp-note-title { font-size: 14px; font-weight: 600; color: var(--text); }
.esp-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 800px) {
  .esp-card { padding: 20px; }
  .esp-title { font-size: 26px; }
  .esp-pill { margin-left: 0; }
  .esp-chart-axis span:nth-child(even) { visibility: hidden; }
  .esp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
