/* Hush · Familiar chat. User-selected WeChat reference, 2026-10-25. */
:root {
  --brand:#07c160; --brand-hover:#06ad56; --brand-press:#059748; --brand-soft:rgba(7,193,96,.12); --brand-softer:rgba(7,193,96,.06);
  --brand-ink:#006b38; --action-bg:#078443; --action-hover:#06783f; --action-press:#056534; --action-ink:#fff;
  --danger:#c63030; --danger-soft:#fcebea; --danger-fill:#c63030; --danger-ink:#fff; --warn:#8c620e;
  --ink-1:#191919; --ink-2:#555; --ink-3:#606060; --ink-4:#666;
  --bg-app:#f7f7f7; --bg-panel:#fff; --bg-sunken:#ededed; --bg-rail:#e2e2e2; --bg-rail-hi:#d6d6d6; --bg-list:#ededed;
  --bg-hover:rgba(0,0,0,.045); --bg-active:#087e52; --bg-mask:rgba(0,0,0,.4); --bg-glass:#f7f7f7;
  --selected-ink:#fff; --selected-muted:rgba(255,255,255,.94); --muted-badge:#666;
  --bubble-me:#95ec69; --bubble-me-ink:#191919; --bubble-other:#ebebeb; --bubble-sys:transparent;
  --line:#e7e7e7; --line-strong:#d5d5d5; --sh-1:none; --sh-2:0 2px 12px rgba(0,0,0,.12); --sh-3:0 8px 32px rgba(0,0,0,.17); --sh-brand:none;
  --r-xs:4px; --r-sm:5px; --r-md:6px; --r-lg:8px; --r-xl:12px;
  --rail-w:60px; --list-w:280px; --head-h:48px; --tab-h:56px; --focus:#16874b;
  --font:"Microsoft YaHei UI","PingFang SC","Noto Sans SC","Segoe UI",sans-serif; --font-display:var(--font);
}
[data-theme="dark"] {
  --brand:#07c160; --brand-hover:#29cb77; --brand-press:#52d891; --brand-soft:rgba(7,193,96,.2); --brand-softer:rgba(7,193,96,.1);
  --brand-ink:#61dfa0;
  --danger:#ff7772; --danger-soft:#422626; --warn:#e4bd71; --ink-1:#e5e5e5; --ink-2:#c0c0c0; --ink-3:#a6a6a6; --ink-4:#9d9d9d;
  --bg-app:#111; --bg-panel:#252525; --bg-sunken:#202020; --bg-rail:#171717; --bg-rail-hi:#303030; --bg-list:#202020;
  --bg-hover:rgba(255,255,255,.055); --bg-active:#087e52; --bg-mask:rgba(0,0,0,.65); --bg-glass:#191919;
  --bubble-me:#3bb357; --bubble-me-ink:#0d1c10; --bubble-other:#2c2c2c; --bubble-sys:transparent;
  --line:#2b2b2b; --line-strong:#444; --sh-2:0 2px 12px rgba(0,0,0,.3); --sh-3:0 8px 32px rgba(0,0,0,.45); --focus:#70dd9f;
}
html,body { font-size:14px; color:var(--ink-1); }
/* Keep a usable viewport on engines that do not understand the newer
   dynamic viewport units. Feature-specific rules progressively replace this
   baseline when svh/dvh are available. */
html,body { min-height:100%; }
body { display:flex; flex-direction:column; height:100%; }
@supports (height:100svh) {
  body { min-height:100svh; }
}
@supports (height:100dvh) {
  body { height:100dvh; }
}
body>#root { flex:1; min-height:0; height:auto; }
.app { height:100%; min-height:0; }
button,input,textarea,select { touch-action:manipulation; }
:where(button,a,input,textarea,select,[role="button"],[tabindex="0"]):focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
/* Compact authentication. Keep Hush identity, without marketing chrome. */
.boot-logo,.login-logo { background:#07c160; box-shadow:none; border-radius:12px; }
.boot-logo::after,.login-logo::after { background:url("mark.svg") center/64% no-repeat; }
.boot-name { font:600 24px/1.3 var(--font); letter-spacing:0; }
.boot-splash .boot-logo { animation:none; }
.login-wrap { display:flex; justify-content:center; align-items:safe center; padding:32px 20px; background:var(--bg-sunken); }
.login-card { width:min(100%,400px); padding:36px 32px 28px; border:1px solid var(--line); border-radius:10px; box-shadow:var(--sh-2); animation:none; }
.login-head { align-items:center; gap:10px; margin-bottom:28px; }
.login-logo { width:56px; height:56px; margin-bottom:12px; }
.login-title { font-size:24px; font-weight:500; letter-spacing:0; }
.login-sub { margin:0; text-align:center; font-size:13px; color:var(--ink-3); line-height:1.6; }
.field { margin-bottom:18px; }
.field-label { font-size:13px; font-weight:400; margin-bottom:7px; }
.input { height:46px; background:var(--bg-panel); border-color:var(--line-strong); border-radius:5px; font-size:15px; }
.input:hover { background:var(--bg-panel); }
.input:focus { box-shadow:0 0 0 2px var(--brand-soft); }
.input::placeholder { color:var(--ink-4); }
.password-wrap .input { padding-right:62px; }
.autofill-bait { position:absolute; width:1px; height:1px; padding:0; border:0; opacity:0; overflow:hidden; pointer-events:none; }
#passwordChangeForm .field { margin-top:16px; }
#passwordChangeForm .field .modal-desc { margin:8px 0 0; font-size:13px; }
#passwordChangeForm > .btn { width:100%; min-height:44px; margin-top:12px; white-space:normal; }
#passwordChangeStatus:empty { display:none; }
#keyPasswordToggle { margin:0 0 12px; text-align:left; white-space:normal; }
.password-toggle { min-width:44px; min-height:44px; color:var(--ink-2); font-size:13px; }
.btn { font-weight:500; }
.btn-primary { min-height:44px; color:var(--action-ink); background:var(--action-bg); box-shadow:none; }
.btn-primary:hover { background:var(--action-hover); }
.btn-primary:active { background:var(--action-press); }
.btn-primary:disabled { background:var(--bg-sunken); color:var(--ink-4); }
.login-switch { margin-top:20px; font-size:13px; }
.login-switch button { min-width:44px; min-height:44px; padding:0 6px; }
.login-foot { font-size:12px; line-height:1.6; text-align:center; }
.login-foot .dot { flex:none; }
.login-err { background:var(--danger-soft); color:var(--danger); line-height:1.6; }
.login-recovery { margin-top:16px; padding:14px; border:1px solid var(--line); border-radius:6px; background:var(--bg-sunken); }
.login-recovery p { margin:0 0 12px; font-size:13px; line-height:1.6; }
.login-recovery .btn { min-height:44px; margin:0 8px 6px 0; }
.login-recovery [role="status"] { color:var(--ink-2); font-size:13px; }
/* Desktop: a quiet icon rail, 65px conversation rows, one search/header row. */
.rail { padding:12px 0; gap:4px; }
.rail-avatar { width:36px; height:36px; margin-bottom:6px; border-radius:4px; box-shadow:none; }
.rail-avatar:hover { transform:none; }
.rail-avatar .avatar { width:100%; height:100%; }
.rail-btn { width:44px; height:44px; border-radius:5px; color:#656565; }
.rail-btn:hover { color:var(--ink-1); }
.rail-btn.active { color:var(--brand-ink); background:transparent; }
.rail-btn.active::before { display:none; }
.rail-btn svg { width:23px; height:23px; }
[data-theme="dark"] .rail-btn { color:#999; }
[data-theme="dark"] .rail-btn.active { color:var(--brand-ink); }
.rail-badge { right:2px; top:4px; }
.list-panel { background:var(--bg-list); border-right:1px solid var(--line); min-height:0; }
.list-head { padding:0 8px 0 12px; gap:4px; border:0; }
.list-head-title { font-size:16px; font-weight:500; letter-spacing:0; }
.list-head.has-search .list-head-title { display:none; }
.search-box { min-width:0; flex:1; margin:0; height:28px; padding:0 8px; border:1px solid transparent; border-radius:5px; background:var(--bg-app); gap:6px; }
.search-box:focus-within { background:var(--bg-panel); border-color:var(--line-strong); box-shadow:none; }
.search-box input { font-size:12px; }
.search-box input::placeholder { color:var(--ink-4); }
.icon-btn { width:36px; height:36px; min-width:36px; min-height:36px; color:var(--ink-2); border-radius:5px; }
.list-head .icon-btn { width:32px; min-width:32px; }
.list-scroll { padding-bottom:12px; }
.conv { min-height:65px; padding:12px; gap:10px; }
.conv:not(:last-child)::after { content:''; position:absolute; left:58px; right:12px; bottom:0; height:1px; background:var(--line); }
.conv.active::after { display:none; }
button.conv,button.nav-row { width:100%; text-align:left; }
.conv.pinned:not(.active) { background:rgba(0,0,0,.035); }
.conv.active,.conv.active:hover { background:var(--bg-active); color:var(--selected-ink); }
.conv.active::before { display:none; }
.conv.active .conv-preview,.conv.active .conv-time,.conv.active .pin-flag,.conv.active .conv-preview span { color:var(--selected-muted) !important; }
.conv.active:focus-visible { outline-color:var(--selected-ink); outline-offset:-3px; }
.conv-name { font-size:14px; font-weight:400; line-height:1.5; }
.conv-time { font-size:11px; color:var(--ink-4); }
.conv-row2 { margin-top:2px; }
.conv-preview { font-size:12px; color:var(--ink-4); }
.avatar { width:36px; height:36px; border-radius:4px; font-size:14px; font-weight:500; }
.avatar-sm { width:36px; height:36px; border-radius:4px; }
.avatar-xs { width:26px; height:26px; border-radius:3px; }
.avatar-lg { width:64px; height:64px; border-radius:6px; }
.conv .badge { position:absolute; top:6px; left:40px; min-width:16px; height:16px; line-height:16px; font-size:10px; padding:0 4px; }
.badge.mute { background:var(--muted-badge); color:#fff; }
.sec-head { padding:12px 14px 6px; font-size:12px; font-weight:400; color:var(--ink-3); }
.nav-row { min-height:56px; padding-inline:14px; }
.nav-row .nav-ico { width:34px; height:34px; border-radius:4px; }
.nav-row .nav-label { font-size:14px; font-weight:400; }
.nav-row .nav-count { font-size:12px; }
.idx-bar { right:2px; }
.idx-bar button { width:26px; }
.main { background:var(--bg-app); min-width:0; min-height:0; }
.empty-state { padding:24px; text-align:center; color:var(--ink-3); }
.empty-state .glyph { width:72px; height:72px; background:transparent; border-radius:0; color:var(--ink-4); }
.empty-state .glyph svg { width:44px; height:44px; opacity:.5; }
.empty-state .txt { font-size:13px; line-height:1.7; }
.list-scroll .empty-state .btn { width:auto; max-width:100%; padding-inline:18px; font-size:13px; }
/* Reading: square avatars on both sides, small-radius bubbles. */
.chat-head { padding:0 14px; gap:8px; background:var(--bg-app); backdrop-filter:none; -webkit-backdrop-filter:none; }
.chat-head>.avatar { display:none; }
.chat-head .info { display:flex; align-items:center; gap:10px; min-height:44px; text-align:left; overflow:hidden; }
.chat-head .title { font-size:15px; font-weight:400; }
.chat-head .sub { font-size:11px; color:var(--ink-3); flex:none; }
.chat-head .sub.typing { color:var(--brand-ink); }
.msgs { padding:20px 20px 16px; gap:0; }
.msg { width:100%; margin:0 0 18px; gap:10px; }
.msg.grouped { margin-top:0; }
.msg.grouped .avatar { visibility:visible; height:36px; }
.msg-body { max-width:min(calc(100% - 92px),600px); }
.msg-sender { font-size:12px; color:var(--ink-3); margin-bottom:4px; }
.bubble { padding:8px 12px; border:0; border-radius:5px; box-shadow:none; font-size:14px; line-height:1.5; }
.msg.me .bubble { border-radius:5px; }
.bubble:not(.plain):not(.emoji-only)::before { content:''; position:absolute; top:13px; left:-4px; width:8px; height:8px; background:inherit; transform:rotate(45deg); border-radius:1px; }
.msg.me .bubble::before { left:auto; right:-4px; }
.bubble img.pic { max-width:min(240px,100%); max-height:280px; border-radius:5px; }
.msg .bubble.emoji-only img,.msg .bubble.emoji-only .wf-effect-card { width:80px; height:80px; }
.bubble .inline-emoji { display:inline-block; width:24px; height:24px; vertical-align:-5px; object-fit:contain; margin:0 1px; }
.msg-foot,.lock-tag { color:var(--ink-3); font-size:10px; }
.msg-foot { margin-top:3px; }
.msg-foot .read { color:var(--ink-3); }
.msg-foot .fail,.tombstone .redo { min-height:30px; padding-inline:5px; font-size:11px; }
.quote-block,.file-card { width:100%; text-align:left; color:inherit; }
.quote-block { border-radius:3px; }
.msg .bubble.plain .quote-block,.msg .bubble.emoji-only .quote-block { background:var(--bg-panel); color:var(--ink-1); border-left-color:var(--ink-3); }
/* Decryption status inherits an inline ink token. Keep it legible on green. */
.msg.me .bubble:not(.plain):not(.emoji-only):not(:has(.file-card)) { --ink-3:var(--bubble-me-ink); --ink-4:var(--bubble-me-ink); }
/* These containers hold legacy inline brand-coloured text, not brand fills. */
.conv-preview,.pick-row .nm,.nav-label,.btn-ghost { --brand:var(--brand-ink); }
.file-card { min-width:0; width:min(240px,calc(100vw - 140px)); white-space:normal; }
.msg .bubble:has(.file-card) { background:var(--bg-panel); color:var(--ink-1); border:1px solid var(--line); }
.file-name { white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.45; overflow-wrap:anywhere; }
.msg.me .file-size { color:#555; }
.day-sep { background:transparent; color:var(--ink-4); padding:4px 8px; font-size:12px; margin:10px auto 20px; }
.day-sep[data-act="more"] { cursor:pointer; color:var(--ink-3); }
.sys-msg { color:var(--ink-3); }
.unread-sep { color:var(--danger); }
/* Desktop editor: writing above, commands below. */
.composer { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:minmax(0,1fr) 42px auto; height:clamp(140px,22vh,190px); min-height:120px; margin:0 8px 10px; padding:0 4px; background:var(--bg-app); border:1px solid var(--line-strong); border-radius:9px; box-shadow:0 1px 4px rgba(0,0,0,.025); }
.composer:focus-within { border-color:#b8b8b8; }
.composer-input { grid-column:1/-1; grid-row:1; min-height:0; padding:10px 10px 0; }
.composer-input textarea { width:100%; height:100%; min-height:0; max-height:none; padding:0; font-size:14px; line-height:1.6; outline-offset:0; }
.composer-input textarea::placeholder { color:var(--ink-4); }
.composer-tools { grid-column:1; grid-row:2; min-width:0; padding:0; gap:0; }
.composer-attachments { display:flex; align-items:center; }
.tool-btn { width:36px; height:36px; min-width:36px; min-height:36px; border-radius:5px; color:var(--ink-2); }
.tool-btn:hover { color:var(--ink-1); }
.tool-btn svg { width:21px; height:21px; }
.mobile-more { display:none; }
.composer-bar { grid-column:2; grid-row:2; padding:0 6px; align-self:center; }
.composer-hint { display:none; }
.send-btn { height:28px; min-height:28px; min-width:48px; padding:0 12px; border-radius:4px; font-size:12px; font-weight:400; color:var(--action-ink); background:var(--action-bg); box-shadow:none; }
.send-btn:hover { background:var(--action-hover); }
.send-btn:active { background:var(--action-press); }
.send-btn:disabled { color:var(--ink-4); background:var(--bg-sunken); }
.composer-key-status { grid-row:3; grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; margin:2px 6px 6px; border:1px solid var(--line-strong); border-radius:5px; background:var(--bg-panel); color:var(--ink-2); font-size:12px; line-height:1.5; }
.composer-key-status[hidden] { display:none; }
.composer-key-status span { min-width:0; }
.composer-key-status button { flex:none; min-height:36px; padding:0 10px; color:var(--brand-ink); }
.composer-key-status button:disabled { color:var(--ink-3); cursor:wait; }
/* Desktop floating emoji palette; a keyboard-height panel on mobile. */
.emoji-panel { display:none; position:fixed; width:min(466px,calc(100vw - 24px)); height:min(466px,calc(100dvh - 80px)); padding:0; z-index:65; background:var(--bg-app); border:1px solid var(--line-strong); border-radius:8px; box-shadow:var(--sh-3); overflow:hidden; transition:none; }
.emoji-panel.open { display:flex; flex-direction:column; height:min(466px,calc(100dvh - 80px)); }
.emoji-scroll { min-height:0; flex:1; overflow-y:auto; padding:14px 12px 10px; }
.emoji-section-label { margin:8px 8px 10px; font-size:12px; color:var(--ink-3); font-weight:400; }
.emoji-grid { height:auto; overflow:visible; padding:0; display:grid; grid-template-columns:repeat(10,minmax(0,1fr)); gap:2px; align-content:start; }
.emoji-cell { aspect-ratio:1; width:100%; min-width:0; min-height:36px; border-radius:5px; }
.emoji-cell img { width:28px; height:28px; pointer-events:none; }
.emoji-cell:hover { transform:none; background:var(--bg-hover); }
.emoji-tabs { flex:none; min-height:48px; display:flex; align-items:center; gap:5px; padding:5px 12px; border-top:1px solid var(--line); border-bottom:0; }
.emoji-tab { min-height:36px; min-width:36px; display:inline-flex; align-items:center; justify-content:center; gap:5px; padding:0 8px; border-radius:5px; font-size:12px; }
.emoji-tab svg { width:21px; height:21px; }
.emoji-tab.on { color:var(--ink-1); background:var(--bg-sunken); }
.emoji-tabs .spacer { flex:1; }
.emoji-search { display:flex; align-items:center; gap:6px; padding:10px 12px 0; }
.emoji-action { display:inline-flex; align-items:center; justify-content:center; flex:none; width:36px; height:36px; border-radius:5px; color:var(--ink-2); }
.emoji-action svg { width:20px; height:20px; }
.emoji-action:hover,.emoji-action.on { background:var(--bg-sunken); }
.emoji-mode-hint { padding:10px 16px 0; font-size:12px; color:var(--ink-3); }
.emoji-empty { padding:30px 16px; color:var(--ink-3); text-align:center; font-size:13px; }
.emoji-search input { width:100%; height:34px; padding:0 10px; border:1px solid var(--line-strong); border-radius:5px; background:var(--bg-panel); font-size:13px; }
.emoji-favorite-toggle { position:absolute; right:1px; top:0; font-size:11px; color:var(--brand-ink); pointer-events:none; }
.e2e-note { border-color:var(--line); color:var(--ink-2); font-size:12px; }
.modal { border-color:var(--line); border-radius:9px; }
.bubble,.file-name,.conv-name,.msg-sender,.q-from,.q-text { unicode-bidi:plaintext; }
.ctx-item { width:100%; text-align:left; }
.modal-head { font:500 18px/1.4 var(--font); }
.modal-desc { color:var(--ink-2); font-size:13px; line-height:1.7; }
.pick-row { min-height:48px; }
.toast.ok { background:#252525; }
.toast.err { background:#993333; }
.conn-bar { background:#80540f; color:#fff; }
.conn-bar.ok { background:#078443; }
/* Release notices reserve their rendered height instead of covering controls. */
.update-bar { width:min(460px,calc(100vw - 24px)); max-width:calc(100vw - 24px); min-width:0; padding:10px 12px; border-radius:8px; line-height:1.45; box-shadow:var(--sh-2); }
.update-bar>:not(button):not(.dot-live) { min-width:0; flex:1; overflow-wrap:anywhere; }
.update-bar .dot-live { flex:none; }
.update-bar button,.update-bar .btn,.update-bar .btn-primary { width:auto; min-width:78px; min-height:40px; flex:none; padding-inline:12px; font-size:13px; white-space:nowrap; }
.update-bar #upLater { width:44px; min-width:44px; min-height:44px; padding:0; }
body>.update-bar { position:static; inset:auto; transform:none; z-index:100; flex:none; align-self:center; margin:6px 12px max(6px,env(safe-area-inset-bottom,0px)); }
.login-card>.update-bar { position:static; inset:auto; transform:none; display:grid; grid-template-columns:8px minmax(0,1fr) 44px; align-items:center; gap:8px; width:100%; max-width:none; margin-top:18px; padding:12px; background:var(--bg-sunken); box-shadow:none; }
.login-card>.update-bar .dot-live { grid-column:1; grid-row:1; }
.login-card>.update-bar>span:not(.dot-live) { grid-column:2; grid-row:1; }
.login-card>.update-bar #upNow { grid-column:1/-1; grid-row:2; width:100%; min-height:44px; }
.login-card>.update-bar #upLater { grid-column:3; grid-row:1; }
@media (min-width:681px) and (max-width:1099px) {
  :root { --list-w:240px; }
  /* Text summaries need their own line in the narrow desktop settings rail. */
  .nav-row:has(> .nav-count):not(:has(> .nav-count svg)) {
    display:grid;
    grid-template-columns:34px minmax(0,1fr);
    grid-template-rows:auto auto;
    column-gap:var(--s3);
    row-gap:2px;
    min-height:64px;
  }
  .nav-row:has(> .nav-count):not(:has(> .nav-count svg)) .nav-ico { grid-column:1; grid-row:1 / 3; }
  .nav-row:has(> .nav-count):not(:has(> .nav-count svg)) .nav-label { grid-column:2; grid-row:1; min-width:0; }
  .nav-row:has(> .nav-count):not(:has(> .nav-count svg)) .nav-count {
    grid-column:2; grid-row:2; min-width:0; line-height:1.35; overflow-wrap:anywhere;
  }
}
@media (min-width:681px) and (max-height:560px) { .composer { height:120px; min-height:88px; margin-bottom:6px; } .msgs { padding-top:12px; } }
@media (max-width:680px) {
  :root { --head-h:56px; --list-w:auto; --bg-app:#ededed; --bubble-other:#fff; }
  [data-theme="dark"] { --bg-app:#111; --bubble-other:#2c2c2c; }
  .list-panel { background:var(--bg-panel); }
  body.in-chat .list-panel { visibility:hidden; }
  .main:not(.show) { visibility:hidden; }
  .list-head { height:auto; min-height:calc(56px + env(safe-area-inset-top, 0px)); display:grid; grid-template-columns:minmax(0,1fr) 44px; gap:0; padding:env(safe-area-inset-top, 0px) 12px 0; background:var(--bg-app); }
  .list-head.has-search .list-head-title,.list-head-title { display:block; grid-row:1; grid-column:1; font-size:18px; line-height:56px; padding-left:4px; }
  .list-head>.icon-btn { grid-column:2; grid-row:1; width:44px; height:44px; }
  .list-head .search-box { grid-row:2; grid-column:1/-1; height:46px; width:100%; margin:0 0 10px; background:var(--bg-panel); }
  .list-head .search-box input { height:100%; min-width:0; }
  .search-box input,.input { font-size:16px; }
  .conv { min-height:74px; padding:12px 16px; gap:12px; }
  .conv:not(:last-child)::after { content:''; position:absolute; bottom:0; left:76px; right:0; height:1px; background:var(--line); }
  .conv .avatar { width:48px; height:48px; border-radius:5px; }
  .conv-name { font-size:17px; } .conv-preview { font-size:13px; } .conv-time { font-size:11px; }
  .conv .badge { top:6px; left:54px; }
  .conv.active,.conv.active:hover { color:var(--ink-1); background:var(--bg-sunken); }
  .conv.active .conv-preview,.conv.active .conv-time,.conv.active .pin-flag,.conv.active .conv-preview span { color:var(--ink-3) !important; }
  .conv.active:focus-visible { outline-color:var(--focus); }
  .tabbar { background:var(--bg-glass); backdrop-filter:none; -webkit-backdrop-filter:none; }
  .tab { color:var(--ink-1); font-weight:400; gap:2px; } .tab.on { color:var(--brand-ink); }
  .tab svg { width:25px; height:25px; } .tab span:not(.badge) { font-size:10px; }
  .nav-row { min-height:56px; padding-inline:16px; } .nav-row .nav-label { font-size:16px; }
  .chat-head { height:calc(var(--head-h) + env(safe-area-inset-top, 0px)); padding:env(safe-area-inset-top, 0px) 8px 0; gap:4px; background:var(--bg-app); }
  .chat-head .info { justify-content:flex-start; gap:6px; }
  .chat-head .title { font-size:17px; font-weight:500; }
  .chat-head .sub:not(.typing) { display:none; } .chat-head .sub.typing { font-size:11px; }
  .chat-head .icon-btn { min-width:44px; width:44px; min-height:44px; }
  .msgs { padding:18px 12px 12px; } .msg { gap:10px; margin-bottom:18px; }
  .msg .avatar,.msg.grouped .avatar { width:40px; height:40px; border-radius:4px; }
  .msg-body { max-width:calc(100% - 100px); }
  .bubble { font-size:16px; line-height:1.5; padding:8px 12px; border-radius:5px; }
  .bubble img.pic { max-width:100%; max-height:260px; }
  .msg .bubble:has(.file-card) { width:100%; max-width:100%; }
  .file-card { width:100%; max-width:100%; }
  .composer { height:auto; min-height:56px; margin:0; padding:6px max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); grid-template-columns:minmax(0,1fr) 44px 44px 56px; grid-template-rows:auto auto auto auto; gap:0 2px; border:0; border-top:1px solid var(--line-strong); border-radius:0; background:var(--bg-glass); box-shadow:none; }
  .composer-input { grid-column:1; grid-row:1; padding:0; align-self:center; border-radius:5px; background:var(--bg-panel); min-width:0; }
  .composer-input textarea { display:block; min-height:44px; max-height:120px; padding:10px; font-size:16px; line-height:24px; }
  .composer-tools { display:contents; }
  .composer-tools>[data-act="emoji"] { grid-column:2; grid-row:1; align-self:end; }
  .mobile-more { display:flex; grid-column:3; grid-row:1; align-self:end; }
  .tool-btn { width:44px; height:44px; min-width:44px; min-height:44px; } .tool-btn svg { width:25px; height:25px; }
  .composer-bar { grid-column:4; grid-row:1; padding:0; align-self:end; }
  .send-btn { width:100%; min-width:56px; min-height:44px; height:44px; padding:0 8px; font-size:13px; }
  .composer-attachments { display:none; grid-column:1/-1; grid-row:3; gap:14px; padding:16px 8px; background:var(--bg-sunken); }
  .attachments-open .composer-attachments { display:flex; }
  .composer-attachments .tool-btn { display:flex; flex-direction:column; gap:7px; width:64px; height:70px; background:var(--bg-panel); border-radius:8px; }
  .composer-attachments .tool-btn::after { content:attr(title); font-size:11px; }
  .composer-key-status { grid-column:1/-1; grid-row:2; margin:6px 0 0; }
  .emoji-panel,.emoji-panel.open { position:static; grid-column:1/-1; grid-row:4; width:100%; height:var(--emoji-panel-height,min(280px,40dvh)); border:0; border-radius:0; box-shadow:none; margin-top:6px; }
  .emoji-scroll { padding:6px 0; } .emoji-grid { grid-template-columns:repeat(5,minmax(44px,1fr)); gap:8px; }
  .emoji-cell { min-width:44px; min-height:44px; } .emoji-cell img { width:29px; height:29px; }
  .emoji-cell:focus-visible { outline-offset:-3px; }
  .emoji-tabs { min-height:60px; padding:8px 0; gap:8px; } .emoji-tab { min-height:44px; }
  .emoji-search { padding:6px 0; } .emoji-search input { height:44px; min-width:0; font-size:16px; }
  .modal { max-height:min(88dvh,740px); }
  .login-wrap { padding:max(20px,env(safe-area-inset-top)) 16px max(20px,env(safe-area-inset-bottom)); }
  .login-card { padding:28px 24px 22px; }
}
@media (min-width:360px) and (max-width:479px) { .emoji-grid { grid-template-columns:repeat(6,minmax(44px,1fr)); } }
@media (min-width:480px) and (max-width:680px) { .emoji-grid { grid-template-columns:repeat(7,minmax(44px,1fr)); } }
/* Apply to small viewports and hybrid computers with a touch digitizer. */
@media (max-width:680px), (any-pointer:coarse) {
  .icon-btn,.list-head .icon-btn,.tool-btn,.emoji-action,.emoji-tab { min-width:44px; min-height:44px; }
  .icon-btn,.list-head .icon-btn,.tool-btn,.emoji-action { width:44px; height:44px; flex-shrink:0; }
  .send-btn { min-width:44px; min-height:44px; }
  .rail-avatar { width:44px; height:44px; padding:4px; }
  .chat-head .info { min-width:44px; }
  .composer-key-status { flex-wrap:wrap; }
  .composer-key-status button,.msg-foot .fail,.tombstone .redo,.day-sep[data-act="more"],.ctx-item,.quote-block,.file-card,.mention-item { min-height:44px; min-width:44px; }
  .msg-foot { flex-wrap:wrap; }
  .tombstone { flex-wrap:wrap; justify-content:center; }
  .bubble img.pic[role="button"] { min-width:44px; min-height:44px; object-fit:contain; }
  .idx-bar { width:48px; right:0; }
  .idx-bar button { width:44px; height:44px; }
  .list-scroll:has(+ .idx-bar) { padding-right:52px; }
  .update-bar button,.update-bar .btn,.update-bar .btn-primary { min-height:44px; }
  .modal-foot { flex-wrap:wrap; }
  .modal-foot .btn { height:auto; min-height:44px; max-width:100%; padding-block:10px; white-space:normal; }
  .btn:active,.icon-btn:active,.send-btn:active { transform:none; }
}
@media (any-pointer:coarse) and (min-width:681px) {
  .composer { grid-template-rows:minmax(0,1fr) 48px auto; }
  .emoji-grid { grid-template-columns:repeat(7,minmax(44px,1fr)); gap:8px; }
  .emoji-cell { min-width:44px; min-height:44px; }
  .search-box { height:46px; }
  .emoji-search input { height:44px; }
  .search-box input { height:100%; }
}
@media (prefers-reduced-motion:reduce) { .login-card,.update-bar,.main,.emoji-panel { animation:none; transition:none; } }

/* ---------- P2 visual hardening ----------
 * Keep the employee workspace usable when a phone has a cutout, a compact
 * viewport, or a keyboard open.  These rules are intentionally token-based so
 * theme and density changes remain global rather than becoming one-off fixes.
 */
:where(button,[role="button"],a,input,textarea,select):focus-visible {
  outline: 2px solid var(--focus, #1677ff);
  outline-offset: 2px;
}
.modal-mask { padding-bottom: max(var(--s5), env(safe-area-inset-bottom, 0px)); }
.modal { max-height: min(84dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px), 760px); }
.modal-body { overscroll-behavior: contain; scrollbar-gutter: stable; }
.composer { padding-bottom: max(var(--s3), env(safe-area-inset-bottom, 0px)); }
.avatar .online-dot { right: 0; bottom: 0; box-sizing: border-box; }
.toast-wrap { max-width: min(92vw, 560px); padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); }
.toast { overflow-wrap: anywhere; }
.upload-tray { min-height: 0; max-height: min(28dvh, 220px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.upload-item,.upload-item .upload-name { min-width: 0; }
.upload-item .upload-name { overflow-wrap: anywhere; }
.thread-link { min-width: 44px; min-height: 36px; justify-content: center; }
.reaction-row { max-width: 100%; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; }
.reaction-pill { flex: 0 1 auto; max-width: 100%; }
.work-status-option { min-width: 0; }
.work-status-option small { overflow-wrap: anywhere; }
.msg .group-sender,.msg .sender-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-foot time,.conv-time,.res-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width:680px) {
  .modal { max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px), 740px); }
  .modal-mask { padding-inline: max(var(--s3), env(safe-area-inset-left, 0px)) max(var(--s3), env(safe-area-inset-right, 0px)); }
  .composer { padding-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
  .upload-tray { max-height: min(32dvh, 240px); }
  .thread-link { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .voice-meter i,.recording-meter i { animation: none !important; transform: none !important; }
  .composer.drag-over::after,.msgs.drag-over::after { transition: none !important; }
}

/* ---------- P2 visual polish: contrast, density and safe overlays ---------- */
[data-theme="dark"] {
  --ink-3: #a2aab5;
  --ink-4: #9aa5b2;
  --focus: #79e4aa;
  --danger-fill: #d95752;
}
[data-theme="light"], :root {
  --focus: #087e52;
  --danger-fill: #c63030;
}
.btn:disabled,.tool-btn:disabled,.icon-btn:disabled {
  border: 1px solid var(--line-strong);
  background: var(--bg-sunken);
  color: var(--ink-3);
  opacity: 1;
  cursor: not-allowed;
}
.modal { box-shadow: 0 12px 36px rgba(16,24,40,.16), 0 2px 8px rgba(16,24,40,.08); }
[data-theme="dark"] .modal { box-shadow: 0 16px 42px rgba(0,0,0,.52), 0 2px 10px rgba(0,0,0,.35); }
::-webkit-scrollbar-thumb { background: var(--line-strong); background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }
.composer-input textarea { transition: height var(--dur) var(--ease); overflow-y: auto; }
.upload-tray { min-height: 44px; }
.upload-row { position: relative; z-index: 4; }
.upload-actions { position: relative; z-index: 5; }
.composer.drag-over::after { z-index: 1; }
.upload-row[data-status="failed"],.upload-row[data-status="error"] { color: var(--danger); }
.upload-row[data-status="queued"],.upload-row[data-status="uploading"] { color: var(--ink-1); }
.toast-wrap { z-index: 500; }
.call-layer { z-index: 600; }
button:not(.call-btn):active,.btn:not(.call-btn):active,.tool-btn:active,.icon-btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .composer-input textarea { transition: none; }
  button:not(.call-btn):active,.btn:not(.call-btn):active,.tool-btn:active,.icon-btn:active { transform: none; }
}

/* P2 accessibility: preserve interaction hierarchy in Windows High Contrast /
 * forced-colors mode.  Do not rely on subtle fills, shadows or brand hues to
 * communicate the active, disabled, or focused state. */
@media (forced-colors: active) {
  :where(button,a,input,textarea,select,[role="button"],[tabindex="0"]):focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  :where(.btn-primary,.send-btn,.tab.on,.conv.active,.search-filter.on) {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
    forced-color-adjust: none;
  }
  :where(.btn:disabled,.tool-btn:disabled,.icon-btn:disabled,.send-btn:disabled) {
    background: Canvas;
    color: GrayText;
    border: 1px solid GrayText;
    opacity: 1;
  }
  :where(.modal,.composer,.input,.search-box,.emoji-panel,.file-card,.voice-card) {
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    box-shadow: none;
  }
  :where(.danger,.danger-fill,.toast.err,.conn-bar) { background: Canvas; color: CanvasText; border-color: CanvasText; }
}

/* At large text zoom a label must be allowed to wrap rather than clipping the
 * action itself.  Icon-only controls retain their compact geometry. */
@media (min-width: 681px) {
  :where(.btn,.send-btn,.modal-foot .btn,.update-bar button) { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
}

/* P2 responsive hardening: browser zoom and hybrid touch desktops should
 * reflow the workspace instead of creating a second horizontal viewport. */
html, body, #root, .app { max-width: 100%; overflow-x: hidden; }
.app > *, .list-panel, .main, .chat-head, .msgs, .composer { min-width: 0; }
.thread-root, .thread-list, .thread-item, .bookmark-item { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 680px) and (orientation: landscape) {
  .msgs { min-height: 0; padding-block: 8px; }
  .composer-input textarea { max-height: 80px; }
  .chat-head .title, .conv-name, .res-name, .res-sub { overflow-wrap: anywhere; }
}
