/* ============================================================
   ElectionIQ — Premium Redesign v3
   Theme: Deep civic navy × electric sapphire × warm gold
   Font: Sora (headings) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ===== TOKENS ===== */
:root {
  --navy:        #0b1526;
  --navy-mid:    #111f38;
  --navy-card:   #162033;
  --navy-border: #1e2f4a;

  --sapphire:    #2563eb;
  --sapphire-2:  #3b82f6;
  --sapphire-glow: rgba(37,99,235,0.18);

  --gold:        #f59e0b;
  --gold-light:  #fcd34d;
  --gold-glow:   rgba(245,158,11,0.15);

  --emerald:     #10b981;
  --rose:        #f43f5e;

  --text-primary:   #f0f4ff;
  --text-secondary: #8da3c4;
  --text-muted:     #4a6080;

  --surface-1:   #162033;
  --surface-2:   #1a2942;
  --surface-3:   #1e3154;

  --font:        'DM Sans', system-ui, sans-serif;
  --font-heading:'Sora', system-ui, sans-serif;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --r-full: 999px;

  --ease:  cubic-bezier(0.22,1,0.36,1);
  --t:     0.2s;
  --t-slow: 0.4s;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.5);
  --shadow-blue: 0 4px 20px rgba(37,99,235,0.35);
  --shadow-gold: 0 4px 20px rgba(245,158,11,0.3);
}

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

html, body {
  height: 100%;
  background: var(--navy);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 64px;
  background: rgba(11,21,38,0.9);
  border-bottom: 1px solid var(--navy-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sapphire), var(--gold), transparent);
  opacity: 0.4;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-blue);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-text span { color: var(--gold); }

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-1);
  border: 1px solid var(--navy-border);
  border-radius: var(--r-full);
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-pill .live-dot {
  width: 6px; height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-select {
  background: var(--surface-1);
  border: 1px solid var(--navy-border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: border-color var(--t);
}
.header-select:focus { border-color: var(--sapphire-2); color: var(--text-primary); }
.header-select option { background: var(--navy-card); color: var(--text-primary); }

/* ===== HERO SEARCH BAND ===== */
.hero-search {
  background: linear-gradient(180deg, #0d1a30 0%, var(--navy) 100%);
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--navy-border);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.hero-search::before {
  content: '';
  position: absolute;
  top: -80px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 200px;
  background: radial-gradient(ellipse, rgba(37,99,235,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero-search-inner {
  max-width: 780px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-text {
  text-align: center;
  margin-bottom: 18px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(37,99,235,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--sapphire-2);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: var(--r-full);
  margin-bottom: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.hero-text h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  line-height: 1.25;
}

.hero-text h2 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--sapphire-2), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Search bar */
.hero-search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-1);
  border: 1.5px solid var(--navy-border);
  border-radius: var(--r-xl);
  padding: 6px 6px 6px 18px;
  gap: 10px;
  transition: border-color var(--t), box-shadow var(--t);
}

.hero-search-wrap:focus-within {
  border-color: var(--sapphire);
  box-shadow: 0 0 0 3px var(--sapphire-glow), var(--shadow-blue);
}

.hero-search-icon { font-size: 16px; opacity: 0.5; flex-shrink: 0; }

#heroSearchInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  padding: 8px 0;
}
#heroSearchInput::placeholder { color: var(--text-muted); }

#heroSearchBtn {
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t), box-shadow var(--t);
  box-shadow: var(--shadow-blue);
  letter-spacing: 0.2px;
}
#heroSearchBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(37,99,235,0.5);
}

.hero-suggestions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-suggestions span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.hero-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--navy-border);
  color: var(--text-secondary);
  padding: 4px 13px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.hero-chip:hover {
  background: var(--sapphire-glow);
  border-color: var(--sapphire-2);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ===== MAIN LAYOUT ===== */
.main-layout {
  display: grid;
  grid-template-columns: 300px 1fr 284px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ===== PANELS ===== */
.left-panel,
.right-panel {
  background: var(--navy-card);
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.left-panel { border-right: 1px solid var(--navy-border); }
.right-panel { border-left: 1px solid var(--navy-border); }

.panel-section-title {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -8px;
  margin-bottom: 14px;
}

/* Keep legacy h2/h3 selectors working */
.left-panel h2, .left-panel h3, .right-panel h3 {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ===== VOTER JOURNEY TIMELINE ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 10px;
  cursor: pointer;
  border-radius: var(--r-md);
  transition: background var(--t), transform var(--t) var(--ease);
  position: relative;
  border: 1px solid transparent;
}

.timeline-step:hover {
  background: var(--surface-2);
  border-color: var(--navy-border);
  transform: translateX(2px);
}

.timeline-step.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(37,99,235,0.06));
  border-color: rgba(37,99,235,0.3);
}

.step-connector {
  position: absolute;
  left: 27px;
  top: 46px;
  width: 2px;
  height: calc(100% - 10px);
  background: linear-gradient(to bottom, var(--sapphire-2), var(--navy-border));
  opacity: 0.25;
  z-index: 0;
}
.timeline-step:last-child .step-connector { display: none; }

.step-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
  position: relative;
  z-index: 1;
}

.step-info { flex: 1; min-width: 0; }
.step-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-time { font-size: 10px; color: var(--text-muted); }
.step-arrow { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }

/* ===== QUICK FACTS ===== */
.fact-cards {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.fact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--navy-border);
  transition: border-color var(--t);
}
.fact-card:hover { border-color: var(--sapphire-2); }
.fact-icon { font-size: 18px; flex-shrink: 0; }
.fact-card strong { font-size: 12px; font-weight: 600; color: var(--text-primary); display: block; }
.fact-card p { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* ===== NEWS SECTION ===== */
.search-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--navy-border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--sapphire-2); }

.search-bar button {
  padding: 8px 12px;
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  transition: transform var(--t), box-shadow var(--t);
  box-shadow: var(--shadow-blue);
}
.search-bar button:hover { transform: scale(1.04); }

.news-results { display: flex; flex-direction: column; gap: 7px; }

.news-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
  font-style: italic;
}

.news-item {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--navy-border);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color var(--t), transform var(--t) var(--ease);
}
.news-item:hover {
  border-color: var(--sapphire-2);
  transform: translateX(2px);
}
.news-item-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item-snippet {
  font-size: 10px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item-source {
  font-size: 10px;
  color: var(--sapphire-2);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== CHAT SECTION ===== */
.chat-section {
  display: flex;
  flex-direction: column;
  background: var(--navy);
  overflow: hidden;
  position: relative;
}

/* Ambient glow behind chat */
.chat-section::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 500px; height: 300px;
  background: radial-gradient(ellipse, rgba(37,99,235,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.chat-header {
  background: rgba(22,32,51,0.95);
  padding: 12px 20px;
  border-bottom: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(8px);
}

.assistant-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-blue);
  flex-shrink: 0;
}

.chat-header h2 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--emerald);
  font-weight: 500;
}

.status-dot {
  width: 6px; height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

.clear-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--navy-border);
  color: var(--text-muted);
  padding: 5px 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  transition: all var(--t);
}
.clear-btn:hover {
  border-color: var(--rose);
  color: var(--rose);
  background: rgba(244,63,94,0.08);
}

/* ===== CHAT MESSAGES ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 86%;
  animation: msg-in 0.3s var(--ease) both;
}

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

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

.message-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
}

.user-message .message-avatar {
  background: linear-gradient(135deg, var(--gold), #d97706);
  box-shadow: var(--shadow-gold);
}

.message-content {
  background: var(--surface-1);
  padding: 12px 16px;
  border-radius: 4px 14px 14px 14px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  border: 1px solid var(--navy-border);
}

.user-message .message-content {
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  border-color: transparent;
  box-shadow: var(--shadow-blue);
}

.message-content p { margin-bottom: 7px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { font-weight: 700; color: var(--text-primary); }

/* Typing indicator */
.typing-message .message-content {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: var(--surface-1);
}

.typing-dot {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.3s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing-bounce {
  0%, 100% { transform: translateY(0); background: var(--text-muted); }
  50%       { transform: translateY(-5px); background: var(--sapphire-2); }
}

/* ===== QUICK CHIPS ===== */
.quick-chips {
  padding: 10px 24px 12px;
  background: rgba(22,32,51,0.9);
  border-top: 1px solid var(--navy-border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.chips-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 7px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 5px 13px;
  background: var(--surface-2);
  border: 1px solid var(--navy-border);
  border-radius: var(--r-full);
  font-size: 11px;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
  font-weight: 500;
}
.chip:hover {
  background: var(--sapphire-glow);
  border-color: var(--sapphire-2);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-blue);
}

/* ===== CHAT INPUT ===== */
.chat-input-area {
  padding: 12px 20px;
  background: rgba(22,32,51,0.95);
  border-top: 1px solid var(--navy-border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--navy-border);
  border-radius: var(--r-lg);
  padding: 11px 14px;
  transition: border-color var(--t), box-shadow var(--t);
}
.input-wrapper:focus-within {
  border-color: var(--sapphire-2);
  box-shadow: 0 0 0 3px var(--sapphire-glow);
}

#chatInput {
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-family: var(--font);
  resize: none;
  outline: none;
  line-height: 1.55;
  max-height: 120px;
  overflow-y: auto;
  color: var(--text-primary);
}
#chatInput::placeholder { color: var(--text-muted); }

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.char-count { font-size: 10px; color: var(--text-muted); }

.send-btn {
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: transform var(--t) var(--ease), box-shadow var(--t);
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-blue);
}
.send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,99,235,0.45);
}
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.disclaimer {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 7px;
}

/* ===== RIGHT PANEL FAQ ===== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.faq-item {
  border: 1px solid var(--navy-border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t);
}
.faq-item:hover { border-color: rgba(59,130,246,0.3); }
.faq-item.open { border-color: rgba(37,99,235,0.4); }

.faq-question {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-2);
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--t);
}
.faq-question:hover { background: var(--surface-3); }

.faq-toggle {
  font-size: 10px;
  color: var(--sapphire-2);
  transition: transform var(--t) var(--ease);
  flex-shrink: 0;
}
.faq-item.open .faq-toggle { transform: rotate(180deg); }

.faq-answer {
  display: none;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.65;
  border-top: 1px solid var(--navy-border);
  background: var(--surface-1);
}
.faq-item.open .faq-answer { display: block; }

/* ===== GLOSSARY ===== */
.glossary-search { margin-bottom: 10px; }
.glossary-search input {
  width: 100%;
  padding: 7px 12px;
  border: 1.5px solid var(--navy-border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t);
}
.glossary-search input::placeholder { color: var(--text-muted); }
.glossary-search input:focus { border-color: var(--sapphire-2); }

.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}

.glossary-item {
  padding: 8px 11px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--navy-border);
  transition: border-color var(--t), transform var(--t);
}
.glossary-item:hover {
  border-color: rgba(59,130,246,0.35);
  transform: translateX(2px);
}
.glossary-term {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  text-transform: capitalize;
  margin-bottom: 2px;
}
.glossary-def {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,13,26,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: var(--r-xl);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s var(--ease);
}
.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--surface-2);
  border: 1px solid var(--navy-border);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}
.modal-close:hover {
  background: var(--surface-3);
  color: var(--text-primary);
  border-color: var(--sapphire-2);
}

.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--navy-border);
  border-top-color: var(--sapphire-2);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.modal-step-icon {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--sapphire), #1d4ed8);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-blue);
  flex-shrink: 0;
}
.modal-step-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}
.modal-step-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.modal-ai-content {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-secondary);
}
.modal-details {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--navy-border);
}
.modal-details h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-details ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.modal-details li {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
.modal-details li::before {
  content: "✓";
  color: var(--emerald);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--navy-border);
  padding: 9px 22px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform 0.3s var(--ease), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.error  { background: rgba(244,63,94,0.15); border-color: var(--rose); color: #fca5a5; }
.toast.success{ background: rgba(16,185,129,0.12); border-color: var(--emerald); color: #6ee7b7; }
.toast.info   { background: var(--sapphire-glow); border-color: var(--sapphire-2); color: var(--sapphire-2); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .main-layout { grid-template-columns: 280px 1fr; }
  .right-panel { display: none; }
}

@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
    overflow: visible;
    height: auto;
  }
  .left-panel { border-right: none; border-bottom: 1px solid var(--navy-border); }
  .hero-text h2 { font-size: 18px; }
  #heroSearchBtn { padding: 9px 14px; font-size: 12px; }
  .header-actions { display: none; }
  .app-shell { height: auto; overflow: auto; }
  .chat-section { min-height: 70vh; }
}

/* ===== UTILITY ===== */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* Smooth focus rings */
*:focus-visible {
  outline: 2px solid var(--sapphire-2);
  outline-offset: 2px;
}