:root {
  --accent: #3ddc97; --on-accent: #0b0e12;
  --bg0: #0a0c10; --bg1: #11141a; --bg2: #161a22; --bg3: #1e232d; --bg4: #272d39;
  --text: #e7eaf0; --muted: #8a93a5; --line: #232936; --danger: #ff5d6c; --warn: #ffb454;
  --radius: 12px; --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="midnight"] { --bg0: #000; --bg1: #07080b; --bg2: #0c0e13; --bg3: #14171e; --bg4: #1c2029; --line: #181c25; }
:root[data-theme="light"] { --bg0: #e4e8ef; --bg1: #eef1f6; --bg2: #ffffff; --bg3: #f1f3f8; --bg4: #e3e7ef; --text: #161a22; --muted: #5d667a; --line: #dde2ec; --shadow: 0 10px 40px rgba(20, 30, 60, .18); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg2); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3 { margin: 0; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--bg4) transparent; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
#root { height: 100%; }
.hint { color: var(--muted); font-size: 13px; }

/* ── Кнопки та поля ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; background: var(--bg4); font-weight: 600; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.12); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.wide { width: 100%; margin-top: 8px; } .btn.big { padding: 12px 22px; font-size: 16px; }
.btnrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.link { color: var(--muted); margin-top: 12px; font-size: 14px; } .link:hover { color: var(--text); }
.input { width: 100%; padding: 10px 12px; background: var(--bg1); border: 1px solid var(--line); border-radius: 10px; outline: none; transition: border-color .15s, box-shadow .15s; }
:root[data-theme="light"] .input { background: #fff; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.input { resize: none; }
.field { display: block; margin-bottom: 12px; } .field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--muted); transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--bg4); color: var(--text); }
.icon-btn.on { color: var(--accent); } .icon-btn.off { color: var(--danger); } .icon-btn.danger:hover { background: var(--danger); color: #fff; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.send { color: var(--accent); }
.mini { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 6px; } .mini:hover { color: var(--text); background: var(--bg4); }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; } .check input { accent-color: var(--accent); width: 18px; height: 18px; }
.check small { color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; } .two h3 { margin-top: 0; }

/* ── Аватар і статус ── */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; overflow: hidden; flex: none; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avw { position: relative; display: inline-flex; flex: none; }
.sdot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid var(--bg1); background: #6b7385; }
.sdot.online { background: #3ddc6f; } .sdot.idle { background: var(--warn); } .sdot.dnd { background: var(--danger); }
.topbar .sdot { border-color: var(--bg2); }

/* ── Вхід ── */
.auth { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; background: radial-gradient(1200px 600px at 10% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--bg1); overflow: auto; }
.auth-brand { padding: 12vh 8vw; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.auth-brand h1 { font-size: clamp(40px, 6vw, 72px); letter-spacing: -.03em; line-height: 1; }
.auth-brand p { color: var(--muted); font-size: 18px; max-width: 28ch; margin: 0; }
.logo { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 0 30px color-mix(in srgb, var(--accent) 9%, transparent); margin: 0 0 22px 18px; position: relative; }
.logo::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--text); top: -24px; right: -34px; }
.auth-card { align-self: center; justify-self: center; width: min(420px, calc(100% - 32px)); background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); margin: 24px 0; }
.auth-card h2 { margin-bottom: 6px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg1); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tabs button { padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 600; } .tabs button.active { background: var(--bg4); color: var(--text); }
.err { color: var(--danger); min-height: 20px; font-size: 14px; margin: 4px 0; } .err.ok { color: var(--accent); }
.input.code { font-size: 28px; letter-spacing: .4em; text-align: center; font-family: var(--mono); }
.hint.invite { background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 10px 12px; border-radius: 10px; color: var(--text); }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; } .auth-brand { padding: 40px 28px 0; } .logo { margin-bottom: 8px; } }

/* ── Каркас ── */
.app { display: grid; grid-template-columns: 72px 316px minmax(0, 1fr) 240px; height: 100%; }
.app.no-members { grid-template-columns: 72px 316px minmax(0, 1fr) 0; } .app.no-members .members { display: none; }
.rail { background: var(--bg0); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; overflow-y: auto; scrollbar-width: none; }
.rail-btn { position: relative; width: 48px; height: 48px; border-radius: 24px; background: var(--bg3); color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; transition: border-radius .18s, background .18s, color .18s; }
.rail-btn:hover { border-radius: 16px; background: var(--accent); color: var(--on-accent); }
.rail-btn.active { border-radius: 16px; background: var(--accent); color: var(--on-accent); }
.rail-btn.active::before { content: ""; position: absolute; left: -12px; width: 5px; height: 28px; border-radius: 0 5px 5px 0; background: var(--text); }
.rail-btn.add { color: var(--accent); background: transparent; border: 2px dashed var(--bg4); } .rail-btn.add:hover { border-style: solid; }
.rail-sep { width: 28px; height: 2px; background: var(--bg4); border-radius: 2px; flex: none; }
.rail-btn .badge { position: absolute; right: -4px; bottom: -4px; }
.pip { position: absolute; left: -10px; width: 8px; height: 8px; border-radius: 50%; background: var(--text); }
.live-dot { position: absolute; right: 1px; top: 1px; width: 11px; height: 11px; border-radius: 50%; background: #3ddc6f; border: 2.5px solid var(--bg0); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg0); box-sizing: content-box; }
.side .badge { border: 0; height: 18px; margin-left: auto; }

.side { background: var(--bg1); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.side-head { height: 52px; padding: 0 14px 0 16px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; border-bottom: 1px solid var(--line); text-align: left; flex: none; width: 100%; }
button.side-head:hover { background: var(--bg3); } .sh-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.sec-title { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chan-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; color: var(--muted); cursor: pointer; min-height: 36px; }
.chan-item:hover { background: var(--bg3); color: var(--text); } .chan-item.active { background: var(--bg4); color: var(--text); }
.chan-item.unread { color: var(--text); font-weight: 700; } .chan-item.joined .ico { color: #3ddc6f; }
.chan-item .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chan-item .del { opacity: 0; } .chan-item:hover .del { opacity: 1; }
.gav { width: 32px; height: 32px; border-radius: 50%; background: var(--bg4); display: inline-flex; align-items: center; justify-content: center; }
.live-chip { font-size: 10px; font-weight: 800; background: var(--danger); color: #fff; border-radius: 6px; padding: 2px 5px; display: inline-flex; align-items: center; gap: 3px; letter-spacing: .04em; }
.chan-item .live-chip { background: #3ddc6f; color: #07210f; }
.vpart { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 34px; color: var(--muted); font-size: 14px; }
.vpart .vn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vpart.speaking .avatar { box-shadow: 0 0 0 2px #3ddc6f; }
.empty-side { padding: 20px 10px; color: var(--muted); font-size: 14px; text-align: center; }

.userpanel { background: var(--bg0); flex: none; }
:root[data-theme="light"] .userpanel { background: var(--bg3); }
.vstrip { display: flex; align-items: center; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); gap: 6px; }
.vs-info { flex: 1; min-width: 0; cursor: pointer; } .vs-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #3ddc6f; font-size: 14px; }
.vs-dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc6f; animation: pulse 1.6s infinite; }
.vs-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { opacity: .35; } }
.me-row { display: flex; align-items: center; gap: 2px; padding: 8px; }
.me-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 3px 6px; border-radius: 8px; cursor: pointer; } .me-info:hover { background: var(--bg3); }
.me-info .sdot { border-color: var(--bg0); }
.me-text { min-width: 0; } .me-name { font-weight: 700; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .me-sub { font-size: 12px; color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg2); }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.topbar .title { font-weight: 700; font-size: 16px; } .topbar .sub { color: var(--muted); font-size: 13px; } .spacer { flex: 1; }
.only-mobile { display: none; }
.chanview { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chanview.with-stage .stage { flex: 1 1 58%; } .chanview.with-stage .chat { flex: 0 0 38%; border-top: 1px solid var(--line); }
.chanview.with-stage.chat-hidden .chat { display: none; }

/* ── Повідомлення ── */
.msgs { flex: 1; overflow-y: auto; padding: 12px 0 6px; min-height: 0; }
.day { display: flex; align-items: center; gap: 12px; margin: 14px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { position: relative; display: flex; gap: 14px; padding: 3px 16px 3px 16px; }
.msg:not(.grouped) { margin-top: 12px; } .msg:hover { background: color-mix(in srgb, var(--bg4) 40%, transparent); }
.msg .av { width: 40px; flex: none; align-self: flex-start; } .msg .gtime { width: 40px; flex: none; font-size: 11px; color: var(--muted); text-align: center; opacity: 0; padding-top: 4px; } .msg:hover .gtime { opacity: 1; }
.msg .body { min-width: 0; flex: 1; }
.meta { display: flex; align-items: baseline; gap: 8px; } .meta .name { font-weight: 700; } .meta .name:hover { text-decoration: underline; } .meta .time { font-size: 12px; color: var(--muted); }
.text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.text code { font-family: var(--mono); font-size: .9em; background: var(--bg4); padding: 1px 5px; border-radius: 5px; }
.text pre { background: var(--bg1); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; margin: 6px 0; overflow-x: auto; white-space: pre; } .text pre code { background: none; padding: 0; }
.edited { color: var(--muted); font-size: 11px; }
.actions { position: absolute; right: 12px; top: -14px; display: none; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 2px; box-shadow: var(--shadow); } .msg:hover .actions { display: flex; }
.edit-ta { margin-top: 4px; }
.loadmore { display: block; margin: 6px auto 10px; color: var(--accent); font-weight: 600; padding: 6px 14px; border-radius: 8px; } .loadmore:hover { background: var(--bg3); }
.start { text-align: center; color: var(--muted); padding: 40px 16px; }
.typing { height: 20px; padding: 0 20px; font-size: 12.5px; color: var(--muted); flex: none; font-style: italic; }
.composer { display: flex; align-items: flex-end; gap: 6px; margin: 0 16px 16px; background: var(--bg3); border-radius: 14px; padding: 4px 6px 4px 4px; flex: none; }
.composer .input { background: transparent; border: 0; box-shadow: none; padding: 10px 12px; max-height: 200px; line-height: 1.4; }
.composer .icon-btn { margin-bottom: 2px; }

/* ── Учасники ── */
.members { background: var(--bg1); border-left: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.mem-group { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 14px 8px 6px; }
.mem { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; cursor: pointer; } .mem:hover { background: var(--bg3); }
.mem.off { opacity: .5; } .mem .mn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tag { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 0 5px; }

/* ── Голосова сцена ── */
.stage { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg0); }
.grid { flex: 1; display: grid; gap: 10px; padding: 12px; min-height: 0; }
.spot { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 12px; min-height: 0; }
.spot-main { flex: 1; min-height: 0; display: flex; } .spot-main .tile { flex: 1; }
.spot-strip { display: flex; gap: 10px; height: 112px; flex: none; overflow-x: auto; } .spot-strip .tile { flex: 0 0 180px; }
.tile { position: relative; background: var(--bg3); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; cursor: pointer; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .12s; }
.tile.speaking { outline-color: #3ddc6f; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile.cam video { object-fit: cover; }
.tile-av { display: flex; } .spot-strip .tile-av .avatar { width: 52px !important; height: 52px !important; font-size: 22px !important; }
.tile-label { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .6); color: #fff; padding: 3px 9px; border-radius: 8px; font-size: 13px; font-weight: 600; max-width: calc(100% - 16px); backdrop-filter: blur(6px); }
.tile-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tile-label em { font-weight: 400; opacity: .7; }
.tile-label .ico:first-child:not(:last-child) { color: var(--danger); } .tile.screen .tile-label .ico { color: #fff !important; }
.tile-tools { position: absolute; right: 6px; top: 6px; display: none; gap: 4px; align-items: center; } .tile:hover .tile-tools { display: flex; }
.tile-tools .icon-btn, .vol { background: rgba(0, 0, 0, .6); color: #fff; border-radius: 8px; backdrop-filter: blur(6px); }
.vol { display: flex; align-items: center; gap: 6px; padding: 0 8px; height: 28px; } .vol input { width: 80px; accent-color: var(--accent); }
.controls { flex: none; display: flex; justify-content: center; gap: 12px; padding: 10px 12px 14px; }
.cbtn { width: 52px; height: 52px; border-radius: 50%; background: var(--bg4); color: var(--text); display: flex; align-items: center; justify-content: center; transition: background .15s, transform .08s; }
.cbtn:hover { background: color-mix(in srgb, var(--bg4) 70%, var(--text)); } .cbtn:active { transform: scale(.94); }
.cbtn.on { background: var(--accent); color: var(--on-accent); } .cbtn.off { background: #fff; color: #111; } .cbtn.hang { background: var(--danger); color: #fff; width: 64px; border-radius: 26px; }
.join-splash { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px; text-align: center; }
.js-title { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.js-people { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; } .js-p { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* ── Привітання ── */
.welcome { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.wcard { max-width: 460px; text-align: center; display: flex; flex-direction: column; gap: 14px; } .wcard h1 { font-size: 30px; letter-spacing: -.02em; } .wcard p { color: var(--muted); margin: 0; }
.wbtns { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* ── Модалки, меню, тости ── */
.modal-back { position: fixed; inset: 0; background: rgba(5, 7, 10, .62); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .12s; backdrop-filter: blur(3px); }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); animation: pop .14s; } .modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 6px 22px; } .modal-body { padding: 8px 22px 22px; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: scale(.96); opacity: 0; } }
.copyrow { display: flex; gap: 8px; }
.menu { position: fixed; z-index: 60; min-width: 220px; background: var(--bg3); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); animation: pop .1s; }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; } .menu-item:hover { background: var(--accent); color: var(--on-accent); } .menu-item.danger { color: var(--danger); } .menu-item.danger:hover { background: var(--danger); color: #fff; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; pointer-events: none; }
.toast { background: var(--bg4); color: var(--text); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: pop .15s; border: 1px solid var(--line); max-width: 90vw; } .toast.err { background: var(--danger); color: #fff; border-color: transparent; } .toast.out { opacity: 0; transition: opacity .4s; }
.connbar { position: fixed; top: 0; left: 0; right: 0; background: var(--warn); color: #231600; text-align: center; font-weight: 600; padding: 6px; z-index: 90; transform: translateY(-100%); transition: transform .2s; } .connbar.show { transform: none; }

/* ── Профіль / налаштування ── */
.profile .p-top { display: flex; gap: 18px; align-items: center; } .p-name { font-size: 22px; font-weight: 800; } .p-user { color: var(--muted); } .p-status { font-size: 13px; margin-top: 4px; }
.p-bio { margin-top: 16px; padding: 12px; background: var(--bg1); border-radius: 10px; white-space: pre-wrap; }
.profile .sdot { width: 18px; height: 18px; border-width: 4px; border-color: var(--bg2); }
.settings { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 22px; min-height: 380px; } .sbody { min-width: 0; }
.stabs { display: flex; flex-direction: column; gap: 2px; } .stab { text-align: left; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; } .stab:hover { background: var(--bg3); } .stab.active { background: var(--bg4); color: var(--text); }
.av-row { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; } .chip { padding: 8px 16px; border-radius: 999px; background: var(--bg3); font-weight: 600; border: 2px solid transparent; } .chip.active { border-color: var(--accent); }
.swatches { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--bg2); box-shadow: 0 0 0 1px var(--line); } .swatches input[type=color] { width: 40px; height: 34px; border: 0; background: none; padding: 0; cursor: pointer; }

/* ── Мобільна версія ── */
.scrim { display: none; }
@media (max-width: 899px) {
  .app, .app.no-members { grid-template-columns: minmax(0, 1fr); position: relative; overflow: hidden; }
  .rail, .side, .members { position: fixed; top: 0; bottom: 0; z-index: 40; transition: transform .22s ease; }
  .rail { left: 0; width: 72px; transform: translateX(-100%); } .side { left: 72px; width: min(280px, calc(100vw - 72px)); transform: translateX(-200%); }
  .members { right: 0; width: min(280px, 86vw); transform: translateX(100%); display: block !important; }
  .app.nav-open .rail, .app.nav-open .side { transform: none; } .app.mem-open .members { transform: none; }
  .app.nav-open .scrim, .app.mem-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 30; }
  .only-mobile { display: inline-flex; }
  .chanview.with-stage .stage { flex-basis: 55%; } .chanview.with-stage .chat { flex-basis: 45%; }
  .grid { gap: 6px; padding: 6px; } .cbtn { width: 46px; height: 46px; } .cbtn.hang { width: 58px; }
  .actions { top: -16px; } .tile-tools { display: flex; }
  .composer { margin: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .two { grid-template-columns: 1fr; gap: 6px; }
  .settings { grid-template-columns: 1fr; } .stabs { flex-direction: row; overflow-x: auto; }
}
@media (max-width: 899px) and (orientation: landscape) { .chanview.with-stage .chat { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }


/* ═════════════ Orbit = Discord + Telegram ═════════════ */
:root { --mine: color-mix(in srgb, var(--accent) 26%, var(--bg2)); --other: var(--bg3); }
:root[data-theme="light"] { --mine: color-mix(in srgb, var(--accent) 30%, #fff); --other: #fff; }

/* Список чатів */
.side-tools { padding: 10px 12px 4px; flex: none; }
.chatsearch { border-radius: 999px; background: var(--bg3); border-color: transparent; padding: 9px 16px; }
.chips2 { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.chip2 { padding: 5px 13px; border-radius: 999px; background: var(--bg3); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.chip2:hover { color: var(--text); } .chip2.active { background: var(--accent); color: var(--on-accent); }
#chatlist { padding: 6px; }
.crow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; cursor: pointer; }
.crow:hover { background: var(--bg3); } .crow.active { background: color-mix(in srgb, var(--accent) 24%, var(--bg1)); }
.crow .sdot { border-color: var(--bg1); } .crow:hover .sdot { border-color: var(--bg3); }
.cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-top, .cr-bot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cr-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-time { font-size: 12px; color: var(--muted); flex: none; } .crow.unread .cr-time { color: var(--accent); }
.cr-prev { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow.unread .cr-prev { color: var(--text); } .cr-prev.typ { color: var(--accent); font-style: italic; }
.crow .badge { background: var(--accent); color: var(--on-accent); margin-left: 0; flex: none; }
.crow .tick { display: inline-flex; color: var(--muted); } .crow .tick.seen { color: var(--accent); }
.gav.big { width: 48px; height: 48px; flex: none; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #000), color-mix(in srgb, var(--accent) 45%, #3b6cff)); }
.gav.saved { background: linear-gradient(135deg, #4aa8ff, #2c6bff); }
.topbar .gav { width: 38px; height: 38px; flex: none; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #000), color-mix(in srgb, var(--accent) 45%, #3b6cff)); }

/* Шапка чату */
.topbar { height: 58px; }
.tb-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; } .tb-info.clickable { cursor: pointer; }
.tb-info .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-info .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .sub.typing-on { color: var(--accent); }
.tb-ico { color: var(--muted); display: inline-flex; }
.pinbar { display: none; } .pinbar.show { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 16px; border-bottom: 1px solid var(--line); background: var(--bg2); flex: none; }
.pin-line { width: 3px; height: 32px; border-radius: 2px; background: var(--accent); flex: none; }
.pin-body { flex: 1; min-width: 0; cursor: pointer; } .pin-title { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.pin-text { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Повідомлення-бульбашки */
.chat { position: relative; }
.msgs { padding: 10px 0 8px; background-image: radial-gradient(circle at 15% 8%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 42%), radial-gradient(circle at 90% 85%, color-mix(in srgb, #6a7bff 7%, transparent), transparent 46%); }
.day { justify-content: center; margin: 12px 0 6px; }
.day::before, .day::after { display: none; }
.day span { background: color-mix(in srgb, var(--bg4) 85%, transparent); padding: 3px 12px; border-radius: 999px; backdrop-filter: blur(6px); }
.row { display: flex; align-items: flex-end; gap: 8px; padding: 1px 16px; margin-top: 2px; position: relative; }
.row.first { margin-top: 10px; } .row.mine { justify-content: flex-end; }
.avcol { width: 34px; flex: none; align-self: flex-end; } .avcol .av { display: block; }
.bubble { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 8px; max-width: min(560px, 78%); min-width: 0; padding: 6px 10px 5px; background: var(--other); border-radius: 18px; box-shadow: 0 1px 1px rgba(0, 0, 0, .12); overflow-wrap: anywhere; }
.row.mine .bubble { background: var(--mine); }
.row:not(.mine) .bubble.last { border-bottom-left-radius: 5px; } .row.mine .bubble.last { border-bottom-right-radius: 5px; }
.bubble > .bname, .bubble > .fwd, .bubble > .quote, .bubble > .att-media, .bubble > .att-file, .bubble > .vp, .bubble > .reacts { flex: 0 0 100%; min-width: 0; }
.bubble > .text { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.bubble.voice { min-width: 250px; }
.bname { text-align: left; font-weight: 700; font-size: 14px; margin-bottom: 1px; } .bname:hover { text-decoration: underline; }
.fwd { font-size: 13px; color: var(--accent); display: flex; align-items: center; gap: 5px; margin-bottom: 2px; } .fwd b { font-weight: 700; }
.quote { border-left: 3px solid var(--qc, var(--accent)); background: color-mix(in srgb, var(--qc, var(--accent)) 14%, transparent); border-radius: 4px 8px 8px 4px; padding: 3px 8px; margin: 2px 0 4px; cursor: pointer; }
.q-name { font-size: 13px; font-weight: 700; color: var(--qc, var(--accent)); } .q-text { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bfoot { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding-top: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; user-select: none; }
.tick { display: inline-flex; color: var(--muted); } .tick.seen { color: var(--accent); }
.bubble.media-only { padding: 3px; } .bfoot.over { position: absolute; right: 10px; bottom: 8px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 10px; padding: 1px 7px; }
.bfoot.over .tick { color: #fff; }
.att-media { display: block; border-radius: 14px; overflow: hidden; cursor: zoom-in; margin: 0 0 4px; }
.bubble.media-only .att-media { margin: 0; }
.att-img { display: block; max-width: 100%; width: auto; max-height: 340px; min-width: 150px; min-height: 90px; object-fit: cover; background: var(--bg4); margin: 0 auto; }
.att-img.loading { animation: shimmer 1.2s infinite alternate; height: 150px; width: 220px; } .att-img.broken { height: 90px; width: 150px; opacity: .4; }
@keyframes shimmer { from { opacity: .45; } to { opacity: .9; } }
.att-file { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; margin: 2px 0 4px; border-radius: 12px; background: color-mix(in srgb, var(--text) 6%, transparent); text-align: left; min-width: 220px; }
.att-file:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.af-ico { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.af-info { display: flex; flex-direction: column; min-width: 0; flex: 1; } .af-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .af-size { font-size: 12px; color: var(--muted); }
.vp { display: flex; align-items: center; gap: 10px; padding: 2px 0 2px; }
.vp-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.vp-btn:disabled { opacity: .6; }
.vp-bar { flex: 1; min-width: 110px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 22%, transparent); cursor: pointer; position: relative; overflow: hidden; }
.vp-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.vp-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.rx { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); border: 1px solid transparent; font-size: 14px; }
.rx:hover { background: color-mix(in srgb, var(--text) 16%, transparent); } .rx.mine { background: color-mix(in srgb, var(--accent) 28%, transparent); border-color: var(--accent); }
.rn { font-size: 12.5px; font-weight: 700; }
.btools { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; align-self: center; }
.row:hover .btools { opacity: 1; } .row.mine .btools { order: -1; }
.bdots { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--muted); background: var(--bg3); } .bdots:hover { color: var(--text); background: var(--bg4); }
.row.flash .bubble { animation: flash 1.6s ease-out; } @keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 1px 1px rgba(0, 0, 0, .12); } }
.bubble .text { white-space: pre-wrap; } .bubble .edit-ta { min-width: 260px; }
.chanview.dropping { outline: 2px dashed var(--accent); outline-offset: -10px; }

/* Меню, реакції, емодзі */
.menu.ctx { min-width: 210px; padding: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; } .menu-item .ico { opacity: .75; }
.react-row { display: flex; gap: 0; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); justify-content: space-between; }
.rq { width: 34px; height: 34px; border-radius: 10px; font-size: 21px; display: inline-flex; align-items: center; justify-content: center; } .rq:hover { background: var(--bg4); transform: scale(1.12); }
.rq.more { color: var(--muted); font-size: 16px; }
.emoji-pop { position: fixed; z-index: 70; width: 332px; max-width: calc(100vw - 16px); background: var(--bg3); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; animation: pop .1s; }
.emoji-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.etab { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; } .etab.active { background: var(--accent); color: var(--on-accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 220px; overflow-y: auto; }
.emo { font-size: 22px; height: 36px; border-radius: 8px; } .emo:hover { background: var(--bg4); }

/* Композер */
.composer-wrap { flex: none; margin: 0 14px 12px; }
.composer { margin: 0; display: flex; align-items: flex-end; gap: 2px; background: var(--bg3); border-radius: 24px; padding: 4px 6px; }
.composer-wrap .cbar:not(:empty) + .composer { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.composer .input { background: transparent; border: 0; box-shadow: none; padding: 10px 6px; max-height: 180px; }
.composer .icon-btn { margin: 0 0 2px; width: 40px; height: 40px; border-radius: 50%; }
.composer .act { color: var(--muted); } .composer .act.ready { background: var(--accent); color: var(--on-accent); }
.composer .danger-ico:hover { background: var(--danger); color: #fff; }
.cbar { display: flex; flex-direction: column; gap: 0; }
.rbar, .sbar { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; background: var(--bg3); border-radius: 14px 14px 0 0; border-bottom: 1px solid var(--line); color: var(--accent); }
.rbar + .composer, .cbar:not(:empty) .rbar:last-child { border-radius: 14px 14px 0 0; }
.rb-body, .sb-body { flex: 1; min-width: 0; color: var(--text); } .rb-name { font-size: 13px; font-weight: 700; color: var(--accent); }
.rb-text, .sb-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); } .sb-name { color: var(--text); }
.sb-size { font-size: 12px; color: var(--muted); } .sb-prog { height: 3px; border-radius: 2px; background: var(--bg4); margin-top: 3px; overflow: hidden; } .sb-prog > div { height: 100%; background: var(--accent); transition: width .15s; }
.rec-info { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 6px; min-height: 44px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; } .rec-hint { color: var(--muted); font-size: 14px; }

/* Пошук, результати, фото */
.res-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: 56vh; overflow-y: auto; }
.res { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-align: left; width: 100%; } .res:hover { background: var(--bg3); }
.res-body { min-width: 0; flex: 1; } .res-top { display: flex; align-items: baseline; gap: 8px; } .res-name { font-weight: 700; } .res-where { color: var(--accent); font-size: 12.5px; } .res-time { margin-left: auto; font-size: 12px; color: var(--muted); }
.res-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; animation: fade .12s; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 86vh; border-radius: 6px; object-fit: contain; }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 4px; padding: 10px 14px; color: #fff; background: linear-gradient(rgba(0, 0, 0, .6), transparent); cursor: default; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lb-bar .icon-btn { color: #fff; }

/* Мобільна версія: екран зі списком чатів, як у Telegram */
@media (max-width: 899px) {
  .app.list-page .scrim { display: none !important; }
  .app.list-page .side, .app.nav-open .side { width: min(340px, calc(100vw - 72px)); }
  .app.list-page .side { width: calc(100vw - 72px); }
  .composer-wrap { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer { padding: 3px 4px; }
  .bubble { max-width: 86%; } .row { padding: 1px 8px; }
  .row.mine .bubble { max-width: 88%; }
  .bubble.voice { min-width: 220px; } .vp-bar { min-width: 80px; }
  .btools { display: none; }
  .tb-info .title { max-width: 46vw; }
}
@media (hover: none) { .btools { display: none; } }


/* ── Адміністрування ── */
.admin h3:first-child { margin-top: 0; }
.atiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.atile { background: var(--bg3); border-radius: 14px; padding: 12px 14px; }
.at-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; } .at-lab { font-size: 13px; color: var(--muted); } .at-sub { font-size: 12px; color: var(--accent); margin-top: 2px; }
.warnbox { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--text); padding: 10px 12px; border-radius: 10px; margin-top: 12px; }
.keys { margin-top: 12px; }
.kform { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; } .kform .input { flex: 1; min-width: 150px; }
.kuses { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); } .kuses .input { width: 84px; flex: none; min-width: 0; }
.klist { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.krow { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; background: var(--bg3); border-radius: 10px; }
.krow code { font-family: var(--mono); font-weight: 700; letter-spacing: .03em; } .k-note { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .k-use { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ulist { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 360px; overflow-y: auto; }
.urow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--bg3); } .urow.banned { opacity: .7; }
.ua { width: 38px; height: 38px; border-radius: 50%; color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ui { flex: 1; min-width: 0; } .un { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .un .hint { font-weight: 400; }
.um { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uact { display: flex; gap: 6px; flex: none; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.tag.on { color: #3ddc6f; border-color: #3ddc6f; } .tag.bad { color: var(--danger); border-color: var(--danger); } .tag.warn { color: var(--warn); border-color: var(--warn); } .tag.adm { margin-left: 8px; }
@media (max-width: 899px) { .urow { flex-wrap: wrap; } .uact { width: 100%; justify-content: flex-end; } }
