* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0b1418;
  color: #e9edef;
  height: 100vh;
  overflow: hidden;
}

.screen {
  display: none;
  height: 100vh;
}
.screen.active {
  display: flex;
}

/* Auth */
#auth-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2a3a 0%, #0b1418 100%);
}

.auth-box {
  background: #1a2a3a;
  padding: 2rem;
  border-radius: 12px;
  width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.auth-box h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 2rem;
}

.tabs {
  display: flex;
  margin-bottom: 1rem;
}

.tab {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: none;
  color: #8696a0;
  cursor: pointer;
  font-size: 1rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: #00a884;
  border-bottom-color: #00a884;
}

.auth-box input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #0b1418;
  border: 1px solid #2a3a4a;
  border-radius: 8px;
  color: #e9edef;
  font-size: 1rem;
}

.auth-box input:focus {
  outline: none;
  border-color: #00a884;
}

.auth-box button {
  width: 100%;
  padding: 0.75rem;
  background: #00a884;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.auth-box button:hover {
  background: #00c49a;
}

.error {
  color: #ff6b6b;
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

/* Chat Layout */
#chat-screen {
  flex-direction: row;
}

.sidebar {
  width: 280px;
  background: #111b21;
  border-right: 1px solid #2a3a4a;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2a3a4a;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s;
}
.icon-btn:hover {
  background: #2a3a4a;
}

.user-list {
  flex: 1;
  overflow-y: auto;
}

.user-item {
  padding: 0.875rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1a2a3a;
  transition: background 0.15s;
}

.user-item:hover, .user-item.active {
  background: #2a3a4a;
}

.user-name {
  font-size: 1rem;
  font-weight: 500;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.online-dot.online {
  background: #00a884;
  box-shadow: 0 0 4px #00a884;
}
.online-dot.offline {
  background: #8696a0;
}

/* Main Chat */
.main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0b1418;
}

.no-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8696a0;
}

.no-chat.hidden {
  display: none;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-area.hidden {
  display: none;
}

.chat-header {
  padding: 0.75rem 1rem;
  background: #111b21;
  border-bottom: 1px solid #2a3a4a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 65%;
}

.message.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.message.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.bubble {
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  line-height: 1.4;
  word-break: break-word;
}

.message.mine .bubble {
  background: #005c4b;
  border-top-right-radius: 4px;
}

.message.theirs .bubble {
  background: #1a2a3a;
  border-top-left-radius: 4px;
}

.meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #8696a0;
}

.msg-status {
  font-size: 0.875rem;
}

.input-area {
  padding: 0.75rem;
  background: #111b21;
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid #2a3a4a;
}

.input-area input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: #2a3a4a;
  border: none;
  border-radius: 8px;
  color: #e9edef;
  font-size: 1rem;
}

.input-area input:focus {
  outline: none;
}

.input-area button {
  padding: 0.75rem 1.5rem;
  background: #00a884;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.input-area button:hover {
  background: #00c49a;
}

/* Scrollbar */
.messages::-webkit-scrollbar {
  width: 6px;
}
.messages::-webkit-scrollbar-thumb {
  background: #2a3a4a;
  border-radius: 3px;
}

@media (max-width: 600px) {
  .sidebar {
    width: 72px;
  }
  .sidebar-header h2, .user-name {
    display: none;
  }
  .user-item {
    justify-content: center;
    padding: 1rem;
  }
}
