/* ───────── Police de la charte Mitel 2026 : Museo Sans (repli Arial) ───────── */
@font-face { font-family: "Museo Sans"; src: url("../fonts/MuseoSans-300.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Museo Sans"; src: url("../fonts/MuseoSans-500.woff") format("woff"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Museo Sans"; src: url("../fonts/MuseoSans-700.woff") format("woff"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Museo Sans"; src: url("../fonts/MuseoSans-900.woff") format("woff"); font-weight: 800 900; font-display: swap; }

/* ───────── Jetons de thème : UNIQUEMENT la charte Mitel 2026 ─────────
   Règle : aucune couleur inventée ni « déduite ». Seules sont permises :
   – les 6 couleurs de la charte ci-dessous, le blanc (et le noir pour les ombres) ;
   – leurs variantes PAR TRANSPARENCE (rgba d'une couleur de la charte) ;
   – des dégradés dont chaque étape est une couleur de la charte ;
   – exception validée : UN vert et UN rouge, réservés aux actions d'appel
     (Appeler/Répondre, Raccrocher/Refuser, manqué) et aux états de présence.
   Voir /Users/Fredo/Sites/MD/CHARTE-MITEL-2026.md */
:root {
  /* Couleurs primaires (à utiliser en premier) */
  --mitel-dark: #15325f;        /* Mitel Dark Blue  – PMS 295C */
  --mitel-mid: #0073d0;         /* Mitel Mid Blue   – PMS 3005C */
  --mitel-light: #00a1e0;       /* Mitel Light Blue – PMS 299C */
  /* Couleurs secondaires (accents, avec parcimonie) */
  --mitel-yellow: #fdb714;      /* Mitel Yellow – jamais en texte sur fond clair */
  --mitel-purple: #812cc4;      /* Mitel Purple – PMS 266C */
  --mitel-periwinkle: #def7fc;  /* Mitel Periwinkle */
  /* Exception fonctionnelle validée (téléphonie uniquement) */
  --call-green: #13a10e;
  --call-red: #c4314b;
  /* Dégradés de la charte (étapes = couleurs de la charte) */
  --mitel-gradient-dark: linear-gradient(160deg, var(--mitel-mid) 0%, var(--mitel-dark) 62%);
  --mitel-gradient-light: linear-gradient(160deg, var(--mitel-periwinkle) 0%, #ffffff 100%);
}
:root, [data-theme="light"] {
  --bg: #ffffff;
  --bg-main: rgba(222, 247, 252, .20);      /* Periwinkle à 20 % : bleu très léger */
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-2: rgba(21, 50, 95, .06);        /* pastilles, filtres : Dark Blue à 6 %, neutre */
  --surface-3: rgba(0, 115, 208, .12);      /* Mid Blue transparent */
  --hover: var(--mitel-periwinkle);
  --line: rgba(21, 50, 95, .14);            /* Dark Blue transparent */
  --text: var(--mitel-dark);
  --text-2: rgba(21, 50, 95, .74);
  --text-3: rgba(21, 50, 95, .50);
  --brand: var(--mitel-mid);
  --brand-hover: var(--mitel-dark);
  --brand-soft: var(--mitel-periwinkle);
  --brand-text: #ffffff;
  --green: var(--call-green);
  --green-hover: var(--call-green);
  --green-soft: rgba(19, 161, 14, .12);
  --red: var(--call-red);
  --red-hover: var(--call-red);
  --red-soft: rgba(196, 49, 75, .10);
  --amber: var(--mitel-yellow);
  --amber-text: var(--mitel-dark);          /* le jaune n'est jamais du texte sur fond clair */
  --amber-soft: rgba(253, 183, 20, .20);
  --purple: var(--mitel-purple);
  --shadow-sm: 0 1px 2px rgba(21,50,95,.08), 0 0 1px rgba(21,50,95,.08);
  --shadow: 0 4px 14px rgba(21,50,95,.10), 0 0 2px rgba(21,50,95,.08);
  --shadow-lg: 0 16px 40px rgba(21,50,95,.18), 0 0 2px rgba(21,50,95,.10);
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: var(--mitel-dark);
  --bg-main: var(--mitel-dark);
  --surface: rgba(255, 255, 255, .06);
  --surface-solid: var(--mitel-dark);
  --surface-2: rgba(255, 255, 255, .10);
  --surface-3: rgba(0, 161, 224, .22);
  --hover: rgba(0, 161, 224, .20);          /* Light Blue transparent */
  --line: rgba(255, 255, 255, .16);
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, .78);
  --text-3: rgba(255, 255, 255, .55);
  --brand: var(--mitel-light);
  --brand-hover: #ffffff;
  --brand-soft: rgba(0, 161, 224, .22);
  --brand-text: #ffffff;
  --green: var(--call-green);
  --green-hover: var(--call-green);
  --green-soft: rgba(19, 161, 14, .22);
  --red: var(--call-red);
  --red-hover: var(--call-red);
  --red-soft: rgba(196, 49, 75, .22);
  --amber: var(--mitel-yellow);
  --amber-text: var(--mitel-yellow);        /* sur fond sombre, le jaune est lisible */
  --amber-soft: rgba(253, 183, 20, .18);
  --purple: var(--mitel-purple);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow: 0 4px 14px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
[data-theme="contrast"] {
  --bg: #000; --bg-main: #000; --surface: #000; --surface-solid: #000; --surface-2: #000; --surface-3: #000;
  --hover: rgba(0, 161, 224, .35); --line: #fff; --text: #fff; --text-2: #fff; --text-3: #fff;
  --brand: var(--mitel-light); --brand-hover: var(--mitel-yellow); --brand-soft: #000; --brand-text: #000;
  --green: var(--call-green); --green-hover: var(--call-green); --green-soft: #000;
  --red: var(--call-red); --red-hover: var(--call-red); --red-soft: #000;
  --amber: var(--mitel-yellow); --amber-text: var(--mitel-yellow); --amber-soft: #000; --purple: var(--mitel-purple);
  --shadow-sm: none; --shadow: none; --shadow-lg: none;
  color-scheme: dark;
}
/* ───────── Thème « WCAG 2.1 AA » (choisi dans Paramètres › Apparence) ─────────
   Même charte Mitel, contrastes vérifiés : texte ≥ 4,5:1, gros texte et éléments graphiques ≥ 3:1,
   information jamais portée par la seule couleur, focus toujours visible. */
[data-theme="a11y"] {
  --bg-main: #ffffff;
  --text-2: rgba(21, 50, 95, .74);          /* 5,7:1 sur blanc, 5,4:1 sur Periwinkle */
  --text-3: rgba(21, 50, 95, .74);          /* au lieu de 50 % (2,9:1) */
  --amber-text: var(--mitel-dark);
  --line: rgba(21, 50, 95, .40);            /* bordures de champs et cartes visibles (≥ 3:1) */
  color-scheme: light;
}
/* Colonne de menu et bande du haut : texte blanc plein (4,8:1 minimum sur le dégradé) */
[data-theme="a11y"] :is(.nav-item, .me-status, .me-line, .chip-btn, .tb-line) { color: #ffffff; }
[data-theme="a11y"] :is(.chip-btn, .tb-btn) { background: transparent; box-shadow: inset 0 0 0 1.5px #ffffff; }
/* États écrits en bleu foncé (le vert en petit texte n'atteint que 3,4:1) ; le rouge reste (5,4:1) */
[data-theme="a11y"] :is(.pres-text.free, .pres-label.free, .pres-text.ringing, .pres-label.ringing, .pres-text.unknown, .pres-label.unknown) { color: var(--mitel-dark); }
[data-theme="a11y"] .call-state, [data-theme="a11y"] .call-state .tag { color: var(--mitel-dark); }
[data-theme="a11y"] :is(button.pr-name, button.pr-info):hover { color: var(--mitel-dark); text-decoration: underline; }
/* Survols des numéros : fond Dark Blue, texte blanc (12,7:1) */
[data-theme="a11y"] :is(.num-pill, .si-num, .num-pill.mail):hover { background: var(--mitel-dark); color: #ffffff; }
/* Bouton Appeler : libellé en « gros texte » (≥ 18,66 px gras → 3:1 suffit, 3,4:1 obtenu) */
[data-theme="a11y"] .dial-btn { font-size: 19px; font-weight: 700; }
/* Pastilles de présence : plus grandes, cerclées de Dark Blue, avec un symbole (✓ combiné cloche sens-interdit ×) */
[data-theme="a11y"] .presence { width: 17px; height: 17px; min-width: 17px; min-height: 17px; border: 2px solid var(--mitel-dark); }
[data-theme="a11y"] .presence .ico { display: block; width: 11px; height: 11px; stroke-width: 3.2; }
[data-theme="a11y"] .presence.ringing { color: var(--mitel-dark); }
[data-theme="a11y"] .phone-page .fav-card .presence.mini { width: 15px; height: 15px; min-width: 15px; min-height: 15px; border: 2px solid var(--mitel-dark); }
[data-theme="a11y"] .phone-page .fav-card .presence.mini .ico { width: 9px; height: 9px; }
/* Focus clavier toujours visible, en Mid Blue (4,8:1) plutôt qu'en jaune (1,8:1) */
[data-theme="a11y"] :focus-visible, [data-theme="a11y"].focus-ring :focus-visible { outline: 3px solid var(--mitel-mid); outline-offset: 2px; box-shadow: none; }
[data-theme="a11y"] .sidebar :focus-visible, [data-theme="a11y"] .topbar :focus-visible { outline-color: #ffffff; }
/* Initiales en Dark Blue (le Light Blue sur sa teinte n'atteint pas 4,5:1) */
[data-theme="a11y"] .avatar { color: var(--mitel-dark); }
[data-theme="a11y"] .dir-logo { color: var(--mitel-dark); }
[data-theme="a11y"] .me-card { background: rgba(21, 50, 95, .6); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
[data-theme="a11y"] .me-card .avatar { color: #ffffff; background: rgba(21, 50, 95, .8); }
[data-theme="a11y"] ::placeholder { color: var(--text-2); opacity: 1; }
[data-theme="a11y"] :is(.fav-card, .team-row, .hist-row, .person-list, .set-block, .search-field) { box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="a11y"] .hist-row.unseen { box-shadow: inset 5px 0 0 var(--red), inset 0 0 0 1px var(--line); }

[data-theme="dark"] :is(.person-card, .fav-card, .team-row, .hist-row, .set-block, .call-card, .person-list) { box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="contrast"] .person-card, [data-theme="contrast"] .fav-card, [data-theme="contrast"] .team-card,
[data-theme="contrast"] .call-card, [data-theme="contrast"] .key, [data-theme="contrast"] .me-card,
[data-theme="contrast"] .hist-row, [data-theme="contrast"] .search-field { border: 1px solid #fff !important; }

/* ───────── Base ───────── */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Museo Sans", Arial, sans-serif;
  font-size: 14px; line-height: 1.4; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.focus-ring :focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--amber) 25%, transparent); }
.muted { color: var(--text-2); }
.center { text-align: center; }
.hidden { visibility: hidden; }
.ico { flex: none; display: block; }

/* ───────── Mise en page ───────── */
/* 100dvh = hauteur réellement visible sur smartphone (barre d'adresse comprise) ; 100vh en repli */
#app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  position: relative; width: 280px; flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 22px 16px 16px; overflow-x: hidden; overflow-y: auto; color: #fff;
  background: var(--mitel-gradient-dark);
}
/* Comms Lines de la charte, en bas de la colonne */
.sidebar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 320px; pointer-events: none;
  background: url("../img/comms-lines.svg") no-repeat center bottom / 170% 100%; opacity: .45;
}
.sidebar > * { position: relative; z-index: 1; }
.main { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; background: var(--bg-main); display: flex; flex-direction: column; }
.view { flex: 1; padding: 24px 32px 40px; }

/* ───────── Bande du haut (mode très compact uniquement) ───────── */
.topbar {
  display: none; position: sticky; top: 0; z-index: 12; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding: 6px 10px 6px 14px; color: #fff; background: var(--mitel-gradient-dark);
}
.tb-status { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.tb-status .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); }
.tb-status.ok .dot { background: var(--call-green); }
.tb-status.pending .dot { background: var(--mitel-yellow); }
.tb-status.err .dot { background: var(--call-red); }
.tb-name { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 15px; font-weight: 700; }
.tb-name:empty { display: none; }
.tb-line { flex: none; font-size: 15px; font-weight: 300; color: var(--mitel-light); font-variant-numeric: tabular-nums; }
.tb-actions { flex: none; display: inline-flex; align-items: center; gap: 6px; }
/* Indicateur softphone et bouton messagerie : même hauteur, alignés */
.tb-btn { height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: rgba(255,255,255,.14); }
.tb-btn { width: 30px; color: #fff; }
.tb-btn:hover { background: rgba(255,255,255,.26); }
.tb-logo { display: none; flex: none; width: 124px; height: auto; margin-right: 10px; }

/* ───────── Logo Mitel (≥ 120 px en numérique, zone de protection respectée) ───────── */
.brand-logo { display: block; padding: 0 6px 18px; }
.brand-logo img { display: block; width: 132px; height: auto; }
.brand-logo .connectors { display: none; width: 40px; }

/* ───────── Carte utilisateur ───────── */
.me-card {
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.me-card .avatar { --av: #fff; background: rgba(255,255,255,.16); color: #fff; }
.me-row { display: flex; align-items: center; gap: 12px; }
.me-text { min-width: 0; }
.me-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-line { font-size: 22px; font-weight: 300; letter-spacing: .5px; color: var(--mitel-light); font-variant-numeric: tabular-nums; }
.me-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.78); margin-top: 12px; }
.me-status .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); }
.me-status.ok .dot { background: var(--call-green); box-shadow: 0 0 0 3px rgba(19,161,14,.25); }
.me-status.pending .dot { background: var(--mitel-yellow); }
.me-status.err .dot { background: var(--call-red); }
.me-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; color: #fff;
  background: rgba(255,255,255,.12); font-size: 13px; transition: background .15s;
}
.chip-btn:hover { background: rgba(255,255,255,.22); }
/* Mode de la ligne (casque = softphone, poste = téléphone de bureau) : rond jaune Mitel, icône Dark Blue,
   à gauche du numéro. En colonne réduite (numéro masqué), le rond passe sous l'avatar (.chip-flag). */
.me-line { display: flex; align-items: center; gap: 8px; }
.mode-flag {
  flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--mitel-yellow); color: var(--mitel-dark);
}
.chip-flag { display: none; width: 32px; height: 32px; }
/* Voyant de messagerie vocale : point rouge fixe sur l'icône */
.vm-ico { position: relative; display: inline-flex; }
.tb-btn { position: relative; }
.vm-led {
  position: absolute; top: -2px; right: -3px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--call-red);
}
.tb-btn .vm-led { top: 5px; right: 5px; }

/* ───────── Navigation ───────── */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-bottom { margin-top: auto; padding-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 15px; color: rgba(255,255,255,.86); position: relative; transition: background .15s, color .15s; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.active { background: #fff; color: var(--mitel-dark); font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.nav-item.active .nav-ico { color: var(--mitel-mid); }
.nav-ico { position: relative; display: inline-flex; }
.badge {
  position: absolute; top: -7px; left: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.badge.inline { position: static; margin-left: 6px; box-shadow: none; display: inline-grid; }

/* ───────── Avatars ───────── */
.avatar {
  --av: var(--brand); position: relative; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in srgb, var(--av) 14%, transparent); color: var(--av); font-weight: 600; letter-spacing: .3px;
}
[data-theme="dark"] .avatar { background: color-mix(in srgb, var(--av) 40%, transparent); color: #fff; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }
.avatar.conf { --av: var(--brand); }
.presence { position: absolute; right: -1px; bottom: -1px; width: 28%; height: 28%; min-width: 10px; min-height: 10px; border-radius: 50%; border: 2px solid var(--surface); }
.presence.free { background: var(--green); }
.presence.busy { background: var(--red); }
.presence.ringing { background: var(--amber); }
.presence { display: grid; place-items: center; color: #fff; }
.presence .ico { display: none; }
.presence.unknown { background: var(--text-3); }
.presence.unknown .ico { display: block; }
.presence.unknown .ico { width: 70%; height: 70%; stroke-width: 3.5; }
/* Ne pas déranger : sens interdit, comme dans le Dialer */
.presence.dnd { background: var(--red); }
.presence.dnd .ico { display: block; width: 72%; height: 72%; stroke-width: 4.5; stroke-linecap: butt; }

/* ───────── Boutons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px;
  border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-text); font-weight: 600; transition: background .15s;
}
.btn:hover:not(:disabled) { background: var(--brand-hover); }
.btn.ghost { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.star.on { color: var(--amber); }
.round-call {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--green-soft); color: var(--green); transition: background .15s, color .15s, transform .1s;
}
.round-call:hover { background: var(--green); color: #fff; }
.round-call:active { transform: scale(.94); }

/* ───────── Pages ───────── */
.page { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0; flex: 1; min-width: 160px; color: var(--text); letter-spacing: -.2px; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg { padding: 6px 14px; border-radius: 8px; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; transition: background .15s; }
.seg:hover { color: var(--text); }
.seg.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ───────── Recherche ───────── */
.search-field {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 16px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--text-2); transition: box-shadow .15s;
}
.search-field:focus-within { box-shadow: var(--shadow), 0 0 0 2px var(--brand); }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); font-size: 15px; }
.search-field input::placeholder { color: var(--text-3); }
/* Champ « Entrez un nom ou un numéro » : plus léger (48 px, police 17 px), dans toutes les présentations */
.search-field.big { height: 48px; padding-left: 18px; }
.search-field.big input { font-size: 17px; letter-spacing: .3px; }
/* Bouton « effacer » : ne prend de la place qu'une fois quelque chose tapé (le texte d'aide garde toute la largeur) */
.search-field.big .clear.hidden { display: none; }

/* ───────── Téléphonie ───────── */
.phone-page { max-width: none; }
/* Champ moins large, écarté du bouton vert ; tant que la fenêtre est plus étroite que la largeur maximale,
   la barre laisse de l'air de chaque côté au lieu d'occuper toute la largeur */
.dial-bar { display: flex; align-items: center; gap: 24px; width: calc(100% - 48px); max-width: 720px; margin: 0 auto 28px; }
.dial-bar .search-field { flex: 1; min-width: 0; }
.dial-title { display: none; flex: none; margin: 0; font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.dial-btn {
  flex: none; height: 48px; padding: 0 22px 0 18px; border-radius: 999px; background: var(--green); color: #fff;
  display: inline-flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--green) 45%, transparent); transition: background .15s, transform .08s;
}
.dial-btn .ico { width: 22px; height: 22px; }
.dial-btn:hover { background: var(--green-hover); }
.dial-btn:active { transform: scale(.96); }
.dial-hint { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text-2); background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; }
.dial-hint[hidden] { display: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 4px 14px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; font-weight: 700; }
.section-head .fav-ico { color: var(--amber); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20; background: var(--surface-solid); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; display: none; }
.suggest.open { display: block; }
.suggest.inline { position: static; box-shadow: none; margin-top: 8px; border: 1px solid var(--line); }
.suggest-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: left; transition: background .1s; }
.suggest-item:hover, .suggest-item:focus-visible { background: var(--hover); }
.si-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.si-name { font-weight: 600; }
.si-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-item:hover { background: transparent; }
.si-nums { display: flex; flex-direction: column; align-items: stretch; gap: 2px; flex: none; }
.si-num { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; transition: background .12s, color .12s; }
.si-num:hover, .si-num:focus-visible { background: var(--green); color: #fff; }
.transfer .si-num:hover, .transfer .si-num:focus-visible { background: var(--brand); color: var(--brand-text); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; justify-items: center; }
.key {
  width: 76px; height: 76px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transition: background .12s, transform .08s, box-shadow .12s;
}
.key:hover { background: var(--hover); }
.key:active { transform: scale(.94); background: var(--brand-soft); box-shadow: var(--shadow-sm); }
.kd { font-size: 28px; font-weight: 400; line-height: 1; }
.kl { font-size: 11px; letter-spacing: 1.5px; color: var(--text-2); text-transform: uppercase; margin-top: 3px; }
.pad.small { gap: 10px 16px; }
.pad.small .key { width: 60px; height: 60px; }
.pad.small .kd { font-size: 22px; }

/* ───────── Appels en cours ───────── */
.callstage { position: sticky; top: 0; z-index: 10; padding: 12px 32px 4px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(var(--bg-main) 80%, transparent); }
.callstage[hidden] { display: none; }
.call-card {
  --tone: var(--brand); max-width: 980px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border-left: 5px solid var(--tone); animation: slidein .25s ease-out;
}
.call-card.ringing { background: linear-gradient(90deg, var(--amber-soft), var(--surface) 60%); }
.call-card .call-id { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; text-align: left; opacity: 1; }
.call-card.banner .call-id:hover .call-name { text-decoration: underline; }
.call-text { min-width: 0; display: flex; flex-direction: column; }
.call-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: flex-start; }
.call-card .call-btn { width: 60px; }
.call-card .cb-ico { width: 40px; height: 40px; }
:is(.call-panel, .call-card).live { --tone: var(--green); }
:is(.call-panel, .call-card).ringing { --tone: var(--amber); }
:is(.call-panel, .call-card).held { --tone: var(--purple); }
.ringing .call-state { color: var(--amber-text); }
:is(.call-panel, .call-card).dialing { --tone: var(--brand); }
:is(.call-panel, .call-card).failed { --tone: var(--red); }
.call-state { display: flex; align-items: center; justify-content: inherit; gap: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--tone); }
.call-state .tag { background: var(--brand-soft); color: var(--brand); padding: 1px 8px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.timer { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 500; letter-spacing: 0; }
.call-name { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-sub { color: var(--text-2); font-size: 13px; }

/* Vue plein écran « Appels actifs » */
.calls-view { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.calls-view .call-card { max-width: none; }
.call-panel {
  --tone: var(--brand); position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 24px 36px; border-radius: 24px; box-shadow: var(--shadow);
  background: var(--mitel-gradient-light);
  animation: slidein .3s ease-out;
}
.call-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28;
  background: url("../img/comms-lines-blue.svg") no-repeat center 35% / 160% 70%;
}
.call-panel > * { position: relative; }
[data-theme="dark"] .call-panel { background: var(--mitel-gradient-dark); }
[data-theme="dark"] .call-panel::before { background-image: url("../img/comms-lines.svg"); opacity: .35; }
.call-panel .call-state { justify-content: center; font-size: 13px; margin-top: 20px; }
.call-avatar { position: relative; }
.call-avatar.big .avatar { box-shadow: 0 0 0 6px var(--surface), 0 0 0 8px color-mix(in srgb, var(--tone) 50%, transparent); }
.ringing .call-avatar::before, .ringing .call-avatar::after, .dialing .call-avatar::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--tone); animation: pulse 1.8s ease-out infinite; pointer-events: none;
}
.ringing .call-avatar::after { animation-delay: .9s; }
.avatar.xxl { width: 128px; height: 128px; font-size: 44px; }
.call-name.big { font-size: 34px; font-weight: 600; margin-top: 6px; white-space: normal; line-height: 1.2; max-width: 100%; }
.call-number { font-size: 18px; color: var(--text-2); margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.call-grid { display: grid; grid-template-columns: repeat(3, 96px); gap: 20px 28px; margin-top: 36px; justify-content: center; }
.call-main-btns { display: flex; gap: 48px; justify-content: center; margin-top: 32px; }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text); line-height: 1.25; }
.call-grid .call-btn { width: 96px; font-size: 13px; }
.call-btn:disabled { opacity: .35; }
.cb-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); transition: background .15s, transform .08s, box-shadow .15s; }
.call-panel .call-grid .cb-ico { background: rgba(255, 255, 255, .75); box-shadow: var(--shadow-sm); }
.call-btn:hover:not(:disabled) .cb-ico { background: var(--hover); box-shadow: var(--shadow); }
.call-btn:active:not(:disabled) .cb-ico { transform: scale(.93); }
.call-btn.accent .cb-ico, .call-panel .call-grid .call-btn.accent .cb-ico { background: var(--brand); color: var(--brand-text); }
.call-btn.green .cb-ico { background: var(--green); color: #fff; }
.call-btn.red .cb-ico { background: var(--red); color: #fff; }
.call-btn.green:hover:not(:disabled) .cb-ico { background: var(--green-hover); }
.call-btn.red:hover:not(:disabled) .cb-ico { background: var(--red-hover); }
.call-btn.huge .cb-ico { width: 72px; height: 72px; box-shadow: 0 8px 20px rgba(21,50,95,.18); }
.call-btn.huge .ico { width: 30px; height: 30px; }
.nav-item.nav-calls:not(.active) { font-weight: 700; }
.nav-item.nav-calls:not(.active) .nav-ico { color: var(--call-green); }

/* ───────── Historique ───────── */
.hist-page { max-width: 760px; }
.hist-page .hr-main { grid-template-columns: auto minmax(0, 1fr) auto 52px; gap: 12px; }
.hist-list { display: flex; flex-direction: column; }
.day { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 20px 4px 8px; }
.day:first-child { margin-top: 0; }
.hist-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; background: var(--surface); border-radius: var(--radius);
  margin-bottom: 6px; box-shadow: var(--shadow-sm); transition: box-shadow .15s;
}
.hist-row:hover { box-shadow: var(--shadow); }
.hist-row.unseen { box-shadow: inset 4px 0 0 var(--red), var(--shadow-sm); }
.hr-main { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(130px, auto) 64px; align-items: center; gap: 14px; padding: 10px 8px 10px 14px; text-align: left; min-width: 0; }
.hr-text { display: flex; flex-direction: column; min-width: 0; }
.hr-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row.missed .hr-name { color: var(--red); }
.hr-sub { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hr-dir { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.hr-dir.missed { color: var(--red); }
.hr-dir.incoming .ico { color: var(--green); }
.hr-dir.outgoing .ico { color: var(--brand); }
.hr-time { font-size: 13px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.hr-tools { display: flex; align-items: center; gap: 4px; padding-right: 12px; }
.hr-details { grid-column: 1 / -1; padding: 0 16px 14px 68px; display: flex; flex-direction: column; gap: 8px; animation: fadein .2s; }
.more { margin: 16px auto 0; }

/* ───────── Numéros & cartes personnes ───────── */
.pc-nums { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.num-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px;
  background: var(--surface-2); color: var(--text); font-variant-numeric: tabular-nums; transition: background .15s, color .15s;
}
.num-pill:hover { background: var(--green); color: #fff; }
.person-list { display: flex; flex-direction: column; gap: 8px; }
.person-card { display: flex; align-items: flex-start; gap: 16px; padding: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.pc-text { flex: 1; min-width: 0; }
.pc-name { font-weight: 600; font-size: 16px; }
.pc-sub { font-size: 13px; color: var(--text-2); }
.pc-tools { display: flex; gap: 2px; }

/* ───────── Favoris & supervision ───────── */
.fav-grid, .team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.fav-card, .team-card {
  position: relative; display: flex; flex-direction: column; align-items: center; background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow-sm); padding: 20px 12px 12px; transition: box-shadow .15s, transform .15s;
}
.fav-card:hover, .team-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.fav-main { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; text-align: center; }
.fav-main .avatar { margin-bottom: 8px; }
.fav-name { font-weight: 600; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-sub { font-size: 12px; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-tools { display: flex; gap: 2px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); width: 100%; justify-content: center; }
.fav-card .remove { position: absolute; top: 6px; right: 6px; background: var(--red-soft); color: var(--red); width: 28px; height: 28px; }
.fav-card.editing { animation: wiggle .3s ease-in-out infinite alternate; }
.pres-label { font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px; margin-top: 6px; }
.pres-label.free { background: var(--green-soft); color: var(--green); }
.pres-label.busy { background: var(--red-soft); color: var(--red); }
.pres-label.ringing { background: var(--amber-soft); color: var(--amber-text); }
.pres-label.unknown { background: var(--surface-2); color: var(--text-2); }
.team-card { gap: 4px; }
.team-card .ring { border-radius: 50%; padding: 4px; margin-bottom: 8px; box-shadow: 0 0 0 3px var(--green); }
.team-card.busy .ring { box-shadow: 0 0 0 3px var(--red); }
.team-card.unknown .ring { box-shadow: 0 0 0 3px var(--text-3); }
.team-card.unknown .avatar { filter: grayscale(1); opacity: .6; }
.team-card.ringing .ring { box-shadow: 0 0 0 3px var(--amber); animation: ringpulse 1s infinite; }

/* ───────── Paramètres ───────── */
/* Grande fenêtre : les blocs se rangent en colonnes (Apparence | Langue | Accessibilité…) */
.settings { max-width: 1400px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: stretch; }
.set-grid .set-block { margin-bottom: 0; }
.set-grid .set-block:is(.info, .wide) { grid-column: 1 / -1; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab { padding: 10px 2px 12px; color: var(--text-2); font-size: 15px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.set-block { background: var(--surface); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.set-block h2 { margin: 0 0 6px; font-size: 17px; }
.set-block p { margin: 0 0 14px; }
.set-block.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.set-block.info div { display: flex; flex-direction: column; gap: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; max-width: 320px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.field select, .field input { height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; border-radius: 12px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230073d0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
}
.field + .field { margin-top: 14px; }
.field select, .field input { color: var(--text); }
/* Liste ouverte (native sous Windows) : fond plein du thème, sinon texte blanc sur fond blanc en mode sombre */
.field select option { background-color: var(--surface-solid); color: var(--text); }
/* Flèche Light Blue sur fond sombre (le Mid Blue y est trop peu contrasté) */
:is([data-theme="dark"], [data-theme="contrast"]) .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300a1e0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.field input { border-radius: 12px; }
.field select:focus, .field input:focus { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 6px 0; }
.toggle.disabled { cursor: default; opacity: .55; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.track { flex: none; width: 40px; height: 22px; border-radius: 11px; border: 1px solid var(--text-2); position: relative; transition: background .15s, border-color .15s; margin-top: 1px; }
.thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background .15s; }
.toggle input:checked + .track { background: var(--brand); border-color: var(--brand); }
.toggle input:checked + .track .thumb { transform: translateX(18px); background: var(--brand-text); }
.toggle input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.tg-text { display: flex; flex-direction: column; gap: 2px; }
.dir-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 4px 24px; }
.dir-item { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.dir-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 18px; flex: none; }
[data-theme="dark"] .dir-logo { background: var(--surface-2); }

/* ───────── États vides / hors ligne ───────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 16px; gap: 6px; color: var(--text-2); max-width: 460px; margin: 0 auto; }
.empty.small { padding: 32px 16px; }
.empty h2 { color: var(--text); margin: 8px 0 0; font-size: 18px; }
.empty p { margin: 4px 0; }
.empty .btn { margin-top: 16px; }
.empty-art { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty.small .empty-art { width: 72px; height: 72px; }
.empty-art.spin { animation: breathe 1.6s ease-in-out infinite; }
.offline { padding-top: 12vh; }
.loading { display: flex; justify-content: center; gap: 6px; padding: 40px; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); animation: bounce 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }

/* ───────── Menus, dialogues, toasts ───────── */
.menu { position: fixed; z-index: 100; min-width: 220px; background: var(--surface-solid); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; animation: fadein .12s; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(21,50,95,.45); }
.dialog.dtmf { width: auto; }
.dlg { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.dlg header { display: flex; align-items: center; justify-content: space-between; }
.dlg h2 { margin: 0; font-size: 18px; }
.dlg p { margin: 0; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dlg .search-field { box-shadow: none; border: 1px solid var(--line); }
.dtmf-echo { min-height: 36px; font-size: 26px; text-align: center; letter-spacing: 4px; font-variant-numeric: tabular-nums; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-top: 8px; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--mitel-dark); color: #ffffff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; animation: slideup .2s; transition: opacity .3s, transform .3s; }
.toast.warn { background: var(--mitel-yellow); color: var(--mitel-dark); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ───────── Animations ───────── */
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
@keyframes ringpulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--amber) 40%, transparent); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes nudge { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } 50% { transform: rotate(0); } }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } }
@keyframes slideup { from { opacity: 0; transform: translateY(8px); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
@keyframes wiggle { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ───────── Responsive (onglet Teams étroit / mobile) ───────── */
@media (max-width: 900px) {
  .brand-logo { padding: 0 0 10px; }
  .brand-logo .full { display: none; }
  .brand-logo .connectors { display: block; }
  .sidebar { width: 76px; padding: 16px 10px; align-items: center; }
  .me-card { padding: 8px; background: none; margin-bottom: 4px; }
  .me-text, .me-status, .me-actions .chip-btn > span:not(.vm-ico), .nav-label { display: none; }
  .me-actions { flex-direction: column; }
  .chip-flag { display: inline-grid; }
  .me-actions { justify-content: center; margin-top: 8px; }
  .chip-btn { padding: 8px; }
  .nav-item { justify-content: center; padding: 12px; }
  .view { padding: 20px 16px 32px; }
  .callstage { padding: 8px 16px 0; }
  .call-grid { grid-template-columns: repeat(3, 80px); gap: 16px 12px; }
  .call-grid .call-btn { width: 80px; }
  .hr-main { grid-template-columns: auto minmax(0, 1fr) auto; }
  .hr-dir span:not(.muted) { display: none; }
  .hr-dir .muted { display: none; }
  .hr-time { display: none; }
}
@media (max-width: 560px) {
  /* Encoches d'iPhone (viewport-fit=cover) : le contenu reste dans la zone sûre */
  .topbar { display: flex; padding-top: calc(6px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
  .brand-logo, .sidebar::after { display: none; }
  .dial-btn { width: 48px; padding: 0; justify-content: center; }
  .dial-bar { width: 100%; gap: 14px; }
  .search-field.big { padding-left: 16px; }
  .search-field.big input { font-size: 16px; letter-spacing: .2px; }
  .dial-btn span { display: none; }
  #app { flex-direction: column; }
  .topbar { order: 0; }
  .main { order: 1; }
  .sidebar { order: 2; }
  .sidebar { width: 100%; flex-direction: row; padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .me-card, .nav-bottom { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav-item { padding: 10px; }
  .avatar.xxl { width: 96px; height: 96px; font-size: 34px; }
  .call-name.big { font-size: 26px; }
  .hr-details { padding-left: 16px; }
  /* Filtres sur toute la largeur : les libellés longs (ru, fi, pt…) tiennent sans déborder */
  .segmented { display: flex; width: 100%; }
  .seg { flex: 1 1 auto; justify-content: center; text-align: center; padding: 6px 8px; }
}

/* ───────── Barre de menu toujours en bas / toujours en haut (Paramètres › Apparence) ─────────
   Barre d'onglets horizontale à toutes les largeurs ; la bande du haut (nom, ligne, messagerie)
   remplace la carte utilisateur ; les libellés s'affichent dès que la fenêtre est assez large. */
:root:is([data-nav="top"], [data-nav="bottom"], [data-nav="compact"]) #app { flex-direction: column; }
:root:is([data-nav="top"], [data-nav="bottom"], [data-nav="compact"]) .topbar {
  display: flex; order: 0;
  padding-top: calc(6px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right));
}
:root[data-nav="top"] .sidebar { order: 1; }
:root:is([data-nav="top"], [data-nav="bottom"]) .main { order: 2; }
:root[data-nav="bottom"] .sidebar { order: 3; padding-bottom: calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
:root[data-nav="top"] .sidebar { box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
:root:is([data-nav="top"], [data-nav="bottom"]) .sidebar {
  width: 100%; flex-direction: row; align-items: center; gap: 4px; padding: 4px 8px; overflow: visible;
}
:root:is([data-nav="top"], [data-nav="bottom"]) :is(.brand-logo, .me-card) { display: none; }
:root:is([data-nav="top"], [data-nav="bottom"]) .sidebar::after { display: none; }
:root:is([data-nav="top"], [data-nav="bottom"]) .nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 4px; }
:root:is([data-nav="top"], [data-nav="bottom"]) .nav-bottom { margin: 0; padding: 0; flex: none; }
:root:is([data-nav="top"], [data-nav="bottom"]) .nav-item { width: auto; justify-content: center; padding: 10px; }
:root:is([data-nav="top"], [data-nav="bottom"]) .nav-label { display: none; }
@media (min-width: 700px) {
  :root:is([data-nav="top"], [data-nav="bottom"]) .nav { justify-content: flex-start; }
  :root:is([data-nav="top"], [data-nav="bottom"]) .nav-item { gap: 10px; padding: 9px 16px; white-space: nowrap; }
  :root:is([data-nav="top"], [data-nav="bottom"]) .nav-label { display: inline; }
  :root:is([data-nav="top"], [data-nav="bottom"], [data-nav="compact"]) .tb-logo { display: block; }
}
@media (max-width: 560px) {
  :root:is([data-nav="top"], [data-nav="bottom"]) .nav-bottom { display: none; }
}

/* Barre en haut : l'onglet actif dit déjà où l'on est, les titres de page disparaissent ;
   « Appeler » passe à gauche du champ de saisie */
:root[data-nav="top"] .page-head h1 { display: none; }
:root[data-nav="top"] .page-head:not(:has(> :not(h1))) { display: none; }
:root[data-nav="top"] .dial-title { display: block; }
:root[data-nav="top"] .dial-bar { max-width: 840px; }
@media (max-width: 560px) { :root[data-nav="top"] .dial-title { display: none; } }

/* ───────── Supervision sur téléphone : 2 postes par ligne ───────── */
@media (max-width: 560px) {
  .team-page .team-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .team-page .team-row { height: 54px; padding: 0 10px; gap: 8px; }
  .team-page .team-row .avatar { width: 32px; height: 32px; font-size: 12px; }
  .team-page .team-name { display: block; font-size: 13px; }
  .team-page .team-ext { display: none; }
  .team-page .team-sub { font-size: 11.5px; }
}

/* ───────── Bouton « position de la barre de menu », toujours en haut à droite ─────────
   Même dessin que le bouton menu du site 206 : rond de 44 px, traits en CSS, rond clair au survol.
   Le pictogramme montre la position actuelle : 3 traits = automatique, barre en haut, barre en bas.
   Chaque appui passe à la suivante (automatique → bas → haut → compact), sans menu ni infobulle. */
.navpos-btn {
  position: fixed; z-index: 30; top: calc(2px + env(safe-area-inset-top)); right: calc(6px + env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  color: var(--text); background: transparent; transition: background-color .15s;
}
.navpos-btn:hover, .navpos-btn:focus-visible { background: rgba(21, 50, 95, .10); outline: none; }
.navpos-btn:active { background: rgba(21, 50, 95, .18); }
[data-theme="a11y"] .navpos-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
[data-theme="dark"] .navpos-btn:is(:hover, :focus-visible), [data-theme="contrast"] .navpos-btn:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .16); }
/* Sur la bande bleue du haut (barre en haut/en bas, ou téléphone) : traits blancs */
:root:is([data-nav="top"], [data-nav="bottom"], [data-nav="compact"]) .navpos-btn { color: #fff; }
:root:is([data-nav="top"], [data-nav="bottom"], [data-nav="compact"]) .navpos-btn:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .16); }
:root:is([data-nav="top"], [data-nav="bottom"], [data-nav="compact"]) .topbar { padding-right: calc(52px + env(safe-area-inset-right)); }
/* Bande avec logo (≥ 700 px, 56 px de haut) : bouton centré sur la bande, et au même pixel en automatique */
@media (min-width: 700px) { .navpos-btn { top: calc(8px + env(safe-area-inset-top)); } }
@media (max-width: 560px) {
  .navpos-btn { color: #fff; }
  .navpos-btn:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .16); }
  .topbar { padding-right: calc(52px + env(safe-area-inset-right)); }
}
/* Colonne à gauche : le bouton flotte sur le contenu, on lui garde sa place (titres, bandeau d'appel) */
.page-head { padding-right: 44px; }
@media (min-width: 561px) { :root[data-nav="auto"] .callstage { padding-right: 56px; } }
.nav-glyph { position: relative; display: block; width: 20px; height: 14px; }
.nav-glyph > span { position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px; background: currentColor; }
.nav-glyph > span:nth-child(1) { top: 0; }
.nav-glyph > span:nth-child(2) { top: 6px; }
.nav-glyph > span:nth-child(3) { bottom: 0; }
/* Barre en haut / en bas : cadre d'écran avec une barre épaisse en haut ou en bas */
.nav-glyph:is([data-mode="top"], [data-mode="bottom"]) { height: 16px; border: 2px solid currentColor; border-radius: 3px; }
.nav-glyph:is([data-mode="top"], [data-mode="bottom"]) > span:not(:first-child) { display: none; }
.nav-glyph:is([data-mode="top"], [data-mode="bottom"]) > span:first-child { height: 4px; border-radius: 0; }
.nav-glyph[data-mode="bottom"] > span:first-child { top: auto; bottom: 0; }
/* Compact : cadre d'écran rempli de trois lignes serrées */
.nav-glyph[data-mode="compact"] { height: 16px; border: 2px solid currentColor; border-radius: 3px; }
.nav-glyph[data-mode="compact"] > span { left: 2px; right: 2px; }
.nav-glyph[data-mode="compact"] > span:nth-child(1) { top: 1px; }
.nav-glyph[data-mode="compact"] > span:nth-child(2) { top: 5px; }
.nav-glyph[data-mode="compact"] > span:nth-child(3) { bottom: 1px; }

/* ───────── Présentation compacte (Paramètres › Apparence › Barre de menu › Compact) ─────────
   Une seule page sous la bande du haut, sans onglets : saisie, favoris, postes supervisés hors favoris,
   puis les derniers appels qui tiennent dans la fenêtre (fitCompact, jamais d'ascenseur).
   Paramètres (avec l'onglet Aide et assistance) s'ouvre par la roue, à gauche de la messagerie vocale. */
.tb-settings { display: none; }
:root[data-nav="compact"] .tb-settings { display: inline-flex; }
.tb-btn.on, .tb-btn.on:hover { background: #fff; color: var(--mitel-dark); }
:root[data-nav="compact"] .sidebar { display: none; }
:root[data-nav="compact"] .main { order: 1; }
/* Même air sous la bande du haut qu'avec la barre en haut (marge de la page + 14 px au-dessus du champ) */
:root[data-nav="compact"] .view { padding-bottom: 12px; }
:root[data-nav="compact"] :is(.page-head h1, .dial-title) { display: none; }
:root[data-nav="compact"] .page-head:not(:has(> :not(h1))) { display: none; }
:root[data-nav="compact"] .dial-bar { margin-bottom: 24px; }
.compact-home .section-head { margin-bottom: 8px; }
.compact-home .section-head .badge.inline { margin-left: 2px; }
/* Chaque groupe (Favoris, Supervision, Historique) dans un cadre au liseré léger */
.cmp-sec { border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 12px; }
.cmp-sec + .cmp-sec { margin-top: 12px; }
.cmp-hist .hist-row:last-child { margin-bottom: 0; }
/* Repli d'un groupe : petite flèche discrète à droite du titre (vers le haut = déplié, vers le bas = replié) */
.sec-tools { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.fold-btn { display: none; width: 28px; height: 28px; border-radius: 50%; place-items: center; color: var(--text-2); transition: background .15s, color .15s; }
.compact-home .fold-btn { display: inline-grid; }
.fold-btn:hover { background: var(--hover); color: var(--text); }
.fold-btn .ico { transition: transform .2s; }
.fold-btn[aria-expanded="true"] .ico { transform: rotate(180deg); }
.cmp-sec.folded { padding-bottom: 10px; }
.cmp-sec.folded .section-head { margin-bottom: 0; }
.cmp-sec.folded > :not(.section-head), .cmp-sec.folded .sec-tools .btn { display: none; }
.sec-ico { color: var(--brand); }
.compact-home .empty.small { padding: 0; }
.compact-home .empty.small .empty-art { display: none; }
.cmp-hist > .muted { margin: 0 4px; }
.cmp-hist .hist-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr)); column-gap: 10px; align-items: start; }
.cmp-hist .hist-row { margin-bottom: 6px; border-radius: 12px; }
.cmp-hist .hr-main { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; padding: 6px 6px 6px 12px; }
.cmp-hist .avatar.md { width: 32px; height: 32px; font-size: 12px; }
.cmp-hist .hr-name { font-size: 14px; }
.cmp-hist .hr-sub { font-size: 12px; }
.cmp-hist .hr-dir > span, .cmp-hist .hr-dir .muted { display: none; }
.cmp-hist .hr-time { display: block; font-size: 12px; white-space: nowrap; }
.cmp-hist .hr-tools { padding-right: 8px; gap: 2px; }
.cmp-hist .hr-tools .icon-btn, .cmp-hist .round-call { width: 32px; height: 32px; }
.cmp-hist .hr-details { padding-left: 56px; }
@media (max-width: 560px) {
  :root[data-nav="compact"] .view { padding-bottom: 8px; }
  .cmp-sec { padding: 8px 8px 10px; border-radius: 14px; }
  .compact-home .team-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .compact-home .team-row { height: 54px; padding: 0 10px; gap: 8px; }
  .compact-home .team-row .avatar { width: 32px; height: 32px; font-size: 12px; }
  .compact-home .team-name { display: block; font-size: 13px; }
  .compact-home .team-ext { display: none; }
  .compact-home .team-sub { font-size: 11.5px; }
  .cmp-hist .hr-details { padding-left: 12px; }
}

/* Barre en haut : « Appeler » plus petit, écarté du champ, avec de l'air sous les onglets */
:root[data-nav="top"] .phone-page .dial-bar { margin-top: 14px; }
/* Compact : un peu moins d'air au-dessus du champ (30 px sous la bande), un peu plus en dessous */
:root[data-nav="compact"] .phone-page .dial-bar { margin-top: 10px; }
:root[data-nav="top"] .team-page { padding-top: 14px; }
:root[data-nav="top"] .dial-title { font-size: 21px; margin-right: 4px; }

/* ───────── Conférence ───────── */
.conf-stack { display: flex; justify-content: center; }
.conf-stack .avatar + .avatar { margin-left: -36px; }
.call-name.big.conf-names { display: flex; justify-content: center; align-items: baseline; gap: 8px; flex-wrap: nowrap; white-space: nowrap; font-size: 15px; font-weight: 600; margin-top: 8px; max-width: 100%; }
.conf-names .conf-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.conf-names + .call-number { font-size: 13px; margin-top: 2px; }
.conf-sep { color: var(--text-3); font-weight: 400; }

/* ───────── Favoris compacts (Téléphonie) ───────── */
.phone-page .fav-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 10px; }
.phone-page .fav-card { flex-direction: row; align-items: center; gap: 4px; height: 64px; padding: 0 8px 0 12px; border-radius: 12px; }
.phone-page .fav-card:hover { transform: none; }
.phone-page .fav-main { flex: 1; min-width: 0; flex-direction: row; align-items: center; gap: 12px; text-align: left; height: 100%; }
.phone-page .fav-main .avatar { margin: 0; }
.fav-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.phone-page .fav-name { font-size: 14px; }
.phone-page .fav-tools { flex: none; margin: 0; padding: 0; border: 0; width: auto; gap: 0; }
.phone-page .fav-tools .icon-btn { width: 32px; height: 32px; }
.phone-page .fav-card .remove { position: static; }
.phone-page .fav-card.editing { animation: none; box-shadow: inset 0 0 0 1px var(--red), var(--shadow-sm); }
.pres-text { font-weight: 600; }
.pres-text.free { color: var(--green); }
.pres-text.busy { color: var(--red); }
.pres-text.dnd { color: var(--red); }
.pres-text.ringing { color: var(--amber-text); }
.pres-text.unknown { color: var(--text-2); }
.phone-page .fav-card .presence { width: 16px; height: 16px; right: -3px; bottom: -3px; }
/* Tuile « Prénom / NOM » : visible seulement en largeur minimale */
.fav-tile { display: none; }
.fav-first { display: flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; font-weight: 600; font-size: 13.5px; }
.fav-first > span:last-child, .fav-last { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-last { max-width: 100%; font-size: 12px; font-weight: 600; color: var(--text-2); }
.phone-page .fav-card .presence.mini { position: static; flex: none; width: 9px; height: 9px; min-width: 9px; min-height: 9px; border: 0; }
.phone-page .fav-card .presence.mini.dnd .ico, .phone-page .fav-card .presence.mini.unknown .ico { width: 80%; height: 80%; }
/* Menu des numéros d'un favori (survol de la tuile) */
.fav-pop { min-width: 0; }
.fav-pop .menu-item { padding: 8px 12px; font-size: 13px; }
/* Menu maison des listes déroulantes (Paramètres) */
.sel-pop { overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.sel-pop .menu-item { padding: 8px 12px; font-size: 14px; color: var(--text); gap: 12px; }
.sel-pop .menu-item .mi-label { flex: 1; }
.sel-pop .menu-item.on { color: var(--brand); font-weight: 600; }
.sel-pop .menu-item:focus { background: var(--hover); outline: none; }
.fav-pop .mi-label { font-weight: 600; }
.fav-pop .mi-num { margin-left: auto; padding-left: 14px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .phone-page .fav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .phone-page .fav-card { position: relative; height: auto; padding: 0; border-radius: 10px; }
  .phone-page .fav-main { flex-direction: column; justify-content: center; gap: 1px; min-height: 46px; padding: 6px 6px; text-align: center; }
  .phone-page .fav-main .avatar, .phone-page .fav-text, .phone-page .fav-card:not(.editing) .fav-tools { display: none; }
  .phone-page .fav-tile { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; min-width: 0; }
  .phone-page .fav-card.editing .fav-tools { position: absolute; top: -6px; right: -6px; }
  .phone-page .fav-card.editing .remove { width: 22px; height: 22px; }
}

/* ───────── Infobulles aux couleurs de l'application (jamais le title natif) ───────── */
.site-tooltip {
  position: fixed; z-index: 1000; max-width: 300px; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-solid); border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(21,50,95,.18); color: var(--text); font-size: 12px; font-weight: 600; line-height: 1.4;
  pointer-events: none; opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .06s ease, transform .06s ease, visibility .06s; overflow-wrap: anywhere;
}
.site-tooltip.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.site-tooltip .tip-line + .tip-line { margin-top: 2px; font-weight: 500; color: var(--text-2); }
.site-tooltip .tip-head { font-weight: 700; }

/* ───────── Annuaire : une ligne compacte par personne ───────── */
.phone-page .person-list { display: flex; flex-direction: column; gap: 0; max-width: 920px; margin: 0 auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.person-row {
  display: grid; grid-template-columns: auto minmax(0, max-content) minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  min-height: 46px; padding: 5px 8px 5px 12px; border-bottom: 1px solid var(--line);
}
.person-row:last-child { border-bottom: 0; }
.person-row:hover { background: var(--hover); }
.pr-name { max-width: 200px; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-info { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-nums { display: flex; gap: 4px; }
.pr-nums .num-pill { padding: 3px 9px; font-size: 12.5px; white-space: nowrap; }
.pr-tools { display: flex; }
button.pr-name, button.pr-info { text-align: left; cursor: pointer; min-width: 0; }
button.pr-name:hover, button.pr-info:hover { color: var(--brand); }
/* Fiche dépliée : même dégradé clair Mitel (Periwinkle → blanc) que le panneau d'appel */
.person-row.open { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; padding-top: 10px; padding-bottom: 10px; background: var(--mitel-gradient-light); }
[data-theme="dark"] .person-row.open { background: var(--mitel-gradient-dark); }
.person-row.open .pr-tools { padding-top: 2px; }
.pr-detail { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pr-detail .pr-name { max-width: none; white-space: normal; font-size: 15px; }
.pr-line { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.pr-detail .pr-nums { flex-wrap: wrap; margin-top: 6px; }
.pr-tools .icon-btn { width: 30px; height: 30px; }
.phone-page .dir-head { max-width: 920px; margin-left: auto; margin-right: auto; }
@media (max-width: 900px) {
  .person-row { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 4px; }
  .pr-info { display: none; }
  .pr-nums { grid-column: 2 / -1; grid-row: 2; flex-wrap: wrap; }
}

/* ───────── Supervision compacte : une carte d'une ligne par poste ───────── */
/* Jusqu'à 4 postes par ligne quand la place le permet (cartes de 260 px minimum), 2 sur téléphone */
.team-page { max-width: 1400px; }
.team-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(min(260px, 100%), calc((100% - 24px) / 4)), 1fr)); gap: 8px; }
.team-row {
  display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 14px; text-align: left;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, background .15s;
}
.team-row:hover { box-shadow: var(--shadow); background: var(--hover); }
.team-row.unknown .avatar { filter: grayscale(1); opacity: .6; }
.team-row .presence { width: 14px; height: 14px; right: -2px; bottom: -2px; }
.team-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.team-name { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-ext { font-weight: 500; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.team-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
