:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #181b1f;
  --rail: #0d0f11;
  --sub: #1d2025;
  --line: #292d33;
  --white: #f0f1f3;
  --muted: #949ba5;
  --dim: #727a86;
  --accent: #b2a8f3;
  --accent2: #9689df;
  --green: #73d6bb;
  --pink: #ed9daf;
  --shadow: 0 24px 80px #0006;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--white); font: 14px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { transition: background .15s, color .15s, border-color .15s; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.ui-icon { display: block; width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.primary { border: 1px solid transparent; background: var(--accent); color: #1c1830; border-radius: 8px; padding: 10px 16px; font-weight: 650; }
.primary:hover { background: #c3baf9; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; min-width: 34px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--white); background: #ffffff09; }
.link-button { background: transparent; border: 0; color: var(--accent); padding: 0; font-weight: 550; }
.link-button:hover { text-decoration: underline; }
.btn-secondary { border: 1px solid var(--line); background: #24282e; color: var(--white); padding: 10px 15px; border-radius: 8px; }

/* Sign in */
.auth-layout { min-height: 100dvh; display: flex; align-items: center; justify-content: center; position: relative; padding: 110px 20px; background: #111315; }
.auth-brand { position: absolute; top: 30px; left: 36px; display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 750; letter-spacing: 2px; }
.brand-symbol { display: grid; place-items: center; width: 36px; height: 36px; color: var(--green); background: #172824; border-radius: 11px; }
.brand-symbol .ui-icon { width: 23px; height: 23px; }
.auth-brand small { margin-left: 12px; color: var(--dim); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.auth-panel { position: relative; width: min(420px, 100%); padding: 35px 36px; border: 1px solid var(--line); border-radius: 18px; background: #181b1f; }
.auth-emblem { display: grid; place-items: center; margin: 0 auto 20px; width: 48px; height: 48px; border: 1px solid #31403d; border-radius: 14px; color: var(--green); background: #192521; }
.auth-emblem .ui-icon { width: 28px; height: 28px; }
.auth-panel h1 { margin: 0 0 5px; text-align: center; font-size: 27px; font-weight: 650; letter-spacing: -.8px; }
.auth-panel p { margin: 0 0 28px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-panel label, #modal-label, .modal-kind label { display: block; color: #b5bbc3; letter-spacing: .7px; font-size: 10px; font-weight: 650; margin: 17px 0 8px; }
.auth-panel input, #modal-value, #modal-kind { display: block; width: 100%; background: #111417; color: var(--white); border: 1px solid #32373f; border-radius: 8px; padding: 12px; outline: none; }
.auth-panel input:focus, #modal-value:focus { border-color: var(--accent); }
.auth-panel input::placeholder { color: #636c78; }
.auth-submit { width: 100%; margin-top: 24px; padding: 12px; }
.auth-panel .auth-switch { font-size: 12px; text-align: center; margin: 22px 0 0; }
.auth-footnote { position: absolute; bottom: 28px; color: var(--dim); font-size: 11px; }

/* App navigation */
.app-shell { display: grid; grid-template-columns: 68px 232px minmax(0, 1fr) 210px; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.app-shell.hide-members { grid-template-columns: 68px 232px minmax(0, 1fr); }
.app-shell.hide-members .members-sidebar { display: none; }
.server-rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 19px 0; gap: 13px; overflow-y: auto; scrollbar-width: none; }
.server-rail::-webkit-scrollbar { display: none; }
.home-icon, .rail-add, .rail-join, .server-dot { display: grid; place-items: center; position: relative; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; border: 1px solid #292d33; color: #a9b0ba; background: #1c2025; font-weight: 650; font-size: 14px; }
.home-icon { border-color: #30443c; background: #1b3028; color: var(--green); }
.home-icon .ui-icon { width: 25px; height: 25px; }
.server-dot:hover, .server-dot.active { color: #e7e2ff; background: #343047; border-color: #635879; }
.server-dot.active::before { content: ""; position: absolute; left: -14px; width: 3px; height: 21px; border-radius: 3px; background: var(--accent); }
.rail-add, .rail-join { border-color: transparent; background: #171b1f; color: var(--muted); }
.rail-add:hover, .rail-join:hover { color: var(--green); background: #1d2926; }
.rail-divider { width: 24px; height: 1px; background: var(--line); margin: 2px 0; }
.server-icons { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.rail-bottom { margin-top: auto; padding-top: 15px; }
.connection-dot { display: block; width: 7px; height: 7px; background: #d67c8f; border-radius: 50%; box-shadow: 0 0 0 4px #ffffff05; }
.connection-dot.connected { background: var(--green); }
.channel-sidebar { background: #16191d; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #252930; }
.server-title-bar { display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 0 12px 0 19px; border-bottom: 1px solid #252930; }
.server-title-text { min-width: 0; }
.server-title-text > span { font-size: 14px; font-weight: 650; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 162px; }
.server-title-text small { color: var(--dim); font-size: 10px; }
.sidebar-scroll { padding: 25px 10px 12px; overflow-y: auto; scrollbar-width: thin; flex: 1; }
.channel-section { display: flex; align-items: center; justify-content: space-between; color: #79838e; font-size: 9px; font-weight: 650; letter-spacing: 1.1px; padding: 0 7px; margin-bottom: 8px; }
.voice-heading { margin-top: 26px; }
.small-plus { display: grid; place-items: center; width: 22px; height: 22px; background: transparent; border: 0; border-radius: 5px; color: var(--dim); }
.small-plus .ui-icon { width: 14px; height: 14px; }
.small-plus:hover { color: var(--white); background: #ffffff09; }
.channel-list { display: flex; flex-direction: column; gap: 3px; }
.channel-entry { display: flex; gap: 10px; align-items: center; width: 100%; background: transparent; color: #9aa3ad; border: 1px solid transparent; border-radius: 7px; text-align: left; padding: 8px 10px; font-size: 12px; font-weight: 500; min-width: 0; }
.channel-entry:hover { background: #20252b; color: #e4e7eb; }
.channel-entry.selected { background: #292735; border-color: #3a354b; color: #e3dcff; }
.channel-entry .channel-sign { color: #727d8a; font-size: 18px; font-weight: 400; line-height: 1; }
.channel-entry.selected .channel-sign { color: var(--accent); }
.channel-entry .channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-people { padding: 0 0 0 24px; margin: 0 0 6px; }
.voice-person { font-size: 11px; color: #8c97a2; padding: 4px 0 4px 10px; display: flex; gap: 7px; align-items: center; }
.mini-avatar { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; background: #373546; color: #cfc7ec; font-size: 8px; font-weight: 600; }
.sidebar-tip { margin: 35px 8px 0; padding-top: 19px; border-top: 1px solid #272c32; }
.sidebar-tip-mark { display: block; width: 17px; height: 2px; background: #5f8276; margin-bottom: 12px; }
.sidebar-tip p { color: #a1a9b1; font-size: 11px; margin: 0 0 3px; }
.sidebar-tip small { font-size: 10px; color: #67727e; line-height: 1.7; display: block; }
.user-panel { background: #14171a; display: flex; align-items: center; gap: 8px; padding: 12px 10px; min-height: 66px; border-top: 1px solid #252930; }
.avatar { width: 32px; height: 32px; min-width: 32px; border-radius: 10px; background: #393348; display: grid; place-items: center; font-weight: 650; color: #d5cbee; font-size: 12px; position: relative; }
.avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; border: 3px solid #14171a; background: var(--green); width: 7px; height: 7px; border-radius: 50%; }
.user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
.user-info small { color: var(--dim); font-size: 9px; }
.user-panel .icon-button { width: 27px; min-width: 27px; height: 30px; }
.user-panel .ui-icon { width: 16px; height: 16px; }
.voice-panel { padding: 12px; border-top: 1px solid #2d3e36; background: #17231e; }
.voice-connected { display: block; color: var(--green); font-weight: 650; letter-spacing: .8px; font-size: 8px; }
.voice-panel #voice-location { font-size: 11px; color: #abbcb2; }
.voice-actions { display: flex; gap: 6px; margin-top: 9px; }
.voice-actions button { display: grid; place-items: center; min-width: 0; height: 32px; flex: 1; background: #24352c; border: 1px solid transparent; color: #b4c9bd; border-radius: 6px; padding: 6px; }
.voice-actions button:hover { background: #304338; color: #e9f4ee; }
.voice-actions button.muted, .voice-actions button.active { color: #efadbd; background: #3a2930; }
.voice-actions .ui-icon { width: 16px; height: 16px; }

/* Channel and messages */
.chat-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #1b1e22; }
.chat-header { height: 66px; min-height: 66px; display: flex; align-items: center; gap: 11px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.hash-icon { font-size: 23px; color: #77828e; font-weight: 350; }
.chat-header strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-description { color: #727d89; font-size: 11px; padding-left: 15px; border-left: 1px solid #363c44; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-spacer { flex: 1; min-width: 0; }
.live-marker { font-size: 8px; letter-spacing: 1px; font-weight: 600; color: #91a69c; white-space: nowrap; }
.live-marker i { display: inline-block; background: var(--green); width: 5px; height: 5px; border-radius: 50%; vertical-align: middle; margin: 0 5px 1px 0; }
.settings-trigger { border: 1px solid #343a42; color: #bcc3cc; }
.chat-content { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #343b44 transparent; }
.message-list { display: flex; flex-direction: column; min-height: 100%; padding: 25px 27px 12px; }
.chat-welcome { margin-top: auto; padding-bottom: 30px; }
.welcome-icon { background: #292733; color: #b7a5d9; border: 1px solid #41394f; border-radius: 16px; width: 56px; height: 56px; display: grid; place-items: center; font-size: 32px; font-weight: 400; margin-bottom: 19px; }
.chat-welcome h2 { font-size: 25px; letter-spacing: -.7px; font-weight: 600; margin: 0 0 7px; }
.chat-welcome p { color: #858f9a; margin: 0; font-size: 12px; }
.chat-welcome .welcome-line { display: block; height: 1px; background: var(--line); margin-top: 26px; }
.message { display: flex; gap: 13px; padding: 11px 9px; margin: 0 -9px; border-radius: 7px; position: relative; }
.message:hover { background: #ffffff03; }
.message-avatar { width: 35px; height: 35px; min-width: 35px; border-radius: 11px; background: #383346; display: grid; place-items: center; font-weight: 600; color: #d8ccea; font-size: 12px; }
.message-avatar.alt { background: #2c3b44; color: #bdd5e3; }
.message-avatar.green { background: #2b3d36; color: #bad9cb; }
.message-avatar.pink { background: #44313d; color: #dfc1d3; }
.message-body { min-width: 0; flex: 1; }
.message-meta { display: flex; align-items: baseline; gap: 11px; }
.message-meta strong { font-size: 12px; font-weight: 600; }
.message-meta time { font-size: 9px; color: #6a7481; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: #c1c7cf; margin-top: 3px; line-height: 1.65; }
.message-remove { display: none; position: absolute; top: 6px; right: 5px; background: #262b31; border: 1px solid #3a424c; color: #d4a3b1; border-radius: 6px; font-size: 10px; padding: 4px 8px; }
.message:hover .message-remove, .message:focus-within .message-remove { display: block; }
.load-older { align-self: center; background: #272a32; border: 1px solid #363b46; color: #bcb0da; padding: 7px 13px; border-radius: 7px; font-size: 11px; margin-bottom: 14px; }
.composer-wrap { padding: 12px 23px 13px; }
.composer { display: flex; align-items: center; gap: 10px; background: #25292f; border: 1px solid #363c45; border-radius: 10px; padding: 7px 8px 7px 13px; }
.composer:focus-within { border-color: #675d7d; }
.composer-deco { color: #7f8996; }
.composer textarea { background: transparent; border: 0; outline: none; resize: none; color: #e1e5ea; flex: 1; min-width: 0; min-height: 24px; max-height: 150px; padding: 5px 0; line-height: 1.5; overflow-y: auto; font-size: 12px; }
.composer textarea::placeholder { color: #7b8694; }
.send-button { background: #464052; color: #d7c8ed; border: 1px solid #5c526e; width: 33px; height: 33px; border-radius: 7px; display: grid; place-items: center; }
.send-button:hover { background: #5a4e70; }
.send-button .ui-icon { width: 15px; height: 15px; }
.character-count { font-size: 9px; color: #a49aaf; }
.composer-hint { text-align: right; font-size: 9px; color: #67727e; margin: 7px 3px 0; }

/* Members */
.members-sidebar { display: flex; min-height: 0; flex-direction: column; background: #181b1f; border-left: 1px solid #282d33; }
.members-top { height: 66px; min-height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 21px; border-bottom: 1px solid var(--line); color: #83909b; font-size: 9px; font-weight: 600; letter-spacing: 1px; }
.member-count { background: #2a3037; padding: 1px 6px; border-radius: 5px; color: #b9c1ca; }
.members-list { overflow-y: auto; flex: 1; padding: 25px 12px; }
.members-group-label { font-size: 9px; font-weight: 600; letter-spacing: .9px; color: #6f7b88; padding: 3px 8px 10px; }
.member-card { display: flex; align-items: center; gap: 9px; padding: 9px 8px; border-radius: 7px; color: #c5cbd3; }
.member-card.offline { opacity: .5; }
.member-avatar { position: relative; width: 29px; height: 29px; min-width: 29px; background: #373244; color: #cec2e0; border-radius: 10px; display: grid; place-items: center; font-size: 10px; font-weight: 600; }
.member-avatar::after { content: ""; position: absolute; width: 6px; height: 6px; right: -2px; bottom: -2px; background: var(--green); border: 2px solid #181b1f; border-radius: 50%; }
.member-card.offline .member-avatar::after { background: #747e88; }
.member-name { font-size: 11px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role { font-size: 9px; color: #707c89; }
.members-bottom { padding: 17px; color: #687581; font-size: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.status-icon { color: #80958c; }
.status-icon .ui-icon { width: 17px; height: 17px; }

/* Voice and screen sharing */
.in-call.call-chat-hidden > .chat-content, .in-call.call-chat-hidden > .composer-wrap { display: none; }
.in-call > .chat-content { flex: 0 1 27%; min-height: 100px; border-top: 1px solid var(--line); }
.in-call .chat-welcome { padding-bottom: 12px; }
.in-call .chat-welcome .welcome-icon, .in-call .chat-welcome .welcome-line { display: none; }
.in-call .chat-welcome h2 { font-size: 17px; }
.media-stage { background: #14171a; display: flex; flex: 1 1 0; flex-direction: column; min-height: 230px; overflow: hidden; }
.media-stage-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; gap: 12px; flex-shrink: 0; }
.call-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.call-heading strong { font-size: 12px; font-weight: 600; }
.call-heading > span { font-size: 10px; color: #77838f; }
#call-status { color: #86bba6; }
#call-status.reconnecting { color: #dfbb76; }
.call-heading .stream-quality-badge { padding: 3px 7px; border: 1px solid #37433f; background: #1f2d27; color: #96c4ae; border-radius: 5px; font-size: 9px; white-space: nowrap; }
.call-view-actions { display: flex; gap: 6px; flex-shrink: 0; }
.call-view-actions button { display: flex; align-items: center; gap: 6px; background: #1c2025; border: 1px solid #30373f; color: #aeb7c1; border-radius: 7px; padding: 7px 9px; font-size: 10px; min-height: 33px; }
.call-view-actions .ui-icon { width: 14px; height: 14px; }
.call-view-actions button:hover { background: #2c3039; color: #e3e7ed; }
.call-view-actions button[aria-pressed=true] { background: #2d2939; border-color: #4e445e; color: #c8b8e4; }
.media-layout { flex: 1; min-height: 0; display: flex; padding: 0 18px; gap: 12px; overflow: hidden; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; overflow-y: auto; align-content: safe center; width: 100%; min-height: 0; scrollbar-width: thin; padding: 3px; }
.media-tile { position: relative; background: #1b2026; border: 1px solid #333b46; min-width: 0; overflow: hidden; border-radius: 11px; aspect-ratio: 16/9; cursor: pointer; transition: border-color .15s; max-height: 100%; }
.media-tile:hover { border-color: #7a698e; }
.media-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.media-tile.speaking { border-color: var(--green); box-shadow: inset 0 0 0 1px #73d6bb80; }
.media-tile.focused { border-color: #645773; cursor: default; }
.media-video-slot { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; inset: 0; }
.media-video { object-fit: contain; width: 100%; height: 100%; background: #0c0e10; }
.media-video.local-camera { transform: scaleX(-1); }
.media-avatar { width: clamp(42px, 8vw, 86px); height: clamp(42px, 8vw, 86px); border-radius: 23%; background: #3b344b; display: grid; place-items: center; color: #d1c0e9; font-size: clamp(16px, 2vw, 26px); font-weight: 600; }
.media-caption { position: absolute; bottom: 10px; left: 10px; background: #11161bdc; color: #dae0e8; border: 1px solid #ffffff0a; border-radius: 5px; padding: 4px 8px; font-size: 10px; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-source { position: absolute; top: 10px; left: 10px; background: #1a2028dd; border-radius: 4px; padding: 3px 6px; letter-spacing: .8px; color: #a6aebc; font-size: 8px; font-weight: 600; }
.media-tile[data-source=screen] .media-source { color: #90c3ac; background: #1b2d24ee; }
.media-mic-status { position: absolute; top: 10px; right: 10px; background: #32242ce6; border-radius: 4px; padding: 3px 6px; color: #ce95a5; font-size: 8px; }
.media-mic-status:empty { display: none; }
.media-layout.has-focus { display: grid; grid-template-columns: minmax(0, 1fr) 160px; align-items: stretch; }
.media-layout.single-tile { grid-template-columns: minmax(0, 1fr); }
.media-focus { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 3px; }
.media-focus .media-tile { width: 100%; height: 100%; aspect-ratio: auto; min-height: 100px; }
.has-focus .media-grid { display: flex; flex-direction: column; align-content: initial; justify-content: flex-start; padding: 3px; overflow-y: auto; }
.has-focus .media-grid .media-tile { width: 100%; flex: 0 0 auto; min-height: 85px; }
.has-focus .media-grid .media-caption { font-size: 9px; padding: 3px 5px; bottom: 5px; left: 5px; max-width: calc(100% - 10px); }
.has-focus .media-grid .media-source { font-size: 7px; top: 5px; left: 5px; }
.has-focus .media-grid .media-mic-status { font-size: 0; top: 5px; right: 5px; padding: 0; }
.has-focus .media-grid .media-mic-status:not(:empty)::after { content: "OFF"; font-size: 7px; padding: 3px 5px; display: block; }
.has-focus .media-grid .media-avatar { width: 40px; height: 40px; font-size: 15px; }
.media-hint, .ptt-status { text-align: center; font-size: 10px; color: #687581; margin: 9px 12px 0; flex-shrink: 0; }
.ptt-status { color: #a393be; }
.ptt-status.active, .ptt-status.talking { color: var(--green); }
.media-controls { padding: 14px 16px 18px; display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; flex-shrink: 0; }
.media-controls button { display: flex; align-items: center; justify-content: center; gap: 7px; background: #22272e; color: #b4beca; border: 1px solid #353d47; border-radius: 8px; padding: 9px 11px; font-size: 10px; font-weight: 550; min-height: 37px; }
.media-controls .ui-icon { width: 16px; height: 16px; }
.media-controls button:hover { background: #303540; color: #e9edf3; }
.media-controls button.active { background: #302a3d; border-color: #574569; color: #cdb9e8; }
.media-controls button.danger { background: #3c242c; color: #e4a0b4; border-color: #5d333f; }
.media-controls button.danger:hover { background: #542c39; }
.media-controls .ptt-talk { background: #25382e; border-color: #3d654e; color: #b3dac4; touch-action: none; user-select: none; -webkit-user-select: none; }
.media-controls .ptt-talk.active, .media-controls .ptt-talk.talking, .media-controls .ptt-talk[aria-pressed=true] { color: #d0f9e3; background: #2a4c39; border-color: #6dbd91; }
.media-audio { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); }
.start-audio { align-self: center; border: 1px solid #66517e; border-radius: 7px; padding: 7px 13px; background: #30263d; color: #dac8ef; font-size: 11px; margin-top: 8px; }
.media-stage:fullscreen { width: 100vw; height: 100dvh; max-height: none; min-height: 0; flex: none; padding: 8px; }
.media-stage:fullscreen .media-layout { flex: 1; }

/* General dialogs */
dialog { border: 1px solid #3b424d; border-radius: 15px; background: #1b1f24; color: var(--white); width: min(420px, calc(100vw - 32px)); padding: 27px; box-shadow: var(--shadow); }
dialog::backdrop { background: #07090cc9; backdrop-filter: blur(7px); }
.modal-top { display: flex; justify-content: space-between; align-items: center; }
.modal-icon { display: grid; place-items: center; color: var(--accent); width: 33px; height: 33px; background: #302a3d; border-radius: 9px; }
.modal-close { display: grid; place-items: center; width: 32px; height: 32px; min-width: 32px; background: transparent; border: 1px solid transparent; border-radius: 7px; color: #85909d; }
.modal-close:hover { color: white; background: #2a3038; border-color: #3c444f; }
.modal-close .ui-icon { width: 17px; height: 17px; }
dialog h2 { font-size: 23px; font-weight: 600; letter-spacing: -.6px; margin: 13px 0 5px; }
dialog p { margin: 0 0 18px; color: #8d98a6; font-size: 12px; }
dialog label { display: block; color: #acb5c1; font-size: 10px; letter-spacing: .7px; font-weight: 600; margin-bottom: 8px; }
.modal-kind { margin-top: 15px; }
.modal-controls { margin-top: 25px; display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; z-index: 10; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 11px 17px; border: 1px solid #5a4d6d; border-radius: 9px; background: #2c2538; color: #e4d9f4; box-shadow: 0 8px 30px #0004; font-size: 12px; max-width: min(90vw, 500px); text-align: center; }
.mobile-only { display: none; }

/* Preferences */
.settings-dialog { width: min(880px, calc(100vw - 48px)); height: min(754px, calc(100dvh - 64px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; background: #191d22; border-color: #3a414b; border-radius: 18px; }
.settings-dialog[open] { display: flex; flex-direction: column; }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 27px 30px 23px; border-bottom: 1px solid #30363f; flex-shrink: 0; background: #1c2026; }
.eyebrow { font-size: 8px; letter-spacing: 1.5px; font-weight: 650; color: #7f9f91; }
.settings-header h2 { margin: 7px 0 4px; font-size: 26px; font-weight: 600; }
.settings-header p { margin: 0; font-size: 11px; color: #8793a0; }
.settings-layout { display: grid; grid-template-columns: 178px minmax(0, 1fr); min-height: 0; flex: 1; }
.settings-nav { display: flex; flex-direction: column; gap: 5px; padding: 22px 14px; border-right: 1px solid #2c333b; background: #171b1f; }
.settings-nav button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 10px 12px; text-align: left; border: 1px solid transparent; background: transparent; color: #8b97a5; border-radius: 7px; font-size: 11px; white-space: nowrap; }
.settings-nav button .ui-icon { width: 16px; height: 16px; }
.settings-nav button:hover { background: #242a32; color: #c1cad6; }
.settings-nav button[aria-selected=true] { color: #d4c5ec; background: #302a3b; border-color: #4a3d59; }
.settings-content { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #404956 transparent; padding: 27px 31px 31px; min-height: 0; }
.settings-section-title { margin-bottom: 24px; }
.settings-section-title h3 { font-size: 18px; font-weight: 600; letter-spacing: -.4px; margin: 0 0 6px; }
.settings-section-title p { color: #8793a0; font-size: 11px; margin: 0; }
.settings-field { min-width: 0; margin-bottom: 21px; }
.settings-field label { font-size: 9px; font-weight: 600; letter-spacing: .8px; color: #93a0b0; margin-bottom: 9px; }
#media-settings select { display: block; width: 100%; border: 1px solid #3a4350; border-radius: 7px; color: #d0d8e3; background: #14191e; padding: 10px 11px; min-height: 40px; font-size: 11px; outline: none; }
#media-settings select:focus { border-color: #8d78ab; }
.settings-field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.shortcut-row { display: flex; align-items: center; gap: 18px; justify-content: space-between; padding: 14px 15px; background: #1f242b; border: 1px solid #303946; border-radius: 8px; margin-bottom: 24px; }
.shortcut-row > div { min-width: 0; }
.shortcut-row label { font-size: 8px; color: #9da6b5; margin: 0 0 6px; }
.shortcut-row p { color: #788594; font-size: 10px; line-height: 1.7; margin: 0; max-width: 280px; }
.shortcut-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 94px; min-height: 36px; padding: 8px 10px; border: 1px solid #5d526e; border-radius: 6px; background: #332b3f; color: #d0bee8; font-size: 11px; flex-shrink: 0; }
.shortcut-button .ui-icon { width: 15px; height: 15px; }
.shortcut-button.capturing, .shortcut-button[aria-pressed=true] { border-color: var(--green); color: var(--green); background: #20362a; }
#media-settings .device-hint { color: #71808f; margin: -10px 0 25px; font-size: 10px; line-height: 1.7; }
.volume-field { margin-top: 3px; }
#call-volume-value { float: right; color: #c0acd9; letter-spacing: 0; }
#media-settings input[type=range] { width: 100%; height: 20px; accent-color: #b5a1d3; margin: 0; cursor: pointer; }
.settings-divider { height: 1px; background: #303741; margin: 12px 0 7px; }
#media-settings .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin: 0; padding: 15px 0; font-size: inherit; letter-spacing: 0; font-weight: inherit; cursor: pointer; }
.switch-row > span { min-width: 0; }
.switch-row strong { display: block; color: #c7d0db; font-size: 11px; font-weight: 550; margin-bottom: 3px; }
.switch-row small { color: #778695; font-size: 10px; line-height: 1.6; display: block; }
.switch-row input { position: relative; appearance: none; width: 34px; height: 20px; min-width: 34px; border: 1px solid #4b5562; border-radius: 30px; background: #303944; cursor: pointer; margin: 0; transition: background .15s, border-color .15s; }
.switch-row input::before { position: absolute; content: ""; width: 12px; height: 12px; left: 3px; top: 3px; background: #9aa6b6; border-radius: 50%; transition: transform .15s, background .15s; }
.switch-row input:checked { background: #645079; border-color: #8f74a8; }
.switch-row input:checked::before { background: #e3d3f2; transform: translateX(14px); }
.stream-preview { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; border: 1px solid #35423d; background: #1b2721; border-radius: 10px; padding: 24px 20px; margin-bottom: 25px; }
.stream-preview-icon { display: grid; place-items: center; width: 42px; height: 42px; background: #293e31; color: #92c8aa; border-radius: 10px; margin-bottom: 2px; }
.stream-preview-icon .ui-icon { width: 22px; height: 22px; }
.stream-preview > span { font-size: 8px; letter-spacing: 1.1px; color: #7da38b; }
.stream-preview > strong { font-size: 25px; letter-spacing: -.8px; color: #c2e0cb; font-weight: 550; }
.stream-preview > small { font-size: 9px; color: #718d7c; max-width: 270px; line-height: 1.7; }
.settings-note { color: #8795a6; font-size: 10px; line-height: 1.7; border-top: 1px solid #303741; padding-top: 17px; margin: 5px 0 18px; }
.stream-apply { font-size: 11px; min-height: 38px; }
.appearance-preview { display: grid; grid-template-columns: 25px 65px 1fr; height: 156px; border: 1px solid #3a4350; border-radius: 9px; overflow: hidden; margin-bottom: 20px; background: #14181d; }
.appearance-preview-rail { display: flex; flex-direction: column; align-items: center; gap: 7px; padding-top: 10px; background: #101317; }
.appearance-preview-rail i { display: block; width: 13px; height: 13px; background: #393346; border-radius: 4px; }
.appearance-preview-rail i:first-child { background: #47725b; }
.appearance-preview-side { padding: 12px 7px; border-right: 1px solid #2a333e; background: #191f26; }
.appearance-preview-side b, .appearance-preview-side i { display: block; height: 4px; width: 35px; background: #3c4551; border-radius: 2px; margin-bottom: 13px; }
.appearance-preview-side i { height: 5px; background: #2f3845; margin-bottom: 9px; }
.appearance-preview-side i:nth-child(3) { background: #51465f; }
.appearance-preview-main { position: relative; padding: 13px; }
.appearance-preview-main > b { display: block; height: 4px; width: 35%; background: #4a535e; border-radius: 2px; }
.appearance-preview-main > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 17px; }
.appearance-preview-main i { display: block; height: 62px; border: 1px solid #3c3549; border-radius: 6px; background: #242330; }
.appearance-preview-main i + i { border-color: #34493d; background: #202c25; }
.appearance-preview-main > span { display: block; height: 9px; background: #2e3540; width: 55%; margin: 13px auto 0; border-radius: 3px; }
.settings-footer { display: flex; gap: 8px; align-items: center; min-height: 49px; padding: 12px 24px; border-top: 1px solid #303741; background: #171b20; flex-shrink: 0; }
.settings-save-indicator { width: 5px; height: 5px; border-radius: 50%; background: #6d9a7e; flex-shrink: 0; }
.settings-footer p { font-size: 10px; color: #82958c; margin: 0; flex: 1; }
.settings-escape { color: #566575; font-size: 9px; }

/* Personal display preferences */
body.compact-mode .channel-entry { padding-top: 5px; padding-bottom: 5px; }
body.compact-mode .message { padding-top: 6px; padding-bottom: 6px; gap: 10px; }
body.compact-mode .message-avatar { width: 29px; height: 29px; min-width: 29px; font-size: 10px; border-radius: 8px; }
body.compact-mode .message-text { line-height: 1.5; font-size: 12px; }
body.compact-mode .member-card { padding-top: 5px; padding-bottom: 5px; }
body.compact-mode .sidebar-tip { display: none; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media(prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Small screens */
@media(max-width: 1100px) {
  .app-shell, .app-shell.hide-members { grid-template-columns: 62px 218px minmax(0, 1fr); }
  .members-sidebar { display: none; }
  .app-shell.show-members { grid-template-columns: 62px 218px minmax(0, 1fr) 195px; }
  .app-shell.show-members .members-sidebar { display: flex; }
  .channel-description { max-width: 130px; }
  .media-controls { gap: 6px; padding: 12px; }
  .media-controls button { padding: 8px 9px; }
  .media-layout.has-focus { grid-template-columns: minmax(0, 1fr) 130px; }
  .call-heading { gap: 5px 8px; }
  #call-count, .live-marker { display: none; }
}
@media(max-width: 760px) {
  .app-shell, .app-shell.hide-members, .app-shell.show-members { grid-template-columns: 56px minmax(0, 1fr); }
  .server-rail { grid-column: 1; grid-row: 1; padding-top: 13px; gap: 10px; }
  .home-icon, .rail-add, .rail-join, .server-dot { width: 36px; height: 36px; flex-basis: 36px; border-radius: 11px; font-size: 12px; }
  .server-dot.active::before { left: -10px; }
  .home-icon .ui-icon { width: 21px; height: 21px; }
  .channel-sidebar { display: none; position: absolute; z-index: 5; left: 56px; top: 0; bottom: 0; width: min(260px, calc(100vw - 56px)); box-shadow: 10px 0 30px #0007; }
  .app-shell.menu-open .channel-sidebar { display: flex; }
  .chat-column { grid-column: 2; grid-row: 1; }
  .members-sidebar, .app-shell.show-members .members-sidebar { display: none; }
  .mobile-only { display: grid; }
  .members-toggle { display: none; }
  .chat-header { padding: 0 12px; gap: 8px; height: 57px; min-height: 57px; }
  .channel-description, .live-marker { display: none; }
  .chat-header strong { font-size: 12px; }
  .hash-icon { font-size: 19px; }
  .message-list { padding: 18px 14px 8px; }
  .chat-welcome h2 { font-size: 22px; }
  .composer-wrap { padding: 10px; }
  .composer-hint { display: none; }
  .auth-brand { left: 21px; top: 24px; font-size: 13px; }
  .auth-brand small { display: none; }
  .auth-panel { padding: 29px 24px; }
  .media-stage { min-height: 240px; }
  .media-stage-header { padding: 12px 10px; gap: 7px; align-items: flex-start; }
  .call-heading { flex-direction: column; align-items: flex-start; gap: 2px; }
  .call-heading strong { font-size: 11px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .call-heading > span { font-size: 9px; }
  .call-heading .stream-quality-badge { font-size: 7px; padding: 2px 4px; }
  .call-view-actions { gap: 4px; }
  .call-view-actions button { padding: 6px 7px; min-height: 31px; gap: 4px; font-size: 9px; }
  .call-view-actions .ui-icon { width: 12px; height: 12px; }
  .media-layout { padding: 0 7px; gap: 7px; }
  .media-grid { grid-template-columns: repeat(auto-fit, minmax(min(135px, 100%), 1fr)); gap: 7px; }
  .media-layout.has-focus { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 82px; }
  .media-layout.single-tile { grid-template-rows: minmax(0, 1fr); }
  .has-focus .media-grid { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .has-focus .media-grid .media-tile { width: 126px; height: 72px; min-height: 0; flex: 0 0 126px; }
  .media-caption { font-size: 9px; }
  .media-controls { padding: 10px 8px 12px; gap: 6px; }
  .media-controls button { font-size: 9px; padding: 8px 9px; min-height: 35px; gap: 5px; }
  .media-controls .ui-icon { width: 14px; height: 14px; }
  .media-hint, .ptt-status { font-size: 9px; margin: 7px 7px 0; }
  .in-call > .chat-content { min-height: 80px; }
  .in-call .composer-wrap { padding: 7px; }
  .media-mic-status, .media-source { font-size: 7px; }
  .media-stage:fullscreen { padding: 0; }
  .settings-dialog { width: calc(100vw - 20px); height: calc(100dvh - 24px); max-height: calc(100dvh - 16px); border-radius: 13px; }
  .settings-header { padding: 20px 19px 18px; gap: 10px; }
  .settings-header h2 { font-size: 23px; }
  .settings-header p { font-size: 10px; }
  .eyebrow { font-size: 7px; letter-spacing: 1px; }
  .settings-layout { display: flex; flex-direction: column; }
  .settings-nav { flex-direction: row; gap: 6px; padding: 11px 14px; border-right: 0; border-bottom: 1px solid #303741; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
  .settings-nav button { justify-content: center; min-height: 36px; padding: 8px 9px; font-size: 10px; gap: 6px; flex: 1; }
  .settings-nav button .ui-icon { width: 14px; height: 14px; }
  .settings-content { padding: 21px 19px 25px; flex: 1; }
  .settings-section-title { margin-bottom: 22px; }
  .settings-section-title h3 { font-size: 17px; }
  .settings-section-title p { font-size: 10px; }
  .settings-field-grid { gap: 12px; }
  .settings-field label { font-size: 8px; }
  #media-settings select { padding: 10px 8px; font-size: 10px; }
  .shortcut-row { padding: 12px; gap: 12px; }
  .shortcut-row p { font-size: 9px; }
  .shortcut-button { min-width: 76px; padding: 8px; font-size: 10px; }
  .shortcut-button .ui-icon { width: 13px; height: 13px; }
  #media-settings .switch-row { gap: 16px; padding: 14px 0; }
  .switch-row strong { font-size: 10px; }
  .switch-row small { font-size: 9px; }
  .settings-footer { padding: 12px 19px; }
  .settings-footer p { font-size: 9px; }
  .settings-escape { display: none; }
  .stream-preview { padding: 21px 15px; }
  .stream-preview > strong { font-size: 23px; }
}
@media(max-width: 370px) {
  .call-view-actions button .ui-icon { display: none; }
  .call-view-actions button { padding-left: 6px; padding-right: 6px; }
  .settings-nav button { gap: 4px; padding: 8px 6px; font-size: 9px; }
  .settings-nav button .ui-icon { width: 12px; height: 12px; }
  .settings-field-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media(max-height: 520px) and (min-width: 761px) {
  .media-stage-header { padding: 7px 12px; }
  .media-hint { display: none; }
  .media-controls { padding: 8px; }
  .media-controls button { min-height: 30px; padding: 5px 8px; }
  .media-stage { min-height: 150px; }
  .settings-dialog { height: calc(100dvh - 24px); }
  .settings-header { padding: 14px 23px; }
  .settings-header h2 { font-size: 21px; margin-top: 3px; }
  .settings-header p { display: none; }
}
