:root{
  --app-bg: #0b141a;        /* fondo tipo WhatsApp dark */
  --panel: #111b21;
  --panel-2: #0f1a20;
  --text: #e9edef;
  --muted: #8696a0;
  --border: rgba(255,255,255,.08);
  --bubble-me: #005c4b;
  --bubble-them: #202c33;
  --accent: #25d366;        /* verde WhatsApp */
}

.bg-app{ background: var(--app-bg); color: var(--text); }

.login-card{
  width: 100%;
  max-width: 460px;
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
}
.brand-badge{
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(37,211,102,.12);
  color: var(--accent);
  font-size: 20px;
}

.app-shell{
  height: 100dvh;
  display: grid;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
}

.sidebar{
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 280px;
}
.sidebar-header{
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-search{
  border-bottom: 1px solid var(--border);
}
.sidebar-list{
  overflow: auto;
  flex: 1;
}

.main{
  display: grid;
  grid-template-rows: 60px 1fr auto;
  background: radial-gradient(1200px 600px at 0% 0%, rgba(37,211,102,.06), transparent 55%),
              radial-gradient(1200px 600px at 100% 0%, rgba(255,255,255,.04), transparent 60%),
              var(--panel-2);
}

.topbar{
  display:flex;
  align-items:center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(17,27,33,.92);
  backdrop-filter: blur(6px);
}

.messages{
  padding: 14px 12px;
  overflow: auto;
  position: relative;
}
.messages-empty{
  height: 100%;
  display: grid;
  place-items: center;
}

.composer{
  border-top: 1px solid var(--border);
  background: rgba(17,27,33,.92);
  backdrop-filter: blur(6px);
}
.composer-inner{
  display:flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 10px 6px 10px;
}
.composer-input{
  resize: none;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
}
.composer-input:focus{
  background: rgba(255,255,255,.08);
  border-color: rgba(37,211,102,.35);
  box-shadow: none;
  color: var(--text);
}

.btn-icon{
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}
.btn-icon:hover{
  background: rgba(255,255,255,.06);
}

.btn-send{
  border-radius: 14px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
}

/* Items lista chats */
.chat-item{
  display:flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.chat-item:hover{ background: rgba(255,255,255,.04); }
.chat-item.active{ background: rgba(37,211,102,.08); }
.chat-item .title{ font-weight: 600; }
.chat-item .meta{ color: var(--muted); font-size: .85rem; }

/* Avatares */
.avatar-sm{
  width: 40px; height: 40px;
  border-radius: 12px;
  display:grid; place-items:center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
}

/* Burbujas */
.msg-row{
  display:flex;
  margin-bottom: 8px;
}
.msg{
  max-width: min(720px, 86%);
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bubble-them);
}
.msg.me{
  margin-left: auto;
  background: var(--bubble-me);
}
.msg .time{
  color: rgba(233,237,239,.65);
  font-size: .75rem;
  margin-left: 8px;
  white-space: nowrap;
}
.msg .top{
  display:flex;
  gap: 6px;
  align-items: baseline;
  justify-content: space-between;
}
.msg .name{
  font-size: .8rem;
  color: rgba(233,237,239,.75);
}

/* Backdrop + sidebar móvil */
.backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display:none;
  z-index: 20;
}
.backdrop.show{ display:block; }

@media (max-width: 991.98px){
  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed;
    left: -100%;
    top: 0;
    height: 100dvh;
    width: min(360px, 92vw);
    z-index: 30;
    transition: left .18s ease;
  }
  .sidebar.show{ left: 0; }
}
