:root {
  color-scheme: dark;
  --bg: #101719;
  --bg-glow: #1b2929;
  --panel: #172223;
  --panel-raised: #1c2a2a;
  --panel-soft: #202e2e;
  --sidebar: #131e1f;
  --line: rgba(222, 240, 235, .085);
  --line-strong: rgba(222, 240, 235, .14);
  --text: #edf4ef;
  --muted: #91a39d;
  --muted-2: #657873;
  --accent: #a8ddc9;
  --accent-strong: #82c5ad;
  --accent-ink: #122b25;
  --danger: #f0a49d;
  --shadow: 0 28px 90px rgba(0, 0, 0, .25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf2ed;
  --bg-glow: #dce9df;
  --panel: #fbfdf9;
  --panel-raised: #f3f7f1;
  --panel-soft: #eaf1e9;
  --sidebar: #f3f7f1;
  --line: rgba(39, 69, 56, .10);
  --line-strong: rgba(39, 69, 56, .17);
  --text: #20312a;
  --muted: #6b8075;
  --muted-2: #8b9d93;
  --accent: #367f64;
  --accent-strong: #28684f;
  --accent-ink: #ffffff;
  --danger: #ad5148;
  --shadow: 0 28px 90px rgba(40, 65, 48, .11);
}
* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh; margin: 0; padding: 34px 20px; display: grid; place-items: center;
  color: var(--text); background: radial-gradient(ellipse at 52% -15%, var(--bg-glow), transparent 46%), var(--bg);
  transition: background .2s, color .2s;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
[hidden] { display: none !important; }
.ambient { position: fixed; z-index: -1; pointer-events: none; filter: blur(2px); opacity: .45; }
.ambient-one { width: 370px; height: 370px; top: -180px; left: 15%; border-radius: 50%; background: radial-gradient(circle, rgba(129, 194, 165, .12), transparent 68%); }
.ambient-two { width: 420px; height: 420px; right: -250px; bottom: -230px; border-radius: 50%; background: radial-gradient(circle, rgba(129, 194, 165, .08), transparent 70%); }
.shell { width: min(100%, 1220px); position: relative; }
.login-layout { min-height: 660px; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid var(--line); border-radius: 30px; background: var(--panel); box-shadow: var(--shadow); }
.login-aside { min-height: 660px; padding: 40px 46px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; background: linear-gradient(145deg, rgba(143, 197, 169, .12), transparent 58%), #182624; }
:root[data-theme="light"] .login-aside { background: linear-gradient(145deg, #dcebe0, #cbded0); color: #20352b; }
.login-aside::after { content: ""; position: absolute; width: 470px; height: 470px; right: -210px; bottom: -200px; border: 1px solid rgba(171, 220, 195, .12); border-radius: 50%; box-shadow: 0 0 0 45px rgba(171, 220, 195, .025), 0 0 0 90px rgba(171, 220, 195, .02); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { position: relative; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; color: #152c24; background: linear-gradient(145deg, #d2f0df, #83c7a9); box-shadow: 0 8px 24px rgba(117, 190, 151, .2); font-size: 28px; font-weight: 900; letter-spacing: -.09em; }
.brand-mark span { position: absolute; width: 6px; height: 6px; right: 9px; bottom: 10px; border-radius: 50%; background: #3c8665; }
.brand-mark.small { width: 37px; height: 37px; border-radius: 13px; font-size: 22px; }
.brand-lockup strong, .brand-caption { display: block; }
.brand-lockup strong { font-size: 17px; letter-spacing: -.04em; }
.brand-caption { margin-top: 3px; color: #90a69a; font-size: 8px; font-weight: 800; letter-spacing: .18em; }
:root[data-theme="light"] .brand-caption { color: #617d6c; }
.login-brand { position: relative; z-index: 1; }
.login-pitch { position: relative; z-index: 1; max-width: 470px; padding: 45px 0; }
.eyebrow { margin: 0 0 11px; color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .19em; }
:root[data-theme="light"] .login-aside .eyebrow { color: #397b5d; }
.eyebrow-dot, .live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #a7d9bd; box-shadow: 0 0 10px rgba(167, 217, 189, .65); vertical-align: 1px; }
.login-pitch h1 { margin: 0 0 19px; font-size: clamp(38px, 5.5vw, 62px); line-height: 1.02; letter-spacing: -.065em; font-weight: 750; }
.login-pitch h1 em { color: #9bd1b1; font-family: Georgia, serif; font-weight: 500; }
:root[data-theme="light"] .login-pitch h1 em { color: #397b5d; }
.login-pitch > p { max-width: 320px; margin: 0; color: #a5b8ad; font-size: 14px; line-height: 1.8; }
:root[data-theme="light"] .login-pitch > p { color: #61776a; }
.login-aside-foot { position: relative; z-index: 1; color: #98afa2; font-size: 10px; letter-spacing: .025em; }
.login-card { align-self: center; width: min(100%, 410px); margin: 0 auto; padding: 54px 48px; }
.login-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 43px; }
.mobile-brand { display: none; font-size: 19px; font-weight: 850; letter-spacing: -.05em; }
.secure-label { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.secure-label span { color: var(--accent); margin-right: 4px; }
.login-card h2 { margin: 0 0 8px; font-size: 29px; letter-spacing: -.055em; }
.login-card > p.muted { margin: 0 0 29px; color: var(--muted); font-size: 12px; }
label { display: block; margin: 17px 0 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
input, textarea { width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: 12px; outline: none; background: var(--panel-raised); color: var(--text); transition: border-color .15s, box-shadow .15s, background .15s; }
input { padding: 13px 14px; }
textarea { resize: vertical; padding: 12px 13px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.input-wrap { position: relative; }
.input-wrap input { padding-left: 42px; }
.input-icon { position: absolute; z-index: 1; top: 50%; left: 15px; color: var(--muted-2); font-size: 15px; transform: translateY(-50%); }
.primary { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 20px; border: 0; border-radius: 11px; padding: 11px 16px; color: var(--accent-ink); background: var(--accent); font-size: 11px; font-weight: 850; transition: transform .15s, filter .15s, box-shadow .15s; }
.primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 17%, transparent); }
.primary.full { width: 100%; margin-top: 25px; justify-content: space-between; padding: 0 17px; }
.button-arrow { font-size: 17px; font-weight: 400; }
.status { min-height: 17px; margin: 12px 0 0; color: var(--danger); font-size: 11px; line-height: 1.5; }
.status.success { color: var(--accent); }
.login-foot { margin-top: 29px; padding-top: 19px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 10px; }
.lock-icon { margin-right: 5px; color: var(--accent); }

/* Main chat layout */
.app-layout { min-height: min(850px, calc(100vh - 68px)); display: grid; grid-template-columns: 238px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 25px; background: var(--panel); box-shadow: var(--shadow); }
.sidebar { min-height: 100%; display: flex; flex-direction: column; padding: 25px 15px 17px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 9px 31px; }
.sidebar-brand strong { display: block; font-size: 15px; letter-spacing: -.04em; }
.sidebar-brand .brand-caption { font-size: 7px; }
.version-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.sidebar-section { margin-bottom: 26px; }
.sidebar-label { margin: 0; color: var(--muted-2); font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.sidebar-section > .sidebar-label { padding: 0 10px 10px; }
.nav-item { width: 100%; min-height: 39px; display: flex; align-items: center; gap: 11px; margin: 3px 0; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; color: var(--muted); background: transparent; text-align: left; font-size: 11px; font-weight: 650; transition: background .15s, color .15s, border .15s; }
.nav-item:hover { color: var(--text); background: var(--panel-raised); }
.nav-item.active { color: var(--text); border-color: var(--line); background: var(--panel-raised); box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { width: 17px; color: var(--muted-2); text-align: center; font-size: 17px; }
.nav-item.active .nav-icon { color: var(--accent); }
.hash-icon { font-size: 19px; }
.nav-live { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: #be9a65; }
.nav-live.connected { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.nav-count { min-width: 19px; margin-left: auto; padding: 2px 5px; border-radius: 6px; background: var(--panel-soft); color: var(--muted); text-align: center; font-size: 9px; }
.people-section { padding: 0 9px; }
.section-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 13px; }
.online-count { color: var(--muted-2); white-space: nowrap; font-size: 8px; }
.online-count i, .person-dot { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #82c9a2; }
.online-list { display: flex; flex-direction: column; gap: 9px; }
.online-person { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.online-person > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; color: #f1f5ef; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.online-avatar { flex-basis: 25px; width: 25px; height: 25px; border-radius: 8px; font-size: 9px; }
.person-dot { width: 5px; height: 5px; margin-left: auto; margin-right: 0; }
.small-note { color: var(--muted-2); font-size: 10px; }
.sidebar-spacer { flex: 1; min-height: 50px; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 12px; }
.admin-nav { color: var(--accent); }
.admin-nav[hidden] { display: none; }
.admin-nav.active { background: color-mix(in srgb, var(--accent) 9%, transparent); border-color: color-mix(in srgb, var(--accent) 16%, transparent); }
.nav-chevron { margin-left: auto; }
.self-card { display: flex; align-items: center; gap: 9px; padding: 11px 8px 2px; border-top: 1px solid var(--line); }
.self-avatar { flex-basis: 34px; width: 34px; height: 34px; }
.self-info { min-width: 0; flex: 1; }
.self-info strong, .self-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.self-info strong { font-size: 10px; }
.self-info span { margin-top: 4px; color: var(--muted-2); font-size: 8px; }
.icon-button { width: 31px; height: 31px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; font-size: 16px; transition: background .15s, color .15s, border .15s; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-soft); }
.settings-button { flex: 0 0 31px; font-size: 13px; }
.main-panel { min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
.main-header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 27px; border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 10px; }
.crumb-muted, .crumb-slash { color: var(--muted-2); }
.crumbs strong { font-weight: 750; }
.room-lock { margin-left: 1px; color: var(--accent); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.search-box { width: clamp(150px, 21vw, 235px); height: 32px; display: flex; align-items: center; gap: 7px; margin: 0; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted-2); background: var(--panel-raised); text-transform: none; }
.search-box > span { font-size: 18px; }
.search-box input { height: 28px; padding: 0; border: 0; border-radius: 0; outline: 0; background: transparent; box-shadow: none; font-size: 10px; }
.search-box input:focus { box-shadow: none; }
.search-box kbd { padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; color: var(--muted-2); font-size: 8px; }
.logout-button { border: 0; padding: 8px 0 8px 6px; color: var(--muted); background: transparent; font-size: 10px; }
.logout-button:hover { color: var(--text); }
.logout-button span { margin-left: 4px; color: var(--muted-2); }
.room-header { min-height: 130px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 23px 30px 20px; }
.room-title-group { display: flex; align-items: center; gap: 15px; }
.room-symbol { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 14px; color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); font-size: 24px; }
.room-eyebrow { margin-bottom: 5px; font-size: 8px; }
.room-header h1 { margin: 0 0 5px; font-size: 23px; letter-spacing: -.055em; }
.room-subtitle { margin: 0; color: var(--muted); font-size: 10px; }
.room-details { display: flex; align-items: center; gap: 9px; color: var(--muted-2); white-space: nowrap; font-size: 9px; }
.avatar-stack { display: flex; align-items: center; padding-left: 5px; }
.stack-avatar, .stack-more { width: 23px; height: 23px; flex-basis: 23px; margin-left: -5px; border: 2px solid var(--panel); border-radius: 8px; font-size: 7px; }
.stack-more { color: var(--text); background: var(--panel-soft); }
.detail-divider { width: 1px; height: 14px; margin: 0 2px; background: var(--line-strong); }
.room-live { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.room-live i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.room-live:not(.connected) i { background: #be9a65; box-shadow: none; }
.message-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 31px; padding: 0 30px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 8px; font-weight: 850; letter-spacing: .15em; }
.search-summary { color: var(--accent); font-size: 9px; font-weight: 600; letter-spacing: 0; }
.messages { flex: 1 1 auto; height: min(48vh, 510px); min-height: 280px; overflow-y: auto; padding: 4px 30px 20px; border-bottom: 1px solid var(--line); scroll-behavior: smooth; scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
.empty-state { min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; font-size: 10px; }
.empty-orbit { width: 43px; height: 43px; display: grid; place-items: center; margin-bottom: 4px; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 15px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: 19px; }
.empty-state strong { color: var(--text); font-size: 13px; }
.search-empty { min-height: 200px; }
.date-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--muted-2); font-size: 8px; font-weight: 750; letter-spacing: .08em; }
.date-divider::before, .date-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.message { position: relative; display: flex; align-items: flex-start; gap: 11px; margin: 14px 0; padding: 2px 0; }
.message > .avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; }
.message-content { min-width: 0; flex: 1; }
.message-heading { min-height: 19px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 0 0 3px; }
.message-author { color: var(--text); font-size: 10px; font-weight: 800; }
.message-time, .edited-label { color: var(--muted-2); font-size: 8px; }
.message-text { max-width: 760px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.mine .message-text { color: var(--text); }
.quoted-message { max-width: 500px; display: flex; flex-direction: column; gap: 2px; margin: 7px 0 6px; padding: 7px 10px; border-left: 2px solid var(--accent); border-radius: 0 7px 7px 0; background: var(--panel-raised); }
.quoted-message strong { color: var(--accent); font-size: 8px; }
.quoted-message span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.message-actions { display: flex; align-items: center; gap: 4px; margin-top: 5px; opacity: 0; transition: opacity .15s; }
.message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; }
.message-action { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; color: var(--muted-2); background: var(--panel-raised); font-size: 8px; }
.message-action:hover { color: var(--text); border-color: var(--line-strong); }
.reaction-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.reaction-chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; color: var(--muted); background: var(--panel-raised); font-size: 9px; }
.reaction-chip.reacted { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.system-message { margin: 16px 0; }
.system-notice { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.system-spark { color: var(--accent); font-size: 16px; }
.system-content { min-width: 0; flex: 1; }
.system-content strong { color: var(--accent); font-size: 8px; letter-spacing: .13em; }
.system-content p { margin: 3px 0 2px; color: var(--text); font-size: 10px; line-height: 1.55; }
.system-content time { color: var(--muted-2); font-size: 8px; }
.typing-indicator { min-height: 0; height: 0; padding: 0 30px; color: var(--muted-2); font-size: 9px; opacity: 0; transition: opacity .15s, height .15s; }
.typing-indicator.visible { height: 22px; padding-top: 5px; opacity: 1; }
.typing-dots { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: 1px; }
.typing-dots i { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); animation: bounce .8s infinite alternate; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { to { transform: translateY(-3px); opacity: .4; } }
.reply-preview { display: flex; align-items: center; gap: 10px; margin: 10px 28px 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-raised); }
.reply-mark { width: 3px; align-self: stretch; border-radius: 4px; background: var(--accent); }
.reply-copy { min-width: 0; flex: 1; }
.reply-copy span { color: var(--muted); font-size: 9px; }
.reply-copy strong { color: var(--accent); }
.reply-copy p { overflow: hidden; margin: 3px 0 0; color: var(--muted-2); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.composer { min-height: 53px; display: flex; align-items: center; gap: 10px; margin: 10px 25px 7px; padding: 5px 7px 5px 10px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel-raised); transition: border .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.composer input { flex: 1; height: 39px; padding: 0 2px; border: 0; border-radius: 0; outline: 0; background: transparent; box-shadow: none; font-size: 11px; }
.composer input:focus { border: 0; box-shadow: none; }
.composer-tool { width: 30px; height: 30px; flex: 0 0 30px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 19px; }
.composer-tool:hover { color: var(--accent); background: var(--panel-soft); }
.char-hint { color: var(--muted-2); white-space: nowrap; font-size: 8px; }
.send-button { width: 37px; height: 37px; flex: 0 0 37px; display: grid; place-items: center; border: 0; border-radius: 11px; color: var(--accent-ink); background: var(--accent); font-size: 19px; font-weight: 850; transition: transform .15s, filter .15s; }
.send-button:hover { transform: translateY(-1px); filter: brightness(1.07); }
.composer-footer { display: flex; justify-content: space-between; gap: 10px; padding: 0 29px 16px; color: var(--muted-2); font-size: 8px; }
#message-status { text-align: right; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; padding: 11px 28px 14px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 8px; letter-spacing: .035em; }
.app-footer > span:last-child { font-size: 7px; letter-spacing: .14em; }
.footer-heart { color: #c88782; }

/* Admin studio */
.admin-panel { margin: 15px 25px 22px; padding: 20px; border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); border-radius: 16px; background: var(--panel-raised); animation: panel-in .2s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.admin-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.admin-panel-heading h2 { margin: 0 0 5px; font-size: 19px; letter-spacing: -.04em; }
.admin-panel-heading p.muted { margin: 0; color: var(--muted); font-size: 9px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 11px; }
.stat-card { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.stat-card > span, .stat-card small { display: block; color: var(--muted-2); font-size: 7px; font-weight: 850; letter-spacing: .13em; }
.stat-card strong { display: block; margin: 7px 0 3px; color: var(--text); font-size: 23px; letter-spacing: -.05em; }
.stat-card small { font-size: 8px; font-weight: 500; letter-spacing: 0; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.admin-card-title { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.admin-card-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: 18px; }
.announcement-icon { font-size: 14px; }
.admin-card-title h3, .members-head h3 { margin: 0 0 3px; font-size: 11px; }
.admin-card-title p, .members-head p { margin: 0; color: var(--muted-2); font-size: 8px; }
.admin-form label { margin: 10px 0 6px; font-size: 8px; }
.admin-form input, .admin-form textarea { padding: 9px 10px; border-radius: 9px; font-size: 10px; }
.admin-form .primary { width: 100%; margin-top: 11px; justify-content: space-between; min-height: 37px; padding: 0 11px; font-size: 9px; }
.secondary-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: var(--panel-soft); font-size: 9px; font-weight: 750; }
.secondary-button:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); color: var(--accent); }
.admin-form .secondary-button { width: 100%; margin-top: 11px; }
.members-card { margin-top: 10px; }
.members-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.small-button { min-height: 29px; font-size: 8px; }
.user-list { display: flex; flex-direction: column; }
.member-row { min-width: 0; display: grid; grid-template-columns: minmax(120px, 1fr) 60px auto; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid var(--line); }
.member-identity { min-width: 0; display: flex; align-items: center; gap: 8px; }
.member-avatar { width: 29px; height: 29px; flex-basis: 29px; border-radius: 9px; font-size: 9px; }
.member-details { min-width: 0; }
.member-details strong, .member-details span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-details strong { font-size: 9px; }
.member-details span { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.member-status { color: var(--muted-2); font-size: 7px; font-weight: 850; letter-spacing: .08em; }
.member-status.is-online { color: var(--accent); }
.member-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.member-action-button { min-height: 25px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--panel-raised); font-size: 7px; }
.member-action-button:hover { border-color: var(--line-strong); color: var(--text); }
.member-action-button.danger-action:hover { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.you-label { color: var(--accent); font-size: 7px; font-weight: 850; letter-spacing: .1em; }
.admin-footnote { margin: 12px 2px 0; color: var(--muted-2); font-size: 8px; line-height: 1.55; }

/* Dialog and notifications */
.settings-dialog { width: min(100% - 30px, 420px); padding: 25px; border: 1px solid var(--line-strong); border-radius: 17px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.settings-dialog::backdrop { background: rgba(5, 12, 11, .68); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.dialog-heading h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.04em; }
.dialog-heading p.muted { margin: 0; font-size: 9px; }
.settings-dialog label { margin-top: 13px; }
.settings-dialog input { font-size: 11px; }
.settings-dialog .full { margin-top: 8px; }
.toast-region { position: fixed; z-index: 20; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { max-width: min(360px, calc(100vw - 40px)); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--panel-raised); box-shadow: 0 12px 34px rgba(0,0,0,.18); font-size: 10px; animation: panel-in .2s ease-out; }
.toast.error { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 850px) {
  body { padding: 16px; }
  .app-layout { grid-template-columns: 205px minmax(0, 1fr); min-height: calc(100vh - 32px); }
  .sidebar { padding-inline: 11px; }
  .main-header { padding-inline: 19px; }
  .room-header { padding-inline: 21px; }
  .messages { padding-inline: 21px; }
  .message-toolbar { padding-inline: 21px; }
  .admin-panel { margin-inline: 17px; }
  .member-row { grid-template-columns: minmax(100px, 1fr) 52px auto; }
}
@media (max-width: 650px) {
  body { display: block; padding: 8px; }
  .shell { width: 100%; }
  .login-layout { min-height: calc(100vh - 16px); grid-template-columns: 1fr; border-radius: 19px; }
  .login-aside { display: none; }
  .login-card { width: 100%; max-width: 430px; padding: 35px 27px; }
  .login-card-head { margin-bottom: 38px; }
  .mobile-brand { display: block; }
  .app-layout { min-height: calc(100dvh - 16px); grid-template-columns: 1fr; border-radius: 17px; }
  .sidebar { min-height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 0; }
  .sidebar-brand .brand-mark { width: 32px; height: 32px; border-radius: 11px; font-size: 19px; }
  .sidebar-brand strong { font-size: 13px; }
  .sidebar-section, .people-section, .sidebar-spacer { display: none; }
  .sidebar-bottom { display: flex; flex-direction: row; align-items: center; gap: 6px; }
  .sidebar-bottom .admin-nav { width: auto; min-height: 31px; padding: 0 8px; font-size: 9px; }
  .sidebar-bottom .admin-nav .nav-icon { display: none; }
  .self-card { gap: 6px; padding: 0; border: 0; }
  .self-avatar { width: 29px; height: 29px; flex-basis: 29px; border-radius: 9px; }
  .self-info { display: none; }
  .settings-button { width: 29px; height: 29px; }
  .main-header { min-height: 51px; padding: 0 12px; }
  .crumbs { gap: 6px; font-size: 9px; }
  .header-actions { gap: 6px; }
  .search-box { width: min(37vw, 155px); height: 29px; padding-inline: 6px; gap: 4px; }
  .search-box input { font-size: 9px; }
  .search-box kbd { display: none; }
  .header-actions > .icon-button { width: 29px; height: 29px; }
  .logout-button { font-size: 9px; }
  .room-header { min-height: 104px; padding: 17px 15px 14px; }
  .room-symbol { width: 39px; height: 39px; border-radius: 12px; }
  .room-title-group { gap: 11px; }
  .room-header h1 { font-size: 19px; }
  .room-subtitle { font-size: 9px; }
  .room-details { display: none; }
  .message-toolbar { min-height: 28px; padding-inline: 15px; }
  .messages { height: calc(100dvh - 290px); min-height: 240px; padding: 4px 15px 16px; }
  .message { gap: 8px; margin: 13px 0; }
  .message > .avatar { width: 29px; height: 29px; flex-basis: 29px; border-radius: 9px; }
  .message-actions { opacity: 1; flex-wrap: wrap; }
  .message-action { padding: 4px 6px; }
  .typing-indicator { padding-inline: 15px; }
  .reply-preview { margin-inline: 10px; }
  .composer { margin: 9px 9px 6px; min-height: 48px; gap: 6px; }
  .composer input { font-size: 10px; }
  .composer-footer { padding-inline: 13px; font-size: 7px; }
  .app-footer { padding-inline: 14px; }
  .admin-panel { margin: 10px 9px 15px; padding: 13px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .member-row { grid-template-columns: minmax(100px, 1fr) auto; gap: 6px; }
  .member-status { display: none; }
  .member-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 37px; }
  .member-action-button { font-size: 8px; }
  .app-footer > span:last-child { display: none; }
  .toast-region { right: 10px; bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Stable avatar color palette (kept in CSS so the strict CSP stays enabled). */
.avatar-tone-0 { background: #395f55; }
.avatar-tone-1 { background: #62517b; }
.avatar-tone-2 { background: #765745; }
.avatar-tone-3 { background: #3e5f79; }
.avatar-tone-4 { background: #6c5940; }
.avatar-tone-5 { background: #4b6650; }
.avatar-tone-6 { background: #744e61; }
.avatar-tone-7 { background: #4e626f; }
:root[data-theme="light"] .avatar-tone-0 { background: #729e8e; }
:root[data-theme="light"] .avatar-tone-1 { background: #9886b2; }
:root[data-theme="light"] .avatar-tone-2 { background: #b18a70; }
:root[data-theme="light"] .avatar-tone-3 { background: #7b9db7; }
:root[data-theme="light"] .avatar-tone-4 { background: #aa9167; }
:root[data-theme="light"] .avatar-tone-5 { background: #8ba889; }
:root[data-theme="light"] .avatar-tone-6 { background: #ae8298; }
:root[data-theme="light"] .avatar-tone-7 { background: #819ca8; }
