/* Emserv Connect — EMSERV LLC — thème bleu nuit / orange */
:root {
  --navy: #0F2942;
  --navy-2: #163757;
  --navy-3: #1F4A72;
  --orange: #E8871E;
  --orange-2: #C96F0E;
  --green: #1FA463;
  --red: #E0433A;
  --blue: #2E7CF6;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --text: #13202E;
  --muted: #64748B;
  --line: #E2E8F0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 41, 66, .06), 0 4px 16px rgba(15, 41, 66, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1A2A; --card: #12263B; --text: #E6EDF5; --muted: #93A4B8; --line: #22384F;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
svg { fill: currentColor; }
[hidden] { display: none !important; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--orange); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--orange); color: #fff; }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav a { color: rgba(255,255,255,.75); padding: 7px 12px; border-radius: 8px; }
.mainnav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.mainnav a.on { background: var(--navy-3); color: #fff; }
.topbar-right { margin-left: auto; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--orange); color: #fff; font-weight: 700; position: relative; flex: none;
}
.avatar-lg { width: 42px; height: 42px; background: var(--navy-3); }
.menu-pop {
  position: absolute; right: 0; top: 44px; min-width: 220px; background: var(--card); color: var(--text);
  border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.2); padding: 8px; border: 1px solid var(--line);
}
.menu-who { padding: 8px 10px; display: flex; flex-direction: column; }
.menu-who span { color: var(--muted); font-size: 13px; }
.menu-langs { display: flex; gap: 4px; padding: 6px 6px 10px; border-bottom: 1px solid var(--line); }
.menu-langs a, .login-langs a { flex: 1; text-align: center; padding: 5px 6px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.menu-langs a.on, .login-langs a.on { background: var(--orange); color: #fff; }
.menu-item { display: block; padding: 9px 10px; border-radius: 8px; color: var(--text); }
.menu-item:hover { background: var(--bg); text-decoration: none; }

/* ---------- Barre d'onglets mobile ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .mainnav { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: var(--safe-b);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); font-size: 11px; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.on { color: var(--orange); }
  .tabbar svg { width: 24px; height: 24px; }
  .main { padding-bottom: calc(76px + var(--safe-b)); }
  .hide-sm { display: none; }
}

.main { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ---------- Éléments communs ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font: inherit; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: #E7F6EE; color: #0F6B3F; border: 1px solid #BFE6D0; }
.flash-err { background: #FDECEB; color: #A12C25; border-color: #F6C5C1; }
.hint { margin: 8px 0 12px; padding: 10px 14px; border-radius: 10px; background: #FFF4E5; color: #8A4B05; border: 1px solid #F8D6A8; font-size: 14px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag-on { background: #E7F6EE; color: #0F6B3F; border-color: #BFE6D0; }
.tag-warn { background: #FFF4E5; color: #8A4B05; border-color: #F8D6A8; }
.tag-off { background: #FDECEB; color: #A12C25; border-color: #F6C5C1; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; list-style: none; }

.form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; }
input, select {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-danger { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.row-off { opacity: .55; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font-size: 22px; color: var(--navy); }
@media (prefers-color-scheme: dark) { .stat b { color: var(--orange); } }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }

.dir { font-weight: 700; width: 20px; text-align: center; }
.dir-in { color: var(--blue); }
.dir-out { color: var(--green); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0;
  transition: .25s; z-index: 100; max-width: 90vw; text-align: center; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Connexion ---------- */
.page-login { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-3) 100%); min-height: 100vh; }
.page-login .main { display: grid; place-items: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 380px; }
.login-card { background: var(--card); border-radius: 18px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center; }
.login-card form { text-align: left; margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--orange); color: #fff; margin-bottom: 10px; }
.login-card h1 b { color: var(--orange); }
.login-langs { display: flex; gap: 4px; margin-top: 18px; }
.login-foot { text-align: center; color: rgba(255,255,255,.5); font-size: 12px; }

/* ---------- Téléphone ---------- */
.phone { max-width: 420px; margin: 0 auto; }
.phone-status { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.phone-me { font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--card); border: 1px solid var(--line); }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.pill-on i { background: var(--green); box-shadow: 0 0 0 3px rgba(31,164,99,.2); }
.pill-off i { background: var(--red); }
.pill-wait i { background: var(--orange); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }

.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg-inline { margin: 0; }
.seg-btn { flex: 1; border: 0; background: none; padding: 8px 12px; border-radius: 9px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; text-align: center; white-space: nowrap; }
.seg-btn:hover { text-decoration: none; }
.seg-btn.on { background: var(--navy); color: #fff; }

.dial-display { display: flex; align-items: center; gap: 6px; margin: 4px 0 14px; }
.dial-display input {
  flex: 1; text-align: center; font-size: 30px; letter-spacing: .06em; border: 0; background: none;
  padding: 6px; font-weight: 500;
}
.dial-display input:focus { outline: 0; }
.icon-btn { border: 0; background: none; color: var(--muted); padding: 8px; cursor: pointer; border-radius: 10px; }
.icon-btn svg { width: 26px; height: 26px; }
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; justify-items: center; }
.key {
  width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font: inherit;
  transition: transform .06s, background .1s; user-select: none; -webkit-user-select: none;
}
.key:active { transform: scale(.94); background: var(--line); }
.key b { font-size: 28px; font-weight: 400; line-height: 1; }
.key small { font-size: 10px; letter-spacing: .14em; color: var(--muted); height: 12px; margin-top: 2px; }
.dial-actions { display: flex; justify-content: center; align-items: center; gap: 28px; margin: 18px 0 8px; }
.round {
  width: 68px; height: 68px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.18); transition: transform .08s;
}
.round:active { transform: scale(.93); }
.round svg { width: 30px; height: 30px; }
.round-call { background: var(--green); }
.round-video { background: var(--blue); width: 54px; height: 54px; }
.round-video svg { width: 24px; height: 24px; }
.round-hangup { background: var(--red); }
.round-hangup svg { width: 34px; height: 34px; }
.round-spacer { width: 54px; }
.dial-tips { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-main em { font-weight: 400; color: var(--muted); font-style: normal; }
.item-main small { color: var(--muted); font-size: 13px; }
.item-missed .item-main b { color: var(--red); }
.item-time { font-size: 12px; color: var(--muted); }
.item-acts { display: flex; gap: 8px; }
.list-more { display: block; text-align: center; padding: 12px; font-size: 14px; }
.mini { width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; display: grid; place-items: center; }
.mini svg { width: 18px; height: 18px; }
.mini-call { background: var(--green); }
.mini-video { background: var(--blue); }
.dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--card); }
.dot-on { background: var(--green); }
.dot-off { background: #9AA8B8; }

/* ---------- Écran d'appel ---------- */
.call {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: max(40px, env(safe-area-inset-top)) 20px calc(36px + var(--safe-b));
  background: radial-gradient(circle at 50% 20%, var(--navy-3), var(--navy) 70%); color: #fff; overflow: hidden;
}
.call-head { text-align: center; position: relative; z-index: 2; margin-top: 30px; }
.call-avatar {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center;
  font-size: 40px; font-weight: 700; background: var(--orange);
}
.call.is-incoming .call-avatar { animation: ring 1.2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(232,135,30,.6); } 100% { box-shadow: 0 0 0 26px rgba(232,135,30,0); } }
.call-name { font-size: 26px; font-weight: 600; }
.call-number { opacity: .7; margin-top: 2px; }
.call-state { margin-top: 10px; font-size: 16px; opacity: .9; font-variant-numeric: tabular-nums; }
.call.has-video .call-head { margin-top: 0; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.call.has-video .call-avatar { display: none; }
.call-video { position: absolute; inset: 0; background: #000; z-index: 1; }
.call-video #remoteVideo { width: 100%; height: 100%; object-fit: cover; }
.call-video #localVideo {
  position: absolute; right: 16px; top: max(16px, env(safe-area-inset-top)); width: 28vw; max-width: 180px;
  aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.7);
  transform: scaleX(-1); background: #222;
}
.call-controls {
  position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 26px; margin: 20px 0;
}
.ctl { background: none; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; font: inherit; font-size: 12px; cursor: pointer; }
.ctl-ico { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ctl-ico svg { width: 26px; height: 26px; }
.ctl.on .ctl-ico { background: #fff; color: var(--navy); }
.call-actions { position: relative; z-index: 2; display: flex; gap: 40px; align-items: center; }
.call-dtmf { position: relative; z-index: 3; }
.dtmf-display { text-align: center; font-size: 24px; min-height: 32px; letter-spacing: .1em; }
.dialpad-sm { gap: 10px; }
.dialpad-sm .key { width: 62px; height: 62px; background: rgba(255,255,255,.14); color: #fff; border: 0; box-shadow: none; }
.dialpad-sm .key b { font-size: 24px; }
body.in-call { overflow: hidden; }

/* ---------- Déblocage audio ---------- */
.unlock {
  position: fixed; inset: 0; z-index: 60; background: rgba(15,41,66,.92); display: grid; place-items: center; padding: 20px;
}
.unlock-btn {
  border: 0; background: var(--card); color: var(--text); border-radius: 20px; padding: 28px 24px; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; font: inherit; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.unlock-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; }
.unlock-btn b { font-size: 18px; }
.unlock-btn small { color: var(--muted); font-size: 14px; }

/* ---------- Ne pas déranger ---------- */
.pill-dnd i { background: #8B5CF6; box-shadow: 0 0 0 3px rgba(139,92,246,.2); }

/* ---------- Mes réglages ---------- */
.settings { max-width: 760px; margin: 0 auto; }
.set-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 6px 0; }
.set-nav a { padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.set-nav a:hover { text-decoration: none; border-color: var(--orange); }
.set-card { margin-bottom: 16px; scroll-margin-top: 110px; }
.set-card h3 { font-size: 15px; margin: 0 0 10px; }
.sep { border: 0; border-top: 1px dashed var(--line); margin: 18px 0; }
.warn { color: #B45309; }
.switch-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
.switch-row small { font-weight: 400; color: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 99px; background: #CBD5E1; position: relative; cursor: pointer; flex: none; padding: 0; border: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch:focus { outline: 2px solid var(--orange); outline-offset: 2px; }
.tones { display: grid; gap: 8px; }
.tone { flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 500; cursor: pointer; }
.tone:has(input:checked) { border-color: var(--orange); background: rgba(232,135,30,.08); }
.tone input { width: auto; accent-color: var(--orange); }
.tone span { flex: 1; }
input[type=range] { padding: 0; accent-color: var(--orange); background: none; border: 0; }
.meter { height: 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; margin-top: -4px; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--orange)); transition: width .08s; }
.cam-preview { width: 100%; max-width: 320px; border-radius: 12px; background: #000; transform: scaleX(-1); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } .set-nav { top: 0; } }

/* ---------- Messagerie vocale (v0.3) ---------- */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; line-height: 1; }
.tabbar a { position: relative; }
.tabbar .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
.vm-page { max-width: 760px; margin: 0 auto; }
.vm-item { align-items: flex-start; }
.vm-item .item-main b { white-space: normal; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vm-unread { background: rgba(232,135,30,.06); }
.vm-unread .item-main b { color: var(--orange-2); }
.vm-audio { width: 100%; margin-top: 8px; height: 36px; }
.vm-acts { display: flex; gap: 8px; }
.mini-del { background: var(--bg); color: var(--red); border: 1px solid var(--line); }
a.mini:hover { text-decoration: none; }

/* ---------- Ligne téléphonique ---------- */
.steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; }
.steps li { line-height: 1.5; }

/* ---------- Standard automatique (v0.4) ---------- */
.modes { display: grid; gap: 8px; }
.mode { flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.mode:has(input:checked) { border-color: var(--orange); background: rgba(232,135,30,.08); }
.mode input { width: auto; margin-top: 3px; accent-color: var(--orange); }
.mode span { display: flex; flex-direction: column; gap: 2px; }
.mode small { font-weight: 400; color: var(--muted); }
.ivr-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 700px) { .ivr-ways { grid-template-columns: 1fr; } }
.ivr-way { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; }
.ivr-way input[type=file] { flex: 1; min-width: 0; padding: 6px; font-size: 13px; }
.script { margin-top: 12px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.script summary { cursor: pointer; font-weight: 600; }
.script p { margin: 8px 0 0; font-style: italic; }

/* ---------- v0.5 : groupes, touches, horaires, SMS ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.subnav a { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.subnav a:hover { border-color: var(--orange); text-decoration: none; }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
label.chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
label.chk input { width: auto; accent-color: var(--orange); }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; margin-bottom: 4px; }
.keys-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
@media (max-width: 700px) { .keys-grid { grid-template-columns: 1fr; } }
label.key-row { flex-direction: row; align-items: center; gap: 8px; }
label.key-row select { flex: 1; min-width: 0; }
.key-cap { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 700;
  background: var(--navy); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.hours-table { display: grid; gap: 6px; margin: 4px 0 8px; }
.hours-row { display: grid; grid-template-columns: 140px 1fr auto 1fr; align-items: center; gap: 8px; }
.hours-row input[type=time] { min-width: 0; }
.hours-row:has(input[type=checkbox]:not(:checked)) input[type=time] { opacity: .4; }
@media (max-width: 480px) { .hours-row { grid-template-columns: 110px 1fr auto 1fr; gap: 4px; } }
.page-head .pill { flex: none; }
.grp-members { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.grp-members li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.grp-members li:last-child { border-bottom: 0; }
.grp-members li:has(input:checked) { background: rgba(232,135,30,.07); }
.grp-move { display: flex; gap: 4px; }
.grp-move .mini { width: 28px; height: 28px; font-size: 11px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.grp-avatar { background: var(--orange); font-size: 14px; }

.sms-page { max-width: 1000px; margin: 0 auto; }
.sms-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.sms-layout:not(.has-thread) { grid-template-columns: 1fr; max-width: 640px; }
.sms-threads { padding: 0; overflow: hidden; }
.sms-threads .list { border: 0; border-radius: 0; }
a.sms-thread { color: var(--text); }
a.sms-thread:hover { text-decoration: none; background: var(--bg); }
a.sms-thread.on { background: rgba(232,135,30,.1); }
.sms-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sms-head b { flex: 1; font-size: 17px; }
.sms-back { display: none; }
.bubbles { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; max-height: 60vh; overflow-y: auto; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--navy-3); color: #fff; border-color: transparent; border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }
.bubble p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.bubble small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.bubble img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: 6px; }
.sms-file { display: inline-block; margin-bottom: 6px; font-size: 13px; }
.sms-del { margin: 6px 0 8px; }
@media (max-width: 720px) {
  .sms-layout, .sms-layout.has-thread { grid-template-columns: 1fr; }
  .sms-layout.has-thread .sms-threads { display: none; }
  .sms-back { display: inline-flex; }
}

/* ---------- v0.6 : envoi de SMS, transcription ---------- */
.sms-compose { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.sms-input { display: flex; gap: 8px; align-items: flex-end; }
.sms-input textarea { flex: 1; min-width: 0; resize: none; font: inherit; padding: 10px 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); color: var(--text); max-height: 180px; }
.sms-input .btn { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex: none; }
.bubble.out small { color: rgba(255,255,255,.75); }
.sms-st-on { color: #9BE7BF; font-weight: 600; }
.sms-st-off { color: #FFB4AE; font-weight: 600; }
.sms-err { display: block; color: #FFD1CC; font-size: 11px; }
.mini-sms { background: var(--orange); }
.vm-text { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--orange); background: var(--bg); border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.45; font-style: italic; white-space: normal; }
p.vm-text { font-style: normal; font-size: 13px; }

/* ---------- v0.7 : console, clients, crédit, inscription ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; position: relative; }
.tabs a.on { color: var(--text); border-bottom-color: var(--orange); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs .nav-badge { position: static; margin-left: 4px; }
.grid-wide { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) { .grid-wide { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat small { color: var(--muted); font-size: 12.5px; }
.stat b { font-size: 22px; }
.stat-big b { font-size: 28px; color: var(--navy); }
@media (prefers-color-scheme: dark) { .stat-big b { color: var(--text); } }
.neg { color: var(--red); }
.pos { color: var(--green); }
.ledger td { padding: 8px 6px; vertical-align: top; }
.ledger .right { white-space: nowrap; text-align: right; }
.table td.right, .table th.right { text-align: right; }
.credit-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.rates-table { display: grid; gap: 6px; max-width: 420px; margin-bottom: 8px; }
.rates-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rates-head span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.danger-zone { border-color: rgba(224,67,58,.35); }
.danger-zone .form-row input { max-width: 220px; }
.console code { font-size: 12px; background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.modes-2 { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
@media (max-width: 480px) { .modes-2 { grid-template-columns: 1fr; } }
.signup-card { max-width: 460px; }
.signup-card form { display: grid; gap: 12px; text-align: left; }
.login-signup { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
