*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:Arial,sans-serif;background:#f3eee8;color:#3e3027}
body{display:flex;justify-content:center}
button,input{font:inherit}
button{cursor:pointer}
#mychat{width:100%;max-width:1100px;min-height:100vh;background:#faf8f5;display:flex;flex-direction:column}
#welcomeView{min-height:100vh;display:flex;flex-direction:column}
.chat-header{height:76px;padding:10px 18px;background:#6b4f3a;color:#fff;display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 10px rgba(0,0,0,.15)}
.brand{display:flex;align-items:center;gap:12px}
.brand img{width:50px;height:50px;border-radius:14px;object-fit:cover}
.brand h1{margin:0;font-size:22px}
.brand span{display:block;margin-top:3px;font-size:12px;opacity:.8}
#settingsBtn{width:44px;height:44px;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;font-size:21px}
.chat-main{flex:1;padding:20px}
.search-box{height:48px;display:flex;align-items:center;gap:10px;padding:0 15px;background:#fff;border:1px solid #ded5cc;border-radius:15px;box-shadow:0 2px 8px rgba(0,0,0,.05)}
.search-box span{font-size:18px}
.search-box input{width:100%;border:0;outline:0;background:transparent;font-size:16px;color:#3e3027}
.empty-chat{min-height:500px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:30px}
.empty-chat img{width:105px;height:105px;border-radius:28px;object-fit:cover;box-shadow:0 8px 25px rgba(70,45,30,.18)}
.empty-chat h2{margin:22px 0 8px;font-size:25px}
.empty-chat p{margin:0 0 25px;color:#806f62}
#authArea{width:100%;max-width:420px}
#loginMethods{display:flex;flex-direction:column;gap:10px}
#loginMethods button{width:100%;height:44px;border:0;border-radius:12px;font-size:14px;font-weight:600}
#googleLoginBtn{background:#fff;color:#3e3027;border:1px solid #ded5cc!important}
.user-info{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#fff;border:1px solid #ded5cc;border-radius:15px}
.user-info img{width:42px;height:42px;border-radius:50%;object-fit:cover}
.user-info div{flex:1;min-width:0;text-align:left}
.user-info strong,.user-info span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-info strong{font-size:14px}
.user-info span{margin-top:3px;font-size:12px;color:#806f62}
#logoutBtn{border:0;border-radius:0;padding:8px 10px;background:transparent;color:#6b4f3a;font-size:13px;font-weight:700;cursor:pointer;flex-shrink:0;width:auto;white-space:nowrap;line-height:1.2;box-shadow:none}
#logoutBtn:hover{background:transparent;color:#8b6247}
.chat-footer{padding:12px 18px;display:flex;justify-content:space-between;border-top:1px solid #e5ddd5;color:#9a8b80;font-size:12px}
#chatView{width:100%;height:100vh;min-height:620px;display:flex;overflow:hidden;background:#f7f3ef}
.chat-sidebar{width:320px;flex:none;background:#fff;border-right:1px solid #e2d9d1;display:flex;flex-direction:column}
.sidebar-header{height:72px;padding:10px 14px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #eee7e1}
.sidebar-title{display:flex;align-items:center;gap:10px;font-size:17px}
.sidebar-title img{width:42px;height:42px;border-radius:12px}
.sidebar-header button,.chat-panel-header>button{width:40px;height:40px;border:0;border-radius:50%;background:#f3eee8;color:#6b4f3a;font-size:19px}

#chatQrScanBtn{display:flex;align-items:center;justify-content:center;flex:none;width:40px;height:40px;padding:0}

.sidebar-search{margin:12px;height:44px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#f5f1ed;border-radius:12px}
.sidebar-search input{width:100%;border:0;outline:0;background:transparent;color:#3e3027}
.conversation-list{flex:1;overflow:auto;padding:4px 8px}
.conversation-empty{height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:25px;color:#806f62}
.conversation-empty div{width:58px;height:58px;display:flex;align-items:center;justify-content:center;margin-bottom:14px;border-radius:18px;background:#f3eee8;font-size:27px}
.conversation-empty strong{font-size:14px;color:#5b493d}
.conversation-empty span{max-width:230px;margin-top:7px;font-size:12px;line-height:1.5}
.chat-panel{min-width:0;flex:1;display:flex;flex-direction:column;background:#faf8f5}
.chat-panel-header{height:72px;flex:none;padding:10px 14px;display:flex;align-items:center;gap:10px;background:#fff;border-bottom:1px solid #e2d9d1}
.chat-panel-header #mobileBackBtn{display:none}
.chat-person{flex:1;display:flex;align-items:center;gap:10px;min-width:0}
.chat-avatar{width:44px;height:44px;flex:none;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#6b4f3a;color:#fff;font-size:20px}
.chat-person strong,.chat-person span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-person strong{font-size:15px}
.chat-person span{margin-top:3px;font-size:12px;color:#806f62}
.chat-messages{flex:1;min-height:0;overflow:auto;padding:25px}
.chat-placeholder{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:#806f62}
.chat-placeholder-icon{width:72px;height:72px;display:flex;align-items:center;justify-content:center;border-radius:24px;background:#eee5dc;font-size:32px}
.chat-placeholder h2{margin:18px 0 7px;color:#5b493d;font-size:19px}
.chat-placeholder p{margin:0;font-size:13px}
.message-input{position:relative;min-height:66px;padding:10px 1px;display:flex;align-items:center;gap:0;background:#fff;border-top:1px solid #e2d9d1}
#voiceRecordBtn{width:28px;height:32px;flex-shrink:0;padding:0;border:0;border-radius:0;background:transparent;color:#6b4f3a;font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:none}
.message-input #attachFileBtn,
.message-input #attachImageBtn,
.message-input #cameraBtn,
.message-input #voiceRecordBtn,
.message-input #stickerBtn{
  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
}
.message-input input{flex:1;min-width:0;height:44px;padding:0 14px;border:1px solid #ded5cc;border-radius:22px;outline:0;background:#faf8f5;color:#3e3027}
.message-input input:focus{border-color:#b59b86;background:#fff}
.message-input .send-btn{background:#6b4f3a;color:#fff}
#voiceRecordBtn{width:42px;height:42px;flex-shrink:0;border:0;border-radius:50%;background:#f3eee8;color:#6b4f3a;font-size:21px;cursor:pointer;display:flex;align-items:center;justify-content:center}
#voiceRecordBtn:active{background:#ead7c5}
#voiceRecordBtn.recording{background:#dc3545;color:#fff;animation:voicePulse 1s infinite}
@keyframes voicePulse{50%{box-shadow:0 0 0 7px rgba(220,53,69,.18)}}
@media(max-width:700px){
  #mychat{max-width:none}
  #chatView{height:100vh;min-height:100vh}
  .chat-sidebar{width:100%;border-right:0}
  .chat-panel{display:none}
  #chatView.mobile-chat-open .chat-sidebar{display:none}
  #chatView.mobile-chat-open .chat-panel{display:flex}
  .chat-panel-header #mobileBackBtn{display:block}
  .chat-panel-header #chatSettingsBtn,.chat-panel-header #chatQrScanBtn{display:flex;align-items:center;justify-content:center;flex:none;width:40px;height:40px;padding:0}

}
@media(max-width:600px){
  .chat-header{height:68px;padding:8px 12px}
  .brand img{width:44px;height:44px}
  .brand h1{font-size:20px}
  .chat-main{padding:14px}
  .empty-chat{min-height:calc(100vh - 180px)}
  .empty-chat h2{font-size:22px}
  .chat-footer{padding:10px 14px}
  .message-input{padding:8px}
  .message-input button{width:40px;height:40px}
  .message-input input{height:42px}
}

@media (max-width:600px){
  .message-input{gap:0;padding-left:2px;padding-right:2px}
  .message-input #attachFileBtn,
  .message-input #attachImageBtn,
  .message-input #cameraBtn,
  .message-input #voiceRecordBtn{width:26px;height:32px;min-width:26px;padding:0;margin:0;font-size:15px}
  .message-input .attach-wrapper{flex:none;margin:0;padding:0}
}
.conversation-item{display:flex;align-items:center;gap:11px;padding:10px;border-radius:13px;cursor:pointer}
.conversation-item:hover{background:#f5f1ed}
.conversation-item img{width:46px;height:46px;flex:none;border-radius:50%;object-fit:cover;background:#eee5dc}
.conversation-info{min-width:0;flex:1}
.conversation-info strong,.conversation-info span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conversation-info strong{font-size:14px;color:#4b3b31}
.conversation-info span{margin-top:4px;font-size:11px;color:#918176}
.chat-avatar img{width:44px;height:44px;border-radius:50%;object-fit:cover}

.sidebar-title{display:flex;align-items:center;gap:10px;min-width:0}
.sidebar-title>img{width:42px;height:42px;flex:none;border-radius:50%;object-fit:cover;background:#eee5dc}
.account-details{display:flex;flex-direction:column;gap:5px;min-width:0}
.account-details strong{font-size:14px;color:#4b3b31;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}
.account-online{display:flex;align-items:center;gap:5px;font-size:11px;color:#168447}
.account-online span{width:8px;height:8px;border-radius:50%;background:#22c55e;flex:none}


.settings-overlay{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(30,24,20,.45)}
.settings-modal{width:100%;max-width:390px;padding:20px;background:#fff;border-radius:18px;box-shadow:0 18px 55px rgba(0,0,0,.2)}
.settings-modal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.settings-modal-header h2{margin:0;font-size:20px;color:#4b3b31}
.settings-modal-header button{width:36px;height:36px;border:0;border-radius:50%;background:#f5f1ed;color:#6b4f3a;font-size:17px;cursor:pointer}
.settings-option{display:flex;align-items:center;gap:12px;width:100%;padding:14px 8px;border:0;border-bottom:1px solid #eee8e2;background:#fff;text-align:left;font-size:14px;color:#4b3b31;cursor:pointer}
.settings-option:last-child{border-bottom:0}
.settings-option:hover{background:#faf7f4}
.settings-option-icon{width:34px;height:34px;display:flex;align-items:center;justify-content:center;border-radius:10px;background:#f5eee7;font-size:17px;flex:none}
.settings-chevron{margin-left:auto;font-size:23px;color:#a29488}
@media(max-width:480px){.settings-modal{max-width:100%;padding:17px;border-radius:16px}}

/* THÔNG TIN TÀI KHOẢN */
.settings-account-page{padding-top:8px;color:#4b3b31}
.settings-account-page #backSettingsBtn{display:inline-flex;align-items:center;gap:6px;margin:0 0 20px;padding:9px 13px;border:1px solid #e8ddd2;border-radius:10px;background:#faf6f1;color:#73543d;font-size:13px;font-weight:600;cursor:pointer;transition:background .2s,transform .2s}
.settings-account-page #backSettingsBtn:hover
.settings-account-profile{display:flex;flex-direction:column;align-items:center;padding:8px 12px 22px;text-align:center}
.settings-account-profile img{width:94px;height:94px;border:4px solid #fff;border-radius:50%;object-fit:cover;background:#eee5dc;box-shadow:0 0 0 2px #ead8c5,0 8px 22px rgba(91,62,39,.13)}
.settings-account-profile h3{margin:15px 0 0;color:#513a2b;font-size:20px;font-weight:700;line-height:1.4;overflow-wrap:anywhere}
.settings-account-info{padding:4px 15px;border:1px solid #eee3d8;border-radius:15px;background:linear-gradient(145deg,#fffdfb,#faf5ef)}
.settings-account-info p{display:flex;flex-direction:column;gap:6px;margin:0;padding:13px 2px;border-bottom:1px solid #eee6de;font-size:13px;line-height:1.6;overflow-wrap:anywhere}
.settings-account-info p:last-child
.settings-account-info p strong{color:#927254;font-size:11px;font-weight:700;letter-spacing:.5px;text-transform:uppercase}
.settings-account-info p{color:#49382d}
.settings-account-info p:last-child{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;word-break:break-all}
@media(max-width:480px){
.settings-account-profile img{width:86px;height:86px}
.settings-account-profile h3{font-size:18px}
.settings-account-info{padding:4px 12px}
}

/* Giới hạn chiều cao và cho phép cuộn Thông tin cá nhân */
.settings-account-page{
max-height:calc(100dvh - 150px);
overflow-y:auto;
overscroll-behavior:contain;
-webkit-overflow-scrolling:touch;
padding-bottom:20px;
}
@media(max-width:480px){
.settings-account-page{
max-height:calc(100dvh - 120px);
}
}

/* MODAL CHỌN NGÔN NGỮ */
.settings-language-page{padding-top:8px;color:#4b3b31}
.settings-language-page #backLanguageBtn{display:inline-flex;align-items:center;gap:6px;margin:0 0 20px;padding:9px 13px;border:1px solid #e8ddd2;border-radius:10px;background:#faf6f1;color:#73543d;font-size:13px;font-weight:600;cursor:pointer;transition:background .2s,transform .2s}
.settings-language-page #backLanguageBtn:hover
.settings-language-page>p{margin:0 0 15px;color:#8b735f;font-size:13px;line-height:1.6}
.settings-language-page .language-option{display:flex;align-items:center;gap:10px;width:100%;margin:8px 0;padding:14px 15px;border:1px solid #eee3d8;border-radius:13px;background:#fff;color:#4b3b31;text-align:left;font-size:14px;font-weight:400;cursor:pointer;transition:background .2s,border-color .2s,transform .2s}
.settings-language-page .language-option:hover
.settings-language-page .language-option[style*="700"]{border-color:#b98b5f;background:#f8eee2;color:#69492f;box-shadow:0 3px 10px rgba(105,73,47,.07)}
.settings-language-page .language-option[style*="700"]::after{content:"✓";display:flex;align-items:center;justify-content:center;width:22px;height:22px;margin-left:auto;border-radius:50%;background:#8b6847;color:#fff;font-size:12px;font-weight:700}
@media(max-width:480px){
.settings-language-page .language-option{padding:13px 12px}
}



.account-avatar-wrap{position:relative;width:100px;height:100px;margin:0 auto 12px}
.account-avatar-wrap #accountProfileAvatar{width:100%;height:100%;object-fit:cover;border-radius:50%}
.account-avatar-wrap #changeAvatarBtn{position:absolute;right:0;bottom:0;width:34px;height:34px;padding:0;border:2px solid #fff;border-radius:50%;background:#6b4f3a;color:#fff;cursor:pointer}
.account-name-row{display:flex;align-items:center;justify-content:center;gap:8px}
.account-name-row h3{margin:0}
.account-name-row button{border:0;background:transparent;cursor:pointer;font-size:17px}
#openEditProfileBtn{margin-top:12px;padding:10px 18px;border:0;border-radius:8px;background:#6b4f3a;color:#fff;cursor:pointer}
.profile-edit-overlay{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.55)}
.profile-edit-modal{width:min(100%,420px);max-height:90vh;overflow:auto;padding:22px;border-radius:14px;background:#fff;color:#33271f;box-shadow:0 12px 40px rgba(0,0,0,.25)}
.profile-edit-modal h3{margin:0 0 20px;text-align:center;font-size:18px}
.profile-edit-modal>label,.profile-edit-label{display:block;margin:14px 0 7px;font-weight:600}
#editProfileName,.profile-birth-fields select{min-width:0;width:100%;padding:10px;border:1px solid #d5c9be;border-radius:7px;font:inherit}
.profile-gender-options{display:flex;gap:24px}
.profile-gender-options label{display:flex;align-items:center;gap:7px}
.profile-birth-fields{display:grid;grid-template-columns:1fr 1fr 1.4fr;gap:8px}
.profile-edit-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}
.profile-edit-actions button{padding:10px 18px;border:0;border-radius:7px;cursor:pointer}
#saveProfileBtn{background:#6b4f3a;color:#fff}
#cancelEditProfileBtn{background:#eee;color:#33271f}
@media(max-width:400px){.profile-edit-modal{padding:16px}.profile-edit-modal h3{font-size:16px}}

.message-input textarea{
  flex:1;
  min-width:0;
  min-height:40px;
  max-height:140px;
  resize:none;
  overflow-y:auto;
  padding:10px 12px;
  border:0;
  outline:none;
  background:transparent;
  color:inherit;
  font:inherit;
  line-height:20px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.message-input textarea::placeholder{
  color:#999;
}

.message-row{
  display:flex;
  width:100%;
  min-width:0;
  margin:8px 0;
}
.message-row.own{
  justify-content:flex-end;
}
.message-bubble{
  max-width:min(75%,600px);
  min-width:0;
  box-sizing:border-box;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.message-text{
  min-width:0;
  max-width:100%;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.message-actions{
  display:flex;
  justify-content:flex-end;
  gap:6px;
  margin-top:5px;
}
.message-actions button{
  padding:3px 7px;
  border:0;
  border-radius:5px;
  background:rgba(107,79,58,.12);
  color:inherit;
  font-size:12px;
  cursor:pointer;
}
.message-actions button:hover{
  background:rgba(107,79,58,.24);
}
.message-recalled{
  color:#888;
  font-style:italic;
}

.message-bubble audio{
  display:block;
  width:300px;
  max-width:min(75vw,100%);
  min-width:240px;
  height:48px;
  margin:4px 0;
}


.voice-message{
  display:flex;
  align-items:center;
  gap:10px;
  width:300px;
  max-width:100%;
  min-width:0;
  padding:10px 12px;
  margin:4px 0;
  box-sizing:border-box;
  border-radius:12px;
  background:rgba(107,79,58,.10);
}
.voice-play-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 40px;
  width:40px;
  height:40px;
  padding:0;
  border:0;
  border-radius:50%;
  background:#6b4f3a;
  color:#fff;
  font-size:17px;
  cursor:pointer;
}
.voice-play-btn:hover{
  background:#543b2a;
}
.voice-content{
  flex:1;
  min-width:0;
}
.voice-progress{
  display:block;
  width:100%;
  height:5px;
  margin:5px 0 7px;
  border-radius:5px;
  accent-color:#6b4f3a;
  cursor:pointer;
}
.voice-time{
  display:flex;
  justify-content:space-between;
  gap:8px;
  color:inherit;
  font-size:11px;
  opacity:.8;
  font-variant-numeric:tabular-nums;
}
.voice-message audio{
  display:none;
}


/* MYCHAT - GIAO DIỆN TỐI */
html[data-theme="dark"] body{background:#141414;color:#e8e1da}
html[data-theme="dark"] #mychat,
html[data-theme="dark"] #chatView,
html[data-theme="dark"] .chat-panel{background:#1b1b1b;color:#e8e1da}
html[data-theme="dark"] .chat-sidebar,
html[data-theme="dark"] .sidebar-header,
html[data-theme="dark"] .chat-panel-header,
html[data-theme="dark"] .message-input,
html[data-theme="dark"] .settings-modal{background:#242424;color:#e8e1da}
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .user-info,
html[data-theme="dark"] #googleLoginBtn{background:#2b2b2b;color:#e8e1da;border-color:#444}
html[data-theme="dark"] .search-box input,
html[data-theme="dark"] .sidebar-search input,
html[data-theme="dark"] .message-input input,
html[data-theme="dark"] .message-input textarea{background:transparent;color:#e8e1da}
html[data-theme="dark"] .sidebar-search,
html[data-theme="dark"] .message-input button,
html[data-theme="dark"] .sidebar-header button,
html[data-theme="dark"] .chat-panel-header>button{background:#353535;color:#e8e1da}
html[data-theme="dark"] .conversation-item:hover,
html[data-theme="dark"] .settings-option:hover{background:#333}
html[data-theme="dark"] .conversation-info strong,
html[data-theme="dark"] .account-details strong,
html[data-theme="dark"] .chat-placeholder h2,
html[data-theme="dark"] .settings-modal-header h2,
html[data-theme="dark"] .settings-option,
html[data-theme="dark"] .settings-account-page,
html[data-theme="dark"] .settings-language-page{color:#e8e1da}
html[data-theme="dark"] .conversation-info span,
html[data-theme="dark"] .account-details,
html[data-theme="dark"] .chat-person span,
html[data-theme="dark"] .chat-placeholder,
html[data-theme="dark"] .empty-chat p{color:#b9aaa0}
html[data-theme="dark"] .settings-option{background:#242424;border-color:#414141}
html[data-theme="dark"] .settings-option-icon{background:#38332f}
html[data-theme="dark"] .settings-modal-header button{background:#383838;color:#e8e1da}
html[data-theme="dark"] .settings-account-info{background:#292929;border-color:#444}
html[data-theme="dark"] .settings-account-info p{color:#e8e1da;border-color:#444}
html[data-theme="dark"] .settings-language-page .language-option{background:#292929;color:#e8e1da;border-color:#444}
html[data-theme="dark"] .settings-language-page .language-option[style*="700"]{background:#3a3027;border-color:#b98b5f}
html[data-theme="dark"] .profile-edit-modal{background:#242424;color:#e8e1da}
html[data-theme="dark"] #editProfileName,
html[data-theme="dark"] .profile-birth-fields select{background:#303030;color:#e8e1da;border-color:#555}
html[data-theme="dark"] .conversation-empty div,
html[data-theme="dark"] .chat-placeholder-icon{background:#35302b}
html[data-theme="dark"] .chat-footer{border-color:#444;color:#aaa}
html[data-theme="dark"] .message-actions button{background:#40372f}

.settings-general-page #backGeneralSettingsBtn{
display:inline-flex!important;
align-items:center;
gap:6px;
margin:0 0 18px;
padding:6px 0!important;
border:0!important;
border-radius:0!important;
background:transparent!important;
color:#896744!important;
font-size:13px;
font-weight:700!important;
cursor:pointer;
box-shadow:none!important;
outline:none;
transition:color .18s;
}
.settings-general-page #backGeneralSettingsBtn:hover{
background:transparent!important;
color:#5f4229!important;
}
html[data-theme="dark"] .settings-general-page #backGeneralSettingsBtn{
background:transparent!important;
color:#d0b18b!important;
}
html[data-theme="dark"] .settings-general-page #backGeneralSettingsBtn:hover{
background:transparent!important;
color:#f0d4ad!important;
}

/* MENU NGỮ CẢNH NGƯỜI DÙNG */
.user-context-menu{position:fixed;z-index:20000;min-width:170px;padding:5px;border:1px solid #e8dfd6;border-radius:11px;background:#fff;box-shadow:0 8px 28px rgba(40,30,20,.16)}
.user-context-menu button{width:100%;padding:11px 13px;border:0;border-radius:7px;background:transparent;color:#8b4338;text-align:left;font-size:13px;font-weight:600;cursor:pointer}
.user-context-menu button:hover
html[data-theme="dark"] .user-context-menu{border-color:#444;background:#292929;box-shadow:0 8px 28px rgba(0,0,0,.4)}
html[data-theme="dark"] .user-context-menu button{color:#e5a49a}
html[data-theme="dark"] .user-context-menu button:hover
@media(hover:none){.conversation-item{-webkit-touch-callout:none;user-select:none;-webkit-user-select:none}}


.message-reactions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:7px;position:relative}
.reaction-summary{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.reaction-chip,.reaction-add-btn{min-height:28px;padding:3px 9px;border:1px solid #e8dfd6;border-radius:16px;background:#fff;color:#67483e;font-size:13px;cursor:pointer}
.reaction-chip:hover,.reaction-add-btn:hover{background:#f8eeeb;border-color:#d9b6a8}
.reaction-add-btn{min-width:30px;padding:3px 7px;font-size:16px}
.reaction-picker{position:absolute;z-index:1000;left:0;bottom:calc(100% + 6px);display:flex;gap:4px;padding:7px;border:1px solid #e8dfd6;border-radius:24px;background:#fff;box-shadow:0 5px 20px rgba(40,30,20,.16)}
.reaction-picker button{width:34px;height:34px;border:0;border-radius:50%;background:transparent;font-size:21px;cursor:pointer}
.reaction-picker button:hover{background:#f8eeeb;transform:scale(1.12)}
html[data-theme="dark"] .reaction-chip,html[data-theme="dark"] .reaction-add-btn{background:#292929;border-color:#444;color:#f1d8cd}
html[data-theme="dark"] .reaction-chip:hover,html[data-theme="dark"] .reaction-add-btn:hover{background:#3b302f}
html[data-theme="dark"] .reaction-picker{background:#292929;border-color:#444;box-shadow:0 5px 20px rgba(0,0,0,.4)}
html[data-theme="dark"] .reaction-picker button:hover{background:#3b302f}


.attach-wrapper{position:relative;display:flex;align-items:center}
.attach-menu{position:absolute;bottom:calc(100% + 8px);left:0;z-index:1000;min-width:150px;padding:6px;background:var(--chat-bg,#fff);border:1px solid #ddd;border-radius:10px;box-shadow:0 4px 14px #0002}
.attach-menu:not([hidden]){display:flex;flex-direction:column;gap:4px}
.attach-menu button{border:0;background:transparent;padding:10px;text-align:left;border-radius:6px;cursor:pointer;white-space:nowrap}
.attach-menu button:hover{background:#eee}

/* STICKER MYCHAT */
.sticker-panel{position:fixed;right:12px;bottom:76px;z-index:1100;width:300px;max-width:calc(100vw - 32px);padding:12px;background:#fff;color:#3e3027;border:1px solid #ded5cc;border-radius:14px;box-shadow:0 6px 24px rgba(0,0,0,.18)}
.sticker-panel[hidden]{display:none}
.sticker-panel-header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;font-weight:600}
.sticker-panel-header button{width:32px;height:32px;border:0;border-radius:50%;background:#f3eee8;color:#6b4f3a;cursor:pointer}
.sticker-list{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;min-height:80px;max-height:260px;overflow-y:auto}
html[data-theme="dark"] .sticker-panel{background:#242424;color:#e8e1da;border-color:#444}
html[data-theme="dark"] .sticker-panel-header button{background:#353535;color:#e8e1da}

.sticker-item{display:flex;align-items:center;justify-content:center;aspect-ratio:1;border:0;border-radius:10px;background:#f7f2ec;font-size:30px;cursor:pointer}
.sticker-item:hover{background:#eadfd2;transform:scale(1.06)}
html[data-theme="dark"] .sticker-item{background:#353535}

.camera-overlay{
  position:fixed;
  inset:0;
  z-index:10000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(0,0,0,.72);
}
.camera-overlay[hidden]{
  display:none;
}
.camera-modal{
  width:100%;
  max-width:560px;
  padding:16px;
  border-radius:16px;
  background:var(--panel-bg,#fff);
  color:var(--text-color,#222);
  box-sizing:border-box;
}
.camera-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  font-size:17px;
  font-weight:600;
}
.camera-header button{
  width:38px;
  height:38px;
  border:0;
  border-radius:50%;
  cursor:pointer;
}
#cameraPreview{
  display:block;
  width:100%;
  max-height:65vh;
  min-height:180px;
  object-fit:contain;
  border-radius:12px;
  background:#111;
}
.camera-actions{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:10px;
  margin-top:14px;
}
.camera-actions button{
  min-height:42px;
  padding:9px 16px;
  border:0;
  border-radius:10px;
  background:#6b4f3a;
  color:#fff;
  cursor:pointer;
}
.camera-actions button:disabled{
  opacity:.55;
  cursor:wait;
}
#cameraStatus{
  margin:10px 0 0;
  font-size:13px;
  text-align:center;
}

#cameraCanvas{
  display:block;
  width:100%;
  max-height:65vh;
  object-fit:contain;
  border-radius:12px;
  background:#111;
}

/* Nền bong bóng tin nhắn hai bên */
.message-bubble{
  background:#EAF1F5;
  border:1px solid #DCE6EC;
  border-radius:14px;
  padding:10px 13px;
}
.message-row.own .message-bubble{
  background:#F3E9DF;
  border-color:#E9DACC;
}


/* ===== LỜI MỜI KẾT BẠN - 2 DÒNG ===== */
.friend-requests-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 6px 0;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.friend-requests-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color, inherit);
}

#friendRequestsList {
  width: 100%;
  min-width: 0;
}

#friendRequestsList .friend-request-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 0;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#friendRequestsList .friend-request-item > span {
  display: block;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-color, inherit);
}

#friendRequestsList .friend-request-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

#friendRequestsList .friend-request-actions button {
  display: inline-block;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  white-space: nowrap;
  cursor: pointer;
}

#friendRequestsList .friend-request-actions .friend-request-accept {
  color: #16a34a;
}

#friendRequestsList .friend-request-actions .friend-request-reject {
  color: #dc2626;
}

#friendRequestsList .friend-request-actions button:hover {
  text-decoration: underline;
  filter: none;
}


#friendRequestsList .friend-request-item {
  align-items: center;
  text-align: center;
}

#friendRequestsList .friend-request-item > span {
  text-align: center;
  font-weight: 600;
}

#friendRequestsList .friend-request-actions {
  justify-content: center;
}

#friendRequestsList .friend-request-actions button {
  font-size: 13px;
  font-weight: 600;
}

#friendRequestsSection h3 {
  text-align: center;
  color: Blue;
  font-weight: 700;
}

.conversation-user-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.conversation-user-name .context-add-friend {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.conversation-user-name .context-add-friend:hover {
  text-decoration: underline;
}
.conversation-user-name .context-add-friend:disabled {
  opacity: 0.6;
  cursor: wait;
}
.conversation-user-name .context-add-friend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border: none;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: 0 2px 5px rgba(22, 163, 74, 0.2);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.conversation-user-name .context-add-friend:hover {
  background: #15803d;
  transform: translateY(-1px);
}
.conversation-user-name .context-add-friend:active {
  transform: translateY(0);
}
.conversation-user-name .context-add-friend:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 0 0 8px;
  border-left: 4px solid #16a34a;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
}
.reply-preview[hidden] {
  display: none;
}
.reply-preview-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.reply-preview-content strong {
  font-size: 12px;
  font-weight: 700;
}
#replyPreviewText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 14px;
}
#cancelReplyBtn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #166534;
  font-size: 24px;
  cursor: pointer;
}
#cancelReplyBtn:hover {
  background: #dcfce7;
}

.message-reply-quote {
  padding: 7px 10px;
  margin-bottom: 8px;
  border-left: 3px solid #16a34a;
  border-radius: 6px;
  background: rgba(22, 163, 74, 0.1);
  min-width: 0;
}
.message-reply-quote strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: #15803d;
}
.message-reply-quote-text {
  font-size: 13px;
  opacity: 0.85;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 768px) {
  
  .reply-preview-content {
    flex: 1;
    min-width: 0;
  }

  #replyPreviewText {
    display: block;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #cancelReplyBtn {
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  
  #replyPreview[hidden] {
    display: none !important;
  }
  .reply-preview-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
  .reply-preview-content strong {
    display: block;
    font-size: 13px;
    line-height: 1.4;
  }
  #replyPreviewText {
    display: block;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-size: 14px;
  }
  #cancelReplyBtn {
    flex: 0 0 30px;
    align-self: flex-start;
    width: 30px;
    height: 30px;
    margin: 0;
  }
}


.message-composer {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.message-composer #replyPreview {
  display: flex;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border-left: 4px solid #16a34a;
  border-radius: 8px 8px 0 0;
  background: #f0fdf4;
  color: #166534;
}
.message-composer #replyPreview[hidden] {
  display: none !important;
}
.message-composer .reply-preview-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.message-composer .reply-preview-content strong {
  font-size: 13px;
  line-height: 1.4;
}
.message-composer #replyPreviewText {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 14px;
  line-height: 1.4;
}
.message-composer #cancelReplyBtn {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin: 0;
}
.message-composer .message-input {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .message-composer {
    width: 100%;
  }
  .message-composer .message-input {
    gap: 0;
    padding-left: 1px;
    padding-right: 1px;
  }
}

.message-composer .message-input #messageInput {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}


.message-composer.is-replying .attach-wrapper,
.message-composer.is-replying #attachImageBtn,
.message-composer.is-replying #cameraBtn,
.message-composer.is-replying #voiceRecordBtn,
.message-composer.is-replying #stickerBtn {
  display: none !important;
}

.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}
.sidebar-search-row .sidebar-search {
  flex: 1 1 auto;
  min-width: 0;
}
.sidebar-search-row .sidebar-search input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.sidebar-search-row .create-group-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #dce2ea;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s, transform .2s;
}
.sidebar-search-row .create-group-btn:hover {
  background: #eef4ff;
  border-color: #93b4f5;
  transform: translateY(-1px);
}

/* Modal tạo nhóm chat chung */

.group-modal[hidden] {
  display: none !important;
}
.group-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.group-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
}
.group-modal-content {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 22px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
}
.group-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.group-modal-header h2 {
  margin: 0;
  font-size: 20px;
}
.group-modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 24px;
  cursor: pointer;
}
.group-modal-content label {
  display: block;
  margin: 14px 0 7px;
  font-size: 14px;
  font-weight: 600;
}
#groupNameInput {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  outline: none;
  font: inherit;
}
#groupNameInput:focus {
  border-color: #6489df;
  box-shadow: 0 0 0 3px rgba(100, 137, 223, .15);
}
.group-friends-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
}
.group-empty {
  margin: 8px 0;
  color: #64748b;
  font-size: 14px;
}
.group-create-error {
  margin-top: 10px;
  color: #dc2626;
  font-size: 13px;
}
.group-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.group-modal-actions button {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.group-cancel-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
}
.group-confirm-btn {
  border: 1px solid #315dc5;
  background: #315dc5;
  color: #fff;
}
.group-confirm-btn:hover {
  background: #244ba9;
}

.group-friend-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
}
.group-friend-option:hover {
  background: #f1f5f9;
}
.group-friend-option input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0;
}
.group-friend-option img {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: cover;
  border-radius: 50%;
}
.group-friend-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-info-summary {
  text-align: center;
  padding: 8px 0 18px;
  border-bottom: 1px solid #e2e8f0;
}

.group-info-summary h3 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.group-info-summary p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
}
.group-members-heading {
  margin: 18px 0 10px;
  font-size: 15px;
}
.group-members-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.group-member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: 10px;
}
.group-member-item:hover {
  background: #f8fafc;
}
.group-member-item > img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border-radius: 50%;
}
.group-member-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.group-member-details strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.group-member-details span {
  color: #64748b;
  font-size: 12px;
}

.message-sender-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  min-width: 0;
}
.message-sender-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  object-fit: cover;
  border-radius: 50%;
}
.message-sender-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.message-row.own .message-sender-info {
  justify-content: flex-end;
}
.message-row.own .message-sender-name {
  color: #7c684f;
}

.group-avatar-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 18px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
#groupAvatarPreview {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #fff;
}
.group-avatar-picker-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
#groupAvatarInput {
  width: 100%;
  max-width: 100%;
  font-size: 13px;
}
.group-avatar-picker-actions small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 480px) {
  .group-avatar-picker {
    gap: 10px;
    padding: 10px;
  }
  #groupAvatarPreview {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }
}

#editGroupInfoBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 16px;
  border: 1px solid #d6b77a;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8e8bd, #e9c879);
  color: #513b1e;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
#editGroupInfoBtn:hover {
  background: linear-gradient(135deg, #f3d995, #dfb85f);
  transform: translateY(-1px);
}
#editGroupInfoBtn:focus-visible {
  outline: 2px solid #a87932;
  outline-offset: 3px;
}

#editGroupAvatarPreview {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #d6b77a;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
#editGroupAvatarInput {
  width: 100%;
  max-width: 100%;
  font-size: 13px;
}
#editGroupModal .group-avatar-picker {
  align-items: center;
  gap: 14px;
  margin: 8px 0 18px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
#editGroupModal .group-avatar-picker-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
#editGroupModal .group-avatar-picker-actions small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 480px) {
  #editGroupAvatarPreview {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }
  #editGroupModal .group-avatar-picker {
    gap: 10px;
    padding: 10px;
  }
}

.group-info-summary .group-conversation-avatar {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: #f1f5f9;
  font-size: 30px;
}
.group-info-summary .group-conversation-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}

.group-conversation-item .group-conversation-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: #f1f5f9;
  font-size: 24px;
}
.group-conversation-item .group-conversation-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}

/* =========================
   MYCHAT - AUTH MODERN UI
========================= */
#authArea{
  width:min(100%,420px);
  margin:28px auto;
  padding:0 18px;
  box-sizing:border-box;
  color:var(--text-color,#202124);
  font-family:inherit;
}
#authArea *{box-sizing:border-box}
#authArea #loginMethods{
  display:flex;
  flex-direction:column;
  gap:14px;
  width:100%;
  padding:30px 26px;
  border:1px solid rgba(128,128,128,.18);
  border-radius:24px;
  background:var(--auth-card-bg,rgba(255,255,255,.92));
  box-shadow:0 16px 45px rgba(0,0,0,.10);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  animation:authAppear .35s ease both;
}
#authArea #loginMethods::before{
  content:"MYCHAT";
  display:block;
  margin-bottom:4px;
  color:#5577e8;
  font-size:12px;
  font-weight:800;
  letter-spacing:4px;
  text-align:center;
}
#authArea #loginMethods::after{
  content:"Kết nối và trò chuyện";
  display:block;
  order:-1;
  margin-bottom:2px;
  color:var(--text-color,#202124);
  font-size:25px;
  font-weight:750;
  letter-spacing:-.7px;
  text-align:center;
}
#authArea input{
  width:100%;
  min-height:48px;
  padding:13px 15px;
  border:1px solid #d8dce5;
  border-radius:12px;
  outline:none;
  background:var(--input-bg,#fff);
  color:var(--text-color,#202124);
  font:inherit;
  font-size:15px;
  transition:border-color .2s,box-shadow .2s,background .2s;
}
#authArea input::placeholder{color:#9298a5}
#authArea input:focus{
  border-color:#5577e8;
  box-shadow:0 0 0 4px rgba(85,119,232,.13);
}
#authArea button{
  width:35%;
  min-height:30px;
  padding:6px 8px;
  border:1px solid transparent;
  border-radius:12px;
  background:#5577e8;
  color:#fff;
  font:inherit;
  font-size:15px;
  font-weight:650;
  cursor:pointer;
  transition:transform .18s,box-shadow .18s,background .18s;
}
#authArea button:hover{
  background:#4264d4;
  box-shadow:0 7px 18px rgba(85,119,232,.23);
  transform:translateY(-1px);
}
#authArea button:active{transform:scale(.985)}
#authArea button:disabled{opacity:.55;cursor:not-allowed;transform:none;box-shadow:none}
#authArea #googleLoginBtn{
  border-color:#d8dce5;
  background:var(--input-bg,#fff);
  color:var(--text-color,#30323a);
  box-shadow:none;
}
#authArea #googleLoginBtn:hover{background:rgba(128,128,128,.08)}
#authArea .login-divider{
  display:flex;
  align-items:center;
  gap:12px;
  color:#9298a5;
  font-size:12px;
}
#authArea .login-divider::before,
#authArea .login-divider::after{
  content:"";
  flex:1;
  height:1px;
  background:rgba(128,128,128,.22);
}
#authArea #authMessage{
  margin:0;
  color:#d14343;
  font-size:13px;
  line-height:1.5;
  overflow-wrap:anywhere;
}
@keyframes authAppear{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:translateY(0)}
}
@media(max-width:480px){
  #authArea{margin:16px auto;padding:0 12px}
  #authArea #loginMethods{padding:25px 19px;border-radius:20px;gap:12px}
  #authArea #loginMethods::after{font-size:23px}
}
@media(prefers-reduced-motion:reduce){
  #authArea #loginMethods{animation:none}
  #authArea button,#authArea input{transition:none}
}

#welcomeView #settingsBtn,
#welcomeView .search-box{
  display:none !important;
}

.qr-login-btn{width:100%;margin-top:16px;padding:12px 16px;border:1px solid #6b4f3a;border-radius:10px;background:#6b4f3a;color:#fff;font-size:15px;font-weight:600;cursor:pointer}
.qr-login-panel{margin-top:16px;padding:18px;border:1px solid #e5d8cc;border-radius:12px;background:#fffaf6;color:#4b382b;text-align:center}
.qr-login-panel h3{margin:0 0 10px}
.qr-login-panel p{font-size:14px;line-height:1.5}
.qr-code-container{display:flex;justify-content:center;align-items:center;min-height:180px;margin:16px auto}
.qr-code-container canvas,.qr-code-container img{display:block;max-width:100%;height:auto}
#qrLoginCancelBtn{padding:9px 18px;border:1px solid #b9a493;border-radius:8px;background:#fff;color:#4b382b;cursor:pointer}

#authArea{display:block!important;visibility:visible!important;opacity:1!important}
#qrLoginBtn{display:block!important;visibility:visible!important;opacity:1!important;position:relative!important;z-index:10!important;width:100%;min-height:44px;margin-top:16px;padding:12px;background:#6b4f3a;color:#fff;border:1px solid #6b4f3a;border-radius:10px;font-size:15px;font-weight:600;cursor:pointer}

.qr-login-section{
  display:flex;
  flex-direction:column;
  align-items:center;
  width:100%;
  margin-top:18px;
}
.qr-login-btn{
  display:block;
  width:min(100%,260px);
  min-height:44px;
  padding:12px 18px;
  border:1px solid #6b4f3a;
  border-radius:10px;
  background:#6b4f3a;
  color:#fff;
  font-size:15px;
  font-weight:600;
  text-align:center;
  cursor:pointer;
}
.qr-login-btn:hover{
  background:#58402f;
}
.qr-login-panel{
  width:100%;
  box-sizing:border-box;
  margin-top:16px;
  text-align:center;
}
#authArea{width:100%;box-sizing:border-box}
.qr-login-section{width:100%;align-items:center;box-sizing:border-box}
.qr-login-panel{width:min(100%,380px);box-sizing:border-box;margin:16px auto 0;padding:20px 16px;border-radius:16px}
#qrLoginStatus{white-space:nowrap;font-size:14px;font-variant-numeric:tabular-nums}
.qr-code-container{min-height:220px}
.qr-code-container canvas,.qr-code-container img{max-width:100%;height:auto;border-radius:12px}

.sidebar-actions{display:flex;align-items:center;gap:4px;flex:0 0 auto}
.sidebar-actions button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;min-width:36px;padding:0;border:0;border-radius:50%;background:#f3eee8;color:#6b4f3a;font-size:17px;cursor:pointer;flex-shrink:0}
.sidebar-actions #logoutBtn{width:auto;min-width:0;height:36px;padding:0 8px;border-radius:18px;font-size:12px;white-space:nowrap;flex-shrink:0}
@media(max-width:700px){
  .sidebar-header{gap:6px;padding:8px}
  .sidebar-title{flex:1 1 0;min-width:0;gap:6px}
  .sidebar-title>img{width:36px;height:36px;flex:0 0 36px}
  .account-details{flex:1;min-width:0}
  .account-details strong{max-width:100%;font-size:12px}
  .sidebar-actions{gap:3px}
  .sidebar-actions button{width:32px;height:32px;min-width:32px;font-size:16px}
  .sidebar-actions #logoutBtn{height:32px;padding:0 6px;font-size:11px}
}

/* Hiển thị nút theo PC và Mobile */
#mobileChatSettingsBtn,#mobileChatQrScanBtn{display:none}
#chatQrScanBtn{display:none}
@media(max-width:700px){
  #mobileChatSettingsBtn,#mobileChatQrScanBtn{display:flex;align-items:center;justify-content:center}
}

/* Mobile QR Scanner */
.qr-scanner-overlay{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.75)}
.qr-scanner-overlay[hidden]{display:none}
.qr-scanner-panel{width:100%;max-width:420px;max-height:90vh;overflow-y:auto;padding:20px;border-radius:16px;background:var(--panel-bg,#fff);color:var(--text-color,#222);box-shadow:0 12px 40px rgba(0,0,0,.3)}
.qr-scanner-header{display:flex;align-items:center;justify-content:space-between;gap:12px}
.qr-scanner-header h3{margin:0;font-size:18px}
#qrScannerCloseBtn{flex-shrink:0;border:0;background:transparent;font-size:22px;cursor:pointer}
.qr-scanner-description{font-size:14px;line-height:1.5}
.qr-scanner-camera{position:relative;width:100%;overflow:hidden;border-radius:12px;background:#111;aspect-ratio:1/1}
#qrScannerVideo{display:block;width:100%;height:100%;object-fit:cover}
.qr-scanner-frame{position:absolute;inset:15%;border:3px solid #20c997;border-radius:12px;pointer-events:none;box-shadow:0 0 0 100vmax rgba(0,0,0,.18)}
#qrScannerStatus{min-height:24px;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
#qrScannerCancelBtn{display:block;width:100%;padding:11px;border:0;border-radius:8px;background:#e9ecef;color:#222;font-size:15px;cursor:pointer}
@media(max-width:700px){.qr-scanner-panel{max-width:100%;padding:16px}.qr-scanner-camera{max-height:55vh}}