:root {
  --bg:#f1f4f8;
  --surface:#ffffff;
  --sidebar:#f6f8fb;
  --ink:#18243a;
  --muted:#647086;
  --line:#e3e8f0;
  --primary:#3154c8;
  --primary-soft:#edf1ff;
  --on-primary:#ffffff;
  --green:#176b59;
  --green-soft:#eaf5f0;
  --purple:#794ca5;
  --purple-soft:#f2ecf8;
  --amber:#7a4c0e;
  --amber-soft:#fff5df;
  --danger:#a93242;
  --danger-soft:#fff0f2;
  --bubble:#f2f5f9;
  --shadow:0 18px 70px rgba(26,40,70,.13);
  --focus:#5477df;
}

html[data-theme="dark"] {
  --bg:#101725;
  --surface:#182131;
  --sidebar:#131c2b;
  --ink:#e8edf7;
  --muted:#aab5c7;
  --line:#344157;
  --primary:#88a5ff;
  --primary-soft:#223354;
  --on-primary:#10182a;
  --green:#8cddbf;
  --green-soft:#203b36;
  --purple:#d4b7ef;
  --purple-soft:#362e49;
  --amber:#f2c987;
  --amber-soft:#3a3026;
  --danger:#ffb0ba;
  --danger-soft:#482b35;
  --bubble:#222e41;
  --focus:#a9bcff;
}

* { box-sizing:border-box; }
html, body { min-height:100%; }
body {
  margin:0;
  color:var(--ink);
  background:var(--bg);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:14px;
  line-height:1.5;
}
button, input, textarea, select { font:inherit; }
button, select { cursor:pointer; }
button { color:inherit; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
button:disabled { cursor:not-allowed; opacity:.48; }
button:active:not(:disabled) { filter:brightness(.94); }
button, a, input, textarea, select, summary { scroll-margin:90px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline:3px solid var(--focus);
  outline-offset:3px;
}
svg { width:20px; height:20px; flex-shrink:0; stroke:currentColor; fill:none; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
[hidden] { display:none !important; }
.sprite { position:absolute; width:0; height:0; overflow:hidden; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.skip-link { position:fixed; left:12px; top:-80px; z-index:1000; padding:10px 14px; border-radius:8px; background:var(--ink); color:var(--surface); }
.skip-link:focus { top:12px; }

.auth-screen { min-height:100dvh; display:grid; place-items:center; padding:24px; background:linear-gradient(135deg,var(--bg),var(--sidebar)); }
.auth-card { width:min(100%,420px); padding:34px; border:1px solid var(--line); border-radius:18px; background:var(--surface); box-shadow:var(--shadow); }
.auth-card h1 { margin:28px 0 8px; font-size:25px; letter-spacing:-.7px; }
.auth-card>p { margin:0 0 24px; color:var(--muted); line-height:1.7; }
.auth-card form { display:grid; gap:8px; }
.auth-card label, .room-field-label { font-size:12px; font-weight:650; }
.auth-card input, .room-field, .search-input { width:100%; min-height:46px; padding:10px 12px; border:1px solid var(--line); border-radius:9px; background:var(--sidebar); color:var(--ink); font-size:16px; }
.auth-brand { padding:0; }
.auth-error { margin:0 0 14px!important; padding:10px 12px; border-radius:8px; background:var(--danger-soft); }
.google-login-button { display:flex; align-items:center; justify-content:center; gap:10px; width:100%; min-height:48px; padding:10px 14px; border:1px solid var(--line); border-radius:9px; background:var(--surface); color:var(--ink); font-size:13px; font-weight:650; box-shadow:0 2px 8px rgba(26,40,70,.07); }
.google-login-button:hover { border-color:var(--primary); background:var(--primary-soft); }
.google-mark { display:grid; place-items:center; width:23px; height:23px; border:1px solid var(--line); border-radius:50%; color:#3154c8; background:#fff; font-size:14px; font-weight:750; }
.recovery-login { margin-top:16px; padding-top:14px; border-top:1px solid var(--line); }
.recovery-login summary { color:var(--muted); font-size:12px; font-weight:600; cursor:pointer; }
.recovery-login[open] summary { margin-bottom:12px; color:var(--ink); }
.auth-footnote { display:flex; align-items:flex-start; gap:8px; margin:20px 0 0!important; font-size:11px; }
.auth-footnote svg { width:15px; margin-top:1px; }
.form-error { color:var(--danger)!important; font-size:12px; margin:2px 0 0!important; }
.primary-button, .secondary-button, .danger-button { display:flex; align-items:center; justify-content:center; min-height:44px; border-radius:9px; padding:9px 14px; font-size:12px; font-weight:650; }
.primary-button { border:0; background:var(--primary); color:var(--on-primary); margin-top:10px; }
.secondary-button { width:100%; border:1px solid var(--line); background:var(--surface); margin-top:12px; }
.danger-button { width:100%; border:1px solid var(--danger); background:var(--danger-soft); color:var(--danger); }

.brand { display:flex; align-items:center; gap:11px; padding:0 8px 29px; }
.brand-symbol { display:grid; place-items:center; width:36px; height:36px; border-radius:11px; background:var(--ink); color:var(--surface); }
.brand-symbol svg { width:25px; height:25px; stroke-width:1.8; }
.brand-name { font-size:20px; font-weight:730; letter-spacing:-.9px; line-height:1.15; }
.brand-name span { font-weight:420; color:var(--muted); }
.brand-sub { font-size:11px; color:var(--muted); margin-top:3px; }

.connection-strip { min-height:38px; display:flex; align-items:center; justify-content:center; gap:8px; padding:7px 16px; background:var(--amber-soft); color:var(--amber); font-size:12px; text-align:center; }
.connection-strip.error { background:var(--danger-soft); color:var(--danger); }
.connection-strip.offline { background:var(--amber-soft); color:var(--amber); }
.connection-strip svg { width:15px; height:15px; }
.app { display:grid; grid-template-columns:238px minmax(0,1fr) 294px; height:100dvh; min-height:560px; max-width:1920px; margin:0 auto; background:var(--surface); }
body:has(.connection-strip:not([hidden])) .app { height:calc(100dvh - 38px); }

.sidebar { display:flex; flex-direction:column; min-height:0; padding:28px 17px 14px; border-right:1px solid var(--line); background:var(--sidebar); }
.workspace { display:flex; align-items:center; gap:9px; padding:11px; border:1px solid var(--line); border-radius:10px; background:var(--surface); font-weight:600; font-size:13px; margin:0 1px 10px; }
.workspace svg { width:16px; color:var(--muted); }
.workspace .lock { margin-left:auto; }
.search-open { display:flex; gap:9px; align-items:center; width:100%; min-height:44px; border:0; border-radius:8px; padding:9px; background:transparent; color:var(--muted); text-align:left; font-size:12px; }
.search-open:hover { background:var(--line); }
.search-open svg { width:17px; }
kbd { margin-left:auto; min-width:21px; padding:0 5px; border:1px solid var(--line); border-radius:4px; background:var(--surface); font-family:inherit; font-size:11px; text-align:center; }
.new-room-button { display:flex; align-items:center; justify-content:center; gap:7px; width:100%; min-height:42px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--primary); font-size:12px; font-weight:650; margin-top:8px; }
.new-room-button:hover { border-color:var(--primary); background:var(--primary-soft); }
.new-room-button svg { width:16px; height:16px; }
.section-label { display:flex; align-items:center; justify-content:space-between; margin:25px 10px 9px; color:var(--muted); font-size:11px; font-weight:650; }
.count { padding:1px 6px; border:1px solid var(--line); border-radius:4px; font-size:10px; font-weight:500; }
.conversation-nav, .rooms-dialog-list { display:flex; flex-direction:column; gap:5px; min-height:0; overflow-y:auto; scrollbar-width:thin; }
.conversation-nav { max-height:44dvh; }
.nav-item { display:flex; align-items:center; gap:11px; width:100%; min-height:52px; padding:8px 10px; border:1px solid transparent; border-radius:10px; background:transparent; text-align:left; }
.nav-item:hover { background:var(--bubble); }
.nav-item[aria-current="page"] { color:var(--primary); background:var(--primary-soft); border-color:color-mix(in srgb,var(--primary) 18%,transparent); }
.nav-copy { flex:1; min-width:0; }
.nav-name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:630; }
.nav-preview { display:block; margin-top:2px; color:var(--muted); font-size:11px; }
.nav-presence { margin-left:auto; }
.side-note { margin:25px 10px 0; padding:17px 0; border-top:1px solid var(--line); color:var(--muted); font-size:12px; }
.side-note strong { display:flex; align-items:center; gap:7px; margin-bottom:5px; color:var(--ink); font-size:12px; font-weight:600; }
.side-note svg { width:15px; color:var(--green); }
.side-note p { margin:0; line-height:1.7; }
.sidebar-bottom { margin-top:auto; }
.install-button { display:flex; align-items:center; gap:8px; width:100%; min-height:42px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--primary); font-size:11px; }
.install-button svg { width:16px; }
.profile { display:flex; align-items:center; gap:9px; margin-top:12px; padding:17px 7px 0; border-top:1px solid var(--line); }
.profile-copy { min-width:0; flex:1; }
.profile .name { font-size:12px; font-weight:650; }
.profile .name, .profile .caption { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile .caption { color:var(--muted); font-size:10px; }
.profile .icon-button { margin-left:auto; }

.main { display:flex; flex-direction:column; min-width:0; min-height:0; background:var(--surface); }
.chat-header { display:flex; align-items:center; justify-content:space-between; gap:14px; height:88px; min-height:88px; padding:0 30px; border-bottom:1px solid var(--line); }
.header-title { display:flex; align-items:center; gap:13px; flex:1; min-width:0; }
.header-title>div { min-width:0; }
.header-title h1 { overflow:hidden; margin:0; text-overflow:ellipsis; white-space:nowrap; font-size:19px; font-weight:700; letter-spacing:-.45px; }
.header-subtitle { display:flex; align-items:center; gap:6px; margin-top:3px; color:var(--muted); font-size:11px; }
.header-actions { display:flex; align-items:center; gap:5px; flex-shrink:0; }
.icon-button, .mobile-room-picker { display:inline-grid; place-items:center; width:44px; height:44px; min-width:44px; border:1px solid transparent; border-radius:9px; background:transparent; color:var(--muted); }
.icon-button:hover, .mobile-room-picker:hover { background:var(--bubble); color:var(--ink); }
.mobile-room-picker, .mobile-search, .details-button { display:none; }
.chat-tabs { display:flex; align-items:center; gap:25px; height:46px; min-height:46px; padding:0 30px; border-bottom:1px solid var(--line); }
.tab { display:flex; align-items:center; gap:6px; height:46px; padding:0 1px; border:0; border-bottom:2px solid transparent; background:none; color:var(--muted); font-size:12px; font-weight:560; }
.tab svg { width:15px; height:15px; }
.tab[aria-selected="true"] { color:var(--primary); border-bottom-color:var(--primary); }
.tab-note { display:flex; align-items:center; gap:5px; margin-left:auto; color:var(--muted); font-size:10px; }
.tab-note svg { width:12px; height:12px; }
.chat-scroll { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:var(--line) transparent; }

.empty-state { max-width:390px; margin:45px auto; padding:30px 20px; text-align:center; }
.empty-state .avatar { width:54px; height:54px; margin-bottom:13px; border-radius:16px; }
.empty-state h2 { margin:0 0 8px; font-size:19px; letter-spacing:-.4px; }
.empty-state p { margin:0; color:var(--muted); font-size:12px; line-height:1.8; }
.empty-state .primary-button { display:inline-flex; margin:18px auto 0; }
.room-intro { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:25px 30px 18px; padding:17px 19px; border:1px solid var(--line); border-radius:12px; background:var(--sidebar); }
.room-intro strong { display:block; font-size:14px; font-weight:650; }
.room-intro p { margin:4px 0 0; color:var(--muted); font-size:11px; }
.intro-art { display:flex; align-items:center; flex-shrink:0; }
.intro-art .avatar { width:30px; height:30px; border-radius:9px; }
.connector { width:15px; height:1px; background:var(--line); }
.history-toolbar { display:flex; justify-content:center; margin:0 30px 20px; }
.history-button { min-height:36px; padding:7px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--muted); font-size:11px; }
.date-divider { display:flex; align-items:center; gap:13px; margin:0 30px 21px; color:var(--muted); font-size:10px; }
.date-divider:before, .date-divider:after { content:""; height:1px; flex:1; background:var(--line); }
.messages { max-width:940px; margin:0 auto; padding:0 30px 15px; }
.message { display:flex; align-items:flex-start; gap:11px; margin:0 0 22px; }
.message>.avatar { width:31px; height:31px; margin-top:2px; border-radius:10px; }
.message-content { max-width:calc(100% - 42px); min-width:0; }
.message-meta { display:flex; align-items:center; gap:8px; margin-bottom:6px; font-size:11px; }
.message-meta strong { color:var(--ink); font-weight:650; }
.message-meta time { color:var(--muted); font-size:10px; }
.message-body { padding:12px 15px; border-radius:0 13px 13px 13px; background:var(--bubble); font-size:14px; line-height:1.7; overflow-wrap:anywhere; white-space:pre-wrap; }
.message.human { flex-direction:row-reverse; margin-left:42px; }
.message.human>.avatar { display:none; }
.message.human .message-content { max-width:90%; }
.message.human .message-meta { justify-content:flex-end; }
.message.human .message-body { border-radius:13px 0 13px 13px; background:var(--primary); color:var(--on-primary); }
.message.system { justify-content:center; margin:7px 0 17px; color:var(--muted); font-size:11px; text-align:center; }
.message.system>.avatar { display:none; }
.message.system .message-content { max-width:680px; }
.message.system .message-meta { justify-content:center; }
.message.system .message-body { padding:0; background:transparent; }
.message-status { display:flex; align-items:center; gap:4px; justify-content:flex-end; margin-top:5px; color:var(--muted); font-size:10px; }
.message-status svg { width:13px; height:13px; }

.composer-area { flex-shrink:0; padding:11px 30px 18px; background:var(--surface); }
.composer { padding:11px 13px 10px; border:1px solid color-mix(in srgb,var(--muted) 28%,var(--line)); border-radius:13px; box-shadow:0 3px 10px rgba(24,36,58,.025); }
.composer:focus-within { border-color:var(--primary); box-shadow:0 0 0 2px color-mix(in srgb,var(--primary) 12%,transparent); }
.composer-top { display:flex; align-items:center; gap:8px; margin-bottom:8px; color:var(--muted); font-size:10px; }
.recipient-label { font-size:10px; }
.recipient-select { min-height:32px; max-width:260px; padding:3px 7px; border:0; border-radius:5px; background:var(--primary-soft); color:var(--primary); font-size:10px; font-weight:650; }
textarea { display:block; width:100%; min-height:38px; max-height:112px; padding:2px 0; border:0; outline:0; resize:none; background:transparent; color:var(--ink); font-size:14px; line-height:1.55; }
textarea:focus-visible { outline:0; }
textarea::placeholder { color:var(--muted); opacity:.85; }
.composer-bottom { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:7px; }
.mention-controls { display:flex; align-items:center; gap:6px; min-width:0; overflow:auto; }
.member-shortcut { min-height:32px; padding:4px 8px; border:0; border-radius:5px; background:var(--bubble); color:var(--muted); font-size:10px; white-space:nowrap; }
.member-shortcut:hover { color:var(--primary); }
.send-button { display:flex; align-items:center; justify-content:center; gap:7px; min-width:88px; min-height:38px; padding:7px 13px; border:0; border-radius:8px; background:var(--primary); color:var(--on-primary); font-size:11px; font-weight:650; }
.send-button svg { width:15px; height:15px; }
.composer-note { display:flex; align-items:center; justify-content:center; gap:5px; margin:8px 0 0; color:var(--muted); text-align:center; font-size:9px; }
.composer-note.warning { color:var(--amber); }
.composer-note.error { color:var(--danger); }
.composer-note svg { width:11px; height:11px; }

.avatar { position:relative; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; width:37px; height:37px; border-radius:12px; background:var(--primary-soft); color:var(--primary); }
.avatar svg { width:21px; height:21px; }
.avatar.linux { background:var(--green-soft); color:var(--green); }
.avatar.mac { background:var(--purple-soft); color:var(--purple); }
.avatar.user { background:var(--primary); color:var(--on-primary); font-size:12px; font-weight:650; }
.avatar.small { width:29px; height:29px; border-radius:9px; }
.avatar.small svg { width:17px; height:17px; }
.dot { display:inline-block; width:7px; height:7px; flex-shrink:0; border-radius:50%; background:var(--green); }
.dot.offline { background:var(--amber); }

.right-panel { display:flex; flex-direction:column; min-height:0; overflow-y:auto; padding:29px 24px 20px; border-left:1px solid var(--line); background:var(--surface); scrollbar-width:thin; }
.panel-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
.panel-heading h2 { margin:0; font-size:13px; font-weight:650; }
.panel-heading>span { padding:2px 7px; border-radius:5px; background:var(--bubble); color:var(--muted); font-size:10px; }
.participant { display:flex; align-items:center; gap:10px; margin:0 0 20px; }
.participant .person-info { min-width:0; }
.participant strong { display:block; font-size:12px; font-weight:650; }
.participant .person-state { display:flex; align-items:center; gap:5px; margin-top:3px; color:var(--muted); font-size:10px; }
.device-tag { margin-left:auto; color:var(--muted); }
.device-tag svg { width:15px; height:15px; }
.panel-divider { height:1px; margin:1px 0 20px; flex-shrink:0; background:var(--line); }
.panel-section-title { display:flex; align-items:center; gap:7px; margin:0 0 13px; font-size:11px; font-weight:650; }
.panel-section-title svg { width:15px; height:15px; color:var(--muted); }
.toggle-row { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; font-size:11px; }
.toggle-copy strong { font-size:11px; font-weight:600; }
.toggle-copy p { margin:4px 0 0; color:var(--muted); font-size:10px; line-height:1.65; }
.switch { position:relative; width:42px; height:26px; min-width:42px; padding:0; border:0; border-radius:20px; background:var(--muted); }
.switch:before { content:""; position:absolute; top:4px; left:4px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform .18s; box-shadow:0 1px 3px rgba(0,0,0,.18); }
.switch[aria-checked="true"] { background:var(--green); }
.switch[aria-checked="true"]:before { transform:translateX(16px); }
.limit-note { margin:11px 0 15px; color:var(--green); font-size:10px; }
.stop-button, .clear-button { display:flex; align-items:center; justify-content:center; gap:6px; width:100%; min-height:42px; border:1px solid var(--line); border-radius:7px; background:var(--surface); font-size:10px; }
.stop-button { margin:0 0 12px; color:var(--danger); }
.clear-button { color:var(--muted); }
.stop-button svg, .clear-button svg { width:13px; height:13px; }
.mobile-account-actions { display:none; }
.mobile-account-actions .panel-divider { margin:8px 0 18px; }
.mobile-account-actions .install-button { justify-content:center; margin-bottom:8px; }
.account-identity { display:grid; grid-template-columns:auto minmax(0,1fr); gap:9px; align-items:center; margin:0 0 14px; padding:11px; border:1px solid var(--line); border-radius:9px; background:var(--sidebar); }
.account-identity strong, .account-identity span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-identity strong { display:block; font-size:11px; }
.account-identity span { display:block; color:var(--muted); font-size:10px; }
.logout-mobile-button { color:var(--danger); }
.bottom-nav { display:none; }

.activity-view { max-width:760px; margin:0 auto; padding:29px 30px; }
.activity-view h2 { margin:0 0 6px; font-size:18px; }
.activity-view>p { margin:0 0 25px; color:var(--muted); font-size:12px; }
.activity-event { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:13px; padding:17px 0; border-bottom:1px solid var(--line); font-size:12px; }
.activity-event .timeline-mark { display:grid; place-items:center; width:29px; height:29px; border:1px solid var(--line); border-radius:9px; color:var(--muted); }
.activity-event svg { width:14px; height:14px; }
.activity-event strong { display:block; font-size:12px; font-weight:600; }
.activity-event p { margin:3px 0 0; color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.activity-event time { color:var(--muted); font-size:10px; white-space:nowrap; }

dialog { width:min(92vw,520px); max-height:88dvh; padding:0; border:1px solid var(--line); border-radius:18px; background:var(--surface); color:var(--ink); box-shadow:var(--shadow); }
dialog::backdrop { background:rgba(14,24,41,.54); backdrop-filter:blur(3px); }
.dialog-header { display:flex; align-items:center; justify-content:space-between; gap:15px; padding:20px 24px 12px; }
.dialog-header h2 { margin:0; font-size:19px; letter-spacing:-.4px; }
.dialog-subtitle { margin:2px 0 0; color:var(--muted); font-size:10px; }
.dialog-body { padding:0 24px 25px; font-size:13px; line-height:1.8; }
.dialog-body>p { margin:0 0 14px; }
.dialog-body .primary-button { width:100%; }
.room-field-label { display:block; margin:4px 0 7px; }
.room-members { margin:21px 0 0; padding:0; border:0; }
.room-members legend { margin-bottom:10px; padding:0; font-size:12px; font-weight:650; }
.member-choice { display:flex; align-items:center; gap:11px; margin-bottom:9px; padding:13px; border:1px solid var(--line); border-radius:10px; cursor:pointer; line-height:1.5; }
.member-choice:has(input:checked) { border-color:var(--primary); background:var(--primary-soft); }
.member-choice input { width:20px; height:20px; margin:0; flex-shrink:0; accent-color:var(--primary); }
.member-choice strong { display:block; font-size:12px; font-weight:600; }
.member-choice small { color:var(--muted); font-size:11px; }
.room-members-note { margin:11px 0 0!important; color:var(--muted); font-size:11px; }
.rooms-dialog-list { max-height:52dvh; }
#roomsDialog .new-room-button { margin:0 0 15px; }
.search-results { display:grid; gap:7px; max-height:50dvh; margin-top:16px; overflow:auto; }
.search-result { display:block; width:100%; padding:11px 13px; border:1px solid var(--line); border-radius:9px; background:var(--surface); text-align:left; }
.search-result:hover { border-color:var(--primary); background:var(--primary-soft); }
.search-result small { display:block; color:var(--primary); font-size:10px; }
.search-result span { display:block; margin-top:3px; color:var(--ink); font-size:12px; overflow-wrap:anywhere; }
.empty-search { padding:14px 0; color:var(--muted); font-size:12px; }
.toast { position:fixed; z-index:100; bottom:25px; left:50%; max-width:min(90vw,460px); padding:12px 19px; transform:translateX(-50%); border-radius:10px; background:var(--ink); color:var(--surface); box-shadow:var(--shadow); font-size:12px; pointer-events:none; }

@media (min-width:1600px) {
  .app { grid-template-columns:270px minmax(0,1fr) 320px; }
  .sidebar { padding-right:24px; padding-left:24px; }
  .chat-header, .chat-tabs, .composer-area { padding-right:42px; padding-left:42px; }
  .room-intro { margin-right:42px; margin-left:42px; }
}

@media (max-width:1199px) {
  .app { grid-template-columns:225px minmax(0,1fr); }
  .right-panel { display:none; }
  .details-button { display:inline-grid; }
}

@media (max-width:760px) {
  .auth-screen { padding:16px; }
  .auth-card { padding:26px 20px; }
  .app { display:flex; min-height:400px; }
  .sidebar { display:none; }
  .main { flex:1; }
  .chat-header { height:70px; min-height:70px; padding:0 11px; gap:4px; }
  .mobile-room-picker, .mobile-search, .details-button { display:inline-grid; }
  .header-title { gap:8px; }
  .header-title>.avatar { width:34px; height:34px; border-radius:10px; }
  .header-title h1 { font-size:16px; }
  .header-subtitle { max-width:44vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; }
  .header-actions { gap:0; }
  .header-actions .icon-button { width:40px; min-width:40px; }
  .chat-tabs { height:43px; min-height:43px; padding:0 17px; gap:22px; }
  .tab { height:43px; font-size:11px; }
  .tab-note { font-size:9px; }
  .room-intro { margin:17px; padding:13px 14px; }
  .room-intro strong { font-size:12px; }
  .room-intro p { max-width:195px; font-size:10px; }
  .intro-art .avatar { width:23px; height:23px; border-radius:7px; }
  .connector { width:8px; }
  .date-divider { margin:0 18px 18px; font-size:9px; }
  .history-toolbar { margin:0 17px 16px; }
  .messages { padding-right:17px; padding-left:17px; }
  .message { gap:8px; margin-bottom:19px; }
  .message>.avatar { width:27px; height:27px; border-radius:9px; }
  .message-content { max-width:calc(100% - 35px); }
  .message-body { padding:10px 12px; font-size:14px; }
  .message.human { margin-left:25px; }
  .message.human .message-content { max-width:96%; }
  .composer-area { padding:9px 13px; }
  .composer { padding:9px 11px; }
  .recipient-select { max-width:220px; min-height:34px; }
  textarea { min-height:34px; max-height:82px; font-size:16px; }
  .send-button { min-height:40px; }
  .member-shortcut { min-height:36px; }
  .composer-note { margin-top:6px; font-size:9px; }
  .mobile-account-actions { display:grid; }
  .bottom-nav { display:flex; flex-shrink:0; justify-content:space-around; padding:5px 8px calc(5px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); background:var(--sidebar); }
  .bottom-nav button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-width:74px; min-height:48px; padding:5px 10px; border:0; border-radius:8px; background:none; color:var(--muted); font-size:9px; }
  .bottom-nav button[aria-current="page"] { background:var(--primary-soft); color:var(--primary); }
  .bottom-nav svg { width:19px; height:19px; }
  .activity-view { padding:25px 18px; }
  .activity-event { grid-template-columns:auto minmax(0,1fr); }
  .activity-event time { grid-column:2; }
  .toast { bottom:85px; font-size:11px; }
  dialog { width:calc(100vw - 28px); border-radius:15px; }
  .dialog-header { padding:17px 19px 10px; }
  .dialog-body { padding:0 19px 20px; }
  .connection-strip { min-height:34px; padding:5px 10px; font-size:10px; }
  body:has(.connection-strip:not([hidden])) .app { height:calc(100dvh - 34px); }
}

@media (max-width:390px) {
  .mobile-search { display:none; }
  .header-subtitle { max-width:36vw; }
  .tab-note { display:none; }
  .member-shortcut { padding:4px 6px; }
}

@media (max-height:540px) and (orientation:landscape) {
  .chat-header { height:60px; min-height:60px; }
  .composer-area { padding-top:6px; padding-bottom:6px; }
  .composer-note { display:none; }
  .bottom-nav { display:none; }
  .room-intro { margin-top:10px; margin-bottom:12px; }
}

@media (prefers-reduced-motion:reduce) {
  *, *:before, *:after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}
