:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Top Navigation
   ========================================================================== */
.top-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  font-weight: 800;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: -0.5px;
}

.brand-info h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-tabs {
  display: flex;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sponsor-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid rgba(219, 39, 119, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sponsor-nav-btn svg {
  color: #db2777;
  transition: transform 0.2s ease;
}

.sponsor-nav-btn:hover {
  background: #db2777;
  color: #ffffff;
  border-color: #db2777;
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.35);
  transform: translateY(-1px);
}

.sponsor-nav-btn:hover svg {
  color: #ffffff;
  transform: scale(1.15);
}

.new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.new-chat-btn:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
}

.tab-pane {
  display: block;
}

.tab-pane.hidden {
  display: none !important;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Continuous Chat Workspace
   ========================================================================== */
.chat-workspace {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  min-height: 580px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}

/* Empty Starter State */
.chat-starter {
  max-width: 680px;
  margin: 32px auto;
  text-align: center;
}

.starter-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08);
}

.starter-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.starter-subtitle {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}

.starter-chips-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.chips-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

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

.chip-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Chat Messages List */
.chat-messages-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.chat-turn-group {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn 0.25s ease;
}

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

/* User Message Bubble */
.chat-msg-user {
  align-self: flex-end;
  max-width: 80%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.user-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  font-size: 14.5px;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
  word-break: break-word;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

/* Assistant Message Bubble */
.chat-msg-assistant {
  align-self: flex-start;
  width: 100%;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.assistant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.assistant-bubble-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistant-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.msg-status-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.intent-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: capitalize;
}

/* Organic Answer Typography */
.organic-response-body {
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.68;
}

.organic-response-body p {
  margin-bottom: 12px;
}

.organic-response-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.organic-response-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.organic-response-body li {
  margin-bottom: 6px;
}

.streaming-cursor {
  display: inline-block;
  width: 7px;
  height: 16px;
  background: var(--primary);
  vertical-align: text-bottom;
  margin-left: 3px;
  border-radius: 1px;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Key Highlights Box */
.highlights-card {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.highlights-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.highlights-card ul {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.highlights-card li {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  padding-left: 16px;
}

.highlights-card li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

/* Turn Sponsored Recommendations */
.turn-sponsored-container {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-subtle);
}

.turn-sponsored-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sponsored-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.turn-sponsored-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.pill-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.sponsored-badge {
  background: #fef3c7;
  color: #92400e;
}

.organic-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.sponsored-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.sponsored-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
}

.sponsored-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sponsor-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sponsor-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
}

.sponsor-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.disclosure-pill {
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.card-headline {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 8px;
}

.card-body-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  flex-grow: 1;
}

.card-badge-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  align-self: flex-start;
}

.card-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.card-cta-btn {
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

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

/* Educational Notice */
.educational-gating-card {
  background: var(--bg-app);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gating-icon {
  font-size: 22px;
}

.gating-content h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 2px;
}

.gating-content p {
  font-size: 12.5px;
  color: #15803d;
}

/* Sticky Bottom Input Bar */
.chat-input-sticky-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 14px 24px;
}

.chat-input-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-app);
  border: 1.5px solid var(--border-subtle);
  border-radius: 26px;
  padding: 6px 8px 6px 18px;
  transition: all 0.2s ease;
}

.chat-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: var(--bg-surface);
}

.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text-primary);
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  padding: 6px 0;
}

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

.chat-send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.04);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 8px;
  flex-wrap: wrap;
}

.chat-footer-meta kbd {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 10.5px;
  font-family: inherit;
}

.bullet {
  color: var(--border-strong);
}

/* ==========================================================================
   Server Down & Quota Exhaustion Banners
   ========================================================================== */
.server-down-banner {
  background: #fef2f2;
  border: 1.5px solid #ef4444;
  color: #991b1b;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.12);
  animation: bannerShake 0.4s ease;
}

@keyframes bannerShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.status-indicator.down {
  background: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

.chat-input-box.disabled {
  opacity: 0.6;
  pointer-events: none;
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

/* ==========================================================================
   API Quota & Free Tier Health Section
   ========================================================================== */
.quota-dashboard-section {
  margin-bottom: 24px;
}

.quota-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.quota-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.quota-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.quota-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quota-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quota-provider-logo {
  font-size: 22px;
}

.quota-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.quota-card-plan {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.quota-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.quota-status-badge.active {
  background: var(--success-light);
  color: var(--success);
}

.quota-status-badge.exhausted {
  background: var(--danger-light);
  color: var(--danger);
}

.quota-metric-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.quota-metric-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.6px;
}

.quota-metric-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.quota-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.quota-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.quota-progress-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.quota-progress-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.quota-progress-fill.llm-fill {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.quota-card-footer {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   View 2: Search & Ad Stream Log
   ========================================================================== */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dash-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.secondary-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.secondary-btn:hover {
  background: var(--bg-subtle);
}

.danger-btn {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.danger-btn:hover {
  background: #fee2e2;
}

/* Stream Log Table */
.table-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
}

.table-responsive {
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.audit-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.audit-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.audit-table tr:hover td {
  background: #fbfcfe;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 36px !important;
  font-style: italic;
}

.category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.cat-gpu { background: #eff6ff; color: #1e40af; }
.cat-saas { background: #fdf2f8; color: #9d174d; }
.cat-travel { background: #ecfeff; color: #155e75; }
.cat-finance { background: #fefce8; color: #854d0e; }
.cat-edu { background: #f0fdf4; color: #166534; }
.cat-general { background: var(--bg-subtle); color: var(--text-secondary); }

.ads-summary-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ad-summary-pill {
  font-size: 11px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 16px 32px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
  .top-nav {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .main-content {
    padding: 16px 12px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   A2UI AdBanner Component (Canonical v0.9 Lit & Web Component Spec)
   ========================================================================== */
.ad-banner-slot {
  margin-bottom: 16px;
}

.a2ui-ad-banner {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.a2ui-ad-banner:hover {
  border-color: var(--border-strong);
  border-left-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.ad-banner-content {
  flex: 1;
}

.ad-banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.ad-banner-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-banner-favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
}

.ad-banner-sponsor {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.ad-banner-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ad-banner-disclosure {
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ad-banner-headline {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.ad-banner-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ad-banner-action {
  flex-shrink: 0;
}

.ad-banner-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.ad-banner-cta-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

/* Component View Toggle */
.sponsored-view-toggle {
  display: flex;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
  margin-left: 12px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .a2ui-ad-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .ad-banner-action {
    width: 100%;
    margin-top: 8px;
  }
  .ad-banner-cta-btn {
    width: 100%;
    justify-content: center;
  }
}
