/* CorpComm — панель коммутатора. Тема: «щит телефонной станции»: тёмно-синяя панель,
   сигнальные лампы (зелёная — на линии, янтарная — разговор). */
:root {
  --ink: #16243d;          /* панель станции */
  --ink-2: #21345a;
  --ink-line: #2c4370;
  --paper: #f3f5f8;
  --card: #ffffff;
  --text: #1a2233;
  --mute: #5f6b80;
  --line: #dde2ea;
  --soft: #eef1f6;
  --accent: #2f6fdf;
  --accent-ink: #ffffff;
  --lamp-on: #2fb67c;
  --lamp-call: #f2a93b;
  --lamp-off: #c3cad6;
  --danger: #d83b45;
  --warn: #b97a10;
  --ok: #1d8f5e;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(22, 36, 61, .06), 0 4px 16px rgba(22, 36, 61, .06);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1828; --card: #16223a; --text: #e5eaf3; --mute: #93a0b8; --line: #263656; --soft: #1c2a46;
    --accent: #5b92ff; --lamp-off: #3a4a69; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --ink: #0b1322; --ink-2: #15213a; --ink-line: #24365c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1828; --card: #16223a; --text: #e5eaf3; --mute: #93a0b8; --line: #263656; --soft: #1c2a46;
  --accent: #5b92ff; --lamp-off: #3a4a69; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --ink: #0b1322; --ink-2: #15213a; --ink-line: #24365c; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
code, .code { font-family: var(--mono); font-size: 13px; background: var(--soft); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
pre { font-family: var(--mono); font-size: 12.5px; background: var(--soft); padding: 12px; border-radius: var(--radius-s); overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 620; }
p { margin: 0 0 10px; }
.mute { color: var(--mute); }
.small { font-size: 13px; }

/* ---------- Boot ---------- */
#app.booting { display: grid; place-items: center; min-height: 100vh; background: var(--ink); }
.boot-lamp { width: 14px; height: 14px; border-radius: 50%; background: var(--lamp-call); box-shadow: 0 0 18px var(--lamp-call); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .35 } to { opacity: 1 } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c9d4e8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 17px; }
.brand img { width: 28px; height: 28px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: #8b9bbb; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-sec { font-size: 12px; color: #7d8db0; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #c9d4e8; padding: 8px 10px; border-radius: 8px; font-size: 14.5px; text-decoration: none; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-line); color: #fff; }
.nav a.active svg { opacity: 1; }
.side-foot { padding: 12px 14px 18px; border-top: 1px solid var(--ink-line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink-line); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; }
.side-foot .who { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.side-foot .who b { color: #fff; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { color: #8b9bbb; }
.icon-btn { background: transparent; border: 0; color: inherit; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--ink-2); }
.icon-btn svg { width: 18px; height: 18px; }

.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--mute); font-size: 14px; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Building blocks ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.panel.flush .panel-head { padding: 16px 18px 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font-weight: 580; cursor: pointer; font-size: 14px; white-space: nowrap; text-decoration: none; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); filter: none; }
.btn.danger { background: var(--danger); }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 560; }

/* Лампы — главный визуальный мотив */
.lamp { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lamp-off); flex: none; vertical-align: middle; }
.lamp.on { background: var(--lamp-on); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lamp-on) 22%, transparent); }
.lamp.call { background: var(--lamp-call); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lamp-call) 25%, transparent); animation: pulse .9s ease-in-out infinite alternate; }
.lamp.bad { background: var(--danger); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; background: var(--soft); color: var(--text); white-space: nowrap; }
.badge .sw { width: 8px; height: 8px; border-radius: 3px; }
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }

/* ---------- Switchboard (дашборд) ---------- */
.board { background: var(--ink); border-radius: var(--radius-l); padding: 20px; color: #c9d4e8; margin-bottom: 18px; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.board-head h2 { color: #fff; margin: 0; font-size: 17px; }
.board-legend { display: flex; gap: 14px; font-size: 13px; color: #8b9bbb; flex-wrap: wrap; }
.board-legend span { display: inline-flex; align-items: center; gap: 6px; }
.jacks { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.jack { background: var(--ink-2); border: 1px solid var(--ink-line); border-radius: 10px; padding: 9px 11px; display: grid; grid-template-columns: auto 1fr; gap: 2px 9px; align-items: center; color: #c9d4e8; text-decoration: none; min-width: 0; }
.jack:hover { border-color: #4a6396; text-decoration: none; }
.jack .lamp { grid-row: span 2; width: 11px; height: 11px; }
.jack b { color: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.jack span { font-size: 12px; color: #8b9bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jack.off { opacity: .45; }
.board-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ink-line); }
.board-stats div { font-size: 13px; color: #8b9bbb; }
.board-stats b { display: block; color: #fff; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }

.calls-live { display: grid; gap: 8px; }
.call-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.call-row .cord { font-weight: 600; }
.call-row .cord i { font-style: normal; color: var(--lamp-call); margin: 0 8px; }
.call-row .dur { font-variant-numeric: tabular-nums; color: var(--mute); font-size: 13px; }
.health { display: grid; gap: 10px; }
.health-row { display: flex; gap: 10px; align-items: flex-start; }
.health-row .lamp { margin-top: 6px; }
.health-row b { display: block; font-weight: 600; font-size: 14px; }
.health-row span { color: var(--mute); font-size: 13px; word-break: break-word; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--mute); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tbl .ext { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px; }
.tbl td.right, .tbl th.right { text-align: right; }
.tbl .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { padding: 34px 18px; text-align: center; color: var(--mute); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .input { width: auto; }
.toolbar .grow { flex: 1 1 220px; min-width: 0; }

/* ---------- Forms ---------- */
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-height: 38px; }
textarea.input { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13.5px; font-weight: 560; margin-bottom: 5px; }
.field .help { font-size: 12.5px; color: var(--mute); margin-top: 4px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.check b { font-weight: 560; display: block; font-size: 14px; }
.check span { font-size: 12.5px; color: var(--mute); }
.checks { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; max-height: 280px; overflow: auto; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--lamp-off); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + i { background: var(--lamp-on); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-err { color: var(--danger); font-size: 13.5px; margin: 4px 0 12px; display: none; background: color-mix(in srgb, var(--danger) 9%, transparent); padding: 8px 11px; border-radius: 8px; }
.form-err.show { display: block; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row label { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.color-row input { display: none; }
.color-row input:checked + label { border-color: var(--text); }

/* ---------- Key-value ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; }
.kv dt { color: var(--mute); font-size: 13.5px; }
.kv dd { margin: 0; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.copy { background: none; border: 0; color: var(--mute); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-grid; }
.copy:hover { color: var(--accent); }
.copy svg { width: 15px; height: 15px; }
.secret { font-family: var(--mono); font-size: 13.5px; letter-spacing: .02em; }

.qr-box { background: #fff; border-radius: var(--radius); padding: 10px; display: inline-block; border: 1px solid var(--line); }
.qr-box img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }

.notice { border-radius: var(--radius); padding: 11px 14px; font-size: 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: color-mix(in srgb, var(--lamp-call) 16%, transparent); }
.notice.info { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.notice.bad { background: color-mix(in srgb, var(--danger) 11%, transparent); }
.notice .grow { flex: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--mute); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

.meter { height: 6px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--lamp-on); border-radius: 999px; }
.meter.warn i { background: var(--lamp-call); }
.meter.bad i { background: var(--danger); }

.grid.g3, .grid.g2 { margin-bottom: 18px; }
.grid > .panel { margin-bottom: 0; }
.group-card { align-content: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; background: var(--card); }
.group-card .gc-head { display: flex; align-items: center; gap: 10px; }
.group-card .gc-head .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.group-card .gc-head b { flex: 1; font-size: 15px; }
.rights { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.right-pill { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.right-pill.yes { border-color: transparent; background: color-mix(in srgb, var(--lamp-on) 15%, transparent); color: var(--ok); }

.ivr-opts { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.ivr-opts .key { width: 36px; height: 36px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-weight: 650; }
audio { width: 100%; height: 36px; }

/* ---------- Modal / toast ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(11, 19, 34, .55); display: grid; place-items: center; padding: 18px; z-index: 50; animation: fade .12s ease-out; }
.modal { background: var(--card); border-radius: var(--radius-l); width: min(520px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: rise .16s ease-out; }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 18px 20px 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 6px; }
.modal .icon-btn:hover { background: var(--soft); }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { transform: translateY(8px); opacity: 0 } }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; animation: rise .16s ease-out; }
.toast.err { background: var(--danger); }
.toast .lamp { margin-top: 6px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(360px, 460px); }
.login-art { background: var(--ink); color: #c9d4e8; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login-art h1 { color: #fff; font-size: 30px; max-width: 420px; margin-top: 40px; }
.login-art p { max-width: 420px; color: #8b9bbb; }
.login-art .jacks { max-width: 520px; grid-template-columns: repeat(6, 1fr); }
.login-art .jack { padding: 10px; display: grid; place-items: center; }
.login-art .jack .lamp { grid-row: auto; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--card); }
.login-form form { width: 100%; max-width: 340px; }
.login-form h2 { font-size: 22px; margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .g-side { grid-template-columns: 1fr; } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(11,19,34,.5); }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar b { flex: 1; font-size: 16px; }
  .page { padding: 18px 14px 50px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .fields-2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .board { padding: 14px; }
  .jacks { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  /* Таблицы → карточки */
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stack td::before { content: attr(data-label); color: var(--mute); font-size: 13px; text-align: left; flex: none; }
  .tbl.stack td.lead { font-size: 16px; text-align: left; justify-content: flex-start; padding-bottom: 6px; }
  .tbl.stack td.lead::before { display: none; }
  .tbl.stack .row-actions { justify-content: flex-end; }
  .call-row { grid-template-columns: auto 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .qr-box img { width: 220px; height: 220px; }
  .modal-wrap { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: var(--radius-l) var(--radius-l) 0 0; max-height: 92vh; }
  .modal-foot { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.mt { margin-top: 12px; }
.pad { padding: 4px 18px 8px; }
h3.mt { margin-top: 16px; }

/* ---------- v3: сегменты, режимы, расписания, голосовая почта, инструкции ---------- */
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 14px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 560; font-size: 13.5px; color: var(--mute); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; gap: 10px; cursor: pointer; align-items: flex-start; }
.mode-card input { margin-top: 3px; accent-color: var(--accent); }
.mode-card b { display: block; margin-bottom: 2px; }
.mode-card span { font-size: 12.5px; color: var(--mute); }
.mode-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.slot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.slot .input[type=time] { width: auto; }
.day-pick { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.day-pick label { cursor: pointer; }
.day-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.day-pick span { display: inline-grid; place-items: center; min-width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; font-weight: 560; color: var(--mute); }
.day-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.vm-list { display: grid; gap: 10px; }
.vm-item { display: grid; grid-template-columns: minmax(120px, auto) 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.vm-item:last-child { border-bottom: 0; }
.vpn-opt h3 { display: flex; align-items: center; gap: 8px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.big-secret { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.big-secret code { font-size: 20px; padding: 6px 12px; letter-spacing: .04em; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
.right-pill.warn { border-color: transparent; background: color-mix(in srgb, var(--lamp-call) 18%, transparent); color: var(--warn); }
.panel.narrow { max-width: 520px; }
.steps { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; font-size: 14px; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-weight: 650; font-size: 12.5px; }
.app-guide { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; margin-bottom: 10px; }
.app-guide summary { cursor: pointer; padding: 12px 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.app-guide summary::-webkit-details-marker { display: none; }
.app-guide summary::before { content: "▸"; color: var(--mute); transition: transform .15s; }
.app-guide[open] summary::before { transform: rotate(90deg); }
.cab-board .board-stats { margin-top: 0; padding-top: 0; border-top: 0; }
.cab-board .board-stats b { display: flex; align-items: center; gap: 8px; font-size: 18px; }
audio { min-width: 180px; }
[hidden] { display: none !important; }
@media (max-width: 860px) {
  .mode-cards { grid-template-columns: 1fr; }
  .vm-item { grid-template-columns: 1fr; }
}
.kv.stacked { grid-template-columns: 1fr; gap: 2px; }
.kv.stacked dt { font-weight: 600; color: var(--text); }
.kv.stacked dd { display: block; margin-bottom: 10px; color: var(--mute); font-size: 13.5px; }
.right-pill:not(.yes):not(.warn) { text-decoration: line-through; opacity: .75; }

/* ---------- Languages ---------- */
.lang-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.lang-pick svg { width: 16px; height: 16px; flex: none; }
.lang-pick select { appearance: none; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 26px 5px 9px; font: inherit; color: inherit; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.login-form { position: relative; }
.lang-login { position: absolute; top: 20px; right: 24px; color: var(--mute); }
.lang-side { margin: 0 14px 10px; color: #8b9bbb; }
.lang-side select { border-color: var(--ink-line); color: #c9d4ea; }
.lang-side select option, .lang-login select option { color: #111; }
.form-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin: 22px 0 10px; font-weight: 600; }
.form-sub:first-child { margin-top: 4px; }

/* ---------- Logs ---------- */
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mute); }
.inline-field .input { width: auto; padding-top: 6px; padding-bottom: 6px; }
.check.inline { padding: 0; align-items: center; }
.check.inline input { margin-top: 0; }
.seg button.dim { opacity: .55; }
.tbl tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.tbl tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.logview { margin-top: 10px; height: min(62vh, 640px); overflow: auto; white-space: pre; word-break: normal; font-size: 12px; line-height: 1.5;
  background: #0d1526; color: #cfd8ea; }
@media (max-width: 640px) { .inline-field { width: 100%; } .inline-field .input { flex: 1; } .logview { height: 55vh; font-size: 11px; } }

.checks.inline { display: flex; flex-wrap: wrap; gap: 4px 26px; }
.side-foot .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Maintenance ---------- */
.danger-zone { border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); }
.danger-zone h2 { color: var(--danger); }
.tbl input.days { width: 110px; }
ul.tight { margin: 0; padding-left: 18px; }
ul.tight li { margin: 4px 0; }
.nowrap { white-space: nowrap; }
#jobBar .notice { display: flex; align-items: center; gap: 12px; }
.mode-cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .mode-cards.two { grid-template-columns: 1fr; } }
.empty.nothing { min-height: 100vh; display: grid; place-content: center; text-align: center; }
.empty.nothing b { font-size: 48px; color: var(--mute); }
#accPreview { display: grid; gap: 6px; margin: 14px 0; }
#accPreview code { margin-right: 6px; }
.dns-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.dns-row input[hidden] { display: block; visibility: hidden; }
@media (max-width: 640px) { .dns-row { grid-template-columns: 1fr 1fr auto; } .dns-row [data-dn] { grid-column: 1 / -1; } }

/* ---------- Messages ---------- */
.tbl .chk { width: 32px; }
.msg-text { white-space: pre-wrap; word-break: break-word; max-width: 420px; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; background: var(--soft); white-space: pre-wrap; word-break: break-word; align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.bubble .small { margin-bottom: 4px; }
.q-members { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; max-height: 300px; overflow: auto; }
.q-mem { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.q-mem:last-child { border-bottom: 0; }
.q-mem .input { width: 64px; }
@media (max-width: 640px) { .q-mem { grid-template-columns: 1fr 1fr; } .q-mem > :first-child { grid-column: 1 / -1; } }
.code-big { font-size: 15px; font-weight: 600; }
.tts-adv { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.tts-adv summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.tts-adv[open] summary { margin-bottom: 10px; }
.tts-adv input[type=range] { width: 100%; accent-color: var(--accent); }

/* v4.3 — VPN: SIP closing, internal names */
.notice.ok { background: color-mix(in srgb, var(--lamp-on, #2fa66a) 13%, transparent); }
.notice.ok svg { width: 16px; height: 16px; vertical-align: -3px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mb { margin-bottom: 10px; }

/* v4.4 — self-configuration (Linphone, IP phones by employee login) */
.auto-setup { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.auto-setup .grow { flex: 1; min-width: 200px; }
.auto-setup .grow > b { display: block; font-size: 14px; font-weight: 560; }
.auto-setup span { font-size: 12.5px; color: var(--mute); }
.lp-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lp-box img { background: #fff; padding: 8px; border-radius: 8px; flex: none; }
.lp-steps { flex: 1; min-width: 200px; margin: 0; padding-left: 20px; }
.lp-steps li { margin-bottom: 8px; line-height: 1.45; }
code.wrap { word-break: break-all; white-space: normal; }

/* v4.7 — call statistics (palette validated: CVD ΔE ≥ 9 in both modes) */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-grid: #e6eaf0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-grid: #22314f; } }
:root[data-theme="dark"] { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-grid: #22314f; }
.viz-c1 { fill: var(--viz-1); background: var(--viz-1); }
.viz-c2 { fill: var(--viz-2); background: var(--viz-2); }
.viz-c3 { fill: var(--viz-3); background: var(--viz-3); }
.stats { position: relative; }
.stats .panel-head .seg { margin-bottom: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--soft); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi > span:first-child { font-size: 12.5px; color: var(--mute); }
.kpi b { font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -0.01em; }
.kpi-delta { font-size: 12px; color: var(--mute); }
.kpi-delta.up, .kpi-delta.down { color: var(--text); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.chart { min-width: 0; }
.chart.wide { grid-column: 1 / -1; }
.chart-col { display: grid; gap: 22px; align-content: start; min-width: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.viz-box { width: 100%; overflow: hidden; }
svg.viz { display: block; max-width: 100%; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-grid.base { stroke: var(--line); }
.viz-ax { fill: var(--mute); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-hit { fill: transparent; cursor: default; }
.viz-hit.on { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.viz-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--card); color: var(--text); border: 1px solid var(--line);
  box-shadow: var(--shadow); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; line-height: 1.55; white-space: nowrap; }
.hbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin: 10px 0 12px; }
.hbar i { display: block; min-width: 3px; }
.dir-legend { display: grid; gap: 6px; }
.dir-legend > div { display: grid; grid-template-columns: 14px 1fr auto 44px; align-items: center; gap: 8px; font-size: 13.5px; }
.dir-legend .mute { text-align: right; font-size: 12.5px; }
.top-list { display: grid; gap: 7px; }
.top-row { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr auto 52px; align-items: center; gap: 10px; font-size: 13.5px; }
.top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-name .ext { font-weight: 650; font-variant-numeric: tabular-nums; }
.top-bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.top-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.top-row .small { text-align: right; }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } .stats-grid { grid-template-columns: 1fr; } }

/* v4.8 — SIP protection */
.sg-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sg-inline .input { width: auto; min-width: 140px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 8px; padding: 4px 4px 4px 10px; font-size: 13px; }

/* ---- v4.8.1: operator diagnostics ---- */
.bad-text { color: var(--danger); }
.diag { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 7px; }
.diag li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.diag li .lamp { margin-top: 5px; }
.diag-result { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, rgba(127,127,127,.25)); }
.diag-result.ok { background: color-mix(in srgb, var(--lamp-on) 10%, transparent); }
.diag-result.bad { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.diag-result p { margin: 6px 0 0; }
.logview.short { height: min(36vh, 320px); }
.toolbar.diag-bar { padding: 4px 0 0; border-bottom: 0; }
.toolbar.diag-bar .inline-field { white-space: nowrap; }
