:root{
  --r:#73070B;
  --r-bright:#d71925;
  --bg:#090b0f;
  --panel:#101319;
  --panel2:#151920;
  --line:#2c323b;
  --muted:#949ca8;
  --canvas:#ececea;
}

*{box-sizing:border-box;border-radius:0!important}
[hidden]{display:none!important}

html,body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:#fff;
  font-family:Arial,sans-serif;
}
body{overflow:hidden}
a{text-decoration:none;color:inherit}
button,input,textarea{font:inherit}

/* Header */
.topbar{
  min-height:68px;
  display:flex;
  align-items:center;
  gap:26px;
  padding:0 20px 0 0;
  background:#050608;
  border-bottom:2px solid var(--r);
  color:#fff;
}
.brand{
  min-height:66px;
  display:flex;
  align-items:center;
  color:#fff;
  font-size:25px;
  font-weight:900;
}
.brand span{
  min-height:66px;
  display:flex;
  align-items:center;
  padding:0 14px;
  margin-right:10px;
  background:linear-gradient(135deg,#9a0c16,#73070B 58%,#310306);
}
.brand strong{color:#fff}
.topbar nav{
  display:flex;
  align-items:center;
  gap:20px;
  flex:1;
  min-width:0;
  overflow:auto;
  font-size:12px;
  font-weight:800;
}
.topbar nav a{
  color:#fff;
  white-space:nowrap;
  opacity:.92;
}
.topbar nav a:hover{opacity:1}
.topbar nav .active{color:#e31a27}
.back{
  flex:0 0 auto;
  margin-right:18px;
  padding:9px 12px;
  border:1px solid #414650;
  background:#11151b;
  color:#fff;
  font-size:10px;
  font-weight:900;
}

/* Main layout */
.messages-shell{
  height:calc(100vh - 68px);
  display:grid;
  grid-template-columns:310px minmax(0,1fr);
  overflow:hidden;
}
.inbox{
  min-width:0;
  display:flex;
  flex-direction:column;
  background:#0d1015;
  border-right:1px solid var(--line);
}
.inbox-head{
  min-height:88px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px;
  border-bottom:1px solid var(--line);
}
.inbox-head span,
.new-head span{
  display:block;
  color:#d71925;
  font-size:8px;
  font-weight:900;
  letter-spacing:1.2px;
}
.inbox-head h1,
.new-head h2{
  margin:4px 0 0;
  color:#fff;
}
.inbox-head h1{font-size:25px}
.inbox-head button{
  min-height:36px;
  padding:0 12px;
  border:1px solid #9d1019;
  background:linear-gradient(120deg,#8c0a12,#73070B 60%,#3b0407);
  color:#fff;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
}
.search{
  padding:11px;
  border-bottom:1px solid #252a32;
}
.search input,
.new-search input{
  width:100%;
  min-height:42px;
  padding:0 12px;
  border:1px solid #3a404a;
  background:#090b0f;
  color:#fff;
  outline:none;
}
.search input:focus,
.new-search input:focus{border-color:#8f0b13}

.conversation-list{
  flex:1;
  min-height:0;
  overflow:auto;
}
.conversation-item{
  width:100%;
  min-height:76px;
  display:grid;
  grid-template-columns:46px minmax(0,1fr) auto;
  align-items:center;
  gap:11px;
  padding:12px 13px;
  border:0;
  border-bottom:1px solid #272c34;
  border-left:3px solid transparent;
  background:transparent;
  color:#fff;
  text-align:left;
  cursor:pointer;
}
.conversation-item:hover{background:#141820}
.conversation-item.active{
  background:#1b1115;
  border-left-color:#c3131e;
}
.conversation-item.unread{border-left-color:#c3131e}

.avatar{
  width:44px;
  height:44px;
  overflow:hidden;
  display:grid;
  place-items:center;
  border-radius:50%!important;
  background:#252a32;
  border:1px solid #353b45;
  color:#fff;
  font-size:10px;
  font-weight:900;
}
.avatar img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  object-position:center;
}
.large-avatar{
  width:48px;
  height:48px;
}

.conversation-copy{min-width:0}
.conversation-copy strong{
  display:block;
  color:#fff;
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.conversation-copy span{
  display:block;
  margin-top:4px;
  color:#a1a8b3;
  font-size:9px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.conversation-copy small{
  display:block;
  margin-top:5px;
  color:#6f7884;
  font-size:8px;
}
.unread-badge{
  min-width:20px;
  height:20px;
  display:grid;
  place-items:center;
  padding:0 5px;
  border-radius:50%!important;
  background:#a70d17;
  color:#fff;
  font-size:8px;
  font-weight:900;
}

/* Conversation */
.conversation-panel{
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:
    radial-gradient(circle at 70% 20%,rgba(115,7,11,.08),transparent 30%),
    #090b0f;
}
.conversation-empty{
  flex:1;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  padding:30px;
  text-align:center;
  color:#8b939f;
}
.empty-state-icon{
  width:62px;
  height:62px;
  display:grid;
  place-items:center;
  margin-bottom:15px;
  border:1px solid #3a4049;
  background:#11151b;
  color:#d71925;
  font-size:26px;
}
.conversation-empty strong{
  color:#fff;
  font-size:24px;
}
.conversation-empty p{
  max-width:460px;
  margin:7px 0 18px;
  color:#89929e;
  font-size:11px;
}
.conversation-empty button{
  min-height:38px;
  padding:0 14px;
  border:1px solid #8d0a13;
  background:#73070B;
  color:#fff;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
}

.conversation-content{
  height:100%;
  min-height:0;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
}
.conversation-head{
  min-height:72px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 17px;
  border-bottom:1px solid var(--line);
  background:#101319;
}
.conversation-heading-copy{
  min-width:0;
  flex:1;
}
.conversation-head strong{
  display:block;
  color:#fff;
  font-size:14px;
}
.conversation-head span{
  display:block;
  margin-top:4px;
  color:#8f98a4;
  font-size:9px;
  text-transform:capitalize;
}
.conversation-profile-link{
  padding:8px 10px;
  border:1px solid #3b414b;
  background:#171b22;
  color:#fff;
  font-size:9px;
  font-weight:900;
}

.message-rows{
  min-height:0;
  overflow:auto;
  padding:18px 20px 26px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.message{
  width:min(72%,720px);
  display:flex;
  align-items:flex-end;
  gap:9px;
}
.message.mine{
  align-self:flex-end;
  flex-direction:row-reverse;
}
.message .avatar{
  width:34px;
  height:34px;
  flex:0 0 34px;
}
.bubble{
  min-width:0;
  padding:10px 12px;
  border:1px solid #313741;
  background:#181c22;
  box-shadow:0 5px 14px rgba(0,0,0,.12);
}
.message.mine .bubble{
  background:linear-gradient(125deg,#73070B,#4d0509);
  border-color:#921019;
}
.bubble strong{
  display:block;
  margin-bottom:5px;
  color:#b9c0c9;
  font-size:8px;
}
.bubble p{
  margin:0;
  color:#fff;
  font-size:12px;
  line-height:1.45;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.bubble small{
  display:block;
  margin-top:7px;
  color:#858e99;
  font-size:7px;
}
.message.mine .bubble small{color:#d1a8ab}

.composer{
  min-height:92px;
  display:grid;
  grid-template-columns:minmax(0,1fr) 90px;
  gap:10px;
  align-items:stretch;
  padding:12px 14px;
  border-top:1px solid var(--line);
  background:#101319;
}
.composer-input{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:5px;
}
.composer textarea{
  width:100%;
  min-height:54px;
  max-height:130px;
  resize:vertical;
  padding:10px 11px;
  border:1px solid #3a404a;
  background:#090b0f;
  color:#fff;
  outline:none;
}
.composer textarea:focus{border-color:#8f0b13}
.composer small{
  color:#69727e;
  font-size:7px;
}
.composer>button{
  border:1px solid #921019;
  background:linear-gradient(120deg,#8c0a12,#73070B 60%,#3b0407);
  color:#fff;
  font-size:11px;
  font-weight:900;
  cursor:pointer;
}
.composer>button:disabled{
  opacity:.55;
  cursor:wait;
}

/* New message drawer */
.drawer-overlay{
  position:fixed;
  inset:68px 0 0;
  z-index:90;
  background:rgba(0,0,0,.48);
}
.new-message-panel{
  position:fixed;
  top:68px;
  right:0;
  bottom:0;
  z-index:100;
  width:min(390px,92vw);
  overflow:auto;
  padding:16px;
  background:#101319;
  border-left:1px solid #3b414b;
  box-shadow:-16px 0 40px rgba(0,0,0,.5);
}
.new-head{
  min-height:58px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding-bottom:13px;
  border-bottom:1px solid #2d323a;
}
.new-head h2{font-size:21px}
.new-head button{
  width:34px;
  height:34px;
  border:1px solid #373d47;
  background:#151920;
  color:#fff;
  font-size:22px;
  cursor:pointer;
}
.new-search{padding:13px 0}
.contact-list{border-top:1px solid #2a2f37}
.contact{
  min-height:66px;
  display:grid;
  grid-template-columns:44px minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  padding:10px 0;
  border-bottom:1px solid #2a2f37;
}
.contact>div{min-width:0}
.contact strong{
  display:block;
  color:#fff;
  font-size:11px;
}
.contact span{
  display:block;
  margin-top:3px;
  color:#89919d;
  font-size:8px;
  text-transform:capitalize;
}
.contact button{
  min-height:31px;
  padding:0 10px;
  border:1px solid #921019;
  background:#73070B;
  color:#fff;
  font-size:8px;
  font-weight:900;
  cursor:pointer;
}

.empty{
  padding:26px 15px;
  color:#858e99;
  text-align:center;
  font-size:10px;
}
.message-toast{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:160;
  max-width:340px;
  padding:12px 14px;
  background:#151920;
  border:1px solid #3b414b;
  border-left:4px solid #73070B;
  color:#fff;
  font-size:10px;
  box-shadow:0 14px 34px rgba(0,0,0,.45);
}

/* Responsive */
@media(max-width:850px){
  body{overflow:auto}
  .topbar{
    min-height:0;
    flex-wrap:wrap;
    padding:8px 12px;
  }
  .brand,.brand span{min-height:48px}
  .topbar nav{
    order:3;
    width:100%;
    gap:15px;
  }
  .back{margin-left:auto;margin-right:0}
  .messages-shell{
    height:auto;
    min-height:calc(100vh - 110px);
    grid-template-columns:1fr;
  }
  .inbox{
    max-height:340px;
    border-right:0;
    border-bottom:1px solid var(--line);
  }
  .conversation-panel{min-height:620px}
  .drawer-overlay{inset:0}
  .new-message-panel{top:0}
}

@media(max-width:540px){
  .message{width:90%}
  .composer{
    grid-template-columns:1fr;
  }
  .composer>button{min-height:42px}
}
