/* kernix.chat — design system. Brand: #233C2B. Self-hosted font, no trackers. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/manrope-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/manrope-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --brand: #233C2B;
  --brand-ink: #e7efe6;
  --bg-0: #e4eae4;
  --bg-1: #eff3ef;
  --bg-2: #ffffff;
  --bg-3: #eef2ee;
  --bg-4: #e1e8e2;
  --bg-hover: rgba(35, 60, 43, .06);
  --bg-active: rgba(35, 60, 43, .11);
  --line: #dbe3dc;
  --line-2: #c9d4cb;
  --t1: #14231a;
  --t2: #46584c;
  --t3: #7a897e;
  --accent: #233C2B;
  --accent-h: #2f4f39;
  --accent-ink: #f1f6f0;
  --accent-t: #2a6b44;
  --accent-soft: #e3eee5;
  --ok: #2f9e57;
  --warn: #b7860b;
  --danger: #c93c37;
  --danger-soft: #fbe9e8;
  --mention: #fff4d6;
  --shadow: 0 1px 2px rgba(20, 35, 26, .06), 0 6px 20px rgba(20, 35, 26, .10);
  --shadow-lg: 0 2px 6px rgba(20, 35, 26, .08), 0 18px 48px rgba(20, 35, 26, .20);
  --r-s: 8px; --r: 12px; --r-l: 18px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg-0: #0a0e0c;
  --bg-1: #0f1411;
  --bg-2: #131915;
  --bg-3: #1b221e;
  --bg-4: #242d27;
  --bg-hover: rgba(214, 235, 219, .05);
  --bg-active: rgba(214, 235, 219, .09);
  --line: #202823;
  --line-2: #2d3731;
  --t1: #e9efea;
  --t2: #aab6ae;
  --t3: #78867d;
  --accent: #3e8a5a;
  --accent-h: #479866;
  --accent-ink: #f3faf4;
  --accent-t: #86c79c;
  --accent-soft: #1b2f22;
  --ok: #3fb96a;
  --warn: #d6a72e;
  --danger: #e2564f;
  --danger-soft: #34191a;
  --mention: #2e2a15;
  --shadow: 0 2px 8px rgba(0, 0, 0, .45);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 var(--font); color: var(--t1); background: var(--bg-2);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-t); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent-t); outline-offset: 2px; }
img { display: block; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--t3); }
.small { font-size: 13px; }

/* ---------- icons ---------- */
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.s { width: 16px; height: 16px; }
.ic.l { width: 24px; height: 24px; }
.logo { display: inline-block; background: currentColor; -webkit-mask: url(../img/logo-mark.svg) center / contain no-repeat; mask: url(../img/logo-mark.svg) center / contain no-repeat; aspect-ratio: 1047 / 894; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px;
  transition: background .12s, border-color .12s, opacity .12s; white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--accent-h); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; height: 44px; font-size: 15px; border-radius: 12px; }
.btn.ghost { background: transparent; color: var(--t1); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.subtle { background: var(--bg-3); color: var(--t1); }
.btn.subtle:hover { background: var(--bg-4); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn.link { background: none; color: var(--accent-t); padding: 0; height: auto; font-weight: 500; }
.btn.link:hover { text-decoration: underline; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-s);
  border: 0; background: none; color: var(--t2); flex: none;
}
.iconbtn:hover { background: var(--bg-hover); color: var(--t1); }
.iconbtn.on { color: var(--accent-t); }
.iconbtn.red { color: var(--danger); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--t1); }
.input, .textarea, .select {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); color: var(--t1); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-t); background: var(--bg-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-t) 16%, transparent); }
.input.code { font-family: var(--mono); font-size: 22px; letter-spacing: .35em; text-align: center; height: 52px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 40px; }
.input-wrap .iconbtn { position: absolute; right: 4px; }
.hint { font-size: 12.5px; color: var(--t3); }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }
.err { background: var(--danger-soft); color: var(--danger); border-radius: var(--r-s); padding: 9px 12px; font-size: 13.5px; margin-bottom: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--t2); cursor: pointer; margin-bottom: 14px; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.meter { height: 4px; border-radius: 2px; background: var(--bg-4); overflow: hidden; margin-top: 2px; }
.meter > i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }

/* switch */
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--line-2); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-t); outline-offset: 2px; }

/* ---------- avatar / badges ---------- */
.av {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; user-select: none;
  background: var(--av, #4a6b57); overflow: visible;
}
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av.xs { width: 20px; height: 20px; font-size: 9px; }
.av.s { width: 32px; height: 32px; font-size: 13px; }
.av.l { width: 80px; height: 80px; font-size: 30px; }
.av.xl { width: 96px; height: 96px; font-size: 36px; }
.av .dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); border: 3px solid var(--dotbg, var(--bg-1)); }
.av.s .dot { width: 12px; height: 12px; border-width: 2.5px; }
.av.l .dot, .av.xl .dot { width: 22px; height: 22px; border-width: 4px; right: 2px; bottom: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; line-height: 1;
  color: #fff; background: var(--tag, var(--accent)); vertical-align: 2px; white-space: nowrap;
}
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--bg-3); color: var(--t2); font-size: 12px; font-weight: 600; }
.pill.green { background: var(--accent-soft); color: var(--accent-t); }

/* ---------- overlays ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(5, 10, 7, .55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(4px); } }
.modal { width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg-2); border-radius: var(--r); box-shadow: var(--shadow-lg); animation: pop .14s ease-out; }
.modal.wide { width: min(640px, 100%); }
.modal-h { padding: 20px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-h h2 { margin: 0; font-size: 19px; line-height: 1.3; flex: 1; }
.modal-h p { margin: 4px 0 0; color: var(--t2); font-size: 14px; }
.modal-b { padding: 16px 20px 20px; }
.modal-f { padding: 14px 20px; background: var(--bg-1); display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--t1); color: var(--bg-2); padding: 10px 16px; border-radius: var(--r); font-size: 14px; box-shadow: var(--shadow); animation: pop .15s ease-out; }
.toast.bad { background: var(--danger); color: #fff; }
.menu { position: fixed; z-index: 60; min-width: 200px; padding: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); animation: pop .1s ease-out; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-s); text-align: left; font-size: 14px; color: var(--t1); }
.menu button:hover { background: var(--bg-hover); }
.menu button.red { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.tip { position: fixed; z-index: 90; background: var(--t1); color: var(--bg-2); font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 6px; pointer-events: none; width: max-content; max-width: min(280px, calc(100vw - 12px)); overflow-wrap: anywhere; }

/* ---------- full page shells (landing / link / unlock) ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg-1); position: relative; overflow: hidden; }
.shell-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px; position: relative; z-index: 1; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--t1); font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 26px; color: var(--brand); }
:root[data-theme="dark"] .brand .logo { color: var(--brand-ink); }
.brand-sub { font-weight: 500; color: var(--t3); }
.shell-mid { display: grid; place-items: center; padding: 24px 16px 48px; position: relative; z-index: 1; }
.shell-foot { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 18px 16px 26px; font-size: 13px; position: relative; z-index: 1; }
.shell-foot a { color: var(--t3); }
.card { width: min(400px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 28px; }
.card h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.card .sub { color: var(--t2); margin: 0 0 22px; font-size: 14.5px; }
.bgmark { position: absolute; right: -6vw; bottom: -14vh; width: min(66vw, 820px); color: var(--brand); opacity: .07; pointer-events: none; }
:root[data-theme="dark"] .bgmark { color: var(--brand-ink); opacity: .035; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-3); border-radius: var(--r); padding: 4px; margin-bottom: 22px; }
.tabs button { height: 34px; border: 0; background: none; border-radius: 7px; font-weight: 600; color: var(--t2); font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--bg-2); color: var(--t1); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { height: 3px; flex: 1; border-radius: 2px; background: var(--bg-4); }
.steps i.on { background: var(--accent-t); }
.qr { display: grid; place-items: center; background: #fff; border-radius: var(--r); padding: 10px; width: max-content; margin: 0 auto 12px; border: 1px solid var(--line); }
.qr img { width: 196px; height: 196px; image-rendering: pixelated; }
.secret { font-family: var(--mono); font-size: 13px; background: var(--bg-3); border-radius: var(--r-s); padding: 8px 10px; text-align: center; word-break: break-all; user-select: all; color: var(--t2); margin-bottom: 16px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-family: var(--mono); font-size: 15px; background: var(--bg-3); border-radius: var(--r); padding: 14px 18px; margin-bottom: 14px; user-select: all; }
.note { display: block; font-size: 13.5px; color: var(--t2); margin: 0 0 16px; line-height: 1.5; }
.note .ic { display: none; }
.note .ic { color: var(--accent-t); margin-top: 1px; }
.note.warn .ic { color: var(--warn); }
.landing-tag { font-size: 13px; color: var(--t3); display: flex; gap: 14px; }
.landing-tag span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- app layout ---------- */
:root { --bg-chat: #eef2ed; --bubble-in: #ffffff; --bubble-out: #d6ead4; --bubble-out-meta: #4d7356; --nav: #f6f8f5; }
:root[data-theme="dark"] { --bg-chat: #0d110f; --bubble-in: #1a201c; --bubble-out: #234431; --bubble-out-meta: #92c7a3; --nav: #0e1511; }
.app { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100dvh; overflow: hidden; background: var(--bg-2); }
.app.with-members { grid-template-columns: 360px minmax(0, 1fr) 320px; }

.g-ini { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--av, var(--accent)); color: #fff; font-weight: 700; font-size: 12.5px; overflow: hidden; flex: none; }
.g-ini img { width: 100%; height: 100%; object-fit: cover; }
.g-ini.sm { width: 30px; height: 30px; font-size: 12px; }

.side { background: var(--bg-2); display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.side-h { height: 56px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 16px; font-weight: 700; font-size: 18px; }
.side-h.btnish { cursor: pointer; gap: 10px; font-size: 15px; border-bottom: 1px solid var(--line); }
.side-h.btnish:hover { background: var(--bg-hover); }
.side-h .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-h .title small { display: block; font-size: 12px; font-weight: 500; color: var(--t3); }
.side-search { margin: 0 12px 8px; height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 18px; background: var(--bg-3); color: var(--t3); }
.side-search-input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 14px; color: var(--t1); }
.side-search-input::-webkit-search-cancel-button { display: none; }
.side-scroll { flex: 1; overflow-y: auto; padding: 0 6px 12px; scrollbar-width: thin; }
.side-empty { padding: 16px 12px; color: var(--t3); font-size: 13.5px; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px; font-size: 13px; font-weight: 600; color: var(--t3); }
.side-label .iconbtn { width: 22px; height: 22px; }
.conv { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r); color: var(--t1); cursor: pointer; }
.conv:hover { background: var(--bg-hover); text-decoration: none; }
.conv.active { background: var(--accent); color: var(--accent-ink); }
.conv .av { width: 48px; height: 48px; font-size: 18px; --dotbg: var(--bg-2); }
.conv.active .av { --dotbg: var(--accent); }
.conv .meta { flex: 1; min-width: 0; }
.conv .name { display: flex; align-items: baseline; gap: 6px; font-weight: 600; font-size: 15px; }
.conv .name b { font-weight: inherit; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .name time { font-size: 12px; font-weight: 400; color: var(--t3); flex: none; }
.conv .prev { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.conv .prev-txt { flex: 1; min-width: 0; font-size: 14px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .you { color: var(--t2); }
.conv .typing-txt { color: var(--accent-t); }
.conv .badge { background: var(--accent-t); flex: none; height: 20px; min-width: 20px; border-radius: 10px; }
.conv.active .name time, .conv.active .prev-txt, .conv.active .you, .conv.active .typing-txt { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.bubble-av { position: relative; width: 48px; height: 48px; flex: none; }
.bubble-av .av { position: absolute; width: 32px; height: 32px; font-size: 12px; border: 2px solid var(--bg-2); }
.bubble-av .av:first-child { left: 0; top: 0; }
.bubble-av .av:last-child { right: 0; bottom: 0; }
.bubble-av.s { width: 36px; height: 36px; }
.bubble-av.s .av { width: 24px; height: 24px; font-size: 10px; }

.chan-cat { display: flex; align-items: center; gap: 4px; padding: 14px 8px 4px; font-size: 13px; font-weight: 600; color: var(--t3); cursor: pointer; user-select: none; }
.chan-cat:hover { color: var(--t2); }
.chan-cat .ic { width: 14px; height: 14px; transition: transform .12s; }
.chan-cat.closed .ic.chev { transform: rotate(-90deg); }
.chan-cat span { flex: 1; }
.chan-cat .iconbtn { width: 22px; height: 22px; opacity: 0; }
.chan-cat:hover .iconbtn { opacity: 1; }
.chan { position: relative; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; border-radius: var(--r); color: var(--t2); cursor: pointer; font-weight: 500; }
.chan:hover { background: var(--bg-hover); color: var(--t1); text-decoration: none; }
.chan.active { background: var(--accent-soft); color: var(--accent-t); }
.chan.unread { color: var(--t1); font-weight: 700; }
.chan.unread::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-t); flex: none; }
.chan > .ic { width: 28px; height: 28px; padding: 6px; border-radius: 7px; background: var(--bg-3); color: var(--t2); }
.chan.active > .ic { background: var(--accent); color: var(--accent-ink); }
.chan span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan > .pill { flex: none; height: 20px; padding: 0 7px; }
.chan .iconbtn { width: 26px; height: 26px; opacity: 0; }
.chan:hover .iconbtn { opacity: 1; }
.voice-users { padding: 2px 0 6px 46px; display: grid; gap: 2px; }
.voice-user { display: flex; align-items: center; gap: 8px; height: 28px; font-size: 13.5px; color: var(--t2); }
.voice-user .av { width: 22px; height: 22px; font-size: 9px; transition: box-shadow .1s; }
.voice-user.speaking .av { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--ok); }
.voice-user span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user .ic { width: 14px; height: 14px; color: var(--danger); }
.voicebar { margin: 0 8px 8px; padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); }
.voicebar .row { display: flex; align-items: center; gap: 8px; }
.voicebar .status { flex: 1; min-width: 0; }
.voicebar .status b { display: block; color: var(--accent-t); font-size: 13.5px; }
.voicebar .status small { display: block; color: var(--t2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voicebar .btn.subtle { background: var(--bg-2); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-chat); }
.main-h { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.main-h .h-title { flex: 1; min-width: 0; line-height: 1.25; }
.main-h .h-title.click { cursor: pointer; }
.main-h .h-title b { display: block; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-h .h-title small { display: block; font-size: 12.5px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-h .h-ic { width: 36px; height: 36px; border-radius: 9px; background: var(--bg-3); display: grid; place-items: center; color: var(--t2); flex: none; }
.main-h .back { display: none; }

.msgs { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0 10px; scrollbar-width: thin; overscroll-behavior: contain; }
.msgs-inner { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; max-width: 920px; margin: 0 auto; }
.sys { display: flex; justify-content: center; margin: 10px 16px; }
.sys span { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--bg-2) 85%, transparent); color: var(--t2); font-size: 12.5px; padding: 5px 12px; border-radius: 14px; text-align: center; max-width: 520px; }
.sys.start span { background: var(--mention); color: var(--t1); line-height: 1.4; }
.sys.day { position: sticky; top: 4px; z-index: 1; }
.sys.day span { font-weight: 600; }
.mrow { display: flex; align-items: flex-end; gap: 8px; padding: 0 16px; margin-top: 8px; }
.mrow.cont { margin-top: 2px; }
.mrow.mine { flex-direction: row-reverse; }
.mav { width: 32px; flex: none; cursor: pointer; }
.mav .av { width: 32px; height: 32px; font-size: 13px; }
.bubble { position: relative; max-width: min(600px, 76%); background: var(--bubble-in); color: var(--t1); border-radius: 14px; padding: 6px 10px 6px 11px; box-shadow: 0 1px 1px rgba(0,0,0,.06); min-width: 64px; }
.mine .bubble { background: var(--bubble-out); }
.mrow:not(.mine).more .bubble, .mrow:not(.mine).cont .bubble { border-bottom-left-radius: 5px; }
.mrow:not(.mine).cont .bubble { border-top-left-radius: 5px; }
.mrow:not(.mine):not(.more) .bubble { border-bottom-left-radius: 4px; }
.mine.more .bubble, .mine.cont .bubble { border-bottom-right-radius: 5px; }
.mine.cont .bubble { border-top-right-radius: 5px; }
.mine:not(.more) .bubble { border-bottom-right-radius: 4px; }
.bubble .who { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 1px; color: var(--accent-t); }
.bubble .who > span:first-child { cursor: pointer; }
.bubble .who .tag { height: 16px; font-size: 9.5px; }
.bubble .text { display: inline; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.42; font-size: 15px; }
.bubble .text a { color: var(--accent-t); text-decoration: underline; text-underline-offset: 2px; }
.bubble .text code { font-family: var(--mono); font-size: 13px; background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }
.bubble .text.err { color: var(--t3); font-style: italic; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 -2px 10px; font-size: 11px; color: var(--t3); line-height: 1; position: relative; top: 4px; white-space: nowrap; }
.mine .bubble .meta { color: var(--bubble-out-meta); }
.bubble .tick { letter-spacing: -3px; padding-right: 3px; }
.bubble .tick.read { color: #3a9ad9; }
:root[data-theme="dark"] .bubble .tick.read { color: #6cc1ff; }
.quote { display: block; border-left: 3px solid var(--accent-t); background: rgba(0,0,0,.045); border-radius: 4px; padding: 3px 8px; margin: 2px 0 5px; cursor: pointer; font-size: 13px; max-width: 100%; }
:root[data-theme="dark"] .quote { background: rgba(255,255,255,.06); }
.quote b { display: block; color: var(--accent-t); font-size: 12.5px; }
.quote span { display: block; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-more { opacity: 0; width: 28px; height: 28px; align-self: center; }
.mrow:hover .m-more, .m-more:focus-visible { opacity: 1; }
.mrow.pending .bubble { opacity: .7; }
.mrow.editing .bubble { outline: 2px solid var(--accent-t); }
.mrow.flash .bubble { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--warn); } }

.composer { padding: 6px 16px 14px; flex: none; max-width: 952px; width: 100%; margin: 0 auto; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; border: 1px solid var(--line); background: var(--bg-2); border-radius: 21px; outline: none; resize: none; padding: 10px 16px; max-height: 40vh; min-height: 42px; line-height: 1.4; font-size: 15px; }
.composer textarea:focus { border-color: var(--line-2); }
.composer .send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.composer .send:hover { background: var(--accent-h); }
.composer-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--t2); background: var(--bg-2); border-left: 3px solid var(--accent-t); border-radius: var(--r-s); padding: 6px 8px 6px 10px; margin-bottom: 6px; }
.composer-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-bar b { color: var(--accent-t); }
.composer-bar .iconbtn { width: 24px; height: 24px; }
.typing { height: 20px; padding: 0 24px; font-size: 12.5px; color: var(--t2); display: flex; align-items: center; gap: 6px; max-width: 952px; width: 100%; margin: 0 auto; }
.typing i { display: inline-flex; gap: 3px; }
.typing i b { width: 5px; height: 5px; border-radius: 50%; background: var(--t3); animation: blink 1.2s infinite; }
.typing i b:nth-child(2) { animation-delay: .2s; }
.typing i b:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.readonly { margin: 0 16px 16px; padding: 12px 14px; border-radius: var(--r); background: var(--bg-2); color: var(--t3); font-size: 14px; text-align: center; }

.info { background: var(--bg-2); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.info-h { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.info-body { flex: 1; overflow-y: auto; padding: 12px 10px 18px; scrollbar-width: thin; }
.info-profile { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 8px 0 16px; }
.info-profile .av { margin-bottom: 8px; }
.info-profile h3 { margin: 0; font-size: 18px; }
.info-profile small { color: var(--t3); }
.info-profile .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.info-sec { border-top: 1px solid var(--line); padding: 12px 8px; }
.info-sec p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.member:hover { background: var(--bg-hover); }
.member .av { width: 36px; height: 36px; font-size: 14px; --dotbg: var(--bg-2); }
.member .nm { flex: 1; min-width: 0; }
.member .nm b { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.member .nm small { display: block; font-size: 12.5px; color: var(--t3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.member.off { opacity: .55; }
.member .ic.crown { width: 14px; height: 14px; color: var(--warn); }

.home-empty { flex: 1; display: grid; place-items: center; padding: 24px; }
.home-empty > span:not(.spinner) { background: color-mix(in srgb, var(--bg-2) 85%, transparent); color: var(--t2); font-size: 13.5px; padding: 6px 14px; border-radius: 14px; }
.empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 32px; color: var(--t2); }
.empty .inner { max-width: 380px; }
.empty .logo { width: 48px; color: var(--line-2); margin: 0 auto 18px; }
.empty h2 { margin: 0 0 6px; color: var(--t1); font-size: 20px; }
.empty p { margin: 0 0 18px; }
.loading { display: grid; place-items: center; height: 100dvh; background: var(--bg-2); color: var(--t3); }
.loading .logo { width: 44px; color: var(--brand); animation: breathe 1.6s ease-in-out infinite; }
:root[data-theme="dark"] .loading .logo { color: var(--brand-ink); }
@keyframes breathe { 50% { opacity: .35; } }

/* profile card */
.profile { width: 320px; background: var(--bg-2); border-radius: var(--r); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); animation: pop .12s ease-out; }
.profile .p-head { display: flex; gap: 14px; align-items: center; padding: 18px 16px 4px; }
.profile .p-head .av { --dotbg: var(--bg-2); }
.profile .bd { padding: 6px 16px 16px; }
.profile .nm { font-size: 18px; font-weight: 700; margin: 0; }
.profile .tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 0; }
.profile .sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.profile .sec .label { margin-bottom: 4px; display: block; color: var(--t3); font-weight: 500; font-size: 12.5px; }
.profile .info { white-space: pre-wrap; font-size: 14px; color: var(--t1); overflow-wrap: anywhere; }
.profile .acts { display: flex; gap: 8px; margin-top: 14px; }
.profile .acts > .btn:first-child { flex: 1; }
.role-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--bg-3); font-size: 12.5px; font-weight: 600; border: 0; }
.role-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc, var(--t3)); }
.role-chip button { border: 0; background: none; padding: 0; color: var(--t3); display: grid; }

/* settings (centered dialog) */
.settings { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(5, 10, 7, .5); animation: fade .12s; }
.settings-box { position: relative; width: min(900px, 100%); height: min(680px, 100%); display: grid; grid-template-columns: 220px minmax(0, 1fr); background: var(--bg-2); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-lg); }
.settings nav { background: var(--bg-1); padding: 18px 10px; overflow-y: auto; border-right: 1px solid var(--line); }
.settings nav .label { display: block; padding: 4px 10px 8px; color: var(--t3); font-weight: 600; font-size: 12.5px; }
.settings nav button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-s); color: var(--t1); font-weight: 500; margin-bottom: 2px; }
.settings nav button:hover { background: var(--bg-hover); }
.settings nav button[aria-current="true"] { background: var(--accent-soft); color: var(--accent-t); font-weight: 600; }
.settings nav button.red { color: var(--danger); }
.settings nav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 10px; }
.settings section { padding: 24px 32px 40px; overflow-y: auto; }
.settings section > div { max-width: 600px; }
.settings h2 { margin: 0 0 18px; font-size: 20px; }
.settings h3 { margin: 26px 0 8px; font-size: 14px; color: var(--t1); }
.settings .close { position: absolute; top: 12px; right: 12px; }
.row-set { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row-set > div:first-child { flex: 1; min-width: 0; }
.row-set b { display: block; font-weight: 600; }
.row-set small { display: block; color: var(--t3); font-size: 13.5px; margin-top: 2px; }
.prof-edit { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin-bottom: 18px; }
.prof-edit .avedit { display: grid; gap: 8px; justify-items: center; }
.fp { font-family: var(--mono); font-size: 14px; line-height: 1.7; background: var(--bg-3); padding: 14px 16px; border-radius: var(--r); display: grid; grid-template-columns: repeat(4, max-content); gap: 0 18px; justify-content: center; color: var(--t1); }
.list-box { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row small { color: var(--t3); display: block; font-size: 12.5px; }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.perm-row > div:first-child { flex: 1; min-width: 0; }
.perm-row > .tri, .perm-row > .switch { flex: none; }
.perm-row b { font-weight: 600; display: block; font-size: 14.5px; }
.perm-row small { color: var(--t3); font-size: 13px; }
.tri { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-s); overflow: hidden; }
.tri { flex: none; }
.tri button { width: 34px; height: 28px; padding: 0; border: 0; background: none; color: var(--t3); display: grid; place-items: center; font-size: 15px; line-height: 1; }
.tri button + button { border-left: 1px solid var(--line-2); }
.tri button.on.deny { background: var(--danger); color: #fff; }
.tri button.on.inherit { background: var(--bg-4); color: var(--t1); }
.tri button.on.allow { background: var(--ok); color: #fff; }
.roles-layout { display: grid; grid-template-columns: 190px 1fr; gap: 20px; }
.roles-list { display: grid; gap: 2px; align-content: start; }
.roles-list button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; border-radius: var(--r-s); text-align: left; color: var(--t2); font-weight: 600; }
.roles-list button:hover { background: var(--bg-hover); }
.roles-list button[aria-current="true"] { background: var(--accent-soft); color: var(--t1); }
.roles-list i { width: 12px; height: 12px; border-radius: 50%; background: var(--rc, var(--t3)); flex: none; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; background: var(--sw); }
.swatches button[aria-pressed="true"] { border-color: var(--t1); box-shadow: inset 0 0 0 2px var(--bg-2); }
.swatches input[type=color] { width: 28px; height: 28px; border: 0; padding: 0; background: none; border-radius: 50%; }
.danger-zone { border-top: 1px solid var(--line); padding: 18px 0 0; margin-top: 28px; }
.danger-zone b { color: var(--danger); }

/* ---------- docs ---------- */
body.docs { background: var(--bg-2); }
.dtop { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(8px); z-index: 5; }
.dtop .brand .logo, .dtop .brand img { width: 22px; height: auto; }
.dtop-links a { font-weight: 600; font-size: 14px; }
.dwrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }
.dnav { position: sticky; top: 60px; align-self: start; height: calc(100dvh - 60px); overflow-y: auto; padding: 28px 16px 28px 24px; border-right: 1px solid var(--line); }
.dnav-group { margin-bottom: 22px; }
.dnav-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); padding: 0 10px 6px; }
.dnav a { display: block; padding: 6px 10px; border-radius: var(--r-s); color: var(--t2); font-size: 14.5px; }
.dnav a:hover { background: var(--bg-hover); color: var(--t1); text-decoration: none; }
.dnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-t); font-weight: 600; }
.dnav-toggle, .dnav-btn { display: none; }
.dmain { padding: 40px 48px 80px; min-width: 0; }
.prose { max-width: 720px; line-height: 1.7; font-size: 16px; color: var(--t1); }
.prose h1 { font-size: 34px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 12px; }
.prose .lead { font-size: 18px; color: var(--t2); margin: 0 0 28px; }
.prose h2 { font-size: 22px; margin: 40px 0 10px; letter-spacing: -.01em; }
.prose h3 { font-size: 17px; margin: 28px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--bg-3); padding: 2px 6px; border-radius: 5px; }
.prose pre { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.55; }
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--t2); }
.prose .callout { border-left: 3px solid var(--accent-t); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 var(--r) var(--r) 0; margin: 0 0 18px; }
.prose .callout.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.prose .updated { color: var(--t3); font-size: 14px; }
.dpager { max-width: 720px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.dpager a { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--t1); font-weight: 600; }
.dpager a:hover { border-color: var(--accent-t); text-decoration: none; }
.dpager a small { display: block; font-weight: 500; color: var(--t3); font-size: 12.5px; }
.dpager a.next { text-align: right; grid-column: 2; }

/* ---------- admin panel ---------- */
.adm { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100dvh; }
.adm-nav { background: var(--bg-0); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.adm-nav .brand { padding: 4px 8px 18px; font-size: 17px; }
.adm-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-s); text-align: left; color: var(--t2); font-weight: 550; font-size: 14.5px; }
.adm-nav button:hover { background: var(--bg-hover); color: var(--t1); }
.adm-nav button[aria-current="true"] { background: var(--bg-active); color: var(--t1); }
.adm-nav .grow { flex: 1; }
.adm-main { overflow-y: auto; padding: 28px 32px 60px; background: var(--bg-2); }
.adm-main h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.01em; }
.adm-main .sub { color: var(--t2); margin: 0 0 22px; }
.adm-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.adm-bar .input { max-width: 320px; height: 36px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--bg-1); }
.stat small { display: block; color: var(--t3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat b { display: block; font-size: 28px; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--t3); padding: 10px 12px; background: var(--bg-1); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--bg-hover); }
.tbl .cipher { font-family: var(--mono); font-size: 12px; color: var(--t3); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.uline { display: flex; align-items: center; gap: 10px; }
.uline .av { width: 28px; height: 28px; font-size: 11px; }
.adm-detail { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel-card { border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; background: var(--bg-1); }
.panel-card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--t2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--t3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- link page ---------- */
.term { background: #0c120e; color: #cfe3d3; font-family: var(--mono); font-size: 13.5px; border-radius: var(--r); padding: 12px 14px; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; overflow-x: auto; }
.term code { flex: 1; white-space: nowrap; }
.term .iconbtn { color: #9fb7a5; }
.term .iconbtn:hover { background: rgba(255,255,255,.08); color: #fff; }
.vcode { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 10px; color: var(--accent-t); }
.devices { margin-top: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .app, .app.with-members { grid-template-columns: 320px minmax(0, 1fr); }
  .app.with-members .info { position: fixed; right: 0; top: 0; bottom: 0; width: 320px; z-index: 20; box-shadow: var(--shadow-lg); }
}
@media (max-width: 760px) {
  .app, .app.with-members { grid-template-columns: minmax(0, 1fr); }
  .app .main { display: none; }
  .app.in-chat .side { display: none; }
  .app.in-chat .main { display: flex; }
  .app.with-members .info { width: 100%; }
  .main-h .back { display: inline-grid; margin-left: -8px; }
  .mrow { padding: 0 8px; }
  .bubble { max-width: 84%; }
  .m-more { display: none; }
  .composer { padding: 4px 8px 10px; }
  .settings-box, .settings.wide .settings-box { width: 100%; }
  .prof-edit { grid-template-columns: 1fr; justify-items: center; }
  .roles-layout { grid-template-columns: 1fr; }
  .dwrap { grid-template-columns: 1fr; }
  .dnav { display: none; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px 12px; }
  .dnav-toggle:checked ~ .dnav { display: block; }
  .dnav-btn { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--t2); cursor: pointer; }
  .dmain { padding: 28px 16px 60px; }
  .prose h1 { font-size: 28px; }
  .adm { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .adm-nav { flex-direction: row; overflow-x: auto; padding: 8px; }
  .adm-nav .brand, .adm-nav .grow { display: none; }
  .adm-main { padding: 20px 16px 60px; }
  .adm-detail { grid-template-columns: 1fr; }
  .card { padding: 22px 18px; }
  .shell-top { padding: 16px; }
  .profile { width: min(320px, calc(100vw - 24px)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.center { text-align: center; }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); min-width: 0; align-content: start; }

/* ---------- auth layout (landing, login, unlock, link, panel) ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 44%) 1fr; background: var(--bg-2); }
.auth-brand { position: relative; overflow: hidden; background: var(--brand); color: #e7efe6; padding: 32px 40px; display: flex; flex-direction: column; justify-content: space-between; }
:root[data-theme="dark"] .auth-brand { background: #172a1e; }
.auth-brand .wordmark { display: inline-flex; align-items: center; gap: 10px; color: #e7efe6; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.auth-brand .wordmark:hover { text-decoration: none; }
.auth-brand .wordmark .logo { width: 28px; }
.auth-brand .wordmark small { font-weight: 500; opacity: .6; font-size: 15px; }
.auth-mark { position: absolute; left: 40px; bottom: -6%; width: min(78%, 520px); color: #e7efe6; }
.auth-brand .claim { position: relative; z-index: 1; font-size: 13px; opacity: .65; margin: 0; }
.auth-main { display: flex; flex-direction: column; padding: 32px 24px; }
.auth-form { flex: 1; width: 100%; max-width: 360px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; padding: 24px 0; }
.auth-form h1 { font-size: 24px; letter-spacing: -.015em; margin: 0 0 6px; line-height: 1.25; }
.auth-form .sub { color: var(--t2); margin: 0 0 24px; font-size: 14.5px; }
.auth-form .switch-line { margin: 18px 0 0; font-size: 14px; color: var(--t2); }
.auth-form .switch-line a { font-weight: 600; }
.auth-form .step { font-size: 12.5px; color: var(--t3); margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.auth-foot { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 12.5px; }
.auth-foot a { color: var(--t3); }
.auth .input { height: 46px; }
.auth .qr { border-radius: var(--r-s); }
.auth .codes { border-radius: var(--r-s); }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 16px 20px; flex-direction: row; align-items: center; }
  .auth-mark, .auth-brand .claim { display: none; }
  .auth-main { padding: 8px 20px 20px; }
}
.home-empty { flex: 1; display: grid; place-items: center; padding: 24px; }
.home-empty span { background: var(--bg-3); color: var(--t2); font-size: 13.5px; padding: 6px 14px; border-radius: 14px; }
.settings .lead-text { color: var(--t2); font-size: 14px; margin: -8px 0 18px; max-width: 620px; }
.profile .p-head > .av { flex: none; }
.profile .p-head > .p-names { min-width: 0; flex: 1; }
.profile .nm { overflow-wrap: anywhere; line-height: 1.25; }
.profile .p-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-badge { width: 80px; height: 80px; border-radius: 18px; margin: 0 auto 16px; overflow: hidden; display: grid; place-items: center; flex: none;
  background: var(--av, var(--accent)); color: #fff; font-size: 26px; font-weight: 700; }
.g-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prof-edit .g-badge { margin: 0; }
.row-set { flex-wrap: wrap; }
.row-set .select, .row-set select { max-width: 100%; }
.bubble { -webkit-touch-callout: none; }
img { max-width: 100%; }

/* ---------- messenger layout (no server rail) ---------- */
.side-top { height: 60px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; }
.side-title { flex: 1; min-width: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-btn { border: 0; background: none; padding: 2px; border-radius: 50%; display: grid; place-items: center; }
.me-btn:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.me-btn .av { width: 36px; height: 36px; }
.list-label { padding: 12px 12px 4px; font-size: 12.5px; font-weight: 700; color: var(--t3); }
.g-ini.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }
.conv.active .g-ini { box-shadow: 0 0 0 2px var(--accent-ink); }
.ai-av { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: conic-gradient(from 210deg, #233C2B, #3f8f5c, #1d5e7a, #233C2B); }
.ai-av .ic { width: 22px; height: 22px; }
.room-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-t); flex: none; }
.back-chats { position: relative; }
.back-chats .badge { position: absolute; top: -2px; right: -6px; height: 18px; min-width: 18px; font-size: 10.5px; background: var(--accent-t); border: 2px solid var(--bg-2); }
.group-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 8px; border-radius: var(--r); text-align: left; color: var(--t1); }
.group-head:hover { background: var(--bg-hover); }
.group-head .g-ini { width: 36px; height: 36px; border-radius: 10px; }
.gh-txt { flex: 1; min-width: 0; line-height: 1.25; }
.gh-txt b { display: block; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-txt small { display: block; font-size: 12.5px; color: var(--t3); }
.chan-cat { justify-content: flex-start; padding: 16px 10px 6px; gap: 8px; }
.chan-cat span { flex: 1; }
.chan-cat .cat-count { font-style: normal; font-size: 11.5px; color: var(--t3); background: var(--bg-3); border-radius: 9px; padding: 1px 7px; }
.chan-cat .ic.chev { order: 9; }
.room { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r); color: var(--t1); cursor: pointer; }
.room:hover { background: var(--bg-hover); text-decoration: none; }
.room.active { background: var(--accent); color: var(--accent-ink); }
.room-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-3); color: var(--accent-t); flex: none; }
.room.voice .room-ic { color: #2f7fa3; }
.room.active .room-ic { background: rgba(255,255,255,.14); color: var(--accent-ink); }
.room-meta { flex: 1; min-width: 0; }
.room-name { display: flex; align-items: baseline; gap: 6px; }
.room-name b { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-name time { font-size: 12px; color: var(--t3); flex: none; }
.room-prev { display: block; font-size: 13.5px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.room.unread .room-name b { font-weight: 800; }
.room.unread .room-prev { color: var(--t1); }
.room.active .room-prev, .room.active .room-name time { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.room .room-gear { width: 28px; height: 28px; opacity: 0; flex: none; }
.room:hover .room-gear { opacity: 1; }
.room.active .room-gear { color: var(--accent-ink); }
.av-stack { display: flex; flex: none; }
.av-stack .av { width: 24px; height: 24px; font-size: 10px; border: 2px solid var(--bg-2); margin-left: -8px; }
.voice-users { padding: 0 0 8px 66px; }

/* settings: panel sliding in from the left, stacked navigation */
.settings { display: block; padding: 0; background: rgba(5, 10, 7, .35); }
.settings-box, .settings.wide .settings-box { position: absolute; left: 0; top: 0; bottom: 0; width: min(440px, 100%); height: 100%; display: block; border-radius: 0; animation: slidein .16s ease-out; box-shadow: var(--shadow-lg); }
.settings.wide .settings-box { width: min(600px, 100%); }
@keyframes slidein { from { transform: translateX(-24px); opacity: .4; } }
.settings nav { height: 100%; border-right: 0; padding: 64px 12px 20px; background: var(--bg-2); }
.settings nav button { padding: 12px 12px; font-size: 15px; border-radius: var(--r); }
.settings nav .label { font-size: 13px; padding: 0 12px 10px; }
.settings section { height: 100%; padding: 12px 20px 40px; }
.settings.sub-open nav { display: none; }
.settings:not(.sub-open) section { display: none; }
.settings .sec-top { height: 48px; display: flex; align-items: center; margin: 0 0 4px -8px; }
.settings .settings-x { position: absolute; top: 12px; right: 12px; z-index: 2; }
.settings .roles-layout { grid-template-columns: 1fr; }
.settings .prof-edit { grid-template-columns: 1fr; justify-items: start; }

/* admin: top navigation */
.adm { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.adm-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; padding: 8px 20px; border-bottom: 1px solid var(--line); }
.adm-nav .brand { padding: 0 16px 0 0; }
.adm-nav .grow { flex: 1; }
.adm-nav button { white-space: nowrap; padding: 7px 10px; font-size: 14px; }
.adm-main { padding: 28px max(20px, calc((100vw - 1200px) / 2)) 60px; }

/* ---------- composer extras ---------- */
.composer { position: relative; }
.composer-box .attach { width: 42px; height: 42px; border-radius: 50%; color: var(--t2); flex: none; }
.composer-box .attach:hover { color: var(--accent-t); background: var(--bg-2); }
.composer .send.mic { background: var(--bg-2); color: var(--accent-t); border: 1px solid var(--line); }
.composer .send.mic:hover { background: var(--accent-soft); }
.composer-bar.img img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--r-s); flex: none; }
.cmd-suggest { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 5; max-height: 280px; overflow-y: auto; }
.cmd-suggest button { display: grid; grid-template-columns: auto auto 1fr auto; align-items: baseline; gap: 4px 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-s); color: var(--t1); }
.cmd-suggest button:hover, .cmd-suggest button:first-child { background: var(--bg-hover); }
.cmd-suggest b { font-weight: 700; color: var(--accent-t); }
.cmd-suggest .cmd-opts { font-family: var(--mono); font-size: 12px; color: var(--t3); }
.cmd-suggest small { color: var(--t2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-suggest .cmd-bot { font-style: normal; font-size: 12px; color: var(--t3); }
.cmd-used { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--accent-t); margin-bottom: 2px; }
.cmd-used .ic { width: 13px; height: 13px; }
.bot-badge { display: inline-flex; align-items: center; justify-content: center; gap: 3px; height: 18px; padding: 0 7px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 800; letter-spacing: .05em; line-height: 1; vertical-align: 2px; flex: none; }
.bot-badge .ic { width: 11px; height: 11px; stroke-width: 3.2; }

/* recorder + voice changer chips */
.recorder { background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px; padding: 8px 8px 8px 12px; }
.rec-row { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: breathe 1.2s ease-in-out infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 40px; }
.rec-hint { flex: 1; color: var(--t3); font-size: 13px; }
.fx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 8px; }
.fx-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--t2); margin-right: 2px; }
.fx-chip { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--t1); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.fx-chip:hover { border-color: var(--accent-t); }
.fx-chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.modal .fx-chips { margin: 0; }
.fx-select { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--accent-t); }
.fx-select select { flex: 1; min-width: 0; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--bg-2); color: var(--t1); padding: 0 8px; font-size: 13px; }

/* attachments in bubbles */
.att-img { display: block; position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--bg-3); max-height: 360px; margin: 2px 0 4px; cursor: zoom-in; display: grid; place-items: center; }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-err { display: inline-flex; align-items: center; gap: 6px; color: var(--t3); font-size: 13px; padding: 12px; }
.lightbox { max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--r-s); object-fit: contain; }
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: min(240px, 60vw); padding: 2px 0; }
.voice-msg.pending { color: var(--t3); font-size: 13px; }
.vplay { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; padding: 0; }
.vplay .ic { width: 15px; height: 15px; fill: currentColor; }
.vtrack { flex: 1; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--t3) 30%, transparent); position: relative; cursor: pointer; overflow: hidden; }
.vtrack i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-t); }
.vtime { font-size: 12px; color: var(--t2); font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.vfx { color: var(--accent-t); display: grid; place-items: center; }
.mine .bubble .att-img + .meta, .bubble .voice-msg + .meta { margin-top: 2px; }

/* ---------- Cyprix AI ---------- */
.ai-av.s { width: 36px; height: 36px; }
.ai-av.s .ic { width: 18px; height: 18px; }
.ai-av.xs { width: 32px; height: 32px; }
.ai-av.xs .ic { width: 15px; height: 15px; }
.ai-row .meta .prev-txt { color: var(--t3); }
.ai-notice span { background: color-mix(in srgb, var(--warn) 16%, var(--bg-2)); color: var(--t1); text-align: left; max-width: 640px; }
.ai-notice a { font-weight: 700; }
.ai-code { background: rgba(0,0,0,.08); border-radius: var(--r-s); padding: 10px 12px; overflow-x: auto; font-family: var(--mono); font-size: 13px; margin: 6px 0; white-space: pre; }
:root[data-theme="dark"] .ai-code { background: rgba(255,255,255,.07); }
.ai-typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--t3); animation: blink 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .2s; }
.ai-typing i:nth-child(3) { animation-delay: .4s; }
.err-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--danger); }

/* reports */
.report-preview { margin-top: 4px; font-size: 13px; }
.report-preview summary { cursor: pointer; color: var(--t2); font-weight: 600; }
.report-preview p { margin: 6px 0 0; overflow-wrap: anywhere; }

/* ---------- link: tabs + bots ---------- */
.auth-form.wide { max-width: 640px; justify-content: flex-start; padding-top: 32px; }
.link-tabs { display: flex; gap: 4px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.link-tabs a { padding: 10px 14px; color: var(--t2); font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.link-tabs a:hover { color: var(--t1); text-decoration: none; }
.link-tabs a[aria-selected="true"] { color: var(--accent-t); border-color: var(--accent-t); }
.bots-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.bots-head .sub { margin-bottom: 16px; }
.bot-list { display: grid; gap: 12px; }
.bot-card { display: flex; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); align-items: flex-start; }
.bot-av { border: 0; background: none; padding: 0; border-radius: 50%; flex: none; }
.bot-av .av { width: 64px; height: 64px; font-size: 24px; }
.bot-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.bot-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; }
.bot-info p { margin: 2px 0; overflow-wrap: anywhere; }
.bot-cmds { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.bot-cmds code { font-family: var(--mono); font-size: 12px; background: var(--bg-3); padding: 2px 7px; border-radius: 4px; }
.bot-info .btn-row { margin-top: 8px; }
.bot-empty { display: grid; justify-items: center; gap: 8px; padding: 32px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--t3); }
.bot-empty .ic { width: 36px; height: 36px; }
.bot-sdk { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.bot-sdk b { display: block; margin-bottom: 8px; }
.code-sample { background: #0c120e; color: #cfe3d3; border-radius: var(--r-s); padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; line-height: 1.5; }
.term code.token { word-break: break-all; white-space: normal; font-size: 12.5px; }
.red-txt { color: var(--danger) !important; }

/* ---------- admin extras ---------- */
.report-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.report-note { margin: 0 0 10px; padding: 8px 12px; background: var(--bg-2); border-radius: var(--r-s); white-space: pre-wrap; overflow-wrap: anywhere; }
.report-msgs { display: grid; gap: 6px; margin-bottom: 8px; }
.report-msg { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 12px; }
.report-msg.target { border-left: 3px solid var(--danger); }
.report-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; font-size: 14px; }
.ok-txt { color: var(--ok); font-weight: 600; }
.bad-txt { color: var(--danger); font-weight: 600; }
.bot-admin .uline { margin-bottom: 8px; align-items: flex-start; }
.ai-log { display: grid; gap: 8px; max-width: 860px; }
.ai-log-row { padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line); }
.ai-log-row.user { background: var(--accent-soft); margin-left: 12%; }
.ai-log-row.assistant { background: var(--bg-1); margin-right: 12%; }
@media (max-width: 760px) {
  .bots-head { flex-direction: column; }
  .bot-card { flex-direction: column; }
  .cmd-suggest { left: 8px; right: 8px; }
}
/* Message box: grows with the text; it still scrolls when very long, but never shows a scrollbar. */
.composer textarea { overflow-y: hidden; scrollbar-width: none; }
.composer textarea::-webkit-scrollbar { display: none; width: 0; height: 0; }
.composer textarea.tall { overflow-y: auto; }

.profile .nm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile .p-head .av img { width: 100%; height: 100%; object-fit: cover; }
.profile .bot-note { flex: 1; margin: 0; align-self: center; line-height: 1.4; }
.member .nm b .nm-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.av { aspect-ratio: 1; }
.av img { aspect-ratio: 1; }


/* ---------- modern refresh ---------- */
.sys span { background: color-mix(in srgb, var(--bg-2) 80%, transparent); color: var(--t2); font-size: 12.5px; padding: 6px 12px; border-radius: 999px; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.sys.start span, .sys.note-soft span { background: color-mix(in srgb, var(--bg-2) 72%, transparent); color: var(--t2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; font-size: 12.5px; line-height: 1.45; max-width: 460px; text-align: center; display: inline-flex; gap: 8px; align-items: center; box-shadow: none; }
.sys.start .ic, .sys.note-soft .ic { width: 14px; height: 14px; color: var(--accent-t); flex: none; }
.ai-notice span { background: color-mix(in srgb, var(--warn) 10%, var(--bg-2)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); text-align: left; max-width: 560px; }
.sys.day span { font-size: 12px; padding: 4px 12px; }
.conv { border-radius: 14px; padding: 9px 10px; }
.conv.active { background: var(--accent-soft); color: var(--t1); }
.conv.active .av { --dotbg: var(--accent-soft); }
.conv.active .name time, .conv.active .prev-txt, .conv.active .you { color: var(--t3); }
.conv.active .typing-txt { color: var(--accent-t); }
.room { border-radius: 14px; }
.room.active { background: var(--accent-soft); color: var(--t1); }
.room.active .room-ic { background: var(--accent); color: var(--accent-ink); }
.room.active .room-prev, .room.active .room-name time { color: var(--t3); }
.room.active .room-gear { color: var(--t2); }
.side-search { border-radius: 12px; height: 38px; }
.main-h { background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.composer textarea { border-radius: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.bubble { border-radius: 16px; box-shadow: 0 1px 1.5px rgba(0,0,0,.07); }
.modal { border-radius: var(--r-l); }
.modal-f { border-radius: 0 0 var(--r-l) var(--r-l); }
.menu { border-radius: 12px; padding: 6px; }
.menu button { border-radius: 8px; }
.profile { border-radius: 16px; }
.toast { border-radius: 12px; }
.panel-card { border-radius: 16px; }
.stat { border-radius: 14px; }

/* spaces strip (chats, AI, groups, support) */
.spaces { display: flex; gap: 4px; padding: 2px 10px 10px; overflow-x: auto; scrollbar-width: none; flex: none; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.spaces::-webkit-scrollbar { display: none; }
.space { flex: none; width: 60px; display: grid; justify-items: center; gap: 5px; border: 0; background: none; padding: 6px 0 4px; color: var(--t2); border-radius: 12px; }
.space:hover { background: var(--bg-hover); }
.space .tile { position: relative; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--bg-3); color: var(--t1); transition: box-shadow .15s, transform .15s; }
.space .tile > img, .space .g-fill { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: grid; place-items: center; background: var(--av, var(--accent)); color: #fff; font-weight: 800; font-size: 15px; }
.space.active .tile { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--accent-t); }
.space.active .lbl { color: var(--t1); font-weight: 800; }
.space .lbl { font-size: 11px; font-weight: 600; max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.space.ai .tile { background: conic-gradient(from 210deg, #233C2B, #3f8f5c, #1d5e7a, #233C2B); color: #fff; }
.space.add .tile { background: none; border: 1.5px dashed var(--line-2); color: var(--accent-t); }
.space .badge { position: absolute; top: -5px; right: -7px; border: 2px solid var(--bg-2); height: 20px; min-width: 20px; }
.space-dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent-t); border: 2px solid var(--bg-2); }
.side-top + .spaces { margin-top: -2px; }

/* support */
.support-body { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 16px; align-content: start; min-height: 100%; }
.support-hero { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.support-hero h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.01em; }
.support-hero p { margin: 0 0 16px; color: var(--t2); }
.ticket-list { display: grid; gap: 6px; }
.ticket-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg-2); border-radius: 14px; padding: 12px 14px; color: var(--t1); }
.ticket-row:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.ticket-row.unread b { font-weight: 800; }
.ticket-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-t); display: grid; place-items: center; flex: none; }
.ticket-meta { flex: 1; min-width: 0; }
.ticket-meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-meta small { color: var(--t3); font-size: 12.5px; }
.status-pill, .prio-pill { display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; flex: none; }
.st-open { background: color-mix(in srgb, #2f7fa3 16%, transparent); color: #2f7fa3; }
.st-pending { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.st-closed { background: var(--bg-3); color: var(--t3); }
:root[data-theme="dark"] .st-open { color: #6cbfe6; }
.pr-low { background: var(--bg-3); color: var(--t3); }
.pr-normal { background: var(--accent-soft); color: var(--accent-t); }
.pr-high { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pr-urgent { background: var(--danger); color: #fff; }
.staff-av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.staff-badge { display: inline-flex; align-items: center; height: 16px; padding: 0 6px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: 9.5px; font-weight: 800; letter-spacing: .05em; }
.closed-hint { text-align: center; margin: 0 0 8px; }
.close-ticket { display: block; margin: 8px auto 0; }
.main-h .h-ic .ic { width: 18px; height: 18px; }

/* admin tickets */
.select.sm { height: 36px; width: auto; }
.check.inline { margin: 0; align-items: center; white-space: nowrap; }
.check.inline input { margin: 0; }
.adm-nav button .badge { margin-left: 4px; height: 18px; min-width: 18px; font-size: 10.5px; }
.tbl tr.unread-row td { font-weight: 600; }
.ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ticket-title h1 { margin: 0; }
.ticket-layout { grid-template-columns: minmax(0, 1fr) 300px; }
.ticket-thread { display: grid; gap: 10px; }
.tk-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-1); }
.tk-msg.user { justify-self: start; }
.tk-msg.staff { justify-self: end; background: var(--accent-soft); border-color: transparent; }
.tk-msg.internal { background: color-mix(in srgb, var(--warn) 12%, var(--bg-2)); border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); }
.tk-msg .pill { height: 18px; margin-left: 6px; font-size: 11px; }
.tk-sys { justify-self: center; font-size: 12px; color: var(--t3); display: inline-flex; gap: 5px; align-items: center; }
.tk-sys .ic { width: 12px; height: 12px; }
.reply-box .textarea { min-height: 110px; }
.reply-box .textarea.internal { border-color: color-mix(in srgb, var(--warn) 60%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--bg-2)); }
.reply-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.reply-actions .grow { flex: 1; }
@media (max-width: 760px) { .ticket-layout { grid-template-columns: 1fr; } .tk-msg { max-width: 100%; } }

/* admin roles & power */
.power { display: inline-flex; align-items: center; gap: 10px; min-width: 180px; }
.power-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-4); overflow: hidden; min-width: 120px; }
.power-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-t)); }
.power b { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.me-admin { display: grid; gap: 12px; margin-bottom: 16px; }
.admin-list { display: grid; gap: 12px; }
.admin-card { display: grid; gap: 12px; }
.admin-card.off { opacity: .6; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-chips .pill { height: 24px; font-size: 12px; }
.pill.off { opacity: .45; text-decoration: line-through; }
.perm-group { display: grid; gap: 6px; margin-bottom: 12px; }
.perm-editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; margin-top: 10px; }
.perm-editor .perm-group { margin-bottom: 8px; align-content: start; }
.perm-check { margin: 0; padding: 6px 8px; border-radius: 10px; }
.perm-check:hover { background: var(--bg-hover); }
.perm-check span { display: grid; }
.perm-check small { color: var(--t3); font-size: 12px; }
.perm-check.off { opacity: .45; cursor: not-allowed; }
.power-edit { display: flex; align-items: center; gap: 12px; }
.power-edit input[type=range] { flex: 1; accent-color: var(--accent); }
.power-num { min-width: 48px; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.locked { display: flex; align-items: center; gap: 6px; margin: 0; }

/* friends */
.friend-tabs { grid-template-columns: repeat(3, 1fr); margin-bottom: 8px; }
.friend-tabs .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--bg-4); font-size: 11.5px; }
.friend-tabs button[aria-selected="true"] .count { background: var(--accent); color: var(--accent-ink); }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--bg-2); border-radius: 14px; }
.friend-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; color: var(--t1); }
.friend-who .av { --dotbg: var(--bg-2); }
.friend-who span { min-width: 0; }
.friend-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-who small { display: block; color: var(--t3); font-size: 12.5px; }
.friend-acts { display: flex; gap: 6px; align-items: center; flex: none; }
.add-friend { display: flex; gap: 8px; }
.add-friend .input { flex: 1; }
.friends-btn { position: relative; }
.friends-btn .badge { position: absolute; top: -2px; right: -4px; height: 17px; min-width: 17px; font-size: 10px; border: 2px solid var(--bg-2); }
.profile .acts .btn.subtle:not(:first-child) { flex: none; width: 42px; padding: 0; }
.profile .acts .btn:not(.subtle):not(:first-child) { flex: none; }
@media (max-width: 760px) { .friend-row { flex-wrap: wrap; } .friend-acts { width: 100%; justify-content: flex-end; } }
.st-resolved { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.ticket-ic.st-resolved { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.ticket-ic.st-closed { background: var(--bg-3); color: var(--t3); }
.head-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.resolved-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--ok) 10%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); color: var(--t1); font-size: 14px; }
.resolved-box > span { flex: 1; min-width: 180px; }
.resolved-box > .ic { color: var(--ok); }
.close-ticket { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) { .head-acts .btn { padding: 0 10px; } }

.main-h .back.always { display: inline-grid; margin-left: -8px; }

/* groups home (groups.<domain>/) */
.group-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.group-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); background: var(--bg-2); border-radius: 16px; text-align: left; color: var(--t1); min-width: 0; }
.group-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.gc-meta { flex: 1; min-width: 0; }
.gc-meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-meta small { display: block; color: var(--t3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-row.active { background: var(--accent-soft); }
.groups-back { flex: none; margin-left: -4px; }

@media (max-width: 480px) { .head-acts .btn .bt { display: none; } .head-acts .btn { width: 34px; padding: 0; } }
