/* ============================================================
   FATHM — Tennessee Real Estate Intelligence
   Design: Dark maritime navy, DM Sans + DM Serif Display
   ============================================================ */

/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Fathm palette — deep maritime navy */
  --navy-950:  #080c14;
  --navy-900:  #0d1421;
  --navy-800:  #111c2e;
  --navy-700:  #162336;
  --navy-600:  #1e2f47;
  --navy-500:  #243a58;
  --navy-400:  #2f4d72;

  --slate-300: #8fa3bc;
  --slate-200: #b3c3d4;
  --slate-100: #d0dce8;
  --white:     #f0f4f8;

  /* Accent: warm gold-amber for citations/highlights */
  --gold:      #c9a84c;
  --gold-dim:  #8b7035;

  /* Teal for interactive accents */
  --teal:      #3b8fa6;
  --teal-dim:  #2d6e80;
  --teal-pale: rgba(59, 143, 166, 0.12);

  /* Status */
  --green:     #4caf7d;
  --red:       #e05757;

  /* Spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px; --s9: 48px;

  /* Type */
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
  --text-xs:   11px; --text-sm: 13px; --text-base: 15px;
  --text-md:   17px; --text-lg:  20px; --text-xl:   26px;

  /* Layout */
  --sidebar-w:   260px;
  --header-h:    56px;
  --radius:      8px;
  --radius-lg:   12px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.35);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);

  /* Active theme tokens (dark default) */
  --bg:          var(--navy-950);
  --surface:     var(--navy-800);
  --surface-2:   var(--navy-700);
  --surface-3:   var(--navy-600);
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);
  --text-primary:   var(--white);
  --text-secondary: var(--slate-200);
  --text-muted:     var(--slate-300);
  --accent:      var(--teal);
  --accent-dim:  var(--teal-dim);
  --accent-pale: var(--teal-pale);
}

[data-theme="light"] {
  --bg:          #f5f7fa;
  --surface:     #ffffff;
  --surface-2:   #eef1f5;
  --surface-3:   #e4e8ee;
  --border:      rgba(0,0,0,0.08);
  --border-2:    rgba(0,0,0,0.14);
  --text-primary:   #0d1421;
  --text-secondary: #2a3a4f;
  --text-muted:     #5a7090;
  --accent:      #1f6e8c;
  --accent-dim:  #155469;
  --accent-pale: rgba(31,110,140,0.1);
  --gold:        #a07820;
}

html { height: 100%; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* --- HEADER --- */
.site-header {
  height: var(--header-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 10;
}

.header-inner {
  width: 100%;
  padding: 0 var(--s6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  color: inherit;
}

.logo-mark {
  color: var(--accent);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.badge {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-pale);
  border: 1px solid rgba(59, 143, 166, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
}

.theme-toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--surface-2);
  border-color: var(--border-2);
}

/* --- MAIN LAYOUT --- */
.chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- NEW CHAT BUTTON --- */
.sidebar-top {
  padding: var(--s4) var(--s4) var(--s3);
  flex-shrink: 0;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2) var(--s3);
  background: var(--accent-pale);
  border: 1px solid rgba(59, 143, 166, 0.2);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.new-chat-btn:hover {
  background: rgba(59, 143, 166, 0.18);
  border-color: rgba(59, 143, 166, 0.35);
}

.sidebar-section {
  flex: 1;
  padding: var(--s3) var(--s4);
  overflow-y: auto;
}

.sidebar-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s3);
  padding: 0 var(--s2);
}

/* --- CONVERSATION LIST --- */
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: var(--s2) var(--s3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  line-height: 1.4;
  position: relative;
}
.conv-item:hover {
  background: var(--accent-pale);
  color: var(--text-primary);
}
.conv-item.active {
  background: var(--accent-pale);
  color: var(--text-primary);
  font-weight: 500;
}

.conv-item .conv-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  opacity: 0.6;
}
.conv-item.active .conv-icon { color: var(--accent); opacity: 1; }

.conv-item .conv-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item .conv-delete {
  display: none;
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.conv-item:hover .conv-delete { display: flex; }
.conv-item .conv-delete:hover { color: var(--red); background: rgba(224,87,87,0.1); }

.empty-history {
  padding: var(--s6) var(--s3);
  text-align: center;
}
.empty-history p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- TIME GROUP HEADERS --- */
.conv-time-group {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--s3) var(--s2) var(--s1);
  opacity: 0.7;
}

.sidebar-footer {
  padding: var(--s4);
  border-top: 1px solid var(--border);
}

.disclaimer {
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* --- CHAT PANEL --- */
.chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* --- WELCOME STATE --- */
.welcome-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: var(--s7);
  z-index: 1;
  transition: opacity 0.25s;
}
.welcome-state.hidden {
  opacity: 0;
  pointer-events: none;
}

.welcome-inner {
  text-align: center;
  max-width: 600px;
}

.welcome-icon {
  color: var(--accent);
  opacity: 0.6;
  margin-bottom: var(--s5);
  width: 52px; height: 52px;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: var(--s4);
}
.welcome-title em {
  font-style: italic;
  color: var(--accent);
}

.welcome-tagline {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--accent);
  margin-bottom: var(--s4);
  line-height: 1.3;
}

.welcome-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: 0.03em;
  line-height: 1.6;
}

/* --- QUICK-START PROMPTS --- */
.quick-start {
  margin-top: var(--s7);
  pointer-events: auto;
}

.quick-start-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s4);
  font-weight: 500;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s3);
  max-width: 560px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .prompt-grid {
    grid-template-columns: 1fr;
  }
}

.prompt-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  line-height: 1.4;
}

.prompt-card:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.prompt-card:active {
  transform: translateY(0);
}

.prompt-icon {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.7;
  margin-top: 1px;
}

.prompt-card:hover .prompt-icon {
  opacity: 1;
}

.prompt-text {
  flex: 1;
}

/* --- MESSAGES --- */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s6) var(--s7);
  display: flex;
  flex-direction: column;
  gap: var(--s6);
  scroll-behavior: smooth;
}

.messages:empty + .input-area { margin-top: auto; }

/* Scrollbar */
.messages::-webkit-scrollbar,
.sidebar-section::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track,
.sidebar-section::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb,
.sidebar-section::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 2px;
}

/* --- MESSAGE BUBBLES --- */
.message {
  display: flex;
  gap: var(--s4);
  max-width: 780px;
  width: 100%;
  align-self: flex-start;
  animation: fadeUp 0.22s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.message.assistant .msg-avatar {
  background: var(--accent-pale);
  color: var(--accent);
  border: 1px solid rgba(59,143,166,0.2);
}

.message.user .msg-avatar {
  background: var(--surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border-2);
}

.msg-body { flex: 1; min-width: 0; }

.msg-role {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.message.user .msg-role { text-align: right; }

.msg-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4) var(--s5);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-primary);
}

.message.user .msg-content {
  background: var(--navy-700, var(--surface-3));
  border-color: var(--border-2);
  color: var(--text-primary);
}

[data-theme="light"] .message.user .msg-content {
  background: var(--surface-2);
}

/* Markdown content inside assistant messages */
.msg-content p { margin-bottom: 0.75em; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 600; color: var(--text-primary); }
.msg-content em { font-style: italic; }

.msg-content h3, .msg-content h4 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 1em 0 0.4em;
  font-size: var(--text-base);
  letter-spacing: 0.01em;
}
.msg-content h3 { font-size: var(--text-md); }

.msg-content ul, .msg-content ol {
  padding-left: 1.4em;
  margin: 0.5em 0 0.75em;
}
.msg-content li { margin-bottom: 0.35em; line-height: 1.6; }

.msg-content code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--gold);
}

/* Citation / form reference pill */
.msg-content .cite {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(201,168,76,0.12);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 3px;
  vertical-align: middle;
}

/* Horizontal rule in content */
.msg-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.8em 0;
}

/* --- TYPING INDICATOR --- */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: fit-content;
}

.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: typingPulse 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.4; transform: scale(1); }
  30% { opacity: 1; transform: scale(1.15); }
}

/* --- CONFIDENTIALITY NOTICE --- */
.confidentiality-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin: 0 var(--s7);
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--gold);
  flex-shrink: 0;
}
.confidentiality-notice svg {
  flex-shrink: 0;
  stroke: var(--gold);
  opacity: 0.8;
}

/* --- INPUT AREA --- */
.input-area {
  flex-shrink: 0;
  padding: var(--s4) var(--s7) var(--s5);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: 1.6;
  resize: none;
  max-height: 160px;
  overflow-y: auto;
}

.chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.send-btn:disabled {
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: default;
}
.send-btn:not(:disabled):hover { background: var(--accent-dim); }
.send-btn:not(:disabled):active { transform: scale(0.95); }

/* --- MIC BUTTON (voice input) --- */
.mic-btn {
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.mic-btn:hover {
  color: var(--text-primary);
  background: var(--surface-2);
  border-color: var(--border-2);
}
.mic-btn.listening {
  color: var(--red, #e05757);
  border-color: rgba(224,87,87,0.5);
  background: rgba(224,87,87,0.08);
  box-shadow: 0 0 0 3px rgba(224,87,87,0.15);
  animation: mic-pulse 1.5s ease-in-out infinite;
}
.mic-btn.unsupported {
  display: none;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(224,87,87,0.15); }
  50% { box-shadow: 0 0 0 6px rgba(224,87,87,0.08); }
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-left: 2px;
}

/* --- FORM CITATION LINKS --- */
.msg-content .cite-link {
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.msg-content .cite-link:hover {
  background: rgba(201,168,76,0.22);
  border-color: rgba(201,168,76,0.45);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- FORM MODAL --- */
.form-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--s6);
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.form-modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.form-modal-header strong {
  color: var(--text-primary);
  font-size: var(--text-base);
}

.form-modal-close {
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-modal-close:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.form-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--s5);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-primary);
}

.form-modal-body p { margin-bottom: 0.6em; }
.form-modal-body p:last-child { margin-bottom: 0; }
.form-modal-body strong { font-weight: 600; }
.form-modal-body h3, .form-modal-body h4 {
  font-family: var(--font-body);
  font-weight: 600;
  margin: 0.8em 0 0.3em;
  font-size: var(--text-sm);
}
.form-modal-body h3 { font-size: var(--text-base); }
.form-modal-body ul, .form-modal-body ol {
  padding-left: 1.3em;
  margin: 0.4em 0 0.6em;
}
.form-modal-body li { margin-bottom: 0.3em; }
.form-modal-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.8em 0;
}

.form-modal-footer {
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.form-modal-footer p {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- TABLES IN MESSAGES --- */
.msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6em 0;
  font-size: var(--text-sm);
}
.msg-content th, .msg-content td {
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  text-align: left;
}
.msg-content th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.msg-content td {
  color: var(--text-primary);
}

/* --- BLOCKQUOTES --- */
.msg-content blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--s2) var(--s4);
  margin: 0.6em 0;
  background: var(--accent-pale);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* --- ERROR STATE --- */
.msg-error {
  background: rgba(224,87,87,0.1);
  border-color: rgba(224,87,87,0.3);
  color: var(--red);
}

.retry-notice {
  color: var(--gold);
  font-size: 0.85em;
  font-weight: 500;
  letter-spacing: 0.02em;
  animation: pulse-retry 1.5s ease-in-out infinite;
}
@keyframes pulse-retry {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* --- LOGIN / NDA OVERLAY --- */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--navy-950);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6);
  animation: fadeIn 0.3s ease;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--navy-800);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: var(--s8) var(--s7);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  text-align: center;
}

.login-logo {
  color: var(--teal);
  margin-bottom: var(--s4);
  width: 48px;
  height: 48px;
}

.login-title {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--white);
  margin-bottom: var(--s1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--slate-300);
  margin-bottom: var(--s3);
}

.login-beta-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(201,168,76,0.12);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 20px;
  padding: 2px 12px;
  margin-bottom: var(--s6);
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: var(--s4);
}

.login-field label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-300);
  margin-bottom: var(--s1);
}

.login-field input {
  width: 100%;
  padding: var(--s3) var(--s4);
  background: var(--navy-900);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input::placeholder {
  color: var(--slate-300);
  opacity: 0.5;
}

.login-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-pale);
}

/* NDA Section */
.nda-section {
  margin: var(--s5) 0 var(--s4);
}

.nda-scroll {
  max-height: 180px;
  overflow-y: auto;
  background: var(--navy-900);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s4);
  margin-bottom: var(--s3);
  font-size: var(--text-xs);
  line-height: 1.65;
  color: var(--slate-200);
}

.nda-scroll h3 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--white);
  margin-bottom: var(--s3);
}

.nda-scroll ol {
  padding-left: 1.3em;
  margin: 0;
}

.nda-scroll li {
  margin-bottom: var(--s2);
}

.nda-scroll strong {
  color: var(--white);
  font-weight: 600;
}

/* NDA scrollbar */
.nda-scroll::-webkit-scrollbar { width: 4px; }
.nda-scroll::-webkit-scrollbar-track { background: transparent; }
.nda-scroll::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 2px;
}

.nda-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  cursor: pointer;
}

.nda-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.nda-checkbox label {
  font-size: var(--text-sm);
  color: var(--slate-200);
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

/* Login Button */
.login-btn {
  width: 100%;
  padding: var(--s3) var(--s5);
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  margin-top: var(--s3);
}

.login-btn:disabled {
  background: var(--navy-600);
  color: var(--slate-300);
  cursor: default;
  opacity: 0.6;
}

.login-btn:not(:disabled):hover {
  background: var(--teal-dim);
}

.login-btn:not(:disabled):active {
  transform: scale(0.98);
}

.login-error {
  font-size: var(--text-sm);
  color: var(--red);
  text-align: center;
  margin-top: var(--s3);
  min-height: 1.2em;
}

/* --- MOBILE --- */
@media (max-width: 680px) {
  :root { --sidebar-w: 0px; }

  .sidebar { display: none; }

  .chat-layout { flex-direction: column; }

  .messages { padding: var(--s4); gap: var(--s4); }

  .input-area { padding: var(--s3) var(--s4) var(--s4); }

  .message { max-width: 100%; }

  .header-inner { padding: 0 var(--s4); }
  .badge { display: none; }
}
