:root {
  --ink: #0f172a;
  --ink-secondary: #475569;
  --muted: #64748b;
  --green: #059669;
  --green-hover: #047857;
  --green-light: #ecfdf5;
  --green-border: #a7f3d0;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1060px;
  margin: auto;
  padding: 0 24px;
}

/* ── Modern SaaS Header & Navbar ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28);
  transition: transform 0.2s ease;
}
.brand-group:hover .brand-logo {
  transform: scale(1.04);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #0f172a;
  line-height: 1.15;
}

.brand-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #059669;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: pulse-glow 2.5s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Language Switcher Segment Control ── */
.lang-switch {
  display: inline-flex;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.lang-btn {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.active {
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  cursor: default;
}

.home-blog-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid rgba(5, 150, 105, 0.14);
  border-radius: 7px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.home-blog-link svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.home-blog-link:hover {
  border-color: rgba(5, 150, 105, 0.3);
  background: #d1fae5;
  box-shadow: 0 2px 5px rgba(5, 150, 105, 0.12);
  transform: translateY(-1px);
}

.home-blog-link:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* ── Content Layout ── */
main.shell {
  padding-top: 32px;
  padding-bottom: 48px;
}

/* ── Hero & Search ── */
.eyebrow {
  margin: 0 0 6px;
  color: #059669;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.hero {
  background: linear-gradient(180deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #d1fae5;
  border-radius: 20px;
  padding: 36px 36px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-sm);
}

.hero h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: #064e3b;
  margin: 0 0 10px;
  line-height: 1.25;
}

.hero > p:not(.eyebrow) {
  color: #374151;
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.6;
  max-width: 800px;
}

.search {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 6px 8px 6px 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search > span {
  font-size: 22px;
  color: #94a3b8;
}

.search input {
  border: 0;
  outline: 0;
  flex: 1;
  min-width: 0;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
}

button, .file-button {
  border: 0;
  cursor: pointer;
  background: var(--green);
  color: white;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease;
}
button:hover, .file-button:hover {
  background: var(--green-hover);
}
button:active, .file-button:active {
  transform: scale(0.98);
}

.notice {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 12px 18px;
  border-radius: 12px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
}

/* ── Section Titles ── */
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #0f172a;
  margin: 0;
}
.section-title > span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.count {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 2px;
  margin-left: 6px;
}

/* ── Search Results ── */
.results { margin-bottom: 40px; }

.result, .document {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 16px;
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.result:hover, .document:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.file-icon {
  flex: none;
  width: 44px;
  height: 48px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #059669;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  border: 1px solid #e2e8f0;
}

.result-body h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.result-body { flex: 1 1 0; min-width: 0; }
.result-body h3 a, .document-info a {
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.result-body h3 a:hover, .document-info a:hover {
  color: var(--green);
  text-decoration: underline;
}
.result-body > p {
  font-size: 13.5px;
  line-height: 1.6;
  color: #475569;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.result-body > .result-section {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 5px;
}
.result-section span { color: #64748b; font-weight: 500; }
.result-body > .result-context { white-space: pre-line; }
.result-context strong {
  color: #111827;
  font-weight: 800;
  background: #fef3c7;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Upload progress overlay ── */
.upload-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 45%, rgba(30, 64, 90, .76), rgba(7, 18, 32, .82));
  backdrop-filter: blur(12px) saturate(125%);
}
.upload-progress-overlay[hidden] { display: none; }
body.upload-in-progress { overflow: hidden; }
.upload-progress-card {
  width: min(100%, 480px);
  padding: 34px 34px 27px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 24px;
  background: linear-gradient(155deg, #fff 5%, #f8fbff 100%);
  box-shadow: 0 32px 100px rgba(2, 12, 27, .38), 0 4px 14px rgba(2, 12, 27, .12);
  text-align: center;
  animation: upload-card-in .28s cubic-bezier(.2,.8,.2,1) both;
}
.upload-progress-visual {
  position: relative;
  display: grid;
  width: 90px;
  height: 90px;
  margin: 0 auto 22px;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, #ecfdf5 0 54%, #dcfce7 55% 100%);
  box-shadow: 0 8px 28px rgba(16, 185, 129, .15);
}
.upload-progress-orbit {
  position: absolute;
  inset: -5px;
  border: 2px solid transparent;
  border-top-color: #10b981;
  border-right-color: #34d399;
  border-radius: 50%;
  animation: upload-spin 1.05s linear infinite;
}
.upload-progress-orbit span {
  position: absolute;
  top: 6px;
  right: 9px;
  width: 8px;
  height: 8px;
  border: 2px solid white;
  border-radius: 50%;
  background: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}
.upload-progress-orbit span + span {
  top: auto;
  right: auto;
  bottom: 9px;
  left: 4px;
  width: 6px;
  height: 6px;
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .14);
}
.upload-progress-file { width: 34px; height: 34px; color: #047857; }
.upload-progress-card h2 { margin: 0 0 9px; color: var(--ink); font-size: 21px; letter-spacing: -.025em; }
.upload-progress-card > p:not(.upload-progress-filename) { max-width: 370px; margin: 0 auto; color: #64748b; font-size: 14px; line-height: 1.65; }
.upload-progress-track {
  height: 6px;
  margin: 24px 0 17px;
  overflow: hidden;
  border-radius: 99px;
  background: #e6edf4;
}
.upload-progress-track span {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #059669, #34d399 55%, #60a5fa);
  box-shadow: 0 0 14px rgba(16, 185, 129, .42);
  animation: upload-progress 1.6s cubic-bezier(.45,.05,.55,.95) infinite;
}
.upload-progress-track.is-uploading span {
  width: var(--upload-progress-value, 0%);
  transform: none;
  animation: none;
  transition: width .16s ease-out;
}
.upload-progress-track.is-processing span { width: 34%; }
.upload-progress-percent { min-height: 16px; margin: -9px 0 14px; color: #64748b; font-size: 11px; font-weight: 650; }
.upload-progress-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.upload-progress-stages li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 650;
}
.upload-progress-stages li span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 50%;
  color: #047857;
  background: #d1fae5;
  font-size: 10px;
  font-weight: 800;
}
.upload-progress-stages li.is-active { color: #047857; }
.upload-progress-stages li.is-active span { color: #fff; background: #059669; box-shadow: 0 0 0 4px #d1fae5; }
.upload-progress-stages li.is-complete span { color: #fff; background: #059669; font-size: 0; }
.upload-progress-stages li.is-complete span::after { content: "✓"; font-size: 11px; }
.upload-progress-card > .upload-progress-filename {
  margin: 17px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}
.upload-progress-error { margin: 16px 0 0; padding: 11px 13px; border: 1px solid #fecaca; border-radius: 10px; color: #b91c1c; background: #fef2f2; font-size: 13px; line-height: 1.5; }
.upload-progress-close { margin-top: 15px; padding: 10px 16px; border: 0; border-radius: 9px; color: white; background: #047857; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.upload-progress-close:hover { background: #065f46; }
@keyframes upload-card-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes upload-spin { to { transform: rotate(360deg); } }
@keyframes upload-progress {
  0% { transform: translateX(-120%); }
  55% { transform: translateX(120%); }
  100% { transform: translateX(330%); }
}
@media (prefers-reduced-motion: reduce) {
  .upload-progress-card { animation: none; }
  .upload-progress-orbit, .upload-progress-track.is-processing span { animation: none; }
  .upload-progress-track span { width: 100%; transform: none; }
  .home-blog-link { transition: none; }
}
@media (max-width: 480px) {
  .upload-progress-card { padding: 28px 20px 22px; }
  .upload-progress-stages { gap: 3px; }
  .upload-progress-stages li { flex-direction: column; gap: 5px; font-size: 10px; }
}

.meta {
  display: flex;
  gap: 16px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

/* ── Library & Upload ── */
.library {
  border-top: 1px solid var(--line);
  padding-top: 36px;
}

.columns {
  display: grid;
  grid-template-columns: 0.82fr 1.38fr;
  gap: 20px;
}

.upload-card {
  background: white;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.upload-symbol {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ecfdf5;
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 24px;
}
.upload-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 14px 0 6px;
}
.upload-card p, .upload-card small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.file-button {
  display: inline-block;
  margin: 14px 0 10px;
}
.file-button input { display: none; }

.document-list { min-width: 0; }
.document {
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.document-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.document-info strong {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-info span {
  font-size: 11.5px;
  color: var(--muted);
}

.delete {
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
}
.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.empty {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

footer {
  text-align: center;
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding-top: 24px;
  color: #94a3b8;
  font-size: 12.5px;
}

/* ── AI Mode Bar & Toggle ── */
.ai-mode-bar {
  display: block;
  margin-top: 14px;
}

.ai-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 6px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ai-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #334155;
  border: 0;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-sparkle {
  font-size: 14px;
}

.ai-toggle-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}

.ai-switch-pill {
  width: 32px;
  height: 18px;
  background: #cbd5e1;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background 0.2s ease;
  margin-left: 4px;
}

.ai-switch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ai-toggle-btn.active {
  background: #ecfdf5;
  color: #065f46;
}

.ai-toggle-btn.active .ai-toggle-badge {
  background: #10b981;
  color: white;
}

.ai-toggle-btn.active .ai-switch-pill {
  background: #10b981;
}

.ai-toggle-btn.active .ai-switch-dot {
  transform: translateX(14px);
}

.ai-settings-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  font-size: 14px;
  border-radius: 8px;
  color: #64748b;
  transition: background 0.15s ease;
}
.ai-settings-btn:hover {
  background: #e2e8f0;
}

.ai-mode-panel {
  width: min(100%, 760px);
  margin-top: 12px;
}

.ai-question-form {
  padding: 16px;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.07);
}

.ai-question-form > label,
.ai-scope-control > span {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.ai-question-form textarea {
  display: block;
  width: 100%;
  min-height: 68px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-question-form textarea:focus,
.ai-scope-control select:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.13);
}

.ai-question-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.ai-scope-control {
  flex: 1;
  min-width: 0;
}

.ai-scope-control select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  outline: none;
  background: white;
  color: #334155;
  font: inherit;
  font-size: 13px;
}

.ai-ask-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 13px;
}

/* ── AI Direct Answer Card ── */
.ai-answer-card {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  border: 1px solid #86efac;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 28px;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12);
}

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

.ai-question-heading {
  margin: -5px 0 12px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.ai-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #065f46;
}

.ai-card-icon {
  font-size: 18px;
}

.ai-gemini-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #dcfce7;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.ai-card-close {
  background: transparent;
  border: 0;
  font-size: 20px;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.ai-card-close:hover {
  color: #0f172a;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #047857;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 0;
}

.ai-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #a7f3d0;
  border-top-color: #059669;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.ai-text {
  font-size: 14.5px;
  line-height: 1.65;
  color: #1e293b;
  margin-bottom: 16px;
}
.ai-text p {
  margin: 0 0 10px;
}
.ai-text p:last-child {
  margin-bottom: 0;
}

.ai-sources-wrap {
  border-top: 1px solid #d1fae5;
  padding-top: 12px;
  margin-top: 14px;
}

.ai-sources-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #059669;
  margin-bottom: 8px;
}

.ai-sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-source-chip {
  display: inline-flex;
  align-items: center;
  background: white;
  border: 1px solid #a7f3d0;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #047857;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.ai-source-chip:hover {
  background: #ecfdf5;
  border-color: #34d399;
  transform: translateY(-1px);
}

.ai-error {
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

/* ── Gemini API Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: white;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}
.modal-close-x {
  background: transparent;
  border: 0;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}
.modal-close-x:hover { color: #0f172a; }

.modal-body {
  padding: 22px 24px;
}
.modal-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
  margin: 0 0 16px;
}

.modal-link-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.modal-link-box a {
  color: #047857;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
}
.modal-link-box a:hover {
  text-decoration: underline;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 14px;
  outline: 0;
  box-sizing: border-box;
  font-family: monospace;
}
.form-group input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.modal-note {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.btn-primary {
  background: #059669;
  color: white;
  border: 0;
  border-radius: 9px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: #047857; }

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #fecaca; }

/* ── Mobile Responsive ── */
@media (max-width: 720px) {
  .shell { padding: 0 14px; }
  .header-inner { height: 60px; }
  .privacy-badge { display: none; }
  .brand-badge { display: none; }
  .hero {
    padding: 22px 18px;
    border-radius: 16px;
    margin-bottom: 24px;
  }
  .hero h2 { font-size: 22px; }
  .hero > p:not(.eyebrow) { font-size: 13.5px; }
  .columns { grid-template-columns: 1fr; gap: 16px; }
  .result { gap: 12px; padding: 14px; }
  .search { height: 50px; padding-left: 14px; }
  .search input { font-size: 13.5px; }
  .search button { padding: 10px 16px; font-size: 13px; }
  .ai-question-form { padding: 13px; }
  .ai-question-controls { align-items: stretch; flex-direction: column; }
  .ai-ask-button { width: 100%; }
  .ai-answer-card { padding: 18px 16px; }
  .modal-card { margin: 12px; }
}

/* ── Drag & Drop Upload ── */
.upload-card {
  transition: all 0.2s ease;
}
.upload-card.is-dragover {
  border-color: #059669;
  background: #ecfdf5;
  transform: scale(1.01);
}
.drop-hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: #059669;
  font-weight: 500;
}

/* ── Result Score, Page Link & Show More ── */
.result-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.relevance-score {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.page-link-badge {
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 11.5px;
  transition: all 0.15s ease;
}
.page-link-badge:hover {
  background: #d1fae5;
}
.show-more-wrap {
  text-align: center;
  margin: 22px 0;
}
.show-more-btn {
  display: inline-block;
  padding: 9px 20px;
  background: #ffffff;
  color: #059669;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.show-more-btn:hover {
  background: #f0fdf4;
  border-color: #a7f3d0;
}

/* ── Cookie Consent Banner ── */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cookie-content strong {
  font-size: 14px;
  color: #0f172a;
  display: block;
  margin-bottom: 4px;
}
.cookie-content p {
  font-size: 12.5px;
  color: #475569;
  margin: 0;
  line-height: 1.45;
}
.cookie-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.cookie-btn {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  border: 0;
}
.cookie-accept {
  background: #059669;
  color: #ffffff;
}
.cookie-accept:hover {
  background: #047857;
}
.cookie-reject {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.cookie-reject:hover {
  background: #e2e8f0;
}

/* ── SEO & AI Discovery Section ── */
.seo-discovery {
  margin: 48px 0 32px;
  padding: 36px 30px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.seo-discovery-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 32px;
}

.seo-discovery-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #0f172a;
  margin: 8px 0 12px;
  line-height: 1.3;
}

.seo-discovery-lead {
  font-size: 14px;
  line-height: 1.65;
  color: #475569;
  margin: 0;
}

.seo-pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.seo-pillar-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.seo-pillar-card:hover {
  transform: translateY(-2px);
  border-color: #a7f3d0;
}

.seo-pillar-icon {
  font-size: 24px;
  margin-bottom: 10px;
  line-height: 1;
}

.seo-pillar-card h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
}

.seo-pillar-card p {
  font-size: 12.5px;
  line-height: 1.55;
  color: #64748b;
  margin: 0;
}

.seo-faq-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 28px;
}

.seo-faq-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px;
  text-align: center;
}

.seo-faq-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 780px;
  margin: 0 auto;
}

.seo-faq-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.seo-faq-item[open] {
  background: #ffffff;
  border-color: #cbd5e1;
}

.seo-faq-item summary {
  font-size: 13.5px;
  color: #1e293b;
  outline: none;
  user-select: none;
}

.seo-faq-item p {
  margin: 10px 0 2px;
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
}

@media (max-width: 640px) {
  .seo-discovery {
    padding: 24px 16px;
    margin: 32px 0 20px;
  }
  .seo-discovery-header h2 {
    font-size: 19px;
  }
  .seo-pillars-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ── Air-Gapped Local Mode Card ── */
.airgap-card {
  margin-bottom: 24px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 14px;
  padding: 16px 20px;
  transition: all 0.25s ease;
}
.airgap-card.is-active {
  background: #ecfdf5;
  border-color: #059669;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.15);
}
.airgap-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.airgap-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.airgap-shield {
  font-size: 20px;
}
.airgap-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.airgap-card.is-active .airgap-badge {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
}
.airgap-desc-text {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #166534;
}
.airgap-switch-label {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}
.airgap-checkbox {
  opacity: 0;
  width: 0;
  height: 0;
}
.airgap-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}
.airgap-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.airgap-checkbox:checked + .airgap-slider {
  background-color: #059669;
}
.airgap-checkbox:checked + .airgap-slider:before {
  transform: translateX(22px);
}

/* ── Visual Page Snapshot Evidence ── */
.result-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.preview-snapshot-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.preview-snapshot-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #059669;
}
.snapshot-preview-drawer {
  margin-top: 14px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  animation: fadeIn 0.2s ease-out;
}
.snapshot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.snapshot-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}
.snapshot-open-link {
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  text-decoration: none;
}
.snapshot-open-link:hover {
  text-decoration: underline;
}
.snapshot-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  min-height: 180px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.snapshot-canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
.snapshot-loading {
  font-size: 13px;
  color: #64748b;
  padding: 40px 20px;
}

/* AI Answer Visual Source Cards */
.ai-sources-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.ai-source-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.ai-source-card:hover {
  transform: translateY(-2px);
  border-color: #10b981;
}
.ai-source-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ai-source-doc-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-source-page-badge {
  font-size: 11px;
  font-weight: 600;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.ai-source-thumb-wrap {
  width: 100%;
  min-height: 140px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.ai-source-thumb-wrap canvas {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}
.ai-source-open-btn {
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  text-align: right;
  text-decoration: none;
}
.ai-source-open-btn:hover {
  text-decoration: underline;
}

/* ── Dark Mode (Desktop only - disabled on mobile phones) ── */
@media (prefers-color-scheme: dark) and (min-width: 769px) {
  :root {
    --ink: #f8fafc;
    --ink-secondary: #cbd5e1;
    --muted: #94a3b8;
    --line: #334155;
    --bg: #090d16;
    --white: #0f172a;
  }
  body {
    background: var(--bg);
    color: var(--ink);
  }
  .site-header {
    background: rgba(15, 23, 42, 0.92);
    border-bottom-color: #334155;
  }
  .brand-name { color: #f8fafc; }
  .hero {
    background: #0f172a;
    border-color: #334155;
  }
  .hero h2 { color: #f8fafc; }
  .search {
    background: #1e293b;
    border-color: #475569;
  }
  .search input { color: #f8fafc; }
  .result, .document, .upload-card {
    background: #0f172a;
    border-color: #334155;
  }
  .result h3 a, .document-info strong {
    color: #f8fafc;
  }
  .modal-card {
    background: #0f172a;
    border-color: #334155;
  }
  .modal-header, .modal-footer {
    border-color: #334155;
    background: #0f172a;
  }
  .form-group input {
    background: #1e293b;
    border-color: #475569;
    color: #f8fafc;
  }
  .cookie-banner {
    background: #0f172a;
    border-color: #334155;
  }
  .cookie-content strong { color: #f8fafc; }
  .cookie-content p { color: #cbd5e1; }
  .cookie-reject {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
  }
  .ai-answer-card {
    background: #0f172a;
    border-color: #334155;
  }
  .ai-mode-panel {
    background: #0f172a;
    border-color: #334155;
  }
  .ai-question-form textarea, #ai-document-select {
    background: #1e293b;
    border-color: #475569;
    color: #f8fafc;
  }
  .show-more-btn {
    background: #0f172a;
    border-color: #334155;
  }
  .seo-discovery {
    background: #0f172a;
    border-color: #334155;
  }
  .seo-discovery-header h2 {
    color: #f8fafc;
  }
  .seo-discovery-lead {
    color: #cbd5e1;
  }
  .seo-pillar-card {
    background: #1e293b;
    border-color: #334155;
  }
  .seo-pillar-card h3 {
    color: #f8fafc;
  }
  .seo-pillar-card p {
    color: #94a3b8;
  }
  .seo-faq-section {
    border-top-color: #334155;
  }
  .seo-faq-title {
    color: #f8fafc;
  }
  .seo-faq-item {
    background: #1e293b;
    border-color: #334155;
  }
  .seo-faq-item[open] {
    background: #0f172a;
    border-color: #475569;
  }
  .seo-faq-item summary {
    color: #f8fafc;
  }
  .seo-faq-item p {
    color: #cbd5e1;
  }
  .airgap-card {
    background: #0f172a;
    border-color: #334155;
  }
  .airgap-card.is-active {
    background: #064e3b;
    border-color: #059669;
  }
  .airgap-desc-text {
    color: #cbd5e1;
  }
  .preview-snapshot-btn {
    background: #1e293b;
    border-color: #475569;
    color: #f8fafc;
  }
  .preview-snapshot-btn:hover {
    background: #334155;
  }
  .snapshot-preview-drawer {
    background: #1e293b;
    border-color: #334155;
  }
  .snapshot-title {
    color: #f8fafc;
  }
  .snapshot-canvas-wrap {
    background: #0f172a;
    border-color: #334155;
  }
  .ai-source-card {
    background: #1e293b;
    border-color: #334155;
  }
  .ai-source-doc-name {
    color: #f8fafc;
  }
  .ai-source-thumb-wrap {
    background: #0f172a;
    border-color: #334155;
  }
}
