:root {
  --bg-darkest: #1e1f22;
  --bg-dark: #2b2d31;
  --bg-mid: #313338;
  --bg-light: #383a40;
  --bg-hover: #3f4147;
  --text: #dcddde;
  --text-muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #3ba55c;
  --green-hover: #2d7d46;
  --red: #ed4245;
  --red-hover: #c62d30;
  --border: #26282c;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body[data-theme="light"] {
  --bg-darkest: #f2f3f5;
  --bg-dark: #ffffff;
  --bg-mid: #f5f5f5;
  --bg-light: #ebebeb;
  --bg-hover: #e3e3e3;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --border: #dcdcdc;
}
html, body { height: 100%; margin: 0; background: var(--bg-darkest); color: var(--text); overflow: hidden; }

body, body * { user-select: none; -webkit-user-select: none; }
input, textarea { user-select: text; -webkit-user-select: text; }
body.compact .message { padding: 2px 0 !important; }
body.font-small { font-size: 13px; }
body.font-medium { font-size: 15px; }
body.font-large { font-size: 17px; }
button { font-family: inherit; cursor: pointer; border: none; }
input, select { font-family: inherit; }
.hidden { display: none !important; }

#authView {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #23252b, var(--bg-darkest));
}
.auth-card {
  background: var(--bg-dark); border-radius: 10px; padding: 32px; width: 380px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
.auth-logo { display:flex; align-items:center; gap:10px; margin-bottom: 18px; }
.auth-logo .logo-box { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); display:flex; align-items:center; justify-content:center; font-weight:700; color:#fff; }
.auth-logo span { font-size: 20px; font-weight: 700; }
.auth-card h2 { margin: 0 0 4px; font-size: 20px; }
.auth-card p.sub { color: var(--text-muted); margin: 0 0 20px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display:block; font-size:12px; font-weight:700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-mid); color: var(--text); outline: none; }
.field input:focus { border-color: var(--accent); }
.btn { padding: 10px 16px; border-radius: 6px; font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-hover); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-block { width: 100%; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-muted); text-align: center; }
.auth-switch a { color: #7289da; cursor: pointer; text-decoration: none; }
.auth-error { background: rgba(237,66,69,.15); border: 1px solid var(--red); color: #ff9a9c; padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.auth-suggestions { display:flex; gap:8px; flex-wrap: wrap; margin: 8px 0 4px; }
.auth-suggestions button { background: var(--bg-light); color: var(--text); padding: 6px 10px; border-radius: 14px; font-size: 12px; }
.auth-suggestions button:hover { background: var(--bg-hover); }

#appView { display: flex; height: 100%; }
.rail {
  width: 72px; background: var(--bg-darkest); display: flex; flex-direction: column;
  align-items: center; padding: 12px 0; gap: 8px; flex-shrink: 0; border-right: 1px solid var(--border);
}
.rail-scroll { display:flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; width: 100%; align-items:center; }
.rail-item {
  width: 48px; height: 48px; border-radius: 24px; background: var(--bg-dark); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-weight: 700; transition: all .15s;
  position: relative; overflow: hidden;
}
.rail-item img { width: 100%; height: 100%; object-fit: cover; }
.rail-item:hover, .rail-item.active { border-radius: 16px; background: var(--accent); color:#fff; }
.rail-item.active { box-shadow: 0 0 0 2px var(--bg-darkest), 0 0 0 4px var(--accent); }
.rail-item.logo { background: var(--accent); border-radius: 16px; color: #fff; }
.rail-item.green:hover { background: var(--green); }
.rail-sep { width: 32px; height: 2px; background: var(--border); border-radius: 1px; margin: 2px 0; }
.rail-bottom { display:flex; flex-direction:column; gap:8px; align-items:center; }

.panel { width: 240px; background: var(--bg-dark); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid var(--border); }
.panel-header { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--border); display:flex; align-items:center; gap: 8px; }
.panel-body { flex: 1; overflow-y: auto; padding: 8px; }
.panel-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 12px 8px 6px; }
.panel-list-item { display:flex; align-items:center; gap: 10px; padding: 8px; border-radius: 6px; color: var(--text-muted); }
.panel-list-item:hover, .panel-list-item.active { background: var(--bg-hover); color: var(--text); cursor:pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; flex-shrink:0; overflow:hidden; }
.avatar img { width:100%; height:100%; object-fit:cover; }
.avatar.lg { width: 80px; height: 80px; font-size: 24px; }

.panel-footer { padding: 8px; background: var(--bg-mid); display:flex; align-items:center; gap: 8px; }
.panel-footer .who { flex: 1; overflow: hidden; }
.panel-footer .who .name { font-size: 13px; font-weight: 600; }
.panel-footer .who .tag { font-size: 11px; color: var(--text-muted); }
.icon-btn { width: 30px; height: 30px; border-radius: 6px; background: transparent; color: var(--text-muted); display:flex; align-items:center; justify-content:center; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.active { background: var(--red); color: #fff; }
#voiceBar .icon-btn { font-size: 16px; width: 34px; height: 34px; }

.main { flex: 1; display: flex; flex-direction: column; background: var(--bg-mid); min-width: 0; }
.main-header { padding: 0 16px; height: 48px; display:flex; align-items:center; gap: 10px; border-bottom: 1px solid var(--border); font-weight: 700; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.main-header .count { background: var(--bg-hover); border-radius: 10px; padding: 2px 8px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.main-body { flex: 1; overflow-y: auto; padding: 16px; }
.empty-state { height: 100%; display:flex; flex-direction:column; align-items:center; justify-content:center; color: var(--text-muted); gap: 10px; text-align:center; }
.empty-state svg { opacity: .5; }

.member-list { width: 240px; background: var(--bg-dark); border-left: 1px solid var(--border); flex-shrink:0; padding: 12px 8px; overflow-y:auto; }
.member-list-title { font-size: 11px; font-weight:700; text-transform:uppercase; color: var(--text-muted); padding: 6px 8px; }

.message { display:flex; gap: 12px; padding: 6px 8px; border-radius: 4px; position: relative; }
.message:hover { background: rgba(255,255,255,0.03); }
.message:hover .msg-actions { opacity: 1; }
.message .avatar { margin-top: 2px; }
.message .content { flex: 1; min-width: 0; }
.message .meta { font-size: 13px; margin-bottom: 2px; }
.message .meta .author { font-weight: 700; margin-right: 8px; }
.message .meta .time { font-size: 11px; color: var(--text-muted); }
.message .meta .edited-tag { font-size: 10px; color: var(--text-muted); margin-left: 6px; font-style: italic; }
.message .text { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.msg-actions {
  position: absolute; top: -14px; right: 8px; display: flex; gap: 2px;
  background: var(--bg-dark); border: 1px solid var(--border); border-radius: 6px;
  padding: 2px; opacity: 0; transition: opacity .1s;
}
.msg-actions .icon-btn { width: 26px; height: 26px; font-size: 13px; }
.composer { padding: 8px 16px 16px; display:flex; align-items:flex-end; gap:8px; position:relative; }
.composer textarea {
  flex: 1; width: 100%; background: var(--bg-light); border: none; border-radius: 8px; padding: 12px 14px;
  color: var(--text); outline:none; font-family: inherit; font-size: inherit; resize: none; max-height: 160px; line-height: 1.4;
}
.composer .icon-btn { flex-shrink:0; margin-bottom: 2px; font-size: 18px; }

.panel-list-item.unread { color: var(--text); font-weight: 700; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; flex-shrink: 0; margin-left: auto; }
.rail-item.unread::after {
  content: ''; position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
}

.header-search { position: relative; }
.header-search input {
  width: 170px; background: var(--bg-mid); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; color: var(--text); outline: none;
}
.header-search input:focus { border-color: var(--accent); width: 220px; transition: width .15s; }
.header-search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 320px; max-height: 320px; overflow-y: auto;
  background: var(--bg-dark); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 40;
}
.header-search-result { padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.header-search-result:last-child { border-bottom: none; }
.header-search-result:hover { background: var(--bg-hover); }
.header-search-result .hsr-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.header-search-result .hsr-text { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-search-result mark { background: rgba(88,101,242,.4); color: inherit; border-radius: 2px; }

#dropOverlay {
  position: absolute; inset: 0; background: rgba(88,101,242,.14); border: 3px dashed var(--accent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; z-index: 30; pointer-events: none;
}
.drop-overlay-inner { background: var(--bg-dark); padding: 14px 22px; border-radius: 8px; font-weight: 700; color: var(--text); }

#typingIndicator { padding: 0 16px; height: 20px; font-size: 12px; color: var(--text-muted); font-style: italic; overflow: hidden; }

#mentionAutocomplete {
  position: absolute; bottom: calc(100% + 6px); left: 16px; width: 260px; max-height: 220px; overflow-y: auto;
  background: var(--bg-dark); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 40;
}
.mention-option { display:flex; align-items:center; gap:8px; padding: 7px 10px; cursor: pointer; }
.mention-option:hover, .mention-option.active { background: var(--bg-hover); }
.mention-option .avatar { width: 22px; height: 22px; font-size: 10px; }

.message .text code { background: var(--bg-light); border-radius: 4px; padding: 1px 5px; font-family: "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.message .text pre { background: var(--bg-darkest); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; overflow-x: auto; margin: 4px 0; }
.message .text pre code { background: none; padding: 0; }
.message .text a { color: #7cb0ff; text-decoration: underline; }
.message .text .mention { background: rgba(88,101,242,.28); color: #c9d0ff; border-radius: 4px; padding: 0 3px; font-weight: 600; }
.message .text .mention.mention-self { background: rgba(88,101,242,.55); color: #fff; }
.message.pinned { background: rgba(255,255,255,0.025); }
.message .pin-tag { font-size: 10px; color: var(--text-muted); margin-left: 6px; }
.msg-attachment { max-width: 320px; max-height: 320px; border-radius: 8px; margin-top: 6px; display: block; cursor: zoom-in; }
.msg-reactions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.reaction-pill {
  display:flex; align-items:center; gap: 4px; background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 7px; font-size: 12px; cursor: pointer; color: var(--text);
}
.reaction-pill:hover { border-color: var(--accent); }
.reaction-pill.mine { background: rgba(88,101,242,.25); border-color: var(--accent); }
.emoji-popover {
  position: absolute; top: -40px; right: 40px; background: var(--bg-dark); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 6px; display:flex; gap: 2px; box-shadow: 0 4px 16px rgba(0,0,0,.4); z-index: 20;
}
.emoji-popover button { background: none; font-size: 17px; padding: 3px 5px; border-radius: 6px; }
.emoji-popover button:hover { background: var(--bg-hover); }
.pinned-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.pinned-item:last-child { border-bottom: none; }
.pinned-item .pi-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.pinned-item .pi-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; z-index: 50; }
.modal { background: var(--bg-dark); border-radius: 8px; width: 440px; max-width: 92vw; overflow: hidden; }
.modal-header { padding: 16px 20px; display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { margin:0; font-size: 16px; display:flex; align-items:center; gap:8px; }
.close-x {
  color: var(--text-muted); font-size: 16px; background: none; border: none;
  width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
  cursor: pointer; pointer-events: auto; position: relative; z-index: 5; flex: none;
}
.close-x:hover { color: var(--text); background: rgba(255,255,255,.08); }
.close-x:active { background: rgba(255,255,255,.14); }
.modal-body { padding: 0 20px 20px; }
.modal-body label { display:block; font-size:12px; font-weight:700; text-transform:uppercase; color: var(--text-muted); margin-bottom: 6px; }
.modal-body input { width: 100%; padding: 10px 12px; border-radius: 4px; border: none; background: var(--bg-mid); color: var(--text); outline:none; margin-bottom: 6px; }
.modal-footer { padding: 12px 20px; background: var(--bg-mid); display:flex; justify-content:flex-end; gap: 10px; }
.error-text { color: #ff9a9c; font-size: 12px; margin-top: 4px; }

#settingsOverlay { position: fixed; inset:0; background: var(--bg-darkest); z-index: 60; display:flex; }
.settings-sidebar { width: 220px; background: var(--bg-dark); padding: 60px 8px 20px; overflow-y:auto; }
.settings-sidebar .uid { padding: 0 12px 10px; color: var(--text-muted); font-size: 11px; text-align:right; }
.settings-nav-item { padding: 8px 10px; border-radius: 4px; color: var(--text-muted); font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text); cursor:pointer; }
.settings-nav-item.active { background: var(--bg-hover); color: var(--text); }
.settings-main { flex:1; padding: 60px 40px; overflow-y:auto; position:relative; }
.settings-main h2 { margin-top:0; }
.settings-close { position: absolute; top: 20px; right: 24px; width: 36px; height:36px; border-radius:50%; border:2px solid var(--text-muted); color: var(--text-muted); display:flex; align-items:center; justify-content:center; }
.settings-close:hover { color: var(--text); border-color: var(--text); }
.settings-card { background: var(--bg-mid); border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.settings-card.danger { border: 1px solid var(--red); background: rgba(237,66,69,.08); }
.settings-row { display:flex; align-items:center; justify-content:space-between; padding: 14px 0; border-top: 1px solid var(--border); }
.settings-row:first-child { border-top: none; padding-top: 0; }
.settings-row .rtext strong { display:block; margin-bottom: 2px; }
.settings-row .rtext span { color: var(--text-muted); font-size: 13px; }
.pillgroup { display:flex; gap: 8px; }
.pillgroup button { padding: 8px 16px; border-radius: 4px; background: var(--bg-light); color: var(--text); font-size: 14px; }
.pillgroup button.active { background: var(--accent); color: #fff; }
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--bg-light); position: relative; flex-shrink:0; }
.toggle.on { background: var(--green); }
.toggle .knob { position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; transition: left .15s; }
.toggle.on .knob { left: 20px; }
.settings-footer-save { position: fixed; bottom: 20px; left: 240px; right: 40px; background: var(--bg-darkest); border-radius: 8px; padding: 12px 16px; display:flex; align-items:center; justify-content:space-between; box-shadow: 0 4px 20px rgba(0,0,0,.4); }

.kl-confetti-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 99999; overflow: hidden;
}
.kl-confetti-piece {
  position: absolute; top: -18px; width: 8px; height: 14px; border-radius: 2px;
  animation: klConfettiFall 1000ms cubic-bezier(.18,.7,.25,1) forwards;
}
@keyframes klConfettiFall {
  0% { transform: translate3d(0,-20px,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); opacity: 0; }
}

#toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg-dark); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 6px; z-index: 999; box-shadow: 0 4px 16px rgba(0,0,0,.4); max-width: 320px; }
#toast.error { border-color: var(--red); }
#toast.success { border-color: var(--green); }

.profile-card {
  width: 480px; max-width: 94vw; height: min(680px, calc(100vh - 24px));
  min-height: 420px; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-dark); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55); animation: profileIn .18s ease-out;
}
@keyframes profileIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform:none; } }
.profile-cover { height: 170px; flex: 0 0 170px; position:relative; background: linear-gradient(135deg, var(--accent), var(--bg-light)); background-size: cover; background-position:center; }
.profile-cover:not(.has-banner) { background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,.12), transparent 35%), linear-gradient(135deg, var(--accent), var(--bg-darkest)); }
.profile-cover-gradient { position:absolute; inset:0; background:linear-gradient(to bottom, rgba(0,0,0,.02), rgba(0,0,0,.46)); pointer-events:none; }
.profile-close { position:absolute; top:12px; right:12px; width:34px; height:34px; border-radius:50%; background:rgba(0,0,0,.46) !important; color:#fff !important; display:flex; align-items:center; justify-content:center; z-index:5; backdrop-filter:blur(5px); }
.profile-close:hover { background:rgba(0,0,0,.72) !important; }
.profile-top {
  display:flex; align-items:flex-end; gap:14px; flex:0 0 102px; min-width:0;
  margin-top:-50px; padding:0 20px 10px; position:relative; z-index:4;
}
.profile-avatar-wrap { position:relative; flex-shrink:0; }
.profile-avatar-wrap .avatar { width:100px; height:100px; border:6px solid var(--bg-dark); font-size:28px; box-shadow:0 5px 18px rgba(0,0,0,.34); }
.profile-avatar-wrap .avatar img { display:block; width:100%; height:100%; object-fit:cover; border-radius:50%; }
.profile-online-dot { position:absolute; right:3px; bottom:5px; width:20px; height:20px; border-radius:50%; background:var(--green); border:4px solid var(--bg-dark); box-shadow:0 1px 5px rgba(0,0,0,.35); }
.profile-identity { min-width:0; padding-bottom:4px; flex:1; }
.profile-name-row { display:flex; align-items:center; gap:7px; min-width:0; flex-wrap:wrap; }
.profile-name { font-size:22px; font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.profile-tag { color:var(--text-muted); font-size:13px; margin-top:2px; }
.profile-status { color:var(--text); font-size:13px; margin-top:7px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.profile-status::before { content:'•'; color:var(--green); margin-right:6px; }
.verified-badge { width:19px; height:19px; flex:0 0 19px; border-radius:50%; background:#3b82f6; color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:900; box-shadow:0 1px 4px rgba(59,130,246,.35); }
.profile-bot-badge { font-size:9px; font-weight:800; letter-spacing:.5px; padding:3px 5px; border-radius:4px; background:var(--accent); color:#fff; }
.profile-content {
  flex:1 1 auto; min-height:0; padding:0 20px 20px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable;
}
.profile-content::-webkit-scrollbar { width:8px; }
.profile-content::-webkit-scrollbar-track { background:transparent; }
.profile-content::-webkit-scrollbar-thumb { background:var(--bg-light); border-radius:8px; border:2px solid var(--bg-dark); }
.profile-content::-webkit-scrollbar-thumb:hover { background:var(--bg-hover); }
.profile-badges { display:flex; flex-wrap:wrap; gap:7px; margin:0 0 2px; }
.profile-badge { display:flex; align-items:center; gap:6px; padding:6px 9px; border:1px solid var(--border); background:var(--bg-mid); border-radius:7px; color:var(--text); font-size:11px; font-weight:700; }
.profile-badge-icon { width:28px; height:28px; object-fit:contain; border-radius:50%; display:block; flex:0 0 28px; }
.profile-badge-emoji { width:28px; text-align:center; font-size:18px; line-height:28px; }
.profile-section { margin-top:18px; }
.profile-section-title { font-size:10px; font-weight:800; letter-spacing:.7px; color:var(--text-muted); margin-bottom:8px; }
.profile-about { color:var(--text); font-size:13px; line-height:1.55; white-space:pre-wrap; word-break:break-word; overflow-wrap:anywhere; background:var(--bg-mid); border:1px solid var(--border); border-radius:8px; padding:11px 12px; min-height:42px; }
.profile-about.empty { color:var(--text-muted); font-style:italic; }
.profile-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:18px; }
.profile-stat { background:var(--bg-mid); border:1px solid var(--border); border-radius:8px; padding:10px 6px; text-align:center; }
.profile-stat strong { display:block; font-size:17px; color:var(--text); }
.profile-stat span { display:block; margin-top:2px; font-size:10px; color:var(--text-muted); }
.profile-mutuals { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.profile-mutual { display:flex; align-items:center; gap:8px; min-width:0; padding:7px; background:var(--bg-mid); border:1px solid var(--border); border-radius:7px; cursor:pointer; transition:background .12s,border-color .12s,transform .12s; }
.profile-mutual:hover { background:var(--bg-hover); border-color:var(--accent); transform:translateY(-1px); }
.profile-mutual .avatar { width:30px; height:30px; font-size:10px; }
.profile-mutual-name { min-width:0; font-size:12px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-mutual-name span { color:var(--text-muted); font-weight:400; margin-left:3px; }
.profile-member-date { font-size:12px; color:var(--text); }
.profile-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; flex:0 0 auto; min-height:58px; padding:10px 20px; background:var(--bg-mid); border-top:1px solid var(--border); }
.profile-footer-note { color:var(--text-muted); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-setting-status { display:flex; align-items:center; gap:9px; background:var(--bg-mid); border:1px solid var(--border); border-radius:7px; padding:0 10px; }
.profile-setting-status input { margin:0 !important; padding:10px 0 !important; background:transparent !important; border:0 !important; }
.status-emoji { font-size:15px; }
.setting-hint { color:var(--text-muted); font-size:11px; margin:5px 0 8px; }
@media (max-width:520px) {
  .profile-card { width:calc(100vw - 20px); max-width:none; height:calc(100vh - 20px); min-height:360px; border-radius:12px; }
  .profile-cover { height:135px; flex-basis:135px; }
  .profile-top { flex-basis:94px; margin-top:-44px; padding:0 16px 8px; gap:11px; }
  .profile-avatar-wrap .avatar { width:88px; height:88px; border-width:5px; }
  .profile-name { font-size:20px; }
  .profile-content { padding:0 16px 16px; }
  .profile-mutuals { grid-template-columns:1fr; }
  .profile-footer { padding:10px 16px; }
}

.reveal-row { display: flex; align-items: center; gap: 8px; }
.eye-btn { background: none; color: var(--text-muted); width: 26px; height: 26px; border-radius: 4px; display:flex; align-items:center; justify-content:center; }
.eye-btn:hover { background: var(--bg-hover); color: var(--text); }

.video-tile-wrap { position: relative; cursor: pointer; }
.video-tile-wrap video {
  width: 480px; height: 300px; max-width: 90vw; max-height: 60vh;
  border-radius: 8px; background: #000; object-fit: contain; display: block;
  transition: all .15s;
}
.video-tile-wrap:only-child video { width: 720px; height: 450px; max-width: 92vw; max-height: 72vh; }
.video-tile-label { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.video-expand-btn {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 6px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.video-tile-wrap:hover .video-expand-btn { opacity: 1; }
.video-tile-wrap.expanded {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.94);
  display: flex; align-items: center; justify-content: center;
}
.video-tile-wrap.expanded video { width: 92vw; height: 88vh; max-width: none; max-height: none; object-fit: contain; border-radius: 0; }
.video-tile-wrap.expanded .video-expand-btn { opacity: 1; top: 20px; right: 20px; width: 40px; height: 40px; font-size: 20px; }
.video-tile-wrap.expanded .video-tile-label { bottom: auto; top: 20px; left: 20px; font-size: 14px; padding: 6px 12px; }

.vol-popover { position: absolute; bottom: 36px; background: var(--bg-dark); border-radius: 8px; padding: 10px 12px; box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 60; display:flex; align-items:center; gap:8px; }
.vol-popover input[type="range"] { width: 90px; }
.voice-chip { position: relative; }
.voice-chip.speaking { box-shadow: 0 0 0 2px #3ba55d; transition: box-shadow 0.1s ease; }

.verified-badge{display:inline-flex;align-items:center;justify-content:center;width:15px;height:15px;border-radius:50%;background:#3b82f6;color:#fff;font-size:10px;font-weight:800;line-height:1;margin-left:5px;vertical-align:middle}.verified-badge[title]{cursor:help}

html, body, .main-body, .panel-body, .member-list, .header-search-results, .profile-content, .modal-body { scrollbar-width: thin; scrollbar-color: var(--bg-hover) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); border: 2px solid transparent; background-clip: padding-box; }
.message .msg-actions { flex-wrap: wrap; }
.presence-avatar { position:relative; }
.presence-dot { position:absolute; right:-1px; bottom:-1px; width:10px; height:10px; border-radius:50%; border:2px solid var(--bg-dark); background:#747f8d; }
.presence-dot.online { background:var(--green); }
.in-call-label { font-size:11px; color:var(--green); font-weight:600; }
#replyBar { margin:0 16px; padding:7px 10px; background:var(--bg-light); border-left:3px solid var(--accent); border-radius:6px 6px 0 0; font-size:12px; color:var(--text-muted); }
#replyBar b { color:var(--text); }
#replyBar .icon-btn { float:right; width:20px;height:20px; }
.forward-users { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.forward-user { display:flex; align-items:center; gap:8px; background:var(--bg-light); color:var(--text); border-radius:8px; padding:8px; text-align:left; }
.forward-user:hover { background:var(--bg-hover); }
.notification-item { padding:10px 0; border-bottom:1px solid var(--border); }
.notification-item:last-child { border-bottom:0; }
.notification-item small, .muted { color:var(--text-muted); }
.image-viewer { position:relative; width:min(92vw,1100px); height:min(92vh,800px); display:flex;align-items:center;justify-content:center; background:rgba(20,20,22,.95); border:1px solid var(--border); border-radius:12px; padding:20px; }
.image-viewer img { max-width:100%; max-height:100%; object-fit:contain; border-radius:8px; }
.image-viewer .close-x { position:absolute;right:8px;top:8px;z-index:2; }
.profile-name { transition:color .15s; }
@media (max-width:700px){ .forward-users{grid-template-columns:1fr;} .header-search input{width:120px;} .header-search input:focus{width:160px;} }

body[data-theme="black"] { --bg-darkest:#101114; --bg-dark:#17181c; --bg-mid:#1d1f24; --bg-light:#25272d; --bg-hover:#30333a; --border:#111216; }
body[data-theme="amoled"] { --bg-darkest:#000; --bg-dark:#050505; --bg-mid:#0b0b0b; --bg-light:#151515; --bg-hover:#222; --border:#191919; }
.message .reply-preview { margin:2px 0 5px; padding:5px 8px; border-left:3px solid var(--accent); background:var(--bg-light); border-radius:4px; color:var(--text-muted); font-size:12px; }
.message.user-online .author { color:var(--text); }

.role-row{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--border)}
.role-dot{width:10px;height:10px;border-radius:50%;flex:none}.role-perms{font-size:11px;color:var(--text-muted);margin-left:auto}.profile-card[data-profile-theme="glass"]{background:rgba(45,47,54,.9);backdrop-filter:blur(14px)}.profile-card[data-profile-theme="midnight"]{background:#11131a}.profile-card[data-profile-theme="sunset"] .profile-cover-gradient{background:linear-gradient(135deg,rgba(255,120,80,.35),rgba(180,60,140,.25))}

.status-picker{display:flex;align-items:center;gap:6px;background:transparent;border:0;color:var(--text-muted);font-size:11px;padding:4px 6px;border-radius:6px;cursor:pointer;min-width:0;}
.status-picker:hover{background:var(--bg-hover);color:var(--text);}
.status-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#747f8d;flex:none;box-shadow:0 0 0 2px var(--bg-darkest);}
.status-online{background:#3ba55c!important;}
.status-idle{background:#faa61a!important;}
.status-dnd{background:#ed4245!important;}
.status-offline{background:#747f8d!important;}
.presence-menu{position:fixed;left:16px;bottom:76px;width:230px;background:var(--bg-dark);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 35px rgba(0,0,0,.45);padding:8px;z-index:100;}
.presence-menu-title{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);padding:5px 8px 7px;}
.presence-menu button{width:100%;display:flex;align-items:center;gap:10px;text-align:left;border:0;background:transparent;color:var(--text);padding:8px;border-radius:7px;cursor:pointer;}
.presence-menu button:hover,.presence-menu button.active{background:var(--bg-hover);}
.presence-menu button span:last-child{display:flex;flex-direction:column;gap:1px;}
.presence-menu button small{color:var(--text-muted);font-size:10px;}
.profile-online-dot.status-idle{background:#faa61a!important;}.profile-online-dot.status-dnd{background:#ed4245!important;}.profile-online-dot.status-offline{background:#747f8d!important;}

.kl-emoji{font-family:"Segoe UI Symbol","Noto Sans Symbols 2","Arial Unicode MS",sans-serif;font-variant-emoji:text;color:#fff;-webkit-text-stroke:1px #050505;text-shadow:1px 0 #050505,-1px 0 #050505,0 1px #050505,0 -1px #050505;line-height:1;display:inline-block;}
.emoji-popover .kl-emoji{font-size:18px;}
.reaction-pill .kl-emoji{font-size:15px;margin-right:2px;}

.role-manager-card{background:var(--bg-mid);border:1px solid var(--border);border-radius:9px;padding:12px;margin-bottom:10px;}
.role-manager-head{display:flex;align-items:center;gap:8px;margin-bottom:12px;}
.role-manager-title{display:flex;align-items:center;gap:8px;flex:1;min-width:0;}
.role-name-input{flex:1;min-width:0;background:var(--bg-light);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:7px 9px;}
.role-color-input{width:38px;height:34px;padding:2px;background:var(--bg-light);border:1px solid var(--border);border-radius:6px;}
.role-manager-section{padding-top:9px;margin-top:9px;border-top:1px solid var(--border);font-size:12px;}
.role-permission-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:8px;}
.role-permission-grid label,.role-member-check{display:flex;align-items:center;gap:6px;color:var(--text-muted);font-size:12px;cursor:pointer;}
.role-members-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:8px;max-height:180px;overflow-y:auto;padding-right:3px;}
.role-member-check{padding:5px 6px;border-radius:6px;background:var(--bg-light);color:var(--text);}
.role-member-check:hover{background:var(--bg-hover);}
.role-member-check input{accent-color:var(--accent);}
.role-manager-actions{display:flex;justify-content:flex-end;margin-top:11px;}
.avatar.xs{width:22px;height:22px;font-size:9px;flex:none;}
@media(max-width:600px){.role-members-grid,.role-permission-grid{grid-template-columns:1fr;}.presence-menu{left:8px;bottom:70px;width:220px;}.status-picker{font-size:10px;padding:3px 4px;}}

.settings-select { min-width: 170px; max-width: 240px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-light); color: var(--text); outline: none; }
.settings-range { width: 180px; accent-color: var(--accent); }
.settings-pills { margin-bottom: 22px; flex-wrap: wrap; }
.settings-main label { display:block; font-size:12px; font-weight:700; text-transform:uppercase; color:var(--text-muted); margin: 18px 0 7px; }
body.settings-reduced-motion *, body.settings-reduced-motion *::before, body.settings-reduced-motion *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
body.settings-large-text { font-size: 17px; }
body.settings-large-text .settings-row .rtext span, body.settings-large-text .setting-hint { font-size: 14px; }
body.settings-high-contrast { --border: #777; }
body.settings-no-animations *, body.settings-no-animations *::before, body.settings-no-animations *::after { animation: none !important; transition: none !important; }
@media (max-width: 760px) {
  #settingsOverlay { flex-direction:column; }
  .settings-sidebar { width:100%; max-height:180px; padding:14px 8px; display:flex; flex-wrap:wrap; gap:4px; overflow-y:auto; }
  .settings-sidebar .uid { width:100%; text-align:left; padding:0 8px 6px; }
  .settings-nav-item { font-size:12px; padding:7px 9px; }
  .settings-main { padding:54px 18px 30px; }
  .settings-row { gap:12px; align-items:flex-start; }
  .settings-select { max-width:48%; min-width:130px; }
  .settings-range { width:130px; }
}

body.sidebar-hidden-by-setting .rail { display:none; }

.server-voice-indicator { position:relative; display:flex; align-items:center; gap:5px; min-width:38px; height:28px; padding:0 7px; border:1px solid var(--border); border-radius:7px; background:var(--bg-mid); color:var(--text); cursor:pointer; }
.server-voice-indicator:hover { background:var(--bg-hover); }
.server-voice-icon { font-size:15px; line-height:1; }
.server-voice-indicator span:last-child { font-size:11px; font-weight:700; }
.server-voice-popover { position:absolute; top:42px; left:8px; z-index:1000; width:245px; max-height:330px; overflow:auto; padding:10px; border:1px solid var(--border); border-radius:10px; background:var(--bg-darkest); box-shadow:0 12px 32px rgba(0,0,0,.4); }
.server-voice-group + .server-voice-group { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.server-voice-group-title { display:flex; align-items:center; justify-content:space-between; color:var(--text); font-size:12px; font-weight:700; margin-bottom:6px; }
.server-voice-group-title span { color:var(--text-muted); font-size:11px; }
.server-voice-user { display:flex; align-items:center; gap:7px; padding:4px 2px; color:var(--text-muted); font-size:12px; }
.server-voice-user .avatar { width:24px; height:24px; font-size:9px; }
.voice-channel-count { min-width:20px; padding:2px 6px; border-radius:10px; background:var(--bg-hover); color:var(--text); font-size:10px; font-weight:700; text-align:center; }
.voice-directory-user { display:flex; align-items:center; gap:6px; padding:2px 0 2px 24px; color:var(--text-muted); font-size:12px; }
.voice-directory-user .avatar { width:20px; height:20px; font-size:9px; }

.panel-list-item .avatar,.voice-chip .avatar,.voice-directory-user .avatar,.message>.avatar{border-radius:50%;overflow:hidden;flex:none;}
.panel-list-item .avatar img,.voice-chip .avatar img,.voice-directory-user .avatar img,.message>.avatar img{border-radius:50%;display:block;width:100%;height:100%;object-fit:cover;}
.dm-remove-btn{opacity:.35;margin-left:4px}.panel-list-item:hover .dm-remove-btn{opacity:1}
.support-ticket-row{display:flex;justify-content:space-between;align-items:center;gap:12px;text-align:left;background:var(--bg-mid);border:1px solid var(--border);border-radius:8px;color:var(--text);padding:11px;cursor:pointer}.support-ticket-row span{color:var(--text-muted);font-size:12px}.support-chat-title{display:flex;justify-content:space-between;border-bottom:1px solid var(--border);padding-bottom:10px;margin-bottom:10px}.support-chat-title span{color:var(--text-muted);font-size:12px}.support-chat-messages{max-height:430px;overflow:auto;display:grid;gap:8px}.support-msg{background:var(--bg-mid);border-radius:8px;padding:9px;display:grid;gap:3px}.support-msg.admin{border-left:3px solid var(--accent)}.support-msg span{white-space:pre-wrap}.support-msg small{color:var(--text-muted);font-size:10px}.support-compose{display:flex;gap:8px;margin-top:10px}.support-compose input{flex:1;background:var(--bg-mid);border:1px solid var(--border);border-radius:7px;padding:10px;color:var(--text)}

.video-tile-wrap.screen-share-hidden{display:none!important}

.ceo-hero{display:flex;align-items:center;gap:16px;padding:20px 22px;margin-bottom:16px;border:1px solid rgba(88,101,242,.28);border-radius:16px;background:linear-gradient(135deg,rgba(88,101,242,.14),rgba(0,0,0,.08));box-shadow:0 12px 34px rgba(0,0,0,.18)}
.ceo-hero-icon{width:54px;height:54px;display:flex;align-items:center;justify-content:center;border-radius:15px;background:linear-gradient(145deg,#5865f2,#3b82f6);font-size:27px;box-shadow:0 8px 20px rgba(59,130,246,.28);flex:none}
.ceo-hero-copy{min-width:0;flex:1}.ceo-hero-copy h2{margin:0 0 4px;font-size:20px}.ceo-hero-copy p{margin:0;color:var(--text-muted);font-size:12px;line-height:1.5}.ceo-hero-count{min-width:76px;text-align:center;padding:9px 12px;border-radius:12px;background:rgba(0,0,0,.16);border:1px solid var(--border)}.ceo-hero-count b{display:block;font-size:20px}.ceo-hero-count span{font-size:10px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.06em}
.ceo-toolbar{display:flex;gap:10px;align-items:center;margin-bottom:14px;padding:10px;border:1px solid var(--border);border-radius:13px;background:var(--bg-mid);position:sticky;top:0;z-index:4;box-shadow:0 8px 22px rgba(0,0,0,.14)}
.ceo-search-wrap{display:flex;align-items:center;gap:8px;flex:1;min-width:180px;padding:0 11px;background:var(--bg-light);border:1px solid var(--border);border-radius:9px;color:var(--text-muted)}.ceo-search-wrap input{width:100%;border:0;outline:0;background:transparent;color:var(--text);padding:9px 0}.ceo-filters{display:flex;gap:5px;flex-wrap:wrap}.ceo-filter{border:1px solid var(--border);background:var(--bg-light);color:var(--text-muted);padding:8px 10px;border-radius:8px;font-size:11px;cursor:pointer}.ceo-filter:hover{color:var(--text);background:var(--bg-hover)}.ceo-filter.active{background:rgba(88,101,242,.18);border-color:rgba(88,101,242,.55);color:#fff}
.ceo-user-list{display:grid;gap:13px}.ceo-user-card{border:1px solid var(--border);border-radius:15px;background:var(--bg-mid);padding:16px;box-shadow:0 7px 24px rgba(0,0,0,.12);transition:border-color .16s,transform .16s,box-shadow .16s}.ceo-user-card:hover{border-color:rgba(88,101,242,.42);box-shadow:0 12px 30px rgba(0,0,0,.18);transform:translateY(-1px)}.ceo-user-card.is-ceo{border-color:rgba(245,158,11,.28);background:linear-gradient(145deg,var(--bg-mid),rgba(245,158,11,.035))}
.ceo-user-head{display:flex;align-items:center;gap:12px}.ceo-avatar{width:44px;height:44px;border-radius:50%;overflow:hidden;display:flex;align-items:center;justify-content:center;flex:none;background:linear-gradient(145deg,#5865f2,#3b82f6);font-weight:800;font-size:16px;border:2px solid rgba(255,255,255,.1);box-shadow:0 4px 14px rgba(0,0,0,.22)}.ceo-avatar img{width:100%;height:100%;object-fit:cover}.ceo-user-identity{min-width:0;flex:1}.ceo-name-row{display:flex;align-items:center;gap:5px;flex-wrap:wrap}.ceo-name-row>b{font-size:14px}.ceo-tag{font-size:11px;color:var(--text-muted)}.ceo-role-pill,.ceo-tester-pill{font-size:9px;font-weight:800;letter-spacing:.04em;padding:4px 7px;border-radius:999px;background:rgba(245,158,11,.14);color:#fbbf24;border:1px solid rgba(245,158,11,.2)}.ceo-role-pill.admin{background:rgba(88,101,242,.14);color:#9aa4ff;border-color:rgba(88,101,242,.25)}.ceo-role-pill.user{background:var(--bg-light);color:var(--text-muted);border-color:var(--border)}.ceo-access-summary{display:block;color:var(--text-muted);font-size:10px;margin-top:3px}.ceo-head-actions{display:flex;justify-content:flex-end}.ceo-tester-pill{background:rgba(59,130,246,.13);color:#60a5fa;border-color:rgba(59,130,246,.24)}
.ceo-divider{height:1px;background:var(--border);margin:14px 0}.ceo-section-title{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:9px}.ceo-section-title span{font-size:10px;font-weight:800;letter-spacing:.08em;color:var(--text-muted)}.ceo-section-title small{font-size:10px;color:var(--text-muted)}
.ceo-permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.ceo-permission-card{position:relative;display:flex;align-items:center;gap:10px;min-height:62px;padding:10px 11px;border:1px solid var(--border);border-radius:11px;background:var(--bg-light);cursor:pointer;transition:.15s}.ceo-permission-card:hover{border-color:rgba(88,101,242,.45);background:var(--bg-hover)}.ceo-permission-card.checked{border-color:rgba(88,101,242,.55);background:rgba(88,101,242,.10)}.ceo-permission-card.tester-permission.checked{border-color:rgba(59,130,246,.48);background:rgba(59,130,246,.08)}.ceo-permission-card.disabled{cursor:default;opacity:.72}.ceo-permission-card input{position:absolute;opacity:0;pointer-events:none}.ceo-permission-icon{width:31px;height:31px;display:flex;align-items:center;justify-content:center;border-radius:9px;background:var(--bg-mid);font-size:16px;flex:none}.ceo-permission-copy{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}.ceo-permission-copy b{font-size:11px}.ceo-permission-copy small{font-size:9px;color:var(--text-muted);line-height:1.3}.ceo-switch{width:30px;height:17px;border-radius:999px;background:#4b4f59;position:relative;flex:none;transition:.15s}.ceo-switch i{position:absolute;left:3px;top:3px;width:11px;height:11px;border-radius:50%;background:#fff;transition:.15s;box-shadow:0 1px 3px rgba(0,0,0,.3)}.ceo-permission-card.checked .ceo-switch{background:#5865f2}.ceo-permission-card.checked .ceo-switch i{left:16px}.ceo-permission-card.tester-permission.checked .ceo-switch{background:#3b82f6}
.ceo-card-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:13px}.ceo-footer-hint,.ceo-protected{font-size:10px;color:var(--text-muted)}.ceo-protected{color:#fbbf24}.ceo-save-btn{min-width:116px}.ceo-empty{padding:45px 20px;text-align:center;border:1px dashed var(--border);border-radius:14px;color:var(--text-muted);display:flex;flex-direction:column;align-items:center;gap:5px}.ceo-empty div{font-size:27px;margin-bottom:4px}.ceo-empty b{color:var(--text);font-size:13px}
@media(max-width:760px){.ceo-toolbar{align-items:stretch;flex-direction:column}.ceo-filters{width:100%}.ceo-filter{flex:1}.ceo-permission-grid{grid-template-columns:1fr}.ceo-hero{align-items:flex-start}.ceo-hero-count{display:none}.ceo-head-actions{align-self:flex-start}.ceo-card-footer{align-items:stretch;flex-direction:column}.ceo-save-btn{width:100%}}

:root {
  --bg-darkest: #0b0f16;
  --bg-dark: #111722;
  --bg-mid: #151c28;
  --bg-light: #1b2432;
  --bg-hover: #222e40;
  --text: #f4f7fb;
  --text-muted: #8f9bad;
  --accent: #4f7cff;
  --accent-hover: #3f68e8;
  --border: rgba(255,255,255,.075);
  --panel-glow: rgba(79,124,255,.10);
}
body {
  background:
    radial-gradient(900px 500px at 18% -10%, rgba(79,124,255,.11), transparent 62%),
    radial-gradient(700px 500px at 100% 100%, rgba(38,198,218,.045), transparent 65%),
    var(--bg-darkest);
}
#appView { background: transparent; }
.rail {
  width: 76px;
  padding: 14px 0;
  gap: 10px;
  background: rgba(8,12,19,.88);
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 10px 0 35px rgba(0,0,0,.16);
  backdrop-filter: blur(18px);
}
.rail-scroll { gap: 10px; padding: 2px 0; }
.rail-item {
  width: 50px; height: 50px; border-radius: 16px;
  background: linear-gradient(145deg,#172131,#111925);
  border: 1px solid rgba(255,255,255,.055);
  box-shadow: 0 7px 20px rgba(0,0,0,.18);
  transition: transform .18s ease, border-radius .18s ease, background .18s ease, box-shadow .18s ease;
}
.rail-item:hover { transform: translateY(-2px); }
.rail-item:hover, .rail-item.active { border-radius: 15px; background: linear-gradient(145deg,#587fff,#3f68e8); box-shadow: 0 9px 26px rgba(79,124,255,.28); }
.rail-item.active { outline: 2px solid rgba(79,124,255,.18); outline-offset: 2px; }
.rail-item.logo { background: linear-gradient(145deg,#5d84ff,#3865e7); }
.rail-sep { width: 36px; height: 1px; background: rgba(255,255,255,.09); margin: 3px 0; }

.panel {
  width: 258px;
  background: rgba(15,21,31,.94);
  border-right: 1px solid rgba(255,255,255,.065);
  box-shadow: 8px 0 30px rgba(0,0,0,.10);
  backdrop-filter: blur(18px);
}
.panel-header {
  min-height: 60px; padding: 12px 16px;
  background: linear-gradient(180deg,rgba(255,255,255,.025),transparent);
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 14px;
}
.panel-body { padding: 10px; }
.panel-section-title { padding: 14px 9px 7px; letter-spacing: .07em; font-size: 10px; color:#718096; }
.panel-list-item {
  min-height: 40px; padding: 7px 9px; margin: 2px 0;
  border-radius: 10px; color: #9aa6b8;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.panel-list-item:hover { background: rgba(255,255,255,.045); color: var(--text); transform: translateX(1px); }
.panel-list-item.active {
  color: #fff;
  background: linear-gradient(90deg,rgba(79,124,255,.20),rgba(79,124,255,.075));
  box-shadow: inset 3px 0 0 var(--accent);
}
.panel-list-item .avatar { box-shadow: 0 3px 10px rgba(0,0,0,.18); }
.panel-footer {
  padding: 10px;
  background: rgba(8,12,19,.62);
  border-top: 1px solid rgba(255,255,255,.055);
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.icon-btn:hover { background: rgba(255,255,255,.07); transform: translateY(-1px); }
.icon-btn.active { box-shadow: 0 5px 15px rgba(237,66,69,.22); }

.main { background: linear-gradient(145deg,#151c28,#121925); }
.main-header {
  height: 60px; padding: 0 18px;
  background: rgba(14,20,30,.76);
  border-bottom: 1px solid rgba(255,255,255,.065);
  box-shadow: 0 8px 25px rgba(0,0,0,.10);
  backdrop-filter: blur(18px);
}
.main-header .count { background: rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.05); }
.main-body { padding: 18px; }
.member-list {
  width: 248px; background: rgba(13,19,28,.90);
  border-left: 1px solid rgba(255,255,255,.06);
  padding: 14px 10px;
  backdrop-filter: blur(16px);
}
.member-list-title { padding: 7px 9px; letter-spacing:.07em; font-size:10px; color:#718096; }

.message { padding: 8px 10px; border-radius: 10px; transition: background .15s ease; }
.message:hover { background: rgba(255,255,255,.035); }
.message .meta { font-size: 13px; }
.message .text { line-height: 1.52; color:#e8edf5; }
.message .avatar { box-shadow: 0 4px 12px rgba(0,0,0,.20); }
.msg-actions { top: -8px; right: 10px; border-radius: 10px; background:#111722; box-shadow:0 8px 20px rgba(0,0,0,.3); }
.composer { padding: 10px 18px 18px; }
.composer textarea {
  min-height: 46px; padding: 13px 15px;
  background: rgba(27,36,50,.90);
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 7px 24px rgba(0,0,0,.12);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer textarea:focus { border-color: rgba(79,124,255,.55); box-shadow: 0 0 0 3px rgba(79,124,255,.09); }

.header-search input {
  width: 190px; padding: 8px 12px; border-radius: 10px;
  background: rgba(27,36,50,.82); border:1px solid rgba(255,255,255,.07);
}
.header-search input:focus { width: 240px; border-color: rgba(79,124,255,.55); box-shadow:0 0 0 3px rgba(79,124,255,.08); }
.header-search-results { border-radius: 13px; background:#101722; border-color:rgba(255,255,255,.08); box-shadow:0 18px 45px rgba(0,0,0,.45); }
.header-search-result { padding: 10px 13px; }

.modal-overlay { background: rgba(3,7,12,.72); backdrop-filter: blur(8px); }
.modal {
  background: linear-gradient(145deg,#151d2a,#101722);
  border:1px solid rgba(255,255,255,.075);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0,0,0,.48), 0 0 0 1px rgba(79,124,255,.025);
}
.modal-header { padding: 18px 20px; border-bottom:1px solid rgba(255,255,255,.055); }
.modal-header h3 { font-size:15px; }
.modal-body { padding: 18px 20px 20px; }
.modal-footer { padding: 13px 20px; background:rgba(8,12,19,.35); border-top:1px solid rgba(255,255,255,.055); }
.modal-body input, .modal-body select, .field input {
  border:1px solid rgba(255,255,255,.07); border-radius:10px;
  background:#101722; padding:11px 12px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.modal-body input:focus, .modal-body select:focus, .field input:focus { border-color:rgba(79,124,255,.6); box-shadow:0 0 0 3px rgba(79,124,255,.08); }
.btn { border-radius:10px; transition:transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform:translateY(-1px); }
.btn-primary { background:linear-gradient(135deg,#5b82ff,#416be9); box-shadow:0 7px 20px rgba(79,124,255,.20); }
.btn-primary:hover { background:linear-gradient(135deg,#688cff,#4b73ef); }
.btn-ghost { border-color:rgba(255,255,255,.09); background:rgba(255,255,255,.025); }

#voiceBar {
  margin: 8px 10px 0;
  border: 1px solid rgba(79,124,255,.18) !important;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(135deg,rgba(30,48,83,.94),rgba(16,23,34,.96)) !important;
  box-shadow: 0 12px 30px rgba(0,0,0,.24);
  padding: 10px 13px !important;
}
#voiceBar .icon-btn { border-radius:9px; background:rgba(255,255,255,.045); }
#voiceBar .icon-btn:hover { background:rgba(255,255,255,.10); }
.voice-chip {
  border:1px solid rgba(255,255,255,.06) !important;
  background:rgba(255,255,255,.045) !important;
  box-shadow:0 4px 14px rgba(0,0,0,.12);
  transition:transform .15s ease, border-color .15s ease;
}
.voice-chip:hover { transform:translateY(-1px); border-color:rgba(79,124,255,.28) !important; }

.profile-card {
  border:1px solid rgba(255,255,255,.08) !important;
  border-radius:18px !important;
  overflow:hidden;
  box-shadow:0 30px 90px rgba(0,0,0,.52) !important;
}
.profile-cover { min-height:125px !important; }
.profile-top { padding:0 22px 16px !important; }
.profile-avatar-wrap { filter:drop-shadow(0 9px 18px rgba(0,0,0,.35)); }
.profile-content { padding:0 22px 20px !important; }
.profile-section { border-top-color:rgba(255,255,255,.07) !important; }
.profile-section-title { letter-spacing:.08em !important; color:#7f8ca1 !important; }
.profile-about, .profile-stat { background:rgba(255,255,255,.035) !important; border-color:rgba(255,255,255,.06) !important; border-radius:11px !important; }
.profile-footer { background:rgba(7,11,17,.40) !important; border-top-color:rgba(255,255,255,.06) !important; }

.server-voice-indicator { border-radius:10px; background:rgba(79,124,255,.10); border-color:rgba(79,124,255,.20); }
.server-voice-popover { border-radius:13px; background:#101722; border-color:rgba(255,255,255,.08); box-shadow:0 18px 45px rgba(0,0,0,.45); }
.voice-channel-count { background:rgba(79,124,255,.14); color:#b9c8ff; }

.empty-state { opacity:.86; }
.auth-card {
  width:410px; padding:34px; border-radius:20px;
  background:linear-gradient(145deg,#151d2a,#0f1621);
  border:1px solid rgba(255,255,255,.075);
  box-shadow:0 30px 80px rgba(0,0,0,.42);
}
.auth-logo .logo-box { border-radius:11px; background:linear-gradient(145deg,#5d84ff,#3865e7); box-shadow:0 9px 22px rgba(79,124,255,.25); }
.auth-card .btn { padding:11px 16px; }

@media (max-width: 900px) {
  .member-list { display:none; }
  .panel { width:235px; }
}
@media (max-width: 680px) {
  .rail { width:64px; }
  .rail-item { width:44px; height:44px; }
  .panel { width:220px; }
  .main-header { padding:0 12px; }
  .main-body { padding:12px 8px; }
  .composer { padding:8px 10px 12px; }
  #voiceBar { margin:6px 6px 0; }
  .header-search { display:none; }
}

.kl-sticker-message{box-shadow:0 8px 24px rgba(0,0,0,.18)}
.admin-dashboard-hero{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:22px;margin-bottom:16px;border:1px solid var(--border);border-radius:18px;background:linear-gradient(135deg,rgba(59,130,246,.15),rgba(15,18,24,.96));box-shadow:0 14px 40px rgba(0,0,0,.16)}.admin-dashboard-hero h2{margin:4px 0;font-size:23px}.admin-dashboard-hero p{margin:0;color:var(--text-muted);font-size:12px}.stat-bar{height:4px;background:var(--bg-dark);border-radius:99px;overflow:hidden;margin-top:10px}.stat-bar i,.analytics-row i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,#2389ff,#6d5dfc)}.admin-analytics-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.analytics-bars{display:grid;gap:15px}.analytics-row{display:grid;grid-template-columns:90px 1fr 50px;gap:10px;align-items:center;font-size:12px}.analytics-row>div{height:9px;background:var(--bg-dark);border-radius:99px;overflow:hidden}.analytics-row b{text-align:right}.admin-activity{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}.activity-dot{width:8px;height:8px;border-radius:50%;background:var(--accent);margin-top:6px;flex:0 0 auto}.admin-activity small{color:var(--text-muted);font-size:10px}@media(max-width:800px){.admin-analytics-grid{grid-template-columns:1fr}.admin-dashboard-hero{align-items:flex-start;flex-direction:column}}
.kl-update-overlay{position:fixed;inset:auto 18px 18px 18px;z-index:9999;display:flex;justify-content:center;pointer-events:none}.kl-update-card{width:min(520px,calc(100vw - 36px));display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center;padding:14px 16px;border:1px solid rgba(59,130,246,.35);border-radius:16px;background:rgba(15,18,24,.96);box-shadow:0 18px 50px rgba(0,0,0,.35);pointer-events:auto}.kl-update-card h3{margin:2px 0;font-size:14px}.kl-update-card p{margin:0;color:var(--text-muted);font-size:11px}.kl-update-progress{grid-column:2/4;height:7px;border-radius:99px;background:var(--bg-dark);overflow:hidden}.kl-update-progress i{display:block;height:100%;background:linear-gradient(90deg,#2389ff,#7c5cff);border-radius:99px}

.admin-users-toolbar{margin:0 0 14px;display:flex;gap:10px}.admin-users-toolbar input{flex:1;min-width:0}.admin-error{display:flex;flex-direction:column;gap:5px;padding:28px!important}.control-stats{margin-bottom:16px}.control-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.control-status-list{display:grid;gap:9px;margin-top:14px}.control-status-list>div{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:9px;padding:11px 12px;border:1px solid var(--border);border-radius:11px;background:var(--bg-dark)}.control-status-list small{color:var(--text-muted)}.control-security-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-top:14px}.control-security-grid>div{padding:14px 10px;border:1px solid var(--border);border-radius:11px;background:var(--bg-dark);text-align:center}.control-security-grid b{display:block;font-size:22px}.control-security-grid span{display:block;margin-top:3px;color:var(--text-muted);font-size:10px}@media(max-width:800px){.control-grid{grid-template-columns:1fr}.control-security-grid{grid-template-columns:1fr 1fr}.admin-users-toolbar{flex-direction:column}}

.voice-bar-title{display:flex;align-items:center;gap:9px;min-width:190px}.voice-connection-status{font-size:10px;font-weight:800;padding:4px 7px;border-radius:999px;background:rgba(34,197,94,.10);color:#6ee7a0;white-space:nowrap}.voice-connection-status.connecting{background:rgba(59,130,246,.12);color:#8db7ff}.voice-connection-status.reconnecting{background:rgba(245,158,11,.12);color:#f7c56b}.voice-chip{transition:box-shadow .15s,transform .15s}.voice-chip.speaking{box-shadow:0 0 0 2px rgba(34,197,94,.55),0 0 14px rgba(34,197,94,.14);transform:translateY(-1px)}#voiceBar[data-connection="reconnecting"]{border-top-color:rgba(245,158,11,.5)!important}.voice-diagnostics-modal{width:620px;max-width:94vw}.voice-diag-loading,.voice-diag-empty{padding:24px;border:1px dashed var(--border);border-radius:12px;color:var(--text-muted);text-align:center}.voice-diag-card{padding:14px;border:1px solid var(--border);background:var(--bg-dark);border-radius:12px;margin-bottom:10px}.voice-diag-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}.voice-diag-pill{font-size:10px;font-weight:800;padding:4px 8px;border-radius:999px}.voice-diag-pill.relay{background:rgba(59,130,246,.14);color:#8db7ff}.voice-diag-pill.direct{background:rgba(34,197,94,.12);color:#6ee7a0}.voice-diag-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.voice-diag-grid span{font-size:10px;color:var(--text-muted);padding:8px;border-radius:8px;background:var(--bg-mid)}.voice-diag-grid strong{display:block;color:var(--text);font-size:12px;margin-top:3px;overflow:hidden;text-overflow:ellipsis}.voice-diag-note{font-size:11px;line-height:1.5;color:var(--text-muted);padding:10px 2px}@media(max-width:700px){.voice-bar-title{min-width:0}.voice-connection-status{display:none}.voice-diag-grid{grid-template-columns:repeat(2,1fr)}}

.email-preview-frame{width:100%;height:540px;border:1px solid #26344a;border-radius:12px;background:#080b11;margin:12px 0 4px}
.email-broadcast-card .bot-compose-footer{gap:10px;justify-content:flex-end}

.auth-consent { display:flex; align-items:flex-start; gap:10px; margin: 2px 0 14px; font-size:12px; line-height:1.5; color: var(--text-muted); cursor:pointer; }
.auth-consent input[type="checkbox"] { width:16px; height:16px; margin-top:2px; flex:0 0 auto; accent-color: var(--accent); }


/* ---- KL APP suite: tickets, security, discovery, analytics, desktop ---- */
.kls-overlay { z-index: 1200; }
.kls-modal { max-height: 90vh; display: flex; flex-direction: column; }
.kls-modal .modal-body { overflow-y: auto; }
.kls-kicker { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.kls-muted { color: var(--text-muted, #949ba4); font-size: 13px; }
.kls-empty { padding: 28px 12px; text-align: center; color: var(--text-muted, #949ba4); }
.kls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.kls-row.between { justify-content: space-between; }
.kls-list { display: grid; gap: 8px; }
.kls-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.kls-chip { border: 1px solid var(--border, #3f4147); background: transparent; color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.kls-chip:hover { background: var(--bg-hover); }
.kls-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.kls-pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg-light); color: var(--text); text-transform: capitalize; }
.kls-pill.open { background: #3b82f633; color: #7fb4ff; }
.kls-pill.answered, .kls-pill.good { background: #3ba55d33; color: #5fd48a; }
.kls-pill.closed { background: #6b728033; color: #a0a6b3; }
.kls-pill.staff { background: #5865f233; color: #a5adff; }
.kls-ticket { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border, #3f4147); background: var(--bg-mid); color: var(--text); cursor: pointer; }
.kls-ticket:hover { background: var(--bg-hover); }
.kls-ticket-main { display: grid; gap: 2px; }
.kls-ticket-main small { color: var(--text-muted, #949ba4); }
.kls-form { display: grid; gap: 12px; }
.kls-form label { display: grid; gap: 6px; font-size: 13px; color: var(--text-muted, #b5bac1); }
.kls-form input, .kls-form select, .kls-form textarea, .kls-search, .kls-compose textarea { background: var(--bg-darkest); border: 1px solid var(--border, #3f4147); color: var(--text); border-radius: 8px; padding: 9px 10px; font: inherit; }
.kls-search { flex: 1; min-width: 200px; }
.kls-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.kls-form label.kls-check { display: flex; }
.kls-attach { display: flex; align-items: center; gap: 10px; }
.kls-thread { display: grid; gap: 10px; max-height: 340px; overflow-y: auto; padding: 4px 2px; margin-bottom: 12px; }
.kls-msg { padding: 10px 12px; border-radius: 10px; background: var(--bg-mid); }
.kls-msg.staff { background: #5865f21f; }
.kls-msg-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.kls-msg-head small { margin-left: auto; color: var(--text-muted, #949ba4); }
.kls-msg-body { white-space: pre-wrap; word-break: break-word; }
.kls-thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.kls-thumb { max-width: 160px; max-height: 120px; border-radius: 8px; display: block; }
.kls-compose { display: grid; gap: 8px; }
.kls-compose textarea { width: 100%; resize: vertical; }
.kls-compose-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.kls-compose-actions .kls-muted { margin-right: auto; }
.kls-closed { padding: 10px 12px; border-radius: 8px; background: var(--bg-mid); margin-bottom: 10px; color: var(--text-muted, #b5bac1); }
.kls-events { margin-top: 14px; font-size: 13px; color: var(--text-muted, #949ba4); }
.kls-events ul { margin: 8px 0 0; padding-left: 18px; }
.kls-events li span { opacity: .7; margin-right: 6px; }

.kls-card { background: var(--bg-mid); border: 1px solid var(--border, #3f4147); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.kls-card h4 { margin: 0 0 10px; font-size: 14px; }
.kls-score { display: flex; gap: 20px; align-items: center; }
.kls-score-num { font-size: 42px; font-weight: 800; line-height: 1; }
.kls-score-num small { font-size: 16px; opacity: .6; font-weight: 600; }
.kls-score.good .kls-score-num { color: #5fd48a; }
.kls-score.mid .kls-score-num { color: #f0b232; }
.kls-score.low .kls-score-num { color: #f04747; }
.kls-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.kls-checks li::before { display: inline-block; width: 16px; font-weight: 700; }
.kls-checks li.ok::before { content: "+"; color: #5fd48a; }
.kls-checks li.no::before { content: "-"; color: #f04747; }
.kls-checks li.no { opacity: .75; }
.kls-alert { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #f0b2321f; margin-bottom: 6px; font-size: 13px; }
.kls-alert small { color: var(--text-muted, #949ba4); white-space: nowrap; }
.kls-session { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border, #3f4147); }
.kls-session:first-of-type { border-top: 0; }
.kls-session small { display: block; color: var(--text-muted, #949ba4); margin-top: 2px; }
.kls-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.danger, .btn-ghost.danger { color: #f04747; }
.kls-codes { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--bg-darkest); }
.kls-code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin: 8px 0; }
.kls-code-grid code { padding: 6px 8px; border-radius: 6px; background: var(--bg-mid); text-align: center; letter-spacing: .06em; }
.kls-table { display: grid; font-size: 13px; }
.kls-trow { display: grid; grid-template-columns: 70px 1.4fr 1fr 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border, #3f4147); }
.kls-trow.fail span:first-child { color: #f04747; }

.kls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.kls-server { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg-mid); border: 1px solid var(--border, #3f4147); }
.kls-server .btn { grid-column: 1 / -1; justify-self: end; }
.kls-server-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; overflow: hidden; }
.kls-server-icon img { width: 100%; height: 100%; object-fit: cover; }
.kls-server-body h4 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kls-server-body p { margin: 0 0 6px; font-size: 13px; color: var(--text-muted, #b5bac1); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kls-server-body small { color: var(--text-muted, #949ba4); }
.kls-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; background: #3ba55d33; color: #5fd48a; }
.kls-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.kls-tags span { padding: 3px 9px; border-radius: 6px; background: var(--bg-light); font-size: 12px; }

.kls-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.kls-stats.wide { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.kls-stat, .kls-stats > div { padding: 12px; border-radius: 10px; background: var(--bg-mid); border: 1px solid var(--border, #3f4147); }
.kls-stats b { display: block; font-size: 22px; }
.kls-stats small { color: var(--text-muted, #949ba4); }
.kls-chart { width: 100%; height: auto; display: block; }
.kls-axis { fill: var(--text-muted, #949ba4); font-size: 10px; }
.kls-bar { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.kls-bar i { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.kls-bar b { text-align: right; }
.kls-switch { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.kls-update .kls-row { margin: 10px 0 0; }
@media (max-width: 640px) {
  .kls-trow { grid-template-columns: 1fr 1fr; }
  .kls-score { flex-direction: column; align-items: flex-start; }
  .kls-bar { grid-template-columns: 90px 1fr 34px; }
}
