/* Звонки: только раскладка. Цвета, радиусы, тени, кнопки, поля, списки, панели, лист и окна берутся из design.css
   (дизайн-система инструмента представителя бренда, тот же файл, что у суфлёра). Правила с префиксом sf- повторяют
   суфлёр дословно, mt- относятся к звонкам. Без анимаций сверх дизайн-системы: страница должна быть лёгкой. */
html, body { height: 100%; overscroll-behavior: none; }
:root { --sf-ctl: 34px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
#app { height: 100%; }
[hidden] { display: none !important; }

/* Вход на сайт: подпись, поля и кнопка в одну строку по центру экрана (как у суфлёра) */
.sf-login { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; }
.sf-login-form { display: flex; align-items: center; gap: 8px; width: min(420px, calc(100vw - 48px)); }
.sf-login-fields { display: flex; gap: 8px; flex: 1 1 auto; min-width: 0; }
.sf-login-fields .input { flex: 1 1 auto; min-width: 0; }
.sf-login-fields #login-pin { flex: 0 1 112px; }
.sf-lab { flex: 0 0 auto; min-width: 72px; font-size: 12.5px; color: var(--text-2); }
.sf-login > .sf-lab { font-size: 15px; font-weight: 600; color: var(--text); }
.sf-note { font-size: 12px; color: var(--text-3); line-height: 1.45; overflow-wrap: anywhere; }
.sf-note.err { color: var(--danger); }
.sf-note.on { color: var(--accent-text); font-weight: 600; }

/* Главная: одна строка управления сверху, под ней всё остальное */
.sf { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }
.sf-bar { display: flex; align-items: center; gap: 8px; padding: 12px 24px 14px; flex-wrap: nowrap; flex-shrink: 0;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.sf-bar > * { flex-shrink: 0; }
.sf-bar > .grow { flex: 1 1 auto; min-width: 8px; }
.sf-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 0 max(24px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px)); }
.mt-lobby { width: 100%; max-width: 560px; margin: 0 auto; }
.mt-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.mt-banner .sf-note { flex: 1; }
.mt-list-title { font-weight: 600; color: var(--text-2); margin-top: 4px; }
.mt-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: center; }
.btn.mt-block { width: 100%; }

/* превью своей камеры: пропорции кадра, вдавленное поле дизайн-системы; кнопки камеры и микрофона в углу */
.mt-preview-wrap { position: relative; width: 100%; }
.sf-preview { display: block; width: 100%; aspect-ratio: var(--ar, 4 / 3); max-height: 32dvh; object-fit: cover; border-radius: var(--r-md); background: var(--surface-3); box-shadow: var(--inset); }
.sf-preview.mirror, .sf-cam.mirror { transform: scaleX(-1); }
.mt-preview-off { position: absolute; inset: 0; border: none; border-radius: var(--r-md); background: var(--surface-3); box-shadow: var(--inset); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.mt-preview-ctl { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 8px; }
.btn.off { color: var(--danger); }
.btn.off svg { opacity: 0.8; }

/* контакты: панель дизайн-системы, строка на контакт */
.mt-contacts { display: flex; flex-direction: column; gap: 8px; }
.contact { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 14px; }
.contact .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.contact .dot.on { background: var(--success); }
.contact .dot.busy { background: var(--warn); }
.contact .cname { font-size: 14px; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .cstate { flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.crow + .crow { border-top: 1px solid var(--border); }
.crow .cname { font-weight: 600; flex: 1 1 100%; }
.crow .sf-note { flex: 1 1 auto; }

/* Звонок: как съёмка в суфлёре */
.sf-stage { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.sf-stage-top { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: max(24px, env(safe-area-inset-left, 0px)); right: max(24px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 10px; z-index: 4; pointer-events: none; min-height: 34px; flex-wrap: wrap; row-gap: 6px; }
.sf-cam { display: block; width: min(18vw, 280px); aspect-ratio: var(--ar, 4 / 3); object-fit: cover; border-radius: var(--r-md); background: var(--surface-3); box-shadow: var(--shadow-2); }
.mt-self { position: absolute; top: calc(60px + env(safe-area-inset-top, 0px)); right: max(24px, env(safe-area-inset-right, 0px)); z-index: 4; }
.mt-self.off { display: none; }
.sf-stage-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 16px 24px calc(18px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--bg) 45%); }
.mt-stage { position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); right: max(24px, env(safe-area-inset-right, 0px)); top: calc(56px + env(safe-area-inset-top, 0px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; }
.mt-stage[data-n="0"] { place-items: center; }
.mt-stage[data-n="1"] { grid-template-columns: 1fr; }
.mt-stage[data-n="2"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.mt-stage[data-n="3"], .mt-stage[data-n="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mt-stage[data-n="5"], .mt-stage[data-n="6"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
@media (min-aspect-ratio: 1/1) { .mt-stage[data-n="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; } }
.tile { position: relative; min-height: 0; border-radius: var(--r-md); background: var(--surface-3); box-shadow: var(--inset); overflow: hidden; }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .name { position: absolute; left: 8px; bottom: 8px; }
.tile .state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font-size: 13px; color: var(--text-2); }
.tile.live .state { display: none; }
.waiting { font-size: 14px; color: var(--text-2); text-align: center; padding: 24px; }
.mt-unmute { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 72%, transparent); }
/* во время звонка уведомления встают над строкой кнопок, а не на неё (как у суфлёра при съёмке) */
body:has(.sf-stage:not([hidden])) .toasts { bottom: calc(16px + var(--sf-ctl) + 18px + 12px + env(safe-area-inset-bottom, 0px)); }

/* Входящий и исходящий вызов */
.mt-call-overlay { z-index: 70; }
.mt-call-overlay .modal { width: min(420px, 100%); }
.mt-call-body { align-items: center; text-align: center; gap: 8px; padding: 28px 20px 24px; }
.mt-avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 6px; }
.mt-avatar svg { width: 30px; height: 30px; }
.mt-call-body h2 { font-size: 24px; }
.mt-call-acts { margin-top: 18px; justify-content: center; }
.mt-call-acts .btn { min-width: 140px; }

/* Лист настроек = боковая панель дизайн-системы на весь экран телефона; разделы (.panel), раскрываются на месте (как у суфлёра) */
.sf-sheet .sheet { width: min(520px, 100%); background: var(--bg); outline: none; }
.sf-sheet .sheet-head { padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.sf-sheet .sheet-head h2 { font-size: 15px; }
.sf-sheet-body { display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sf-sheet-body > * { flex-shrink: 0; }
.sf-acc-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 14px; border: none; background: none; border-radius: var(--r-lg);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sf-acc-head > svg { flex: 0 0 auto; color: var(--text-2); }
.sf-acc-head.active > svg:first-child { color: var(--accent-text); }
.sf-acc-val { flex: 0 1 auto; max-width: 55%; font-size: 13px; font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-acc-head .chev { color: var(--text-3); transition: transform var(--d-fast) var(--ease-out); }
.sf-acc.open .sf-acc-head .chev { transform: rotate(180deg); }
.sf-acc-body { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 14px; }
.sf-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 8px 4px 14px; }
.sf-row > .sf-lab { min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sf-line > .input { min-width: 0; }
.dd-item .check svg { stroke: currentColor; }

/* Под палец (телефон, планшет): кнопки, списки, поля 44 px, квадратные 44×44; шрифт полей 16 px (iOS иначе увеличивает страницу) */
@media (pointer: coarse) {
  :root { --sf-ctl: 44px; }
  .btn, .btn.btn-sm, .dd-trigger, .dd-trigger.sm { height: var(--sf-ctl); }
  .btn-icon, .btn-icon.btn-sm { width: var(--sf-ctl); }
  .input, .input.sm { min-height: var(--sf-ctl); }
  .seg button, .seg a { height: calc(var(--sf-ctl) - 6px); min-width: var(--sf-ctl); justify-content: center; }
  .switch-label, .dd-item { min-height: var(--sf-ctl); }
  input:not([type=range]):not([type=checkbox]):not([type=radio]), .input, .input.sm { font-size: 16px; }
}

/* Телефон (класс sf-phone на <html>): отступы 16 px, превью камеры крупнее, лист на весь экран, две строки у входа */
@media (max-width: 600px) {
  .sf-bar, .sf-body { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .sf-stage-top, .mt-stage { left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }
  .sf-cam { width: 34vw; }
  .mt-self { right: max(16px, env(safe-area-inset-right, 0px)); top: calc(96px + env(safe-area-inset-top, 0px)); }
  .mt-stage { top: calc(96px + env(safe-area-inset-top, 0px)); }
  .sf-login-form { flex-wrap: wrap; justify-content: flex-end; }
  .sf-login-fields { flex-basis: 100%; }
}
.sf-phone .sf-sheet .sheet { width: 100%; }
.sf-phone .mt-call-acts { flex-direction: column; width: 100%; }
.sf-phone .mt-call-acts .btn { width: 100%; }
