*{box-sizing:border-box} :root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;color:#1c1e21;background:#f0f2f5;font-synthesis:none}body{margin:0;min-height:100vh}button,input,select{font:inherit}button{cursor:pointer;border:0}.hidden{display:none!important}.muted{color:#65676b}.small{font-size:13px}.tiny{font-size:11px}.grow{flex:1;min-width:0}.min-zero{min-width:0}.auth-shell{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(135deg,#e8f0ff,#f6f7fb)}.auth-card{width:min(430px,100%);background:#fff;border-radius:20px;padding:30px;box-shadow:0 12px 45px #1c2b4a18}.brand-mark{width:46px;height:46px;border-radius:15px;background:#0866ff;color:#fff;display:grid;place-items:center;font-size:27px}.auth-card h1{margin:12px 0 2px;font-size:28px}.tabs{display:flex;gap:8px;margin:22px 0 16px;border-bottom:1px solid #e4e6eb}.tab{background:none;padding:12px 16px;color:#65676b}.tab.active{color:#0866ff;border-bottom:3px solid #0866ff;font-weight:700}.form-stack{display:grid;gap:13px}.form-stack label,.field-label{display:grid;gap:6px;font-size:13px;font-weight:600}.form-stack input,.settings-body select,.details-panel input,.search-wrap input{width:100%;border:1px solid #ccd0d5;border-radius:10px;padding:12px;background:#fff;outline:none}.form-stack input:focus,.details-panel input:focus{border-color:#0866ff}.primary,.secondary,.google-button{padding:12px 16px;border-radius:10px;font-weight:700}.primary{background:#0866ff;color:#fff}.secondary{background:#e7f0ff;color:#0866ff}.google-button{margin-top:12px;width:100%;background:#f0f2f5;color:#252525}.text-button{background:none;color:#0866ff}.message{font-size:13px;min-height:18px;color:#c0392b}.app{height:100dvh;display:grid;grid-template-columns:320px minmax(0,1fr);background:#fff;overflow:hidden}.sidebar{border-right:1px solid #e4e6eb;display:flex;flex-direction:column;min-height:0}.sidebar-head,.chat-head,.details-head{height:72px;display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid #e4e6eb}.brand-inline{font-size:20px;font-weight:800;color:#0866ff}.icon-button{width:38px;height:38px;border-radius:50%;background:#f0f2f5;color:#333;font-size:20px;flex:none}.search-wrap{padding:12px}.search-wrap input{background:#f0f2f5;border:0;border-radius:22px}.section-label{font-size:12px;font-weight:700;color:#65676b;padding:10px 16px 5px}.people-list,.conversation-list{overflow:auto}.person-row,.conversation-row{display:flex;align-items:center;gap:11px;padding:10px 14px;cursor:pointer}.person-row:hover,.conversation-row:hover{background:#f5f6f7}.avatar{width:42px;height:42px;border-radius:50%;object-fit:cover;background:#dbe7ff;flex:none}.avatar.large{width:86px;height:86px}.person-meta,.conversation-meta{min-width:0;flex:1}.person-meta strong,.conversation-meta strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px}.presence-line{font-size:12px;color:#65676b;margin-top:3px}.presence-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#31a24c;margin-right:5px}.presence-dot.off{background:#aeb3b8}.sidebar-foot{margin-top:auto;border-top:1px solid #e4e6eb;padding:12px;display:flex;align-items:center;gap:10px}.sidebar-foot .grow{display:grid}.chat-panel{min-width:0;display:flex;flex-direction:column}.empty-state{margin:auto;text-align:center;padding:25px}.empty-icon{font-size:55px;color:#b8c6df}.chat-view{height:100%;display:flex;flex-direction:column;min-height:0}.chat-head{flex:none}.chat-head strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.back-button{display:none}.messages{flex:1;overflow:auto;padding:22px;display:flex;flex-direction:column;gap:9px;background:#fff}.bubble{max-width:min(72%,520px);padding:10px 13px;border-radius:18px;background:#f0f2f5;overflow-wrap:anywhere;line-height:1.4}.bubble.mine{align-self:flex-end;background:#0866ff;color:#fff}.bubble .time{display:block;font-size:10px;opacity:.65;margin-top:4px}.bubble img,.bubble video{display:block;max-width:100%;max-height:330px;border-radius:12px}.composer{display:flex;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid #e4e6eb}.composer input[type=text],.composer>input{flex:1;min-width:0;border:0;background:#f0f2f5;border-radius:22px;padding:13px 16px;outline:none}.attach-button{font-size:27px;color:#0866ff;cursor:pointer}.send-button{width:42px;height:42px;border-radius:50%;background:#0866ff;color:white;font-size:19px}.details-panel{display:none;border-left:1px solid #e4e6eb;padding:0 18px 24px;flex-direction:column;align-items:center;gap:12px;overflow:auto;background:#fff}.app.details-visible{grid-template-columns:320px minmax(0,1fr) 300px}.app.details-visible .details-panel{display:flex}.details-head{width:calc(100% + 32px);justify-content:space-between;margin-bottom:16px}.details-panel h3{margin:0}.details-panel .field-label{align-self:stretch;margin-top:14px}.details-panel input,.details-panel .secondary{width:100%}.settings-dialog{border:0;border-radius:18px;width:min(450px,calc(100% - 28px));padding:0;box-shadow:0 15px 60px #0003}.settings-dialog::backdrop{background:#10182888}.dialog-head{display:flex;justify-content:space-between;align-items:center;padding:12px 18px;border-bottom:1px solid #e4e6eb}.dialog-head h2{font-size:19px}.settings-body{padding:20px;display:grid;gap:12px}.settings-body select{margin-top:7px}.setting-row{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-top:12px}.setting-row p{margin:5px 0}.setting-row input{width:20px;height:20px;accent-color:#0866ff}.details-panel .muted{text-align:center}@media(max-width:900px){.app,.app.details-visible{grid-template-columns:290px minmax(0,1fr)}.app.details-visible .details-panel{position:absolute;right:0;top:0;bottom:0;width:min(320px,88vw);z-index:5;box-shadow:-12px 0 36px #172b4d20}}@media(max-width:620px){.app{display:block;position:relative}.sidebar{height:100dvh;width:100%;border:0}.chat-panel{position:absolute;inset:0;background:#fff;display:none}.app.chat-open .chat-panel{display:flex}.app.chat-open .sidebar{display:none}.back-button{display:block}.messages{padding:15px 12px}.bubble{max-width:84%}.auth-card{padding:23px}.details-panel{position:absolute;inset:0;background:#fff;z-index:6;display:none;width:100%;box-shadow:none}.app.details-open.details-visible .details-panel{display:flex}.chat-head{padding:10px}.composer{padding:9px 10px;padding-bottom:max(9px,env(safe-area-inset-bottom))}}
.avatar-upload-label input[type=file]{padding:9px;background:#f7f8fa;border:1px dashed #b8c6df}
.avatar-upload-label small{font-weight:400;font-size:11px}
.avatar-preview{width:76px;height:76px;border-radius:50%;object-fit:cover;border:2px solid #dbe7ff}

.profile-edit{padding:12px 0 16px;margin-bottom:14px;border-bottom:1px solid #e7eaf0}
.profile-edit-head{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.profile-edit input[type=file]{display:block;width:100%;margin:8px 0;padding:9px;border:1px dashed #b8c6df;border-radius:10px}
button:disabled{opacity:.65;cursor:wait}

/* Refined desktop messaging layout */
.sidebar{background:#fff}
.sidebar-head{height:76px}
.search-wrap input{height:44px}
.person-row,.conversation-row{width:100%;border:0;text-align:left;background:transparent;border-radius:12px;margin:2px 6px;padding:11px 10px;width:calc(100% - 12px)}
.person-row:hover,.conversation-row:hover{background:#f0f2f5}
.person-row:focus-visible,.conversation-row:focus-visible,button:focus-visible{outline:2px solid #0866ff;outline-offset:2px}
.chat-panel{background:#fff;min-height:0}
.empty-state{max-width:520px}
.chat-head{height:76px;background:#fff}
.details-head{height:64px;flex:none}
.details-panel .avatar.large{margin-top:14px}
.details-panel h3{font-size:17px}
.details-panel .field-label{margin-top:18px}
.details-panel .secondary{margin-top:2px}
.avatar-upload-label input[type=file]{width:100%;font-size:12px}
@media(min-width:901px){
  .app.details-visible .details-panel{width:300px}
  .app.details-visible{grid-template-columns:320px minmax(0,1fr) 300px}
}

/* Professional chat feature layer */
.details-panel{display:none;min-width:0}.details-tabs{display:flex;gap:3px;overflow:auto;width:100%;padding:0 0 10px;border-bottom:1px solid #e4e6eb}.detail-tab{white-space:nowrap;background:transparent;padding:8px;border-radius:9px;color:#65676b;font-size:12px}.detail-tab.active{background:#e7f0ff;color:#0866ff;font-weight:700}.detail-section{display:none;width:100%;gap:10px}.detail-section.active{display:flex;flex-direction:column}.detail-actions{display:grid;gap:8px;width:100%;margin:14px 0}.danger-button{width:100%;padding:10px;border-radius:10px;background:#ffe8e8;color:#c62828;font-weight:700}.danger-button.outline{background:transparent;border:1px solid #e4a0a0}.wallpaper-options{display:grid;grid-template-columns:1fr 1fr;gap:7px}.wallpaper-options button{padding:9px;border:1px solid #d9dee8;border-radius:9px;background:#fff;font-size:12px}.detail-list{display:grid;gap:8px;width:100%}.detail-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px;border:1px solid #e7eaf0;border-radius:10px;font-size:12px}.detail-item button{background:#e7f0ff;color:#0866ff;border-radius:8px;padding:7px}.shared-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%}.shared-file{min-width:0;min-height:70px;padding:8px;border:1px solid #e7eaf0;border-radius:10px;color:inherit;text-decoration:none;overflow-wrap:anywhere;font-size:12px}.shared-file img{width:100%;height:90px;object-fit:cover;border-radius:7px}.composer-tool{width:38px;height:38px;border-radius:50%;background:#eef3ff;color:#0866ff;font-size:21px}.sticker-picker{position:absolute;bottom:75px;left:330px;width:min(330px,calc(100vw - 30px));padding:12px;background:#fff;border:1px solid #e4e6eb;border-radius:16px;box-shadow:0 10px 36px #15294b24;z-index:8}.sticker-picker-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.sticker-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:4px}.sticker-grid button{background:transparent;border-radius:8px;font-size:23px;padding:5px}.message-wrap{position:relative;display:flex;flex-direction:column;align-items:flex-start;max-width:min(75%,560px)}.message-wrap.mine{align-self:flex-end;align-items:flex-end}.message-wrap .bubble{max-width:100%}.message-actions{display:flex;gap:4px;opacity:0}.message-wrap:hover .message-actions,.message-actions:focus-within{opacity:1}.message-actions button{background:#f0f2f5;border-radius:50%;width:28px;height:28px}.reaction-strip{display:flex;gap:4px;flex-wrap:wrap}.reaction-chip{border:1px solid #dbe4f5;border-radius:15px;background:#fff;padding:3px 7px;font-size:12px}.reaction-menu{display:flex;gap:4px;padding:5px;background:#fff;border:1px solid #e4e6eb;border-radius:22px;box-shadow:0 5px 18px #0002;z-index:9}.reaction-menu button{background:transparent;font-size:19px;padding:3px}.sticker-bubble{font-size:52px!important;background:transparent!important;padding:3px!important}.messages[data-wallpaper="lavender"]{background:#f2edff}.messages[data-wallpaper="mint"]{background:#eaf8f2}.messages[data-wallpaper="sunset"]{background:linear-gradient(135deg,#fff0e8,#f8eaff)}
:root[data-theme="dark"]{color-scheme:dark;background:#18191a;color:#e4e6eb}:root[data-theme="dark"] body,:root[data-theme="dark"] .app,:root[data-theme="dark"] .sidebar,:root[data-theme="dark"] .chat-panel,:root[data-theme="dark"] .details-panel,:root[data-theme="dark"] .chat-head,:root[data-theme="dark"] .messages{background:#18191a;color:#e4e6eb}:root[data-theme="dark"] .sidebar,:root[data-theme="dark"] .chat-head,:root[data-theme="dark"] .composer,:root[data-theme="dark"] .details-panel{border-color:#3e4042}:root[data-theme="dark"] .person-row:hover,:root[data-theme="dark"] .conversation-row:hover,:root[data-theme="dark"] .icon-button,:root[data-theme="dark"] .bubble:not(.mine){background:#303236;color:#e4e6eb}:root[data-theme="dark"] .composer input,:root[data-theme="dark"] .search-wrap input,:root[data-theme="dark"] .details-panel input,:root[data-theme="dark"] .settings-body select{background:#303236;color:#e4e6eb;border-color:#4b4d50}:root[data-theme="dark"] .sticker-picker,:root[data-theme="dark"] .reaction-menu,:root[data-theme="dark"] .shared-file,:root[data-theme="dark"] .detail-item{background:#242526;color:#e4e6eb;border-color:#3e4042}
@media(max-width:620px){.sticker-picker{left:10px;bottom:72px}.message-wrap{max-width:88%}.details-tabs{position:sticky;top:0;background:inherit;z-index:2}}

.conversation-kind{font-size:14px;color:#8b95a5;padding:0 5px}.detail-section a{color:#0866ff;overflow-wrap:anywhere;font-size:12px;padding:7px 0}.details-panel .details-tabs{flex:none}.details-panel .details-section{min-height:0}:root[data-theme="dark"] .settings-dialog{background:#242526;color:#e4e6eb}:root[data-theme="dark"] .dialog-head{border-color:#3e4042}:root[data-theme="dark"] .wallpaper-options button{background:#303236;color:#e4e6eb;border-color:#4b4d50}
@media(max-width:900px){.message-actions{opacity:1}}
:root[data-theme="dark"] .detail-tab{color:#b0b3b8}:root[data-theme="dark"] .detail-tab.active{background:#263b5e;color:#8ab4ff}:root[data-theme="dark"] .detail-item button,:root[data-theme="dark"] .reaction-chip{background:#303236;color:#e4e6eb;border-color:#4b4d50}

/* Chip Tom Message polish: keep floating controls inside their owning viewport */
.messages{overflow-x:hidden;overflow-y:auto;position:relative}
.message-wrap{min-width:0;max-width:min(78%,560px);overflow:visible}
.message-wrap .bubble{min-width:0;overflow-wrap:anywhere;word-break:break-word}
.message-actions{max-width:100%;flex-wrap:wrap;align-self:flex-end}
.reaction-menu{position:absolute;right:0;bottom:100%;max-width:min(260px,calc(100vw - 32px));flex-wrap:wrap;overflow:hidden}
.message-link{font-weight:700;text-decoration:underline;overflow-wrap:anywhere}
.blocked-notice{padding:12px 16px;text-align:center;background:#fff4e5;color:#8a4b08;border-top:1px solid #f0d7b2;font-size:13px}
.blocked-notice.hidden{display:none}
.blocked-settings{border-top:1px solid var(--border,#e5e7eb);padding-top:14px;margin-top:14px}
.blocked-settings h3{font-size:14px;margin:0 0 10px}
.shared-file img{max-width:100%;height:auto;object-fit:cover}

/* UI overflow and emoji glyph fallback */
.reaction-menu,.sticker-panel,.emoji-panel{box-sizing:border-box;max-width:min( min(92vw, 420px), calc(100vw - 24px));max-height:min(55vh,420px);overflow:auto;z-index:1000}
.reaction-menu button,.sticker-panel button,.emoji-panel button{font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;line-height:1.35;min-width:32px;min-height:32px}
.unread-dot{display:inline-block;flex:0 0 9px;width:9px;height:9px;border-radius:50%;background:#1685ff;margin-left:auto;align-self:center}
.message-actions,.reaction-strip{max-width:100%;overflow-x:auto;overflow-y:hidden}

/* Reaction controls: always visible on touch devices and desktop; never hide behind hover-only UI. */
.message-actions { opacity: 1 !important; visibility: visible !important; display: flex; align-items: center; }
.message-actions button { flex: 0 0 30px; min-width: 30px; min-height: 30px; cursor: pointer; }
.message-react-button { display: inline-flex; align-items: center; justify-content: center; }
.reaction-strip { display: flex; flex-wrap: wrap; gap: 5px; max-width: 100%; min-height: 0; margin-top: 3px; }
.reaction-chip { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; color: inherit; background: var(--surface, #292b2f); border-color: rgba(128,128,128,.35); }
.reaction-chip.mine-reaction { border-color: #1877f2; box-shadow: 0 0 0 1px #1877f2 inset; }
.reaction-menu { max-width: calc(100vw - 16px); flex-wrap: wrap; position: fixed; z-index: 9999 !important; }
.reaction-menu button { min-width: 34px; min-height: 34px; cursor: pointer; }


/* Reaction/action layout hardening */
.message-wrap {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: fit-content;
  max-width: min(75%, 560px);
  min-width: 0;
  align-self: flex-start;
  align-items: flex-start;
  overflow: visible;
}
.message-wrap.mine {
  align-self: flex-end;
  align-items: flex-end;
}
.message-wrap > .bubble {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.message-wrap > .message-actions {
  display: flex;
  flex: 0 0 auto;
  align-self: flex-start;
  justify-content: flex-start;
  align-items: center;
  gap: 5px;
  width: auto;
  max-width: 100%;
  min-height: 28px;
  margin-top: 3px;
  opacity: 1;
  position: static;
}
.message-wrap.mine > .message-actions {
  align-self: flex-end;
}
.message-wrap > .message-actions button {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  line-height: 1;
}
.message-wrap > .reaction-strip {
  display: flex;
  align-self: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin-top: 2px;
}
.message-wrap.mine > .reaction-strip {
  align-self: flex-end;
}
.reaction-menu {
  box-sizing: border-box;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(180px, calc(100vh - 24px));
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px;
  border-radius: 16px;
}
.reaction-menu button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
