:root {
  color-scheme: light;
  --page: #f3f5f7;
  --surface: #fff;
  --surface-soft: #f8f9fb;
  --surface-hover: #f1f3f8;
  --ink: #1d2532;
  --ink-soft: #4f5c6d;
  --muted: #657285;
  --line: #e4e8ed;
  --accent: #4d5f9e;
  --accent-strong: #3d4f8c;
  --accent-soft: #edf0fa;
  --bubble-mine: #e8edfc;
  --bubble-other: #f1f3f6;
  --green: #23835a;
  --danger: #a43743;
  --shadow: 0 16px 42px #1c29400c;
  --radius: 16px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #11151c;
  --surface: #191f29;
  --surface-soft: #1e2530;
  --surface-hover: #252e3b;
  --ink: #e8ecf3;
  --ink-soft: #c1cad7;
  --muted: #9aa8ba;
  --line: #2c3542;
  --accent: #a7b5ed;
  --accent-strong: #c3cdf8;
  --accent-soft: #29334c;
  --bubble-mine: #303c5c;
  --bubble-other: #252d38;
  --green: #6bd3a3;
  --danger: #ff9da5;
  --shadow: 0 16px 42px #0004;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; overflow-x: hidden; }
body { min-height: 100vh; min-height: 100dvh; background: var(--page); color: var(--ink); font-size: 15px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 62%, transparent); outline-offset: 2px; }
.hidden { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; background: radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--accent-soft) 80%, transparent), transparent 53%), var(--page); }
.auth-card { width: min(100%, 430px); padding: 38px clamp(22px, 7vw, 44px) 30px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 19px; border-radius: 20px; color: #fff; background: linear-gradient(145deg, #6a7dbb, #45588f); box-shadow: 0 8px 20px #3d4f8c2e; }
.brand-mark svg { width: 29px; height: 29px; }
.brand-mark.compact { width: 43px; height: 43px; margin: 0; border-radius: 15px; flex: none; }
.brand-mark.compact svg { width: 23px; height: 23px; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.auth-card h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -.045em; }
.auth-intro { margin: 9px 0 26px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.form-stack { display: grid; gap: 16px; text-align: left; }
.form-stack label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.form-stack input, .search-box input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--surface); color: var(--ink); font-size: 15px; outline: none; transition: border-color .16s, box-shadow .16s; }
.form-stack input:focus, .search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.password-wrap { position: relative; display: flex; }
.password-wrap input { padding-right: 76px; }
.show-password { position: absolute; top: 0; right: 4px; min-height: 46px; border: 0; background: transparent; color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.primary, .secondary { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 11px; padding: 12px 16px; font-size: 14px; font-weight: 700; transition: background .16s, transform .16s; }
.primary { color: #fff; background: #46588f; box-shadow: 0 5px 13px #354a8726; }
.primary:hover { background: #374b84; transform: translateY(-1px); }
.primary span { margin-left: auto; font-size: 20px; line-height: 12px; }
.secondary { color: var(--accent-strong); background: var(--accent-soft); }
.secondary:hover { background: color-mix(in srgb, var(--accent-soft) 78%, var(--accent) 22%); }
.invite-intro { margin: 9px 0 20px; }
.notice { min-height: 18px; margin: 12px 0 0; color: var(--green); font-size: 13px; overflow-wrap: anywhere; }
.notice.error { color: var(--danger); }
.auth-foot { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

.app-shell { width: min(100%, 1800px); height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(300px, 350px) minmax(0, 1fr); margin: 0 auto; padding: 18px; gap: 18px; }
.sidebar, .main-panel { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sidebar { display: flex; flex-direction: column; padding: 19px 16px 14px; overflow: hidden; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-lockup b { display: block; font-size: 16px; letter-spacing: -.025em; }
.brand-lockup small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); }
.icon-button:hover { background: var(--surface-hover); color: var(--ink); }
.icon-button svg { width: 21px; height: 21px; }
.sidebar-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 13px; }
.sidebar-title-row h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.online-summary { color: var(--muted); font-size: 11px; }
.search-box { min-height: 44px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface-soft); color: var(--muted); }
.search-box svg { width: 18px; height: 18px; flex: none; }
.search-box input { border: 0; padding: 0; background: transparent; box-shadow: none !important; font-size: 13px; }
.search-box input::placeholder, .message-composer textarea::placeholder { color: var(--muted); opacity: .85; }
.desktop-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0 8px; padding: 4px; border-radius: 11px; background: var(--surface-soft); }
.switch-tab { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.switch-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px #18223516; }
.sidebar-content { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.general-row, .conversation-row, .person-row { width: 100%; min-height: 68px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 13px; padding: 9px 10px; background: transparent; color: var(--ink); text-align: left; }
.general-row:hover, .conversation-row:hover, .person-row:hover { background: var(--surface-hover); }
.general-row.selected, .conversation-row.selected { background: var(--accent-soft); }
.chat-avatar, .avatar { position: relative; width: 46px; height: 46px; display: grid; place-items: center; flex: none; border-radius: 50%; background: #e8edf7; color: #405486; font-size: 15px; font-weight: 700; }
:root[data-theme="dark"] .chat-avatar, :root[data-theme="dark"] .avatar { background: #313b50; color: #c4d0f7; }
.general-avatar { color: #45588f; }
.general-avatar svg { width: 22px; height: 22px; }
.online-dot { position: absolute; right: -1px; bottom: 0; width: 12px; height: 12px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); }
.chat-row-copy { display: grid; min-width: 0; flex: 1; gap: 5px; }
.chat-row-copy b { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-copy small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-meta { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 7px; flex: none; }
.chat-row-meta time { color: var(--muted); font-size: 10px; }
.unread-badge { min-width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 99px; padding: 0 6px; background: #46588f; color: white; font-size: 10px; font-weight: 700; }
.list-caption { margin: 19px 10px 7px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .09em; }
.conversation-row { min-height: 64px; }
.conversation-row .avatar, .person-row .avatar { width: 44px; height: 44px; }
.person-row { min-height: 64px; }
.person-info { display: grid; min-width: 0; flex: 1; gap: 4px; }
.person-info b { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.person-info small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.presence { width: 7px; height: 7px; display: inline-block; flex: none; border-radius: 50%; background: #a8b2c0; }
.presence.online { background: var(--green); }
.empty-state { padding: 38px 20px; color: var(--muted); text-align: center; }
.empty-state b { display: block; margin: 10px 0 6px; color: var(--ink-soft); font-size: 14px; }
.empty-state p { margin: 0 auto; max-width: 240px; font-size: 12px; line-height: 1.6; }
.empty-icon { color: var(--accent); font-size: 28px; }
.text-action { margin-top: 14px; border: 0; background: transparent; color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.sidebar-footer { padding-top: 10px; }
.footer-nav { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 10px; padding: 0 10px; background: transparent; color: var(--ink-soft); font-size: 13px; text-align: left; }
.footer-nav:hover { background: var(--surface-hover); }
.nav-icon { width: 21px; height: 21px; display: grid; place-items: center; }
.nav-icon svg { width: 18px; height: 18px; }
.profile-mini { display: flex; align-items: center; gap: 10px; margin-top: 9px; border-top: 1px solid var(--line); padding: 13px 3px 0; }
.profile-mini .avatar { width: 38px; height: 38px; font-size: 13px; }
.profile-meta { display: grid; min-width: 0; flex: 1; gap: 3px; }
.profile-meta b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.profile-meta small { color: var(--muted); font-size: 11px; }
.logout-button { width: 40px; height: 40px; }
.logout-button svg { width: 19px; height: 19px; }

.main-panel { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.home-panel { flex: 1; display: grid; place-content: center; justify-items: center; padding: 32px; color: var(--muted); text-align: center; }
.home-mark { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 27px; background: var(--accent-soft); color: var(--accent-strong); }
.home-mark svg { width: 34px; height: 34px; }
.home-panel h2 { margin: 22px 0 7px; color: var(--ink); font-size: 22px; letter-spacing: -.035em; }
.home-panel p { max-width: 330px; margin: 0; font-size: 14px; line-height: 1.6; }
.chat-view { position: relative; min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; }
.chat-header { min-height: 80px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); padding: 10px 24px; }
.back-button { display: none; }
.chat-top-avatar { width: 44px; height: 44px; }
.chat-heading { min-width: 0; display: grid; gap: 3px; }
.chat-heading .eyebrow { margin: 0; font-size: 9px; }
.chat-heading h2 { overflow: hidden; margin: 0; font-size: 16px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.chat-status { color: var(--muted); font-size: 11px; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--muted); font-size: 11px; }
.chat-theme-toggle { display: none; }
.connection-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.connection-status.offline i { background: #d38b47; }
.messages { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 22px clamp(16px, 4vw, 60px); display: flex; flex-direction: column; gap: 4px; background: var(--surface); scroll-behavior: smooth; }
.message { max-width: min(76%, 650px); display: flex; justify-content: flex-start; margin: 4px 0; }
.message { position: relative; touch-action: pan-y; transition: transform .16s ease; }
.message.reply-ready::before { content: '↩'; position: absolute; left: -34px; top: 50%; color: var(--accent); font-size: 22px; transform: translateY(-50%); }
.message-highlight .message-card { animation: message-flash 1.4s ease; }
@keyframes message-flash { 0%,100% { box-shadow: 0 0 0 0 transparent; } 35% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent); } }
.message.mine { align-self: flex-end; justify-content: flex-end; }
.message.grouped { margin-top: 1px; }
.message-card { min-width: 52px; max-width: 100%; border-radius: 5px 17px 17px 17px; padding: 10px 13px 7px; background: var(--bubble-other); color: var(--ink); font-size: 15px; line-height: 1.48; overflow-wrap: anywhere; }
.message.mine .message-card { border-radius: 17px 5px 17px 17px; background: var(--bubble-mine); color: var(--ink); }
.message.grouped:not(.mine) .message-card { border-top-left-radius: 7px; }
.message.mine.grouped .message-card { border-top-right-radius: 7px; }
.message-card p { margin: 0; white-space: pre-wrap; }
.message-card time { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; text-align: right; }
.message-quote { display: grid; width: 100%; gap: 2px; margin: 0 0 8px; border: 0; border-left: 3px solid var(--accent); border-radius: 2px 8px 8px 2px; padding: 5px 9px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--ink); text-align: left; cursor: pointer; }
.message-quote b { color: var(--accent); font-size: 12px; }
.message-quote span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.message-reply-button { display: block; margin: 3px 0 0 auto; border: 0; padding: 2px 4px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.message-reply-button:hover, .message-reply-button:focus-visible { color: var(--accent); }
.message-author { display: block; margin-bottom: 3px; color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.message-photo { display: block; width: min(340px, 100%); aspect-ratio: 4 / 3; max-height: 300px; margin: 0 0 6px; border-radius: 12px; background: var(--surface-soft); object-fit: contain; cursor: zoom-in; }
.date-divider { display: flex; align-items: center; justify-content: center; padding: 14px 0 10px; }
.date-divider span { border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.chat-empty { margin: auto; padding: 25px 16px; color: var(--muted); font-size: 14px; text-align: center; }
.jump-bottom { position: absolute; right: 24px; bottom: 96px; z-index: 2; min-height: 40px; border: 1px solid var(--line); border-radius: 99px; padding: 0 15px; background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; }
.photo-preview { display: flex; align-items: center; gap: 12px; padding: 10px 23px 0; color: var(--muted); font-size: 12px; }
.reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-left: 3px solid var(--accent); border-top: 1px solid var(--line); padding: 8px 20px; background: var(--surface); }
.reply-preview > div { display: grid; min-width: 0; gap: 3px; }
.reply-preview b { color: var(--accent); font-size: 13px; }
.reply-preview small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.photo-preview img { width: 54px; height: 54px; border-radius: 10px; background: var(--surface-soft); object-fit: cover; }
.photo-preview span { flex: 1; }
.message-composer { min-height: 70px; display: flex; align-items: flex-end; gap: 10px; margin: 0; border-top: 1px solid var(--line); padding: 12px 20px max(12px, env(safe-area-inset-bottom)); background: var(--surface); }
.composer-icon, .send-button { width: 46px; height: 46px; display: grid; place-items: center; flex: none; border: 0; border-radius: 14px; }
.composer-icon { background: var(--surface-soft); color: var(--ink-soft); }
.composer-icon:hover { background: var(--surface-hover); }
.send-button { background: #46588f; color: #fff; }
.send-button:hover { background: #374b84; }
.send-button svg { width: 20px; height: 20px; }
.message-composer textarea { min-height: 46px; max-height: 140px; flex: 1; resize: none; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface-soft); color: var(--ink); font-size: 15px; line-height: 1.35; outline: none; }
.message-composer textarea:focus { border-color: var(--accent); }
.settings-view { min-height: 0; flex: 1; overflow: auto; padding: clamp(18px, 4vw, 44px); }
.settings-card { max-width: 560px; margin: 6px auto; border: 1px solid var(--line); border-radius: 18px; padding: clamp(22px, 4vw, 34px); background: var(--surface); }
.settings-card h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.035em; }
.settings-card > .muted { margin: 0 0 22px; }
.settings-card .form-stack { margin-top: 22px; }
.wide { max-width: 1100px; }
.admin-columns { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,.8fr); gap: 38px; margin-top: 27px; }
.admin-section { min-width: 0; }
.admin-section h3 { margin: 0 0 6px; font-size: 15px; }
.admin-section > .muted { margin: 0 0 14px; }
.admin-search { margin: 14px 0 8px; }
.admin-users { max-height: 36vh; overflow: auto; margin: 10px 0 22px; }
.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 11px 3px; }
.admin-user > div { display: grid; min-width: 0; gap: 4px; }
.admin-user b { font-size: 13px; }
.admin-user small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.profile-section { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 20px; }
.profile-section h3 { margin: 0 0 12px; font-size: 17px; }
.profile-section > .muted { margin: 0 0 12px; }
.setting-toggle { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: var(--ink); font-size: 14px; }
.setting-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.profile-section > button { margin: 8px 8px 0 0; }
.text-button { min-height: 40px; border: 0; border-radius: 9px; padding: 0 9px; background: transparent; color: var(--accent-strong); font-size: 12px; font-weight: 700; white-space: nowrap; }
.text-button:hover { background: var(--accent-soft); }
.invite-result { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 12px; color: var(--ink-soft); font-size: 12px; overflow-wrap: anywhere; }
.invite-result a { color: var(--accent-strong); overflow-wrap: anywhere; }
.settings-heading { margin-top: 30px !important; }
.mobile-nav { display: none; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); max-width: min(90vw, 520px); transform: translate(-50%, 14px); opacity: 0; pointer-events: none; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: 13px; text-align: center; transition: opacity .18s, transform .18s; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.image-viewer { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 24px; background: #080b11f2; touch-action: pan-x pan-y pinch-zoom; }
.image-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; }
.setup-card { position: fixed; z-index: 30; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 18px; padding: 19px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.setup-card b { font-size: 15px; }
.setup-card p { margin: 8px 0 13px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.setup-card > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.setup-card .primary { min-height: 40px; margin-top: 0; padding-inline: 14px; }
.update-banner { position: fixed; z-index: 31; top: max(12px, env(safe-area-inset-top)); left: 50%; width: min(560px, calc(100vw - 24px)); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 9px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-size: 13px; }
.update-banner .secondary { min-height: 36px; padding: 0 13px; }
.update-banner .text-button { min-height: 36px; }

@media (min-width: 761px) and (max-width: 1050px) {
  .app-shell { grid-template-columns: minmax(285px, 320px) minmax(0, 1fr); padding: 10px; gap: 10px; }
  .sidebar { padding: 15px 12px 12px; }
  .messages { padding-inline: 22px; }
  .admin-columns { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 760px) {
  html, body { height: 100%; }
  .app-shell { width: 100%; height: var(--app-viewport-height, 100vh); height: var(--app-viewport-height, 100dvh); display: flex; flex-direction: column; gap: 0; padding: 0; }
  .sidebar { width: 100%; flex: 1; border: 0; border-radius: 0; padding: max(14px, env(safe-area-inset-top)) 16px calc(78px + env(safe-area-inset-bottom)); }
  .sidebar-header { margin-bottom: 20px; }
  .sidebar-title-row h2 { font-size: 24px; }
  .desktop-switch { display: none; }
  .sidebar-content { flex: 1; margin-top: 13px; }
  .general-row, .conversation-row, .person-row { min-height: 72px; padding-inline: 8px; }
  .chat-avatar, .avatar { width: 50px; height: 50px; }
  .conversation-row .avatar, .person-row .avatar { width: 48px; height: 48px; }
  .chat-row-copy b, .person-info b { font-size: 15px; }
  .chat-row-copy small, .person-info small { font-size: 13px; }
  .list-caption { margin-top: 24px; font-size: 10px; }
  .sidebar-footer { display: none; }
  .main-panel { display: none; flex: 1; border: 0; border-radius: 0; }
  .app-shell.view-chat .sidebar, .app-shell.view-profile .sidebar, .app-shell.view-admin .sidebar { display: none; }
  .app-shell.view-chat .main-panel, .app-shell.view-profile .main-panel, .app-shell.view-admin .main-panel { display: flex; }
  .app-shell.view-chat .home-panel { display: none; }
  .app-shell.view-profile #chatView, .app-shell.view-admin #chatView { display: none !important; }
  .app-shell.view-profile #profileView, .app-shell.view-admin #adminView { display: block !important; }
  .mobile-nav { position: fixed; z-index: 15; right: 0; bottom: 0; left: 0; min-height: calc(66px + env(safe-area-inset-bottom)); display: flex; align-items: stretch; justify-content: space-around; border-top: 1px solid var(--line); padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(18px); }
  .app-shell.view-chat .mobile-nav { display: none; }
  .mobile-nav-item { min-width: 56px; min-height: 54px; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
  .mobile-nav-item svg { width: 21px; height: 21px; }
  .mobile-nav-item.active { color: var(--accent-strong); }
  .mobile-nav-item.active svg { stroke-width: 2.2; }
  .chat-view { height: 100%; }
  .chat-header { min-height: 68px; gap: 8px; padding: max(6px, env(safe-area-inset-top)) 10px 8px; }
  .back-button { display: inline-grid; width: 42px; height: 42px; margin-right: 0; }
  .chat-top-avatar { width: 42px; height: 42px; }
  .chat-heading .eyebrow { display: none; }
  .chat-heading h2 { font-size: 16px; }
  .chat-status { font-size: 11px; }
  .connection-status { margin-left: auto; }
  .chat-theme-toggle { display: inline-grid; width: 40px; height: 40px; margin-left: auto; }
  .connection-status { margin-left: 0; }
  .connection-status span { display: none; }
  .messages { padding: 14px 12px; }
  .message { max-width: 88%; }
  .message-card { font-size: 15px; }
  .message-photo { width: min(76vw, 340px); max-height: min(38vh, 300px); }
  .jump-bottom { right: 14px; bottom: 83px; }
  .photo-preview { padding: 8px 12px 0; }
  .message-composer { min-height: 64px; gap: 7px; padding: 8px 10px max(9px, env(safe-area-inset-bottom)); }
  .composer-icon, .send-button { width: 44px; height: 44px; border-radius: 14px; }
  .message-composer textarea { min-height: 44px; max-height: 112px; padding: 11px 12px; font-size: 16px; }
  .settings-view { padding: max(18px, env(safe-area-inset-top)) 14px calc(84px + env(safe-area-inset-bottom)); }
  .settings-card { margin: 0 auto; padding: 23px 18px; border-radius: 17px; }
  .settings-card h2 { font-size: 22px; }
  .admin-columns { grid-template-columns: minmax(0,1fr); gap: 30px; margin-top: 23px; }
  .admin-users { max-height: 34vh; }
  .auth-card { padding-block: 31px 27px; }
  .setup-card { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  .update-banner { top: max(8px, env(safe-area-inset-top)); }
}
@media (max-width: 380px) {
  .sidebar { padding-inline: 12px; }
  .sidebar-header { margin-bottom: 15px; }
  .brand-lockup small { font-size: 10px; }
  .chat-row-meta time { font-size: 9px; }
  .connection-status { display: none; }
  .message { max-width: 92%; }
  .mobile-nav-item { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
