/* fine.earth — стили. Светлая/тёмная тема: data-theme на <html>, без него — по системе. */
:root {
  --bg: #EEF1F6;
  --surface: #FFFFFF;
  --field: #F5F7FA;
  --ink: #0E1726;
  --muted: #556070;
  --placeholder: #7A8494;
  --line: #D6DCE6;
  --line-soft: #E3E8EF;
  --bubble: #FFFFFF;
  --bubble-line: #DEE4EC;
  --accent: #2255C4;
  --accent-hover: #1A44A0;
  --accent-text: #2255C4;
  --on-accent: #FFFFFF;
  --sel: #E0E8F7;
  --img: #DCE3EE;
  --card: #0E1726;
  --card-ink: #E5EAF2;
  --card-muted: #A3AEC0;
  --card-field: #18243A;
  --card-line: #2A3852;
  --danger: #C2362B;
  --ok: #2E9E5B;
  --warn-bg: #FDF1D6;
  --warn-ink: #6B4A0B;
  --toast-bg: #0E1726;
  --toast-ink: #FFFFFF;
  --shadow: 0 12px 32px rgba(10, 20, 40, .14);
  --nm-0: #B4532A; --nm-1: #1F5F8B; --nm-2: #2F7373; --nm-3: #7A5F14;
  --nm-4: #6B4E8A; --nm-5: #2255C4; --nm-6: #A23B5A; --nm-7: #3F6B2E;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Geologica, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --surface: #111A2B; --field: #0F1828; --ink: #E5EAF2; --muted: #94A0B4; --placeholder: #7E8AA0;
    --line: #24314A; --line-soft: #1C2740; --bubble: #152036; --bubble-line: #223049;
    --accent: #3469D8; --accent-hover: #4378E0; --accent-text: #8FB2F5; --sel: #1C2B4D; --img: #1C2740;
    --card: #E5EAF2; --card-ink: #0E1726; --card-muted: #556070; --card-field: #D3DAE6; --card-line: #BCC6D6;
    --danger: #F07167; --ok: #4CC27E; --warn-bg: #3A2E10; --warn-ink: #F5D98B; --toast-bg: #E5EAF2; --toast-ink: #0B1220;
    --shadow: 0 12px 32px rgba(0, 0, 0, .45);
    --nm-0: #F0A07A; --nm-1: #7FB8E3; --nm-2: #7CCACA; --nm-3: #E0C070;
    --nm-4: #C4A6E8; --nm-5: #8FB2F5; --nm-6: #EE9AB4; --nm-7: #9CCB82;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --surface: #111A2B; --field: #0F1828; --ink: #E5EAF2; --muted: #94A0B4; --placeholder: #7E8AA0;
  --line: #24314A; --line-soft: #1C2740; --bubble: #152036; --bubble-line: #223049;
  --accent: #3469D8; --accent-hover: #4378E0; --accent-text: #8FB2F5; --sel: #1C2B4D; --img: #1C2740;
  --card: #E5EAF2; --card-ink: #0E1726; --card-muted: #556070; --card-field: #D3DAE6; --card-line: #BCC6D6;
  --danger: #F07167; --ok: #4CC27E; --warn-bg: #3A2E10; --warn-ink: #F5D98B; --toast-bg: #E5EAF2; --toast-ink: #0B1220;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --nm-0: #F0A07A; --nm-1: #7FB8E3; --nm-2: #7CCACA; --nm-3: #E0C070;
  --nm-4: #C4A6E8; --nm-5: #8FB2F5; --nm-6: #EE9AB4; --nm-7: #9CCB82;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
a { color: var(--accent-text); }
button, input, textarea, select { font: inherit; color: inherit; }
::placeholder { color: var(--placeholder); opacity: 1; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 12px; cursor: pointer; white-space: nowrap; font-weight: 500; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--field); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.solid { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.solid:hover { opacity: .9; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--field); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.icon { padding: 0; width: 40px; min-width: 40px; }
.btn.sm.icon { width: 36px; min-width: 36px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 50px; font-size: 16px; border-radius: 14px; }

.input, textarea.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--field); outline: none; font-size: 16px; color: var(--ink);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error-text { color: var(--danger); font-size: 14px; min-height: 1em; margin: 8px 0 0; }
.error-text:empty { margin: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow, .grow { flex: 1; min-width: 0; }

/* ---------- brand & top controls ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand .logo { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); flex: none; }
.brand .pt { color: var(--accent); }
.brand.sm { font-size: 17px; gap: 8px; }
.brand.sm .logo { width: 20px; height: 20px; }

.controls { display: flex; align-items: center; gap: 6px; }
.ctl {
  height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; font-family: var(--mono); font-size: 13px; font-weight: 500;
}
.ctl:hover { background: var(--field); }
.ctl.round { padding: 0; width: 40px; }
.ctl svg.i { width: 16px; height: 16px; }
.ctl.sq { border-radius: 10px; height: 36px; min-width: 36px; }
.ctl.sq.round { width: 36px; }
.lang-wrap { position: relative; }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 190px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: var(--shadow); display: grid; gap: 2px;
}
.lang-menu[hidden] { display: none; }
.lang-menu.up { top: auto; bottom: calc(100% + 8px); }
.lang-menu button {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; color: var(--ink); font-size: 15px;
}
.lang-menu button:hover { background: var(--field); }
.lang-menu button[aria-checked="true"] { background: var(--sel); font-weight: 600; }
.lang-menu button small { font-family: var(--mono); font-size: 12px; opacity: .7; }

/* ---------- landing ---------- */
.landing { max-width: 1120px; margin: 0 auto; padding: 0 24px; min-height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 24px 0; }
.topbar nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hero { display: flex; flex-wrap: wrap; gap: 48px; padding: 48px 0 64px; align-items: flex-start; }
.hero-main { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero-title { margin: 0; font-size: clamp(40px, 7vw, 64px); line-height: 1.02; font-weight: 600; letter-spacing: -0.035em; white-space: pre-line; }
.lead { margin: 0; font-size: 19px; color: var(--muted); max-width: 480px; font-weight: 300; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.card p.sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.create-card { max-width: 540px; }
.create-card .pair { display: flex; flex-wrap: wrap; gap: 0 12px; }
.create-card .pair > label { flex: 1 1 200px; }
.link-hint { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.link-hint code { background: var(--bg); color: var(--ink); padding: 3px 8px; border-radius: 6px; font: inherit; }

.account-card {
  flex: 1 1 340px; min-width: 0; max-width: 420px; background: var(--card); color: var(--card-ink);
  border: 1px solid var(--card-line); border-radius: 24px; padding: 28px;
}
.account-card p.sub { color: var(--card-muted); }
.account-card label.field > span { color: var(--card-muted); }
.account-card .input { background: var(--card-field); border-color: var(--card-line); color: var(--card-ink); }
.account-card .input::placeholder { color: var(--card-muted); }
.account-card .btn.primary { background: var(--card-ink); border-color: var(--card-ink); color: var(--card); }
.account-card .btn.primary:hover { opacity: .9; }
.tabs { display: flex; gap: 4px; background: var(--card-field); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; min-height: 38px; border-radius: 9px; cursor: pointer; color: var(--card-muted); font-size: 14px; }
.tabs button.active { background: var(--card-ink); color: var(--card); font-weight: 500; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 24px; padding-bottom: 64px; }
.features > div { border-top: 2px solid var(--ink); padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.features svg.i { width: 24px; height: 24px; color: var(--accent-text); }
.features h3 { margin: 0; font-size: 17px; font-weight: 600; }
.features p { margin: 0; color: var(--muted); font-size: 14px; }
.foot { margin-top: auto; border-top: 1px solid var(--line); padding: 20px 0 32px; font-family: var(--mono); font-size: 13px; color: var(--muted); }

.banner { background: var(--warn-bg); color: var(--warn-ink); padding: 16px 18px; border-radius: 16px; margin-bottom: 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* одиночные экраны: вход в чат, подтверждение, не найдено */
.single { min-height: 100%; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; padding: 16px 16px 24px; }
.single .topbar { padding: 8px 0 0; }
.single main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: 32px 0; }
.single h1 { margin: 0; font-size: clamp(32px, 9vw, 44px); line-height: 1.05; font-weight: 600; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.single .meta-line { color: var(--muted); font-size: 14px; }
.single .card { border-radius: 20px; }

/* ---------- app layout ---------- */
.layout { display: grid; grid-template-columns: 320px 1fr; height: 100%; }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 12px 18px; }
.tools { padding: 0 14px 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--line-soft); }
.alias-form { display: flex; align-items: center; gap: 6px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px 4px 12px; }
.alias-form:focus-within { border-color: var(--accent); }
.alias-form .at { font-family: var(--mono); color: var(--muted); }
.alias-form input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 6px 0; }
.alias-form .btn { min-height: 34px; padding: 4px 12px; border-radius: 9px; font-size: 14px; }
.tools .row .btn { flex: 1; min-width: 0; }
.llm-list { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.llm-list button { border: 1px solid var(--line); background: var(--field); color: var(--accent-text); border-radius: 8px; padding: 2px 8px; cursor: pointer; font-size: 13px; font-family: var(--mono); }
.chat-list { overflow-y: auto; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.chat-item { display: flex; gap: 12px; padding: 10px; border-radius: 14px; cursor: pointer; align-items: center; text-decoration: none; color: inherit; }
.chat-item:hover { background: var(--field); }
.chat-item.active { background: var(--sel); }
.chat-item .meta { flex: 1; min-width: 0; }
.chat-item .top, .chat-item .bot { display: flex; align-items: baseline; gap: 6px; }
.chat-item .bot { align-items: center; }
.chat-item .title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .when { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }
.chat-item .preview { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; flex: none; }
.chat-item .unread { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 16px; border-top: 1px solid var(--line-soft); }
.me .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me .who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who small { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 32px 16px; font-size: 14px; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.placeholder { margin: auto; color: var(--muted); text-align: center; padding: 24px; max-width: 320px; display: grid; justify-items: center; gap: 12px; }
.placeholder svg.i { width: 40px; height: 40px; stroke-width: 1.4; }

.avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #FFFFFF; font-weight: 600; flex: none; font-size: 15px; }
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 12px; }
.avatar.md { width: 36px; height: 36px; border-radius: 12px; font-size: 13px; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .layout.chat-open .sidebar { display: none; }
  .layout:not(.chat-open) .main { display: none; }
  .hero { padding-top: 24px; gap: 32px; }
  .account-card { max-width: none; }
  .landing { padding: 0 16px; }
}
.only-mobile { display: none !important; }
@media (max-width: 760px) { .only-mobile { display: inline-flex !important; } }

/* ---------- chat pane ---------- */
.pane { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.pane-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pane-head .ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.pane-head .ttl b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 600; }
.pane-head .ttl small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .pane-head { padding: 10px 10px; gap: 8px; }
  .pane-head .av, .pane-head .lbl { display: none; }
  .pane-head .btn.sm.has-lbl { width: 36px; min-width: 36px; padding: 0; }
}
.pane-head .ttl small .on { color: var(--accent-text); }
.pane-head .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.pane-head .controls { margin-left: 4px; }
.conn { font-size: 12px; padding: 4px 14px; text-align: center; background: var(--warn-bg); color: var(--warn-ink); }
.conn.hidden { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 18px clamp(12px, 3vw, 28px) 8px; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; margin: 12px 0 8px; }
.sys { align-self: center; font-size: 13px; color: var(--muted); margin: 6px 0; text-align: center; }
.msg { display: flex; flex-direction: column; max-width: min(620px, 82%); align-self: flex-start; margin-top: 10px; }
.msg.cont { margin-top: 3px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .bubble { background: var(--bubble); border: 1px solid var(--bubble-line); padding: 8px 12px 6px; border-radius: 16px 16px 16px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.cont .bubble { border-radius: 4px 16px 16px 4px; }
.msg.mine .bubble { background: var(--accent); color: var(--on-accent); border-color: transparent; border-radius: 16px 16px 4px 16px; }
.msg.mine.cont .bubble { border-radius: 16px 4px 4px 16px; }
.msg.mine .bubble a { color: inherit; }
.msg .author { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: normal; }
.msg .time { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 10px; float: right; margin-top: 4px; }
.msg.mine .time { color: inherit; opacity: .75; }
.msg.pending .bubble { opacity: .6; }
.msg.failed .bubble { outline: 2px solid var(--danger); cursor: pointer; }
.msg.llm .author::after { content: 'LLM'; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .04em; color: var(--accent-text); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }

.file { display: flex; align-items: center; gap: 12px; min-width: min(240px, 60vw); white-space: normal; }
.file .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--bg); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.msg.mine .file .ico { background: rgba(255,255,255,.18); color: #fff; }
.file .fn { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.file .fn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file .fn small { font-family: var(--mono); font-size: 12px; opacity: .75; }
.file button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.file button:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.preview-img { display: block; max-width: 100%; max-height: 320px; border-radius: 11px; margin-bottom: 6px; cursor: zoom-in; background: var(--img); }
.caption { margin-top: 6px; }

.typing { font-size: 13px; color: var(--muted); padding: 0 clamp(14px, 3vw, 30px); height: 22px; display: flex; align-items: center; }
.composer {
  margin: 0 clamp(8px, 2vw, 20px) max(16px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px;
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1; resize: none; max-height: 160px; min-height: 40px; border: 0; background: transparent; outline: none; padding: 9px 4px; font-size: 16px; }
.composer .btn.icon { border: 0; border-radius: 12px; }
.composer .attach { background: transparent; color: var(--muted); }
.composer .attach:hover { background: var(--field); color: var(--ink); }
.uploads { padding: 0 clamp(14px, 3vw, 30px); }
.upload-row { font-size: 13px; display: flex; gap: 8px; align-items: center; padding: 6px 0; color: var(--muted); }
.upload-row progress { flex: 1; height: 6px; accent-color: var(--accent); }
.dropzone { position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 16%, transparent); border: 3px dashed var(--accent); display: none; place-items: center; font-size: 20px; font-weight: 600; color: var(--accent-text); z-index: 5; pointer-events: none; }
.pane.dragging .dropzone { display: grid; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(5, 10, 20, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal header { padding: 16px 16px 0 22px; display: flex; align-items: center; }
.modal header h3 { margin: 0; flex: 1; font-size: 18px; font-weight: 600; }
.modal .body { padding: 16px 22px 22px; }
.members { list-style: none; margin: 0 0 12px; padding: 0; }
.members li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.members li:last-child { border-bottom: 0; }
.members .nm { flex: 1; min-width: 0; }
.members .nm small { color: var(--muted); margin-left: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; margin-right: 6px; }
.dot.on { background: var(--ok); }
.badge { font-family: var(--mono); font-size: 11px; background: var(--sel); color: var(--accent-text); padding: 1px 7px; border-radius: 999px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 60; cursor: zoom-out; }
.lightbox img { max-width: 95vw; max-height: 95vh; }

#toasts { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--toast-bg); color: var(--toast-ink); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: tin .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---------- показ экрана ---------- */
.screen-area { display: contents; }
.screen-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--sel); color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); }
.screen-bar.live { background: var(--warn-bg); color: var(--warn-ink); }
.screen-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-bar > .i { width: 18px; height: 18px; flex: none; }
.screen-bar.hidden, .screen-view.hidden { display: none; }
.screen-view { background: #000; flex: none; height: 55%; min-height: 180px; display: flex; border-bottom: 1px solid var(--line); }
.screen-view video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.screen-view:fullscreen { height: 100%; }
.screen-view:fullscreen video { cursor: zoom-out; }
@media (max-width: 720px) { .screen-view { height: 38%; } .screen-bar { padding: 8px 10px; } }

/* ---------- голос ---------- */
.voice-area { display: contents; }
.voice-audio { display: none; }
.voice-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--sel); color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); }
.voice-bar.live { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.voice-bar.other { background: var(--field); color: var(--muted); }
.voice-bar > .i { width: 18px; height: 18px; flex: none; }
.voice-bar .grow { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.voice-bar span.grow { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-bar b { font-weight: 600; white-space: nowrap; }
.voice-people { display: flex; flex-wrap: wrap; gap: 4px; }
.voice-people .vp { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.voice-people .vp.wait { opacity: .55; }
.voice-people .vp svg.i { width: 13px; height: 13px; color: var(--danger); }
@media (max-width: 720px) { .voice-bar { padding: 8px 10px; } }

/* камеры в разговоре */
.voice-rows { display: contents; }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; padding: 6px 16px; background: var(--field); border-bottom: 1px solid var(--line); max-height: 42%; overflow: auto; flex: none; }
.voice-grid[data-n="1"] { grid-template-columns: minmax(0, 360px); justify-content: center; }
.voice-grid.hidden { display: none; }
.voice-grid .vt { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; cursor: zoom-in; }
.voice-grid .vt video { width: 100%; height: 100%; object-fit: cover; display: block; }
.voice-grid .vt video.mirror { transform: scaleX(-1); }
.voice-grid .vt:fullscreen { cursor: zoom-out; border-radius: 0; }
.voice-grid .vt:fullscreen video { object-fit: contain; }
.voice-grid .vn { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.voice-grid .vn svg.i { width: 12px; height: 12px; color: #ff8a80; }
@media (max-width: 720px) { .voice-grid { padding: 6px 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 34%; } }
