/* ==========================================================================
   Base commune — reprise du template Alexime (ALX-0028, ALX-0032).
   Ne pas y mettre de couleur propre à un client : c'est le rôle de theme.css.
   Style : thème de la console Alexime, avec du relief (ombres teintées,
   fonds de blocs dégradés légers, halos de page, effets au survol).
   Sommaire : 1. Tokens  2. Socle  3. Mise en page  4. Composants
              5. Fenêtres et notifications  6. Impression  7. Animations
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  /* Valeurs par défaut, redéfinies dans theme.css. */
  --brand: #1f5f7a;
  --accent: #d9824a;
  --radius: 14px;
  --density: 1; /* 1 = compacte (bureau), 1.2 = confortable (terrain, tablette) */
  --font-body: system-ui, sans-serif;
  --font-display: system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --success: #2e8a5f;
  --warning: #c98a12;
  --danger: #c2453d;
  --info: #3b73c4;
  --violet: #7a5cc4;

  --ink: #16303d;
  --muted: #5c7180;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f5f8fa;
  --line: #dfe7ed;
  --line-strong: #c8d5de;

  /* Couleurs dérivées de la marque. */
  --brand-strong: color-mix(in oklab, var(--brand) 80%, black);
  --brand-soft: color-mix(in oklab, var(--brand) 13%, var(--surface));
  --brand-softer: color-mix(in oklab, var(--brand) 6%, var(--surface));
  --brand-ink: var(--brand);
  --on-brand: #ffffff;
  --accent-soft: color-mix(in oklab, var(--accent) 16%, var(--surface));

  /* Fond de page : deux halos (marque, accent) sur un fond clair. */
  --halo-1: color-mix(in oklab, var(--brand) 12%, var(--bg));
  --halo-2: color-mix(in oklab, var(--accent) 11%, var(--bg));
  /* Fond des blocs : dégradé très léger vers la teinte du bloc (--tint). */
  --tint: var(--brand);
  --block-bg: linear-gradient(165deg, var(--surface) 45%, color-mix(in oklab, var(--tint) 5%, var(--surface)));

  /* Ombres teintées de la couleur du texte (plus douces qu'un noir). */
  --shadow-color: 22 48 61;
  --shadow-sm: 0 1px 2px rgb(var(--shadow-color) / 6%), 0 1px 3px rgb(var(--shadow-color) / 5%);
  --shadow-md: 0 2px 4px rgb(var(--shadow-color) / 5%), 0 8px 22px rgb(var(--shadow-color) / 9%);
  --shadow-lg: 0 20px 56px rgb(var(--shadow-color) / 18%);
  --focus: 0 0 0 3px color-mix(in oklab, var(--brand) 30%, transparent);

  --radius-sm: calc(var(--radius) * 0.65);
  --radius-lg: calc(var(--radius) * 1.3);
  --radius-pill: 999px;

  /* Espacements (multipliés par la densité) et hauteur des contrôles. */
  --space-1: calc(4px * var(--density));
  --space-2: calc(8px * var(--density));
  --space-3: calc(12px * var(--density));
  --space-4: calc(16px * var(--density));
  --space-5: calc(24px * var(--density));
  --space-6: calc(32px * var(--density));
  --control-h: calc(40px * var(--density));
  --control-h-sm: calc(32px * var(--density));
  --card-pad: clamp(16px, 2.2vw, calc(24px * var(--density)));

  --fast: 140ms;
  --soft: 220ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --topbar-h: 64px;
  --page-max: none;
  --gutter: clamp(16px, 2.5vw, 40px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e3eaee;
    --muted: #93a4ae;
    --bg: #0e161b;
    --surface: #162129;
    --surface-2: #1b2831;
    --line: #26343d;
    --line-strong: #34454f;
    --brand-ink: color-mix(in oklab, var(--brand) 55%, white);
    --brand-soft: color-mix(in oklab, var(--brand) 28%, var(--surface));
    --brand-softer: color-mix(in oklab, var(--brand) 14%, var(--surface));
    --accent-soft: color-mix(in oklab, var(--accent) 24%, var(--surface));
    --halo-1: color-mix(in oklab, var(--brand) 22%, var(--bg));
    --halo-2: color-mix(in oklab, var(--accent) 12%, var(--bg));
    --block-bg: linear-gradient(165deg, var(--surface) 45%, color-mix(in oklab, var(--tint) 10%, var(--surface)));
    --shadow-color: 0 0 0;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-md: 0 2px 4px rgb(0 0 0 / 25%), 0 10px 24px rgb(0 0 0 / 30%);
    --shadow-lg: 0 24px 60px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

/* 2. Socle ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 520px at 8% -8%, var(--halo-1), transparent 70%),
    radial-gradient(900px 480px at 96% 0%, var(--halo-2), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; color: var(--ink); }
h1 { font-size: clamp(1.5rem, 1.25rem + 0.9vw, 2rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }

a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.icon { flex: none; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--on-brand); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* 3. Mise en page ---------------------------------------------------------- */

/* En-tête : collant, translucide et flouté. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
  box-shadow: 0 1px 0 rgb(var(--shadow-color) / 3%), 0 6px 18px rgb(var(--shadow-color) / 4%);
}
.topbar-inner {
  height: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 24px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); border-radius: var(--radius-sm); }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: calc(var(--radius) * 0.75);
  background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 55%, var(--accent)));
  color: var(--on-brand); font: 700 16px/1 var(--font-display);
  box-shadow: 0 2px 6px color-mix(in oklab, var(--brand) 35%, transparent), inset 0 1px 0 rgb(255 255 255 / 25%);
  transition: transform var(--soft) var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.04); }
.brand-name { font: 650 1.05rem/1 var(--font-display); letter-spacing: -0.01em; }

.nav { flex: 1; display: flex; align-items: center; gap: 16px; margin-left: 8px; }
.nav-list { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 540;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--brand-softer); }
.nav-link.is-active { color: var(--brand-ink); background: var(--brand-soft); }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--brand), color-mix(in oklab, var(--brand) 40%, var(--accent)));
}

/* Menus déroulants (<details> natif : fonctionne sans JavaScript) */
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; cursor: pointer; user-select: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-chevron { color: var(--muted); transition: transform var(--fast) var(--ease); }
.nav-menu details[open] .nav-chevron { transform: rotate(180deg); }
.nav-menu details[open] > summary { color: var(--ink); background: var(--brand-softer); }
.nav-dropdown {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 30; min-width: 250px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: pop var(--fast) var(--ease);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-weight: 520; white-space: nowrap;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.nav-item .icon { color: var(--muted); transition: color var(--fast) var(--ease); }
.nav-item:hover { background: var(--brand-softer); color: var(--ink); transform: translateX(2px); }
.nav-item:hover .icon { color: var(--brand-ink); }
.nav-item.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-item.is-active .icon { color: var(--brand-ink); }
.nav-item-button { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }

/* Compte (tout à droite) */
.user-menu { display: flex; align-items: center; gap: 6px; margin: 0; }
.user-link { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--radius-pill); color: var(--ink); transition: background-color var(--fast) var(--ease); }
.user-link:hover, .user-link.is-active, .user-menu details[open] > .user-link { background: var(--brand-softer); }
.user-avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in oklab, var(--accent) 30%, var(--surface)));
  color: color-mix(in oklab, var(--accent) 75%, var(--ink));
  font-weight: 650; font-size: 0.85rem; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 25%, transparent);
}
.user-name { font-weight: 560; font-size: 0.9rem; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown { left: auto; right: 0; min-width: 220px; }
.user-dropdown form { margin: 0; padding-top: 2px; border-top: 1px solid var(--line); }
@media (min-width: 861px) { .nav > .user-menu { margin-left: auto; } }

.nav-toggle {
  display: none; margin-left: auto;
  padding: 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); cursor: pointer;
}

.page {
  flex: 1;
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: clamp(20px, 3.5vw, 36px) var(--gutter) 48px;
  display: flex; flex-direction: column; gap: var(--space-5);
}
.page:focus { outline: none; box-shadow: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.eyebrow { color: var(--brand-ink); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 6px; }
.lead { color: var(--muted); margin-top: 6px; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.86rem; margin-bottom: calc(var(--space-5) * -0.5); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-ink); text-decoration: underline; }

.footer {
  max-width: var(--page-max); width: 100%; margin: 0 auto;
  padding: 20px var(--gutter) 28px; color: var(--muted); font-size: 0.85rem;
  display: flex; gap: 16px; justify-content: center;
}
.footer a { color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--space-5); }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-5); align-items: start; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row + .row { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.grow { flex: 1; }
.title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

@media (max-width: 960px) { .layout-aside { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed; inset: var(--topbar-h) 0 auto 0;
    flex-direction: column; align-items: stretch; margin-left: 0;
    max-height: calc(100dvh - var(--topbar-h)); overflow-y: auto;
    padding: 12px var(--gutter) 20px;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity var(--soft) var(--ease), transform var(--soft) var(--ease), visibility 0s linear var(--soft);
  }
  .nav.is-open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav-list { flex-direction: column; }
  .nav-link { padding: 12px; font-size: 1rem; min-height: 44px; }
  .nav-link.is-active::after { display: none; }
  .nav-dropdown { position: static; box-shadow: none; border: 0; padding: 0 0 6px 12px; min-width: 0; animation: none; background: none; }
  .user-menu { padding-top: 12px; border-top: 1px solid var(--line); }
  .user-name { flex: 1; max-width: none; }
}

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

/* Bloc : surface au fond légèrement dégradé, liseré de couleur optionnel.
   `--tint` donne la teinte (marque par défaut) : .tone-* la change. */
.card {
  position: relative;
  background: var(--block-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--card-pad);
}
.card-accent { border-top: 3px solid var(--tint); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--space-4); }
.card-title { font-size: 0.78rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-3); }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .table-wrap { margin: 0; }
.card-head-padded { padding: var(--card-pad) var(--card-pad) 0; }
.card-pad { padding: 0 var(--card-pad) var(--card-pad); }
.card-muted { background: var(--brand-softer); border-style: dashed; box-shadow: none; }

/* Blocs cliquables : relief au survol. */
a.card, .card-link, .tile, .stat, .note-card {
  transition: transform var(--soft) var(--ease), box-shadow var(--soft) var(--ease), border-color var(--soft) var(--ease);
}
a.card:hover, .card-link:hover, .tile:hover, .stat:hover, .note-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: color-mix(in oklab, var(--tint) 35%, var(--line));
}
a.card:active, .stat:active, .note-card:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* Teintes : fond d'icône, liseré, dégradé des blocs. */
.tone-brand { --tint: var(--brand); }
.tone-accent { --tint: var(--accent); }
.tone-success { --tint: var(--success); }
.tone-warning { --tint: var(--warning); }
.tone-danger { --tint: var(--danger); }
.tone-info { --tint: var(--info); }
.tone-violet { --tint: var(--violet); }

/* Accueil : salutation, indicateurs, tuiles par domaine */
.greeting h1 { font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.5rem); font-weight: 700; letter-spacing: -0.02em; }
.greeting .lead { margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); }
.stat {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  padding: var(--space-4) calc(var(--space-4) + 2px);
  background: var(--block-bg); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat:hover { color: var(--ink); }
.stat-icon {
  grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in oklab, var(--tint) 16%, var(--surface)), color-mix(in oklab, var(--tint) 26%, var(--surface)));
  color: color-mix(in oklab, var(--tint) 85%, var(--ink));
}
.stat-label { color: var(--muted); font-size: 0.84rem; }
.stat-value { font: 650 1.55rem/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--space-4); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 170px;
  padding: calc(var(--space-5) - 2px) var(--space-5) var(--space-4); overflow: hidden;
  background: linear-gradient(160deg, var(--surface) 40%, color-mix(in oklab, var(--tint) 9%, var(--surface)));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--tint), color-mix(in oklab, var(--tint) 30%, var(--surface))); }
.tile:nth-child(4n + 2) { --tint: var(--accent); }
.tile:nth-child(4n + 3) { --tint: var(--success); }
.tile:nth-child(4n + 4) { --tint: var(--violet); }
.tile-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.tile-desc { color: var(--muted); font-size: 0.88rem; }
.tile-links { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tile-links a {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-pill);
  color: var(--ink); text-decoration: none; font-weight: 560; font-size: 0.9rem;
  background: color-mix(in oklab, var(--tint) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 14%, transparent);
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.tile-links a:hover { background: color-mix(in oklab, var(--tint) 20%, var(--surface)); transform: translateY(-1px); }
.tile-links a .icon { color: color-mix(in oklab, var(--tint) 80%, var(--ink)); }

/* Boutons : un seul bouton principal (.btn) par écran ; les autres en secondaire ou discret. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 0 calc(16px * var(--density));
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 88%, white), var(--brand));
  color: var(--on-brand);
  font: 600 0.94rem/1 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgb(var(--shadow-color) / 12%), 0 3px 10px color-mix(in oklab, var(--brand) 22%, transparent), inset 0 1px 0 rgb(255 255 255 / 18%);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), filter var(--fast) var(--ease);
}
.btn:hover { color: var(--on-brand); filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 2px 4px rgb(var(--shadow-color) / 12%), 0 6px 16px color-mix(in oklab, var(--brand) 30%, transparent), inset 0 1px 0 rgb(255 255 255 / 18%); }
.btn:active { transform: translateY(0); filter: brightness(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }
.btn:focus-visible { border-radius: var(--radius-pill); box-shadow: var(--focus); }
.btn-secondary {
  background: linear-gradient(180deg, var(--surface), var(--surface-2)); color: var(--ink);
  border-color: var(--line-strong); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  color: var(--brand-ink); background: linear-gradient(180deg, var(--surface), var(--brand-softer));
  border-color: color-mix(in oklab, var(--brand) 40%, var(--line)); box-shadow: var(--shadow-md);
}
.btn-ghost { background: transparent; color: var(--brand-ink); box-shadow: none; }
.btn-ghost:hover { color: var(--brand-ink); background: var(--brand-soft); box-shadow: none; transform: none; }
.btn-danger { background: linear-gradient(180deg, color-mix(in oklab, var(--danger) 88%, white), var(--danger)); box-shadow: 0 3px 10px color-mix(in oklab, var(--danger) 22%, transparent); }
.btn-sm { min-height: var(--control-h-sm); padding: 0 calc(12px * var(--density)); font-size: 0.86rem; }
.btn-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-icon:hover { background: var(--brand-soft); color: var(--brand-ink); }

/* Pastilles (statuts, priorités) */
.badge {
  --tone: var(--brand);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: linear-gradient(180deg, color-mix(in oklab, var(--tone) 10%, var(--surface)), color-mix(in oklab, var(--tone) 16%, var(--surface)));
  color: color-mix(in oklab, var(--tone) 80%, var(--ink));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tone) 18%, transparent);
  font-size: 0.79rem; font-weight: 600; white-space: nowrap;
}
.badge-muted { --tone: var(--muted); }
.badge.tone-success { --tone: var(--success); }
.badge.tone-warning { --tone: var(--warning); }
.badge.tone-danger { --tone: var(--danger); }
.badge.tone-info { --tone: var(--info); }
.badge.tone-muted { --tone: var(--muted); }

.status-nouveau { --tone: var(--info); }
.status-qualifie { --tone: var(--violet); }
.status-en_cours { --tone: var(--brand); }
.status-a_valider { --tone: var(--warning); }
.status-en_attente_client { --tone: var(--accent); }
.status-clos { --tone: var(--muted); }
.priority-p1 { --tone: var(--danger); }
.priority-p2 { --tone: var(--warning); }
.priority-p3 { --tone: var(--info); }
.priority-p4 { --tone: var(--muted); }

/* Boutons de filtre (en haut d'une liste), avec compteur */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); text-decoration: none; font-weight: 560; font-size: 0.88rem;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.filter-chip:hover { color: var(--ink); border-color: color-mix(in oklab, var(--brand) 35%, var(--line)); background: var(--brand-softer); }
.filter-chip.is-active { color: var(--brand-ink); border-color: color-mix(in oklab, var(--brand) 45%, var(--line)); background: var(--brand-soft); }
.filter-count { min-width: 22px; padding: 1px 7px; border-radius: var(--radius-pill); background: color-mix(in oklab, var(--brand) 10%, var(--surface)); font-size: 0.78rem; text-align: center; font-variant-numeric: tabular-nums; }

/* Onglets (boutons [data-tab] et panneaux [data-panel] dans [data-tabs], voir app.js) */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; padding: 8px 14px; border: 0; background: none; font: inherit; font-weight: 540;
  color: var(--muted); cursor: pointer; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.tab:hover { color: var(--ink); background: var(--brand-softer); }
.tab.is-active { color: var(--brand-ink); }
.tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.tab-panel { padding-top: var(--space-4); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--space-4); }
.form-wide { max-width: 860px; }
.form-narrow { max-width: 520px; }
.form-section { border: 0; margin: 0; padding: 0 0 8px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 20px; }
.form-section legend { font: 650 1rem/1.2 var(--font-display); padding: 0; margin-bottom: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 6px; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.field-full { grid-column: 1 / -1; }
.field-short { max-width: 200px; }
.field-label { font-weight: 580; font-size: 0.9rem; }
.field-hint { color: var(--muted); font-size: 0.82rem; }
.optional { color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.field-error { display: flex; align-items: center; gap: 6px; color: var(--danger); font-size: 0.84rem; font-weight: 520; }
input:not([type="checkbox"], [type="radio"]), select, textarea {
  width: 100%; min-height: var(--control-h); padding: calc(9px * var(--density)) 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
  box-shadow: inset 0 1px 2px rgb(var(--shadow-color) / 4%);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in oklab, var(--brand) 35%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); background: var(--surface); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 25%, transparent) !important; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.check-card { align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease); }
.check-card:hover { border-color: color-mix(in oklab, var(--brand) 30%, var(--line)); }
.check-card input { margin-top: 3px; }
.check-card:has(input:checked) { border-color: color-mix(in oklab, var(--brand) 50%, var(--line)); background: var(--brand-softer); }
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); }
.segmented label { position: relative; padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer; font-weight: 540; color: var(--muted); transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.segmented label:hover { color: var(--ink); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.segmented label:has(input:focus-visible) { box-shadow: var(--focus); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar select { width: auto; min-width: 190px; }
.search { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.search .icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; border-radius: var(--radius-pill); }

/* Messages */
.alert {
  --tone: var(--info);
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: linear-gradient(165deg, color-mix(in oklab, var(--tone) 8%, var(--surface)), color-mix(in oklab, var(--tone) 13%, var(--surface)));
  border: 1px solid color-mix(in oklab, var(--tone) 25%, var(--surface));
  border-left: 4px solid var(--tone);
  color: color-mix(in oklab, var(--tone) 72%, var(--ink));
}
.alert .icon { margin-top: 2px; }
.alert-success { --tone: var(--success); }
.alert-warning { --tone: var(--warning); }
.alert-danger { --tone: var(--danger); }

/* Tableau : en-tête teinté, survol de ligne, ligne entière cliquable */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--card-pad) * -1); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: calc(11px * var(--density)) var(--card-pad); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: color-mix(in oklab, var(--brand) 4%, var(--surface-2)); color: var(--muted); font-size: 0.76rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.table tbody tr { transition: background-color var(--fast) var(--ease); }
.table tbody tr:hover { background: var(--brand-softer); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-muted td { opacity: 0.55; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .wrap { white-space: normal; }
.table-clickable tbody tr { position: relative; cursor: pointer; }
.row-link { color: var(--ink); text-decoration: none; font-weight: 580; transition: color var(--fast) var(--ease); }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:focus-visible { box-shadow: none; }
.table-clickable tbody tr:hover .row-link { color: var(--brand-ink); }
.table-clickable tbody tr:has(.row-link:focus-visible) { box-shadow: inset 0 0 0 2px var(--brand); }

/* Fiche : liste de faits */
.facts { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 560; text-align: right; overflow-wrap: anywhere; }
.facts-grand { padding-top: 8px; border-top: 1px solid var(--line); font-size: 1.05rem; }
.facts-grand dt { color: var(--ink) !important; font-weight: 650; }
.notes { white-space: pre-wrap; color: var(--ink); }

/* État vide */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 48px 24px; }
.empty p { color: var(--muted); max-width: 46ch; }
.empty-icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in oklab, var(--tint) 7%, var(--surface)), color-mix(in oklab, var(--tint) 18%, var(--surface)));
  color: color-mix(in oklab, var(--tint) 85%, var(--ink));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 15%, transparent);
}

/* Utilitaires */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }

/* Écrans de connexion : carte centrée, étroite */
.auth {
  width: 100%; max-width: 420px; margin: clamp(16px, 8vh, 72px) auto 0;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  padding: clamp(24px, 4vw, 36px); box-shadow: var(--shadow-md);
}
.auth .form { width: 100%; margin-top: 8px; text-align: left; }
.auth .alert { width: 100%; text-align: left; }
.auth-wide { max-width: 600px; }

/* Comptes */
.user-row-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.user-row-form input[name="display_name"] { min-width: 160px; flex: 1; }
.user-actions { display: flex; flex-wrap: wrap; gap: 4px; }

/* 5. Fenêtres et notifications ------------------------------------------- */

/* Fenêtre modale (<dialog> natif) : 3 tailles. dialog-wide = 90 % de l'écran. */
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog:not([open]) { display: none !important; }
.dialog[open] { display: flex; flex-direction: column; animation: pop var(--soft) var(--ease); }
.dialog::backdrop { background: rgb(22 48 61 / 42%); backdrop-filter: blur(3px); }
.dialog-md { width: min(720px, calc(100vw - 32px)); }
.dialog-wide, .dialog:has([data-dialog-wide]) { width: min(90vw, 1400px); max-width: 90vw; max-height: 90dvh; }
.dialog [data-remote-body] { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog [data-remote-body] > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog-head, .dialog-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--space-4) var(--space-5); }
.dialog-head { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--brand-softer), var(--surface)); }
.dialog-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-5); color: var(--ink); }
.dialog-foot { justify-content: flex-end; border-top: 1px solid var(--line); background: var(--surface-2); }

/* Notifications éphémères */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  background: color-mix(in oklab, var(--ink) 94%, var(--brand)); color: var(--surface); box-shadow: var(--shadow-lg);
  animation: toast-in var(--soft) var(--ease);
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--soft) var(--ease), transform var(--soft) var(--ease); }

/* 6. Impression ------------------------------------------------------------- */

/* Portrait par défaut ; .print-landscape pour un tableau large (planning…). */
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  @page landscape { size: A4 landscape; margin: 10mm; }
  .print-landscape { page: landscape; }
  body { background: #fff !important; color: #000; }
  .topbar, .footer, .toasts, .no-print, .skip-link, .breadcrumb, .md-widget { display: none !important; }
  .page { padding: 0; }
  .card { background: #fff; box-shadow: none; border-color: #ccc; }
  a { color: inherit; text-decoration: none; }
  tr, .card { break-inside: avoid; }
}

/* 7. Animations ------------------------------------------------------------ */

.page.is-entering > * { animation: rise 320ms var(--ease) both; }
.page.is-entering > *:nth-child(2) { animation-delay: 30ms; }
.page.is-entering > *:nth-child(3) { animation-delay: 60ms; }
.page.is-entering > *:nth-child(n+4) { animation-delay: 90ms; }
.page.is-loading { opacity: 0.55; transition: opacity var(--soft) var(--ease) 80ms; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; transition-duration: 1ms !important; }
  a.card:hover, .card-link:hover, .tile:hover, .stat:hover, .note-card:hover, .btn:hover, .nav-item:hover { transform: none; }
}

/* 8. Modules de la console ----------------------------------------------- */
/* Repris de l'ancienne feuille de la console ; les composants communs
   viennent de la base ci-dessus. */

/* En-tête : raccourci et cloche à droite des menus */
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-tools + .bell-slot, .nav > .bell-slot { display: flex; align-items: center; }
@media (max-width: 860px) { .nav-tools { margin-left: 0; padding: 4px 12px; } }
@media (min-width: 861px) { .nav > .user-menu { margin-left: 0; padding-left: 16px; border-left: 1px solid var(--line); } }

/* Tuiles de l'accueil : une teinte par domaine */
.tile-commercial { --tint: var(--brand); }
.tile-support { --tint: var(--accent); }
.tile-exploitation { --tint: var(--success); }
.tile-gestion { --tint: var(--violet); }
.tile-links a.is-upcoming { color: var(--muted); background: transparent; border: 1px dashed var(--line); box-shadow: none; }
.tile-links a.is-upcoming .icon { color: var(--muted); }
.tile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.tile-badges a.badge { text-decoration: none; }
.nav-item.is-upcoming { color: var(--muted); }
.nav-item-ticket { margin-left: auto; font: 600 0.72rem/1 var(--font-mono); color: var(--muted); opacity: 0.8; }

.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--muted); }
.upcoming-list li { display: flex; align-items: center; gap: 8px; }
.upcoming-list .badge { margin-left: auto; }

/* Liste de modules */
.module-list { list-style: none; margin: 0; padding: 0; }
.module-list li + li { border-top: 1px solid var(--line); }
.module-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 8px; margin: 0 -8px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
  transition: background-color var(--fast) var(--ease);
}
.module-row:hover { background: var(--brand-softer); }
.module-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); }
.module-name { flex: 1; font-weight: 560; }
.module-arrow { color: var(--muted); transition: transform var(--fast) var(--ease); }
.module-row:hover .module-arrow { transform: translateX(3px); color: var(--brand-ink); }

/* Préfixe client */
.prefix {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-ink);
  font: 650 0.78rem/1.4 var(--font-mono); letter-spacing: 0.04em;
}
.prefix-lg { font-size: 1rem; padding: 4px 10px; border-radius: var(--radius-sm); }

.client-prospect { --tone: var(--info); }
.client-actif { --tone: var(--success); }
.client-resilie { --tone: var(--warning); }
.client-archive { --tone: var(--muted); }
.badge.tone-health { --tone: #7a5cc4; background: color-mix(in oklab, var(--tone) 13%, var(--surface)); color: color-mix(in oklab, var(--tone) 78%, var(--ink)); }

/* Contacts */
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.contact + .contact { border-top: 1px solid var(--line); }
.contact.is-inactive { opacity: 0.6; }
.contact-avatar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.contact-main { flex: 1; min-width: 0; }
.contact-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 580; }
.contact-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.contact-meta span { display: inline-flex; align-items: center; gap: 4px; }
.contact-meta a { color: var(--muted); overflow-wrap: anywhere; }
.contact-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.contact-actions form { margin: 0; }
@media (max-width: 640px) {
  .contact { flex-wrap: wrap; }
  .contact-actions { width: 100%; justify-content: flex-start; padding-left: 50px; }
}

/* Outils et instances */
.tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tool-name { display: flex; align-items: center; gap: 8px; font-weight: 580; margin-bottom: 6px; }
.tool-instance { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.9rem; padding: 4px 0; }
.env { font-size: 0.74rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 6px; }
.env-production { background: color-mix(in oklab, var(--success) 14%, var(--surface)); color: var(--success); }
.env-recette { background: color-mix(in oklab, var(--warning) 16%, var(--surface)); color: color-mix(in oklab, var(--warning) 80%, var(--ink)); }

/* Affaires : kanban -------------------------------------------------------- */

/* Page pleine largeur (kanban) : le contenu occupe tout l'écran. */
.page.page-full { max-width: none; padding-top: 16px; gap: 14px; }

.board-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 18px;
}
.board-title { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.board-title h1 { font-size: 1.35rem; }
.board-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; }
.board-filters select { width: auto; min-height: 34px; padding: 4px 10px; font-size: 0.86rem; }
.board-filters .check { font-size: 0.86rem; gap: 6px; }
.board-filters .check input { width: 15px; height: 15px; }
.board-actions { display: flex; gap: 6px; }
.search-sm { flex: 0 1 230px; }
.search-sm input { min-height: 34px; padding: 4px 10px 4px 32px; font-size: 0.86rem; }
.search-sm .icon { left: 10px; }

.toggle { padding: 0 12px; min-height: 42px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 0.92rem; }
.toggle:has(input:checked) { border-color: color-mix(in oklab, var(--brand) 45%, var(--line)); background: var(--brand-softer); }
.grow { flex: 1 1 260px; }

/* Colonnes : se partagent toute la largeur ; défilement horizontal seulement
   si l'écran est trop étroit pour leur largeur minimale. */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr);
  gap: 10px; overflow-x: auto; padding-bottom: 12px;
  scroll-snap-type: x proximity; align-items: start;
}
.board-col {
  display: flex; flex-direction: column; min-height: 160px; max-height: calc(100dvh - var(--topbar-h) - 130px);
  background: color-mix(in oklab, var(--bg) 70%, var(--line)); border-radius: var(--radius-sm);
  padding: 8px; scroll-snap-align: start; min-width: 0;
  transition: background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.board-col.is-over { background: var(--brand-soft); box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--brand) 50%, transparent); }
.board-col-perdue { background: color-mix(in oklab, var(--danger) 6%, var(--bg)); }
.board-col-head h2 { font-size: 0.86rem; font-weight: 650; display: flex; align-items: baseline; gap: 6px; padding: 2px 4px 0; }
.board-count { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.board-col-sub { display: flex; justify-content: space-between; gap: 6px; min-height: 1.3em; margin: 0 4px 8px; font-size: 0.72rem; color: var(--muted); }
.board-total { font-weight: 650; color: var(--ink); }
.board-cards { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; min-height: 50px; padding: 2px; margin: -2px; }

.deal-card {
  display: flex; flex-direction: column; gap: 3px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 8px; box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; cursor: grab; font-size: 0.78rem; line-height: 1.35;
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.deal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.deal-card:active { cursor: grabbing; }
.deal-card.is-overdue { border-left-color: var(--danger); }
.deal-card.is-dragging { opacity: 0.4; }
.deal-card.is-saving { opacity: 0.7; pointer-events: none; }
.deal-card.is-landed { animation: pop var(--soft) var(--ease); }
.board-col-perdue .deal-card, .board-col-livree .deal-card { border-left-color: var(--muted); opacity: 0.85; }
.deal-card-client { display: flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-card-client .prefix { font-size: 0.66rem; padding: 0 5px; }
.deal-card-title { font-size: 0.84rem; font-weight: 620; line-height: 1.3; }
.deal-card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }
.deal-card-meta .badge { font-size: 0.68rem; padding: 1px 7px; }
.deal-amount { font-weight: 650; font-variant-numeric: tabular-nums; }
.deal-card-foot { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.72rem; margin-top: 1px; }
.deal-card-foot > span { display: inline-flex; align-items: center; gap: 3px; }
.deal-card-foot .icon { width: 12px; height: 12px; }
.deal-due { margin-left: auto; }
.deal-card.is-overdue .deal-due { color: var(--danger); font-weight: 650; }
.deal-checks.is-done { color: var(--success); }
.deal-age.is-late { color: var(--danger); font-weight: 650; }

.missing-list { margin: 8px 0 12px; padding-left: 20px; color: var(--ink); }

/* Fiche affaire */
.stepper { display: flex; list-style: none; margin: 0; padding: 4px 0 8px; overflow-x: auto; counter-reset: step; }
.step { flex: 1 0 110px; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 0.82rem; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-current::before { background: var(--brand); }
.step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); color: var(--on-brand); }
.step.is-done .step-dot { background: var(--brand); border-color: var(--brand); }
.step.is-current .step-dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step.is-current { color: var(--ink); font-weight: 650; }

.checklist { list-style: none; margin: 0 0 4px; padding: 0; }
.checklist li + li { border-top: 1px solid var(--line); }
.check-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; margin: 0; }
.check-item .check { flex: 1; }
.check-item input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--muted) 60%, transparent); }
.next-action { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.summary-title { cursor: pointer; font-weight: 620; }
.subhead { font-size: 0.85rem; color: var(--muted); margin: 14px 0 4px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline-date { font-size: 0.8rem; color: var(--muted); }
.timeline-note { font-size: 0.88rem; color: var(--muted); }

.deal-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.deal-mini-list li { display: flex; flex-direction: column; gap: 4px; }
.deal-mini-list li.is-closed { opacity: 0.65; }
.deal-mini-list a { color: var(--ink); font-weight: 560; text-decoration: none; }
.deal-mini-list a:hover { color: var(--brand-ink); text-decoration: underline; }
.deal-mini-meta { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; }

/* Formulaire d'affaire : client existant ou nouveau prospect */
.deal-form .client-mode { margin-bottom: 16px; }
.deal-form .when-new { display: none; }
.deal-form:has(input[name="client_mode"][value="nouveau"]:checked) .when-new { display: grid; }
.deal-form:has(input[name="client_mode"][value="nouveau"]:checked) .when-existing { display: none; }

/* Réglages des étapes */
.stage-list { display: flex; flex-direction: column; gap: 12px; }
.stage-card.is-end { background: var(--brand-softer); }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.stage-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 0.85rem; }
.stage-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 380px; margin: 0; }
.stage-form input[name="label"] { flex: 1 1 200px; font-weight: 600; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.88rem; }
.inline-field input { width: 76px; }
.stage-tools { display: flex; align-items: center; gap: 4px; }
.stage-tools form { margin: 0; }
.stage-checks { list-style: none; margin: 12px 0 0 40px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stage-checks li { display: flex; align-items: center; gap: 6px; }
.stage-checks li form { margin: 0; }
.stage-check-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; }
.stage-check-form input[type="text"] { flex: 1 1 220px; min-height: 36px; padding: 6px 10px; }
.stage-check-form.is-new input[type="text"] { border-style: dashed; }
@media (max-width: 640px) { .stage-checks { margin-left: 0; } }

/* Devis ---------------------------------------------------------------------- */

.quote-brouillon { --tone: var(--muted); }
.quote-envoye { --tone: var(--info); }
.quote-accepte { --tone: var(--success); }
.quote-refuse { --tone: var(--danger); }
.quote-remplace { --tone: var(--muted); }
.quote-expire { --tone: var(--warning); }
.table tr.is-muted td { opacity: 0.55; }

/* Document (aperçu, page client, impression) : toujours sur fond blanc. */
.quote-doc {
  --doc-ink: #17242c; --doc-muted: #5d6d78; --doc-line: #dfe5ea;
  background: #fff; color: var(--doc-ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: clamp(20px, 4vw, 48px); font-size: 0.92rem; line-height: 1.5;
  display: flex; flex-direction: column; gap: 22px;
}
.qd-pre { white-space: pre-line; }
.qd-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.qd-from, .qd-to { display: flex; flex-direction: column; gap: 1px; color: var(--doc-muted); }
.qd-company { color: var(--doc-ink); font: 700 1.15rem/1.3 var(--font-display); margin-bottom: 4px; }
.qd-kind { font: 700 1.9rem/1 var(--font-display); color: var(--brand); text-align: right; margin-bottom: 10px; letter-spacing: -0.01em; }
.qd-meta dl { margin: 0; display: grid; gap: 3px; }
.qd-meta dl div { display: flex; justify-content: space-between; gap: 16px; }
.qd-meta dt { color: var(--doc-muted); }
.qd-meta dd { margin: 0; font-weight: 600; }
.qd-to { align-self: flex-end; min-width: min(100%, 300px); padding: 14px 16px; border: 1px solid var(--doc-line); border-radius: 10px; }
.qd-to strong { color: var(--doc-ink); }
.qd-label { font-size: 0.72rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.qd-title { font-size: 1.15rem; color: var(--doc-ink); }
.qd-intro { color: var(--doc-ink); }
.qd-lines { width: 100%; border-collapse: collapse; }
.qd-lines th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--doc-muted); padding: 8px 10px; border-bottom: 2px solid var(--doc-ink); }
.qd-lines td { padding: 10px; border-bottom: 1px solid var(--doc-line); vertical-align: top; }
.qd-lines .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qd-designation { display: block; font-weight: 600; }
.qd-description { display: block; color: var(--doc-muted); font-size: 0.86rem; margin-top: 2px; }
.qd-section td { padding-top: 18px; font-weight: 700; color: var(--brand); border-bottom-color: var(--doc-line); }
.qd-text td { color: var(--doc-muted); font-style: italic; }
.qd-totals { align-self: flex-end; min-width: min(100%, 320px); }
.qd-totals dl { margin: 0; display: grid; gap: 4px; }
.qd-totals dl div { display: flex; justify-content: space-between; gap: 24px; font-variant-numeric: tabular-nums; }
.qd-totals dt { color: var(--doc-muted); }
.qd-totals dd { margin: 0; font-weight: 600; }
.qd-grand { margin-top: 6px; padding-top: 8px; border-top: 2px solid var(--doc-ink); font-size: 1.1rem; }
.qd-grand dt { color: var(--doc-ink) !important; font-weight: 700; }
.qd-vat-mention { margin-top: 8px; font-size: 0.82rem; color: var(--doc-muted); text-align: right; }
.qd-block h3 { font-size: 0.9rem; margin-bottom: 4px; }
.qd-terms { display: flex; flex-direction: column; gap: 6px; padding-top: 16px; border-top: 1px solid var(--doc-line); font-size: 0.8rem; color: var(--doc-muted); }
.qd-sign { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 14px; }
.qd-sign-box { width: min(100%, 300px); height: 90px; border: 1px dashed var(--doc-line); border-radius: 8px; }
.qd-accepted { align-items: flex-start; padding: 12px 16px; border: 1px solid #2e8a5f; border-radius: 8px; background: #f1f8f4; color: var(--doc-ink); }
.qd-accepted strong { color: #2e8a5f; }
.qd-proof { font-size: 0.74rem; color: var(--doc-muted); }
.qd-signature { display: block; max-width: 260px; max-height: 90px; margin: 4px 0; }

/* Zone de signature (page client) */
.signature-canvas {
  display: block; width: 100%; height: 180px; max-width: 560px;
  background: #fff; border: 1px dashed color-mix(in oklab, var(--brand) 45%, var(--line)); border-radius: var(--radius-sm);
  touch-action: none; cursor: crosshair;
}
.signature-tools { justify-content: space-between; max-width: 560px; }

/* Éditeur de lignes */
.sticky-aside { position: sticky; top: calc(var(--topbar-h) + 16px); }
.quote-editor { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.quote-editor th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.quote-editor th.num { text-align: right; }
.quote-editor td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.quote-editor input, .quote-editor select, .quote-editor textarea { min-height: 36px; padding: 6px 8px; }
.quote-editor textarea[name="line_description"] { margin-top: 4px; font-size: 0.85rem; min-height: 32px; }
.quote-editor td:first-child { min-width: 220px; }
.quote-editor select[name="line_unit"] { min-width: 108px; }
.quote-editor select[name="line_vat"] { min-width: 92px; }
.input-num { width: 100px; text-align: right; font-variant-numeric: tabular-nums; }
.quote-editor td.num { text-align: right; }
.qe-total { font-weight: 650; white-space: nowrap; padding-top: 16px !important; font-variant-numeric: tabular-nums; }
.qe-actions { white-space: nowrap; padding-top: 10px !important; }
.qe-actions .btn-icon { width: 30px; height: 30px; }
.qe-titre td { background: var(--brand-softer); }
.qe-title-input { font-weight: 650; }
.qe-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px clamp(16px, 2.4vw, 24px); }
.facts-grand { padding-top: 8px; border-top: 1px solid var(--line); font-size: 1.05rem; }
.facts-grand dt { color: var(--ink) !important; font-weight: 650; }

.link-box { border-color: color-mix(in oklab, var(--success) 40%, var(--line)); background: color-mix(in oklab, var(--success) 6%, var(--surface)); display: flex; flex-direction: column; gap: 10px; }
.link-box p { display: flex; gap: 8px; align-items: flex-start; }
.link-box input { min-height: 36px; font-size: 0.85rem; }

/* Page client (lien public) et version imprimable */
.sheet-body { background: var(--bg); }
.sheet { max-width: 920px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.sheet-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet-brand { font: 650 1rem/1.2 var(--font-display); }
.decision { display: flex; flex-direction: column; gap: 14px; }
.decision-refuse summary { cursor: pointer; color: var(--muted); }
.decision-refuse .form { margin-top: 10px; }

@media print {
  @page { margin: 14mm; }
  body, .sheet-body { background: #fff !important; }
  .topbar, .footer, .toasts, .no-print, .skip-link, .breadcrumb { display: none !important; }
  .sheet { max-width: none; padding: 0; }
  .quote-doc { border: 0; box-shadow: none; padding: 0; font-size: 10.5pt; }
  .qd-lines tr { break-inside: avoid; }
  .qd-totals, .qd-terms { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* Contrats ----------------------------------------------------------------- */

.contract-brouillon { --tone: var(--muted); }
.contract-actif { --tone: var(--success); }
.contract-resilie { --tone: var(--warning); }
.contract-termine { --tone: var(--muted); }
.btn.full { width: 100%; margin-bottom: 10px; }

/* Jauge de consommation (largeur par classe : pas de style en ligne avec la CSP) */
.meter { height: 10px; border-radius: var(--radius-pill); background: var(--bg); border: 1px solid var(--line); overflow: hidden; margin-bottom: 8px; }
.meter-bar { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), color-mix(in oklab, var(--brand) 60%, var(--accent))); transition: width var(--soft) var(--ease); }
.meter.is-over .meter-bar { background: var(--danger); }
.meter-0 { width: 0%; }
.meter-5 { width: 5%; }
.meter-10 { width: 10%; }
.meter-15 { width: 15%; }
.meter-20 { width: 20%; }
.meter-25 { width: 25%; }
.meter-30 { width: 30%; }
.meter-35 { width: 35%; }
.meter-40 { width: 40%; }
.meter-45 { width: 45%; }
.meter-50 { width: 50%; }
.meter-55 { width: 55%; }
.meter-60 { width: 60%; }
.meter-65 { width: 65%; }
.meter-70 { width: 70%; }
.meter-75 { width: 75%; }
.meter-80 { width: 80%; }
.meter-85 { width: 85%; }
.meter-90 { width: 90%; }
.meter-95 { width: 95%; }
.meter-100 { width: 100%; }

/* Tickets ------------------------------------------------------------------ */

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 0.88rem; font-weight: 520;
}
.chip:hover { border-color: color-mix(in oklab, var(--brand) 35%, var(--line)); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip-count { min-width: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--bg); color: var(--ink); font-size: 0.75rem; font-weight: 700; text-align: center; }
.chip-en_retard { background: var(--danger); color: #fff; }
.chip-a_trier { background: var(--warning); color: #fff; }
.chip-non_lus { background: var(--info); color: #fff; }
.chips-select { margin-left: auto; }
.chips-select select { min-height: 34px; padding: 4px 10px; width: auto; }
.unread-dot { display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; background: var(--info); vertical-align: middle; }

.ticket-head h1 { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.7rem); margin-bottom: 8px; }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.request-card { display: flex; flex-direction: column; gap: 6px; border-left: 3px solid var(--brand); }
.request-from { font-size: 0.9rem; }
.form-grid.compact { grid-template-columns: 1fr 1fr; gap: 10px; }

/* Choix du niveau d'urgence (création d'une demande) */
.urgency-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.urgency-choice {
  --tone: var(--muted);
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); border-left: 4px solid var(--tone); border-radius: var(--radius-sm); background: var(--surface);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.urgency-choice input { position: absolute; opacity: 0; pointer-events: none; }
.urgency-choice span { color: var(--muted); font-size: 0.85rem; }
.urgency-choice:has(input:checked) { background: color-mix(in oklab, var(--tone) 10%, var(--surface)); border-color: var(--tone); }
.urgency-choice:has(input:focus-visible) { box-shadow: var(--focus); }
.urgency-p1 { --tone: var(--danger); }
.urgency-p2 { --tone: var(--warning); }
.urgency-p3 { --tone: var(--info); }
.urgency-p4 { --tone: var(--success); }

/* Conversation façon messagerie */
.chat {
  display: flex; flex-direction: column; min-height: 420px; height: calc(100dvh - var(--topbar-h) - 230px);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in oklab, var(--brand) 5%, transparent) 0 2px, transparent 3px) 0 0 / 28px 28px,
    color-mix(in oklab, var(--bg) 70%, var(--surface));
}
.chat-list { flex: 1; overflow-y: auto; padding: 16px clamp(10px, 2vw, 20px); display: flex; flex-direction: column; gap: 6px; }
.chat-empty { margin: auto; color: var(--muted); }
.chat-day { display: flex; justify-content: center; margin: 10px 0 4px; }
.chat-day span { padding: 3px 12px; border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: 0.75rem; box-shadow: var(--shadow-sm); text-transform: capitalize; }
.chat-event { display: flex; justify-content: center; margin: 4px 0; }
.chat-event span { padding: 3px 10px; border-radius: 8px; background: color-mix(in oklab, var(--warning) 14%, var(--surface)); color: color-mix(in oklab, var(--warning) 70%, var(--ink)); font-size: 0.76rem; }
.chat-row { display: flex; }
.chat-row.is-mine { justify-content: flex-end; }
.bubble {
  position: relative; max-width: min(75%, 560px); padding: 7px 10px 6px; border-radius: 12px;
  background: var(--surface); box-shadow: 0 1px 1px rgb(16 32 44 / 10%); display: flex; flex-direction: column; gap: 2px;
}
.is-theirs .bubble { border-top-left-radius: 4px; }
.is-mine .bubble { border-top-right-radius: 4px; background: color-mix(in oklab, var(--brand) 16%, var(--surface)); }
.bubble-author { font-size: 0.76rem; font-weight: 650; color: var(--brand-ink); }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.93rem; line-height: 1.4; }
.bubble-meta { align-self: flex-end; font-size: 0.68rem; color: var(--muted); }
.chat-note {
  align-self: center; width: min(90%, 620px); padding: 8px 12px; border-radius: 10px;
  background: color-mix(in oklab, #f3c74b 18%, var(--surface)); border: 1px dashed color-mix(in oklab, #c99a12 55%, var(--line));
}
.chat-note-label { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 650; color: #8a6a0c; text-transform: uppercase; letter-spacing: 0.04em; }
.bubble-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.file-thumb { display: block; border-radius: 8px; overflow: hidden; background: var(--bg); }
.file-thumb img { display: block; max-width: 220px; max-height: 180px; object-fit: cover; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border-radius: 8px;
  background: color-mix(in oklab, var(--ink) 6%, var(--surface)); color: var(--ink); text-decoration: none; font-size: 0.85rem;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip small { color: var(--muted); }
.chat-files { list-style: none; margin: 0; padding: 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-files li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: var(--radius-pill); background: var(--brand-soft); font-size: 0.82rem; }
.chat-files button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 1rem; line-height: 1; }
.chat-attach { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--muted); cursor: pointer; }
.chat-attach:hover { background: var(--brand-softer); color: var(--ink); }
.chat-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.chat-attach:has(input:focus-visible) { box-shadow: var(--focus); }
.chat-composer { padding: 10px clamp(10px, 2vw, 16px) 8px; background: var(--surface); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.chat-mode { align-self: flex-start; }
.chat-mode label { padding: 4px 10px; font-size: 0.82rem; display: inline-flex; align-items: center; gap: 4px; }
.chat-composer:has(input[value="interne"]:checked) .chat-input textarea { background: color-mix(in oklab, #f3c74b 12%, var(--surface)); }
.chat-input { display: flex; align-items: flex-end; gap: 8px; }
.chat-input textarea { resize: none; min-height: 42px; max-height: 180px; border-radius: 22px; padding: 10px 16px; }
.chat-send {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); cursor: pointer; transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.chat-send:hover { background: var(--brand-strong); }
.chat-send:active { transform: scale(0.94); }
.chat-hint { font-size: 0.72rem; color: var(--muted); padding-left: 16px; }
@media (hover: none) { .chat-hint { display: none; } }

/* Page du client */
.ticket-public { max-width: 820px; }
.ticket-public .chat { height: min(70dvh, 640px); }
.ticket-public-head { display: flex; flex-direction: column; gap: 6px; }
.ticket-public-head h1 { font-size: 1.35rem; }
.validate-card { border-color: color-mix(in oklab, var(--warning) 45%, var(--line)); display: flex; flex-direction: column; gap: 10px; }
.validate-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.validate-actions form { margin: 0; }
.validate-not-yet > summary { list-style: none; }
.validate-not-yet > summary::-webkit-details-marker { display: none; }
.validate-not-yet .form { margin-top: 10px; min-width: min(100%, 420px); }
.center { text-align: center; }

/* Temps passé -------------------------------------------------------------- */

.time-counter { display: flex; flex-direction: column; gap: 10px; }
.time-counter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.time-today strong { font: 700 1.5rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.time-today.is-bumped strong { animation: pop var(--soft) var(--ease); }
.time-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.time-btn {
  min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  font: 650 0.9rem/1 var(--font-body); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.time-btn:active:not(:disabled) { transform: scale(0.96); }
.time-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.time-btn.plus { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.time-btn.plus:hover { background: color-mix(in oklab, var(--brand) 22%, var(--surface)); }
.time-btn.minus:hover:not(:disabled) { background: var(--brand-softer); }
.time-btn.quick { grid-column: 1 / -1; background: color-mix(in oklab, var(--warning) 12%, var(--surface)); border-color: transparent; color: color-mix(in oklab, var(--warning) 75%, var(--ink)); }
/* Repères de l'encart : ce ticket, client ce mois, outil, client */
.time-stats { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 0.86rem; }
.time-stats > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.time-stats dt { color: var(--muted); }
.time-stats dd { margin: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.time-stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.time-stats-month dd { min-width: 130px; }
.meter-sm { width: 100%; height: 6px; margin: 0; }
.month-nav { align-items: center; }
.month-label { min-width: 150px; text-align: center; text-transform: capitalize; }
.inline-edit { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-edit select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 0.86rem; }
.time-table td { vertical-align: middle; }

/* Cloche de notifications (en-tête) ---------------------------------------- */

.nav-tools + .bell-slot, .bell-slot { display: flex; align-items: center; }
.bell { position: relative; }
.bell > summary { list-style: none; }
.bell > summary::-webkit-details-marker { display: none; }
.bell-button {
  position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: var(--muted); cursor: pointer; transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.bell-button:hover, .bell[open] .bell-button { background: var(--brand-softer); color: var(--ink); }
.bell-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--danger); color: #fff; font: 700 0.68rem/18px var(--font-body); text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.bell-panel {
  position: absolute; top: calc(100% + 8px); right: -8px; z-index: 30; width: min(330px, calc(100vw - 32px));
  padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); animation: pop var(--fast) var(--ease);
}
.bell-title { font-size: 0.74rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 4px 8px 8px; }
.bell-empty { display: flex; align-items: center; gap: 8px; padding: 8px; color: var(--success); }
.bell-item { background: transparent; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: calc(var(--radius-sm) - 2px); color: var(--ink); text-decoration: none; font-size: 0.9rem; }
.bell-item:hover { background: var(--brand-softer); }
.bell-item-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; background: color-mix(in oklab, var(--tone, var(--muted)) 14%, var(--surface)); color: var(--tone, var(--muted)); }
.bell-item.tone-danger { --tone: var(--danger); }
.bell-item.tone-warning { --tone: var(--warning); }
.bell-item.tone-info { --tone: var(--info); }
@media (max-width: 860px) {
  .bell-slot { padding: 4px 12px; }
  .bell-panel { right: auto; left: 0; }
}

/* Outils et serveurs ----------------------------------------------------- */

.server-name { font-size: 1.15rem; font-weight: 650; color: var(--brand-ink); }
.instance-card { border-top: 3px solid var(--line); }
.instance-production { border-top-color: var(--success); }
.instance-recette { border-top-color: var(--warning); }
/* Clé d'API d'une instance */
.api-key { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; }
.api-key-title { margin: 0; font-size: 0.92rem; }
.api-key p { margin: 0; }
.api-key .alert { flex-direction: column; align-items: stretch; gap: 8px; }
.api-key-value { width: 100%; font-size: 0.8rem; }
.instance-delete { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }

.fallback-recap { width: 100%; margin: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 12px 14px; border-radius: 10px; background: var(--bg); }
.fallback-recap > div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.fallback-recap dt { color: var(--muted); }
.fallback-recap dd { margin: 0; overflow-wrap: anywhere; }
.fallback-contact a { white-space: nowrap; }

/* ==========================================================================
   Planning (ALX-0014). La position des éléments dans la grille passe par des
   classes (pl-r-N : ligne de départ, pl-h-N : hauteur en demi-heures), la
   politique de sécurité interdisant les styles en ligne.
   ========================================================================== */
.text-warning { color: color-mix(in oklab, var(--warning) 80%, var(--ink)); }
.btn-block { width: 100%; justify-content: center; }
.pl-nav { margin: -4px 0 12px; }
.pl-load { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pl-load-figures { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pl-load .meter { margin: 0; }

.pl-week { --pl-row: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.pl-head, .pl-body { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.pl-head { border-bottom: 1px solid var(--line); background: var(--bg); }
.pl-dayhead { display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; border-left: 1px solid var(--line); min-width: 0; font-size: 0.86rem; }
.pl-dayhead.is-today { background: color-mix(in oklab, var(--brand) 9%, var(--bg)); }
.pl-dayhead.is-today strong { color: var(--brand); }
.pl-avail-total { font-size: 0.75rem; }
.pl-times, .pl-col { display: grid; grid-template-rows: repeat(var(--pl-rows, 8), var(--pl-row)); }
.pl-col { border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% calc(var(--pl-row) * 2); }
.pl-col.is-today { background-color: color-mix(in oklab, var(--brand) 3%, var(--surface)); }
.pl-col > * { grid-column: 1; min-width: 0; }
.pl-hour { padding: 2px 6px 0 0; text-align: right; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-avail { background: color-mix(in oklab, var(--success, #2f855a) 10%, transparent); }
.pl-free { display: flex; align-items: flex-start; justify-content: center; padding-top: 3px; color: transparent; font-size: 0.72rem; text-decoration: none; border-radius: 6px; }
.pl-free:hover, .pl-free:focus-visible { color: var(--brand); background: color-mix(in oklab, var(--brand) 10%, transparent); outline: 1px dashed color-mix(in oklab, var(--brand) 45%, transparent); }
.pl-block {
  z-index: 1; margin: 1px 3px; padding: 3px 6px; border-radius: 6px; overflow: hidden; text-decoration: none; color: var(--ink);
  background: color-mix(in oklab, var(--brand) 18%, var(--surface)); border-left: 3px solid var(--brand);
  display: flex; flex-direction: column; gap: 1px; font-size: 0.78rem; line-height: 1.25;
}
.pl-block:hover { background: color-mix(in oklab, var(--brand) 26%, var(--surface)); }
.pl-block.kind-maintenance { background: color-mix(in oklab, var(--warning) 20%, var(--surface)); border-left-color: var(--warning); }
.pl-block.kind-autre { background: color-mix(in oklab, var(--muted) 14%, var(--surface)); border-left-color: var(--muted); }
.pl-block.is-done { opacity: 0.6; }
.pl-block.is-outside { border-left-style: dashed; }
.pl-block-time { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-block-title { font-weight: 600; overflow-wrap: anywhere; }
.pl-due {
  display: block; padding: 2px 6px; border-radius: 6px; font-size: 0.72rem; line-height: 1.3; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere;
}
.pl-due.is-unplanned { border-color: color-mix(in oklab, var(--warning) 60%, var(--line)); background: color-mix(in oklab, var(--warning) 12%, var(--surface)); }
.pl-due.is-late { border-color: color-mix(in oklab, var(--danger) 60%, var(--line)); background: color-mix(in oklab, var(--danger) 12%, var(--surface)); color: var(--danger); }
.pl-legend { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pl-legend .pl-due { display: inline-block; }

.pl-list { display: none; flex-direction: column; gap: 10px; }
.pl-list-day { display: flex; flex-direction: column; gap: 6px; }
.pl-list-day.is-today { border-color: var(--brand); }
.pl-list-item { margin: 0; padding: 8px 10px; }
.pl-list .pl-free { color: var(--brand); justify-content: flex-start; padding: 8px 10px; border: 1px dashed var(--line); font-size: 0.85rem; }

@media (max-width: 760px) {
  .pl-week { display: none; }
  .pl-list { display: flex; }
}

.pl-rules { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; }
.pl-rules li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pl-inline-form .row { flex-wrap: wrap; }
.pl-inline-form select, .pl-inline-form input[type="date"], .pl-inline-form input[type="text"] { width: auto; }

/* Accueil et fiches : aujourd'hui, blocs à venir */
.today-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.today-list .pl-block, .today-list .pl-due { margin: 0; }
.today-card { margin-bottom: 16px; }
.pl-plan-btn { margin-top: 8px; }

.pl-rows-1 { --pl-rows: 1; }
.pl-rows-2 { --pl-rows: 2; }
.pl-rows-3 { --pl-rows: 3; }
.pl-rows-4 { --pl-rows: 4; }
.pl-rows-5 { --pl-rows: 5; }
.pl-rows-6 { --pl-rows: 6; }
.pl-rows-7 { --pl-rows: 7; }
.pl-rows-8 { --pl-rows: 8; }
.pl-rows-9 { --pl-rows: 9; }
.pl-rows-10 { --pl-rows: 10; }
.pl-rows-11 { --pl-rows: 11; }
.pl-rows-12 { --pl-rows: 12; }
.pl-rows-13 { --pl-rows: 13; }
.pl-rows-14 { --pl-rows: 14; }
.pl-rows-15 { --pl-rows: 15; }
.pl-rows-16 { --pl-rows: 16; }
.pl-rows-17 { --pl-rows: 17; }
.pl-rows-18 { --pl-rows: 18; }
.pl-rows-19 { --pl-rows: 19; }
.pl-rows-20 { --pl-rows: 20; }
.pl-rows-21 { --pl-rows: 21; }
.pl-rows-22 { --pl-rows: 22; }
.pl-rows-23 { --pl-rows: 23; }
.pl-rows-24 { --pl-rows: 24; }
.pl-rows-25 { --pl-rows: 25; }
.pl-rows-26 { --pl-rows: 26; }
.pl-rows-27 { --pl-rows: 27; }
.pl-rows-28 { --pl-rows: 28; }
.pl-rows-29 { --pl-rows: 29; }
.pl-rows-30 { --pl-rows: 30; }
.pl-rows-31 { --pl-rows: 31; }
.pl-rows-32 { --pl-rows: 32; }
.pl-rows-33 { --pl-rows: 33; }
.pl-rows-34 { --pl-rows: 34; }
.pl-rows-35 { --pl-rows: 35; }
.pl-rows-36 { --pl-rows: 36; }
.pl-rows-37 { --pl-rows: 37; }
.pl-rows-38 { --pl-rows: 38; }
.pl-rows-39 { --pl-rows: 39; }
.pl-rows-40 { --pl-rows: 40; }
.pl-rows-41 { --pl-rows: 41; }
.pl-rows-42 { --pl-rows: 42; }
.pl-rows-43 { --pl-rows: 43; }
.pl-rows-44 { --pl-rows: 44; }
.pl-rows-45 { --pl-rows: 45; }
.pl-rows-46 { --pl-rows: 46; }
.pl-rows-47 { --pl-rows: 47; }
.pl-rows-48 { --pl-rows: 48; }
.pl-r-1 { grid-row-start: 1; }
.pl-r-2 { grid-row-start: 2; }
.pl-r-3 { grid-row-start: 3; }
.pl-r-4 { grid-row-start: 4; }
.pl-r-5 { grid-row-start: 5; }
.pl-r-6 { grid-row-start: 6; }
.pl-r-7 { grid-row-start: 7; }
.pl-r-8 { grid-row-start: 8; }
.pl-r-9 { grid-row-start: 9; }
.pl-r-10 { grid-row-start: 10; }
.pl-r-11 { grid-row-start: 11; }
.pl-r-12 { grid-row-start: 12; }
.pl-r-13 { grid-row-start: 13; }
.pl-r-14 { grid-row-start: 14; }
.pl-r-15 { grid-row-start: 15; }
.pl-r-16 { grid-row-start: 16; }
.pl-r-17 { grid-row-start: 17; }
.pl-r-18 { grid-row-start: 18; }
.pl-r-19 { grid-row-start: 19; }
.pl-r-20 { grid-row-start: 20; }
.pl-r-21 { grid-row-start: 21; }
.pl-r-22 { grid-row-start: 22; }
.pl-r-23 { grid-row-start: 23; }
.pl-r-24 { grid-row-start: 24; }
.pl-r-25 { grid-row-start: 25; }
.pl-r-26 { grid-row-start: 26; }
.pl-r-27 { grid-row-start: 27; }
.pl-r-28 { grid-row-start: 28; }
.pl-r-29 { grid-row-start: 29; }
.pl-r-30 { grid-row-start: 30; }
.pl-r-31 { grid-row-start: 31; }
.pl-r-32 { grid-row-start: 32; }
.pl-r-33 { grid-row-start: 33; }
.pl-r-34 { grid-row-start: 34; }
.pl-r-35 { grid-row-start: 35; }
.pl-r-36 { grid-row-start: 36; }
.pl-r-37 { grid-row-start: 37; }
.pl-r-38 { grid-row-start: 38; }
.pl-r-39 { grid-row-start: 39; }
.pl-r-40 { grid-row-start: 40; }
.pl-r-41 { grid-row-start: 41; }
.pl-r-42 { grid-row-start: 42; }
.pl-r-43 { grid-row-start: 43; }
.pl-r-44 { grid-row-start: 44; }
.pl-r-45 { grid-row-start: 45; }
.pl-r-46 { grid-row-start: 46; }
.pl-r-47 { grid-row-start: 47; }
.pl-r-48 { grid-row-start: 48; }
.pl-h-1 { grid-row-end: span 1; }
.pl-h-2 { grid-row-end: span 2; }
.pl-h-3 { grid-row-end: span 3; }
.pl-h-4 { grid-row-end: span 4; }
.pl-h-5 { grid-row-end: span 5; }
.pl-h-6 { grid-row-end: span 6; }
.pl-h-7 { grid-row-end: span 7; }
.pl-h-8 { grid-row-end: span 8; }
.pl-h-9 { grid-row-end: span 9; }
.pl-h-10 { grid-row-end: span 10; }
.pl-h-11 { grid-row-end: span 11; }
.pl-h-12 { grid-row-end: span 12; }
.pl-h-13 { grid-row-end: span 13; }
.pl-h-14 { grid-row-end: span 14; }
.pl-h-15 { grid-row-end: span 15; }
.pl-h-16 { grid-row-end: span 16; }
.pl-h-17 { grid-row-end: span 17; }
.pl-h-18 { grid-row-end: span 18; }
.pl-h-19 { grid-row-end: span 19; }
.pl-h-20 { grid-row-end: span 20; }
.pl-h-21 { grid-row-end: span 21; }
.pl-h-22 { grid-row-end: span 22; }
.pl-h-23 { grid-row-end: span 23; }
.pl-h-24 { grid-row-end: span 24; }
.pl-h-25 { grid-row-end: span 25; }
.pl-h-26 { grid-row-end: span 26; }
.pl-h-27 { grid-row-end: span 27; }
.pl-h-28 { grid-row-end: span 28; }
.pl-h-29 { grid-row-end: span 29; }
.pl-h-30 { grid-row-end: span 30; }
.pl-h-31 { grid-row-end: span 31; }
.pl-h-32 { grid-row-end: span 32; }
.pl-h-33 { grid-row-end: span 33; }
.pl-h-34 { grid-row-end: span 34; }
.pl-h-35 { grid-row-end: span 35; }
.pl-h-36 { grid-row-end: span 36; }
.pl-h-37 { grid-row-end: span 37; }
.pl-h-38 { grid-row-end: span 38; }
.pl-h-39 { grid-row-end: span 39; }
.pl-h-40 { grid-row-end: span 40; }
.pl-h-41 { grid-row-end: span 41; }
.pl-h-42 { grid-row-end: span 42; }
.pl-h-43 { grid-row-end: span 43; }
.pl-h-44 { grid-row-end: span 44; }
.pl-h-45 { grid-row-end: span 45; }
.pl-h-46 { grid-row-end: span 46; }
.pl-h-47 { grid-row-end: span 47; }
.pl-h-48 { grid-row-end: span 48; }

/* Fenêtre « Planifier » et panneau « À planifier » (ALX-0014) */
.dialog-wide { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.dialog-wide[open] { display: flex; flex-direction: column; }
.dialog-wide [data-remote-body] { display: flex; flex-direction: column; min-height: 0; }
.dialog-wide .plan-form { display: flex; flex-direction: column; min-height: 0; }
.plan-body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; color: var(--ink); }
.plan-page .dialog-foot { padding-inline: 0; }
.plan-page .plan-body { padding-inline: 0; }
.plan-target { margin: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); }
.slot-choice input { position: absolute; opacity: 0; pointer-events: none; }
.slot-choice span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); font-size: 0.9rem;
}
.slot-choice input:checked + span { border-color: var(--brand); background: color-mix(in oklab, var(--brand) 12%, var(--surface)); color: var(--brand); font-weight: 600; }
.slot-choice input:focus-visible + span { outline: 3px solid color-mix(in oklab, var(--brand) 40%, transparent); outline-offset: 2px; }
.slot-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-choice { cursor: pointer; }
.plan-for, .plan-other, .plan-new-client, .plan-rdv-deal { display: none; }
.plan-for { flex-direction: column; gap: 12px; }
.plan-form:has(input[name="pour"][value="ticket"]:checked) .for-ticket,
.plan-form:has(input[name="pour"][value="affaire"]:checked) .for-affaire,
.plan-form:has(input[name="pour"][value="rdv"]:checked) .for-rdv { display: flex; }
.plan-form:has(select[name="client_id"] option[value=""]:checked) .plan-new-client { display: grid; }
.plan-form:has(select[name="client_id"] option:not([value=""]):checked) .plan-rdv-deal { display: flex; }
.plan-form:has(input[name="slot"][value="autre"]:checked) .plan-other, .plan-other.is-visible { display: flex; }
.plan-other { flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.plan-other input[type="date"], .plan-other select { width: auto; }
.plan-notes summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.plan-notes textarea { margin-top: 6px; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-move { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.plan-foot { justify-content: space-between; }

.pl-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.pl-main { min-width: 0; }
.pl-todo { position: sticky; top: 76px; max-height: calc(100dvh - 96px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pl-todo-title { margin: 6px 0 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.pl-todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pl-todo-item {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: 0.86rem; background: var(--surface);
}
.pl-todo-item:hover { border-color: var(--brand); background: color-mix(in oklab, var(--brand) 5%, var(--surface)); }
.pl-todo-item.is-late { border-left: 3px solid var(--danger); }
.pl-todo-main { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; }
.pl-todo-label { font-weight: 600; overflow-wrap: anywhere; }
.pl-todo-meta { color: var(--muted); font-size: 0.76rem; }
.pl-todo-item.is-late .pl-todo-meta { color: var(--danger); }
.pl-block.kind-rendez_vous { background: color-mix(in oklab, var(--accent) 20%, var(--surface)); border-left-color: var(--accent); }
@media (max-width: 1100px) {
  .pl-layout { grid-template-columns: 1fr; }
  .pl-todo { position: static; max-height: none; order: -1; }
}

/* Facturation (ALX-0015) */
.bill-stats { margin-bottom: 16px; }
.bill-due { margin-bottom: 16px; }
.bill-client { padding: 12px clamp(16px, 2.4vw, 24px); border-top: 1px solid var(--line); }
.bill-client-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bill-client-head h3 { margin: 0; font-size: 1rem; flex: 1; min-width: 200px; }
.bill-client-head h3 a { color: inherit; text-decoration: none; }
.bill-items { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.bill-items li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; }
.bill-items strong, .bill-rows strong { font-variant-numeric: tabular-nums; }
.bill-lists { align-items: start; }
.bill-rows { list-style: none; margin: 0; padding: 0; }
.bill-rows li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px clamp(16px, 2.4vw, 24px); border-top: 1px solid var(--line); font-size: 0.9rem; }
.bill-rows li > a { flex: 1; min-width: 160px; color: inherit; text-decoration: none; }
.bill-rows li > a:hover { color: var(--brand); }
.bill-rows li.is-overdue { background: color-mix(in oklab, var(--danger) 6%, var(--surface)); }
.bill-line-form { display: grid; grid-template-columns: auto minmax(160px, 1fr) 70px 110px 100px auto auto; gap: 8px; align-items: center; }
.bill-line-form .num { text-align: right; }
.bill-new-line { padding: 12px clamp(16px, 2.4vw, 24px); border-top: 1px solid var(--line); grid-template-columns: auto minmax(160px, 1fr) 70px 110px auto; }
.bill-totals { margin: 0; padding: 12px clamp(16px, 2.4vw, 24px); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; border-top: 1px solid var(--line); }
.bill-totals > div { display: flex; gap: 16px; min-width: 240px; justify-content: space-between; }
.bill-totals dt { color: var(--muted); }
.bill-totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.bill-total dd { font-weight: 700; font-size: 1.1rem; }
.badge.invoice-brouillon { --tone: var(--muted); }
.badge.invoice-envoyee { --tone: var(--warning); }
.badge.invoice-payee { --tone: var(--success); }
@media (max-width: 760px) {
  .bill-line-form, .bill-new-line { grid-template-columns: 1fr 1fr; }
  .bill-line-form .badge, .bill-line-form input[name="label"] { grid-column: 1 / -1; }
}

/* Supervision (ALX-0016) */
.mon-table tr.is-muted td { color: var(--muted); }
.mon-table td { vertical-align: top; }
.mon-incident { display: block; margin-top: 4px; color: var(--danger); font-size: 0.82rem; }
.mon-small { font-size: 0.78rem; }
.mon-incidents { margin-top: 16px; }
.mon-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0 0; font-size: 0.86rem; color: var(--muted); }
.version-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; }
.version-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.version-list .notes { flex-basis: 100%; margin: 0; font-size: 0.88rem; }
.version-form { gap: 8px; }
.version-form input[name="version"] { width: 120px; }

/* Paramètres (ALX-0043, repris du template ALX-0038) ---------------------- */

/* Roue dentée de l'en-tête, juste avant la cloche « À faire ». */
.settings-slot { display: flex; align-items: center; }
.settings-link { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--soft) var(--ease); }
.settings-link:hover, .settings-link.is-active { background: var(--brand-softer); color: var(--ink); }
.settings-link:hover .icon { transform: rotate(45deg); transition: transform var(--soft) var(--ease); }
@media (max-width: 860px) { .settings-slot { padding: 4px 12px; } }

/* Logo choisi dans Paramètres : à la place de l'initiale. */
/* Le logo garde ses proportions : aussi haut que possible dans la barre, sans cadre. */
.brand-mark.has-logo { display: block; width: auto; height: auto; max-width: none; padding: 0; border-radius: 0; background: none; box-shadow: none; }
/* Hauteur explicite : une hauteur en % n'est pas appliquée à l'image dans ce bloc. */
.brand-mark.has-logo img { display: block; height: calc(var(--topbar-h) - 18px); width: auto; max-width: 220px; object-fit: contain; }
/* Logo sur fond blanc : en mode clair, le blanc se fond dans l'en-tête ; en mode
   sombre, petite plaque blanche pour qu'il reste lisible. */
.brand-mark.has-logo img { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
  .brand-mark.has-logo { padding: 3px 8px; border-radius: 8px; background: #ffffff; }
  .brand-mark.has-logo img { mix-blend-mode: normal; height: calc(var(--topbar-h) - 24px); }
}
.brand:hover .brand-mark.has-logo { transform: none; }
@media (max-width: 860px) { .brand-mark.has-logo img { height: calc(var(--topbar-h) - 24px); max-width: 150px; } }

/* Confirmation intégrée : un premier clic dévoile le vrai bouton. */
.confirm-delete summary { list-style: none; cursor: pointer; display: inline-flex; }
.confirm-delete summary::-webkit-details-marker { display: none; }
.confirm-delete[open] summary { display: none; }

/* Paramètres › Visuel (ALX-0038) */
a.tab { text-decoration: none; display: inline-flex; align-items: center; }
.settings-tabs { margin-bottom: calc(var(--space-2) * -1); }
.logo-field { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.logo-preview { width: 72px; height: 72px; font-size: 28px; flex: none; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.color-field { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.color-field.is-custom { border-color: color-mix(in oklab, var(--info) 35%, var(--line)); }
.color-field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.color-field-inputs { display: flex; align-items: center; gap: 8px; }
.color-field-inputs input[type="color"] { width: 46px; height: 38px; padding: 2px; border-radius: 10px; cursor: pointer; flex: none; }
.color-field-hex { max-width: 110px; }
.color-sample { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 34px; }
.sample-tab { padding: 4px 12px; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; font-size: 0.86rem; }
.sample-accent { --tone: var(--accent); }
.sample-topbar { padding: 6px 14px; border-radius: 8px; background: var(--topbar-bg, var(--ink)); color: #f2f6fa; font-weight: 600; font-size: 0.86rem; }
.swatches { display: inline-flex; gap: 4px; margin-left: auto; }
.swatch { display: inline-block; width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.swatch-brand-strong { background: var(--brand-strong); }
.swatch-brand-soft { background: var(--brand-soft); }
.swatch-brand-softer { background: var(--brand-softer); }
.swatch-bg { background: var(--bg); }
.swatch-halo1 { background: var(--halo-1); }
.swatch-halo2 { background: var(--halo-2); }
.background-preview {
  display: grid; place-items: center; height: 120px; margin-bottom: var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: radial-gradient(420px 160px at 8% -20%, var(--halo-1), transparent 70%), radial-gradient(380px 160px at 96% -10%, var(--halo-2), transparent 65%), var(--bg);
}
.background-preview-card { padding: 10px 18px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 600; }
.settings-actions { position: sticky; bottom: 0; z-index: 5; align-items: center; padding: 12px var(--card-pad); border-radius: var(--radius); background: color-mix(in oklab, var(--surface) 92%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-md); border-top: 0; }
.settings-actions .muted { margin-right: auto; font-size: 0.86rem; }
.styleguide-themes { margin-top: 12px; }
