:root {
  --primary: #0b5cab;
  --primary-hover: #094785;
  --primary-light: #e7f1ff;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --sidebar-bg: #1e293b;
  --sidebar-text: #f1f5f9;
  --sidebar-muted: #94a3b8;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --radius: 10px;
}

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

body, html {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* Authentication Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  animation: cardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(11, 92, 171, 0.2);
}

.auth-brand h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.auth-tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input-wrap input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: monospace;
}

.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 92, 171, 0.15);
}

.auth-btn {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-btn:hover {
  background: var(--primary-hover);
}

.auth-error-msg {
  color: #dc2626;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
}

/* App Layout */
.app-layout {
  display: flex;
  height: 100%;
}

/* Sidebar */
.app-sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-text h3 {
  font-size: 15px;
  font-weight: 600;
}

.status-badge {
  font-size: 12px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 8px #4ade80;
}

.sidebar-section {
  flex: 1;
  margin-top: 24px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--sidebar-muted);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
  transform: translateX(2px);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.db-info {
  display: flex;
  flex-direction: column;
}

.db-label {
  font-size: 10px;
  color: var(--sidebar-muted);
}

.db-val {
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
}

.logout-btn {
  background: transparent;
  color: var(--sidebar-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.logout-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

/* Chat Main Area */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.chat-header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-info h2 {
  font-size: 18px;
  font-weight: 700;
}

.header-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.partner-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
}

.partner-badge img {
  height: 24px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  border-radius: 2px;
}

/* Messages container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-card {
  text-align: center;
  margin: auto;
  max-width: 540px;
  padding: 40px 20px;
}

.welcome-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(11, 92, 171, 0.15);
}

.welcome-card h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.welcome-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.msg-row {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.msg-row.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-row.user .msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 2px;
}

.msg-row.bot .msg-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}

/* Chat Input Bar */
.chat-footer {
  padding: 18px 32px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-input-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 8px 6px 18px;
  transition: border-color 0.15s;
}

.chat-input-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 92, 171, 0.1);
}

.chat-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 14px;
  outline: none;
  padding: 8px 0;
}

.send-btn {
  background: var(--primary);
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.send-btn:hover {
  background: var(--primary-hover);
}
