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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

#app {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: monospace;
  font-size: 0.8rem;
  color: #888;
}

button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  background: #00d4ff;
  color: #1a1a2e;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}

button:hover {
  background: #00b8d9;
}

.btn-secondary {
  padding: 6px 14px;
  font-size: 0.85rem;
  background: #333;
  color: #e0e0e0;
}

.btn-secondary:hover {
  background: #444;
}

.error {
  color: #ff6b6b;
  font-size: 0.85rem;
}

.empty-state {
  color: #888;
  font-style: italic;
  text-align: center;
  padding: 40px 0;
}

/* Login */
#login-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
}

#login-view h1 {
  font-size: 2rem;
  color: #00d4ff;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
}

#login-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #aaa;
}

#login-form input {
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #e0e0e0;
  font-size: 1rem;
  font-family: monospace;
}

#login-form input:focus {
  outline: none;
  border-color: #00d4ff;
}

/* Dashboard */
#dashboard-view {
  display: flex;
  flex-direction: column;
}

#dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #16213e;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  z-index: 2;
}

#dash-header h1 {
  font-size: 1.2rem;
  color: #00d4ff;
}

#dash-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

#dash-username {
  font-weight: 600;
}

#dash-actions {
  padding: 16px;
  border-bottom: 1px solid #222;
}

#dash-chats {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-card {
  background: #16213e;
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.chat-card:hover {
  border-color: #00d4ff;
}

.chat-card-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.chat-card-meta {
  font-size: 0.8rem;
  color: #888;
}

/* Chat */
#chat-view {
  display: flex;
  flex-direction: column;
}

#header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #16213e;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  z-index: 2;
}

#chat-label {
  font-weight: 600;
  color: #00d4ff;
  font-size: 1rem;
}

#users-label {
  color: #aaa;
  font-size: 0.85rem;
  flex: 1;
}

#messages {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.5;
}

.msg-user {
  background: #16213e;
  border: 1px solid #2a3a5e;
  align-self: flex-start;
}

.msg-bot {
  background: #0f3460;
  border: 1px solid #1a4a7a;
  align-self: flex-start;
}

.msg-system {
  background: transparent;
  color: #888;
  font-style: italic;
  font-size: 0.85rem;
  align-self: center;
  text-align: center;
  padding: 4px 0;
}

.msg-sender {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.msg-user .msg-sender {
  color: #00d4ff;
}

.msg-bot .msg-sender {
  color: #ff6b6b;
}

.msg-time {
  font-size: 0.7rem;
  color: #666;
  margin-top: 2px;
}

.msg-content {
  white-space: pre-wrap;
}

.msg-edit-btn {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 0 3px;
  background: transparent;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.2;
  opacity: 0.55;
  cursor: pointer;
}

.msg-edit-btn:hover {
  background: transparent;
  opacity: 1;
}

.bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.typing-indicator {
  padding: 6px 16px;
  color: #888;
  font-style: italic;
  font-size: 0.85rem;
  background: #1a1a2e;
}

.new-messages-bar {
  padding: 8px 16px;
  color: #00d4ff;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  background: #1a1a2e;
  border-top: 1px solid #2a3a5e;
}

#msg-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #16213e;
  border-top: 1px solid #333;
}

.char-count {
  align-self: flex-end;
  font-size: 0.7rem;
  color: #888;
  min-width: 2ch;
  text-align: right;
  user-select: none;
}

.char-count-over {
  color: #ff6b6b;
  font-weight: 600;
}

#msg-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  overflow: hidden;
  max-height: 200px;
}

#msg-input:focus {
  outline: none;
  border-color: #00d4ff;
}

#msg-form button {
  flex-shrink: 0;
  align-self: flex-end;
}
