/* =====================================================================================
   Charte graphique « Maison » — sobre, chaleureuse, intemporelle. Voir docs/charte-graphique.md
   Ivoire, beige, brun espresso, bordeaux. Titres en serif, traits fins, pas d'ombres.
   La couleur d'accent (--brand) est injectée depuis branding/brand.yaml.
   ===================================================================================== */
:root {
  --brand: #6B2232;
  --brand-hover: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 8%, #FBF8F2);
  --brand-ring: color-mix(in srgb, var(--brand) 22%, transparent);
  --accent-text: var(--brand);          /* liens et éléments actifs */
  --on-brand: #FBF8F2;                  /* texte sur fond bordeaux */

  color-scheme: light;
  --bg: #F7F3EC;          /* blanc cassé */
  --surface: #FFFDF9;     /* cartes : blanc cassé plus clair */
  --surface-2: #EFE8DC;   /* lin : en-têtes de tableaux, survols */
  --border: #D9CDBA;
  --border-strong: #B9A890;
  --text: #17110D;        /* brun presque noir : contraste maximal */
  --text-2: #33271F;
  --muted: #54453A;       /* textes secondaires : reste très lisible (contraste > 7:1) */

  --success: #3B4A2A; --success-bg: #E9EDDD; --success-bd: #B9C49C;   /* olive */
  --warning: #683C0D; --warning-bg: #F5E6CC; --warning-bd: #D9B47A;   /* caramel */
  --danger:  #7E2020; --danger-bg:  #F4DEDA; --danger-bd:  #D9A79E;   /* brique */
  --info:    #4E3A2C; --info-bg:    #ECE2D3; --info-bd:    #CDB99D;   /* taupe */
  --neutral: #4F463E; --neutral-bg: #EAE3D8; --neutral-bd: #D2C6B5;

  --radius: 6px;
  --radius-sm: 4px;
  --shadow: none;
  --shadow-lg: 0 16px 40px -12px rgba(43, 33, 27, .25);
  --sidebar: 320px;       /* assez large pour lire chaque titre du menu en entier, même dans une section dépliée */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
}

/* Pas de mode sombre : l'interface reste en blanc cassé, quel que soit le réglage de l'appareil. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Structure ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-head { padding: 24px 22px 14px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font: 600 19px/1 var(--serif); }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 3px; }
.account { margin: 4px 14px 10px; padding: 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; gap: 11px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 600 13px var(--serif); letter-spacing: .04em; color: var(--on-brand); background: var(--brand); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
.account-name { font: 600 15px/1.25 var(--serif); }
.account-sub { color: var(--muted); font-size: 12px; }
.nav { padding: 4px 12px 18px; flex: 1; }
.nav-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); padding: 18px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; border-left: 2px solid transparent; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--accent-text); border-left-color: var(--brand); font-weight: 600; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; min-width: 22px; text-align: center; padding: 0 7px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); }
.nav .nav-tag { margin-left: auto; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 0 6px; border-radius: 4px; background: var(--neutral-bg); color: var(--muted); }
.nav .count.alert { background: var(--brand); color: var(--on-brand); }
/* Menu par services : sections pliables (une par département de l'entreprise) */
.nav-group { margin: 2px 0; }
.nav-group > summary { list-style: none; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 600; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--surface-2); }
.nav-group > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.nav-group > summary .nav-group-title { flex: 1; min-width: 0; }
.nav-group > summary::after { content: ""; width: 7px; height: 7px; flex: none; margin: 0 5px 0 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease; }
.nav-group[open] > summary::after { transform: rotate(45deg); }
.nav-group[open] > summary .count { display: none; }
.nav-group[data-active] > summary { color: var(--accent-text); }
.nav-items { margin: 0 0 6px 17px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 10px 10px 3px; }
@media (prefers-reduced-motion: reduce) { .nav-group > summary::after { transition: none; } }
.sidebar-foot { padding: 14px 22px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font: italic 13px var(--serif); }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { max-width: 1120px; margin: 0 auto; padding: 36px 40px 64px; }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: 30px; line-height: 1.2; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.breadcrumb { font-size: 13px; margin-bottom: 12px; display: inline-flex; align-items: center; gap: 6px; }
h2 { font-size: 20px; margin: 34px 0 14px; }

/* ---------- Cartes & grilles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-body { padding: 20px 22px; }
.card-head { padding: 15px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: 17px; }
.card + .card { margin-top: 16px; }
.grid > .card, .stack > .card { margin-top: 0; }
.stack > .card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.kpi { padding: 18px 20px; }
.kpi .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.kpi .value { font: 600 30px/1.2 var(--serif); margin-top: 6px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 14px; padding: 13px 22px; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list a.row-link { display: flex; align-items: center; gap: 14px; color: inherit; width: 100%; }
.list a.row-link:hover { text-decoration: none; }
.list a.row-link:hover .strong { color: var(--accent-text); }
.list .grow { flex: 1; min-width: 0; }
.list .num { font: 600 18px var(--serif); }
.icon-box { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); color: var(--info); flex: none; }

/* ---------- Texte utilitaire ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.right { text-align: right; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- Badges de statut ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid; line-height: 1.7; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.badge.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-bd); }
.badge.danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-bd); }
.badge.info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-bd); }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-bd); }
.tag { display: inline-block; padding: 0 8px; border-radius: var(--radius-sm); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 14px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }

/* ---------- Formulaires ---------- */
.field { display: block; }
.field > span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-style: italic; }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 14px/1.5 var(--font);
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
/* Champs : chacun prend la place que son contenu mérite (date, montant, code = étroits ; texte moyen = double ; texte long = pleine largeur). */
.form-grid, .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 18px; align-items: start; }
.form-grid .full, .fields .full { grid-column: 1 / -1; }
.form-grid .wide, .fields .wide { grid-column: span 2; }
@media (max-width: 520px) { .form-grid .wide, .fields .wide { grid-column: 1 / -1; } }
.checkbox { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* Interrupteur */
/* Interrupteur : piste 46×26, pastille 20×20 centrée au pixel près (3 px de marge de chaque côté, en haut comme en bas). */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 46px; height: 26px; margin: 0; left: 0; top: 50%; transform: translateY(-50%); cursor: pointer; }
.switch .track { flex: none; display: block; box-sizing: border-box; width: 46px; height: 26px; border-radius: 13px; background: var(--border-strong); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; box-sizing: border-box; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(23, 17, 13, .35); transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--brand-ring); }
.switch input:disabled + .track { opacity: .6; }
.switch-text { min-width: 5.6em; }

/* Sélecteur de droits (3 états) */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 4px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-ring); }
.segmented input:checked + span.auto { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.segmented input:checked + span.validation { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.segmented input:checked + span.interdit { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.perm-row .what { flex: 1 1 220px; }

.steps { margin: 0 0 16px; padding-left: 22px; line-height: 1.7; }
.steps li { margin-bottom: 4px; }

/* Choix de droits : trois gros boutons explicites (icône + mots simples), lisibles sans formation */
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label > span { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: var(--radius); border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 600; }
.choice label > span .icon { width: 18px; height: 18px; flex: none; }
.choice label:hover > span { border-color: var(--text-2); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-ring); }
.choice input:checked + span.auto { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.choice input:checked + span.validation { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.choice input:checked + span.interdit { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.choice input:checked + span { box-shadow: inset 0 0 0 1px currentColor; }
.perm-title { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
@media (max-width: 640px) { .choice { width: 100%; } .choice label { flex: 1 1 30%; } .choice label > span { justify-content: center; padding: 0 8px; flex-direction: column; gap: 2px; padding-block: 8px; text-align: center; font-size: 13px; } }

.advanced { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.trust { margin-bottom: 18px; }
.trust-head { display: flex; gap: 14px; align-items: flex-start; }
.trust-head h2 { margin: 0 0 4px; font-size: 19px; }
.trust-head p { margin: 0; }
.trust-icon { width: 30px; height: 30px; flex: none; color: var(--brand); }
.trust-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Pastille d'un employé */
.person { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--person, var(--brand)); color: #FBF8F2; font: 600 16px var(--serif); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.person.lg { width: 46px; height: 46px; font-size: 21px; }

/* ---------- Devis & factures : lignes du formulaire ---------- */
.lines-head, .lines-row { display: grid; grid-template-columns: minmax(0, 3fr) 70px 80px 100px 84px; gap: 8px; }
.lines-head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.lines-row { margin-bottom: 8px; }
.table tfoot td { border-top: 1px solid var(--border); padding-top: 9px; padding-bottom: 9px; }
@media (max-width: 640px) { .lines-head { display: none; } .lines-row { grid-template-columns: 1fr 1fr; padding: 10px 0; border-top: 1px solid var(--border); } .lines-row input:first-child { grid-column: 1 / -1; } }

/* ---------- Console : clients en cartes ---------- */
.cards-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 22px 0 14px; }
.cards-bar input[type="search"] { flex: 1 1 240px; max-width: 360px; }
.cards-sort { display: flex; align-items: center; gap: 8px; }
.cards-sort select { width: auto; }
.client-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.client-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.client-card.has-alert { border-color: var(--danger); }
.client-card[data-dialog] { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.client-card[data-dialog]:hover, .client-card[data-dialog]:focus-visible { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(60, 30, 20, .13); border-color: var(--border-strong, var(--border)); }
.client-card[data-dialog]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.client-card[data-dialog]:active { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .client-card[data-dialog] { transition: none; } .client-card[data-dialog]:hover { transform: none; } }
.client-dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(680px, calc(100vw - 28px)); max-height: min(86vh, 900px); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(40, 20, 12, .35); overflow: hidden; }
.client-dialog[open] { display: flex; flex-direction: column; animation: dlg-in .18s ease; }
.client-dialog::backdrop { background: rgba(35, 22, 16, .5); backdrop-filter: blur(2px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .client-dialog[open] { animation: none; } }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; font: 600 24px var(--serif); }
.dlg-status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dlg-body { padding: 14px 22px 6px; overflow-y: auto; display: grid; gap: 18px; }
.dlg-body section h3 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.dlg-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px 18px; }
.dlg-line { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; }
.dlg-line:first-of-type { border-top: 0; }
.dlg-options { list-style: none; margin: 6px 0 0; padding: 0; }
.dlg-options li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.dlg-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
.dlg-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 4px 0; }
.dlg-table td { padding: 5px 0; border-top: 1px solid var(--border); }
.dlg-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dlg-note { margin-top: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13.5px; white-space: pre-wrap; }
.dlg-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.client-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.client-name { font: 600 18px var(--serif); color: var(--text); }
.client-name:hover { color: var(--accent-text); text-decoration: none; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.m-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.m-value { font: 600 21px var(--serif); font-variant-numeric: tabular-nums; }
.budget-bar { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-bottom: 4px; }
.budget-bar span { display: block; height: 100%; background: var(--success); }
.budget-bar span.low { background: var(--danger); }
.spark { width: 100%; height: 30px; fill: var(--brand); opacity: .75; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.opt.on { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.opt.off { background: transparent; color: var(--muted); border-color: var(--border); border-style: dashed; text-decoration: line-through; opacity: .8; }
.opt.open { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.opt.pack { background: var(--info-bg); color: var(--info); border-color: var(--info-bd); }
.client-card footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.alerts { display: flex; gap: 6px; flex-wrap: wrap; }
.option-rows { display: grid; gap: 4px; }
.option-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Le bureau : plan 2D (léger) et vue 3D ---------- */
.office-modes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mode-btn { height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: 600 13.5px var(--font); cursor: pointer; }
.mode-btn:hover { border-color: var(--text-2); }
.mode-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.mode-btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.office[data-mode="2d"] .office-stage { display: none; }
.office[data-mode="3d"] .org { display: none; }
/* Organigramme : vous → départements → employés (traits de liaison en CSS pur) */
/* .org défile dans sa propre zone si elle est vraiment trop étroite : il ne déborde jamais sur le menu latéral */
.org { display: block; overflow-x: auto; padding: 8px 0 4px; --line: var(--border-strong); }
.org-tree { display: flex; flex-direction: column; align-items: center; width: 100%; min-width: min-content; }
.office { container: org / inline-size; }   /* le conteneur est le parent : une règle @container ne peut pas styler son propre conteneur */
.org-node { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 8px; background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius); font-size: 14px; text-align: center; max-width: 100%; overflow-wrap: break-word; }
.org-node-boss { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.org-node-boss .muted { color: var(--on-brand); opacity: .9; }
.org-boss { position: relative; padding-bottom: 22px; }
.org-boss::after { content: ""; position: absolute; left: 50%; bottom: 0; height: 22px; border-left: 2px solid var(--line); }
.org-depts { display: flex; justify-content: center; width: 100%; }
.org-dept { position: relative; flex: 1 1 0; min-width: 140px; max-width: 280px; padding: 22px 5px 0; display: flex; flex-direction: column; align-items: center; }
.org-dept::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 2px solid var(--line); }
.org-dept:first-child::before { left: 50%; } .org-dept:last-child::before { right: 50%; } .org-dept:only-child::before { display: none; }
.org-dept::after { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--line); }
.org-people { position: relative; display: flex; flex-direction: column; gap: 8px; padding-top: 18px; align-items: stretch; width: 100%; }
.org-people::before { content: ""; position: absolute; left: 50%; top: 0; height: 18px; border-left: 2px solid var(--line); }
.chip { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; padding: 6px 10px 6px 6px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text); font: inherit; cursor: pointer; }
.chip:hover { border-color: var(--text-2); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.chip.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); }
.chip-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.25; overflow-wrap: anywhere; }
.chip-state { font-size: 12px; color: var(--muted); }
.chip[data-state="travail"] { border-color: var(--warning); }
.chip[data-state="attente"] { border-color: var(--warning); background: var(--warning-bg); }
.chip[data-state="erreur"] { border-color: var(--danger); background: var(--danger-bg); }
.chip[data-state="pause"] { opacity: .8; border-style: dashed; }
.chip .person { width: 30px; height: 30px; font-size: 14px; }
.chip-job { font-size: 12px; color: var(--text-2); }
/* Téléphone seulement (zone < 620 px) : l'arbre se met en colonne, un seul trait à gauche.
   Mesuré sur la largeur de la zone (container query), pas sur celle de la fenêtre. Sur ordinateur l'arbre reste horizontal. */
@container org (max-width: 620px) {
  .org-tree { align-items: stretch; min-width: 0; }
  .org-boss { align-self: flex-start; padding-bottom: 14px; }
  .org-boss::after { left: 24px; height: 14px; }
  .org-depts { flex-direction: column; border-left: 2px solid var(--line); margin-left: 24px; padding-left: 0; width: auto; }
  .org-dept { max-width: none; padding: 14px 0 0 18px; align-items: flex-start; }
  .org-dept::before { top: 14px; left: 0; right: auto; width: 18px; border-top: 2px solid var(--line); }
  .org-dept:first-child::before, .org-dept:last-child::before { left: 0; right: auto; }
  .org-dept::after, .org-people::before { display: none; }
  .org-people { padding-top: 8px; padding-left: 6px; }
}

.office-stage { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: #EFE7D8; }
#office-canvas { display: block; width: 100%; height: clamp(360px, 56vw, 620px); touch-action: pan-y; cursor: grab; }
#office-canvas:active { cursor: grabbing; }
#office-canvas:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: -3px; }
.office-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 70%; }
.office-tools .btn { min-width: 34px; font-size: 15px; background: rgba(255, 253, 249, .92); }
.office-hint { position: absolute; left: 12px; bottom: 8px; margin: 0; font-size: 12px; color: var(--muted); background: rgba(255, 253, 249, .85); padding: 2px 8px; border-radius: var(--radius-sm); }
.roster { list-style: none; margin: 18px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.roster-item { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--text); }
.roster-item:hover { border-color: var(--border-strong); }
.roster-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.roster-item.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); background: var(--brand-soft); }
.office-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
@media (max-width: 640px) { #office-canvas { height: min(128vw, 580px); } .office-tools .btn { height: 30px; padding: 0 9px; font-size: 13px; } .office-hint { display: none; } .office-tools { max-width: 100%; left: 10px; } .roster { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .switch .track, .switch .track::after { transition: none; } }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 11px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table a.cell-link { color: var(--text); font-weight: 600; }
.table a.cell-link:hover { color: var(--accent-text); }

/* ---------- Filtres ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 2px; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; padding: 8px 12px; color: var(--text-2); font-size: 13.5px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -3px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--brand); }
.tabs .n { margin-left: 6px; font-weight: 500; opacity: .75; }

/* ---------- Messages & états vides ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 20px; font-size: 14px; }
.alert.success { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.alert.info { color: var(--info); background: var(--info-bg); border-color: var(--info-bd); }
.alert.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-bd); }
.alert.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-bd); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; margin-bottom: 10px; color: var(--border-strong); }
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; font: 600 17px var(--serif); }

.progress { height: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); }
.progress.warn > div { background: var(--warning); }

.timeline { border-left: 1px solid var(--border-strong); margin-left: 6px; padding-left: 18px; }
.timeline .step { position: relative; padding-bottom: 16px; }
.timeline .step::before { content: ""; position: absolute; left: -23px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); }
.timeline .step.agent::before { border-color: var(--brand); background: var(--brand-soft); }
.timeline .step.tool::before { border-color: var(--success); background: var(--success-bg); }
.code { font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; }
.mail-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.7; }
dl.props { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; margin: 0; font-size: 14px; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Radar de prospection ---------- */
.radar { position: relative; width: 100%; max-width: 460px; aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-strong); overflow: visible; }
.radar svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.radar .ring { fill: none; stroke: var(--border-strong); stroke-width: .5; stroke-dasharray: 1.5 2; }
.radar .ring.outer { stroke-dasharray: none; stroke: var(--border); }
.radar .spoke { stroke: var(--border); stroke-width: .5; }
.radar .ring-label { font: 5px var(--font); fill: var(--muted); }
.radar .sector-label { font: 600 7px var(--serif); fill: var(--brand); }
.radar-beam { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from -50deg, transparent 0deg, color-mix(in srgb, var(--brand) 22%, transparent) 50deg, transparent 50.5deg); }
.radar-beam::after { content: ""; position: absolute; left: 50%; top: 0; width: 1.5px; height: 50%; margin-left: -.75px;
  background: linear-gradient(to top, transparent, color-mix(in srgb, var(--brand) 70%, transparent)); }
.radar.static .radar-beam { display: none; }
.radar-center { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--brand); }
.blip { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); opacity: .55; transition: opacity .6s, transform .2s; z-index: 2; }
.blip.prospect { background: var(--brand); }
.blip.lead { background: var(--success); }
.blip:hover, .blip:focus-visible, .blip.selected { opacity: 1; transform: scale(1.35); outline: none; z-index: 4; }
.blip.selected { box-shadow: 0 0 0 2px var(--text); }
.blip.ping { animation: blip-ping 2.6s ease-out; }
@keyframes blip-ping {
  0% { opacity: 1; box-shadow: 0 0 0 1px var(--border-strong), 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); }
  35% { opacity: 1; box-shadow: 0 0 0 1px var(--border-strong), 0 0 0 10px transparent; }
  100% { opacity: .55; }
}
.radar.static .blip { opacity: 1; }
.radar-legend { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; font-size: 13px; }
.radar-legend li { display: flex; gap: 8px; align-items: baseline; }
.sector-n { font: 600 13px var(--serif); color: var(--brand); min-width: 14px; }
.radar-keys { display: grid; gap: 8px; margin-top: 16px; font-size: 13px; }
.radar-keys span { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.prospect { background: var(--brand); }
.dot.lead { background: var(--success); }
.score { font-variant-numeric: tabular-nums; }

/* ---------- Chaîne de raisonnement (attribution) ---------- */
.chain { position: relative; margin: 0; padding: 0; list-style: none; }
.chain > li { position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding-bottom: 18px; }
.chain > li::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 1px; background: var(--border-strong); }
.chain > li:last-child::before { display: none; }
.chain .node { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  border: 1px solid var(--border-strong); color: var(--info); position: relative; z-index: 1; }
.chain .node.ok { border-color: var(--success-bd); background: var(--success-bg); color: var(--success); }
.chain .node.ko { border-color: var(--danger-bd); background: var(--danger-bg); color: var(--danger); }
.chain .node.decision { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chain .step-title { font-weight: 600; }
.chain .step-meta { font-size: 12px; color: var(--muted); }
.chain .evidence { margin-top: 6px; padding: 8px 12px; border-left: 2px solid var(--border-strong); background: var(--surface-2);
  font: italic 14px/1.55 var(--serif); color: var(--text-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.chain .source { font-size: 12.5px; word-break: break-all; }
.criteria-list { list-style: none; margin: 0; padding: 0; }
.criteria-list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.criteria-list li:first-child { border-top: 0; }
.criteria-list .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; }
.criteria-list .mark.ok { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); }
.criteria-list .mark.ko { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-bd); }
.gauge { display: flex; align-items: baseline; gap: 6px; }
.gauge .big { font: 600 44px/1 var(--serif); }

/* ---------- Boîtes mail ---------- */
.mailboxes { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.mailbox { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.mailbox .provider { display: flex; align-items: center; gap: 10px; }
.provider-mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--serif);
  color: var(--on-brand); flex: none; }
.provider-mark.gmail { background: #8E3B2E; } .provider-mark.outlook { background: #4B5A43; }
.provider-mark.icloud { background: #6F655C; } .provider-mark.yahoo { background: #7A5230; } .provider-mark.imap { background: #4E3A2C; }
.provider-choice { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.provider-choice a { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-weight: 600; }
.provider-choice a:hover { border-color: var(--brand); text-decoration: none; }
.steps-help { margin: 0; padding-left: 20px; font-size: 14px; }
.steps-help li { margin-bottom: 6px; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 410px; border-top: 3px solid var(--brand); }
.login .avatar { width: 56px; height: 56px; font-size: 19px; margin: 0 auto 16px; }
.login h1 { text-align: center; font-size: 26px; margin: 0; }
.login .powered { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font: italic 13px var(--serif); margin-top: 22px; }
.login .powered img { width: 18px; height: 18px; border-radius: 2px; }
.login:has(.dev-credentials) { grid-template-rows: 1fr auto; }
.login .dev-credentials { align-self: end; justify-self: stretch; margin: 24px -24px -24px; padding: 12px 24px; text-align: center; font-size: 14px; line-height: 1.7;
  color: var(--warning); background: var(--warning-bg); border-top: 1px solid var(--warning-bd); }
.login .dev-credentials strong { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.login .dev-credentials code { font-weight: 700; user-select: all; }

/* ---------- Mobile ---------- */
.nav-toggle { display: none; }
.scrim { display: none; }
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { max-width: 90vw; position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .layout .sidebar { transform: none; }
  .nav-toggle:checked ~ .layout .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(43, 33, 27, .4); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar .title { font: 600 17px var(--serif); flex: 1; min-width: 0; }
  .topbar label, .topbar a.btn { flex: none; }
  .content { padding: 20px 16px 48px; }
  .page-head { margin-bottom: 20px; padding-bottom: 14px; }
  .page-head h1 { font-size: 25px; }
  .grid-2, .grid-aside, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-mobile { display: none !important; }
  dl.props { grid-template-columns: 1fr; gap: 2px; }
  dl.props dd { margin-bottom: 8px; }
  .list > li, .card-body { padding-left: 16px; padding-right: 16px; }
  .table th, .table td { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 420px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Radar commun : reperes compacts, details hors du cercle. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.commercial-radar { align-items: start; }
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; pointer-events: none; }
.radar-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }   /* le cercle prend toute la largeur ; filtres et critères dessous */
.radar-stage { min-width: 0; }
.radar-card .radar { max-width: min(100%, 460px, max(300px, calc(100vh - 380px))); }   /* tient dans la hauteur de l'écran : pas de défilement pour voir tout le cercle */
.radar-side { min-width: 0; }
.radar-controls { display: grid; grid-template-columns: auto minmax(220px, 420px); justify-content: space-between; align-items: center; gap: 12px 24px; margin-bottom: 16px; }
.radar-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.radar-filters .active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.radar-search { margin: 0; }
.radar-summary { margin: 0 0 18px; text-align: center; font-variant-numeric: tabular-nums; }
.radar-card .card-head { flex-wrap: wrap; gap: 6px 12px; }
.radar-card .radar-keys { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.radar-criteria { border-top: 1px solid var(--border); padding-top: 12px; }
.radar-criteria-title { font-size: 13px; font-weight: 600; }
.radar-criteria .radar-legend { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 12px; }
.radar-side .radar-keys { margin-top: 0; }
.radar-side > p { margin: 12px 0 18px; }
.radar .blip { width: 18px; height: 18px; margin: -9px 0 0 -9px; opacity: .8; }
.radar .blip::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; }
.radar .blip.cluster { width: 32px; height: 32px; margin: -16px 0 0 -16px; color: var(--on-brand); font: 600 12px var(--font); opacity: 1; }
.radar .blip.negotiation, .dot.negotiation { background: var(--warning); }
.radar .blip.mixed { background: var(--info); }
.radar .blip:hover, .radar .blip:focus-visible, .radar .blip.selected { transform: scale(1.12); }
.radar .blip:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
.radar-panel { min-width: 0; }
.radar-panel .card-head { flex-wrap: wrap; gap: 8px; }
.radar-detail-grid.with-list { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 20px 40px; align-items: start; }
.radar-group { min-width: 0; }
.radar-group-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.radar-contact-list { max-height: 225px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.radar-contact { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.radar-contact:last-child { border-bottom: 0; }
.radar-contact.active, .radar-contact:hover { background: var(--brand-soft); }
.radar-contact small { display: block; color: var(--muted); font-size: 11px; }
.radar-contact-detail { overflow-wrap: anywhere; }
.radar-contact-detail h3 { font-size: 22px; margin: 6px 0 16px; }
.radar-contact-detail p { margin: 4px 0 0; }
.radar-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 40px; max-width: 720px; }
.radar-contact-detail .progress { margin: 6px 0; }
.radar-contact-detail .btn { margin-top: 18px; white-space: normal; }
.commercial-tabs { margin-top: 28px; }

/* Tous les tableaux partagent le meme editeur de colonnes. */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.table-configured [data-column-visible='true'] { display: table-cell !important; }
.table-configured [data-column-visible='false'] { display: none !important; }
.column-dialog { padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; box-shadow: var(--shadow-lg); }
.column-dialog::backdrop { background: rgba(43,33,27,.4); }
.column-dialog .card-head { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.column-dialog .card-body > p:first-child { margin-top: 0; }
.column-options { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.column-option { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.column-option:last-child { border-bottom: 0; }
.column-option label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
.column-option input { width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.column-move { min-width: 34px; min-height: 34px; }
.column-move:disabled { opacity: .3; cursor: default; }
.column-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }

/* ---------- Diagramme de flux du parcours commercial ---------- */
.flow-card { --tone-0: #8C4A2F; --tone-1: #6B2232; --tone-2: #B58A3C; --tone-3: #5E6B47; --tone-4: #7A6A5A; --tone-5: #A99884; --tone-6: #4E3A2C; }
.flow-scroll { overflow-x: auto; }
.flow { display: block; width: 100%; height: auto; }
.flow-link { fill: none; opacity: .3; transition: opacity .15s; }
.flow-link:hover { opacity: .6; }
.flow-link.base { stroke: var(--brand); }
.flow-node.base rect { fill: var(--brand); }
.flow-link.ok { stroke: var(--success); }
.flow-node.ok rect { fill: var(--success); }
.flow-link.ko { stroke: var(--danger); }
.flow-node.ko rect { fill: var(--danger); }
.flow-link.idle { stroke: var(--border-strong); }
.flow-node.idle rect { fill: var(--border-strong); }
.flow-link.reason { stroke: var(--danger); }
.flow-node.reason rect { fill: var(--danger); }
.flow-link.tone-0 { stroke: var(--tone-0); }
.flow-node.tone-0 rect { fill: var(--tone-0); }
.flow-link.tone-1 { stroke: var(--tone-1); }
.flow-node.tone-1 rect { fill: var(--tone-1); }
.flow-link.tone-2 { stroke: var(--tone-2); }
.flow-node.tone-2 rect { fill: var(--tone-2); }
.flow-link.tone-3 { stroke: var(--tone-3); }
.flow-node.tone-3 rect { fill: var(--tone-3); }
.flow-link.tone-4 { stroke: var(--tone-4); }
.flow-node.tone-4 rect { fill: var(--tone-4); }
.flow-link.tone-5 { stroke: var(--tone-5); }
.flow-node.tone-5 rect { fill: var(--tone-5); }
.flow-link.tone-6 { stroke: var(--tone-6); }
.flow-node.tone-6 rect { fill: var(--tone-6); }
.flow-label { font: 13px var(--font); fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.flow-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.flow-note { margin: 14px 0 0; }
.flow-table { margin: 18px 0 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.flow-table summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.flow-table .table { margin-top: 12px; }
.flow-table td, .flow-table th { padding-left: 12px; padding-right: 12px; }

@media (max-width: 860px) {
  .radar-card .radar { max-width: 100%; }
  .radar-layout, .radar-detail-grid.with-list, .radar-controls { grid-template-columns: minmax(0, 1fr); }
  .commercial-tabs { overflow-x: auto; white-space: nowrap; }
  .radar-panel .card-head h3 { margin: 0; }
  .radar-contact-list { max-height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  .radar .blip { animation: none; transition: none; }
}

/* Réseaux sociaux : aperçu d'une publication */
.post-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; font-size: 15px; line-height: 1.55; }
.post-preview .post-title { font: 600 18px/1.3 var(--serif); margin-bottom: 8px; }
.post-visual { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
details > summary.card-head { list-style: none; }
details > summary.card-head::-webkit-details-marker { display: none; }

/* ---------- Feuille de devis / facture : même disposition que le PDF ---------- */
.sheet { background: #FFFEFB; border: 1px solid var(--border); border-radius: 3px; max-width: 794px; margin: 0 auto; padding: clamp(16px, 3.4vw, 36px);
  box-shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 10px 28px rgba(60, 40, 20, .09); font-size: 14px; line-height: 1.5; }
.sheet-actions { max-width: 794px; margin-left: auto; margin-right: auto; }
.sheet [hidden] { display: none !important; }
.sheet-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.sheet-company { font: 600 19px/1.25 var(--serif); color: var(--brand); margin-bottom: 4px; }
.sheet-title { text-align: right; margin-left: auto; }
.sheet-kind { font: 600 28px/1.1 var(--serif); color: var(--brand); letter-spacing: .02em; }
.sheet-number { font-weight: 700; margin: 4px 0 6px; }
.sheet-number .draft { color: var(--danger); font-size: 13px; }
.sheet-to { margin: 14px 0 0 auto; width: min(100%, 330px); background: var(--surface-2); padding: 10px 12px 12px; border-radius: 2px; display: grid; gap: 6px; }
.sheet-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sheet-object { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.sheet-object .box { flex: 1; }
/* « cases » à remplir : contour discret, pleine lisibilité au focus */
.input.box { background: #fff; border: 1px dashed var(--border-strong); min-height: 30px; padding: 3px 8px; font-size: 13.5px; }
.input.box:hover { border-style: solid; }
.input.box.num { text-align: right; }
.input.box.mail-box { font-size: 13px; font-style: italic; }
.sheet-lines { margin-top: 14px; }
.sheet-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 74px 92px 78px 100px; gap: 6px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--border); }
.sheet-row > * { min-width: 0; }
.sheet-row-head { background: var(--brand); color: var(--on-brand, #fff); font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 6px 8px; border-bottom: 0; }
.sheet-row .num { text-align: right; }
.sheet-row:not(.sheet-row-head) > span:first-child { padding-right: 4px; }
.sheet-add { padding: 10px 0 0; }
.sheet-totals { margin: 14px 0 0 auto; width: min(100%, 320px); }
.tot-line { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.tot-net { display: flex; justify-content: space-between; gap: 12px; background: var(--brand); color: var(--on-brand, #fff); padding: 8px 12px; margin-top: 8px; font-weight: 700; font-size: 15px; }
.sheet-conditions { margin-top: 14px; }
.sheet { min-height: 1123px; }       /* une feuille = une page A4 (794 × 1123 px à l'écran) */
.sheet-pagebreak { margin: 18px -44px 14px; padding: 6px 44px; border-top: 2px dashed var(--border-strong); border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 12px; text-align: center; letter-spacing: .04em; }
@media (max-width: 680px) { .sheet { min-height: 0; } .sheet-pagebreak { margin-left: -18px; margin-right: -18px; } }
.doc-title { font: 600 26px/1.2 var(--serif); color: var(--brand); margin: 26px 0 4px; letter-spacing: .02em; }
.doc-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.doc-h { font: 600 17px/1.3 var(--serif); color: var(--brand); margin: 20px 0 4px; }
.doc-ul { margin: 4px 0 10px; padding-left: 22px; }
.doc-table { margin: 8px 0 14px; }
@media (max-width: 680px) { .doc-parties { grid-template-columns: 1fr; } }
.sheet-sign { margin-top: 14px; width: min(100%, 300px); min-height: 70px; border: 1px dashed var(--border-strong); padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.sheet-legal { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; line-height: 1.45; }
@media (max-width: 680px) {
  .sheet-title { text-align: left; margin-left: 0; }
  .sheet-row-head { display: none; }
  .sheet-row { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 10px 0; }
  .sheet-row .c-des { grid-column: 1 / -1; }
  .sheet-row .c-tot { grid-column: 3 / -1; }
  .sheet-row [data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .sheet-row:not([data-line]) > span:not(.c-des)::before { display: none; }
}

/* ---------- Listes pliables / dépliables ---------- */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 2px 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease; }
details.fold[open] > summary::before { transform: rotate(45deg); margin-bottom: 4px; }
details.fold > summary:hover { background: var(--surface-2); }
details.fold > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--brand-ring); }
details.fold > summary .grow { flex: 1; min-width: 0; }
details.fold:not([open]) > summary.card-head { border-bottom: 0; }
details.fold[open] > .fold-peek, details.fold[open] > summary .fold-peek { display: none; }
.fold-peek { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.fold-tools { display: flex; gap: 8px; justify-content: flex-end; margin: 0 0 12px; }
details.fold-mini > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); list-style: none; }
details.fold-mini > summary::-webkit-details-marker { display: none; }
details.fold-mini > summary::before { content: "▸ "; color: var(--muted); }
details.fold-mini[open] > summary::before { content: "▾ "; }
@media (prefers-reduced-motion: reduce) { details.fold > summary::before { transition: none; } }

/* ---------- Page Agents : cartes de même taille + fenêtre « Autorisations » ---------- */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-rows: 1fr; gap: 16px; margin-top: 4px; }
.agent-tile { display: flex; flex-direction: column; gap: 14px; min-height: 270px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); scroll-margin-top: 16px; }
.agent-tile[data-state="erreur"] { border-color: var(--brand); }
.tile-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tile-id { flex: 1; min-width: 0; }
.tile-id h3 { margin: 0; font-size: 19px; line-height: 1.2; }
.tile-id .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-stats { margin: 0; display: grid; gap: 10px; flex: 1; align-content: start; }
.tile-stats > div { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px; align-items: start; }
.tile-stats dt { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.tile-stats dd { margin: 0; font-size: 14px; min-width: 0; }
.tile-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.4; min-height: 2.8em; margin-top: 2px; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Drapeau d'urgence : petit drapeau bordeaux, point d'exclamation blanc dedans */
.flag { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.flag:hover { background: var(--brand-soft); }
.flag:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.flag svg { width: 34px; height: 34px; overflow: visible; }
.flag .pole { stroke: var(--brand); stroke-width: 2; stroke-linecap: round; fill: none; }
.flag .cloth { fill: var(--brand); stroke: var(--brand); stroke-width: 1; stroke-linejoin: round; }
.flag .mark { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; fill: none; }
.flag .dot { fill: #fff; }

/* Fenêtre (dialog natif : fermeture avec Échap, focus piégé, fond assombri) */
dialog.modal { padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); width: min(720px, calc(100% - 24px)); max-height: min(90vh, 860px); box-shadow: 0 24px 60px rgba(23, 17, 13, .35); }
dialog.modal[open] { display: flex; }
dialog.modal::backdrop { background: rgba(23, 17, 13, .5); }
.modal-form { display: flex; flex-direction: column; width: 100%; min-height: 0; max-height: inherit; }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); font-size: 26px; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--surface-2); }
.modal-x:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.modal-body { padding: 8px 20px 18px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 520px) { dialog.modal { width: 100%; max-height: 100%; height: 100%; border-radius: 0; } .agent-grid { grid-template-columns: 1fr; } }

/* Cartes de présentation : léger soulèvement au survol (l'interface reste vivante sans être agitée). Désactivé si l'appareil réduit les animations. */
.agent-tile, .card.kpi, .mailbox { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.agent-tile:hover, .card.kpi:hover, .mailbox:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(60, 40, 20, .14); border-color: var(--border-strong); }
.agent-tile:focus-within { border-color: var(--border-strong); box-shadow: 0 6px 16px rgba(60, 40, 20, .10); }
@media (prefers-reduced-motion: reduce) {
  .agent-tile, .card.kpi, .mailbox { transition: none; }
  .agent-tile:hover, .card.kpi:hover, .mailbox:hover { transform: none; }
}
.modal-head .grow { flex: 1; min-width: 0; }
.tile-select { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.tile-select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.tile-id { display: flex; flex-direction: column; min-width: 0; }
.tile-name { font: 600 19px/1.2 var(--serif); }
.tile-flag { flex: none; display: inline-flex; min-width: 0; }
.agent-tile.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring); background: var(--brand-soft); }
.office > .agent-grid, .office > .agent-services { margin-top: 20px; }
.agent-services { display: grid; gap: 18px; }
.agent-service > summary { padding: 6px 4px; font-size: 15px; }
.agent-service > summary .icon { width: 18px; height: 18px; color: var(--brand); }
.agent-service > .agent-grid { margin-top: 10px; }
.todo-service-title a, .table .service-row th a { color: inherit; text-decoration: none; }
.todo-service-title a:hover, .table .service-row th a:hover { text-decoration: underline; }
.service-icon { width: 24px; height: 24px; vertical-align: -3px; margin-right: 10px; color: var(--brand); }
.list .list-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 12px 16px 4px; }
.todo-service + .todo-service { margin-top: 10px; }
.todo-service-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 8px 4px 2px; }
.table .service-row th { text-align: left; background: var(--surface-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); padding: 7px 12px; }
.table .service-row th .icon { width: 15px; height: 15px; vertical-align: -3px; margin-right: 8px; color: var(--brand); }

/* ---------- Comptabilité : diagramme de flux et acquisition de clients ---------- */
.sankey-wrap { overflow-x: auto; padding: 4px 0 2px; }
.sankey { display: block; width: 100%; min-width: 720px; height: auto; font-family: var(--font); }
.sankey .sk-name { font-size: 14px; font-weight: 700; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.sankey .sk-sub { font-size: 13px; fill: var(--text-2); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.sankey .sk-link { transition: fill-opacity .15s; }
.sankey .sk-link.sk-rev { fill: var(--brand); fill-opacity: .20; }
.sankey .sk-link.sk-profit { fill: var(--success); fill-opacity: .26; }
.sankey .sk-link.sk-cost { fill: var(--danger); fill-opacity: .22; }
.sankey .sk-link:hover { fill-opacity: .42; }
.sankey .sk-node.sk-rev { fill: var(--brand); }
.sankey .sk-node.sk-profit { fill: var(--success); }
.sankey .sk-node.sk-cost { fill: var(--danger); }
.period-tabs { margin-bottom: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.kpi .previous { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.kpi .detail { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) minmax(110px, 190px); gap: 12px; align-items: center; }
.funnel-bar { height: 30px; background: var(--surface-2); border-radius: var(--radius-sm); overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; min-width: 3px; background: var(--brand); border-radius: var(--radius-sm); }
.funnel-row:nth-child(n+3) .funnel-bar > span { opacity: .86; }
.funnel-meta { font-size: 13px; color: var(--text-2); }
@media (max-width: 640px) { .funnel-row { grid-template-columns: 1fr; gap: 4px; } }
.definition { margin: 0 0 12px; }
.definition dt { font-weight: 700; }
.definition dd { margin: 2px 0 0; color: var(--text-2); }

/* ---------- Feuille compacte, repères de page A4 et impression ---------- */
.sheet-legalrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.sheet-legalrow span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.sheet-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sheet-fit { max-width: 794px; margin: 0 auto 10px; padding: 7px 12px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid; }
.sheet-fit.ok { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.sheet-fit.multi { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-bd); }
@media (max-width: 680px) { .sheet-legalrow { grid-template-columns: 1fr; } }
.sheet.sheet-edit { min-height: 0; padding-top: 28px; padding-bottom: 24px; }
@page { size: A4; margin: 12mm; }
@media print {
  .sidebar, .topbar, .scrim, .nav-toggle, .page-head, .breadcrumb, .alert, .tabs, .btn, .form-actions, .sheet-actions, .sheet-add, .sheet-fit, .hint, summary { display: none !important; }
  body { background: #fff !important; }
  .layout, .main, .content { display: block !important; padding: 0 !important; margin: 0 auto !important; max-width: none !important; }
  .sheet { box-shadow: none !important; border: 0 !important; border-radius: 0 !important; width: 100% !important; max-width: none !important; min-height: 0 !important; padding: 0 !important; background: #fff !important; background-image: none !important; }
  .sheet .input, .sheet select, .sheet textarea { border: 0 !important; background: transparent !important; padding: 0 !important; min-height: 0 !important; box-shadow: none !important; appearance: none; -webkit-appearance: none; resize: none; font-size: 13px !important; color: #17110D !important; }
  .sheet input::placeholder, .sheet textarea::placeholder { color: transparent !important; }
  .sheet-row, .sheet-totals, .sheet-legal, .sheet-sign, .doc-parties, .doc-table tr, .sheet-to { break-inside: avoid; }
  .sheet-pagebreak { break-before: page; border: 0 !important; margin: 0 !important; padding: 0 !important; height: 0; overflow: hidden; font-size: 0 !important; background: none !important; }
  .sheet-legalrow label span { color: #6B5B4D !important; }
  a { color: inherit !important; text-decoration: none !important; }
}
/* « Aperçu A4 » : les mêmes règles que l'impression, à l'écran, sur une page de 794 px de large */
body.print-preview .sidebar, body.print-preview .topbar, body.print-preview .scrim, body.print-preview .nav-toggle, body.print-preview .page-head, body.print-preview .breadcrumb, body.print-preview .alert, body.print-preview .tabs, body.print-preview .btn, body.print-preview .form-actions, body.print-preview .sheet-actions, body.print-preview .sheet-add, body.print-preview .sheet-fit, body.print-preview .hint, body.print-preview summary { display: none !important; }
body.print-preview { background: #fff !important; }
body.print-preview .layout, body.print-preview .main, body.print-preview .content { display: block !important; padding: 0 !important; margin: 0 auto !important; max-width: none !important; }
body.print-preview .sheet { box-shadow: none !important; border: 0 !important; border-radius: 0 !important; width: 100% !important; max-width: none !important; min-height: 0 !important; padding: 0 !important; background: #fff !important; background-image: none !important; }
body.print-preview .sheet .input, body.print-preview .sheet select, body.print-preview .sheet textarea { border: 0 !important; background: transparent !important; padding: 0 !important; min-height: 0 !important; box-shadow: none !important; appearance: none; -webkit-appearance: none; resize: none; font-size: 13px !important; color: #17110D !important; }
body.print-preview .sheet input::placeholder, body.print-preview .sheet textarea::placeholder { color: transparent !important; }
body.print-preview .sheet-row, body.print-preview .sheet-totals, body.print-preview .sheet-legal, body.print-preview .sheet-sign, body.print-preview .doc-parties, body.print-preview .doc-table tr, body.print-preview .sheet-to { break-inside: avoid; }
body.print-preview .sheet-pagebreak { break-before: page; border: 0 !important; margin: 0 !important; padding: 0 !important; height: 0; overflow: hidden; font-size: 0 !important; background: none !important; }
body.print-preview .sheet-legalrow label span { color: #6B5B4D !important; }
body.print-preview a { color: inherit !important; text-decoration: none !important; }
body.print-preview .content { width: 794px; }
body.print-preview .sheet { padding: 45px !important; box-sizing: border-box; border: 1px solid #ddd !important; }

/* Ventes par jour (Comptabilité → Ventes en ligne et banque) */
.daybars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.daybar { flex: 1; min-width: 3px; height: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 3px 3px 0 0; }
.daybar > span { display: block; width: 100%; min-height: 2px; background: var(--brand); border-radius: 3px 3px 0 0; }

/* ---------- Développement Marque (communication, référencement) ---------- */
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.assistant-strip { margin-bottom: 18px; }
.assistant-strip .card-body { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.assistant-text { flex: 1 1 260px; min-width: 0; display: grid; gap: 2px; }
.assistant-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.assistant-actions form { margin: 0; }
.axes { margin-top: 16px; }
.axe { display: block; color: inherit; transition: border-color .15s ease, background .15s ease; }
.axe:hover { text-decoration: none; border-color: var(--border-strong); background: var(--brand-soft); }
.axe.active { border-color: var(--brand); background: var(--brand-soft); }
.axe .label { color: var(--accent-text); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; }
.axe p { margin: 6px 0 10px; }
.tabs.sub { margin-top: -6px; }
.tabs.sub a { font-weight: 500; font-size: 13px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* Blog : aperçu d'un article */
.article-preview { font-size: 15.5px; line-height: 1.65; }
.article-preview h2 { font-size: 20px; margin: 22px 0 8px; }
.article-preview h3 { font-size: 16.5px; margin: 16px 0 6px; }
.article-preview p { margin: 0 0 12px; }
.article-preview ul, .article-preview ol { margin: 0 0 12px 22px; padding: 0; }
.article-preview blockquote { margin: 0 0 12px; padding: 4px 14px; border-left: 3px solid var(--brand); color: var(--text-2); }
.article-preview a { color: var(--brand); }

.mail-preview { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font: 13.5px/1.55 var(--sans, system-ui); margin: 0 0 6px; }

/* --- Console : tableau de bord des KPIs --------------------------------------------------------------------- */
.kpi-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; margin-bottom: 18px; }
.kpi-filter-actions { display: flex; gap: 8px; align-items: center; min-height: 40px; }
.kpi .previous { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge.trend::before { display: none; }
.badge.trend { gap: 4px; font-variant-numeric: tabular-nums; }
.kpi-legend { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.kpi-legend .swatch { display: inline-block; width: 12px; height: 10px; border-radius: 2px; background: var(--brand); opacity: .55; }
.kpi-legend .swatch.prev { background: none; opacity: 1; border-top: 2.4px dashed var(--text); height: 0; width: 18px; margin-left: 10px; border-radius: 0; }
.kpi-chart { width: 100%; height: auto; display: block; }
.kpi-chart .grid { stroke: var(--border); stroke-width: 1; }
.kpi-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans, inherit); }
.kpi-chart .bar { fill: var(--brand); opacity: .55; }
.kpi-chart .bar:hover { opacity: .9; }
.kpi-chart .prev-halo { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linejoin: round; stroke-linecap: round; }
.kpi-chart .prev { fill: none; stroke: var(--text); stroke-width: 2.4; stroke-dasharray: 7 5; stroke-linejoin: round; stroke-linecap: round; }
.kpi-chart .prev-dot { fill: var(--text); stroke: var(--surface); stroke-width: 1.5; }
.kpi-chart .bar.on { opacity: .95; }
.kpi-chart .prev-dot.on { r: 5.5; }
.kpi-chart .hit { fill: var(--brand); fill-opacity: 0; cursor: crosshair; }
.kpi-chart .hit.on { fill-opacity: .08; }
.kpi-chart-wrap { position: relative; }
.kpi-chart-card .card-head, .kpi-table .card-head { flex-wrap: wrap; gap: 6px 16px; }
.kpi-chart-card .card-head h3, .kpi-table .card-head h3 { white-space: nowrap; }
.kpi-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 200px; max-width: 280px; padding: 10px 13px; border-radius: 9px; background: var(--text); color: var(--surface); box-shadow: 0 10px 26px rgba(0, 0, 0, .3); font-size: 12.5px; line-height: 1.45; }
.kpi-tip[hidden] { display: none; }
.kpi-tip .t-day { font-weight: 700; margin-bottom: 6px; text-transform: capitalize; }
.kpi-tip .t-row { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.kpi-tip .t-row .k { opacity: .75; }
.kpi-tip .t-row strong, .kpi-tip .t-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-tip .t-sub { opacity: .6; font-size: 11.5px; text-align: right; margin-top: -1px; }
.kpi-tip .t-delta { margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(128, 128, 128, .35); display: flex; align-items: center; gap: 7px; font-weight: 600; }
.kpi-tip .t-delta::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; }
.kpi-tip .t-delta.success::before { background: #4fbf68; }
.kpi-tip .t-delta.warning::before { background: #f0a43a; }
.kpi-tip .t-delta.danger::before { background: #ef5b4f; }
.kpi-tip .t-delta.info::before { background: #5aa0e6; }
.share-cell { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.share-bar { flex: 1; height: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.share-bar > span { display: block; height: 100%; background: var(--brand); opacity: .75; border-radius: 999px; }
.share-pct { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; color: var(--text-2); }
.kpi-table .table-wrap { overflow-x: visible; }
.table.fit { table-layout: auto; width: 100%; }
.table.fit th, .table.fit td { padding-left: 14px; padding-right: 14px; vertical-align: middle; }
.table.fit th { white-space: normal; line-height: 1.25; }
.table.fit .c-name { width: 24%; }
.table.fit .c-share { width: 20%; }
.table.fit td .cell-link { display: inline-block; margin-right: 6px; }
.show-mobile { display: none; }
@media (max-width: 860px) { .show-mobile { display: block; } .table.fit .c-name, .table.fit .c-share { width: auto; } .share-cell { min-width: 90px; } }
@media (max-width: 520px) { .share-cell { min-width: 0; } .share-cell .share-bar { display: none; } .table.fit th, .table.fit td { padding-left: 8px; padding-right: 8px; } .table.fit .badge { padding: 0 6px; } }
.spark-line { width: 96px; height: 26px; display: block; }
.spark-line polyline { fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark-line line { stroke: var(--border-strong, var(--border)); stroke-width: 1.5; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .neg { color: var(--danger); }

/* Tableau de bord : une décision en tête, les chiffres clés, puis le détail */
.dash-hero { display: flex; align-items: center; gap: 20px; padding: 20px 24px; margin-bottom: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: inherit; }
a.dash-hero:hover { text-decoration: none; border-color: var(--brand); }
.dash-hero.todo { background: var(--brand-soft); border: 1.5px solid var(--brand); }
.dash-hero-count { font: 600 46px/1 var(--serif); color: var(--brand); min-width: 1.1ch; text-align: center; }
.dash-hero-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.dash-hero-text strong { font: 600 20px/1.3 var(--serif); }
.dash-hero-text span { color: var(--muted); }
.dash-hero.ok .icon { width: 30px; height: 30px; color: var(--success); flex: none; }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.dash-kpi-value { font: 600 32px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.dash-kpi-label { margin-top: 6px; color: var(--muted); font-size: 14px; }
.dash-main { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }   /* deux colonnes si la place le permet, sinon l'une sous l'autre */
.dash-main > :first-child { flex: 2 1 420px; min-width: 0; }
.dash-main > :last-child { flex: 1 1 280px; min-width: 0; }
.dash-todo { columns: 230px 3; column-gap: 32px; padding: 10px 22px 18px; }
.dash-dept { break-inside: avoid; margin-bottom: 8px; }
.dash-dept .todo-service-title { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 6px 0 2px; }
.dash-dept .todo-service-title .icon { width: 15px; height: 15px; color: var(--brand); flex: none; }
.dash-todo-list { list-style: none; margin: 0; padding: 0; }
.dash-todo-list a { display: flex; align-items: center; gap: 12px; margin: 0 -10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); }
.dash-todo-list a:hover { background: var(--surface-2); text-decoration: none; }
.dash-todo-list .grow { flex: 1; min-width: 0; }
.dash-count { min-width: 30px; padding: 1px 9px; border-radius: 8px; background: var(--surface-2); text-align: center; font: 700 14px var(--font); font-variant-numeric: tabular-nums; }
.dash-echeances { list-style: none; margin: 0; padding: 4px 22px 8px; }
.dash-echeances li { display: flex; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.dash-echeances li:first-child { border-top: 0; }
.dash-echeances .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-date { flex: none; width: 48px; font: 600 17px var(--serif); font-variant-numeric: tabular-nums; color: var(--brand); }
.dash-agents-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; margin: -6px 0 14px; font-size: 14px; }
.dash-agents-summary .small { margin-left: auto; }
.dash-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.state-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--success); }
.state-dot.off { background: var(--border-strong); } .state-dot.err { background: var(--danger); }
.dash-agents { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.dash-agent-group { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 10px 20px; align-items: start; padding: 14px 22px; border-top: 1px solid var(--border); }
.dash-agent-group:first-child { border-top: 0; }
.dash-agent-group-title { display: flex; align-items: center; gap: 8px; padding-top: 5px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.dash-agent-group-title .icon { width: 15px; height: 15px; color: var(--brand); flex: none; }
.dash-agent-group-title a { color: inherit; } .dash-agent-group-title a:hover { text-decoration: underline; }
.dash-agent-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.agent-pill:hover { border-color: var(--text-2); text-decoration: none; }
.agent-pill.off { border-style: dashed; color: var(--muted); }
.agent-pill.off .state-dot { background: var(--border-strong); }
.agent-pill.err { border-color: var(--danger-bd); background: var(--danger-bg); color: var(--danger); }
.agent-pill.err .state-dot { background: var(--danger); }
.agent-pill-flag { font-size: 12px; font-weight: 700; }
@media (max-width: 960px) {
  .dash-agent-group { grid-template-columns: minmax(0, 1fr); }
  .dash-agent-group-title { padding-top: 0; }
}
@media (max-width: 560px) {
  .dash-hero { flex-wrap: wrap; padding: 16px 18px; gap: 12px 16px; }
  .dash-hero .btn { width: 100%; }
  .dash-hero-count { font-size: 38px; }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dash-todo { padding: 6px 16px 14px; }
}

/* Validations : la carte ouverte ressort, l'aperçu replié se lit comme une phrase, les boutons de décision sont à part */
.val-card { transition: border-color .15s ease; }
.val-card:has(details[open]) { border-color: var(--brand); }
.val-card .fold-peek { color: var(--text-2); font-size: 14px; margin-top: 3px; }
.val-card .card-head h3 { font-size: 18px; }
.val-card .form-actions.val-actions { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.page-head p strong { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .val-card { transition: none; } }

/* Référencement : tester le site, un score par axe, les points à corriger avec leur conseil */
.test-launch { padding: 18px 22px; margin-bottom: 16px; }
.test-launch form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.test-launch-field { flex: 1 1 320px; min-width: 0; }
.test-launch p { margin: 10px 0 0; }
.axe-card .label { color: var(--accent-text); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; }
.axe-card p { margin: 10px 0 14px; }
.axe-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.score { display: flex; align-items: baseline; gap: 4px; margin: 10px 0 2px; }
.score-num { font: 600 44px/1 var(--serif); font-variant-numeric: tabular-nums; }
.score-max { color: var(--muted); font-size: 15px; }
.score.success .score-num { color: var(--success); } .score.warning .score-num { color: var(--warning); } .score.danger .score-num { color: var(--danger); }
.score-delta { margin-left: 10px; font-size: 13px; font-weight: 700; } .score-delta.up { color: var(--success); } .score-delta.down { color: var(--danger); }
.danger-text { color: var(--danger); }
.test-result { margin-top: 16px; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.check:first-child { border-top: 0; padding-top: 4px; }
.check-pick { padding-top: 3px; } .check-pick input { width: 17px; height: 17px; accent-color: var(--brand); }
.check .grow { flex: 1; min-width: 0; }
.check-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.check-advice { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.check.echec .check-advice { border-left-color: var(--danger); } .check.attention .check-advice { border-left-color: var(--warning); }
.check-ok { margin-top: 14px; }
.check-ok > summary { padding: 6px 0; }
.check-list.compact .check { padding: 9px 0; }
@media (max-width: 560px) { .test-launch { padding: 16px 18px; } .test-launch .btn { width: 100%; } }

/* Arrêt d'un agent et consommation en direct */
.btn-stop { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-stop:hover { background: color-mix(in srgb, var(--danger) 82%, #000); border-color: color-mix(in srgb, var(--danger) 82%, #000); }
.btn-stop .icon { width: 14px; height: 14px; stroke: currentColor; }
.tile-stop[hidden] { display: none; }
.tile-foot { flex-wrap: wrap; }
.tile-activity:empty { display: none; }
.conso-live { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--muted); }
.conso-live .state-dot { animation: conso-pulse 1.6s ease-in-out infinite; }
.conso-live .state-dot.offline { background: var(--danger); animation: none; }
@keyframes conso-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .conso-live .state-dot { animation: none; } }
.metric-switch { display: inline-flex; gap: 6px; }
.metric-switch .btn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.conso-plot { position: relative; }
.conso-svg { width: 100%; height: auto; display: block; }
.conso-grid { stroke: var(--border); stroke-width: 1; }
.conso-axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.conso-cursor { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 4; }
.conso-empty { padding: 42px 0; text-align: center; margin: 0; }
.conso-tip { position: absolute; z-index: 3; min-width: 180px; padding: 9px 12px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12.5px; line-height: 1.55; pointer-events: none; box-shadow: var(--shadow-lg); }
.conso-tip[hidden] { display: none; }
.conso-tip > div { display: flex; align-items: center; gap: 8px; }
.conso-tip > div b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.conso-tip i, .conso-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.conso-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.conso-legend li { display: inline-flex; align-items: center; gap: 7px; }
.conso-note { margin: 10px 0 0; }
.conso-table td.num { white-space: nowrap; }
.conso-table form[hidden] { display: none; }
@media (max-width: 560px) { .conso-live { margin-left: 0; } }

/* Miniature de consommation sur chaque carte d'agent */
.tile-trend { display: flex; align-items: center; gap: 12px; margin: 2px 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: inherit; background: var(--surface); }
.tile-trend:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.tile-trend svg { flex: 1 1 auto; min-width: 0; width: 100%; height: 28px; display: block; }
.tile-trend-text { flex: none; white-space: nowrap; font-size: 13px; }
.spark-line { fill: none; stroke: var(--brand); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--brand); opacity: .12; }
.tile-trend.flat .spark-line { stroke: var(--border-strong); }
.tile-trend.flat .spark-area { opacity: 0; }

/* Console : personnalité des agents d'un client */
.persona-agents { border-top: 1px solid var(--border); display: grid; gap: 8px; }
.persona-agent { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.persona-agent > summary { padding: 10px 14px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.persona-body { padding: 4px 14px 14px; display: grid; gap: 14px; border-top: 1px solid var(--border); }
.persona-text { margin-top: 14px; }
.field > span.hint { display: block; margin: 4px 0 0; font-size: 12px; color: var(--muted); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Console : modèles de personnalité */
.persona-models { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 12px; }
.persona-models .field { min-width: 240px; margin: 0; }
.persona-save { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.persona-save .input { width: 210px; }
.model-card { margin-bottom: 16px; }
.model-agents { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.model-apply { margin-top: 4px; }
.model-apply > summary { font-weight: 600; }
.model-clients { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }

/* Bureau 3D : légende des états, sous la vue (visible seulement en 3D) */
.office-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 2px 12px; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.office[data-mode="2d"] .office-legend { display: none; }
.office-legend li { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.office-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.office-hint { font-size: 12.5px; background: rgba(255, 253, 249, .94); border: 1px solid var(--border); }

/* ---------- Calendrier ---------- */
.cal-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { margin: 0 0 0 8px; font-size: 22px; }
.cal-title::first-letter, .cal-agenda-date::first-letter, .cal-weekview .cal-num::first-letter { text-transform: uppercase; }
.cal-views { margin: 0; }
.cal-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 0; font-size: 12px; color: var(--muted); }
.cal-legend li { display: flex; align-items: center; gap: 6px; }
.cal-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; background: var(--info); }
.cal-item { display: block; margin-top: 3px; padding: 3px 7px; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.35; text-decoration: none; color: var(--info);
  background: var(--info-bg); border-left: 3px solid var(--info-bd); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item:hover { filter: brightness(.96); }
.cal-item.done { opacity: .55; text-decoration: line-through; }
.cal-item.k-reunion, .cal-dot.k-reunion { color: #fff; background: var(--brand); border-left-color: var(--brand); }
.cal-item.k-rdv, .cal-dot.k-rdv, .cal-item.k-intervention, .cal-dot.k-intervention { color: var(--success); background: var(--success-bg); border-left-color: var(--success); }
.cal-item.k-deadline, .cal-dot.k-deadline, .cal-item.k-fiscal, .cal-dot.k-fiscal { color: var(--danger); background: var(--danger-bg); border-left-color: var(--danger); }
.cal-item.k-facture, .cal-dot.k-facture, .cal-item.k-devis, .cal-dot.k-devis, .cal-item.k-rappel, .cal-dot.k-rappel { color: var(--warning); background: var(--warning-bg); border-left-color: var(--warning); }
.cal-dot.k-reunion { background: var(--brand); } .cal-dot.k-rdv, .cal-dot.k-intervention { background: var(--success); }
.cal-dot.k-deadline, .cal-dot.k-fiscal { background: var(--danger); } .cal-dot.k-facture, .cal-dot.k-devis, .cal-dot.k-rappel { background: var(--warning); }
.cal-month, .cal-weekview, .cal-agenda { padding: 0; overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head > div { padding: 8px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 112px; padding: 6px 8px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; }
.cal-week .cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--surface-2); } .cal-day.other .cal-num { color: var(--muted); }
.cal-day.today { background: var(--brand-soft); }
.cal-day.today .cal-num { color: var(--brand); font-weight: 700; }
.cal-num { display: block; font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.cal-wd { display: none; text-transform: capitalize; }
.cal-more { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.cal-weekview { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekview .cal-day { min-height: 220px; }
.cal-weekview .cal-day:last-child { border-right: 0; }
.cal-weekview .cal-num { font-size: 12px; margin-bottom: 4px; }
.cal-agenda-day { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 4px 20px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.cal-agenda-day:last-child { border-bottom: 0; }
.cal-agenda-day.today { background: var(--brand-soft); }
.cal-agenda-date { font-weight: 600; } .cal-agenda-date a { color: inherit; text-decoration: none; }
.cal-agenda-items .cal-item { margin-top: 0; margin-bottom: 4px; font-size: 13px; padding: 5px 9px; }
.cal-up { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px; align-items: center; } .cal-up .cal-item { margin: 0; }
@media (max-width: 860px) {
  .cal-head { display: none; }
  .cal-week, .cal-weekview { grid-template-columns: minmax(0, 1fr); }
  .cal-day, .cal-weekview .cal-day { min-height: 0; border-right: 0; }
  .cal-day.empty, .cal-day.other.empty { display: none; }
  .cal-wd { display: inline; }
  .cal-item { white-space: normal; }
  .cal-agenda-day, .cal-up { grid-template-columns: minmax(0, 1fr); }
}
