/* AlphaCall — web client styles. Dark by default, light when the OS asks for it. */
:root {
  --bg: #0b0f15; --bg2: #11161f; --panel: #151b26; --panel2: #1b2230; --line: #232c3b; --line2: #2e394b;
  --text: #e6ebf2; --muted: #8b97a8; --faint: #5d6877;
  --accent: #3b82f6; --accent2: #6366f1; --ok: #22c55e; --warn: #f59e0b; --err: #ef4444; --busy: #f97316;
  --bubble-me: linear-gradient(135deg, #2563eb, #4f46e5); --bubble-them: #1e2633;
  --radius: 14px; --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f5f9; --bg2: #ffffff; --panel: #ffffff; --panel2: #f1f4f8; --line: #e3e8ef; --line2: #d3dae4; --text: #111827; --muted: #5b6676; --faint: #9aa4b2;
    --bubble-them: #eef1f6; --shadow: 0 10px 40px rgba(15, 23, 42, .14); color-scheme: light; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.ic { flex-shrink: 0; display: block; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; margin-left: auto; margin-right: auto; display: block; }
.err-t { color: var(--err) !important; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
[hidden] { display: none !important; }

/* ---------- brand ---------- */
.logo-mark { width: 44px; height: 44px; border-radius: 13px; background: conic-gradient(from 210deg, #22d3ee, #3b82f6, #8b5cf6, #22d3ee); position: relative; box-shadow: 0 6px 20px rgba(59, 130, 246, .35); }
.logo-mark::after { content: ""; position: absolute; inset: 11px; border-radius: 50%; border: 3px solid #fff; border-right-color: transparent; transform: rotate(-30deg); }
.logo-mark.sm { width: 36px; height: 36px; border-radius: 11px; } .logo-mark.sm::after { inset: 9px; border-width: 2.5px; }
.boot { height: 100vh; display: grid; place-items: center; } .boot .logo-mark { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }

/* ---------- buttons & inputs ---------- */
.btn { height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; text-decoration: none; color: var(--text); transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(1.12); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.btn.danger { background: var(--err); border-color: transparent; color: #fff; } .btn.ghost { background: transparent; } .btn.ghost.danger { color: var(--err); background: transparent; border-color: var(--line2); }
.btn.big { height: 46px; padding: 0 22px; font-size: 15px; } .btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.ib { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); flex-shrink: 0; }
.ib:hover { background: var(--panel2); color: var(--text); } .ib.xs { width: 26px; height: 26px; border-radius: 7px; } .ib.send { color: var(--accent); }
input:not([type=checkbox]), select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 12px; } label > input, label > select { margin-top: 5px; color: var(--text); font-weight: 400; font-size: 14px; }
.tag { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line2); vertical-align: middle; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; } .row-btns.center { justify-content: center; }

/* ---------- avatars & presence ---------- */
.av { border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; overflow: hidden; background: var(--panel2); letter-spacing: .02em; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avp { position: relative; display: inline-block; flex-shrink: 0; line-height: 0; }
.dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--panel); background: var(--faint); }
.dot.online { background: var(--ok); } .dot.busy { background: var(--busy); } .dot.dnd { background: var(--err); } .dot.in-call { background: var(--accent); } .dot.offline { background: var(--faint); }
.dot.dnd::after { content: ""; position: absolute; left: 2px; right: 2px; top: 3px; height: 2px; background: #fff; border-radius: 1px; }

/* ---------- auth / guest ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; overflow: auto; height: 100vh;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(59, 130, 246, .18), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(139, 92, 246, .16), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; } .auth-card.center label { width: 100%; text-align: left; margin-top: 14px; }
.auth-card h3 { margin: 12px 0 2px; font-size: 20px; }
.brand { display: flex; gap: 13px; align-items: center; margin-bottom: 22px; } .brand b { display: block; font-size: 19px; } .brand span { color: var(--muted); font-size: 12.5px; }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; margin-bottom: 18px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.auth .err { color: var(--err); min-height: 18px; font-size: 13px; margin-bottom: 8px; } .auth .btn.big { width: 100%; }
.auth-foot { margin-top: 16px; display: flex; gap: 6px; align-items: center; text-align: center; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 76px 340px 1fr; height: 100vh; height: 100dvh; }
.rail { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; }
.rail .logo-mark { margin-bottom: 12px; }
.rt { width: 62px; padding: 8px 0 6px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; position: relative; }
.rt:hover { background: var(--panel2); color: var(--text); } .rt.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.rt .badge-n { position: absolute; top: 3px; right: 9px; }
.badge-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font: 700 10.5px/18px var(--font); text-align: center; font-style: normal; }
.grow { flex: 1; }
.netpill { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-bottom: 8px; } .netpill.up { background: var(--ok); } .netpill.reconnecting, .netpill.connecting { background: var(--warn); animation: pulse 1s infinite; } .netpill.down { background: var(--err); }
.me-btn { border: 0; background: transparent; cursor: pointer; padding: 0; border-radius: 50%; }
.me-btn .dot { border-color: var(--bg2); }
.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; } .list-head h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.searchbox { margin: 0 14px 10px; position: relative; } .searchbox .ic { position: absolute; left: 11px; top: 11px; color: var(--faint); } .searchbox input { padding-left: 34px; height: 38px; }
.rows { overflow-y: auto; flex: 1 1 auto; min-height: 0; } #srows { flex: 0 0 auto; max-height: 45%; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; border-radius: 12px; margin: 1px 6px; }
.row:hover { background: var(--panel2); } .row.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.row-main { flex: 1; min-width: 0; } .row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; } .row-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; } .ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav { color: #fbbf24; } .typing { color: var(--accent); }
.hint { color: var(--muted); padding: 16px 20px; font-size: 13px; }
.sub-h { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); padding: 10px 20px 4px; }
.chips { display: flex; gap: 6px; padding: 0 14px 10px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: transparent; border-radius: 99px; padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cdir { display: inline-flex; color: var(--ok); vertical-align: -2px; } .cdir.missed { color: var(--err); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: -2px; } .bars i { width: 3px; border-radius: 1px; background: currentColor; opacity: .25; }
.bars.b1 i:nth-child(-n+1), .bars.b2 i:nth-child(-n+2), .bars.b3 i:nth-child(-n+3), .bars.b4 i { opacity: 1; }
.bars.b1 { color: var(--err); } .bars.b2 { color: var(--warn); } .bars.b3, .bars.b4 { color: var(--ok); }
.pane { min-width: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 380px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .ic { color: var(--faint); } .empty b { color: var(--text); font-size: 17px; } .empty p { margin: 0; }

/* ---------- conversation ---------- */
.conv, .call-detail, .settings { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.conv.drop::after { content: "Drop to send"; position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 16px; display: grid; place-items: center; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--bg) 80%, transparent); z-index: 5; }
.conv-head { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 64px; }
.conv-head .back { display: none; } .ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .ch-main span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 3px; }
.day { text-align: center; margin: 12px 0 8px; } .day span { background: var(--panel2); color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.msg { display: flex; align-items: center; gap: 4px; max-width: 78%; } .msg.me { align-self: flex-end; flex-direction: row-reverse; } .msg.them { align-self: flex-start; }
.bub { padding: 8px 12px 6px; border-radius: 16px; background: var(--bubble-them); word-wrap: break-word; overflow-wrap: anywhere; position: relative; min-width: 60px; }
.msg.me .bub { background: var(--bubble-me); color: #fff; border-bottom-right-radius: 5px; } .msg.them .bub { border-bottom-left-radius: 5px; }
.msg.me .bub a { color: #dbeafe; } .msg.pending { opacity: .7; } .msg.failed .bub { outline: 2px solid var(--err); }
.meta { display: inline-flex; align-items: center; gap: 3px; float: right; margin: 6px 0 -2px 10px; font-size: 10.5px; opacity: .7; }
.tk { display: inline-flex; } .tk.read { color: #7dd3fc; opacity: 1; } .msg.them .tk.read { color: var(--accent); }
.msg-act { display: none; gap: 2px; } .msg:hover .msg-act { display: flex; }
.bub .img img { max-width: min(320px, 60vw); max-height: 320px; border-radius: 10px; display: block; margin-bottom: 2px; }
.bub .file { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 4px 0; } .bub .file small { display: block; opacity: .75; }
.file-up .prog { height: 4px; background: rgba(255, 255, 255, .25); border-radius: 2px; margin-top: 6px; overflow: hidden; } .file-up .prog i { display: block; height: 100%; width: 0; background: #fff; transition: width .2s; }
.typing-line { height: 18px; padding: 0 20px; color: var(--accent); font-size: 12px; font-style: italic; }
.composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea { resize: none; border-radius: 20px; padding: 9px 14px; min-height: 38px; max-height: 140px; line-height: 1.4; }
.more-msgs { margin-bottom: 8px; }

/* ---------- popovers ---------- */
.menu-pop, .emoji-pop { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); padding: 5px; min-width: 220px; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.menu-pop button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 11px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu-pop button span { flex: 1; } .menu-pop button:hover { background: var(--panel2); } .menu-pop button.danger { color: var(--err); } .menu-pop button.on { color: var(--accent); }
.menu-pop .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.emoji-pop { width: 320px; padding: 0; overflow: hidden; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 4px; gap: 2px; } .emoji-tabs button { flex: 1; border: 0; background: transparent; font-size: 17px; padding: 5px 0; border-radius: 7px; cursor: pointer; } .emoji-tabs button.on { background: var(--panel2); }
.emoji-grid { height: 240px; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-cat { grid-column: 1 / -1; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--faint); padding: 4px; }
.em { border: 0; background: transparent; font-size: 22px; padding: 3px; border-radius: 7px; cursor: pointer; line-height: 1.2; } .em:hover { background: var(--panel2); }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); z-index: 900; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; width: 100%; max-width: 440px; box-shadow: var(--shadow); max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 620px; } .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px 20px; font-size: 16px; }
.modal-body { padding: 6px 20px 14px; overflow-y: auto; } .modal-body p { margin: 0 0 12px; color: var(--muted); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px 16px; }
.sres .sr { padding: 8px 0; border-bottom: 1px solid var(--line); }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 520px; }
.toast { background: #111827; color: #f9fafb; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: pop .15s; border-left: 4px solid var(--accent); text-align: left; }
.toast.err { border-left-color: var(--err); } .toast.warn { border-left-color: var(--warn); } .toast.out { opacity: 0; transition: opacity .3s; }

/* ---------- cards / settings ---------- */
.set-body, .cd-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; max-width: 760px; width: 100%; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; } .card-h { font-weight: 700; margin-bottom: 10px; font-size: 15px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; } .kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); } .kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.tg { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; margin: 0; }
.tg b { color: var(--text); font-size: 14px; display: block; } .tg small { color: var(--muted); font-weight: 400; display: block; font-size: 12.5px; margin-top: 2px; }
.tg input { position: absolute; opacity: 0; pointer-events: none; }
.tg i { width: 42px; height: 24px; border-radius: 12px; background: var(--line2); position: relative; flex-shrink: 0; transition: background .2s; }
.tg i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.tg input:checked + i { background: var(--accent); } .tg input:checked + i::after { left: 21px; }
.me-card { display: flex; gap: 12px; align-items: center; margin: 0 14px 10px; padding: 12px; background: var(--panel2); border-radius: 14px; } .me-card b { display: block; }
.row.set { padding: 12px 14px; } .set-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; color: var(--accent); }
.prof { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; } .prof-act { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.linkbox { display: flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 4px 4px 4px 12px; } .linkbox code { flex: 1; overflow-wrap: anywhere; }
.sess { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); } .sess > div { flex: 1; } .sess small { display: block; }
.danger-card { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.dev-preview { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; margin-bottom: 14px; }
.dev-preview video { width: 100%; height: 100%; object-fit: cover; } .mirror { transform: scaleX(-1); }
.meter { position: absolute; left: 10px; right: 10px; bottom: 8px; height: 4px; background: rgba(255, 255, 255, .2); border-radius: 2px; overflow: hidden; } .meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .1s; }
.verdict { padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-weight: 600; } .verdict.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.verdict.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); } .verdict.err { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.cands { font-size: 11.5px; overflow-x: auto; background: var(--bg2); padding: 10px; border-radius: 8px; }
.cd-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; } .cd-hero h3 { margin: 10px 0 0; font-size: 20px; }
.cd-act { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.dialbox { display: flex; gap: 4px; margin: 0 14px 12px; } .dialbox input { height: 40px; }

/* ---------- incoming ---------- */
#incoming-stack { position: fixed; top: 16px; right: 16px; z-index: 1500; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100% - 32px)); }
.incoming { background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: flex; gap: 13px; align-items: center; animation: slidein .25s ease-out; flex-wrap: wrap; }
@keyframes slidein { from { transform: translateY(-14px); opacity: 0; } }
.in-main { flex: 1; min-width: 140px; } .in-main b { display: block; font-size: 16px; } .in-main span { color: var(--muted); font-size: 13px; }
.in-act { display: flex; gap: 8px; }
.rb { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff; transition: transform .15s; } .rb:hover { transform: scale(1.07); }
.rb.accept { background: var(--ok); } .rb.decline { background: var(--err); } .rb.msg { background: var(--panel2); color: var(--text); width: 40px; height: 40px; align-self: center; }
.pulse { position: relative; border-radius: 50%; } .pulse::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); animation: ring 1.6s infinite; }
@keyframes ring { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }

/* ---------- the call stage ---------- */
.stage { position: fixed; inset: 0; z-index: 800; background: #05070b; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; color: #fff; }
.stage-main { position: relative; overflow: hidden; grid-column: 1; grid-row: 1; }
.stage .remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .3s; }
.stage.has-video .remote { opacity: 1; } .stage.peer-sharing .remote { object-fit: contain; }
.remote-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(800px 500px at 50% 30%, rgba(59, 130, 246, .22), transparent 70%), #05070b; }
.stage.has-video .remote-ph { display: none; } .stage:not(.ringing) .remote-ph .pulse::before { display: none; }
.ph-name { font-size: 26px; font-weight: 700; } .ph-sub { color: #9ca3af; display: flex; gap: 6px; align-items: center; min-height: 20px; }
.stage-top { position: absolute; left: 0; right: 0; top: 0; padding: 18px 20px 40px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); z-index: 2; }
.who b { display: block; font-size: 17px; } .who .st { color: #cbd5e1; font-size: 13px; font-variant-numeric: tabular-nums; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; gap: 5px; align-items: center; padding: 4px 9px; border-radius: 99px; background: rgba(0, 0, 0, .45); font-size: 12px; font-weight: 600; backdrop-filter: blur(6px); white-space: nowrap; }
.badge.e2e { color: #86efac; cursor: pointer; font-variant-numeric: tabular-nums; } .badge.rec { color: #fca5a5; animation: pulse 1.2s infinite; } .badge.q { color: #e5e7eb; } .badge.q:empty { display: none; }
.k-note { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .7); padding: 7px 14px; border-radius: 99px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 3; white-space: nowrap; }
.k-note.on { opacity: 1; }
.captions { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(760px, 90%); background: rgba(0, 0, 0, .75); padding: 8px 16px; border-radius: 10px; font-size: 17px; opacity: 0; transition: opacity .3s; text-align: center; z-index: 3; }
.captions.on { opacity: 1; }
.local-wrap { position: absolute; right: 18px; bottom: 18px; width: 220px; aspect-ratio: 16/10; border-radius: 14px; overflow: hidden; background: #111; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); cursor: grab; z-index: 4; touch-action: none; border: 1px solid rgba(255, 255, 255, .12); }
.local-wrap video { width: 100%; height: 100%; object-fit: cover; } .local-off { position: absolute; inset: 0; display: none; place-items: center; color: #9ca3af; background: #111827; }
.local-wrap.off .local-off { display: grid; } .local-wrap.off video { visibility: hidden; } .local-wrap .meter { bottom: 6px; height: 3px; }
.stage-bar { grid-column: 1 / -1; grid-row: 2; display: flex; justify-content: center; gap: 12px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: #0b0f15; flex-wrap: wrap; }
.cb { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #1f2937; color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .1s; position: relative; }
.cb:hover { background: #374151; } .cb:active { transform: scale(.95); } .cb.off { background: #f3f4f6; color: #111827; } .cb.active { background: var(--accent); }
.cb.end { background: var(--err); width: 64px; border-radius: 26px; } .cb.end:hover { background: #dc2626; } .cb.on-hand { background: #f59e0b; }
.cb small { position: absolute; top: -4px; right: -4px; background: var(--err); border-radius: 9px; min-width: 18px; height: 18px; font-size: 10.5px; line-height: 18px; font-weight: 700; }
.stage-side { grid-column: 2; grid-row: 1; width: 340px; background: var(--panel); color: var(--text); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.side-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; min-height: 0; }
#k-chatbox { padding: 0; } #k-chatbox .msgs { padding: 12px; } #k-chatbox .msg { max-width: 92%; }
.stage.ending { opacity: .6; transition: opacity .6s; }
body.in-call #incoming-stack { z-index: 1600; }

/* ---------- group rooms ---------- */
.room-grid { position: absolute; inset: 0; padding: 70px 14px 14px; display: grid; gap: 10px; grid-auto-rows: 1fr; }
.tile { position: relative; background: #111827; border-radius: 14px; overflow: hidden; min-height: 0; border: 2px solid transparent; transition: border-color .2s; }
.tile.talking { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34, 197, 94, .35); }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; } .tile.screen video { object-fit: contain; }
.tile .t-ph { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(400px 260px at 50% 40%, rgba(99, 102, 241, .25), transparent 70%), #0f172a; }
.tile.has-video .t-ph { display: none; }
.tile .t-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; display: flex; gap: 5px; align-items: center; max-width: calc(100% - 16px); }
.tile .t-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-hand { position: absolute; top: 8px; left: 8px; font-size: 22px; } .tile .t-react { position: absolute; top: 8px; right: 10px; font-size: 34px; animation: floatup 2.5s ease-out forwards; }
@keyframes floatup { from { transform: translateY(20px) scale(.6); opacity: 0; } 15% { transform: none; opacity: 1; } to { transform: translateY(-40px); opacity: 0; } }
.tile .t-menu { position: absolute; top: 6px; right: 6px; opacity: 0; } .tile:hover .t-menu { opacity: 1; } .tile .t-menu .ib { background: rgba(0, 0, 0, .5); color: #fff; }
.room-grid.speaker { grid-template-columns: 1fr !important; grid-template-rows: 1fr 120px; }
.room-grid.speaker .strip { display: flex; gap: 8px; overflow-x: auto; } .room-grid.speaker .strip .tile { width: 180px; flex-shrink: 0; }
.lobby-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--panel); color: var(--text); padding: 26px; border-radius: 18px; width: min(420px, 92%); text-align: center; box-shadow: var(--shadow); }
.knock { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); } .knock > span { flex: 1; }
.people-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); } .people-row > div { flex: 1; min-width: 0; } .people-row small { display: block; color: var(--muted); }
.reactbar { display: flex; gap: 4px; padding: 6px; } .reactbar button { border: 0; background: transparent; font-size: 24px; cursor: pointer; border-radius: 8px; padding: 2px 4px; } .reactbar button:hover { background: var(--panel2); }
.room-card { display: flex; gap: 12px; align-items: center; }

/* ---------- phone ---------- */
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 10px auto; }
.dialpad button { height: 62px; border-radius: 50%; aspect-ratio: 1; margin: auto; border: 1px solid var(--line2); background: var(--panel2); font-size: 24px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.dialpad button small { font-size: 9.5px; letter-spacing: .14em; color: var(--muted); margin-top: 3px; font-weight: 700; } .dialpad button:active { background: var(--accent); color: #fff; }
.dial-num { font-size: 28px; text-align: center; letter-spacing: .04em; border: 0; background: transparent; padding: 6px; font-variant-numeric: tabular-nums; }
.sip-st { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 12px; margin: 0 14px 10px; background: var(--panel2); border-radius: 10px; }
.sip-st i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); } .sip-st.on i { background: var(--ok); } .sip-st.err i { background: var(--err); } .sip-st.wait i { background: var(--warn); }
.vm-row audio { width: 100%; height: 34px; margin-top: 6px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 64px 1fr; }
  .pane { position: fixed; inset: 0 0 0 64px; z-index: 50; transform: translateX(100%); transition: transform .22s ease; }
  .shell.pane-open .pane { transform: none; }
  .conv-head .back { display: inline-grid; }
  .rt { width: 54px; } .rt span { display: none; }
  .stage-side { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 100%); z-index: 6; }
}
@media (max-width: 560px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); gap: 0; }
  .rail .logo-mark, .rail .grow, .netpill { display: none; } .rt { width: auto; flex: 1; padding: 7px 0; } .rt span { display: block; font-size: 10px; }
  .me-btn { padding: 0 8px; } .list { grid-row: 1; border-right: 0; }
  .pane { inset: 0; }
  .local-wrap { width: 120px; right: 10px; bottom: 10px; }
  .cb { width: 46px; height: 46px; } .cb.end { width: 56px; } .stage-bar { gap: 8px; }
  .msg { max-width: 88%; } .stage-top { padding: 12px 14px 30px; }
  .room-grid { padding: 64px 6px 6px; gap: 6px; }
  #incoming-stack { right: 16px; left: 16px; width: auto; }
}
