* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05060a;
  color: #f4f4f5;
}

#app {
  min-height: 100vh;
  display: flex;
}

.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: flex;
}

/* Login screen */

#login-screen {
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: radial-gradient(circle at top, #1f2937, #020617);
  border-radius: 1rem;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: #9ca3af;
  font-size: 0.95rem;
}

.login-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.login-card input {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #374151;
  background: #020617;
  color: #f9fafb;
}

.login-card input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px #4f46e5;
}

.login-card button {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;
  border: none;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover {
  filter: brightness(1.05);
}

/* Chat layout */

#chat-screen {
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #111827;
  background: rgba(3, 7, 18, 0.98);
}

.app-title h1 {
  margin: 0;
  font-size: 1.1rem;
}

.user-label {
  display: inline-flex;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #111827;
  color: #9ca3af;
  font-size: 0.75rem;
}

.app-status {
  font-size: 0.75rem;
  color: #9ca3af;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #111827;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.message {
  max-width: 80%;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.message.user {
  margin-left: auto;
  background: #4f46e5;
}

.message.agent {
  margin-right: auto;
  background: #111827;
  border: 1px solid #1f2937;
}

.message.meta {
  margin: 0.5rem auto;
  max-width: 60%;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
}

.message-form {
  display: flex;
  padding: 0.75rem 0.75rem 0.9rem;
  gap: 0.5rem;
  border-top: 1px solid #111827;
  background: rgba(3, 7, 18, 0.98);
}

.message-form textarea {
  flex: 1;
  resize: none;
  padding: 0.5rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid #374151;
  background: #020617;
  color: #f9fafb;
  font-family: inherit;
  font-size: 0.9rem;
}

.message-form textarea:focus {
  outline: none;
  border-color: #4f46e5;
}

.message-form button {
  padding: 0.55rem 0.9rem;
  border-radius: 0.5rem;
  border: none;
  background: #4f46e5;
  color: white;
  font-weight: 500;
  cursor: pointer;
}

.message-form button:hover {
  filter: brightness(1.05);
}

/* Sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.75rem;
  background: radial-gradient(circle at top, #020617, #000000);
}

.panel {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0.75rem;
  border: 1px solid #111827;
  padding: 0.75rem 0.85rem;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.panel-body {
  font-size: 0.85rem;
  color: #d1d5db;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-top: 1px solid #111827;
  }
}
