/* Страница встречи (VIDEO10). Стиль сайта клиники — docs/СТИЛЬ-сайта-клиники-для-CRM.md: бирюзовый #00A7AA,
   розовый #F85077 — только одна главная кнопка на экране, фон #F0F5F6, текст #1B1B26, ошибки #D24A4A на #FFEEF2,
   шрифт Mulish (файлы — на самой машине). Кнопки на этой странице — не ниже 48 px (р. 2.5 проекта). */

@font-face { font-family: "Mulish"; font-style: normal; font-weight: 400; font-display: swap; src: url("/s/fonts/Mulish-Regular.woff2") format("woff2"); }
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 500; font-display: swap; src: url("/s/fonts/Mulish-Medium.woff2") format("woff2"); }
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 600; font-display: swap; src: url("/s/fonts/Mulish-SemiBold.woff2") format("woff2"); }

:root {
  --primary: #00A7AA;
  --primary-fill: #00B5AD;
  --primary-2: #96CFD0;
  --primary-disabled: #80D3D5;
  --hover: #E2F5F6;
  --tint: #EFFAFB;
  --bg: #F0F5F6;
  --text: #1B1B26;
  --muted: #5C6470;
  --gray: #D6D6D6;
  --pink: #F85077;
  --pink-dark: #E2416A;
  --pink-bg: #FFEEF2;
  --err: #D24A4A;
  --white: #FFFFFF;
  --stage: #1B1B26;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Mulish", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px; line-height: 1.5; font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, p { margin: 0; }
h1 { font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 17px; line-height: 1.35; font-weight: 600; }
a { color: var(--primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.i .slash { display: none; }
.off svg.i .slash { display: inline; }

/* ── оболочка до встречи: один столбец ─────────────────────────────────────────────────────────────────────────── */
.page { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; min-height: 100vh; min-height: 100dvh; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 16px; }
.logo { display: block; height: 40px; width: auto; }
.main { display: flex; flex-direction: column; gap: 16px; }

.card { background: var(--white); border-radius: 24px; padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.card .meta { color: var(--muted); font-size: 15px; line-height: 1.45; margin-top: -8px; }
.lead { font-size: 17px; }
.msg { font-size: 18px; line-height: 1.5; }
.sub { color: var(--muted); font-size: 15px; }
.nw { white-space: nowrap; }

form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 600; font-size: 16px; }
.input {
  width: 100%; min-height: 56px; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--primary-2);
  background: var(--white); color: var(--text); font: inherit; font-size: 18px; outline: none;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0, 167, 170, 0.14); }
.input.code { font-size: 26px; letter-spacing: 0.18em; text-align: center; font-weight: 600; }

.err { color: var(--err); background: var(--pink-bg); border-radius: 12px; padding: 10px 14px; font-size: 16px; }
.err:empty { display: none; }

/* галочка согласия на запись (VIDEO13-2B): вся строка — цель для пальца */
.check { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border-radius: 16px; background: var(--tint);
  border: 1.5px solid var(--primary-2); font-weight: 600; font-size: 17px; line-height: 1.35; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--primary); cursor: pointer; }
.check:focus-within { outline: 3px solid rgba(0, 167, 170, 0.35); outline-offset: 2px; }

.notice { border-radius: 16px; padding: 12px 16px; font-size: 15px; background: var(--tint); color: var(--text); }
.notice.warn { background: var(--pink-bg); }
.notice.row { display: flex; align-items: flex-start; gap: 8px; }
.notice.row p { flex: 1; padding-top: 2px; }

/* ── кнопки: «таблетка», не ниже 48 px ─────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 24px; border-radius: 40px; border: 1.5px solid var(--primary);
  background: var(--white); color: var(--primary); font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), border-color 120ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { background: var(--primary); color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .ctl:focus-visible, .x:focus-visible { outline: 3px solid rgba(0, 167, 170, 0.35); outline-offset: 2px; }
.btn.primary { background: var(--primary); color: var(--white); }
.btn.primary:hover { background: var(--primary-fill); border-color: var(--primary-fill); }
.btn.cta { background: var(--pink); border-color: var(--pink); color: var(--white); }
.btn.cta:hover { background: var(--pink-dark); border-color: var(--pink-dark); }
.btn.danger { border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: var(--pink-bg); color: var(--err); }
.btn[disabled] { opacity: 0.5; cursor: default; pointer-events: none; }
.btn.primary[disabled] { background: var(--primary-disabled); border-color: var(--primary-disabled); opacity: 1; }
.btns { display: flex; flex-direction: column; gap: 10px; }
.btns .btn { width: 100%; }
.btns.two { flex-direction: row; }
.btns.two .btn { flex: 1; }

.x { width: 48px; height: 48px; border-radius: 24px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none; margin: -12px -12px -12px 0; }
.x:hover { background: var(--hover); color: var(--text); }

/* ── проверка камеры ───────────────────────────────────────────────────────────────────────────────────────────── */
.preview { position: relative; border-radius: 16px; overflow: hidden; background: var(--hover); aspect-ratio: 4 / 3; }
.preview video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.preview.small { aspect-ratio: 4 / 3; max-width: 200px; }
.level { height: 10px; border-radius: 5px; background: var(--hover); overflow: hidden; }
.level i { display: block; height: 100%; width: 100%; background: var(--primary); transform-origin: left center; transform: scaleX(0); transition: transform 80ms linear; }

/* ── встреча: на весь экран ────────────────────────────────────────────────────────────────────────────────────── */
body.meet { overflow: hidden; }
body.meet .page { max-width: none; padding: 0; height: 100vh; height: 100dvh; min-height: 0; }
body.meet .top { display: none; }
body.meet .main { display: grid; gap: 0; height: 100%; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.bar { grid-row: 1; grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--white);
  min-height: 56px; border-bottom: 1px solid var(--hover); flex-wrap: wrap; }
.bar .mark { width: 28px; height: 28px; flex: none; }
.bar .title { font-weight: 600; font-size: 16px; }
.bar .grow { flex: 1; }
.recb { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; border-radius: 40px; padding: 4px 12px;
  background: var(--tint); color: var(--muted); }
.recb.on { background: var(--pink-bg); color: var(--err); }
.recb .dot { width: 8px; height: 8px; border-radius: 4px; background: currentColor; }
.rectext { font-size: 14px; color: var(--muted); }
.rectext.on { color: var(--err); font-weight: 600; }
.rectext.bad { color: var(--err); }

.stage { grid-row: 2; position: relative; background: var(--stage); overflow: hidden; display: grid; gap: 8px; padding: 8px;
  grid-auto-rows: 1fr; min-height: 0; }
.stage.n2 { grid-template-columns: 1fr; }
.stage .empty { color: rgba(255, 255, 255, 0.78); align-self: center; justify-self: center; text-align: center; padding: 24px; font-size: 16px; max-width: 420px; }
.tile { position: relative; border-radius: 16px; overflow: hidden; background: #262633; min-height: 0; min-width: 0; }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
/* подписи на видео (VIDEO13-2B): сверху слева, крупно — «Врач», «Экран врача», имя; своё окно — «Вы» */
.tile .label { position: absolute; left: 10px; top: 10px; max-width: calc(100% - 20px); background: rgba(27, 27, 38, 0.72); color: var(--white);
  font-size: 14px; font-weight: 600; padding: 4px 12px; border-radius: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; z-index: 1; }
.tile.kickable .label { max-width: calc(100% - 210px); }
.tile .kick { position: absolute; right: 10px; top: 10px; background: var(--white); min-height: 48px; padding: 8px 16px; font-size: 14px; }
.self { position: absolute; right: 16px; bottom: 16px; width: 28%; max-width: 200px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden;
  border: 2px solid var(--white); background: #262633; z-index: 2; }
.self video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.self .label { position: absolute; left: 6px; bottom: 6px; background: rgba(27, 27, 38, 0.72); color: var(--white); font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 40px; }
.self.screen video { transform: none; object-fit: contain; }
.audio-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; min-height: 56px; font-size: 18px; padding: 12px 28px; }
.audio-btn:active { transform: translate(-50%, calc(-50% + 1px)); }

.controls { grid-row: 3; display: flex; justify-content: center; align-items: stretch; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--white); border-top: 1px solid var(--hover); flex-wrap: wrap; }
.ctl { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 64px; min-height: 60px;
  padding: 6px 4px; border-radius: 16px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-weight: 600;
  line-height: 1.2; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.ctl:hover { background: var(--hover); }
.ctl.off { color: var(--err); background: var(--pink-bg); }
.ctl.active { color: var(--white); background: var(--primary); }
.ctl.danger { color: var(--err); }
.ctl.danger:hover { background: var(--pink-bg); }
.ctl[disabled] { opacity: 0.45; cursor: default; pointer-events: none; }
/* счётчик новых сообщений чата на кнопке «Чат» */
.ctl .badge { position: absolute; top: 2px; left: calc(50% + 4px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--pink); color: var(--white); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }

/* ── чат (VIDEO13-2B): на телефоне — поверх встречи во весь экран (над клавиатурой), на компьютере — столбец справа ── */
.chat { display: flex; flex-direction: column; background: var(--white); min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--hover); }
.chat-head .x { margin: 0; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg-item { max-width: 85%; align-self: flex-start; background: var(--bg); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.msg-item.mine { align-self: flex-end; background: var(--tint); border: 1px solid var(--primary-2); border-radius: 16px 16px 4px 16px; }
.msg-item .who { font-size: 12px; font-weight: 600; color: var(--muted); }
.msg-item .text { font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-note { padding: 8px 16px 0; font-size: 13px; }
.chat .err { margin: 8px 16px 0; font-size: 14px; }
form.chat-form { flex-direction: row; gap: 8px; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); }
.chat-form .input { flex: 1; min-width: 0; min-height: 48px; font-size: 16px; padding: 10px 14px; }
.chat-form .btn { flex: none; padding: 10px 18px; }

.side { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--white); overflow-y: auto; min-height: 0; }
.wait-item { background: var(--tint); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.wait-item p { font-size: 15px; }
.wait-item .btns.two .btn { padding: 8px 12px; font-size: 15px; }

.banner { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 20; background: var(--white); color: var(--text);
  border: 1.5px solid var(--primary); border-radius: 40px; padding: 10px 20px; font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(27, 27, 38, 0.14); max-width: calc(100% - 32px); text-align: center; }

dialog { border: 0; border-radius: 24px; padding: 24px; max-width: min(440px, calc(100vw - 32px)); width: 100%; color: var(--text);
  box-shadow: 0 16px 48px rgba(27, 27, 38, 0.22); }
dialog::backdrop { background: rgba(27, 27, 38, 0.45); }
dialog p { font-size: 17px; margin-bottom: 20px; }

/* врач: сбоку зал ожидания и подсказки; на телефоне — под видео */
body.meet.host .main { grid-template-rows: auto minmax(0, 1fr) auto auto; }
body.meet.host .side { grid-row: 4; max-height: 38vh; }

@media (max-width: 719.98px) {
  .chat { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: 100vh; height: var(--vvh, 100dvh); z-index: 15; }
}

@media (min-width: 720px) {
  .page { padding-top: 24px; }
  .logo { height: 48px; }
  .card { padding: 32px; }
  h1 { font-size: 24px; }
  .btns { flex-direction: row; flex-wrap: wrap; }
  .btns .btn { width: auto; }
  .btns.stack { flex-direction: column; }
  .btns.stack .btn { width: 100%; }
  .self { aspect-ratio: 16 / 9; width: 24%; max-width: 260px; }
  .stage { padding: 12px; gap: 12px; }
  .stage.n2 { grid-template-columns: 1fr 1fr; }
  .controls { gap: 8px; padding: 10px 16px; }
  .ctl { min-width: 96px; padding: 6px 10px; font-size: 13px; }
  body.meet.host .main { grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto minmax(0, 1fr) auto; }
  body.meet.host .stage { grid-column: 1; grid-row: 2; }
  body.meet.host .controls { grid-column: 1; grid-row: 3; }
  body.meet.host .side { grid-column: 2; grid-row: 2 / span 2; max-height: none; border-left: 1px solid var(--hover); }
  /* чат открыт: свой столбец справа от видео (у врача — между видео и залом ожидания); кнопки — под видео и чатом */
  body.meet.chat-open .main { grid-template-columns: minmax(0, 1fr) 340px; }
  body.meet.chat-open .controls { grid-column: 1 / -1; }
  .chat { grid-column: 2; grid-row: 2; border-left: 1px solid var(--hover); }
  body.meet.host.chat-open .main { grid-template-columns: minmax(0, 1fr) 340px 360px; }
  body.meet.host.chat-open .controls { grid-column: 1 / 3; }
  body.meet.host.chat-open .side { grid-column: 3; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
