/* Adminica Voice — оболочка как у chat.llm (topbar + empty-state + composer) */

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
}
html {
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  position: relative;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
}

/* ── topbar как в чате ───────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 12px;
  min-height: 32px;
  height: 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-logo {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  object-fit: cover;
}
.topbar-title {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 42vw;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #181818;
  color: var(--fg-muted);
  font-size: 11px;
  cursor: default;
}
.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-muted);
  flex-shrink: 0;
}
.conn-dot[data-state="live"],
.conn-pill[data-phase="ok"] .conn-dot { background: var(--accent); }
.conn-dot[data-state="error"],
.conn-pill[data-phase="error"] .conn-dot { background: var(--danger); }
.conn-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #141414;
  background: var(--accent);
  padding: 1px 4px;
  border-radius: 4px;
}
.live-badge[hidden] { display: none !important; }

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.topbar-count {
  margin-right: 4px;
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
}
.icon-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover {
  color: var(--fg);
  background: var(--bg-hover);
}
.icon-btn[aria-expanded="true"] {
  color: var(--accent);
}

/* ── stage / messages ────────────────────────────────────────────── */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  margin: 0 auto;
}

.feed {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.feed:empty { display: none; }

.line {
  display: grid;
  grid-template-columns: 4.2rem 1.6rem 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 0;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.line:nth-child(even) { background: #1a1a1a; }
.line.speaker-a { border-left-color: #3dba9c; }
.line.speaker-b { border-left-color: #d4a017; }
.line.speaker-c { border-left-color: #c56b8a; }
.line.speaker-d { border-left-color: #6b8fd4; }
.line.speaker-e { border-left-color: #c47a4a; }
.line.speaker-f { border-left-color: #8b6bc4; }
.line.speaker-g { border-left-color: #4aa3a3; }
.line.speaker-h { border-left-color: #b85c7a; }
.line.speaker-i { border-left-color: #7a9b4a; }
.line.speaker-j { border-left-color: #a67c52; }
.line.speaker-k { border-left-color: #5c7a9b; }
.line.speaker-l { border-left-color: #9b5c8a; }
.line time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-muted);
  padding-top: 3px;
  cursor: pointer;
  user-select: none;
}
.line .spk {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 0 0;
  margin: 0;
  cursor: pointer;
  color: var(--fg-muted);
  line-height: 1.2;
  text-align: center;
  border-radius: 0;
}
.line .spk:hover { background: rgba(255, 255, 255, 0.06); }
.line.speaker-a .spk { color: #3dba9c; }
.line.speaker-b .spk { color: #d4a017; }
.line.speaker-c .spk { color: #c56b8a; }
.line.speaker-d .spk { color: #6b8fd4; }
.line.speaker-e .spk { color: #c47a4a; }
.line.speaker-f .spk { color: #8b6bc4; }
.line.speaker-g .spk { color: #4aa3a3; }
.line.speaker-h .spk { color: #b85c7a; }
.line.speaker-i .spk { color: #7a9b4a; }
.line.speaker-j .spk { color: #a67c52; }
.line.speaker-k .spk { color: #5c7a9b; }
.line.speaker-l .spk { color: #9b5c8a; }
.line p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--fg);
  font-weight: 400;
  cursor: text;
  border-radius: 0;
  outline: none;
}
.line p:hover { background: rgba(255, 255, 255, 0.03); }
.line.is-excluded {
  opacity: 0.42;
}
.line.is-excluded p {
  text-decoration: line-through;
  color: var(--fg-muted);
}
.line.is-editing {
  opacity: 1;
  outline: 1px solid var(--border);
  background: #1f1f1f;
}
.line.is-editing p {
  text-decoration: none;
  color: var(--fg);
  background: #242424;
  padding: 2px 6px;
  cursor: text;
  /* ≥16px — иначе iOS зумит страницу и часто не возвращает масштаб */
  font-size: 16px;
  max-height: 30vh;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

@media (max-width: 640px) {
  /* только оболочка эфира — legal-страницы должны нормально скроллиться */
  html:not(.legal-html),
  body:not(.legal-page) {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
  }
  body:not(.legal-page) .main {
    height: 100%;
    max-height: 100%;
  }
  .line {
    grid-template-columns: 3.6rem 1.4rem 1fr;
    gap: 6px;
    padding: 8px 10px;
  }
  .conn-pill { max-width: 30vw; }
  .topbar-count {
    display: inline;
    max-width: 28vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
  }
  .empty-state {
    justify-content: center;
    padding: 12px 16px 8px;
  }
  .ai-orb-wrap {
    width: min(220px, 58vw);
    height: min(220px, 58vw);
  }
  .empty-state-lead { font-size: 13px; }
  .composer-dock {
    margin-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
  .composer-status { min-height: 0; padding-bottom: 8px; }
  .composer-hint { font-size: 12px; }
  .line.is-editing p {
    font-size: 16px;
    line-height: 1.4;
  }
  .settings-panel {
    top: 40px;
    width: calc(100% - 28px);
    max-height: min(72dvh, 520px);
  }
  .settings-panel select,
  .settings-panel .esp-claim input[type="text"] {
    font-size: 16px; /* iOS: без автозума */
  }
}

/* ── empty-state: орб как в ассистент-виджете ───────────────────── */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 24px 20px 16px;
  text-align: center;
  color: var(--fg-muted);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.empty-state[hidden] { display: none !important; }
body.has-history .empty-state { display: none !important; }

.ai-orb-wrap {
  position: relative;
  width: min(280px, 62vw);
  height: min(280px, 62vw);
  margin: 0 0 8px;
  display: grid;
  place-items: center;
}
.ai-orb-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(168, 240, 196, 0.55), transparent 42%),
    radial-gradient(circle at 62% 48%, rgba(97, 218, 251, 0.38), transparent 46%),
    radial-gradient(circle at 48% 62%, rgba(61, 166, 95, 0.42), transparent 50%),
    radial-gradient(circle at 28% 58%, rgba(229, 193, 127, 0.18), transparent 48%);
  background-size: 140% 140%;
  filter: blur(28px);
  opacity: 0.85;
  pointer-events: none;
  will-change: opacity, transform, background-position;
  animation: orbGlowBreath 7s ease-in-out infinite, orbGlowShift 11s ease-in-out infinite;
}
@keyframes orbGlowBreath {
  0%, 100% { opacity: 0.62; transform: scale(0.92); }
  50% { opacity: 0.98; transform: scale(1.06); }
}
@keyframes orbGlowShift {
  0%, 100% { background-position: 30% 28%, 70% 55%, 50% 70%, 25% 60%; }
  33% { background-position: 55% 40%, 40% 35%, 62% 55%, 45% 70%; }
  66% { background-position: 40% 55%, 65% 60%, 35% 40%, 60% 45%; }
}
.ai-orb {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.empty-state-lead {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--fg-muted);
  max-width: 280px;
}
.empty-state-description {
  font-size: 12px;
  max-width: 300px;
  line-height: 1.45;
  color: var(--fg-muted);
  margin-top: 10px;
  min-height: 0;
}
.empty-state-description:empty { display: none; }

body[data-listening="1"] .ai-orb-glow {
  animation-duration: 1.8s;
  opacity: 1;
  filter: blur(32px);
}

.suggest-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  max-width: 480px;
}
.suggest-chip {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #1c1c1c;
  color: var(--fg-soft);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  animation: fadeIn 0.35s ease-out both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.suggest-chip:hover {
  background: var(--bg-hover);
  color: var(--fg);
  border-color: var(--border-hover);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ── composer-dock как в чате ────────────────────────────────────── */

.composer-dock {
  position: relative;
  margin: 0 auto 14px;
  max-width: 760px;
  width: calc(100% - 32px);
  flex-shrink: 0;
}

.composer {
  position: relative;
  margin: 0;
  padding: 10px 12px 8px;
  background: #1e232b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.22);
}

.composer-status {
  min-height: 28px;
  padding: 2px 4px 10px;
}
.composer-hint {
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.45;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mode-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  text-decoration: none;
  font-family: inherit;
}
.mode-pill.is-active {
  background: #242424;
  border-color: var(--border);
  color: var(--fg);
}
.mode-pill:hover { color: var(--fg); }
.mode-pill-chat {
  border-color: var(--border);
  background: #242424;
  color: var(--fg);
}
.mode-pill-logo {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.send-button {
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #0f0f0f;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.send-button:hover:not(:disabled) {
  background: var(--primary-hover);
}
.send-button .ico-stop { display: none; }
.send-button[data-mode="stop"] {
  background: #2a2a2a;
  color: var(--fg);
}
.send-button[data-mode="stop"]:hover:not(:disabled) {
  background: #3a3a3a;
}
.send-button[data-mode="stop"] .ico-play { display: none; }
.send-button[data-mode="stop"] .ico-stop { display: block; }
.send-button:disabled {
  opacity: 0.4;
  cursor: default;
}

body[data-listening="1"] .conn-pill { border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
body[data-listening="1"] .composer {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  box-shadow: 0 2px 16px rgba(61, 166, 95, 0.08);
}
body[data-listening="1"] .send-button[data-mode="stop"] {
  box-shadow: 0 0 0 3px rgba(61, 166, 95, 0.16);
}

/* ── settings modal — живой popover, без «коробок» ───────────────── */

.settings-backdrop {
  position: absolute;
  inset: 0;
  z-index: 18;
  background:
    radial-gradient(ellipse 70% 40% at 50% 12%, rgba(61, 166, 95, 0.12), transparent 55%),
    rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease-out both;
}
.settings-backdrop[hidden] { display: none !important; }

.settings-panel {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 44px;
  transform: translateX(-50%);
  width: min(368px, calc(100% - 32px));
  max-height: min(70vh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  background: #171717;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 16px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  animation: settingsIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes settingsIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.settings-panel[hidden] { display: none !important; }
body.is-settings-open .composer-dock { pointer-events: none; }

.settings-glow {
  pointer-events: none;
  position: absolute;
  left: 10%;
  right: 10%;
  top: -1px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.9;
  box-shadow: 0 0 18px rgba(61, 166, 95, 0.45);
}

.settings-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  position: relative;
}
.settings-panel-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.settings-mark {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(61, 166, 95, 0.14);
  animation: settingsPulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes settingsPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(61, 166, 95, 0.12); }
  50% { box-shadow: 0 0 0 7px rgba(61, 166, 95, 0.05); }
}
.settings-panel-head strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--white);
}
.settings-kicker {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--fg-muted);
}
.settings-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-close:hover {
  color: var(--fg);
  background: var(--bg-hover);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 16px;
}

.settings-block {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  animation: settingsBlockIn 0.28s ease-out both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.settings-block:first-child {
  border-top: none;
  padding-top: 2px;
}
@keyframes settingsBlockIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.settings-block-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.settings-ico {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: rgba(61, 166, 95, 0.1);
  flex-shrink: 0;
}
.settings-block h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 550;
  color: var(--fg-soft);
}
.settings-note {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.35;
}

.settings-panel select,
.settings-panel .esp-claim input[type="text"] {
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 12px;
  background: #222;
  width: 100%;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.settings-panel select:hover,
.settings-panel .esp-claim input[type="text"]:hover {
  background: #262626;
}
.settings-panel select:focus,
.settings-panel .esp-claim input[type="text"]:focus {
  outline: none;
  background: #262626;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.settings-panel select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%238b8b8b' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.settings-gain {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #222;
}
.settings-gain-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--fg-soft);
}
.gain-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.settings-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(61, 166, 95, 0.25), rgba(61, 166, 95, 0.7));
  padding: 0;
  outline: none;
  cursor: pointer;
}
.settings-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 166, 95, 0.18);
  border: none;
}
.settings-panel input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 166, 95, 0.18);
  border: none;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-ui {
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: #2e2e2e;
  position: relative;
  flex-shrink: 0;
  transition: background 0.16s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d0d0d0;
  transition: transform 0.16s ease, background 0.16s ease;
}
.switch input:checked + .switch-ui {
  background: color-mix(in srgb, var(--accent) 70%, #1a1a1a);
}
.switch input:checked + .switch-ui::after {
  transform: translateX(14px);
  background: #fff;
}
.switch-text {
  font-size: 13px;
  color: var(--fg-soft);
  line-height: 1.3;
}
.switch-text em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--fg-muted);
}

.legal-mini {
  margin: 0;
  padding: 12px 18px 14px;
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}
.legal-mini a {
  color: var(--fg-muted);
  text-decoration: none;
}
.legal-mini a:hover { color: var(--accent); }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  color: #141414;
}
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}
.btn.ghost:hover { background: var(--bg-hover); }
.btn.tiny {
  padding: 6px 10px;
  font-size: 12px;
}
.btn.settings-add {
  flex-shrink: 0;
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(61, 166, 95, 0.14);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  border: 1px solid transparent;
}
.btn.settings-add:hover {
  background: rgba(61, 166, 95, 0.22);
  color: #7ed49a;
}

.settings-panel .esp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.settings-panel .esp-list[hidden] { display: none !important; }
.settings-panel .esp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: #242424;
}
.settings-panel .esp-item.is-online .esp-item-meta strong {
  color: var(--accent);
}
.settings-panel .esp-item-body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.settings-panel .esp-item-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.settings-panel .esp-item-meta strong {
  font-size: 13px;
  color: var(--fg);
  font-weight: 500;
}
.settings-panel .esp-item-serial,
.settings-panel .esp-item-level {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.settings-panel .esp-wave {
  display: block;
  flex: 1 1 100px;
  height: 22px;
  border-radius: 6px;
  background: #1a1a1a;
}
.settings-panel .esp-unlink {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
.settings-panel .esp-unlink:hover {
  color: var(--danger);
  background: rgba(231, 76, 60, 0.1);
}
.settings-panel .esp-claim {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-panel .esp-claim input[type="text"] {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

/* ── legal pages — как empty-state Voice: спокойно и читабельно ─── */

html.legal-html,
body.legal-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: auto;
}
body.legal-page {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

.legal-bg { display: none; }

.legal-topbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: max(2px, env(safe-area-inset-top, 0px));
}
.legal-topbar .topbar-title { flex: 0 1 auto; }
.legal-topbar-nav {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding-right: 2px;
}
.legal-topbar-nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 12px;
  line-height: 1;
}
.legal-topbar-nav a:hover { color: var(--fg); }
.legal-topbar-nav a.is-active { color: var(--fg-soft); }

.legal-shell {
  flex: 1;
  width: min(520px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 max(40px, calc(24px + env(safe-area-inset-bottom, 0px)));
}

.legal-doc {
  text-align: left;
}

.legal-doc h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--white);
}

.legal-meta {
  margin: 0 0 28px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg-muted);
}

.legal-doc section {
  margin: 0 0 22px;
  padding: 0;
  border: none;
  background: none;
}
.legal-doc section:last-of-type { margin-bottom: 0; }

.legal-doc h2 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-soft);
}

.legal-doc p,
.legal-doc li {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-muted);
  font-weight: 400;
}
.legal-doc p + p { margin-top: 8px; }
.legal-doc strong {
  color: var(--fg-soft);
  font-weight: 500;
}
.legal-doc ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.legal-doc li {
  position: relative;
  padding-left: 14px;
}
.legal-doc li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-hover);
}
.legal-doc a {
  color: var(--accent);
  text-decoration: none;
}
.legal-doc a:hover { color: var(--accent-hover); }

.legal-foot {
  margin: 28px 0 0;
  padding: 0;
  border: none;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
}
.legal-foot a {
  color: var(--fg-muted);
  text-decoration: none;
}
.legal-foot a:hover { color: var(--fg); }

@media (max-width: 640px) {
  .legal-shell {
    width: calc(100% - 32px);
    padding-top: 20px;
  }
  .legal-doc h1 { font-size: 18px; }
  .legal-topbar-nav { gap: 12px; }
}

/* legacy */
.legal-back, .legal-eyebrow, .grain, .glow { display: none; }
