/* BG Phone — стили. Цвета берутся из темы Telegram (--tg-theme-*),
   запасные значения — для открытия вне Telegram. */

:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --sep: var(--tg-theme-section-separator-color, rgba(60, 60, 67, .18));
  --danger: var(--tg-theme-destructive-text-color, #ff3b30);
  --green: #34c759;
  --red: #ff3b30;
  --amber: #ff9f0a;
  --press: color-mix(in srgb, var(--text) 8%, var(--card));
  --tabbar-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --k: min(78px, 21vw, 10.4vh);
  --miss: #ff3b30;
  --offline: #c7c7cc;
}
:root[data-scheme="dark"] { --miss: #ff453a; --offline: #48484a; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-secondary-bg-color, #000000);
    --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1c1c1e));
    --text: var(--tg-theme-text-color, #ffffff);
    --hint: var(--tg-theme-hint-color, #8e8e93);
    --sep: var(--tg-theme-section-separator-color, rgba(84, 84, 88, .6));
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, Roboto, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body { -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.ic { width: 24px; height: 24px; flex-shrink: 0; display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- каркас */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 8px; }
.me { min-width: 0; }
.me-name { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hint); flex-shrink: 0; transition: background .3s; }
.dot.on { background: var(--green); }
.dot.wait { background: var(--amber); animation: blink 1.2s infinite; }
.dot.off { background: var(--red); }
@keyframes blink { 50% { opacity: .35; } }

main { flex: 1; padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 20px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.tab {
  position: relative; flex: 1; height: var(--tabbar-h); border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 500; color: var(--hint);
}
.tab .ic { width: 25px; height: 25px; }
.tab.active { color: var(--accent); }
.tab .badge {
  position: absolute; top: 4px; left: calc(50% + 5px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 11px; line-height: 16px; text-align: center;
}

/* ---------- клавиатура */
.dial { display: flex; flex-direction: column; align-items: center; padding-top: 2.5vh; }
.dial-number {
  height: 58px; max-width: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 300; letter-spacing: 1px; font-variant-numeric: tabular-nums;
  overflow: hidden; white-space: nowrap;
}
.dial-hint {
  height: 34px; margin-bottom: 1.8vh; max-width: 100%; padding: 0 2px;
  display: flex; align-items: center; justify-content: safe center; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
}
.dial-hint::-webkit-scrollbar { display: none; }
.suggest { flex-shrink: 0; }
.dial-name { font-size: 15px; color: var(--accent); animation: fade .2s ease-out; }
.suggest {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 5px; border: 0; border-radius: 16px;
  background: var(--card); color: var(--text); font-size: 13.5px; white-space: nowrap; animation: fade .2s ease-out;
}
.suggest span { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.suggest em { font-style: normal; color: var(--hint); font-variant-numeric: tabular-nums; }
.suggest .avatar { font-size: 9px !important; }
.suggest .avatar .st { width: 8px; height: 8px; border-width: 1.5px; }
.suggest .avatar .ic { width: 13px; height: 13px; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }
/* быстрый вызов конференции 150 — на месте подсказок, пока номер пуст */
.quick-conf {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 4px; border: 0; border-radius: 17px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
  font-size: 14px; font-weight: 600; white-space: nowrap; animation: fade .2s ease-out;
  transition: transform .08s ease, background .15s ease;
}
.quick-conf:active { transform: scale(.96); background: color-mix(in srgb, var(--accent) 24%, transparent); }
.quick-conf .avatar { --av: var(--accent) !important; }
.quick-conf em { font-style: normal; font-weight: 500; opacity: .65; font-variant-numeric: tabular-nums; }
.keys { display: grid; grid-template-columns: repeat(3, var(--k)); gap: calc(var(--k) * .2) calc(var(--k) * .36); }
.key {
  width: var(--k); height: var(--k); border-radius: 50%; border: 0;
  background: var(--card); color: var(--text);
  font-size: calc(var(--k) * .42); font-weight: 400; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease, background .15s ease;
}
.key:active { transform: scale(.93); background: var(--press); }
.key { flex-direction: column; gap: 0; line-height: 1; }
.key small { height: 10px; margin-top: 2px; font-size: 9.5px; font-weight: 600; letter-spacing: .14em; color: var(--hint); }
.key:not(:has(small:not(:empty))) small { display: none; }
.dial-actions {
  display: grid; grid-template-columns: repeat(3, var(--k)); column-gap: calc(var(--k) * .36);
  justify-items: center; align-items: center; margin-top: calc(var(--k) * .26);
}
.btn-call {
  width: var(--k); height: var(--k); border-radius: 50%; border: 0;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease, filter .15s;
}
.btn-call:active { transform: scale(.93); filter: brightness(.92); }
.btn-call .ic { width: 34px; height: 34px; }
.btn-back { width: 56px; height: 56px; border: 0; background: none; color: var(--hint); display: flex; align-items: center; justify-content: center; }
.btn-back .ic { width: 30px; height: 30px; }
.btn-back[hidden] { display: flex; visibility: hidden; }

/* ---------- списки */
.search { position: relative; margin: 4px 0 6px; }
.search .ic { position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; color: var(--hint); }
.search input {
  width: 100%; height: 36px; border: 0; border-radius: 10px; outline: none;
  padding: 0 12px 0 34px; background: var(--card); color: var(--text); font-size: 16px;
  -webkit-user-select: text; user-select: text;
}
.search input::placeholder { color: var(--hint); }
.section-title { margin: 18px 16px 6px; font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: .02em; }
.list { background: var(--card); border-radius: 12px; overflow: hidden; }
.item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 9px 14px; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; height: .5px; background: var(--sep); }
.list.plain .item + .item::before { left: 14px; }
.item.tap:active { background: var(--press); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { display: flex; align-items: center; gap: 5px; margin-top: 1px; font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub .ic { width: 13px; height: 13px; }
.item-right { color: var(--hint); font-size: 14px; font-variant-numeric: tabular-nums; }
.missed .item-title { color: var(--red); }
.round-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.round-btn .ic { width: 18px; height: 18px; }
.empty { padding: 48px 24px; text-align: center; color: var(--hint); font-size: 15px; }
.empty .ic { width: 44px; height: 44px; margin: 0 auto 12px; opacity: .5; }

/* ---------- аватар */
.avatar {
  position: relative; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; letter-spacing: .01em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--av) 78%, #fff), var(--av));
}
.avatar .st { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--card); background: var(--hint); }
.st.free { background: var(--green); }
.st.busy { background: var(--red); }
.st.ringing { background: var(--amber); }
.st.offline { background: #aeaeb2; }
.state-free { color: var(--green); }
.state-busy { color: var(--red); }
.state-ringing { color: var(--amber); }

/* ---------- первый вход */
.hero { padding: 9vh 8px 0; text-align: center; }
.hero-icon {
  width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 24px;
  background: var(--accent); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
}
.hero-icon .ic { width: 40px; height: 40px; }
.hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; }
.lead { max-width: 330px; margin: 0 auto 26px; font-size: 15px; color: var(--hint); }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chip {
  height: 50px; border: 0; border-radius: 12px; background: var(--card); color: var(--text);
  font-size: 18px; font-variant-numeric: tabular-nums; transition: background .15s, color .15s;
}
.chip.sel { background: var(--accent); color: var(--accent-text); }
.btn-primary {
  width: 100%; height: 50px; margin-top: 22px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); font-size: 17px; font-weight: 600;
}
.btn-primary:disabled { opacity: .4; }
.btn-plain { margin-top: 12px; border: 0; background: none; color: var(--accent); font-size: 16px; }
.spinner {
  width: 30px; height: 30px; margin: 40vh auto 0; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--hint) 30%, transparent); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- доступ (админ) */
.req { padding: 12px 14px; }
.req + .req { border-top: .5px solid var(--sep); }
.req-actions { display: flex; gap: 10px; margin-top: 10px; }
.req-actions button { flex: 1; height: 38px; border: 0; border-radius: 10px; font-size: 15px; font-weight: 600; }
.btn-ok { background: var(--accent); color: var(--accent-text); }
.btn-no { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.link-btn { border: 0; background: none; color: var(--red); font-size: 15px; padding: 6px 0 6px 10px; }
.name-input {
  width: 100%; border: 0; outline: none; background: none; color: var(--text); font-size: 16px; padding: 0;
  -webkit-user-select: text; user-select: text;
}
.name-input::placeholder { color: var(--hint); }
.ext-label { width: 40px; color: var(--hint); font-variant-numeric: tabular-nums; }
.grant-label { flex: none; width: 108px; color: var(--hint); font-size: 16px; }
.grant-select {
  flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font: inherit; font-size: 16px;
  padding: 0; -webkit-appearance: none; appearance: none; font-variant-numeric: tabular-nums;
}
.grant-select:disabled, .grant-select:invalid { color: var(--hint); }
.grant-btn { margin-top: 12px; }
.grant-note { margin-top: 12px; }
.grant-note .btn-plain { margin-top: 6px; padding: 0; }

/* ---------- экран звонка */
#call {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 9vh) 24px calc(var(--safe-b) + 5vh);
  background: radial-gradient(130% 90% at 50% -10%, #3a4557 0%, #161a20 55%, #0b0c0f 100%);
  color: #fff;
  animation: rise .22s ease-out;
}
#call[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.c-name { margin-top: 18px; max-width: 100%; font-size: 30px; font-weight: 500; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-num { margin-top: 2px; font-size: 16px; color: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; }
.c-status { display: flex; align-items: center; gap: 8px; min-height: 24px; margin-top: 8px; font-size: 17px; color: rgba(255, 255, 255, .72); font-variant-numeric: tabular-nums; }
.c-q { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.c-q i { display: block; width: 3px; border-radius: 1px; background: rgba(255, 255, 255, .25); }
.c-q i:nth-child(1) { height: 5px; } .c-q i:nth-child(2) { height: 8px; } .c-q i:nth-child(3) { height: 12px; }
.c-q:not(.good):not(.mid):not(.bad) { display: none; }
.c-q.good i { background: var(--green); }
.c-q.mid i:nth-child(-n+2) { background: var(--amber); }
.c-q.bad i:nth-child(1) { background: var(--red); }
.pulse { animation: pulse 1.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .28); }
  100% { box-shadow: 0 0 0 26px rgba(255, 255, 255, 0); }
}
.c-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; width: 100%; }
.c-grid { display: grid; grid-template-columns: repeat(3, 76px); gap: 22px 34px; }
.c-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; color: rgba(255, 255, 255, .88); font-size: 12.5px; }
.c-btn .circle {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); color: #fff;
  transition: background .15s, color .15s, transform .08s;
}
.c-btn:active .circle { transform: scale(.93); }
.c-btn.on .circle { background: #fff; color: #111; }
.c-btn[disabled] { opacity: .35; }
.c-btn .ic { width: 28px; height: 28px; }
.c-end, .c-answer {
  width: 76px; height: 76px; border-radius: 50%; border: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
  transition: transform .08s, filter .15s;
}
.c-end { margin-top: 34px; background: var(--red); }
.c-answer { background: var(--green); }
.c-end:active, .c-answer:active { transform: scale(.93); filter: brightness(.9); }
.c-end .ic, .c-answer .ic { width: 34px; height: 34px; }
.c-end .ic { transform: rotate(135deg); }
.c-incoming { display: flex; justify-content: space-between; width: min(290px, 100%); }
.c-incoming .c-end { margin-top: 0; }
.c-incoming label { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .8); }
.c-dtmf { height: 38px; margin-bottom: 14px; font-size: 30px; font-weight: 300; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.c-keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 30px; }
.c-keys .key { width: 72px; height: 72px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 30px; }
.c-keys .key:active { background: rgba(255, 255, 255, .3); }
.c-hide { margin-top: 18px; border: 0; background: none; color: rgba(255, 255, 255, .8); font-size: 16px; }

/* ---------- уведомление */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 60;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: rgba(30, 30, 32, .92); color: #fff; font-size: 14px; text-align: center;
  transform: translateX(-50%); animation: rise .2s ease-out;
}
#toast[hidden] { display: none; }

@media (max-height: 640px) {
  .dial { padding-top: 0; }
  .dial-number { height: 48px; font-size: 34px; }
  .c-grid { gap: 14px 30px; }
  #call { padding-top: calc(env(safe-area-inset-top, 0px) + 5vh); }
}


/* ---------- карточки и мелкие элементы (v2) */
.card { background: var(--card); border-radius: 14px; padding: 12px 14px; margin: 4px 0 10px; }
.seg { display: flex; gap: 2px; padding: 2px; margin: 8px 0 2px; border-radius: 9px; background: color-mix(in srgb, var(--hint) 16%, transparent); }
.seg button { flex: 1; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--text); font-size: 13.5px; font-weight: 500; transition: background .15s; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.fav-mark { display: inline-flex; margin-left: 6px; color: #ffb800; vertical-align: -1px; }
.fav-mark .ic { width: 13px; height: 13px; }
.info-btn { width: 32px; height: 32px; margin-right: -6px; border: 0; background: none; color: var(--accent); display: flex; align-items: center; justify-content: center; }
.info-btn .ic { width: 21px; height: 21px; }
.item-sub.strong { color: var(--text); font-size: 15px; }
.missed .item-sub.strong { color: var(--red); }
.wrap { white-space: normal; }
.avatar.svc .ic { width: 55%; height: 55%; }

/* плашка «разрешите микрофон» */
.banner {
  display: flex; align-items: center; gap: 12px; margin: 2px 16px 10px; padding: 10px 12px;
  border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); animation: fade .25s ease-out;
}
.banner-ic { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.banner-ic .ic { width: 19px; height: 19px; }
.banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; color: var(--hint); }
.banner-text b { font-size: 15px; font-weight: 600; color: var(--text); }
.banner-btn { height: 32px; padding: 0 14px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; }

/* полоса «кто на связи» */
.team-head { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.meter { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; }
.meter i { display: block; min-width: 4px; }
.m-free { background: var(--green); }
.m-busy { background: var(--red); }
.m-ringing { background: var(--amber); }
.m-offline { background: var(--offline); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; color: var(--hint); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend b { color: var(--text); font-weight: 600; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

/* неделя: итоги + столбики */
.week-head { font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: .02em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.stats div { display: flex; flex-direction: column; min-width: 0; }
.stats b { font-size: 22px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats span { font-size: 12.5px; color: var(--hint); }
.chart { position: relative; }
.cols { display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; border-bottom: 1px solid var(--sep); padding-top: 4px; }
.col { position: relative; height: 104px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; transition: opacity .15s; }
.chart:has(.col.hot) .col:not(.hot) { opacity: .4; }
.col-val { height: 15px; margin-bottom: 3px; font-size: 12px; font-weight: 600; line-height: 15px; color: var(--text); }
.bar { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; width: 16px; }
.bar i { display: block; width: 16px; }
.bar i:first-child { border-radius: 4px 4px 0 0; }
.b-talk { background: var(--accent); }
.b-miss { background: var(--miss); }
.col-day { position: absolute; bottom: -20px; font-size: 11.5px; color: var(--hint); }
.col.today .col-day { color: var(--text); font-weight: 600; }
.chart + .legend { margin-top: 26px; }
.tip {
  position: absolute; top: -6px; z-index: 2; transform: translate(-50%, -100%);
  padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--card);
  font-size: 12px; line-height: 1.35; white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); animation: fade .15s ease-out;
}
.tip b { display: block; font-weight: 600; }

/* карточка контакта (снизу) */
#sheet { position: fixed; inset: 0; z-index: 40; }
#sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .25s; }
.sheet-card {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto;
  padding: 6px 16px calc(var(--safe-b) + 20px); border-radius: 18px 18px 0 0; background: var(--bg);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
#sheet.open .sheet-backdrop { opacity: 1; }
#sheet.open .sheet-card { transform: none; }
.sheet-handle { display: block; width: 38px; height: 5px; margin: 4px auto 10px; border: 0; border-radius: 3px; background: color-mix(in srgb, var(--hint) 45%, transparent); }
.sheet-head { display: flex; flex-direction: column; align-items: center; padding: 6px 0 14px; }
.sheet-name { margin-top: 12px; font-size: 22px; font-weight: 600; text-align: center; }
.sheet-sub { margin-top: 2px; font-size: 14px; color: var(--hint); }
.sheet-actions { display: flex; gap: 10px; }
.sa { flex: 1; height: 60px; border: 0; border-radius: 14px; background: var(--card); color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12.5px; font-weight: 500; }
.sa .ic { width: 22px; height: 22px; }
.sa-call { background: var(--green); color: #fff; }
.sa.on { color: #ffb800; }
.sa.on span { color: var(--text); }

/* экран звонка: кольцо голоса */
.c-ava { position: relative; width: 108px; height: 108px; }
.c-ava .avatar { position: relative; z-index: 1; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
/* собеседник выключил микрофон (как в WhatsApp): значок на аватаре + строка */
.c-pmute {
  position: absolute; right: -2px; bottom: -2px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: #1c1c1e; box-shadow: 0 0 0 3px #161a20, 0 4px 12px rgba(0, 0, 0, .35);
  animation: pop .2s ease-out;
}
.c-pmute .ic { width: 18px; height: 18px; }
.c-peer-muted {
  display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); font-size: 13.5px;
  animation: fade .2s ease-out;
}
.c-peer-muted .ic { width: 15px; height: 15px; flex-shrink: 0; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.c-ring {
  position: absolute; inset: -14px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .0) 55%, rgba(255, 255, 255, .55) 70%, rgba(255, 255, 255, 0) 72%);
  opacity: .1; transition: transform .08s linear, opacity .08s linear; will-change: transform;
}
.c-ava.waiting .c-ring { animation: wave 1.8s ease-out infinite; transition: none; }
@keyframes wave { 0% { transform: scale(.85); opacity: .5; } 100% { transform: scale(1.5); opacity: 0; } }
.c-btn .circle { position: relative; }
.c-btn .circle .ic { position: relative; z-index: 1; }
.lvl { position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); transform: scale(1); transition: transform .06s linear; }
.c-btn.on .lvl { display: none; }

.c-sound {
  margin-top: 18px; padding: 10px 18px; border: 0; border-radius: 22px;
  background: rgba(255, 255, 255, .92); color: #111; font-size: 15px; font-weight: 600;
  animation: fade .2s ease-out, nudge 1.6s ease-in-out .3s infinite;
}
@keyframes nudge { 50% { transform: scale(1.04); } }

/* ---------- v1.2: настройки, «добавить», полноэкранный режим */
.gear { margin-left: auto; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--card); color: var(--hint); display: flex; align-items: center; justify-content: center; }
.gear .ic { width: 20px; height: 20px; }
.gear:active { background: var(--press); }
.sheet-title { margin: 2px 4px 4px; font-size: 20px; font-weight: 700; }
#sheet.over { z-index: 70; }
.switch { position: relative; flex-shrink: 0; width: 51px; height: 31px; border: 0; border-radius: 16px; background: color-mix(in srgb, var(--hint) 35%, transparent); transition: background .2s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on i { transform: translateX(20px); }
.col-item { flex-direction: column; align-items: stretch; gap: 8px; }
.row-line { display: flex; align-items: center; justify-content: space-between; }
.seg.mini { margin: 0; }
.seg.mini button { height: 28px; font-size: 13px; }
.icon-plain { width: 32px; height: 32px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.icon-plain .ic { width: 14px; height: 14px; }
.pill-btn { height: 30px; padding: 0 14px; border: 0; border-radius: 15px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; }
.footnote { margin: 14px 4px 0; font-size: 12.5px; color: var(--hint); text-align: center; font-variant-numeric: tabular-nums; }
.c-grid .c-btn.add { grid-column: 2; }
.sheet-card .list .round-btn { pointer-events: none; }

/* полноэкранный режим Telegram: кнопки Telegram поверх верха страницы */
html.fs .top { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 8px); }
html.fs #call { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 5vh); }
html.fs .sheet-card { max-height: calc(100vh - var(--tg-safe-area-inset-top, 0px) - var(--tg-content-safe-area-inset-top, 0px) - 12px); }

/* во время звонка уведомления сверху — не перекрывают кнопки */
body.in-call #toast { top: calc(env(safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 16px); bottom: auto; background: rgba(255, 255, 255, .94); color: #111; }

.danger-row { width: 100%; min-height: 50px; margin-top: 18px; border: 0; background: var(--card); color: var(--red); font-size: 16px; font-weight: 500; border-radius: 12px; }
.danger-row:active { background: var(--press); }

/* ---------- v1.4: Ear Mode — телефон у уха: замок поверх экрана звонка,
   касания не проходят. Экран не затемняем — видно разговор и время. */
#ear {
  position: fixed; inset: -2px; z-index: 2147483647;
  background: transparent;
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#ear[hidden] { display: none; }
.ear-box {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.ear-lock {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .16); color: #fff;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22) inset;
  animation: ear-in .18s ease-out;
}
.ear-lock .ic { width: 28px; height: 28px; }
.ear-cap { font-size: 13px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
@keyframes ear-in { from { opacity: 0; transform: scale(.85); } }
html.ear-on, html.ear-on body { overflow: hidden; overscroll-behavior: none; }

/* панель отладки Ear Mode (только при включённой отладке) */
#earDbg {
  position: fixed; left: 8px; right: 8px; z-index: 2147483647;
  top: calc(var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px) + 6px);
  padding: 8px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, .78); color: #d8f3ff;
  font-size: 11px; line-height: 1.4; font-variant-numeric: tabular-nums;
  -webkit-user-select: none; user-select: none;
}
#earDbg[hidden] { display: none; }
#earDbg .ed-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 2px; }
#earDbg .ed-head b { color: #ff9f0a; }
#earDbg .ed-head b.on { color: #30d158; }
#earDbg .ed-dim { color: rgba(216, 243, 255, .55); }
/* у уха панель не принимает касаний — их забирает слой с замком */
html.ear-on #earDbg { pointer-events: none; }

/* ---------- v1.4.7: экран звонка без наложений на любой высоте экрана.
   Блоки не сжимаются (раньше flex сжимал имя до нуля и «150» наезжал на
   «Conference»), размеры кнопок следуют высоте экрана, на крошечных
   экранах — прокрутка вместо наложения. */
#call {
  --cb: clamp(56px, 8.4vh, 72px);   /* кнопки разговора */
  --ce: clamp(60px, 9vh, 76px);     /* «Завершить» */
  --ck: clamp(54px, 8.2vh, 72px);   /* клавиши в разговоре */
  overflow-y: auto; overscroll-behavior: contain;
}
#call > * { flex-shrink: 0; }
.c-grid { grid-template-columns: repeat(3, calc(var(--cb) + 4px)); gap: clamp(12px, 2.6vh, 22px) clamp(24px, 4vh, 34px); }
.c-btn .circle { width: var(--cb); height: var(--cb); }
.c-end, .c-answer { width: var(--ce); height: var(--ce); }
.c-end { margin-top: clamp(16px, 4vh, 34px); }
.c-keys { grid-template-columns: repeat(3, var(--ck)); gap: calc(var(--ck) * .19) calc(var(--ck) * .42); }
.c-keys .key { width: var(--ck); height: var(--ck); font-size: calc(var(--ck) * .42); }
.c-dtmf { height: calc(var(--ck) * .5); margin-bottom: calc(var(--ck) * .18); font-size: calc(var(--ck) * .4); }
.c-hide { margin-top: clamp(8px, 2vh, 18px); padding: 6px 14px; }
@media (max-height: 700px) {
  .c-ava { transform: scale(.8); margin: -11px 0; }
  .c-name { margin-top: 10px; font-size: 26px; }
}
/* клавиши в разговоре: как в iPhone — имя и время сверху, без большого аватара */
#call.pad { padding-top: calc(env(safe-area-inset-top, 0px) + 3vh); }
html.fs #call.pad { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 1.5vh); }
#call.pad .c-ava { display: none; }
#call.pad .c-name { margin-top: 0; font-size: 24px; }
#call.pad .c-num { font-size: 14px; }
#call.pad .c-status { margin-top: 4px; font-size: 15px; }
