.chat-login-gate {
  min-height: calc(100vh - 70px);
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.chat-login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
body.dark .chat-login-card { background: #1e1e1e; }

.chat-login-icon { font-size: 2.4rem; margin-bottom: 12px; }

.chat-login-card h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: #222;
}
body.dark .chat-login-card h2 { color: #eee; }

.chat-login-card p {
  color: #888;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.chat-login-card .btn {
  background: #e07b39;
  color: #fff;
  box-shadow: none;
}
.chat-login-card .btn:hover { background: #c9652a; }

.chat-page {
  display: flex;
  height: calc(100vh - 80px);
  max-width: 1100px;
  margin: 0 auto;
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
}
body.dark .chat-page { border-color: #333; }

.chat-sidebar {
  width: 240px;
  min-width: 200px;
  border-right: 1px solid #eee;
  padding: 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
body.dark .chat-sidebar { border-color: #333; }

.chat-sidebar-label {
  margin: 16px 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
}

.chat-thread-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}
.chat-thread-btn:hover { background: #fff3e0; }
.chat-thread-btn.active { background: #e07b39; color: #fff; }
body.dark .chat-thread-btn { color: #ccc; }
body.dark .chat-thread-btn:hover { background: #2a2a2a; }

.chat-users-list { display: flex; flex-direction: column; gap: 4px; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  padding: 18px 24px;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid #eee;
}
body.dark .chat-header { border-color: #333; color: #eee; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble-row { display: flex; }
.chat-bubble-row.mine { justify-content: flex-end; }

.chat-bubble {
  max-width: 70%;
  background: #f1f1f1;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-bubble-row.mine .chat-bubble {
  background: #e07b39;
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
body.dark .chat-bubble { background: #2a2a2a; color: #eee; }

.chat-bubble-sender {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e07b39;
}
.chat-bubble-row.mine .chat-bubble-sender { color: rgba(255,255,255,0.85); }

.chat-bubble-body {
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble-time {
  font-size: 0.7rem;
  opacity: 0.65;
  align-self: flex-end;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #eee;
}
body.dark .chat-input-row { border-color: #333; }

.chat-input-row input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 50px;
  font-size: 0.95rem;
  outline: none;
  color: #333;
}
.chat-input-row input:focus { border-color: #e07b39; }

@media (max-width: 768px) {
  .chat-page {
    flex-direction: column;
    height: auto;
    border-left: none;
    border-right: none;
  }
  .chat-sidebar {
    width: 100%;
    max-height: 160px;
    border-right: none;
    border-bottom: 1px solid #eee;
  }
  .chat-messages {
    height: 55vh;
  }
}
