:root{
  font-family:"Segoe UI",system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--text);background:#e9eef4;font-size:13px;line-height:1.4;
  --nav:#17212b;--nav-soft:#22303d;--blue:#2563eb;--blue-hover:#1d4ed8;--blue-soft:#eaf2ff;
  --surface:#fff;--surface-subtle:#f6f8fb;--overlay:#07111f99;--line:#dce3eb;--border:#cbd5e1;
  --text:#17212b;--muted:#667383;--danger:#c9363e;--online:#22a866;--busy:#d74850;--away:#d89a19;--offline:#8d99a6;
  --sp-1:4px;--sp-2:6px;--sp-3:8px;--sp-4:12px;--sp-5:16px;--sp-6:20px;--sp-7:24px;
  --radius-control:8px;--radius-card:12px;--radius-dialog:16px;--shadow-dialog:0 24px 70px #0f1f331f;
}
*{box-sizing:border-box} [hidden]{display:none!important} html,body{width:100%;height:100%;overflow:hidden} body{margin:0;min-height:100vh;min-height:100dvh;overscroll-behavior:none;-webkit-tap-highlight-color:transparent} button,input,textarea,select{font:inherit}
button{cursor:pointer} button:disabled{cursor:not-allowed;opacity:.72}
.brand-mark{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:linear-gradient(145deg,#2563eb,#0ea5a4);overflow:hidden;box-shadow:0 8px 18px #125ac733}.brand-mark img{width:100%;height:100%;display:block}
.brand-mark.small{width:28px;height:28px;border-radius:8px;font-size:14px;box-shadow:none}
.login-page{min-height:100vh;min-height:100dvh;display:grid;place-items:center;padding:18px;padding-top:max(18px,env(safe-area-inset-top));padding-right:max(18px,env(safe-area-inset-right));padding-bottom:max(18px,env(safe-area-inset-bottom));padding-left:max(18px,env(safe-area-inset-left));background:radial-gradient(circle at 50% 0,#f9fbfd,#e5ebf1 70%)}
.login-card{width:min(360px,100%);padding:30px;background:#fff;border:1px solid #dce2e8;border-radius:18px;box-shadow:0 18px 60px #1a2b3c1a}
.login-card .brand-mark{margin:0 auto 14px}.login-card h1{text-align:center;font-size:21px;margin:0}.login-card>p{text-align:center;color:var(--muted);margin:5px 0 22px}
.auth-stack{width:min(760px,100%);display:grid;gap:12px}.auth-forms{display:flex;align-items:start;justify-content:center;gap:14px}.auth-forms .login-card{flex:0 1 360px}.invite-intro{padding:17px 20px;border:1px solid #bcd5f5;border-radius:14px;background:#f4f8ff;box-shadow:0 10px 30px #1a4c8510}.invite-intro h2{margin:8px 0 4px;font-size:17px}.invite-intro p{margin:4px 0;color:#506071;font-size:12px}.invite-badge{display:inline-flex;align-items:center;padding:3px 8px;border-radius:10px;background:#dfeeff;color:#1769e0;font-size:10px;font-weight:700}.text-button{padding:5px 0;border:0;background:transparent;color:#1769e0;font-size:11px}.danger-text{color:#bb3838}.invite-register>p.hint{text-align:left;margin:-10px 0 12px}
label>span{display:block;color:#4c5560;font-size:12px;font-weight:600;margin-bottom:5px}
input,textarea,select{width:100%;border:1px solid #ccd3db;border-radius:9px;background:#fff;color:#20242a;outline:none;transition:.15s border,.15s box-shadow}
input,select{height:38px;padding:0 10px}textarea{padding:9px 10px;resize:none}
input:focus,textarea:focus,select:focus{border-color:#5597ec;box-shadow:0 0 0 3px #1769e018}
.login-card label{display:block;margin:12px 0}.primary,.outline{height:38px;border:0;border-radius:9px;padding:0 14px;font-weight:650}
.login-card .remember-login{display:flex;align-items:center;gap:8px;margin:4px 0 12px;color:#364350;font-size:11px;cursor:pointer}.remember-login input{width:15px;height:15px;min-height:0;margin:0;accent-color:#1769e0}.remember-login span{display:inline;margin:0;font-size:11px;font-weight:500}
.primary{background:var(--blue);color:#fff}.primary:hover{background:var(--blue-hover)}.outline{border:1px solid var(--border);background:var(--surface);color:#303842}.wide{width:100%}button:focus-visible,a:focus-visible,[role=button]:focus-visible{outline:2px solid #60a5fa;outline-offset:2px}
.form-error,.error{color:#b73737!important}.form-error{min-height:18px;margin:10px 0 0!important;font-size:12px}

.app-shell{width:100vw;height:100vh;height:100dvh;margin:0;display:grid;grid-template-columns:clamp(230px,20vw,300px) minmax(0,1fr);background:#fff;border-radius:0;overflow:hidden;box-shadow:none}
.sidebar{display:flex;flex-direction:column;min-width:0;background:var(--nav);color:#fff;padding:calc(14px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}
.sidebar-brand{height:38px;display:flex;align-items:center;gap:9px;padding:0 8px;margin-bottom:8px}.sidebar-brand strong{font-size:15px;letter-spacing:.02em}
.me-card{display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:9px;padding:9px;border-radius:10px;background:var(--nav-soft);margin-bottom:16px}
.me-card div{display:flex;min-width:0;flex-direction:column}.me-card strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.me-card div span{font-size:11px;color:#aab6c2;margin-top:1px}
.avatar{display:grid;place-items:center;flex:0 0 auto;width:34px;height:34px;border-radius:50%;background:#dbe9fb;color:#174e91;font-size:12px;font-weight:750}.avatar.mini{width:33px;height:33px;background:#314252;color:#cfe2fa}.presence-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--offline);box-shadow:0 0 0 2px #fff}.presence-dot.online{background:var(--online)}.presence-dot.busy{background:var(--busy)}.presence-dot.away{background:var(--away)}.presence-dot.offline{background:var(--offline)}
.me-card>.presence-dot{box-shadow:0 0 0 2px var(--nav-soft)}
.section-title{display:flex;align-items:center;justify-content:space-between;padding:0 8px 6px;color:#8f9ca9;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}
.icon-button{display:grid;place-items:center;width:24px;height:24px;border:0;border-radius:6px;background:transparent;color:#b9c4cf;font-size:18px;line-height:1}.icon-button:hover{background:#ffffff14;color:#fff}
.conversation-list{flex:1;min-height:0;overflow:auto}.conversation-row{width:100%;display:grid;grid-template-columns:34px 1fr;align-items:center;gap:9px;padding:7px 8px;margin:2px 0;border:0;border-radius:9px;background:transparent;color:#e9eef3;text-align:left}.conversation-row:hover{background:#ffffff0d}.conversation-row.active{background:#16569f;color:#fff}.conversation-row.active .avatar{background:#fff;color:#174e91}.conversation-copy{min-width:0;display:flex;flex-direction:column}.conversation-copy strong{display:flex;min-width:0;align-items:baseline;gap:6px;white-space:nowrap;overflow:hidden}.contact-name{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;font-size:13px}.contact-email{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;color:#8fa0b0;font-size:9px;font-weight:500}.conversation-copy small{display:flex;align-items:center;gap:5px;color:#9facb8;font-size:10.5px;margin-top:2px}.conversation-row.active small,.conversation-row.active .contact-email{color:#eef6ff}.conversation-copy .presence-dot{width:6px;height:6px;box-shadow:none}
.sidebar-empty{padding:10px;color:#82909d;font-size:12px}.sidebar-actions{padding-top:8px;border-top:1px solid #ffffff12}.sidebar-button{width:100%;height:34px;padding:0 9px;border:0;border-radius:8px;background:transparent;color:#aeb8c3;text-align:left;font-size:12px}.sidebar-button:hover{background:#ffffff0d;color:#fff}.sidebar-action-icon{display:inline-grid;place-items:center;width:22px}.sidebar-action-label{display:inline}
.sidebar-invite-section{max-height:32%;margin-bottom:8px;overflow:hidden}.invitation-list{display:grid;gap:3px;max-height:150px;overflow:auto}.invite-row{display:grid;grid-template-columns:28px minmax(0,1fr);gap:7px;align-items:center;padding:6px 8px;border-radius:8px;background:#ffffff0a;color:#edf3f8}.invite-row:hover{background:#ffffff12}.invite-avatar{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#614f25;color:#ffe5a5;font-size:13px}.invite-row-copy{min-width:0;display:flex;flex-direction:column}.invite-row-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.invite-row-copy small{color:#e8bd57;font-size:9.5px}.invite-inline-actions{grid-column:1/-1;display:flex;gap:4px;padding-left:35px}.invite-mini{height:24px;padding:0 8px;border:1px solid #ffffff26;border-radius:6px;background:#ffffff0c;color:#dce6ef;font-size:9.5px}.invite-mini.accept{border-color:#4ebc7b66;color:#8ae2ae}.invite-mini.reject{border-color:#dc686866;color:#f2a0a0}
.invite-row-button{width:100%;border:0;text-align:left}.invite-row-button:focus-visible{outline:2px solid #78aef4;outline-offset:-2px}

.chat-pane{position:relative;min-width:0;min-height:0;overflow:hidden;display:grid;grid-template-rows:58px auto minmax(0,1fr) auto auto;background:#f7f9fb}
.chat-header{grid-row:1;display:flex;align-items:center;justify-content:space-between;padding:env(safe-area-inset-top) max(18px,env(safe-area-inset-right)) 0 18px;background:#fff;border-bottom:1px solid var(--line)}
.chat-person{display:flex;align-items:center;gap:10px;min-width:0}.chat-person>div{min-width:0}.chat-person h1{font-size:14px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.peer-email{display:block;max-width:min(42vw,420px);margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#667383;font-size:9px}.chat-person p{display:flex;align-items:center;gap:5px;margin:1px 0 0;color:var(--muted);font-size:10.5px}.chat-person .presence-dot{width:6px;height:6px;box-shadow:none}
.header-actions{display:flex;gap:6px}.round-button{display:grid;place-items:center;width:32px;height:32px;border:0;border-radius:50%;background:#eef3f8;color:#34485c;font-size:15px}.round-button:hover{background:#dfe9f3}.round-button.danger{background:#feeaea;color:#c73737}.ui-icon{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.voice-banner{grid-row:2;padding:7px 18px;background:#e9f7ef;color:#24724a;font-size:11px;border-bottom:1px solid #d2ebdc}.voice-banner.error{background:#fff0f0;color:#a93636}.pulse{display:inline-block;width:7px;height:7px;margin-right:7px;border-radius:50%;background:var(--online);animation:pulse 1.6s infinite}@keyframes pulse{50%{box-shadow:0 0 0 5px #30b66d20}}
.timeline{grid-row:3;min-height:0;overflow-x:hidden;overflow-y:auto;scrollbar-gutter:stable;overscroll-behavior:contain;padding:16px 22px 10px;background:linear-gradient(#f7f9fbcc,#f7f9fbcc),radial-gradient(circle at 10px 10px,#d8dee5 1px,transparent 1px);background-size:auto,20px 20px}.timeline::-webkit-scrollbar{width:10px}.timeline::-webkit-scrollbar-track{background:#edf1f5}.timeline::-webkit-scrollbar-thumb{border:2px solid #edf1f5;border-radius:8px;background:#b9c3ce}.timeline::-webkit-scrollbar-thumb:hover{background:#929faa}
.new-message-indicator{position:absolute;right:25px;bottom:76px;z-index:4;height:30px;padding:0 12px;border:1px solid #bcd4f4;border-radius:16px;background:#fff;color:#1769e0;box-shadow:0 4px 16px #1d365122;font-size:11px;font-weight:650}.new-message-indicator:hover{background:#f1f7ff}
.date-marker{width:max-content;margin:5px auto 12px;padding:3px 8px;border-radius:10px;background:#e8edf2;color:#56616d;font-size:10px}
.message-row{display:flex;flex-direction:column;align-items:flex-start;margin:5px 0}.message-row.own{align-items:flex-end}.message-meta{display:flex;gap:7px;align-items:center;min-height:18px;margin:0 5px 2px;color:#667383;font-size:10px}.message-meta time{color:#667383}.edited-indicator{color:#667383;font-size:9px}.message-receipt{font-size:9px;font-weight:650;white-space:nowrap}.message-receipt.read{color:#1769e0}.message-receipt.unread{color:#667383;font-weight:500}.message-item-action{width:22px;height:18px;padding:0;border:0;border-radius:5px;background:transparent;color:#596979;font-size:12px;line-height:18px;opacity:0;transition:.15s}.message-row:hover .message-item-action,.message-item-action:focus-visible{opacity:1}.reply-item:hover,.edit-item:hover{background:#e7f1ff;color:#1769e0}.delete-item:hover{background:#feecec;color:#c93838}
.search-hit-flash .bubble{animation:search-hit 2.1s ease}@keyframes search-hit{0%,35%{box-shadow:0 0 0 4px #f2bb3f66;background:#fff6d8}100%{box-shadow:0 1px 2px #2030400a}}
.reply-hit-flash .bubble{animation:reply-hit 2.1s ease}@keyframes reply-hit{0%,35%{box-shadow:0 0 0 4px #4c91e855}100%{box-shadow:0 1px 2px #2030400a}}
.bubble{max-width:min(72%,620px);padding:7px 10px;border:1px solid #e0e5ea;border-radius:5px 12px 12px 12px;background:#fff;box-shadow:0 1px 2px #2030400a}.own .bubble{border-color:#cfe1fa;border-radius:12px 5px 12px 12px;background:var(--blue-soft)}.bubble p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.4}.message-link{color:#0969da;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.message-link:hover{color:#034fa9}.deleted-bubble{border-style:dashed;background:#f3f5f7!important}.deleted-message{color:#8a949e;font-style:italic}
.message-reply-quote{display:flex;width:100%;min-width:150px;max-width:390px;flex-direction:column;gap:2px;margin:0 0 6px;padding:6px 8px;border:0;border-left:3px solid #5b91d5;border-radius:4px 7px 7px 4px;background:#eef3f8;color:#44515e;text-align:left}.own .message-reply-quote{background:#dceafb}.message-reply-quote:hover{background:#e3edf7}.message-reply-quote strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#2769b8;font-size:9.5px}.message-reply-quote span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10.5px}
.file-card{display:flex;align-items:center;gap:9px;min-width:190px;color:#263644;text-decoration:none}.file-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:#e1ecf8;color:#1769e0;font-size:17px}.file-card>span:last-child{display:flex;min-width:0;flex-direction:column}.file-card strong{max-width:310px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.file-card small{color:var(--muted);font-size:10px;margin-top:1px}
.bubble.image-bubble{padding:3px;overflow:hidden}.media-message{display:block;max-width:320px;padding:0;border:0;border-radius:9px;background:transparent;color:#263644;text-align:left;overflow:hidden}.media-message img,.video-thumb{display:block;width:auto;max-width:320px;height:auto;max-height:260px;object-fit:cover;background:#e7ecf1}.media-message>span:last-child{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:6px 7px 5px}.media-message strong{max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.media-message small{color:var(--muted);font-size:9.5px;white-space:nowrap}.video-thumb{position:relative;width:320px;height:190px}.video-thumb video{width:100%;height:100%;object-fit:cover;background:#20262d}.video-thumb i{position:absolute;left:50%;top:50%;display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:#101820b8;color:#fff;font-size:18px;font-style:normal;transform:translate(-50%,-50%)}
.empty-state{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#929ba5}.empty-state strong{color:#697480;font-size:14px}.empty-state span{font-size:11px;margin-top:3px}
.composer{grid-row:4;position:relative;display:grid;grid-template-columns:32px 32px minmax(0,1fr) 32px;align-items:end;gap:7px;padding:9px max(16px,env(safe-area-inset-right)) max(9px,env(safe-area-inset-bottom)) 16px;background:#fff;border-top:1px solid var(--line)}.composer textarea{min-height:34px;max-height:120px;border-color:#d9dfe5;background:#f6f8fa;font-size:13px;line-height:1.3}.composer-icon,.send-button{width:32px;height:32px;border:0;border-radius:50%;font-size:18px}.composer-icon{background:#eef2f6;color:#536476}.send-button{background:var(--blue);color:#fff;font-size:14px}.reply-composer-preview{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0;padding:6px 8px;border-left:3px solid #5b91d5;border-radius:5px;background:#eef4fb}.reply-composer-preview>span{display:flex;min-width:0;flex-direction:column}.reply-composer-preview strong{color:#2769b8;font-size:9.5px}.reply-composer-preview small{max-width:min(72vw,650px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#526171;font-size:10.5px}.reply-composer-preview button{flex:0 0 auto;width:24px;height:24px;border:0;border-radius:50%;background:transparent;color:#6b7885;font-size:17px}.reply-composer-preview button:hover{background:#dce8f5}.drop-hint{position:absolute;inset:4px max(9px,env(safe-area-inset-right)) 4px 9px;z-index:5;display:none;place-items:center;border:2px dashed #3c82df;border-radius:10px;background:#edf5ffed;color:#1769e0;font-size:12px;font-weight:700;pointer-events:none}.composer.drop-active .drop-hint{display:grid}.status-line{min-height:18px;margin:0;padding:0 max(18px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) 18px;background:#fff;color:#34714e;font-size:10.5px}.chat-pane>#status{grid-row:5}
.bubble.editing-bubble{width:min(72vw,620px);padding:8px;background:#fff}.edit-message-form{display:grid;gap:7px}.edit-message-form textarea{min-height:64px;max-height:180px;resize:vertical;background:#fff;font-size:13px;line-height:1.4}.edit-message-actions{display:flex;justify-content:flex-end;gap:6px}.edit-message-actions button{height:30px;padding:0 11px;font-size:10.5px}

.modal{width:min(520px,calc(100vw - 48px));max-height:min(80dvh,720px);padding:0;border:0;border-radius:var(--radius-dialog);background:var(--surface);color:var(--text);box-shadow:var(--shadow-dialog);overflow:hidden}.modal::backdrop{background:var(--overlay);backdrop-filter:blur(2px)}.compact-modal{width:min(420px,calc(100vw - 48px))}
.modal-head{position:sticky;top:0;z-index:4;min-height:52px;display:flex;align-items:center;justify-content:space-between;padding:8px 16px;border-bottom:1px solid var(--line);background:var(--surface)}.modal-head h2{font-size:17px;line-height:1.35;margin:0}.modal-head small{display:block;margin-top:1px;color:var(--muted);font-size:11px}.close-button{display:grid;place-items:center;flex:0 0 auto;width:32px;height:32px;padding:0;border:0;border-radius:var(--radius-control);background:var(--surface-subtle);color:#56616d}.close-button .ui-icon{width:18px;height:18px}
.settings-section{padding:14px 18px;border-bottom:1px solid var(--line)}.settings-section h3{font-size:12px;margin:0 0 9px}.inline-form{display:grid;grid-template-columns:1fr auto;gap:8px}.stack-form{display:grid;gap:8px;padding:15px 18px}.settings-section .stack-form{padding:0}.hint{margin:7px 18px 14px;color:var(--muted);font-size:10.5px}.settings-section .hint{margin:7px 0 0}.modal>.status-line{padding:8px 18px 12px;border-radius:0 0 14px 14px}.stack-form label{margin:0}
.setting-check-row{display:flex!important;align-items:center;gap:8px;margin-top:10px!important;color:#364350;font-size:11px}.setting-check-row input{width:15px!important;height:15px!important;min-height:0!important;margin:0;accent-color:#1769e0}.setting-check-row span{display:inline;margin:0;font-size:11px;font-weight:500}
.invite-modal{width:min(560px,calc(100vw - 24px))}.invite-result{margin:0 18px 14px;padding:12px;border:1px solid #c9dcf4;border-radius:10px;background:#f6f9fd}.invite-result label{display:block;margin-top:8px}.invite-result textarea{min-height:58px;resize:vertical;background:#fff;font-size:11px}.invite-result-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.invite-result-head strong{color:#24633e;font-size:11px}.invite-result-head span{color:var(--muted);font-size:10px}.invite-copy-actions{display:flex;gap:7px;margin-top:8px}.invite-copy-actions .outline{height:32px;font-size:10.5px}.invite-history-section{max-height:250px;overflow:auto}.invite-history{display:grid;gap:6px}.invite-history-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 10px;align-items:center;padding:8px;border:1px solid var(--line);border-radius:8px}.invite-history-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.invite-history-row small{color:var(--muted);font-size:9.5px}.invite-history-actions{display:flex;gap:5px}.invite-history-actions button{height:26px;padding:0 8px;border:1px solid #ccd5de;border-radius:6px;background:#fff;color:#52606e;font-size:9.5px}.decision-body{padding:18px}.decision-body p{margin:10px 0;font-size:12px}.decision-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.decision-actions button{height:36px}.danger-outline{border-color:#e7b9b9;color:#a93232}
.invite-detail-grid{display:grid;grid-template-columns:72px minmax(0,1fr);gap:7px 10px;margin:12px 0;font-size:11px}.invite-detail-grid dt{color:var(--muted)}.invite-detail-grid dd{margin:0;overflow-wrap:anywhere;color:#293644}.invite-detail>.hint{margin:8px 0}.invite-detail-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:7px;margin-top:10px}.invite-detail-actions button{height:34px;font-size:10.5px}.invite-history-row[role=button]{cursor:pointer}.invite-history-row[role=button]:hover{border-color:#b9cde4;background:#f8fbff}.invite-history-row[role=button]:focus-visible{outline:2px solid #5597ec;outline-offset:1px}
.admin-invite-row{width:100%;border:1px solid var(--line);background:#fff;color:#20242a;text-align:left}.admin-invite-row:hover{border-color:#b9cde4;background:#f8fbff}.admin-invite-status{padding:3px 7px;border-radius:10px;background:#edf3f9;color:#556473;font-size:9px}
.visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.content-browser-dialog{width:min(680px,calc(100vw - 24px));height:min(78vh,720px);height:min(78dvh,720px);overflow:hidden}.content-browser-dialog>.modal-head>div{min-width:0}.content-browser-dialog>.modal-head small{display:block;max-width:440px;margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:9.5px}.content-search-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:12px 16px;border-bottom:1px solid var(--line)}.search-field{min-width:0}.content-search-toolbar input{background:#f6f8fa}.content-search-toolbar .outline{height:38px}.content-summary{min-height:30px;margin:0;padding:8px 16px;color:var(--muted);font-size:10.5px;border-bottom:1px solid var(--line)}.content-results,.shared-files-list{height:calc(100% - 119px);overflow:auto;padding:8px 12px 14px}.content-result{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;border-bottom:1px solid #edf0f3}.content-result-main{display:grid;grid-template-columns:42px minmax(0,1fr);align-items:center;gap:10px;min-width:0;padding:9px 4px;border:0;background:transparent;color:#26323d;text-align:left}.content-result-main:hover{background:#f7f9fb}.content-result-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:9px;overflow:hidden;background:#e9eef4;color:#547087;font-size:18px}.content-result-icon img,.content-result-icon video{width:100%;height:100%;object-fit:cover}.content-result-copy{display:flex;min-width:0;flex-direction:column;gap:3px}.content-result-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.content-result-copy small{color:var(--muted);font-size:9.5px}.content-result-copy mark{padding:0 1px;border-radius:2px;background:#ffe59b;color:inherit}.content-download{display:inline-flex;align-items:center;justify-content:center;height:30px;padding:0 9px;border:1px solid #cbd6e1;border-radius:8px;background:#fff;color:#1769e0;text-decoration:none;font-size:10px;white-space:nowrap}.content-download:hover{background:#f2f7fd}.content-empty{height:100%;min-height:180px;display:flex;align-items:center;justify-content:center;flex-direction:column;color:#97a0aa}.content-empty strong{color:#6d7883;font-size:12px}.content-empty span{margin-top:3px;font-size:10px}.content-filters{display:flex;gap:6px;padding:10px 16px;border-bottom:1px solid var(--line);overflow:auto}.content-filters button{height:29px;padding:0 12px;border:1px solid #d4dbe3;border-radius:15px;background:#fff;color:#596674;font-size:10.5px;white-space:nowrap}.content-filters button.active{border-color:#1769e0;background:#eaf3ff;color:#1769e0;font-weight:700}.shared-files-list{height:calc(100% - 156px)}.shared-file-row{display:grid;grid-template-columns:54px minmax(0,1fr) auto;align-items:center;gap:10px;padding:9px 4px;border-bottom:1px solid #edf0f3}.shared-file-preview{position:relative;display:grid;place-items:center;width:54px;height:54px;padding:0;border:0;border-radius:9px;overflow:hidden;background:#e9eef4;color:#547087;text-decoration:none;font-size:21px}.shared-file-preview img,.shared-file-preview video{width:100%;height:100%;object-fit:cover}.shared-file-preview i{position:absolute;left:50%;top:50%;display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#111a23b8;color:#fff;font-size:10px;font-style:normal;transform:translate(-50%,-50%)}.shared-file-copy{display:flex;min-width:0;flex-direction:column;gap:3px}.shared-file-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.shared-file-copy small{color:var(--muted);font-size:9.5px}.content-load-more{position:absolute;left:0;right:0;bottom:0;display:flex;justify-content:center;padding:8px;background:#fff;border-top:1px solid var(--line)}.content-load-more .outline{height:30px;font-size:10px}
.image-dialog{width:min(94vw,1100px);height:min(92vh,850px);height:min(92dvh,850px);padding:0;border:0;border-radius:14px;background:#101418;color:#fff;box-shadow:0 24px 80px #0008;overflow:hidden}.image-dialog::backdrop{background:#05080bd9;backdrop-filter:blur(3px)}.image-viewer-head{height:54px;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:env(safe-area-inset-top) max(15px,env(safe-area-inset-right)) 0 max(15px,env(safe-area-inset-left));background:#181d22;border-bottom:1px solid #ffffff12}.image-viewer-head>div:first-child{display:flex;min-width:0;flex-direction:column}.image-viewer-head strong{max-width:60vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.image-viewer-head small{color:#9da7b1;font-size:10px}.image-viewer-actions{display:flex;align-items:center;gap:8px}.download-button{display:inline-flex;align-items:center;height:32px;padding:0 12px;border-radius:8px;background:#1769e0;color:#fff;text-decoration:none;font-size:11px;font-weight:650}.image-dialog .close-button{background:#ffffff14;color:#fff}.image-stage{height:calc(100% - 54px);display:grid;place-items:center;padding:14px max(14px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));overflow:auto}.image-stage img,.image-stage video{display:block;max-width:100%;max-height:100%;object-fit:contain;box-shadow:0 6px 30px #0008}.image-stage video{width:min(100%,1000px);background:#000}
.conversation-row{position:relative}.rail-presence{display:none}.content-browser-dialog{position:relative}
.unread-badge{position:absolute;right:7px;top:50%;display:grid;place-items:center;min-width:18px;height:18px;padding:0 5px;border:2px solid var(--nav);border-radius:10px;background:#e5484d;color:#fff;font-size:9px;font-weight:750;line-height:1;transform:translateY(-50%)}.conversation-row.active .unread-badge{border-color:#2d72c9}
.notification-setting-row{display:flex;align-items:center;gap:10px}.notification-setting-row .outline{flex:0 0 auto;height:34px}.notification-permission{color:var(--muted);font-size:10.5px}.notification-preview-option{display:flex!important;align-items:center;gap:8px;margin-top:10px!important;color:#364350;font-size:11px}.notification-preview-option input{width:15px!important;height:15px!important;min-height:0!important;margin:0;accent-color:#1769e0}
#settingsDialog{overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}.install-hint-emphasis{animation:install-hint 2.1s ease}@keyframes install-hint{0%,35%{padding:7px;border-radius:7px;background:#e6f1ff;color:#1769e0}100%{background:transparent;color:var(--muted)}}

@media(display-mode:standalone){
  body{background:var(--nav)}
  .app-shell{height:100dvh}
}

@media(max-width:820px){
  .app-shell{grid-template-columns:68px minmax(0,1fr)}
  .sidebar{overflow:hidden;padding:calc(10px + env(safe-area-inset-top)) 6px calc(8px + env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))}
  .sidebar-brand{justify-content:center;padding:0}.sidebar-brand strong,.me-card>div,.section-title>span,.conversation-copy,.invite-row-copy,.invite-inline-actions,.sidebar-empty,.sidebar-action-label{display:none!important}
  .me-card{display:flex;justify-content:center;padding:7px;background:transparent}.me-card>.presence-dot{margin-left:-8px;margin-top:22px}.section-title{justify-content:center;padding:2px 0}.section-title .icon-button{flex:0 0 auto}
  .sidebar-invite-section{max-height:24%}.invitation-list{justify-items:center}.invite-row{display:block;padding:5px;background:transparent}.invite-avatar{width:34px;height:34px}
  .conversation-row{display:flex;justify-content:center;overflow:hidden;padding:6px}.conversation-row .avatar{width:38px;height:38px}.rail-presence{position:absolute;right:7px;bottom:6px;display:block;width:8px;height:8px;box-shadow:0 0 0 2px var(--nav)}.conversation-row.active .rail-presence{box-shadow:0 0 0 2px #2d72c9}
  .unread-badge{right:1px;top:1px;min-width:16px;height:16px;padding:0 4px;border-width:2px;font-size:8px;transform:none}
  .sidebar-actions{display:flex;flex-direction:column}.sidebar-button{display:grid;place-items:center;height:36px;padding:0;text-align:center}.sidebar-action-icon{width:auto;font-size:16px}
  .timeline{padding:12px 10px}.bubble{max-width:86%}.message-item-action{opacity:1}.chat-header{padding-top:env(safe-area-inset-top);padding-right:max(11px,env(safe-area-inset-right));padding-left:11px}.composer{padding:8px max(9px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) 9px}.media-message,.media-message img,.video-thumb{max-width:240px}.media-message img{max-height:220px}.video-thumb{height:150px}.image-viewer-head strong{max-width:42vw}.new-message-indicator{right:14px}
}

@media(max-width:520px){
  .login-page{align-items:start;overflow:auto}.auth-stack{padding:4px 0}.auth-forms{display:grid;gap:10px}.auth-forms .login-card{width:100%;padding:22px}.invite-intro{padding:13px}
  .app-shell{grid-template-columns:58px minmax(0,1fr)}
  .sidebar{padding-right:3px;padding-left:max(3px,env(safe-area-inset-left))}.sidebar-brand{height:34px;margin-bottom:4px}.brand-mark.small{width:26px;height:26px}.me-card{margin-bottom:10px;padding:4px}.conversation-row{padding:5px 2px}.conversation-row .avatar{width:34px;height:34px}.rail-presence{right:5px;bottom:5px}.section-title{padding-bottom:3px}.chat-pane{grid-template-rows:52px auto minmax(0,1fr) auto auto}.chat-header{padding-left:8px;padding-right:max(6px,env(safe-area-inset-right))}.chat-person{gap:7px}.chat-person .avatar{width:31px;height:31px}.peer-email{max-width:26vw}.header-actions{gap:2px}.round-button{width:32px;height:32px}.header-actions #removeConversation{display:none}.voice-banner{padding:6px 10px}.timeline{padding:10px 7px 7px;scrollbar-gutter:auto}.timeline::-webkit-scrollbar{width:5px}.message-row{margin:4px 0}.bubble{max-width:92%;padding:6px 8px}.bubble p{font-size:14px}.composer{grid-template-columns:40px 40px minmax(0,1fr) 40px;gap:5px;padding:7px max(6px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) 6px}.composer-icon,.send-button{width:40px;height:40px}.composer textarea{min-height:40px;max-height:96px;padding:9px 10px;font-size:14px}.status-line{min-height:15px;padding-right:max(9px,env(safe-area-inset-right));padding-bottom:max(3px,env(safe-area-inset-bottom));padding-left:9px}.media-message,.media-message img,.video-thumb{max-width:min(250px,76vw)}.media-message img{max-height:210px}.video-thumb{width:min(250px,76vw);height:min(148px,45vw)}.new-message-indicator{right:9px;bottom:76px}.modal,.compact-modal,.content-browser-dialog{position:fixed;inset:auto 0 0;width:100%;height:auto;max-width:none;max-height:92dvh;margin:0;border-radius:20px 20px 0 0}.modal-head{padding-top:max(8px,env(safe-area-inset-top))}.modal-body{padding-bottom:max(16px,env(safe-area-inset-bottom))}.shared-file-row{grid-template-columns:48px minmax(0,1fr) auto;gap:8px}.shared-file-preview{width:48px;height:48px}.content-load-more{padding-bottom:max(8px,env(safe-area-inset-bottom))}.image-dialog{width:100vw;height:100vh;height:100dvh;max-width:none;max-height:none;border-radius:0}.image-viewer-head strong{max-width:36vw}.image-stage{padding:8px max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
}

@media(max-height:520px){
  .chat-pane{grid-template-rows:50px auto minmax(0,1fr) auto auto}.sidebar{padding-top:max(6px,env(safe-area-inset-top));padding-bottom:max(5px,env(safe-area-inset-bottom))}.sidebar-brand{height:30px;margin-bottom:2px}.me-card{margin-bottom:5px}.timeline{padding-top:7px}.composer{padding-top:5px;padding-bottom:max(5px,env(safe-area-inset-bottom))}.image-dialog{height:100vh;height:100dvh;max-height:none}
}

.call-dialog,.voice-note-dialog{width:min(430px,calc(100vw - 24px));max-height:min(92vh,640px);overflow:auto}.call-panel,.voice-note-panel{display:flex;flex-direction:column;align-items:center;gap:12px;padding:24px 20px;text-align:center}.call-symbol{display:grid;place-items:center;width:68px;height:68px;border-radius:50%;background:#e8f4ff;color:#1769e0;font-size:30px}.call-panel h2,.call-panel p{margin:0}.call-panel>strong{font-size:15px}.call-timer{font-variant-numeric:tabular-nums;color:var(--muted);font-size:20px}.call-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;width:100%}.call-actions button{min-width:92px}.call-end{background:#d63d45}.recording-indicator{display:flex;align-items:center;gap:7px;color:var(--muted)}.recording-indicator.active{color:#cf3038}.recording-indicator.active::before{content:"";width:9px;height:9px;border-radius:50%;background:#e12632;animation:pulse 1.2s infinite}.voice-note-panel>strong{font-size:28px;font-variant-numeric:tabular-nums}.voice-note-panel audio{width:100%}.voice-note-bubble{display:flex;align-items:center;gap:9px;min-width:220px}.voice-note-bubble audio{width:min(260px,54vw);height:34px}.voice-note-bubble a{color:#1769e0;text-decoration:none}.call-timeline{display:flex;align-items:center;gap:8px;color:#536476}.call-timeline .file-icon{font-size:14px}

@media(max-width:520px){.composer{grid-template-columns:30px 30px minmax(0,1fr) 30px}.call-dialog,.voice-note-dialog{width:100vw;height:100vh;height:100dvh;max-width:none;max-height:none;border-radius:0}.call-panel,.voice-note-panel{min-height:calc(100% - 56px);justify-content:center;padding-bottom:max(24px,env(safe-area-inset-bottom))}.voice-note-bubble audio{width:min(220px,52vw)}}
.voice-note-error{display:flex;flex-direction:column;gap:4px;color:#9b2c2c}.voice-note-error button{min-height:36px}

/* v54 unified messaging surfaces */
.ui-icon{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}.sidebar-action-icon .ui-icon{width:18px;height:18px}.composer-icon .ui-icon,.send-button .ui-icon{width:18px;height:18px}.round-button .ui-icon{width:18px;height:18px}.avatar img{display:block;width:100%;height:100%;border-radius:inherit;object-fit:cover}.content-download{gap:4px}.content-download .ui-icon{width:14px;height:14px}
.modal-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:12px 16px}.modal-footer{position:sticky;bottom:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:56px;padding:10px 16px;border-top:1px solid var(--line);background:var(--surface);color:var(--muted);font-size:12px}.footer-actions{display:flex;gap:8px}.modal-footer button{height:36px;min-width:72px}
.clipboard-image-body{display:grid;grid-template-columns:112px minmax(0,1fr);align-items:center;gap:14px}.clipboard-image-body img{display:block;width:112px;height:112px;border:1px solid var(--line);border-radius:10px;background:var(--surface-subtle);object-fit:contain}.clipboard-image-body div{display:flex;min-width:0;flex-direction:column;gap:4px}.clipboard-image-body strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.clipboard-image-body small{color:var(--muted);font-size:11px}
.delete-confirm-dialog{width:min(440px,calc(100vw - 32px))}.delete-confirm-body{padding-block:20px}.delete-confirm-body p{margin:0;color:var(--text);font-size:14px;line-height:1.6}.danger-action{background:var(--danger);color:#fff}.danger-action:hover{filter:brightness(.94)}.danger-action:disabled{cursor:wait;opacity:.58}.about-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:18px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface-subtle)}.about-row span{display:flex;min-width:0;flex-direction:column;gap:2px}.about-row strong{font-size:12px}.about-row small{color:var(--muted);font-size:10px}.about-row code{overflow-wrap:anywhere;color:var(--muted);font-size:10px}
@media(max-width:520px){.delete-confirm-dialog .modal-footer{align-items:stretch;flex-direction:column}.delete-confirm-dialog .footer-actions{justify-content:flex-end}.about-row{align-items:flex-start;flex-direction:column;gap:5px}}
.content-browser-dialog{width:min(680px,calc(100vw - 48px));height:min(680px,80dvh);display:grid;grid-template-rows:auto auto auto minmax(0,1fr);overflow:hidden}.content-browser-dialog:not([open]){display:none}.content-browser-dialog>.modal-head small{max-width:440px;font-size:11px}.content-search-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:10px 16px}.content-search-toolbar .primary{height:36px}.compact-action{display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap}.compact-action .ui-icon{width:16px;height:16px}.icon-field{position:relative;display:block}.icon-field>.ui-icon{position:absolute;left:10px;top:50%;z-index:1;width:16px;height:16px;color:var(--muted);transform:translateY(-50%);pointer-events:none}.icon-field input{height:36px;padding-left:34px;background:var(--surface-subtle)}
.segment-tabs{display:flex;gap:4px;padding:0 16px 10px;border-bottom:1px solid var(--line)}.segment-tabs button{height:30px;padding:0 12px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:12px}.segment-tabs button span{display:inline-grid;place-items:center;min-width:18px;height:18px;margin-left:4px;padding:0 5px;border-radius:9px;background:#e7edf5;font-size:10px}.segment-tabs button.active{background:var(--blue-soft);color:var(--blue);font-weight:700}.address-book-body{padding:4px 12px 12px}.persona-list{display:grid}.persona-row{position:relative;display:grid;grid-template-columns:40px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:56px;padding:8px 4px;border-bottom:1px solid #edf1f5}.persona-row:last-child{border-bottom:0}.persona-main{display:contents}.persona-avatar{position:relative;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;overflow:hidden;background:#dceaff;color:#174e91;font-size:13px;font-weight:750}.persona-avatar img,.profile-avatar img{width:100%;height:100%;object-fit:cover}.persona-avatar .presence-dot{position:absolute;right:1px;bottom:1px}.persona-copy{min-width:0;display:flex;flex-direction:column}.persona-copy strong,.persona-copy small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.persona-copy strong{font-size:13px}.persona-copy small{color:var(--muted);font-size:11px}.persona-copy em{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#667383;font-size:11px;font-style:normal}.persona-actions{display:flex;align-items:center;gap:4px}.icon-action{display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:8px;background:transparent;color:#5c6977}.icon-action:hover{background:#edf3fa;color:var(--blue)}.icon-action .ui-icon{width:17px;height:17px}.persona-menu{position:absolute;right:4px;top:46px;z-index:7;min-width:150px;padding:4px;border:1px solid var(--line);border-radius:10px;background:var(--surface);box-shadow:0 12px 32px #10243c24}.persona-menu button{width:100%;height:32px;padding:0 10px;border:0;border-radius:6px;background:transparent;text-align:left;font-size:12px}.persona-menu button:hover{background:var(--surface-subtle)}.persona-menu .danger-text{border-top:1px solid var(--line);color:var(--danger)}.status-chip{display:inline-flex;align-items:center;width:max-content;height:20px;padding:0 7px;border-radius:999px;background:#eef2f7;color:#526172;font-size:10px}.status-chip.accepted{background:#e8f7ef;color:#197146}.status-chip.pending{background:#fff5d9;color:#8c6200}.status-chip.rejected,.status-chip.expired,.status-chip.revoked{background:#f5eeee;color:#8a4b4b}.content-empty.compact-empty{min-height:220px;gap:6px;text-align:center}.content-empty .ui-icon{width:28px;height:28px}.content-empty button{margin-top:4px}
.people-picker-dialog{width:min(560px,calc(100vw - 48px));max-height:min(760px,84dvh)}.modal-form-layout{display:grid;grid-template-rows:minmax(0,1fr) auto;max-height:calc(84dvh - 52px)}.field-label{display:block;color:#45515e;font-size:12px;font-weight:650}.field-label input{display:block;margin-top:5px}.field-counter{float:right;color:var(--muted);font-size:10px;font-weight:500}.selected-people{display:flex;flex-wrap:wrap;gap:6px;min-height:0;margin:10px 0}.selected-people:empty{display:none}.selected-person-chip{display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 7px 0 4px;border-radius:14px;background:var(--blue-soft);color:#2459a9;font-size:11px}.selected-person-chip .avatar{width:22px;height:22px;font-size:9px}.selected-person-chip button{width:18px;height:18px;padding:0;border:0;background:transparent;color:#53709a}.member-picker{max-height:330px;overflow:auto;margin-top:8px;border:1px solid var(--line);border-radius:12px}.member-choice{cursor:pointer}.member-choice input{position:absolute;opacity:0;pointer-events:none}.choice-check{display:grid;place-items:center;width:24px;height:24px;border:1px solid var(--border);border-radius:50%;color:transparent}.member-choice input:checked~.choice-check{border-color:var(--blue);background:var(--blue);color:#fff}.choice-check .ui-icon{width:14px;height:14px}.group-profile{display:flex;align-items:center;gap:10px;margin-bottom:12px;padding:10px;border-radius:12px;background:var(--surface-subtle)}.group-avatar{width:44px;height:44px}.group-profile>div{display:flex;flex-direction:column}.group-profile small{color:var(--muted);font-size:11px}.danger-zone{margin-top:16px;padding-top:12px;border-top:1px solid #efd2d2}.danger-zone>strong{color:var(--danger);font-size:11px}.danger-zone .decision-actions{margin-top:8px}
.settings-dialog{width:min(720px,calc(100vw - 48px));height:min(680px,82dvh);display:grid;grid-template-rows:auto minmax(0,1fr) auto}.settings-dialog:not([open]){display:none}.settings-layout{display:grid;grid-template-columns:172px minmax(0,1fr);min-height:0}.settings-nav{display:flex;flex-direction:column;gap:3px;padding:10px;border-right:1px solid var(--line);background:var(--surface-subtle)}.settings-nav button{display:flex;align-items:center;gap:8px;width:100%;height:36px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:#465361;text-align:left;font-size:12px}.settings-nav button .ui-icon{width:17px;height:17px}.settings-nav button.active{background:var(--blue-soft);color:var(--blue);font-weight:700}.settings-panels{padding:0}.settings-section{padding:16px 18px;border:0}.settings-section h3{margin:0 0 14px;font-size:16px}.settings-section>label{display:block;margin:12px 0}.profile-avatar-row{display:grid;grid-template-columns:64px minmax(0,1fr);align-items:center;gap:12px;margin-bottom:14px}.profile-avatar{width:64px;height:64px;font-size:20px}.profile-avatar-row>div{display:flex;min-width:0;flex-direction:column}.profile-avatar-row small{overflow:hidden;text-overflow:ellipsis;color:var(--muted);font-size:11px}.profile-avatar-actions{display:flex;align-items:center;gap:8px;margin-top:7px}.file-label{display:inline-flex!important;align-items:center;height:32px;padding:0 10px;margin:0!important;border-radius:8px;font-size:11px;cursor:pointer}.avatar-preview{display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:10px;margin-bottom:12px;padding:10px;border:1px solid var(--line);border-radius:12px;background:var(--surface-subtle)}.avatar-preview img{width:48px;height:48px;border-radius:50%;object-fit:cover}.avatar-preview span{display:flex;flex-direction:column}.avatar-preview small{color:var(--muted);font-size:10px}.avatar-preview button{height:32px}.settings-action-stack{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}.settings-action-stack button{height:36px}.settings-dialog>.status-line{min-height:30px;padding:7px 16px;border-top:1px solid var(--line)}
.reaction-picker{display:flex;gap:4px;flex-wrap:wrap;margin:4px 0;padding:4px;width:max-content;max-width:220px;border:1px solid var(--line);border-radius:10px;background:var(--surface);box-shadow:0 6px 18px #10243c18}.reaction-picker button{display:grid;place-items:center;width:30px;height:30px;padding:0;border:0;border-radius:7px;background:transparent;font-size:16px;line-height:1}.reaction-picker button:hover{background:var(--surface-subtle)}.reaction-list{display:flex;gap:4px;flex-wrap:wrap;max-width:360px;margin-top:3px}.reaction-chip{display:inline-flex;align-items:center;justify-content:center;gap:3px;min-width:30px;height:22px;padding:0 6px;border:1px solid var(--border);border-radius:999px;background:var(--surface);font-size:13px;line-height:1}.reaction-chip span{font-size:10px}.reaction-chip.mine{border-color:#7aa7ea;background:var(--blue-soft)}.message-item-action.reaction-item{position:relative;display:grid;place-items:center;width:26px;height:24px}.message-item-action.reaction-item::after{content:"";position:absolute;inset:-7px}.message-item-action.reaction-item .ui-icon{width:15px;height:15px}
html[data-theme="dark"]{color-scheme:dark;--surface:#17212b;--surface-subtle:#202d39;--line:#354453;--border:#506071;--text:#edf4fb;--muted:#aab7c4;--blue-soft:#173c68;background:#111922}html[data-theme="dark"] body,html[data-theme="dark"] .chat-pane,html[data-theme="dark"] .settings-section,html[data-theme="dark"] input,html[data-theme="dark"] textarea,html[data-theme="dark"] select{background:var(--surface);color:var(--text)}html[data-theme="dark"] .modal,html[data-theme="dark"] .modal-head,html[data-theme="dark"] .modal-footer{background:var(--surface);color:var(--text)}html[data-theme="dark"] .outline{background:var(--surface);color:var(--text)}html[data-density="standard"]{font-size:14px}html[data-density="standard"] .persona-row{min-height:64px;padding-block:10px}
@media (min-width:600px) and (max-width:899px){.modal,.compact-modal,.content-browser-dialog,.people-picker-dialog,.settings-dialog{width:calc(100vw - 40px);max-width:720px;max-height:calc(100dvh - 40px)}.section-title>span:last-child{display:inline-flex!important}}
@media (max-width:599px){.modal,.compact-modal,.content-browser-dialog,.people-picker-dialog,.settings-dialog{position:fixed;inset:auto 0 0;width:100vw;max-width:none;margin:0;border-radius:20px 20px 0 0}.section-title>span:last-child{display:inline-flex!important}.content-search-toolbar{padding-inline:12px}.compact-action span{display:none}.segment-tabs{padding-inline:12px}.address-book-body{padding-inline:8px}.settings-layout{display:block}.settings-nav{position:sticky;top:0;z-index:3;display:flex;flex-direction:row;overflow:auto;padding:8px;border:0;border-bottom:1px solid var(--line)}.settings-nav button{flex:0 0 auto;width:auto}.settings-panels{max-height:calc(92dvh - 112px)}.settings-section{padding:14px 12px}.people-picker-dialog,.settings-dialog{max-height:92dvh}.modal-form-layout{max-height:calc(92dvh - 52px)}.modal-footer{padding-bottom:max(10px,env(safe-area-inset-bottom))}.persona-row{min-height:60px}.footer-actions{flex:1;justify-content:flex-end}.footer-actions button{flex:1}.settings-dialog{display:grid}.content-browser-dialog{display:grid}}
@media (max-height:520px){.modal,.compact-modal,.content-browser-dialog,.people-picker-dialog,.settings-dialog{max-height:96dvh}.modal-body{padding-block:8px}.modal-head{min-height:46px}.modal-footer{min-height:48px}}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* v54.1: complete dark-theme surface and contrast mapping. */
html[data-theme="dark"]{
  --surface-elevated:#263746;
  --surface-input:#111a23;
  --surface-hover:#2b3c4b;
  --text-subtle:#b6c4d2;
  --accent-text:#9bc8ff;
  --danger-soft:#4b252b;
  --success-soft:#173b2b;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .chat-pane,
html[data-theme="dark"] .chat-header,
html[data-theme="dark"] .composer,
html[data-theme="dark"] .status-line,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-head,
html[data-theme="dark"] .modal-body,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .settings-section,
html[data-theme="dark"] .content-load-more,
html[data-theme="dark"] .login-card{
  background:var(--surface);
  color:var(--text);
}
html[data-theme="dark"] .login-page{background:radial-gradient(circle at 50% 0,#243443,#111922 72%)}
html[data-theme="dark"] .login-card{border-color:var(--line);box-shadow:0 18px 60px #0007}
html[data-theme="dark"] .invite-intro{border-color:#41658a;background:#172d46}
html[data-theme="dark"] .invite-intro p,
html[data-theme="dark"] label>span,
html[data-theme="dark"] .setting-check-row,
html[data-theme="dark"] .notification-preview-option,
html[data-theme="dark"] .field-label,
html[data-theme="dark"] .settings-nav button,
html[data-theme="dark"] .call-timeline{color:var(--text-subtle)}
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .icon-field input{
  border-color:var(--border);
  background:var(--surface-input);
  color:var(--text);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#93a4b5;opacity:1}
html[data-theme="dark"] button:disabled{opacity:.72}
html[data-theme="dark"] .outline,
html[data-theme="dark"] .content-download,
html[data-theme="dark"] .invite-history-actions button,
html[data-theme="dark"] .admin-invite-row,
html[data-theme="dark"] .content-filters button{
  border-color:var(--border);
  background:var(--surface-elevated);
  color:var(--text);
}
html[data-theme="dark"] .round-button,
html[data-theme="dark"] .composer-icon,
html[data-theme="dark"] .file-icon,
html[data-theme="dark"] .content-result-icon,
html[data-theme="dark"] .shared-file-preview,
html[data-theme="dark"] .call-symbol{
  background:var(--surface-elevated);
  color:var(--accent-text);
}
html[data-theme="dark"] .round-button:hover,
html[data-theme="dark"] .icon-action:hover,
html[data-theme="dark"] .content-result-main:hover,
html[data-theme="dark"] .content-download:hover,
html[data-theme="dark"] .content-filters button:hover,
html[data-theme="dark"] .invite-history-row[role=button]:hover,
html[data-theme="dark"] .persona-menu button:hover{background:var(--surface-hover);color:var(--text)}
html[data-theme="dark"] .round-button.danger,
html[data-theme="dark"] .delete-item:hover{background:var(--danger-soft);color:#ffb0b5}
html[data-theme="dark"] .timeline{
  background:linear-gradient(#141f29e8,#141f29e8),radial-gradient(circle at 10px 10px,#3b4b5a 1px,transparent 1px);
  background-size:auto,20px 20px;
}
html[data-theme="dark"] .timeline::-webkit-scrollbar-track{background:#18242f}
html[data-theme="dark"] .timeline::-webkit-scrollbar-thumb{border-color:#18242f;background:#526374}
html[data-theme="dark"] .timeline::-webkit-scrollbar-thumb:hover{background:#718396}
html[data-theme="dark"] .bubble,
html[data-theme="dark"] .bubble.editing-bubble{
  border-color:#40505f;
  background:var(--surface-subtle);
  color:var(--text);
  box-shadow:0 1px 2px #0006;
}
html[data-theme="dark"] .own .bubble{border-color:#35699f;background:#173c68;color:#f4f8ff}
html[data-theme="dark"] .deleted-bubble{background:#26323d!important;color:var(--text-subtle)}
html[data-theme="dark"] .message-reply-quote{background:#263746;color:var(--text-subtle)}
html[data-theme="dark"] .own .message-reply-quote{background:#234f7c}
html[data-theme="dark"] .message-reply-quote:hover{background:#2c4358}
html[data-theme="dark"] .message-reply-quote strong,
html[data-theme="dark"] .message-link,
html[data-theme="dark"] .voice-note-bubble a,
html[data-theme="dark"] .content-download,
html[data-theme="dark"] .message-receipt.read{color:var(--accent-text)}
html[data-theme="dark"] .file-card,
html[data-theme="dark"] .media-message,
html[data-theme="dark"] .content-result-main,
html[data-theme="dark"] .invite-detail-grid dd{color:var(--text)}
html[data-theme="dark"] .composer textarea,
html[data-theme="dark"] .edit-message-form textarea{border-color:var(--border);background:var(--surface-input);color:var(--text)}
html[data-theme="dark"] .reply-composer-preview{background:#20374e}
html[data-theme="dark"] .reply-composer-preview strong{color:var(--accent-text)}
html[data-theme="dark"] .reply-composer-preview small,
html[data-theme="dark"] .reply-composer-preview button{color:var(--text-subtle)}
html[data-theme="dark"] .reply-composer-preview button:hover{background:#2d4a64}
html[data-theme="dark"] .date-marker,
html[data-theme="dark"] .new-message-indicator,
html[data-theme="dark"] .status-chip,
html[data-theme="dark"] .segment-tabs button span,
html[data-theme="dark"] .admin-invite-status{
  border-color:var(--border);
  background:var(--surface-elevated);
  color:var(--text-subtle);
}
html[data-theme="dark"] .new-message-indicator{color:var(--accent-text)}
html[data-theme="dark"] .voice-banner{border-color:#315f49;background:var(--success-soft);color:#9ee7bd}
html[data-theme="dark"] .voice-banner.error{background:var(--danger-soft);color:#ffb0b5}
html[data-theme="dark"] .invite-result{border-color:#41658a;background:#172d46}
html[data-theme="dark"] .invite-result textarea{background:var(--surface-input)}
html[data-theme="dark"] .invite-detail-grid dt,
html[data-theme="dark"] .peer-email,
html[data-theme="dark"] .persona-copy small,
html[data-theme="dark"] .persona-copy em,
html[data-theme="dark"] .content-result-copy small,
html[data-theme="dark"] .shared-file-copy small,
html[data-theme="dark"] .profile-avatar-row small,
html[data-theme="dark"] .avatar-preview small{color:var(--text-subtle)}
html[data-theme="dark"] .content-search-toolbar input{background:var(--surface-input)}
html[data-theme="dark"] .content-result,
html[data-theme="dark"] .shared-file-row,
html[data-theme="dark"] .persona-row{border-color:var(--line)}
html[data-theme="dark"] .persona-avatar,
html[data-theme="dark"] .avatar{background:#294869!important;color:#f4f8ff}
html[data-theme="dark"] .conversation-row.active{background:#1f548e;color:#fff}
html[data-theme="dark"] .conversation-row.active .avatar{background:#f4f8ff!important;color:#1f548e}
html[data-theme="dark"] .conversation-row.active small,
html[data-theme="dark"] .conversation-row.active .contact-email{color:#e4f0ff}

/* Request 107c: keep the Address Book content-height until its list needs to scroll. */
.address-book-dialog.content-browser-dialog{
  display:flex;
  flex-direction:column;
  height:fit-content;
  max-height:min(80dvh,680px);
  align-content:start;
}
.address-book-dialog.content-browser-dialog:not([open]){display:none}
.address-book-dialog .address-book-body{
  flex:0 1 auto;
  min-height:0;
  max-height:calc(min(80dvh,680px) - 154px);
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
}
@media (max-width:599px){
  .address-book-dialog.content-browser-dialog{
    display:flex;
    height:fit-content;
    max-height:82dvh;
    border-radius:20px 20px 0 0;
  }
  .address-book-dialog.content-browser-dialog:not([open]){display:none}
  .address-book-dialog .address-book-body{
    max-height:calc(82dvh - 154px);
    padding-bottom:max(12px,env(safe-area-inset-bottom));
  }
}
html[data-theme="dark"] .message-meta,
html[data-theme="dark"] .message-meta time,
html[data-theme="dark"] .edited-indicator,
html[data-theme="dark"] .message-receipt.unread,
html[data-theme="dark"] .message-item-action{color:var(--text-subtle)}
html[data-theme="dark"] .icon-action{color:var(--text-subtle)}
html[data-theme="dark"] .selected-person-chip,
html[data-theme="dark"] .settings-nav button.active,
html[data-theme="dark"] .segment-tabs button.active,
html[data-theme="dark"] .content-filters button.active,
html[data-theme="dark"] .reaction-chip.mine{border-color:#6799d0;background:#173c68;color:#e9f3ff}
html[data-theme="dark"] .selected-person-chip button{color:#b9d8ff}
html[data-theme="dark"] .status-chip.accepted{background:#173b2b;color:#9ee7bd}
html[data-theme="dark"] .status-chip.pending{background:#493a16;color:#f6d576}
html[data-theme="dark"] .status-chip.rejected,
html[data-theme="dark"] .status-chip.expired,
html[data-theme="dark"] .status-chip.revoked{background:#462a2d;color:#f1b2b6}
html[data-theme="dark"] .danger-zone{border-color:#63383d}
html[data-theme="dark"] .avatar-preview,
html[data-theme="dark"] .group-profile,
html[data-theme="dark"] .settings-nav,
html[data-theme="dark"] .reaction-picker,
html[data-theme="dark"] .reaction-chip,
html[data-theme="dark"] .persona-menu{background:var(--surface-subtle);color:var(--text)}
html[data-theme="dark"] .reaction-picker button:hover{background:var(--surface-hover)}
html[data-theme="dark"] .empty-state{color:var(--text-subtle)}
html[data-theme="dark"] .empty-state strong,
html[data-theme="dark"] .content-empty strong{color:var(--text)}
html[data-theme="dark"] .close-button{background:var(--surface-elevated);color:var(--text-subtle)}
html[data-theme="dark"] .text-button{color:var(--accent-text)}
html[data-theme="dark"] .danger-zone>strong,
html[data-theme="dark"] .danger-text,
html[data-theme="dark"] .danger-outline,
html[data-theme="dark"] .form-error,
html[data-theme="dark"] .error{color:#ffb0b5!important}
html[data-theme="dark"] .search-hit-flash .bubble{animation:search-hit-dark 2.1s ease}
@keyframes search-hit-dark{0%,35%{box-shadow:0 0 0 4px #f2bb3f66;background:#4a3d1e}100%{box-shadow:0 1px 2px #0006}}

/* v66 unified composer and logical-message attachments */
.staged-attachment-tray{grid-column:1/-1;display:flex;gap:7px;overflow-x:auto;padding:1px 0 3px;scrollbar-width:thin}.staged-attachment{display:grid;grid-template-columns:34px minmax(90px,170px) 24px;align-items:center;gap:6px;flex:0 0 auto;padding:5px 6px;border:1px solid var(--line);border-radius:8px;background:#f6f8fa}.staged-attachment-preview{display:grid;place-items:center;width:34px;height:34px;border-radius:6px;overflow:hidden;background:#e1ecf8;color:#1769e0}.staged-attachment-preview img{width:100%;height:100%;object-fit:cover}.staged-attachment-copy{display:flex;min-width:0;flex-direction:column}.staged-attachment-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.staged-attachment-copy small{color:var(--muted);font-size:9.5px}.remove-staged{display:grid;place-items:center;width:24px;height:24px;border:0;border-radius:50%;background:transparent;color:#687785}.remove-staged:hover{background:#e4e9ef}.remove-staged .ui-icon{width:14px;height:14px}.message-attachments{display:grid;gap:6px;margin-top:7px}.message-attachments .file-card{padding:6px;border-radius:7px;background:#f5f7fa}.message-attachments .media-message{border-radius:7px}.bubble>p+.message-attachments{padding-top:2px;border-top:1px solid #dfe5eb}.message-row.own .message-attachments .file-card{background:#e9f2ff}
.content-parent-link{align-self:flex-start;margin-top:2px;padding:0;border:0;background:transparent;color:var(--blue);font-size:10px}
html[data-theme="dark"] .staged-attachment{background:var(--surface-subtle);color:var(--text)}html[data-theme="dark"] .staged-attachment-preview,html[data-theme="dark"] .message-attachments .file-card{background:var(--surface-elevated)}html[data-theme="dark"] .remove-staged{color:var(--text-subtle)}html[data-theme="dark"] .remove-staged:hover{background:var(--surface-hover)}html[data-theme="dark"] .bubble>p+.message-attachments{border-color:var(--line)}
@media(max-width:640px){.staged-attachment{grid-template-columns:32px minmax(80px,145px) 24px}.staged-attachment-preview{width:32px;height:32px}.message-attachments .media-message,.message-attachments .media-message img,.message-attachments .video-thumb{max-width:min(230px,70vw)}}

/* v68 group mention picker and deterministic mention rendering */
.composer{position:relative}.mention-picker{position:absolute;z-index:30;left:42px;bottom:calc(100% + 6px);width:min(360px,calc(100vw - 34px));max-height:230px;overflow:auto;padding:5px;border:1px solid var(--line);border-radius:10px;background:var(--surface);box-shadow:0 8px 26px #14273b30}.mention-option{display:grid;grid-template-columns:34px minmax(0,1fr);align-items:center;gap:8px;width:100%;padding:6px;border:0;border-radius:7px;background:transparent;color:var(--text);text-align:left}.mention-option.active,.mention-option:hover{background:var(--surface-hover)}.mention-option .persona-avatar{width:32px;height:32px}.mention-option span:last-child{display:flex;min-width:0;flex-direction:column}.mention-option strong,.mention-option small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mention-option small{color:var(--muted);font-size:10px}.message-mention{border-radius:4px;background:#dcecff;color:#145da8;padding:0 2px;font-weight:650}.mention-me-indicator{border-radius:999px;background:#e8f2ff;color:#1769e0;padding:1px 6px;font-size:9px;font-weight:700}.message-row.mentioned-me .bubble{box-shadow:0 0 0 2px #73aaf0}.mention-empty{padding:9px;color:var(--muted);font-size:11px}html[data-theme="dark"] .mention-picker{background:var(--surface-elevated)}html[data-theme="dark"] .message-mention{background:#234f7c;color:#e9f3ff}html[data-theme="dark"] .mention-me-indicator{background:#173c68;color:#b9d8ff}
