/* Final geometry: fewer boxes, calmer hierarchy, one material per layer. */
:root{--ui-radius:16px}
html .shell{max-width:1420px;grid-template-columns:272px minmax(0,1fr);border-radius:22px;margin:20px auto;height:calc(100dvh - 40px)}
html .sidebar{padding:24px 16px 16px;background:var(--t-glass);box-shadow:none;border-right:1px solid var(--t-border)}
html .brand{gap:11px;padding-inline:8px;margin-bottom:24px}html .brand b{font-size:15px;font-weight:600;letter-spacing:.1px}html .brand small{font-size:8px;letter-spacing:1.4px;opacity:.72}
.brand-logo{display:block;width:39px;height:39px;flex:none;border-radius:12px}.intro .brand-logo{width:44px;height:44px}.admin-brand .brand-logo{width:38px;height:38px}
html .identity{background:transparent;border:0;padding:8px;margin-bottom:20px}html .identity .avatar{width:39px;height:39px;border-radius:13px}html .identity-copy strong{font-size:13px}.identity-copy small{font-size:10px}
html .section-label,html .online-label{font-size:10px;letter-spacing:1px;margin-top:12px}html .private-hint{display:none}html .room-nav{margin-bottom:10px}html :is(.room-nav,.group-item,.user){padding:10px;border-radius:12px;min-height:51px}html :is(.room-nav.active,.group-item.active,.user.active){box-shadow:none;border:1px solid var(--t-border)}
html .mesh-card{background:transparent;border:0;border-top:1px solid var(--t-border);border-radius:0;margin-top:14px;padding:16px 8px 0;opacity:.8}html .mesh-title strong{font-size:10px;font-weight:500}html .mesh-stat{font-size:10px}
html .topbar{height:80px;flex-basis:80px;padding:16px 28px;box-shadow:none;border-bottom:1px solid var(--t-border)}html .room-icon{width:36px;height:36px;border-radius:12px;font-weight:500}html .topbar h1{font-size:16px;font-weight:600}html .topbar p{margin-top:5px;font-size:10px}html .top-actions button{background:transparent;border-color:transparent;box-shadow:none}
html .messages{padding:22px 36px}html .messages .welcome-card{padding:25px 12px 24px;margin:0 auto 14px}html .welcome-card h2{font-size:18px;font-weight:500;letter-spacing:0}html .welcome-symbol{background:transparent;border:0;box-shadow:none;width:44px;height:44px;margin-bottom:15px}html .welcome-logo{display:block;width:44px;height:44px;border-radius:14px}html .day-divider{font-size:10px;opacity:.7}html .message{margin-block:19px;gap:11px}html .bubble{font-size:14px;line-height:1.65;box-shadow:none;border-color:transparent;padding:11px 15px}html .message.mine .bubble{border-color:transparent;box-shadow:none}html .msg-meta{font-size:10px;margin-bottom:6px}html .file-card{border:1px solid var(--t-border);box-shadow:none}
html .composer{margin:0 24px 22px;min-height:64px;padding:9px;border-radius:18px;box-shadow:0 5px 22px var(--t-shadow)}html .composer .tool-btn{background:transparent}html .send-btn{border-radius:12px;box-shadow:none}html .transfer-tray{background:transparent;border:0;padding:4px 26px}html .transfer{padding:9px 12px;border-radius:11px;margin-bottom:7px}
html .form-card{padding:36px;border-radius:22px;box-shadow:0 18px 60px var(--t-shadow)}html .intro h1{font-weight:500;line-height:1.5;font-size:clamp(32px,3.8vw,48px)}html .theme-control{background:transparent;border:0;border-top:1px solid var(--t-border);border-radius:0;padding:16px 0 0}html .theme-control select{font-size:12px}
html dialog{max-height:calc(var(--visible-height,100dvh) - 32px);overflow:auto;overscroll-behavior:contain;border-radius:22px;scrollbar-width:thin}html dialog form{padding:28px}html dialog .close,html dialog .dialog-close{display:grid;place-items:center;width:36px;height:36px;min-height:36px;min-width:36px;border-radius:50%;font-size:23px;background:var(--t-soft);color:var(--t-muted);z-index:2}html dialog .close{right:14px;top:14px}html .profile-editor-head{padding-right:26px}html .profile-editor-head h2{font-size:20px}html .profile-editor-head p{font-size:11px}html .dialog-actions{padding-top:16px;margin-top:12px;border-top:1px solid var(--t-border);gap:9px}html .dialog-actions button{min-height:42px;padding:10px 17px}html .inline-error{color:var(--t-danger);min-height:18px;margin:12px 0 0;font-size:12px}
html dialog.is-closing{pointer-events:none}html dialog.is-closing::backdrop{opacity:0}html dialog[open]{animation:dialog-arrive .3s var(--ease)}@keyframes dialog-arrive{from{opacity:0;transform:translateY(14px) scale(.975)}to{opacity:1;transform:none}}
.drawer-backdrop{position:fixed;inset:0;z-index:30;border:0;border-radius:0;padding:0;background:#090f1880;backdrop-filter:blur(3px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .3s ease,visibility .3s;box-shadow:none!important;transform:none!important;filter:none!important}.drawer-backdrop.visible{opacity:1;visibility:visible;pointer-events:auto}
html body.sidebar-open:after{display:none}html .admin-sidebar{box-shadow:none}html .admin-content{padding:28px}html .panel{border-radius:15px;box-shadow:none}html .stat-card{border-radius:15px;box-shadow:none;padding:22px}html .stat-card b{font-size:30px;font-weight:500}.admin-sidebar nav button{min-height:46px}html .header-actions .theme-control{border:0;padding:0}
@media(max-width:900px){html .shell{margin:0;height:100dvh;border-radius:0;grid-template-columns:245px minmax(0,1fr)}html .admin-sidebar{z-index:31;touch-action:pan-y pinch-zoom;width:min(280px,84vw);transition:transform .38s var(--ease);background:var(--t-panel)}html .admin-main>header{height:auto;min-height:82px;gap:12px}html .admin-main .header-actions{justify-content:flex-end}html .admin-content{padding:16px}}
@media(max-width:700px){html .shell{display:block;height:var(--visible-height,100dvh);margin:0;border:0;border-radius:0}html .chat{height:100%;min-height:0}html .sidebar{inset:0 auto 0 0;height:100dvh;width:min(300px,84vw);z-index:31;background:var(--t-panel);touch-action:pan-y pinch-zoom;transition:transform .38s var(--ease);padding-top:max(22px,env(safe-area-inset-top));box-shadow:12px 0 60px #0004}html .brand{margin-bottom:18px}html .drawer-visible{overflow:hidden}html .topbar{padding:10px 12px;padding-top:max(10px,env(safe-area-inset-top));height:auto;flex-basis:72px;min-height:72px;gap:5px}html .topbar h1{font-size:15px}html .top-actions button{min-width:40px;min-height:44px}html .mobile-menu{margin-right:0;min-width:40px}html .back-room{min-width:40px}.top-actions{gap:0}html .messages{padding:14px 14px 18px}html .message{max-width:96%;margin-block:16px}html .bubble{font-size:14px}html .composer{margin:0 8px max(8px,env(safe-area-inset-bottom));padding:7px;min-height:60px;gap:2px;border-radius:17px}html .composer textarea{font-size:16px;padding:9px 5px}html .composer .tool-btn{min-width:35px;width:35px;min-height:44px}html .send-btn{min-width:40px;width:40px;min-height:42px}html .emoji-panel{max-width:calc(100vw - 32px);max-height:55dvh;overflow:auto;left:6px;bottom:68px}html dialog{max-width:calc(100vw - 20px);max-height:calc(var(--visible-height,100dvh) - 24px);border-radius:20px}html dialog form{padding:24px 20px}html dialog input,html dialog textarea,html dialog select{font-size:16px}html .member-picker{max-height:29dvh}html .field-grid{grid-template-columns:1fr}html .form-card{padding:27px 23px}html .intro{padding:25px}html .transfer-tray{padding-inline:12px}html .file-card{width:min(70vw,340px)}html .brand-logo{width:36px;height:36px}}
@media(prefers-reduced-motion:reduce){html dialog[open]{animation:none}.drawer-backdrop{transition:none}}
.control-icon{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none;flex:none}.top-actions button,.send-btn,.back-room,.mobile-menu,.close-sidebar,.mobile-admin-menu{display:inline-flex;align-items:center;justify-content:center}.close-sidebar,.mobile-menu,.mobile-admin-menu{display:none}.create-group-btn .control-icon{width:17px;height:17px}.emoji-panel[data-closing]{pointer-events:none}.theme-control select{cursor:pointer}html .profile-avatar{border:1px solid var(--t-border);background:var(--t-soft);color:var(--t-accent)}
@media(max-width:900px){.mobile-admin-menu{display:inline-flex}}@media(max-width:700px){.mobile-menu,.close-sidebar{display:inline-flex}.close-sidebar{margin-left:auto;width:36px;height:36px}.tool-btn input{display:none}}
/* Transfer feedback belongs to the attachment, never the footer. */
[data-progress-file],.image-wrap,.video-wrap{position:relative}.sticker-message:has(.file-progress),.image-wrap:has(.file-progress){min-height:110px}.file-progress{position:absolute;right:12px;top:12px;z-index:3;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--t-glass);backdrop-filter:blur(12px);box-shadow:0 2px 12px #0002;color:var(--t-accent);cursor:default}.image-wrap>.file-progress,.video-wrap>.file-progress,.sticker-message>.file-progress{left:50%;top:50%;right:auto;transform:translate(-50%,-50%)}.file-progress svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);fill:none;stroke-width:2.5}.ring-track{stroke:var(--t-border)}.ring-value{stroke:currentColor;stroke-linecap:round;stroke-dasharray:100;transition:stroke-dashoffset .2s linear}.ring-text{font-size:9px;font-weight:600}.file-progress.indeterminate svg{animation:ring-spin 1s linear infinite}.file-progress.indeterminate .ring-value{stroke-dasharray:25 75;stroke-dashoffset:0!important}.file-progress.failed{color:var(--t-danger);cursor:pointer}.file-progress.failed .ring-value{stroke-dashoffset:0!important}.file-progress.failed .ring-text{font-size:10px}.file-card:has(>.file-progress) .file-actions{margin-right:48px}#transferTray,.transfer-tray{display:none!important}@keyframes ring-spin{to{transform:rotate(270deg)}}@media(prefers-reduced-motion:reduce){.file-progress.indeterminate svg{animation:none}.ring-value{transition:none}}html[data-motion=off] .file-progress.indeterminate svg{animation:none}

/* Media dimensions belong to the card's content box, never the viewport. */
html .message>div:last-child{min-width:0;max-width:100%}
html .message .file-card{box-sizing:border-box;max-width:100%;min-width:0;overflow:hidden;background:var(--t-panel);color:var(--t-text)}
html .file-card .video-wrap,html .file-card .image-wrap{width:100%;max-width:100%;min-width:0;overflow:hidden;border-radius:12px}
html .file-card .video-inline{box-sizing:border-box;width:100%;max-width:100%;min-width:0;height:auto;max-height:320px;object-fit:contain;background:#111;border-radius:inherit}
html .file-card .image-inline{max-width:100%;height:auto;object-fit:contain}
html .file-main{min-width:0}html .file-info{min-width:0}html .file-actions{flex-shrink:0}
html #previewContent video{display:block;width:100%;max-width:100%;max-height:65dvh;object-fit:contain}
@media(max-width:700px){html .message>div:last-child{max-width:calc(100% - 45px)}html .file-card{width:min(70vw,340px)}html .file-card .video-inline{width:100%;max-height:260px}html .file-card .file-actions{gap:4px}html .file-card .file-actions button{width:32px;min-width:32px}}

.widget-menu a{display:block;padding:11px 14px;margin:6px 8px;border:1px solid var(--t-border);border-radius:12px;background:var(--t-soft);color:var(--t-text);font-size:12px;text-decoration:none;transition:background .2s}.widget-menu a:hover{background:var(--t-hover)}
