#mtc-app{box-sizing:border-box}
.mtc-app{
  display:grid;
  grid-template-columns:330px minmax(0,1fr);
  height:760px;
  min-height:560px;
  max-height:calc(100vh - 40px);
  background:#fff;
  border:1px solid #e8e8ef;
  border-radius:24px;
  overflow:hidden;
  box-shadow:0 22px 55px rgba(40,31,80,.12);
  font-family:inherit;
  color:#222;
}
.mtc-sidebar{
  min-width:0;
  min-height:0;
  border-right:1px solid #eeeef4;
  background:linear-gradient(180deg,#fff 0%,#fbfaff 100%);
  overflow:hidden;
  position:relative;
}
.mtc-brand{padding:22px 24px 20px;border-bottom:1px solid #eeeef4}
.mtc-brand-top{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:17px}
.mtc-logo{display:block;width:190px;max-width:calc(100% - 58px);height:auto;object-fit:contain;margin-bottom:0}
.mtc-current-user{position:relative;flex:0 0 auto;width:46px;height:46px}
.mtc-current-user img{display:block;width:46px;height:46px;border-radius:50%;object-fit:cover;border:2px solid #fff;box-shadow:0 4px 14px rgba(62,38,119,.18);background:#f1eff5}
.mtc-current-user-dot{position:absolute;right:-1px;bottom:1px;width:10px;height:10px;border-radius:50%;background:#22b573;border:2px solid #fff;box-sizing:content-box}
.mtc-brand strong{display:block;font-size:25px;letter-spacing:-.5px;color:#26315c}
.mtc-brand span{display:block;font-size:13px;color:#777b91;margin-top:4px}
.mtc-search{padding:15px 16px}
.mtc-search input{width:100%;box-sizing:border-box;border:1px solid #e4e3ec;border-radius:13px;padding:13px 14px;background:#fff;outline:none;font-size:14px;transition:.2s}
.mtc-search input:focus{border-color:#7748c8;box-shadow:0 0 0 3px rgba(119,72,200,.09)}
.mtc-team-list{overflow:auto;height:calc(100% - 185px);min-height:0;padding:0 8px}
.mtc-person{width:100%;display:flex;align-items:center;gap:11px;text-align:left;border:0;background:transparent;border-radius:15px;padding:12px 10px;cursor:pointer;transition:.18s;margin-bottom:3px}
.mtc-person:hover{background:#f7f1ff}
.mtc-person.active{background:linear-gradient(100deg,#faf3ff,#fff7fb);box-shadow:inset 4px 0 0 #7748c8}
.mtc-avatar-wrap{position:relative;flex:0 0 auto}
.mtc-person img{width:50px;height:50px;border-radius:50%;object-fit:cover}
.mtc-avatar-wrap i{position:absolute;width:10px;height:10px;border-radius:50%;right:-1px;bottom:1px;border:2px solid #fff}
.mtc-avatar-wrap i.online{background:#22b573}.mtc-avatar-wrap i.offline{background:#adb1bd}
.mtc-person-text{min-width:0;flex:1}
.mtc-person strong,.mtc-person small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mtc-person strong{font-size:14px;color:#5b32a7}
.mtc-person small{font-size:12px;color:#777b91;margin-top:4px}
.mtc-unread{min-width:22px;height:22px;padding:0 6px;border-radius:12px;background:linear-gradient(135deg,#7647c7,#f24a8b);color:#fff;display:flex;align-items:center;justify-content:center;font-size:10px}
.mtc-sidebar-footer{position:absolute;bottom:0;left:0;right:0;background:rgba(255,255,255,.96);border-top:1px solid #eeeef4;padding:12px 16px;display:flex;justify-content:space-between;font-size:11px;color:#777b91}

.mtc-chat{
  min-width:0;
  min-height:0;
  height:100%;
  display:flex;
  flex-direction:column;
  background:#fff;
  overflow:hidden;
}
.mtc-empty{margin:auto;text-align:center;color:#777b91}
.mtc-empty-icon{font-size:48px}
.mtc-empty h2{color:#20243a;margin:12px 0 6px;font-size:31px}
.mtc-empty p{margin:0}
.mtc-conversation{
  height:100%;
  min-height:0;
  min-width:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.mtc-chat-header{
  flex:0 0 auto;
  min-height:88px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 24px;
  border-bottom:1px solid #eeeef4;
  position:relative;
  background:#fff;
}
.mtc-chat-header strong{display:block;font-size:17px;color:#3e2677}
.mtc-chat-header span{font-size:12px;margin-top:4px;display:block}
.mtc-profile-bio{margin-left:auto;max-width:38%;font-size:12px;color:#777b91;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.online-status{color:#1aa968!important}.offline-status{color:#85899a!important}
.mtc-user-avatar{flex:0 0 auto}
.mtc-user-avatar img{width:50px;height:50px;border-radius:50%;object-fit:cover}

.mtc-messages{
  flex:1 1 auto;
  min-height:0;
  min-width:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:28px;
  background:radial-gradient(circle at 15% 15%,rgba(121,70,200,.035),transparent 30%),linear-gradient(180deg,#fcfcfe,#f7f7fa);
  overscroll-behavior:contain;
}
.mtc-msg{
  max-width:68%;
  padding:11px 13px;
  border-radius:16px;
  margin-bottom:11px;
  line-height:1.5;
  word-break:break-word;
  overflow-wrap:anywhere;
  box-shadow:0 2px 10px rgba(30,20,60,.035);
}
.mtc-msg.mine{margin-left:auto;background:linear-gradient(135deg,#7647c7 0%,#f24a8b 100%);color:#fff;border-bottom-right-radius:5px}
.mtc-msg.theirs{margin-right:auto;background:#fff;border:1px solid #ebeaf0;border-bottom-left-radius:5px;color:#373a4b}
.mtc-msg time{display:block;font-size:10px;opacity:.68;margin-top:6px;text-align:right}
.mtc-text{margin-top:7px}

.mtc-image-card{
  display:block;
  text-decoration:none;
  color:inherit;
  width:min(100%,420px);
  max-width:100%;
}
.mtc-image-card img{
  display:block;
  width:auto;
  max-width:100%;
  height:auto;
  max-height:320px;
  object-fit:contain;
  border-radius:11px;
  background:rgba(0,0,0,.04);
}
.mtc-image-card span{font-size:10px;display:block;margin-top:5px;opacity:.7;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.mtc-file-card{
  display:flex;
  align-items:center;
  gap:10px;
  width:min(100%,360px);
  min-width:0;
  box-sizing:border-box;
  text-decoration:none;
  color:inherit;
  background:rgba(255,255,255,.75);
  border-radius:12px;
  padding:9px;
}
.mtc-msg.mine .mtc-file-card{background:rgba(255,255,255,.14);color:#fff}
.mtc-file-icon{font-size:26px;flex:0 0 auto}
.mtc-file-card span:nth-child(2){min-width:0;flex:1}
.mtc-file-card strong,.mtc-file-card small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mtc-file-card strong{font-size:12px}.mtc-file-card small{font-size:10px;opacity:.65;margin-top:3px}

.mtc-composer{
  flex:0 0 auto;
  min-width:0;
  display:flex;
  align-items:center;
  gap:9px;
  padding:14px 16px;
  border-top:1px solid #eeeef4;
  background:#fff;
  position:relative;
  z-index:2;
}
.mtc-composer input[type=text]{
  flex:1 1 auto;
  min-width:0;
  width:0;
  box-sizing:border-box;
  border:1px solid #dedee8;
  border-radius:13px;
  padding:14px 15px;
  outline:none;
  font-size:14px;
}
.mtc-composer input[type=text]:focus{border-color:#7647c7;box-shadow:0 0 0 3px rgba(118,71,199,.08)}
.mtc-icon-btn{flex:0 0 auto;width:46px;height:46px;border:0;border-radius:13px;background:#f5f1fb;color:#7647c7;cursor:pointer;font-size:20px}
.mtc-send{flex:0 0 auto;height:46px;border:0;border-radius:13px;padding:0 24px;background:linear-gradient(135deg,#7647c7,#f24a8b);color:#fff;font-weight:600;cursor:pointer;box-shadow:0 8px 18px rgba(118,71,199,.18)}
.mtc-send:disabled,.mtc-icon-btn:disabled{opacity:.55;cursor:not-allowed}
.mtc-loading,.mtc-error,.mtc-no-results{padding:20px;color:#777b91}

@media(max-width:900px){
  .mtc-app{grid-template-columns:280px}
  .mtc-profile-bio{display:none}
  .mtc-msg{max-width:76%}
}
@media(max-width:680px){
  .mtc-app{
    display:block;
    height:calc(100dvh - 20px);
    min-height:520px;
    max-height:none;
    border-radius:16px;
    position:relative;
  }
  /* On phones the team list is the first screen after login. */
  .mtc-sidebar{
    display:flex;
    flex-direction:column;
    width:100%;
    height:100%;
    border-right:0;
    border-bottom:0;
  }
  .mtc-brand{flex:0 0 auto}
  .mtc-team-list{height:auto;flex:1 1 auto;min-height:0;overflow-y:auto;padding-bottom:58px}
  .mtc-sidebar-footer{position:absolute}
  .mtc-chat{
    display:none;
    width:100%;
    height:100%;
  }
  .mtc-app.mtc-mobile-chat-open .mtc-sidebar{display:none}
  .mtc-app.mtc-mobile-chat-open .mtc-chat{display:flex}
  .mtc-empty{padding:20px}
  .mtc-msg{max-width:85%}
  .mtc-profile-bio{display:none}
  .mtc-mobile-back{
    display:flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    width:38px;
    height:38px;
    margin-right:2px;
    border:0;
    border-radius:10px;
    background:#f5f1fb;
    color:#7647c7;
    font-size:28px;
    line-height:1;
    cursor:pointer;
  }
  .mtc-chat-header{padding:0 12px;min-height:72px}
}
@media(min-width:681px){
  .mtc-mobile-back{display:none}
}
@media(max-width:480px){
  .mtc-chat-header{padding:0 10px;min-height:68px}
  .mtc-brand{padding:17px}
  .mtc-brand-top{gap:10px;margin-bottom:14px}
  .mtc-current-user,.mtc-current-user img{width:42px;height:42px}
  .mtc-current-user-dot{width:9px;height:9px}
  .mtc-logo{width:165px}
  .mtc-brand strong{font-size:22px}
  .mtc-composer{padding:10px;gap:7px}
  .mtc-icon-btn{width:42px;height:42px}
  .mtc-send{height:42px;padding:0 16px}
  .mtc-msg{max-width:88%}
  .mtc-messages{padding:18px 12px}
  .mtc-image-card img{max-height:240px}
}

/* Branded front-end login */
.mtc-login-page{
  min-height:min(760px,calc(100vh - 40px));
  display:flex;
  align-items:center;
  justify-content:center;
  padding:30px 16px;
  box-sizing:border-box;
  background:
    radial-gradient(circle at 15% 15%,rgba(118,71,199,.10),transparent 30%),
    radial-gradient(circle at 85% 80%,rgba(242,74,139,.09),transparent 28%),
    #fafafd;
}
.mtc-login-card{
  width:min(430px,100%);
  box-sizing:border-box;
  padding:42px 38px 34px;
  background:rgba(255,255,255,.97);
  border:1px solid #e8e6ef;
  border-radius:26px;
  box-shadow:0 24px 70px rgba(40,31,80,.14);
  text-align:center;
}
.mtc-login-logo{display:block;width:min(225px,80%);height:auto;margin:0 auto 24px;object-fit:contain}
.mtc-login-brand{font-size:30px;line-height:1.15;font-weight:800;letter-spacing:-.7px;color:#26315c}
.mtc-login-subtitle{margin:8px 0 25px;color:#777b91;font-size:14px}
.mtc-login-form{text-align:left}
.mtc-field{margin-bottom:17px}
.mtc-field label{display:block;margin:0 0 7px;color:#373b50;font-size:13px;font-weight:600}
.mtc-field input{width:100%;box-sizing:border-box;border:1px solid #dedde8;border-radius:13px;padding:14px 15px;background:#fff;color:#272a3c;font-size:14px;outline:none;transition:.2s}
.mtc-field input:focus{border-color:#7647c7;box-shadow:0 0 0 4px rgba(118,71,199,.09)}
.mtc-password-wrap{position:relative}
.mtc-password-wrap input{padding-right:62px}
.mtc-password-toggle{position:absolute;right:8px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:#7647c7;font-size:12px;font-weight:700;cursor:pointer;padding:7px}
.mtc-remember{display:flex;align-items:center;gap:7px;margin:3px 0 18px;color:#777b91;font-size:12px;cursor:pointer}
.mtc-remember input{accent-color:#7647c7}
.mtc-login-submit{width:100%;height:50px;border:0;border-radius:14px;background:linear-gradient(135deg,#7647c7,#f24a8b);color:#fff;font-size:15px;font-weight:700;cursor:pointer;box-shadow:0 10px 22px rgba(118,71,199,.20);transition:transform .15s,box-shadow .15s}
.mtc-login-submit:hover{transform:translateY(-1px);box-shadow:0 13px 25px rgba(118,71,199,.24)}
.mtc-login-error{margin:0 0 18px;padding:11px 12px;border:1px solid #f1cbd8;border-radius:11px;background:#fff4f7;color:#b22b58;font-size:12px;text-align:left;line-height:1.5}
.mtc-login-note{margin:20px 0 0;color:#9295a4;font-size:11px}
.mtc-access-denied p{color:#777b91;font-size:13px;line-height:1.7;margin:12px 0 0}
.mtc-logout{color:#7647c7;text-decoration:none;font-weight:600;margin-left:8px}
.mtc-logout:hover{text-decoration:underline}
@media(max-width:480px){
  .mtc-login-page{min-height:calc(100vh - 20px);padding:15px 10px}
  .mtc-login-card{padding:32px 22px 28px;border-radius:20px}
  .mtc-login-logo{width:190px;margin-bottom:20px}
  .mtc-login-brand{font-size:27px}
}

/* v2.0 account + username enhancements */
.mtc-current-user{display:block;text-decoration:none;cursor:pointer;transition:transform .18s ease,filter .18s ease}
.mtc-current-user:hover{transform:translateY(-1px);filter:brightness(1.03)}
.mtc-current-user:focus-visible{outline:3px solid rgba(118,71,199,.25);outline-offset:3px;border-radius:50%}
.mtc-chat-user-info{min-width:0}
.mtc-chat-user-info strong{line-height:1.15}
.mtc-chat-username{display:block!important;margin-top:3px!important;font-size:11px!important;color:#7647c7!important;font-weight:600}
.mtc-chat-user-info #mtc-chat-status{display:block!important;margin-top:3px!important}
.mtc-person-text small{font-size:11px}
@media(max-width:680px){.mtc-chat-user-info{min-width:0}.mtc-chat-user-info strong,.mtc-chat-user-info small,.mtc-chat-user-info span{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}

/* v2.1 - WhatsApp-style account header + other-team-members-only list */
.mtc-current-user{transition:transform .18s ease,box-shadow .18s ease}
.mtc-current-user:hover{transform:translateY(-1px)}
.mtc-current-user:focus-visible{outline:3px solid rgba(118,71,199,.25);outline-offset:3px;border-radius:50%}
.mtc-person-text strong{font-weight:700}
.mtc-chat-user-info{min-width:0}
.mtc-chat-user-info strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mtc-chat-user-info small{color:#777b91;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
