/* ============================================================
   PlantBreed Global - Unified Stylesheet
   A plant breeding intelligence platform with dark green theme
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #0a1a0f;
  --bg-secondary: #0d1f12;
  --bg-card: #112118;
  --bg-input: #1a2e22;
  --text-primary: #e8f5e9;
  --text-secondary: #a5d6a7;
  --text-muted: #6b8f71;
  --accent: #2d6a4f;
  --accent-light: #40916c;
  --accent-bright: #52b788;
  --border: #1e3a28;
  --error: #cf6679;
  --success: #4caf50;
  --info: #64b5f6;
  --purple: #9c6ade;
  --purple-bg: #2a1a3e;
  --orange: #fb8c00;
  --blue: #42a5f5;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
  --sidebar-width: 220px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  color: var(--text-primary);
}

/* ---- Utility Classes ---- */
.inline {
  display: inline;
}

.hidden {
  display: none !important;
}

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

.loading {
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
  padding: 2rem;
}

/* ============================================================
   1. App Layout
   ============================================================ */
.app-layout {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

.app-layout.no-sidebar {
  display: flex;
  flex-direction: column;
}

.app-layout.no-sidebar > .main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   2. Sidebar
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  transition: transform 0.3s ease, width 0.3s ease, min-width 0.3s ease;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-brand h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sidebar-brand span {
  color: var(--accent-bright);
}

.region-tabs {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  gap: 4px;
}

.region-tab {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  font-size: 0.9rem;
}

.region-tab:hover {
  background: rgba(45, 106, 79, 0.15);
  color: var(--text-secondary);
}

.region-tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-light);
}

.region-icon {
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.region-icon svg {
  display: block;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

.region-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Sidebar toggle (hamburger) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: background var(--transition);
}

.sidebar-toggle:hover {
  background: var(--accent);
}

/* Collapsed sidebar (mobile) */
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  transform: translateX(-100%);
  overflow: hidden;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================================
   3. Topbar
   ============================================================ */
.topbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 52px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: var(--accent-bright);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  transition: color var(--transition);
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: #ffffff;
  text-decoration: none;
}

.nav-link.active {
  color: #ffffff;
  border-bottom-color: var(--accent-bright);
}

.user-email {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  transition: color var(--transition);
}

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

/* ============================================================
   4. Auth Pages
   ============================================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a1a0f 0%, #0d2818 50%, #0a1a0f 100%);
  padding: 1rem;
}

.auth-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-header h1 {
  font-size: 1.6rem;
  color: var(--accent-bright);
  margin-bottom: 0.3rem;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.15);
}

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

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.verify-info {
  text-align: center;
  color: var(--text-secondary);
  padding: 1rem 0;
  font-size: 0.95rem;
}

.verify-info strong {
  color: var(--text-primary);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.7rem 1.25rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: #3a3a3a;
  color: #888;
  cursor: not-allowed;
  transform: none;
}

/* Flash messages */
.flash {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flash.error {
  background: rgba(207, 102, 121, 0.15);
  border: 1px solid rgba(207, 102, 121, 0.3);
  color: var(--error);
}

.flash.success {
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: var(--success);
}

.flash.info {
  background: rgba(100, 181, 246, 0.15);
  border: 1px solid rgba(100, 181, 246, 0.3);
  color: var(--info);
}

.auth-links {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--accent-bright);
  font-weight: 500;
}

.auth-legal {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.auth-legal a {
  color: var(--text-muted);
}

.auth-legal a:hover {
  color: var(--accent-bright);
}

/* ============================================================
   5. Dashboard
   ============================================================ */
.dashboard {
  max-width: 960px;
  margin: 0 auto;
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-size: 0.95rem;
  font-weight: 500;
}

.mode-btn:hover {
  border-color: var(--accent-light);
  background: rgba(45, 106, 79, 0.1);
  color: var(--text-primary);
}

.mode-btn.active {
  border-color: var(--accent-bright);
  background: rgba(45, 106, 79, 0.2);
  color: #ffffff;
}

.mode-btn .mode-icon {
  font-size: 1.6rem;
}

.mode-btn .mode-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Selection panel */
.selection-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.selection-panel h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.select-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.select-col label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.select-col select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b8f71' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 1.8rem;
  cursor: pointer;
  transition: border-color var(--transition);
}

.select-col select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.select-col select:focus {
  outline: none;
  border-color: var(--accent-bright);
}

.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

.btn-generate:hover {
  background: var(--accent-light);
}

.btn-generate:active {
  transform: scale(0.98);
}

.btn-generate:disabled {
  background: #2a2a2a;
  color: #666;
  cursor: not-allowed;
  transform: none;
}

.limit-warning {
  background: rgba(207, 102, 121, 0.12);
  border: 1px solid rgba(207, 102, 121, 0.4);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

/* NGT Badge */
.ngt-badge {
  display: none;
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid rgba(156, 106, 222, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   6. Progress Toast
   ============================================================ */
.progress-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: toast-slide-up 0.3s ease;
  max-width: 90vw;
}

.progress-toast.hidden {
  display: none;
}

@keyframes toast-slide-up {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.toast-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color var(--transition);
  flex-shrink: 0;
}

.toast-dismiss:hover {
  color: var(--text-primary);
}

/* ============================================================
   7. Results Panel
   ============================================================ */
.results-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.results-header h2 {
  font-size: 1.15rem;
  color: var(--text-primary);
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.results-meta .cached-badge {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: transparent;
  border: 1px solid var(--accent-bright);
  color: var(--accent-bright);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-download:hover {
  background: rgba(82, 183, 136, 0.1);
  color: #ffffff;
  border-color: #ffffff;
  text-decoration: none;
}

/* Report text content */
.report-text {
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.report-text h2 {
  font-size: 1.15rem;
  color: var(--accent-bright);
  margin: 1.5rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.report-text h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin: 1.25rem 0 0.5rem;
}

.report-text h4 {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 1rem 0 0.4rem;
}

.report-text p {
  margin-bottom: 0.75rem;
}

.report-text ul,
.report-text ol {
  margin: 0.5rem 0 0.75rem 1.25rem;
}

.report-text li {
  margin-bottom: 0.3rem;
}

.report-text strong {
  color: var(--text-primary);
}

.report-text code {
  background: var(--bg-input);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--accent-bright);
}

.report-text blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 0.75rem 0;
  background: rgba(45, 106, 79, 0.08);
  color: var(--text-muted);
  font-style: italic;
}

/* Report figures */
.report-figures {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.report-figures svg {
  max-width: 100%;
  height: auto;
}

.report-figures img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* Sources panel */
.sources-panel {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.sources-panel h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: background var(--transition);
}

.source-badge:hover {
  background: rgba(45, 106, 79, 0.15);
}

.source-badge a {
  color: var(--accent-bright);
  font-size: 0.75rem;
}

/* ============================================================
   7b. Inline Progress Panel
   ============================================================ */
.progress-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.progress-panel.hidden {
  display: none;
}

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

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.progress-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.progress-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-elapsed {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.progress-bar-track {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-steps {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
}

.progress-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: relative;
}

.progress-step::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 0.4rem;
}

.progress-step:last-child::after {
  display: none;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.progress-step.active .step-dot {
  border-color: var(--accent-bright);
  background: var(--accent-bright);
  box-shadow: 0 0 6px rgba(82, 183, 136, 0.4);
}

.progress-step.active .step-label {
  color: var(--text-primary);
}

.progress-step.done .step-dot {
  border-color: var(--success);
  background: var(--success);
}

.progress-step.done .step-label {
  color: var(--text-muted);
}

.step-label {
  white-space: nowrap;
}

.progress-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  min-height: 1.2em;
}

/* ============================================================
   7c. References Panel
   ============================================================ */
.references-panel {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.references-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0;
  width: 100%;
  text-align: left;
}

.references-toggle h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.references-icon {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.references-toggle.open .references-icon {
  transform: rotate(180deg);
}

.ref-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.references-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.references-list.hidden {
  display: none;
}

.ref-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.45;
  transition: border-color var(--transition);
}

.ref-item:hover {
  border-color: var(--accent);
}

.ref-num {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.5rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

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

.ref-title {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.15rem;
  word-break: break-word;
}

.ref-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ref-meta a {
  color: var(--accent-bright);
  text-decoration: none;
  font-size: 0.75rem;
}

.ref-meta a:hover {
  text-decoration: underline;
}

.ref-citations {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.ref-source-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.ref-relevance {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  background: rgba(82, 183, 136, 0.08);
  border: 1px solid rgba(82, 183, 136, 0.2);
  color: var(--accent-bright);
}

/* ============================================================
   8. Tables (inside reports and elsewhere)
   ============================================================ */
/* Table scroll wrapper — prevents wide tables from overflowing */
.report-text .table-scroll,
.report-content .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border-radius: var(--radius);
}

.report-text table,
.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.report-text thead th {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--accent-light);
}

.report-text tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.report-text tbody tr:nth-child(even) {
  background: rgba(26, 46, 34, 0.4);
}

.report-text tbody tr:nth-child(odd) {
  background: var(--bg-card);
}

.report-text tbody tr:hover {
  background: rgba(45, 106, 79, 0.15);
}

/* ============================================================
   9. Saved Reports Page
   ============================================================ */
.reports-page {
  max-width: 1100px;
  margin: 0 auto;
}

.reports-page h1 {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
}

.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.reports-table thead th {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  padding: 0.65rem 0.85rem;
  text-align: left;
  white-space: nowrap;
}

.reports-table tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.reports-table tbody tr:nth-child(even) {
  background: rgba(26, 46, 34, 0.4);
}

.reports-table tbody tr:nth-child(odd) {
  background: var(--bg-card);
}

.reports-table tbody tr:hover {
  background: rgba(45, 106, 79, 0.12);
}

.region-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.region-badge.europe {
  background: rgba(66, 165, 245, 0.15);
  color: var(--blue);
  border: 1px solid rgba(66, 165, 245, 0.3);
}

.region-badge.africa {
  background: rgba(251, 140, 0, 0.15);
  color: var(--orange);
  border: 1px solid rgba(251, 140, 0, 0.3);
}

.region-badge.turkey {
  background: rgba(229, 57, 53, 0.15);
  color: #ef5350;
  border: 1px solid rgba(229, 57, 53, 0.3);
}

.region-badge.india {
  background: rgba(255, 152, 0, 0.15);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.region-badge.brazil {
  background: rgba(76, 175, 80, 0.15);
  color: #66bb6a;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.mode-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mode-badge.review {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.mode-badge.patent {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid rgba(156, 106, 222, 0.3);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-sm:hover {
  background: var(--accent);
  border-color: var(--accent-light);
  color: #ffffff;
}

.active-row {
  outline: 2px solid var(--accent-bright);
  outline-offset: -2px;
}

/* Report viewer (inline on My Reports page) */
.report-viewer {
  margin-top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.report-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.report-viewer-header h2 {
  color: var(--text-primary);
  font-size: 1.15rem;
  margin: 0;
}

.report-viewer-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.report-viewer-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.report-viewer-body {
  overflow-x: auto;
}

.report-viewer-body h1 { color: var(--accent-light); font-size: 1.2rem; margin-top: 1.5rem; }
.report-viewer-body h2 { color: var(--accent-light); font-size: 1.05rem; margin-top: 1.25rem; }
.report-viewer-body h3 { color: var(--accent-bright); font-size: 0.95rem; margin-top: 1rem; }
.report-viewer-body p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.65; margin-bottom: 0.5rem; }
.report-viewer-body li { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.25rem; }
.report-viewer-body strong { color: var(--accent-bright); }
.report-viewer-body hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

.report-viewer-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0.75rem 0;
}
.report-viewer-body th {
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-weight: 600;
}
.report-viewer-body td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  color: var(--text-secondary);
}
.report-viewer-body tr:nth-child(even) td {
  background: rgba(45, 106, 79, 0.05);
}

.report-viewer-body .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.75rem 0;
}

.report-viewer-figures {
  margin-top: 1rem;
}

.report-viewer-figures svg {
  max-width: 100%;
  height: auto;
  text-decoration: none;
}

.btn-sm.danger:hover {
  background: rgba(207, 102, 121, 0.2);
  border-color: var(--error);
  color: var(--error);
}

/* ============================================================
   10. Samples Page
   ============================================================ */
.samples-page {
  max-width: 900px;
  margin: 0 auto;
}

.samples-page h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.samples-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.samples-page h2 {
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.samples-page .subtitle,
.samples-page .page-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.sample-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.sample-tab {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.sample-tab:hover {
  border-color: var(--accent);
  color: var(--text-secondary);
}

.sample-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sample-region {
  /* wrapper for each region's sample cards */
}

.cta {
  text-align: center;
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.cta p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.sample-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sample-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.sample-card:hover {
  border-color: var(--accent);
}

.sample-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.sample-header:hover {
  background: rgba(45, 106, 79, 0.08);
}

.sample-header h3 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin: 0.25rem 0;
}

.sample-mode {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.sample-mode.review {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.sample-mode.patent {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid rgba(156, 106, 222, 0.3);
}

.sample-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.sample-tags .tag {
  display: inline-block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sample-report {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.sample-report .report-content h2 {
  color: var(--accent-light);
  font-size: 1.1rem;
  margin-top: 0;
}

.sample-report .report-content h3 {
  color: var(--accent-bright);
  font-size: 0.95rem;
  margin-top: 1.25rem;
}

.sample-report .report-content p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.sample-report .report-content {
  overflow-x: auto;
}

.sample-report .report-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0.75rem 0;
  min-width: 500px;
}

.sample-report .report-content th {
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-weight: 600;
}

.sample-report .report-content td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  color: var(--text-secondary);
}

.sample-report .report-content tr:nth-child(even) td {
  background: rgba(45, 106, 79, 0.05);
}

.sample-report .report-content ul,
.sample-report .report-content ol {
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.sample-report .report-content li {
  margin-bottom: 0.3rem;
}

.report-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.report-disclaimer {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.tag.ngt {
  background: var(--purple-bg, rgba(156, 106, 222, 0.15));
  color: var(--purple, #9c6ade);
  border-color: rgba(156, 106, 222, 0.3);
}

/* ============================================================
   11. Legal Pages (Terms, Privacy)
   ============================================================ */
.legal-page {
  max-width: 780px;
  margin: 0 auto;
  padding-bottom: 3rem;
}

.legal-page h1 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.legal-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.legal-tab {
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.legal-tab:hover {
  color: var(--text-secondary);
}

.legal-tab.active {
  color: var(--accent-bright);
  border-color: var(--border);
  border-bottom-color: var(--bg-primary);
  background: var(--bg-primary);
}

/* ============================================================
   12. Footer
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: auto;
}

.site-footer a {
  color: var(--accent-bright);
  margin: 0 0.35rem;
}

.site-footer a:hover {
  color: #ffffff;
}

/* ============================================================
   13. AI Disclosure Banner
   ============================================================ */
.ai-disclosure-banner {
  background: rgba(45, 106, 79, 0.1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   15. Cached Badge
   ============================================================ */
.cached-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.3);
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ============================================================
   16. Cards (General-purpose)
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.empty-state {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2.5rem 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.empty-state-text {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ============================================================
   17. Form Elements (shared)
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* ============================================================
   18. Scrollbar Styling
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ============================================================
   20. Responsive Breakpoints
   ============================================================ */

/* Tablet and below */
@media (max-width: 768px) {
  /* Sidebar collapses */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 150;
    transform: translateX(0);
    transition: transform 0.3s ease;
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
  }

  .sidebar-toggle {
    display: block;
  }

  .sidebar-brand {
    padding: 1rem;
    padding-top: 0.75rem;
    text-align: center;
    font-size: 1.2rem;
  }

  /* Main area takes full width */
  .app-layout {
    flex-direction: column;
  }

  .main-area {
    width: 100%;
  }

  /* Topbar adjustments */
  .topbar {
    padding: 0 1rem;
    padding-left: 3rem; /* space for hamburger */
  }

  .topbar-left {
    gap: 0.75rem;
  }

  .tagline-sm {
    font-size: 0.72rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-link {
    font-size: 0.82rem;
  }

  .user-email {
    display: none;
  }

  /* Dashboard grids */
  .mode-selector {
    grid-template-columns: 1fr;
  }

  .select-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Results */
  .results-panel {
    padding: 1rem;
    margin-top: 1rem;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .results-header h2 {
    font-size: 1rem;
    word-break: break-word;
  }

  .btn-download {
    width: 100%;
    justify-content: center;
  }

  /* Report text */
  .report-text {
    font-size: 0.88rem;
  }

  .report-text h2 {
    font-size: 1.05rem;
  }

  .report-text h3 {
    font-size: 0.95rem;
  }

  /* Tables need horizontal scroll on mobile */
  .report-text .table-scroll,
  .report-content .table-scroll {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0 1rem;
  }

  /* Figures */
  .report-figures {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    padding: 0.75rem;
  }

  /* Progress panel */
  .progress-panel {
    padding: 1rem;
    margin-top: 1rem;
  }

  .progress-title {
    font-size: 0.85rem;
  }

  .progress-steps {
    flex-direction: column;
    gap: 0.25rem;
  }

  .progress-step {
    padding: 0.3rem 0;
  }

  .progress-step::after {
    display: none;
  }

  .step-label {
    font-size: 0.72rem;
  }

  /* References */
  .ref-item {
    padding: 0.5rem 0.6rem;
    gap: 0.5rem;
  }

  .ref-title {
    font-size: 0.82rem;
  }

  .ref-meta {
    font-size: 0.7rem;
    gap: 0.3rem;
  }

  /* Sources panel */
  .sources-panel {
    margin-top: 1rem;
  }

  .source-badge {
    font-size: 0.7rem;
  }

  /* Reports table → card layout on mobile */
  .reports-table-wrap {
    overflow-x: visible;
  }

  .reports-table {
    font-size: 0.82rem;
  }

  .reports-table thead {
    display: none;
  }

  .reports-table tbody tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .reports-table tbody tr:hover {
    border-color: var(--accent);
  }

  .reports-table tbody td {
    display: block;
    padding: 0.15rem 0;
    border-bottom: none;
    text-align: left;
  }

  .reports-table tbody td::before {
    content: attr(data-label);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.1rem;
  }

  /* Hide empty label on actions cell */
  .reports-table tbody td[data-label=""]::before {
    display: none;
  }

  /* Actions row: buttons left-aligned */
  .reports-table tbody td:last-child {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
  }

  /* Report viewer on saved reports page */
  .report-viewer {
    padding: 0.75rem;
    overflow: hidden;
  }

  .report-viewer-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .report-viewer-header h2 {
    font-size: 0.95rem;
    word-break: break-word;
  }

  .report-viewer-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }

  .report-viewer-actions .btn-sm {
    flex: 1;
    text-align: center;
  }

  /* Report viewer body — contain width on mobile */
  .report-viewer-body {
    overflow-x: hidden;
    max-width: 100%;
  }

  .report-viewer-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    font-size: 0.72rem;
  }

  .report-viewer-body .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding: 0 0.75rem;
  }

  .report-viewer-body p,
  .report-viewer-body li {
    font-size: 0.82rem;
    word-break: break-word;
  }

  .report-viewer-body h1 { font-size: 1rem; }
  .report-viewer-body h2 { font-size: 0.92rem; }
  .report-viewer-body h3 { font-size: 0.85rem; }

  .report-viewer-figures {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Sample cards */
  .sample-header h3 {
    font-size: 0.88rem;
  }
}

/* Mobile */
@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .topbar {
    height: 48px;
    padding-left: 2.8rem;
  }

  .topbar-right {
    gap: 0.4rem;
  }

  .topbar-right .nav-link {
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
  }

  .btn-text {
    font-size: 0.78rem;
  }

  .tagline-sm {
    display: none;
  }

  /* Auth */
  .auth-container {
    padding: 1.5rem 1.25rem 1.25rem;
  }

  .auth-header h1 {
    font-size: 1.4rem;
  }

  /* Dashboard */
  .dashboard {
    padding: 0;
  }

  .select-row {
    grid-template-columns: 1fr;
  }

  .selection-panel {
    padding: 1rem;
  }

  .mode-btn {
    padding: 1rem 0.75rem;
  }

  .mode-btn .mode-desc {
    font-size: 0.7rem;
  }

  .btn-generate {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
  }

  /* Results */
  .results-panel {
    padding: 0.75rem;
    border-radius: var(--radius);
  }

  .results-meta {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .report-text {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .report-text table {
    font-size: 0.75rem;
  }

  .report-text thead th {
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
  }

  .report-text tbody td {
    padding: 0.35rem 0.5rem;
  }

  .report-figures {
    padding: 0.5rem;
  }

  /* Progress panel */
  .progress-panel {
    padding: 0.75rem;
  }

  .progress-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .progress-detail {
    font-size: 0.75rem;
  }

  /* References */
  .references-panel {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }

  .references-toggle h3 {
    font-size: 0.8rem;
  }

  .ref-item {
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem;
  }

  .ref-num {
    font-size: 0.7rem;
  }

  .ref-title {
    font-size: 0.8rem;
  }

  .ref-meta {
    font-size: 0.68rem;
  }

  /* Reports page */
  .reports-page {
    padding: 0 0.25rem;
  }

  .topbar-reports {
    flex-wrap: wrap;
    height: auto;
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
  }

  .topbar-reports .topbar-left {
    width: 100%;
  }

  .topbar-reports .topbar-right {
    width: 100%;
    justify-content: flex-start;
  }

  .page-title {
    font-size: 1rem;
  }

  .report-viewer-body {
    font-size: 0.85rem;
  }

  /* Legal */
  .legal-page {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .legal-tabs {
    flex-wrap: wrap;
  }

  /* Footer */
  .site-footer {
    font-size: 0.72rem;
  }
}

/* ============================================================
   21. Print Styles
   ============================================================ */
@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .topbar,
  .site-footer,
  .progress-toast,
  .btn-download,
  .btn-generate,
  .mode-selector,
  .selection-panel,
  .ai-disclosure-banner {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #1a1a1a;
  }

  .main-area {
    width: 100%;
  }

  .results-panel {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .report-text {
    color: #333;
  }

  .report-text h2,
  .report-text h3 {
    color: #1a1a1a;
  }

  .report-text table {
    border: 1px solid #ccc;
  }

  .report-text thead th {
    background: #2d6a4f;
    color: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report-text tbody td {
    border: 1px solid #ddd;
    color: #333;
  }
}

/* ============================================================
   21b. About Page
   ============================================================ */
.about-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.about-hero {
  text-align: center;
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.about-hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 1rem;
}

.about-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.about-cta {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary-sm {
  padding: 0.4rem 1rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition);
}

.btn-primary-sm:hover {
  background: var(--accent-light);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.5rem;
  background: transparent;
  border: 1px solid var(--accent-bright);
  color: var(--accent-bright);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-outline:hover {
  background: rgba(82, 183, 136, 0.1);
  color: #fff;
}

.about-section {
  margin-bottom: 2.5rem;
}

.about-section h2 {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.about-section > p {
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.about-card h3 {
  font-size: 1.05rem;
  color: var(--accent-bright);
  margin-bottom: 0.5rem;
}

.about-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.about-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.about-card li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
  padding-left: 1rem;
  position: relative;
}

.about-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.about-regions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.about-region-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.about-region-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.about-region-card span {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.about-sources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.about-source {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.about-source strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.about-source span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.about-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.about-step strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.about-step p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.about-bottom-cta {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.about-bottom-cta h2 {
  margin-bottom: 0.4rem;
}

.about-bottom-cta p {
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .about-hero h1 {
    font-size: 1.6rem;
  }

  .about-subtitle {
    font-size: 0.92rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-regions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .about-page {
    padding: 1rem 1rem 2rem;
  }

  .about-hero {
    padding: 2rem 0 1.5rem;
  }

  .about-hero h1 {
    font-size: 1.4rem;
  }

  .about-section h2 {
    font-size: 1.15rem;
  }

  .about-cta {
    flex-direction: column;
  }

  .about-cta a {
    text-align: center;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   23. Selection & Highlight
   ============================================================ */
::selection {
  background: rgba(45, 106, 79, 0.4);
  color: #ffffff;
}

::-moz-selection {
  background: rgba(45, 106, 79, 0.4);
  color: #ffffff;
}
