/* ───────── Jetons de thème (alignés sur Microsoft Teams / Fluent 2) ───────── */
:root, [data-theme="light"] {
  --bg: #f5f5f5;
  --bg-main: #fafafa;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --surface-3: #e8e8ee;
  --hover: #f0f0f5;
  --line: #e1e1e1;
  --text: #242424;
  --text-2: #616161;
  --text-3: #8a8a8a;
  --brand: #5b5fc7;
  --brand-hover: #4f52b2;
  --brand-soft: #e8ebfa;
  --brand-text: #ffffff;
  --green: #13a10e;
  --green-hover: #0f8a0b;
  --green-soft: #e7f6e6;
  --red: #c4314b;
  --red-hover: #a72a40;
  --red-soft: #fdf3f4;
  --amber: #d97706;
  --amber-soft: #fff4e5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.08), 0 0 1px rgba(0,0,0,.06);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 0 2px rgba(0,0,0,.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.16), 0 0 2px rgba(0,0,0,.1);
  --radius: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1f1f1f;
  --bg-main: #292929;
  --surface: #2e2e2e;
  --surface-2: #383838;
  --surface-3: #3d3e66;
  --hover: #3a3a3a;
  --line: #3d3d3d;
  --text: #ffffff;
  --text-2: #d6d6d6;
  --text-3: #a3a3a3;
  --brand: #7f85f5;
  --brand-hover: #9299f7;
  --brand-soft: #3d3e66;
  --brand-text: #1f1f1f;
  --green: #54b054;
  --green-hover: #6cc06c;
  --green-soft: #1f3a1f;
  --red: #e37d80;
  --red-hover: #ee9598;
  --red-soft: #3e1f25;
  --amber: #f2b44c;
  --amber-soft: #3d3020;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}
[data-theme="contrast"] {
  --bg: #000; --bg-main: #000; --surface: #000; --surface-2: #000; --surface-3: #000; --hover: #1aebff33;
  --line: #fff; --text: #fff; --text-2: #fff; --text-3: #fff;
  --brand: #1aebff; --brand-hover: #ffff01; --brand-soft: #000; --brand-text: #000;
  --green: #3ff23f; --green-hover: #ffff01; --green-soft: #000;
  --red: #ff6b6b; --red-hover: #ffff01; --red-soft: #000;
  --amber: #ffff01; --amber-soft: #000;
  --shadow-sm: none; --shadow: none; --shadow-lg: none;
  color-scheme: dark;
}
[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: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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 ───────── */
#app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 280px; flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 20px 16px 16px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto;
}
.main { flex: 1; min-width: 0; overflow-y: auto; background: var(--bg-main); display: flex; flex-direction: column; }
.view { flex: 1; padding: 24px 32px 40px; }

/* ───────── Carte utilisateur ───────── */
.me-card {
  border-radius: var(--radius); padding: 16px;
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 55%, var(--surface)));
  margin-bottom: 12px;
}
.me-row { display: flex; align-items: center; gap: 12px; }
.me-text { min-width: 0; }
.me-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-line { font-size: 22px; font-weight: 300; letter-spacing: .5px; color: var(--text); font-variant-numeric: tabular-nums; }
.me-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.me-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.me-status.ok .dot { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.me-status.pending .dot { background: var(--amber); animation: blink 1.2s infinite; }
.me-status.err .dot { background: var(--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;
  background: var(--surface); box-shadow: var(--shadow-sm); font-size: 13px; transition: background .15s;
}
.chip-btn:hover { background: var(--hover); }
.chip-flag { display: inline-flex; padding: 6px; border-radius: 50%; background: var(--surface); color: var(--brand); }

/* ───────── 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: var(--text); position: relative; transition: background .15s, color .15s; text-align: left;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--brand); color: var(--brand-text); font-weight: 600; box-shadow: var(--shadow-sm); }
.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;
  box-shadow: 0 0 0 2px var(--surface);
}
.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) 16%, var(--surface)); color: var(--av); font-weight: 600; letter-spacing: .3px;
}
[data-theme="dark"] .avatar { background: color-mix(in srgb, var(--av) 35%, var(--surface)); 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); animation: blink 1s infinite; }

/* ───────── 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: 24px; font-weight: 700; margin: 0; flex: 1; min-width: 160px; }
.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); }
.search-field.big { height: 56px; padding-left: 22px; }
.search-field.big input { font-size: 20px; letter-spacing: .5px; }
.search-field.wide { max-width: 640px; margin-bottom: 20px; }

/* ───────── Clavier ───────── */
.keypad-view { max-width: 400px; margin: 12px auto 0; display: flex; flex-direction: column; align-items: stretch; gap: 28px; }
.dial-box { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20; background: var(--surface); 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; }
.si-num { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.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-foot { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; align-items: center; }
.dial-btn {
  width: 76px; height: 76px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--green) 45%, transparent); transition: background .15s, transform .08s;
}
.dial-btn:hover { background: var(--green-hover); }
.dial-btn:active { transform: scale(.94); }
.icon-btn.back { width: 56px; height: 56px; }
.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: #8764b8; }
: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: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--tone) 22%, var(--surface)) 0%, var(--surface) 70%);
  animation: slidein .3s ease-out;
}
.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: color-mix(in srgb, var(--surface) 70%, transparent); 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 color-mix(in srgb, currentColor 0%, rgba(0,0,0,.18)); }
.call-btn.huge .ico { width: 30px; height: 30px; }
.call-btn.green.huge .cb-ico { animation: nudge 1.4s ease-in-out infinite; }
.nav-item.nav-calls:not(.active) { color: var(--green); font-weight: 600; }
.nav-item.nav-calls .nav-ico { animation: breathe 1.6s ease-in-out infinite; }

/* ───────── Historique ───────── */
.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); animation: fadein .2s; }
.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; animation: fadein .2s;
}
.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); }
.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.ringing .ring { box-shadow: 0 0 0 3px var(--amber); animation: ringpulse 1s infinite; }

/* ───────── Paramètres ───────── */
.settings { max-width: 720px; }
.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: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: flex; flex-direction: column; gap: 4px; }
.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; }
.dir-logo.AAD { background: #e5f1fb; color: #0078d4; }
.dir-logo.OC { background: #e5f1fb; color: #0f6cbd; }
.dir-logo.GC { background: #fdecea; color: #ea4335; }
.dir-logo.MD { background: #e6f3fb; color: #0073d0; }
[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); 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); color: var(--text); box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.35); }
.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(--text); color: var(--bg-main); 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(--amber); color: #000; }
.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) {
  .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, .chip-flag, .nav-label { display: none; }
  .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) {
  #app { flex-direction: column-reverse; }
  .sidebar { width: 100%; flex-direction: row; padding: 4px 8px; 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; }
  .key, .dial-btn { width: 68px; height: 68px; }
  .avatar.xxl { width: 96px; height: 96px; font-size: 34px; }
  .call-name.big { font-size: 26px; }
  .hr-details { padding-left: 16px; }
}

/* ───────── Conférence ───────── */
.conf-stack { display: flex; justify-content: center; }
.conf-stack .avatar + .avatar { margin-left: -36px; }
.conf-names { display: flex; justify-content: center; align-items: baseline; gap: 12px; flex-wrap: nowrap; white-space: nowrap; font-size: 28px; }
.conf-names .conf-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.conf-sep { color: var(--text-3); font-weight: 400; }
