:root {
  --bg: #0f1012;
  --panel: #16171a;
  --panel-2: #1c1d21;
  --raise: #24252a;
  --hover: #2b2c32;
  --line: #2a2b31;
  --text: #ecebe8;
  --text-2: #a3a1a8;
  --text-3: #6f6d76;
  --accent: #ff8a3d;
  --accent-ink: #1a0f06;
  --accent-soft: rgba(255, 138, 61, .14);
  --ok: #3ddc84;
  --danger: #ff5d5d;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  --bg: #f4f2ef;
  --panel: #fbfaf8;
  --panel-2: #ffffff;
  --raise: #efece8;
  --hover: #e8e4df;
  --line: #e2ddd7;
  --text: #1d1b19;
  --text-2: #5d5953;
  --text-3: #8f8a83;
  --accent: #e8661a;
  --accent-ink: #fff;
  --accent-soft: rgba(232, 102, 26, .12);
  --ok: #17a85a;
  --danger: #d93a3a;
  --shadow: 0 12px 40px rgba(40, 30, 20, .18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
kbd {
  font: 12px var(--mono); padding: 1px 6px; border-radius: 5px;
  background: var(--raise); border: 1px solid var(--line); border-bottom-width: 2px;
}
.i { width: 18px; height: 18px; flex: none; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--raise); font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.big { height: 44px; font-size: 15px; width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 8px; border: 0; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.sm .i { width: 15px; height: 15px; }
.icon-btn.off { color: var(--danger); }

/* ---------- login ---------- */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(60rem 40rem at 50% 120%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%); padding: 32px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 0h16a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8H8a8 8 0 0 1-8-8V8a8 8 0 0 1 8-8zm8 7c1 3 1 7 0 9 0-2-1-4-3-5 0 3-2 4-2 7a5 5 0 0 0 10 0c0-5-4-7-5-11z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 0h16a8 8 0 0 1 8 8v16a8 8 0 0 1-8 8H8a8 8 0 0 1-8-8V8a8 8 0 0 1 8-8zm8 7c1 3 1 7 0 9 0-2-1-4-3-5 0 3-2 4-2 7a5 5 0 0 0 10 0c0-5-4-7-5-11z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.logo-mark.sm { width: 22px; height: 22px; }
.sub { margin: -10px 0 0; color: var(--text-2); }
.warn { margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(255, 93, 93, .1); color: var(--danger); font-size: 13px; }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.field > span output { color: var(--text); }
.hint { color: var(--text-3); font-size: 12.5px; font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; }
.field .hint { margin-left: 6px; }
input:not([type]), input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); outline: none;
}
input:not([type]):focus, input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px var(--panel);
}
.swatch.sel { border-color: var(--text); }

.seg { justify-self: start; display: inline-flex; padding: 3px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 14px; border-radius: 7px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.seg input:checked + span { background: var(--raise); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; font-weight: 800; font-size: 16px; border-bottom: 1px solid var(--line); }
.conn { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.conn.on { background: var(--ok); }
.section-head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 4px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
}
.new-channel { padding: 4px 10px; }
.new-channel input { height: 32px; }

.tree { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.ch {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; margin-top: 2px;
  border: 0; border-radius: 7px; background: none; color: var(--text-2); text-align: left; font-weight: 600;
}
.ch:hover { background: var(--hover); color: var(--text); }
.ch.active { background: var(--accent-soft); color: var(--text); }
.ch.active .i { color: var(--accent); }
.ch .i { width: 16px; height: 16px; color: var(--text-3); }
.ch .n { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-3); }
.users { list-style: none; margin: 0 0 4px; padding: 0 0 0 22px; }
.u {
  display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 7px;
  color: var(--text-2); cursor: default; min-height: 30px;
}
.u.clickable { cursor: pointer; }
.u.clickable:hover { background: var(--hover); color: var(--text); }
.u .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.u.self .nm { color: var(--text); font-weight: 600; }
.u .flags { display: flex; gap: 3px; color: var(--text-3); }
.u .flags .i { width: 14px; height: 14px; }
.u .flags .red { color: var(--danger); }
.u .flags .acc { color: var(--accent); }

.avatar {
  --c: var(--accent);
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--c); color: #15120f; font-size: 11px; font-weight: 800; text-transform: uppercase;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 2px var(--panel);
  transition: box-shadow .12s;
}
.speaking > .avatar, .avatar.speaking { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ok); }

.me {
  display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 12px;
  background: var(--panel-2); border-top: 1px solid var(--line);
}
.me .avatar { width: 32px; height: 32px; font-size: 13px; margin-right: 6px; box-shadow: 0 0 0 2px var(--panel-2); }
.me .avatar.speaking { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px var(--ok); }
.me-info { flex: 1; min-width: 0; }
.me-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-status { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px 0 16px; flex: none;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.nav-btn { display: none; margin-left: -6px; }
.title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-icon .i { color: var(--text-3); }
.title h1 { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.actions { margin-left: auto; display: flex; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); font-weight: 600; font-size: 13px;
}
.tool:hover { color: var(--text); background: var(--hover); }
.tool.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.tool .i { width: 16px; height: 16px; }

/* ---------- stage ---------- */
.stage {
  flex: none; max-height: 58%; min-height: 180px; padding: 10px; overflow: auto;
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-content: start;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.stage.focus { max-height: none; flex: 1 1 60%; grid-template-columns: 1fr; }
.stage.focus .tile:not(.focused) { display: none; }
.stage.focus .tile.focused { aspect-ratio: auto; height: 100%; min-height: 240px; }
.tile {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--line); cursor: zoom-in;
}
.stage.focus .tile { cursor: zoom-out; }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.tile.mirror video { transform: scaleX(-1); }
.tile .tag {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 60px);
  padding: 3px 9px; border-radius: 6px; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.tile .tile-btns { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-btns, .tile:focus-within .tile-btns { opacity: 1; }
.tile .tile-btns button { width: 30px; height: 30px; border-radius: 7px; border: 0; background: rgba(0,0,0,.62); color: #fff; display: grid; place-items: center; }
.tile.has-controls .tag { bottom: 52px; }

/* ---------- music ---------- */
.music-bar {
  flex: none; display: grid; gap: 6px; padding: 8px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.mrow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mrow .disc {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.mrow .disc .i { width: 16px; height: 16px; }
.mrow.playing .disc .i { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px) rotate(-6deg); } }
.mrow .meta { min-width: 0; flex: 1; }
.mrow .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .who { font-size: 11.5px; color: var(--text-3); }
.mrow .seek { display: flex; align-items: center; gap: 8px; font: 11px var(--mono); color: var(--text-3); }
.mrow .seek input { flex: 1; height: 14px; }
.mrow .vol { width: 90px; flex: none; }
.mrow .ctrls { display: flex; gap: 2px; }
.queue { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 40px; }
.queue button {
  max-width: 220px; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue button.cur { border-color: var(--accent); color: var(--text); }

/* ---------- chat ---------- */
.chat { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px 16px 4px; overflow-wrap: anywhere; }
.empty { margin: auto; text-align: center; color: var(--text-3); padding: 40px 0; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.msg { display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; padding: 2px 8px; margin: 0 -8px; border-radius: 8px; }
.msg:hover { background: var(--panel); }
.msg.first { margin-top: 12px; }
.msg .avatar { width: 36px; height: 36px; font-size: 14px; grid-row: span 2; box-shadow: none; }
.msg:not(.first) .avatar { visibility: hidden; height: 0; }
.msg .head { display: flex; align-items: baseline; gap: 8px; }
.msg:not(.first) .head { display: none; }
.msg .who { font-weight: 700; }
.msg .ts { font-size: 11px; color: var(--text-3); }
.msg .body { white-space: pre-wrap; }
.msg .embed { margin: 6px 0 4px; max-width: min(480px, 100%); }
.msg .embed img, .msg .embed video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; background: var(--panel-2); }
.msg .embed img { cursor: zoom-in; }
.msg .embed audio { width: 100%; max-width: 420px; }
.msg .embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
.msg .file {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 12px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; color: var(--text);
}
.msg .file small { color: var(--text-3); }
.sys { text-align: center; font-size: 12px; color: var(--text-3); margin: 10px 0; }
.compact .msg { grid-template-columns: auto 1fr; }
.compact .msg .avatar { display: none; }
.compact .msg.first { margin-top: 4px; }
.compact .msg .head { display: inline-flex !important; margin-right: 6px; }
.compact .msg { display: block; }
.compact .msg .head, .compact .msg .body { display: inline; }
.compact .msg .ts { margin-right: 6px; }

.typing { height: 20px; padding: 0 18px; font-size: 12px; color: var(--text-3); }
.composer {
  display: flex; align-items: flex-end; gap: 4px; margin: 0 16px 16px; padding: 6px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.composer textarea {
  flex: 1; height: auto; min-height: 34px; max-height: 200px; padding: 7px 4px; resize: none;
  border: 0; background: transparent; line-height: 20px;
}
.composer .send { color: var(--accent); }
.drop-hint {
  position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 14px;
  display: grid; place-items: center; font-size: 18px; font-weight: 700; color: var(--accent);
  background: color-mix(in srgb, var(--bg) 85%, transparent); pointer-events: none;
}

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px);
}
.modal-card {
  width: min(820px, 100%); height: min(640px, 100%); display: grid; grid-template-columns: 200px 1fr;
  border-radius: 14px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.tabs { display: flex; flex-direction: column; gap: 2px; padding: 20px 10px; background: var(--panel); border-right: 1px solid var(--line); }
.tabs h2 { margin: 0 10px 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.tab { text-align: left; padding: 8px 12px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font-weight: 600; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--raise); color: var(--text); }
.panes { position: relative; overflow-y: auto; padding: 8px 28px 28px; }
.close { position: absolute; top: 14px; right: 14px; }
.pane { display: none; gap: 14px; }
.pane.active { display: grid; }
.pane h3 { margin: 18px 0 0; font-size: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meter-wrap { position: relative; height: 26px; }
.meter { position: absolute; inset: 9px 0; border-radius: 99px; background: var(--raise); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--text-3); transition: width .05s linear; }
.meter-fill.hot { background: var(--ok); }
.meter-range { position: absolute; inset: 0; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
.meter-range::-webkit-slider-runnable-track { background: transparent; height: 26px; }
.meter-range::-moz-range-track { background: transparent; }
.meter-range::-webkit-slider-thumb { -webkit-appearance: none; width: 6px; height: 26px; border-radius: 3px; background: var(--accent); }
.meter-range::-moz-range-thumb { width: 6px; height: 26px; border-radius: 3px; border: 0; background: var(--accent); }

.keylist { display: grid; gap: 2px; }
.keyrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keyrow .lbl { flex: 1; }
.keybtn {
  min-width: 150px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); font: 600 12.5px var(--mono);
}
.keybtn:hover { border-color: var(--text-3); }
.keybtn.capturing { border-color: var(--accent); color: var(--accent); animation: pulse 1s infinite; }
.keybtn.unset { color: var(--text-3); }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- popover / lightbox / toasts ---------- */
.popover {
  position: fixed; z-index: 60; width: 240px; padding: 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 10px;
}
.popover .ph { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.popover .ph .avatar { width: 32px; height: 32px; font-size: 13px; box-shadow: none; }
.popover .sub2 { font-size: 12px; color: var(--text-3); font-weight: 400; }
.lightbox { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .85); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toasts { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow); animation: up .2s ease-out;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--raise); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--hover); }

/* ---------- small screens ---------- */
.scrim { display: none; }
@media (max-width: 860px) {
  .tool .lbl { display: none; }
  .tool { padding: 0 9px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.45); }
  .nav-btn { display: inline-grid; }
  .topbar { padding: 0 8px 0 12px; gap: 6px; }
  .actions { gap: 4px; }
  .messages { padding: 12px 12px 4px; }
  .composer { margin: 0 8px 8px; }
  .stage { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .modal-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100%; border-radius: 0; }
  .tabs { flex-direction: row; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .tabs h2 { display: none; }
  .tab { white-space: nowrap; }
  .panes { padding: 4px 16px 24px; }
  .close { top: 4px; right: 4px; }
  .grid2 { grid-template-columns: 1fr; }
  .queue { padding-left: 0; }
  .mrow .vol { width: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.pane > .btn { justify-self: start; }

/* ---------- auth ---------- */
.auth { display: grid; gap: 14px; }
.auth-tabs { display: flex; justify-self: stretch; margin-bottom: 16px; }
.auth-tabs span { white-space: nowrap; }
.auth-tabs label { flex: 1; text-align: center; }
.resume { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.resume .avatar { width: 40px; height: 40px; font-size: 16px; box-shadow: none; }
.resume b { font-size: 16px; }
.link { border: 0; background: none; color: var(--text-2); font-size: 13px; text-decoration: underline; justify-self: center; }
.link:hover { color: var(--text); }
.note { margin: 0; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--accent-soft); color: var(--text); }
.note.err { background: rgba(255, 93, 93, .12); color: var(--danger); }
.pw-form { display: grid; gap: 8px; max-width: 360px; }
.pw-form .btn { justify-self: start; }
a.icon-btn { text-decoration: none; }
.u .flags .adm { color: var(--accent); }

/* ---------- admin panel ---------- */
.admin-body { overflow: auto; }
.admin-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); font-size: 16px;
}
.admin-tag { padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.admin-top .back { margin-left: auto; height: 32px; font-size: 13px; text-decoration: none; color: var(--text); }
.gate { display: grid; place-items: center; padding: 60px 16px; }
.gate .login-card { gap: 10px; }
.gate h2 { margin: 0; }
.gate .btn { text-decoration: none; justify-self: start; }
.admin { display: grid; grid-template-columns: 220px 1fr; max-width: 1180px; margin: 0 auto; }
.admin-nav { position: sticky; top: 56px; align-self: start; display: grid; gap: 2px; padding: 20px 12px; }
.admin-nav .tab { display: flex; align-items: center; gap: 8px; }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.badge.soft { background: var(--raise); color: var(--text-2); }
.admin-main { padding: 12px 24px 48px; min-width: 0; }
.admin-main h2 { margin: 12px 0 0; font-size: 20px; }
.admin-main .pane { gap: 14px; }
.row-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-head .search { margin-left: auto; width: 240px; margin-top: 12px; }
.list { display: grid; gap: 8px; }
.card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); flex-wrap: wrap; }
.card .avatar, .who .avatar { width: 34px; height: 34px; font-size: 14px; box-shadow: none; }
.grow { flex: 1; min-width: 160px; }
.nowrap { white-space: nowrap; }
.empty-card { padding: 28px; border-radius: 10px; border: 1px dashed var(--line); color: var(--text-3); text-align: center; }
.chan .grow input { height: 34px; }
.order { display: flex; gap: 2px; }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.danger { color: var(--danger); }
.btn.danger.armed, .btn.armed { background: var(--danger); color: #fff; border-color: transparent; }
.inline-form { display: flex; gap: 8px; max-width: 520px; }
.settings-form { display: grid; gap: 16px; max-width: 640px; }
.settings-form textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: 10px; }
.dot-online { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--ok); vertical-align: middle; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.reset-form { display: flex; gap: 6px; }
.reset-form input { height: 30px; width: 180px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--raise); color: var(--text-2); white-space: nowrap; }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.pill.approved { background: rgba(61, 220, 132, .14); color: var(--ok); }
.pill.pending { background: rgba(246, 195, 68, .16); color: #d9a521; }
.pill.rejected, .pill.disabled { background: rgba(255, 93, 93, .12); color: var(--danger); }
@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; display: flex; overflow-x: auto; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .admin-nav .tab { white-space: nowrap; }
  .admin-main { padding: 8px 16px 40px; }
  .row-head .search { width: 100%; margin-left: 0; }
  .actions-cell { justify-content: flex-start; }
}
.me .icon-btn { width: 30px; }

/* ---------- moderation / soundboard / bots ---------- */
.popover.wide { width: 340px; }
.pop-sec { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.pop-row { display: flex; gap: 6px; }
.pop-row select { height: 30px; flex: 1; min-width: 0; }
.btn.danger { color: var(--danger); }
.btn.armed { background: var(--danger); color: #fff; border-color: transparent; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pad {
  display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); font-size: 11px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pad span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pad:hover { border-color: var(--accent); color: var(--text); }
.pad:active { transform: scale(.96); }
.pad .emo { font-size: 20px; line-height: 1.2; }
.u.bot { color: var(--text-2); }
.u.bot small { color: var(--text-3); }
.avatar.bot-av { background: var(--raise); color: var(--accent); }
.avatar.bot-av .i { width: 14px; height: 14px; }
.bot-panel { display: grid; gap: 6px; }
.bot-panel + .bot-panel, .mrow + .bot-panel { padding-top: 6px; border-top: 1px solid var(--line); }
.bot-err { padding-left: 40px; font-size: 12px; color: var(--danger); }
.qchip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 260px; padding: 2px 4px 2px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden;
}
.qchip button { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--text-3); padding: 0; }
.qchip button:hover { background: var(--hover); color: var(--text); }
.qchip button .i { width: 12px; height: 12px; }
.bot-add { display: flex; gap: 6px; padding-left: 40px; }
.bot-add input { height: 30px; flex: 1; min-width: 0; }
.bot-add .lib { height: 30px; width: 130px; flex: none; }
.bot-row { display: flex; align-items: center; gap: 10px; }
.bot-row .avatar { width: 30px; height: 30px; box-shadow: none; }
@media (max-width: 760px) { .bot-add, .bot-err { padding-left: 0; } .pads { grid-template-columns: repeat(3, 1fr); } }

/* ---------- admin: roles, bots, media ---------- */
.role-card { display: grid; gap: 12px; align-items: stretch; }
.role-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.role-head input[type="color"] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.role-head .grow input, .card .grow > input { height: 34px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px; }
.perm { font-size: 13px; padding: 4px 0; align-items: flex-start; }
.perm input { margin-top: 2px; }
.role-select { height: 30px; width: auto; padding: 0 8px; color: var(--rc, var(--text)); font-weight: 600; }
.card select { height: 34px; width: auto; max-width: 200px; }
.inline-form select { height: 38px; width: auto; }
.upload-row { display: flex; align-items: center; gap: 12px; }
.upload-row .btn { cursor: pointer; }
.admin-main h2 + .hint code, .hint code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--raise); }
.admin-main .pane h2:not(:first-child) { margin-top: 28px; }
