:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  --bar: #19161c;
  --rail: #161419;
  --sidebar: #201c24;
  --main: #26212a;
  --right: #211d25;
  --raised: #342d39;
  --field: #1d1920;
  --line: #3f3644;
  --text: #f5eef4;
  --muted: #c9b9c9;
  --accent: #ffbd86;
  --accent-bright: #ffd1a9;
  --accent-ink: #35201a;
  --accent-bg: #49343c;
  --accent-line: #856254;
  --danger: #ffb5bd;
  --live: #a4dfb8;
  --radius: .55rem;
  --gutter: clamp(.85rem, 1.7vw, 1.4rem);
  color: var(--text);
  background: var(--bar);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bar);
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1 { font-size: 1.35rem; line-height: 1.2; }
h2 { font-size: .98rem; line-height: 1.3; }
h3 { font-size: .88rem; line-height: 1.35; }
p, label, small { line-height: 1.45; }
small, .muted { color: var(--muted); }
small { font-size: .79rem; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:not([type="checkbox"]), textarea, select {
  width: 100%; min-width: 0; color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .75rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
a { color: inherit; }
.icon { display: block; flex: none; width: 1.15rem; height: 1.15rem; }

.topbar {
  z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: .9rem; min-height: 3.625rem; padding: .45rem var(--gutter);
  border-bottom: 1px solid var(--line); background: var(--bar);
}
.breadcrumb { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1; color: var(--muted); font-size: .8rem; }
.breadcrumb strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.brand { display: inline-flex; flex: none; align-items: center; gap: .65rem; font-size: 1.18rem; font-weight: 770; letter-spacing: -.025em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; border-radius: .7rem; background: var(--accent); color: var(--accent-ink); }
.brand-mark svg { width: 76%; height: 76%; }
.account { display: flex; align-items: center; gap: .55rem; min-width: 0; font-size: .87rem; }
#account-name { max-inline-size: 18ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#logout { flex: none; }
.avatar, .section-icon { display: inline-grid; place-items: center; flex: none; border-radius: .65rem; font-weight: 750; color: var(--accent); background: var(--accent-bg); }
.avatar { width: 1.85rem; height: 1.85rem; font-size: .8rem; }
.section-icon { width: 2.5rem; height: 2.5rem; font-size: 1.35rem; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.65rem;
  padding: .5rem .82rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--raised); color: var(--text); font-size: .88rem; font-weight: 650; line-height: 1.25;
}
.button:hover:not(:disabled) { border-color: var(--muted); }
.button.primary { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.button.primary:hover:not(:disabled) { border-color: transparent; background: var(--accent-bright); }
.button.quiet { background: transparent; }
.button.danger { color: var(--danger); }
.text-button { border: 0; background: none; padding: .2rem .15rem; color: var(--accent); text-decoration: underline; }
.eyebrow { color: var(--accent); font-weight: 750; font-size: .75rem; letter-spacing: .13em; text-transform: uppercase; }
.stack { display: grid; gap: .42rem; }
.stack label { font-weight: 650; font-size: .87rem; }
.stack .button { margin-top: .3rem; }
.notice { font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.notice[data-kind="error"] { color: var(--danger); }
.notice[data-kind="success"] { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.auth-view { display: flex; overflow: auto; padding: clamp(1rem, 4vw, 3rem); background: var(--main); }
.auth-layout { display: grid; grid-template-columns: 1.1fr 1fr; width: min(100%, 58rem); margin: auto; border: 1px solid var(--line); border-radius: 1.2rem; overflow: hidden; background: var(--sidebar); }
.auth-intro { display: flex; flex-direction: column; justify-content: center; gap: .85rem; min-width: 0; padding: clamp(1.4rem, 4vw, 3rem); background: #39263c; border-inline-end: 1px solid var(--line); }
.auth-signal { display: block; width: 100%; max-width: 29rem; margin-bottom: .5rem; }
.signal-guide { stroke: #947086; stroke-dasharray: 1 8; opacity: .65; }
.signal-shadow { stroke: #d594b6; stroke-width: 1.5; opacity: .6; }
.signal-main { stroke: var(--accent); stroke-width: 3; }
.signal-point { fill: var(--accent); stroke: #39263c; stroke-width: 2; }
.auth-tagline { font-size: clamp(2rem, 4.6vw, 4rem); line-height: 1.02; letter-spacing: -.045em; font-weight: 760; }
.auth-intro .muted { max-width: 33ch; }
.auth-card { align-self: center; min-width: 0; padding: clamp(1.4rem, 4vw, 3rem); }
.auth-card h1 { font-size: clamp(1.45rem, 4vw, 2rem); }
.auth-card form { margin: 1.2rem 0 .8rem; }
.auth-card label:not(:first-child), #invite-field { margin-top: .45rem; }
.auth-switch { margin-top: .75rem; color: var(--muted); font-size: .9rem; }

.workspace {
  --rail-width: 4.5rem;
  --sidebar-width: 15.4375rem;
  --people-width: 17.875rem;
  display: grid; min-width: 0; min-height: 0;
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr) var(--people-width);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "rail sidebar chat voice" "rail dock chat voice";
  background: var(--main);
}
.workspace[data-sharing="true"] {
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr) auto;
  grid-template-areas: "rail sidebar stage voice" "rail sidebar chat voice" "rail dock chat voice";
}
.panel { min-width: 0; min-height: 0; }
.panel-header { display: flex; min-height: 3.625rem; align-items: center; gap: .68rem; padding: .55rem var(--gutter); border-bottom: 1px solid var(--line); }
.panel-header .muted { font-size: .77rem; }
.mobile-nav { display: none; }
.space-rail, .friends-panel, .voice-panel, .message-area { overflow: auto; overscroll-behavior: contain; }
.space-rail { grid-area: rail; min-height: 0; padding: .75rem 0; border-inline-end: 1px solid var(--line); background: var(--rail); scrollbar-width: thin; }
.spaces-list { display: grid; justify-items: center; gap: .55rem; list-style: none; padding: .25rem 0; }
.spaces-list li { list-style: none; }
.spaces-list .space-button, .rail-add, .rail-friends {
  position: relative; display: grid; place-items: center; width: 2.65rem; min-height: 2.65rem;
  padding: 0; border-radius: .85rem; border: 1px solid var(--line); background: var(--sidebar); color: var(--muted);
}
.space-monogram { font-weight: 730; }
[data-space=""] .space-monogram { font-size: 1.3rem; }
.spaces-list .space-button:hover, .rail-add:hover, .rail-friends:hover { color: var(--accent); background: var(--raised); }
.rail-friends { margin: .25rem auto 0; }
.workspace[data-section="friends"] .rail-friends { color: var(--accent); background: var(--accent-bg); border-color: var(--accent-line); }
.rail-rule { height: 1px; width: 1.5rem; margin: .6rem auto .35rem; background: var(--line); }
.spaces-list .space-button[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.space-button[aria-current="true"]::before { content: ''; position: absolute; inset-inline-start: -.65rem; width: .22rem; height: 1.6rem; border-radius: .3rem; background: var(--accent); }
:is(.space-button, .rail-friends) .count-badge { position: absolute; inset: auto -.32rem -.25rem auto; box-shadow: 0 0 0 2px var(--rail); }
.rail-add { margin: .65rem auto 0; border-style: dashed; color: var(--accent); background: transparent; }
.friends-panel, .voice-panel { scroll-padding-block-start: 4rem; }
.friends-panel { grid-area: sidebar; border-inline-end: 1px solid var(--line); background: var(--sidebar); }
.sidebar-header, .voice-header { position: sticky; top: 0; z-index: 1; }
.sidebar-header h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .94rem; }
.sidebar-body { padding: .7rem .8rem 1.1rem; }
.workspace[data-view="friends"] #channels-section,
.workspace:not([data-view="friends"]) #dm-sidebar-section { display: none; }
.dm-sidebar-section { display: grid; gap: .55rem; }
.dm-sidebar-section h2 { margin-top: .35rem; color: var(--muted); font-size: .78rem; }
.channel-group { position: relative; }
.channel-group summary { display: flex; align-items: center; gap: .45rem; min-height: 2.15rem; padding: .2rem 2.4rem .2rem .35rem; color: var(--muted); font-size: .8rem; font-weight: 650; cursor: pointer; list-style: none; }
.channel-group summary::-webkit-details-marker { display: none; }
.channel-group summary::before { content: ''; inline-size: .42rem; block-size: .42rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.channel-group details[open] summary::before { transform: rotate(45deg); }
.group-add { position: absolute; inset: .1rem .12rem auto auto; width: 1.95rem; min-height: 1.95rem; padding: 0; border-color: transparent; background: transparent; color: var(--muted); font-size: 1.15rem; }
.group-add:hover:not(:disabled) { color: var(--accent); background: var(--raised); border-color: transparent; }
.channel-speaker { height: 1.1rem; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4V5Zm4 4a4 4 0 0 1 0 6m2.7-8.7a8 8 0 0 1 0 11.4'/%3E%3C/svg%3E") center / contain no-repeat; }
.voice-row-count { flex: none; margin-inline-start: auto; font-size: .66rem; color: var(--live); }
.voice-members { display: grid; gap: .3rem; margin: .22rem 0 .45rem 1.15rem; padding: .15rem 0 .15rem .58rem; border-inline-start: 1px solid var(--line); list-style: none; }
.voice-members li { display: flex; align-items: center; gap: .45rem; min-width: 0; font-size: .8rem; overflow-wrap: anywhere; }
.voice-members .avatar { width: 1.3rem; height: 1.3rem; border-radius: 50%; font-size: .7rem; }
#space-controls { display: grid; gap: .5rem; }
.invite-form { display: grid; gap: .4rem; padding: .55rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .82rem; }
.invite-form > div { display: grid; gap: .35rem; }
.space-invitations:empty, .space-people:has(#space-members:empty) { display: none; }
.space-invitations:not(:empty) { padding: .5rem; border-inline-start: 2px solid var(--accent); }
.presence-dot { display: inline-block; flex: none; width: .48rem; height: .48rem; border-radius: 50%; background: #806d7e; }
.presence-dot[data-online="true"], [data-online="true"] > .presence-dot { background: var(--live); }
.space-people { padding: .85rem var(--gutter); border-top: 1px solid var(--line); }
.space-people h3 { margin-bottom: .45rem; }
.space-people li { display: flex; align-items: center; gap: .45rem; font-size: .86rem; overflow-wrap: anywhere; }
.channel {
  display: flex; width: 100%; align-items: center; gap: .45rem; min-height: 2.2rem;
  padding: .3rem .48rem; text-align: left; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--text); font-size: .87rem; overflow-wrap: anywhere;
}
.channel:hover { background: var(--raised); }
.channel[aria-current="true"] { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); font-weight: 700; }
.channel-icon { width: 1.1rem; flex: none; text-align: center; font-size: 1.1rem; color: var(--muted); }
.channel[aria-current="true"] .channel-icon { color: var(--accent); }
.rooms-section { display: grid; gap: .5rem; }
.create-dialog { width: min(26rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: .9rem; color: var(--text); background: var(--sidebar); }
.create-dialog::backdrop { background: #100d12bd; }
.create-dialog header { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.create-dialog .dialog-close { width: 2rem; min-height: 2rem; flex: none; padding: 0; font-size: 1.25rem; }
.create-dialog form { padding: 1rem; gap: .65rem; }
.create-dialog .primary { justify-self: end; }
.count-badge { display: inline-grid; place-items: center; min-width: 1.35rem; min-height: 1.25rem; padding-inline: .24rem; margin-inline-start: auto; flex: none; background: var(--accent); color: var(--accent-ink); border-radius: .45rem; font-weight: 750; font-size: .69rem; line-height: 1; }
.channel:has(.count-badge:not([hidden])) { font-weight: 720; }
.mobile-nav .count-badge { margin-inline-start: 0; }
.room-list, .people { display: grid; gap: .25rem; list-style: none; padding: 0; }
.people-empty { padding: .15rem 0; color: var(--muted); font-size: .8rem; }
.request-row { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; justify-content: space-between; padding: .15rem 0; font-size: .86rem; overflow-wrap: anywhere; }
.request-row > span { min-width: 0; }
.request-row .button { font-size: .79rem; padding: .35rem .6rem; min-height: 2.35rem; }

.chat-panel { grid-area: chat; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-header { background: var(--main); }
.chat-identity { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-identity h1 { font-size: 1.04rem; }
.chat-header .section-icon { width: 2.15rem; height: 2.15rem; }
.panel-toggle { width: 2rem; min-height: 2rem; flex: none; padding: 0; background: transparent; color: var(--muted); }
.panel-toggle[aria-expanded="true"] { background: var(--raised); color: var(--accent); }
.message-area { padding: .55rem var(--gutter); }
.message-area:focus-visible { outline-offset: -2px; }
.empty-chat { display: grid; min-height: 100%; place-items: center; padding: .75rem; text-align: center; }
.empty-chat-content { display: grid; justify-items: center; gap: .45rem; }
.empty-icon {
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin-bottom: .3rem;
  border: 1px solid var(--accent-line); border-radius: 1rem; background: var(--accent-bg); color: var(--accent);
  font-size: 1.95rem; font-weight: 750;
}
.empty-title { font-size: 1.05rem; font-weight: 700; }
.empty-chat .muted { font-size: .88rem; }
.messages { display: grid; align-content: start; gap: .25rem; padding: 0; list-style: none; }
.message { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .65rem; padding: .34rem 0; }
.message .avatar { width: 2.05rem; height: 2.05rem; border-radius: 50%; color: var(--text); background: var(--raised); }
.message.own .avatar { color: var(--accent); background: var(--accent-bg); }
.message-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem .6rem; overflow-wrap: anywhere; }
.message-meta strong { font-size: .92rem; }
.message.own .message-meta strong { color: var(--accent); }
.message-meta time { font-size: .75rem; color: var(--muted); }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .12rem; font-size: .95rem; }
.composer { display: grid; gap: .35rem; padding: .55rem var(--gutter) .7rem; background: var(--main); }
.composer form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .35rem; padding: .28rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--field); }
.composer form:focus-within { border-color: var(--accent-line); }
.composer textarea { display: block; resize: vertical; min-height: 2.35rem; max-height: min(8rem, 21dvh); padding: .46rem .55rem; border: 0; font-size: .91rem; }
.composer textarea:focus-visible { outline-offset: -2px; }
.composer .button { min-height: 2.35rem; }
.composer .send-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.composer-hint { font-size: .72rem; color: var(--muted); }

.voice-panel { grid-area: voice; border-inline-start: 1px solid var(--line); background: var(--right); }
.voice-header { overflow-wrap: anywhere; background: var(--right); }
.voice-header .section-icon { width: 2.15rem; height: 2.15rem; }
.voice-body, .screen-panel { display: grid; gap: .65rem; padding: .75rem var(--gutter); }
.voice-status { display: flex; align-items: baseline; gap: .42rem; color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.voice-status::before, .share-dot { content: ""; display: inline-block; flex: none; width: .46rem; height: .46rem; border-radius: 50%; background: currentColor; }
.voice-status[data-kind="success"] { color: var(--live); }
.voice-status[data-kind="error"] { color: var(--danger); }
.call-dock { grid-area: dock; min-width: 0; display: grid; align-items: center; gap: .45rem; padding: .7rem .8rem; border-top: 1px solid var(--line); background: var(--bar); max-block-size: 40dvh; overflow: auto; }
.call-dock .button { min-height: 2.25rem; padding: .35rem .45rem; }
.call-dock .stack .button { margin: 0; }
.dock-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.dock-info strong:empty { display: none; }
.voice-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
.call-dock .danger, #mute[data-muted="true"] { color: var(--danger); background: #4b2734; border-color: #875167; }
#mute:not([data-muted="true"]) .mute-slash { display: none; }
#screen-toggle[data-sharing="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-bg); }
.call-events { border-inline-start: 2px solid var(--accent-line); color: var(--muted); padding-inline-start: .55rem; font-size: .79rem; overflow-wrap: anywhere; }
.call-settings { border-top: 1px solid var(--line); }
.call-settings summary { cursor: pointer; padding: .78rem var(--gutter); font-size: .9rem; font-weight: 690; }
.call-settings .screen-panel { padding-top: 0; border: 0; }
.call-settings .setting-row { border-top: 0; padding-top: 0; padding-bottom: .4rem; }
.call-roster { display: grid; gap: .5rem; padding-block: .6rem; }
.call-roster h3 { display: flex; align-items: center; gap: .5rem; }
.roster-count { color: var(--live); font-variant-numeric: tabular-nums; }
.call-members { display: grid; gap: .35rem; padding: 0; list-style: none; }
.call-members:empty { display: none; }
.call-members li { display: flex; min-width: 0; align-items: center; gap: .55rem; padding: .4rem .54rem; background: var(--bar); border-radius: .5rem; overflow-wrap: anywhere; font-size: .87rem; }
.call-members li .avatar { background: var(--raised); color: var(--live); }
.call-members li::after { content: ''; margin-inline-start: auto; width: .4rem; height: .4rem; flex: none; border-radius: 50%; background: var(--live); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: .65rem; border-top: 1px solid var(--line); padding-top: .8rem; font-size: .87rem; cursor: pointer; }
.setting-row span { display: grid; gap: .22rem; }
.switch-input { appearance: none; position: relative; flex: none; margin: 0; width: 2.5rem; height: 1.42rem; padding: 0; border: 1px solid var(--muted); border-radius: 1rem; background: var(--field); cursor: pointer; }
.switch-input::after { content: ''; position: absolute; top: .19rem; left: .2rem; width: .92rem; height: .92rem; border-radius: 50%; background: var(--muted); }
.switch-input:checked { background: var(--accent); border-color: var(--accent); }
.switch-input:checked::after { left: 1.25rem; background: var(--accent-ink); }
.switch-input:disabled { opacity: .55; cursor: default; }
.quality-label { font-size: .84rem; font-weight: 680; }
#screen-quality { font-size: .82rem; }
.screen-panel { border-top: 1px solid var(--line); }
.screen-panel h3 { display: flex; align-items: center; gap: .5rem; }
.screen-panel h3 .icon { color: var(--accent); }
.screen-panel .muted { font-size: .85rem; }
.screen-preview { grid-area: stage; display: grid; min-width: 0; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; background: #161218; border-bottom: 1px solid var(--line); }
.screen-preview video { display: block; min-height: 0; width: 100%; height: 100%; object-fit: contain; }
.preview-caption { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-height: 2.7rem; padding: .35rem var(--gutter); background: var(--bar); color: var(--muted); font-size: .78rem; }
.screen-expand { min-height: 2rem; margin-inline-start: auto; padding: .3rem .55rem; color: var(--accent); font-size: .76rem; }
.screen-preview:is(:fullscreen, .screen-expanded) { width: 100%; height: 100%; border: 0; background: #100e11; }
.screen-preview.screen-expanded { position: fixed; inset: 0; z-index: 20; }
.share-dot { color: var(--accent); }

@media (min-width: 67.001rem) {
  .breadcrumb { padding-inline-start: 1rem; border-inline-start: 1px solid var(--line); }
}
@media (max-width: 67rem) {
  .workspace { --rail-width: 4rem; --sidebar-width: 12rem; --people-width: 13.75rem; }
}
@media (width > 58rem) {
  .workspace[data-people="hidden"] { --people-width: 0px; }
  .workspace[data-people="hidden"] .voice-panel { display: none; }
}
@media (max-width: 58rem) {
  .topbar { min-height: 3.5rem; }
  .breadcrumb, .panel-toggle { display: none; }
  .workspace, .workspace[data-sharing="true"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "nav" "chat" "dock"; }
  .workspace[data-view="channels"] { grid-template-columns: 3.65rem minmax(0, 1fr); grid-template-areas: "nav nav" "rail sidebar" "dock dock"; }
  .workspace[data-view="friends"] { grid-template-areas: "nav" "sidebar" "dock"; }
  .workspace[data-view="voice"] { grid-template-areas: "nav" "voice" "dock"; }
  .workspace[data-view="voice"][data-sharing="true"] { grid-template-rows: auto minmax(0, 2fr) minmax(0, 3fr) auto; grid-template-areas: "nav" "stage" "voice" "dock"; }
  .mobile-nav { grid-area: nav; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem; padding: .35rem .55rem; border-bottom: 1px solid var(--line); background: var(--bar); }
  .sidebar-header { display: none; }
  .mobile-nav .button { min-height: 2.45rem; gap: .2rem; padding-inline: .2rem; border-color: transparent; background: transparent; font-size: .81rem; }
  .mobile-nav .count-badge { min-width: 1.1rem; font-size: .64rem; }
  .mobile-nav .button[aria-current="true"] { border-color: var(--accent-line); background: var(--accent-bg); color: var(--accent); }
  .workspace:not([data-view="channels"]) .space-rail,
  .workspace:not([data-view="channels"], [data-view="friends"]) .friends-panel,
  .workspace:not([data-view="chat"]) .chat-panel,
  .workspace:not([data-view="voice"]) :is(.voice-panel, .screen-preview:not(:fullscreen, .screen-expanded), .call-dock[data-active="false"]) { display: none; }
  .space-button[aria-current="true"]::before { inset-inline-start: -.42rem; width: .18rem; }
  .friends-panel, .voice-panel { border-inline: 0; }
  .call-dock { grid-template-columns: minmax(0, 1fr) auto; padding: .5rem var(--gutter); }
  .call-dock .voice-controls { grid-template-columns: repeat(3, 2.35rem); }
  .call-dock :is(.notice, #play) { grid-column: 1 / -1; }
  .create-dialog input, .friend-form input, .composer textarea { font-size: 1rem; }
  .composer textarea { resize: none; }
  .composer-hint { display: none; }
}
@media (max-width: 38rem) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-intro { gap: .45rem; }
  .auth-signal { display: none; }
}
@media (max-width: 28rem) {
  .brand { font-size: 1rem; gap: .45rem; }
  .brand-mark { width: 1.85rem; height: 1.85rem; }
  .account { gap: .35rem; }
  .account .avatar { display: none; }
  #logout { min-height: 2.35rem; padding-inline: .55rem; }
}
@media (max-height: 29rem) {
  .panel-header { min-height: 3.1rem; padding-block: .4rem; }
  .composer textarea { height: 2.65rem; }
  .composer-hint { display: none; }
  .empty-icon { display: none; }
}
.channel-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: .08rem .15rem; }
.channel-row > .channel { width: 100%; min-width: 0; }
.channel-row > .voice-members { grid-column: 1 / -1; }

.workspace[data-view="friends"] { --people-width: 0px; }
.workspace[data-view="friends"] .voice-panel { display: none; }
.workspace[data-view="friends"] .chat-panel { grid-template-rows: auto minmax(0, 1fr); }
.workspace[data-view="friends"] .message-area,
.workspace[data-view="friends"] .composer { display: none; }
.friends-section { display: grid; align-content: start; gap: 1.15rem; min-height: 0; overflow: auto; padding: clamp(1rem, 2.5vw, 2rem); }
.friends-page-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: min(100%, 48rem); }
.friends-page-top h1 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); letter-spacing: -.025em; }
.friend-list-section { display: grid; gap: .55rem; width: min(100%, 48rem); }
.friend-list-section h2 { padding-bottom: .5rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
.friends-directory { gap: .35rem; }
.friends-directory > li:not(.people-empty) { display: flex; align-items: center; min-height: 3.45rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--sidebar); }
.friends-directory > li > .channel { min-height: 2.8rem; }
.friends-directory .presence-dot { margin-inline: auto .5rem; }
.friends-directory .friend-label { display: grid; min-width: 0; gap: .08rem; }
.friends-directory .friend-label strong { overflow: hidden; text-overflow: ellipsis; }
.friends-directory .friend-presence { font-size: .76rem; }
.friends-directory .people-empty { padding: .35rem .1rem; }
.dm-sidebar-section [data-view-button="friends"] { margin-bottom: .3rem; }
.channel-title-button { display: flex; flex: 1; min-width: 0; align-items: center; gap: .65rem; padding: 0; text-align: left; border: 0; background: transparent; color: inherit; }
.channel-title-button:hover .chat-title { color: var(--accent-bright); }
.chat-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.04rem; font-weight: 720; line-height: 1.25; }
.chat-identity { display: grid; min-width: 0; overflow-wrap: anywhere; }
.chat-identity .muted { font-size: .77rem; }
.title-chevron { flex: none; color: var(--muted); font-size: 1rem; }
.chat-header .section-icon { width: 2.15rem; height: 2.15rem; }
.settings-body { display: grid; gap: .8rem; padding: 1rem; }
.settings-channel-name { font-size: 1rem; font-weight: 700; }
.settings-body .invite-form { margin-top: .15rem; }
.settings-body .invite-form > div { grid-template-columns: minmax(0,1fr) auto; }
.settings-body .invite-form .button { min-height: 2.55rem; }
.settings-body .muted { font-size: .82rem; }
.settings-body > .button { justify-self: start; }
#space-leave { margin-top: .25rem; }
@media (max-width: 58rem) {
  .workspace[data-view="friends"] { grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "nav" "chat" "dock"; }
  .workspace[data-view="friends"] .friends-panel { display: none; }
  .workspace[data-view="friends"] .friends-section { padding: 1rem var(--gutter) 1.3rem; }
}

noscript { padding: .75rem var(--gutter); }

/* Live call stage follows the reference: people in the center, roster at right. */
.space-title-button { display:flex; width:100%; align-items:center; justify-content:space-between; gap:.5rem; padding:.2rem 0; border:0; background:transparent; color:var(--text); text-align:left; font-weight:720; }
.space-title-button:hover { color:var(--accent-bright); }
.space-title-button span { color:var(--muted); }
.presence-heading { margin:.75rem 0 .25rem; color:var(--muted); font-size:.72rem; font-weight:720; }
.space-member.offline { opacity:.64; }
.space-member.offline .presence-dot { background:#766b79; }
/* Keep the workspace grid intact: the call stage lives inside .chat-panel. */
.call-stage { min-width:0; min-height:0; display:flex; flex-direction:column; gap:1rem; overflow:auto; padding:clamp(1rem,2vw,1.5rem); background:var(--main); }
.stage-heading { display:flex; justify-content:space-between; gap:1rem; color:var(--muted); font-size:.88rem; }
.stage-heading strong { color:var(--text); font-size:1rem; }
.stage-tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr)); align-content:center; gap:.75rem; flex:1; }
.stage-tile { position:relative; display:grid; min-height:clamp(9rem,22vh,14rem); place-items:center; border:1px solid var(--line); border-radius:.85rem; background:radial-gradient(ellipse at 50% 40%,#403541,var(--sidebar) 72%); }
.stage-avatar { width:4.25rem; height:4.25rem; border-radius:35%; font-size:1.6rem; }
.tile-label { position:absolute; bottom:.65rem; left:.65rem; padding:.32rem .5rem; border-radius:.4rem; background:#17131bd9; font-size:.8rem; }
#call-stage:has(.stage-tile:only-child) .stage-tile { min-height:min(42vh,22rem); }
#deafen.is-on { color:var(--danger); background:#4b2734; border-color:#875167; }
.rail-settings { position:fixed; z-index:4; left:.72rem; bottom:.72rem; width:2.65rem; min-height:2.65rem; padding:0; border-radius:50%; font-size:1.2rem; }
.settings-options { display:grid; gap:.8rem; padding:.6rem .15rem; }
.call-toast { position:fixed; z-index:30; left:50%; bottom:5.6rem; transform:translateX(-50%); max-width:min(90vw,30rem); padding:.7rem 1rem; border:1px solid var(--accent-line); border-radius:.7rem; background:var(--raised); box-shadow:0 .5rem 2rem #0008; text-align:center; }
.call-toast[data-kind="join"] { border-color:var(--live); }
.call-toast[data-kind="leave"] { border-color:var(--muted); }
@media (max-width:58rem) {
  .workspace[data-view="voice"] { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) auto; grid-template-areas:"nav" "stage" "dock"; }
  .workspace[data-view="voice"] .call-stage { display:flex; }
  .workspace[data-view="voice"] .voice-panel { display:none; }
  .workspace[data-view="voice"] .call-stage { padding:.8rem; }
  .stage-tile { min-height:8rem; }
  .rail-settings { left:.55rem; bottom:.55rem; }
}
.call-stage .screen-preview { grid-area:auto; width:100%; height:min(42vh,30rem); min-height:12rem; border:1px solid var(--line); border-radius:.8rem; overflow:hidden; }
@media (min-width:58.001rem) {
  .workspace[data-view="voice"] .chat-panel { display:none; }
}

/* Reference-aligned workspace: channel rail, compact call dock, focus stage and people panel. */
.workspace { grid-template-rows:minmax(0,1fr); grid-template-areas:"rail sidebar chat voice"; }
.friends-panel { display:flex; flex-direction:column; overflow:hidden; }
.sidebar-body { flex:1; min-height:0; overflow:auto; }
.sidebar-header { min-height:4.6rem; }
.space-title-button { display:grid; grid-template-columns:2.25rem minmax(0,1fr) auto; justify-content:initial; text-align:left; }
.space-glyph { display:grid; place-items:center; width:2.25rem; height:2.25rem; border:1px solid var(--accent-line); border-radius:.65rem; background:var(--accent-bg); color:var(--accent); font-size:1.3rem; }
.space-title-copy { display:grid; min-width:0; gap:.15rem; }
.space-title-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.94rem; }
.space-title-copy small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:.72rem; }
.space-chevron { color:var(--muted); }
.call-dock { grid-area:auto; display:grid; gap:.45rem; min-width:0; max-block-size:none; padding:.65rem; border:1px solid var(--line); border-radius:.7rem; background:#252a27; overflow:visible; }
.call-dock .voice-status { font-size:.75rem; }
.voice-connection { position:relative; }
.voice-status[data-kind="success"][tabindex] { cursor:help; }
.voice-latency { position:absolute; bottom:100%; inset-inline-start:0; z-index:2; visibility:hidden; padding:.35rem .55rem; border:1px solid var(--line); border-radius:.4rem; background:var(--raised); color:var(--text); font-size:.75rem; }
.voice-connection:hover .voice-latency, .voice-connection:focus-within .voice-latency { visibility:visible; }
.call-dock .stack .button { width:100%; }
.call-dock[data-active="true"] { border-color:#405047; background:#262d2b; }
.call-dock .voice-controls { grid-template-columns:repeat(4,minmax(0,1fr)); }
.call-dock .voice-controls .button { width:100%; min-width:0; min-height:2.15rem; padding:.25rem; font-size:.72rem; }
#call-focus-trigger .icon { width:1.15rem; height:1.15rem; }
.profile-footer { display:flex; align-items:center; gap:.35rem; min-height:3.6rem; padding:.45rem .6rem; border-top:1px solid var(--line); background:var(--bar); }
.profile-person { display:flex; align-items:center; gap:.5rem; flex:1; min-width:0; }
.profile-person > span:last-child { display:grid; min-width:0; }
.profile-person strong,.profile-person small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-person strong { font-size:.82rem; }
.profile-person small { font-size:.7rem; }
.profile-footer .button { width:2.1rem; min-width:2.1rem; min-height:2.1rem; padding:.2rem; background:transparent; }
.profile-footer .button.is-on { color:var(--danger); background:#4b2734; }
.chat-panel { grid-area:chat; display:flex; flex-direction:column; min-height:0; }
.chat-panel .message-area { flex:1; min-height:0; }
.call-stage { display:flex; flex:1; min-height:0; overflow:auto; }
.workspace[data-view="voice"] .message-area,.workspace[data-view="voice"] .composer,.workspace[data-view="voice"] .friends-section { display:none; }
.workspace[data-view="voice"] .chat-header .panel-toggle { display:none; }
.stage-heading { align-items:center; }
.stage-heading > div { display:grid; gap:.3rem; }
.stage-heading p { color:var(--muted); font-size:.8rem; }
.stage-tiles { grid-template-columns:repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap:.8rem; }
.stage-tile { min-height:clamp(11rem,25vh,17rem); border-radius:.9rem; }
.stage-tile.is-speaking { border-color:var(--live); box-shadow:inset 0 0 0 1px var(--live); }
.stage-tile.is-sharing { grid-column:span 2; }
.stage-controls { display:flex; justify-content:center; flex-wrap:wrap; gap:.45rem; padding:.55rem; align-self:center; border:1px solid var(--line); border-radius:.85rem; background:var(--bar); }
.stage-controls .button { min-height:2.5rem; }
.stage-controls #stage-mute[data-muted="true"],.stage-controls #stage-deafen[aria-pressed="true"] { color:var(--danger); background:#4b2734; border-color:#875167; }
.call-preview { display:flex; align-items:center; gap:.55rem; padding:.65rem; border:1px solid var(--line); border-radius:.7rem; background:var(--bar); }
.call-preview > div:nth-child(2) { display:grid; min-width:0; flex:1; }
.call-preview strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.82rem; }
.call-preview small { color:var(--live); font-size:.7rem; }
.call-preview-open { flex:none; width:2.3rem; min-width:2.3rem; min-height:2.3rem; padding:.2rem; }
.call-preview-open .icon { width:1.15rem; height:1.15rem; }
.call-preview-mark { display:grid; place-items:center; width:2rem; height:2rem; flex:none; border-radius:.55rem; color:var(--live); background:#33423c; }
.member-tabs { display:flex; border-bottom:1px solid var(--line); }
.member-tab { min-height:2.2rem; padding:0 .25rem .45rem; border:0; border-bottom:2px solid var(--accent); background:transparent; color:var(--accent-bright); font-size:.8rem; }
.voice-panel .voice-body { align-content:start; }
.voice-panel .call-roster { padding-top:.2rem; }
/* Keep the roster heading visible so the right-side list has a clear label. */
.voice-panel .space-people h3 { margin-bottom:.55rem; }
@media (max-width:58rem) {
  .workspace { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); grid-template-areas:"nav" "chat"; }
  .workspace:not([data-view="channels"],[data-view="friends"]) .friends-panel { display:none; }
  .workspace[data-view="voice"] { grid-template-rows:auto minmax(0,1fr) minmax(10rem,35vh); grid-template-areas:"nav" "chat" "voice"; }
  .workspace[data-view="voice"] .chat-panel { display:flex; }
  .workspace[data-view="voice"] .call-stage { display:flex; min-height:0; }
  .workspace[data-view="voice"] .voice-panel { display:flex; min-height:0; border-top:1px solid var(--line); }
  .workspace[data-view="voice"] .voice-panel .space-people { display:none; }
  .workspace[data-view="voice"] .voice-panel .call-members { display:flex; flex-wrap:wrap; }
  .workspace[data-view="voice"] .call-preview { display:none !important; }
  .call-dock { display:none; }
  .workspace[data-view="voice"] .profile-footer { display:none; }
  .workspace[data-view="channels"] { grid-template-columns:3.65rem minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); grid-template-areas:"nav nav" "rail sidebar"; }
  .workspace[data-view="voice"] .call-stage { padding:.8rem; }
}
.workspace[data-view="voice"] .chat-panel { display:flex; }
.workspace[data-sharing="true"] { grid-template-rows:minmax(0,1fr); grid-template-areas:"rail sidebar chat voice"; }
.workspace[data-view="voice"][data-sharing="true"] { grid-template-rows:minmax(0,1fr); grid-template-areas:"rail sidebar chat voice"; }
@media (max-width:58rem) {
  .workspace[data-view="voice"][data-sharing="true"] { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) minmax(10rem,35vh); grid-template-areas:"nav" "chat" "voice"; }
}
.stage-controls .button { width:2.7rem; min-width:2.7rem; min-height:2.7rem; padding:.45rem; border-radius:50%; }
.stage-controls #stage-leave { color:var(--danger); background:#4b2734; border-color:#875167; }
