﻿:root {
  --bg-rail: #1e1f22;
  --bg-side: #2b2d31;
  --bg-main: #313338;
  --bg-panel: #232428;
  --bg-input: #383a40;
  --bg-tile: #1e1f22;
  --hover: #35373c;
  --active: #404249;
  --text: #dbdee1;
  --muted: #949ba4;
  --header: #f2f3f5;
  --blurple: #5865f2;
  --blurple-dark: #4752c4;
  --green: #23a55a;
  --red: #da373c;
  --border: #1f2023;
  --font: "gg sans", "Noto Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-main);
  color: var(--text);
  font: 16px/1.375 var(--font);
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg { display: block; flex-shrink: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- login ---------- */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 20% 20%, #5865f2 0, transparent 45%),
              radial-gradient(circle at 80% 80%, #eb459e 0, transparent 40%), #404eed;
  padding: 16px;
}
.login-card {
  width: 100%; max-width: 440px; background: var(--bg-main); border-radius: 8px;
  padding: 32px; box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0; text-align: center; color: var(--header); font-size: 24px; }
.login-card .sub { margin: 8px 0 20px; text-align: center; color: var(--muted); }
.login-card label { display: block; font-size: 12px; font-weight: 700; color: #b5bac1; margin: 16px 0 8px; letter-spacing: .02em; }
.login-card .req { color: #f23f43; }
.login-card input {
  width: 100%; padding: 10px; border-radius: 4px; border: 0; background: #1e1f22;
  color: var(--text); font: inherit; outline: none;
}
.error { color: #fa777c; font-size: 14px; min-height: 20px; margin: 8px 0 0; }
.btn-primary {
  width: 100%; margin-top: 12px; padding: 12px; border-radius: 4px; background: var(--blurple);
  color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--blurple-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.switch-mode { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.switch-mode a { color: #00a8fc; text-decoration: none; }
.switch-mode a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: 72px 240px minmax(0, 1fr) 240px;
  /* Pin the single row to the window height; without this a long chat
     stretches the row and pushes the composer/user panel off-screen. */
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.app > * { min-height: 0; }
@media (max-width: 1000px) { .app { grid-template-columns: 72px 240px minmax(0, 1fr); } .members { display: none; } }
@media (max-width: 640px)  { .app { grid-template-columns: 0 200px minmax(0, 1fr); } .rail { display: none; } }

/* ---------- rail ---------- */
.rail { background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; }
.rail-item {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-main); color: var(--text); font-weight: 600; font-size: 18px;
  transition: border-radius .15s, background .15s; position: relative; cursor: pointer; user-select: none;
}
.rail-item:hover, .rail-item.active { border-radius: 16px; background: var(--blurple); color: #fff; }
.rail-item.active::before {
  content: ""; position: absolute; left: -16px; width: 8px; height: 40px; border-radius: 0 4px 4px 0; background: #fff;
}
.rail-item.download { margin-top: auto; background: var(--bg-main); color: var(--green); text-decoration: none; }
.rail-item.download:hover { background: var(--green); color: #fff; }
.rail-sep { width: 32px; height: 2px; background: var(--hover); border-radius: 1px; }

/* ---------- sidebar ---------- */
.sidebar { background: var(--bg-side); display: flex; flex-direction: column; min-width: 0; }
.server-header {
  height: 48px; padding: 0 16px; display: flex; align-items: center; font-weight: 600; color: var(--header);
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(0,0,0,.2); flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-list { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.category {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 4px 8px;
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em;
}
.category button { color: var(--muted); padding: 0; }
.category button:hover { color: var(--text); }
.channel {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin: 1px 0; border-radius: 4px;
  color: var(--muted); cursor: pointer; user-select: none; font-weight: 500;
}
.channel:hover { background: var(--hover); color: #dbdee1; }
.channel.active { background: var(--active); color: #fff; }
.channel.unread { color: #fff; font-weight: 600; }
.channel .hash { font-size: 20px; width: 20px; text-align: center; line-height: 1; opacity: .8; }
.channel .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.voice-members { padding-left: 32px; }
.voice-member {
  display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 4px; color: var(--muted);
  font-size: 14px; cursor: default;
}
.voice-member:hover { background: var(--hover); color: var(--text); }
.voice-member .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-member .state-icons { display: flex; gap: 2px; color: var(--muted); }
.live-badge {
  background: #ed4245; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 8px; letter-spacing: .02em;
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-weight: 600; font-size: 14px; user-select: none; transition: box-shadow .1s;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.speaking .avatar, .avatar.speaking { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 4px var(--green); }

.voice-panel {
  display: flex; align-items: center; gap: 4px; padding: 8px; background: var(--bg-panel);
  border-bottom: 1px solid #2e2f34;
}
.voice-panel-info { flex: 1; min-width: 0; }
.voice-status { color: var(--green); font-weight: 600; font-size: 14px; }
.voice-channel-name { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-panel { display: flex; align-items: center; gap: 2px; padding: 8px; background: var(--bg-panel); height: 52px; }
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; color: var(--header); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-status { font-size: 12px; color: var(--muted); }
.icon-btn { width: 32px; height: 32px; border-radius: 4px; display: grid; place-items: center; color: #b5bac1; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.off { color: #f23f43; }
.icon-btn.on { color: var(--green); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg-main); }
.main-header {
  height: 48px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(0,0,0,.2); font-weight: 600; color: var(--header);
}
.main-header .hash { color: var(--muted); font-size: 24px; font-weight: 400; }
.main-header svg { color: var(--muted); }

.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; }
.welcome { padding: 16px; margin-bottom: 8px; }
.welcome .big-hash {
  width: 68px; height: 68px; border-radius: 50%; background: #41434a; display: grid; place-items: center;
  font-size: 42px; color: #fff; margin-bottom: 8px;
}
.welcome h2 { margin: 0 0 4px; font-size: 32px; color: var(--header); }
.welcome p { margin: 0; color: var(--muted); }

.msg { display: flex; gap: 16px; padding: 2px 16px 2px 16px; margin-top: 17px; position: relative; }
.msg:hover { background: #2e3035; }
.msg.grouped { margin-top: 0; padding-left: 72px; }
.msg .avatar { width: 40px; height: 40px; font-size: 16px; margin-top: 2px; }
.msg-content { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head .author { font-weight: 500; }
.msg-head .time, .msg .hover-time { font-size: 12px; color: var(--muted); }
.msg .hover-time { position: absolute; left: 16px; width: 44px; text-align: center; top: 5px; font-size: 11px; display: none; }
.msg.grouped:hover .hover-time { display: block; }
.msg-body { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; color: var(--text); }
.msg-body a { color: #00a8fc; text-decoration: none; }
.msg-body a:hover { text-decoration: underline; }
.msg-body code { background: #2b2d31; padding: 1px 4px; border-radius: 4px; font-family: Consolas, monospace; font-size: 85%; }
.msg-body pre { background: #2b2d31; border: 1px solid #1e1f22; padding: 8px; border-radius: 4px; margin: 4px 0; overflow-x: auto; white-space: pre; }
.msg-body pre code { background: none; padding: 0; }
.msg-body img.embed { display: block; max-width: min(400px, 100%); max-height: 300px; border-radius: 8px; margin-top: 4px; }

.composer { padding: 0 16px; }
.composer textarea {
  width: 100%; resize: none; border: 0; outline: none; border-radius: 8px; background: var(--bg-input);
  color: var(--text); font: inherit; padding: 11px 16px; max-height: 50vh; display: block;
}
.composer textarea::placeholder { color: #6d6f78; }
.typing { height: 24px; padding: 2px 16px; font-size: 13px; color: var(--text); }
.typing b { font-weight: 700; }

/* ---------- voice view ---------- */
.voice-view { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #000; }
.voice-grid {
  flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 8px; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.voice-grid.has-focus { align-content: start; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.tile {
  position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg-tile);
  display: grid; place-items: center; outline: 2px solid transparent; transition: outline-color .1s;
}
.tile.speaking { outline-color: var(--green); }
.tile .avatar { width: 80px; height: 80px; font-size: 32px; box-shadow: none !important; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile.screen { cursor: pointer; }
.tile.focused { grid-column: 1 / -1; aspect-ratio: auto; height: 70vh; min-height: 240px; }
.tile .label {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 13px; font-weight: 500; padding: 3px 8px; border-radius: 4px; max-width: calc(100% - 16px);
}
.tile .label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .label .muted-icon { color: #f23f43; }
.tile .waiting-text { position: absolute; color: var(--muted); font-size: 14px; }
.tile .tile-actions { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.tile:hover .tile-actions { display: flex; }
.tile .tile-actions button { background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; width: 32px; height: 32px; display: grid; place-items: center; }

.voice-controls { display: flex; justify-content: center; gap: 16px; padding: 20px; }
.round-btn {
  width: 56px; height: 56px; border-radius: 50%; background: #2b2d31; color: #fff; display: grid; place-items: center;
}
.round-btn:hover { background: #3a3c42; }
.round-btn.off { background: #fff; color: #1e1f22; }
.round-btn.on { background: var(--green); }
.round-btn.danger { background: var(--red); }
.round-btn.danger:hover { background: #a12828; }

/* ---------- members ---------- */
.members { background: var(--bg-side); overflow-y: auto; padding: 16px 8px; }
.members h3 { margin: 8px 8px 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.member { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 4px; color: var(--muted); }
.member:hover { background: var(--hover); color: var(--text); }
.member { cursor: pointer; }
.member.offline { opacity: .4; }
.member.offline:hover { opacity: 1; }
.member .name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.crown { color: #f0b232; display: inline-flex; flex-shrink: 0; }
/* online dot on avatars (member list, DM list, profile card) */
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-wrap.online::after {
  content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 3px solid var(--bg-side);
}
.clickable { cursor: pointer; }
.msg-head .author.clickable:hover, .main-header .clickable:hover { text-decoration: underline; }
.member .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.member .activity { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* ---------- direct messages ---------- */
.rail-item .badge {
  position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #f23f43; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
  border: 3px solid var(--bg-rail);
}
.dm-row { padding: 5px 8px; gap: 10px; }
.dm-row .avatar-wrap.online::after { width: 8px; height: 8px; border-width: 2px; }
.dm-row .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.dm-empty { padding: 8px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.home-view { flex: 1; display: grid; place-items: center; padding: 16px; }
.home-empty { max-width: 420px; text-align: center; color: var(--muted); }
.home-empty h2 { color: var(--header); margin: 12px 0 8px; }
.home-empty-icon { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; background: var(--bg-side);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23949ba4' d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
  background-size: 44px; background-repeat: no-repeat; background-position: center; }
.welcome .avatar.xl { margin-bottom: 8px; }

/* ---------- profile popout ---------- */
.profile-popout {
  position: fixed; z-index: 45; width: 300px; border-radius: 8px; overflow: hidden;
  background: #232428; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.popout-banner { height: 60px; }
.popout-avatar { margin: -40px 0 0 16px; width: max-content; border: 6px solid #232428; border-radius: 50%; }
.popout-avatar .avatar-wrap.online::after { width: 16px; height: 16px; border: 4px solid #232428; right: 0; bottom: 0; }
.popout-body { margin: 8px 16px 16px; padding: 12px; border-radius: 8px; background: #111214; }
.popout-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 20px; font-weight: 600; color: var(--header); }
.role-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; background: #2b2d31; color: #f0b232; font-size: 12px; font-weight: 600; }
.popout-status { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #80848e; }
.status-dot.on { background: var(--green); }
.popout-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid #2e2f34; font-size: 14px; }
.popout-section .field-label { margin-bottom: 4px; }
.popout-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.popout-bio .muted { color: var(--muted); font-style: italic; }
.popout-btn { width: 100%; margin-top: 12px; }
.popout-message input {
  width: 100%; margin-top: 12px; padding: 9px 10px; border: 0; border-radius: 4px; outline: none;
  background: #1e1f22; color: var(--text); font: inherit; font-size: 14px;
}

/* About Me editor (settings) */
.bio-input {
  width: 100%; padding: 10px; border: 0; border-radius: 4px; outline: none; resize: vertical;
  background: #1e1f22; color: var(--text); font: inherit;
}
.bio-footer { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.bio-footer #bio-count { color: var(--muted); font-size: 12px; margin-right: auto; }
.bio-footer .form-status { margin: 0; }
.preview-bio { margin: 8px 16px 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }

/* ---------- "new version" banner ---------- */
.update-banner {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-shrink: 0;
  padding: 6px 16px; background: var(--blurple); color: #fff; font-size: 14px; font-weight: 500;
}
.update-banner .btn { background: #fff; color: var(--blurple); padding: 4px 12px; }
.update-banner .btn:hover { background: #e3e5e8; }

/* ---------- message actions / editing ---------- */
.msg-actions {
  position: absolute; top: -16px; right: 16px; z-index: 2; display: none; gap: 2px; padding: 2px;
  background: var(--bg-main); border: 1px solid #26272b; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.msg:hover .msg-actions { display: flex; }
.msg-actions button { width: 32px; height: 28px; border-radius: 4px; display: grid; place-items: center; color: #b5bac1; }
.msg-actions button:hover { background: var(--hover); color: var(--text); }
.msg-actions button.danger:hover { color: #f23f43; }
.messages .msg:first-of-type .msg-actions, .welcome + .msg .msg-actions { top: 0; }
.edited { margin-left: 4px; font-size: 11px; color: var(--muted); user-select: none; }
.edit-box {
  width: 100%; margin-top: 4px; padding: 10px 12px; border: 0; border-radius: 8px; outline: none; resize: none;
  background: var(--bg-input); color: var(--text); font: inherit; display: block; max-height: 50vh;
}
.edit-hint { margin: 4px 0 2px; font-size: 12px; color: var(--muted); white-space: normal; }
.edit-hint a { color: #00a8fc; text-decoration: none; }
.edit-hint a:hover { text-decoration: underline; }

/* channel gear (admins) */
.channel-edit { margin-left: auto; display: none; color: var(--muted); padding: 0; }
.channel:hover .channel-edit, .channel.active .channel-edit { display: grid; }
.channel-edit:hover { color: var(--text); }

/* context menu items */
.context-menu .menu-title { font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 8px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-menu .menu-item { display: block; width: 100%; text-align: left; padding: 7px 8px; border-radius: 3px; color: #dbdee1; font-size: 14px; }
.context-menu .menu-item:hover { background: var(--blurple); color: #fff; }
.context-menu .menu-item.danger { color: #f23f43; }
.context-menu .menu-item.danger:hover { background: var(--red); color: #fff; }

/* modal dialog */
.modal-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.7); }
.modal { width: 100%; max-width: 440px; background: var(--bg-main); border-radius: 8px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.modal h2 { margin: 0; padding: 20px 16px 0; font-size: 20px; color: var(--header); }
.modal-message { padding: 12px 16px 4px; color: #dbdee1; }
.modal .field-label { padding: 0 16px; margin-top: 16px; }
.modal-input { display: flex; align-items: center; gap: 6px; margin: 0 16px; padding: 0 10px; border-radius: 4px; background: #1e1f22; }
.modal-input span { color: var(--muted); font-size: 18px; }
.modal-input input { flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: none; background: none; color: var(--text); font: inherit; }
.modal-preview {
  display: flex; gap: 12px; margin: 12px 0 0; padding: 12px; border-radius: 4px; background: #2b2d31;
  box-shadow: 0 0 0 1px #1e1f22; max-height: 200px; overflow: hidden;
}
.modal-preview .avatar { width: 40px; height: 40px; }
.modal-preview .author { font-weight: 500; }
.modal-tip { margin-top: 12px; font-size: 12px; color: var(--muted); }
.modal-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding: 16px; background: var(--bg-side); }
.btn-link { padding: 8px 16px; color: #fff; font-size: 14px; }
.btn-link:hover { text-decoration: underline; }
.btn.btn-danger { background: var(--red); }
.btn.btn-danger:hover { background: #a12828; }

/* ---------- settings ---------- */
.settings { position: fixed; inset: 0; z-index: 40; display: flex; background: var(--bg-main); }
.settings-sidebar { flex: 1 0 218px; display: flex; justify-content: flex-end; background: var(--bg-side); overflow-y: auto; }
.settings-sidebar nav { width: 218px; padding: 60px 6px 60px 20px; }
.settings-heading { padding: 6px 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.settings-heading:not(:first-child) { margin-top: 12px; }
.settings-tab {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; margin-bottom: 2px;
  border-radius: 4px; color: #b5bac1; cursor: pointer; font-weight: 500;
}
.settings-tab:hover { background: var(--hover); color: var(--text); }
.settings-tab.active { background: var(--active); color: #fff; }
.settings-tab.danger { color: #f23f43; }
.settings-sep { height: 1px; margin: 8px 10px; background: #3f4147; }
.settings-version { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.settings-content { flex: 1 1 800px; display: flex; overflow-y: auto; }
.settings-inner { flex: 1; max-width: 740px; min-width: 0; padding: 60px 40px 80px; }
.settings-close { padding-top: 60px; width: 72px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.settings-close button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; color: var(--muted); }
.settings-close button:hover { border-color: var(--text); color: var(--text); background: var(--hover); }
.settings h2 { margin: 0 0 20px; color: var(--header); font-size: 20px; }
.settings h3 { margin: 0 0 12px; color: var(--header); font-size: 16px; }
.settings-divider { height: 1px; background: #3f4147; margin: 32px 0; }
.field-label { display: block; margin: 0 0 8px; font-size: 12px; font-weight: 700; color: #b5bac1; text-transform: uppercase; letter-spacing: .02em; }
.field-note { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.field-note a { color: #00a8fc; }
.field-note.warn { color: #f0b232; }
.settings input[type=password], .settings select {
  width: 100%; padding: 10px; margin-bottom: 16px; border: 0; border-radius: 4px; background: #1e1f22; color: var(--text); font: inherit; outline: none;
}
.settings select:disabled { opacity: .5; }
.settings-form { max-width: 440px; }
.form-status { min-height: 20px; margin: 0 0 12px; font-size: 14px; }
.form-status.error { color: #fa777c; }
.form-status.ok { color: var(--green); }
span.form-status { margin-left: 12px; }
.btn { padding: 8px 16px; border-radius: 4px; background: #4e5058; color: #fff; font-weight: 500; font-size: 14px; }
.btn:hover { background: #6d6f78; }
.btn-brand { background: var(--blurple); }
.btn-brand:hover { background: var(--blurple-dark); }
.btn-danger-outline { background: none; border: 1px solid var(--red); color: #fff; }
.btn-danger-outline:hover { background: var(--red); }
.btn.recording { background: var(--red); }

.account-card { background: #1e1f22; border-radius: 8px; overflow: hidden; }
.account-banner { height: 100px; }
.account-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px; margin-top: -38px; }
.account-avatar { border: 7px solid #1e1f22; border-radius: 50%; }
.account-name { flex: 1; font-size: 20px; font-weight: 600; color: var(--header); padding-bottom: 12px; }
.account-head .btn { margin-bottom: 16px; }
.account-fields { margin: 8px 16px 16px; padding: 16px; background: var(--bg-side); border-radius: 8px; }
.account-field .field-label { margin-bottom: 4px; }
.avatar.xl { width: 80px; height: 80px; font-size: 32px; }

.profile-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
@media (max-width: 900px) { .profile-layout { grid-template-columns: 1fr; } }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--bg-main) inset; }
.swatch.custom { display: grid; place-items: center; background: #4e5058; color: #fff; font-size: 22px; position: relative; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.profile-preview { background: #1e1f22; border-radius: 8px; overflow: hidden; padding-bottom: 16px; }
.profile-preview .account-banner { height: 60px; }
.preview-avatar { margin: -40px 0 0 16px; border: 6px solid #1e1f22; border-radius: 50%; width: max-content; }
.preview-name { margin: 8px 16px 0; font-size: 20px; font-weight: 600; }

.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mic-test { display: flex; align-items: center; gap: 16px; }
.meter { flex: 1; height: 10px; border-radius: 5px; background: #4e5058; overflow: hidden; }
.meter-fill { width: 0; height: 100%; background: var(--green); transition: width 60ms linear; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; border-radius: 4px; background: #2b2d31; cursor: pointer; }
.radio-row input { accent-color: var(--blurple); width: 18px; height: 18px; }
.ptt-box { margin-top: 16px; }
.keybind { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 440px; padding: 6px 6px 6px 12px; border-radius: 4px; background: #1e1f22; }
.keybind-value { font-weight: 600; color: var(--header); }

.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; cursor: pointer; }
.toggle-title { font-weight: 500; color: var(--header); }
.switch {
  appearance: none; flex-shrink: 0; width: 40px; height: 24px; border-radius: 12px; background: #80848e;
  position: relative; cursor: pointer; transition: background .15s; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(16px); }

@media (max-width: 700px) {
  .settings-sidebar { flex: 0 0 170px; }
  .settings-sidebar nav { width: 170px; padding: 24px 6px; }
  .settings-inner { padding: 24px 16px; }
  .settings-close { padding-top: 24px; width: 52px; }
  .device-grid { grid-template-columns: 1fr; }
}

/* ---------- misc ---------- */
.context-menu {
  position: fixed; z-index: 50; background: #111214; border-radius: 4px; padding: 8px 12px; min-width: 200px;
  box-shadow: 0 8px 16px rgba(0,0,0,.4); font-size: 14px;
}
.context-menu label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.context-menu input[type=range] { width: 100%; accent-color: var(--blurple); }
.context-menu .value { text-align: right; color: var(--muted); font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: #111214; color: var(--text); padding: 12px 16px; border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,.4);
}
