/* The app's own pages (home, Narrative Assurance): dark background video, cards, forms, progress. */
/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ──────────────────────────────────────────────────────────── */
:root {
  --black:      #000000;
  --cream:      #FAF0E1;
  --white:      #FFFFFF;
  --blue:       #3369FF;
  --blue-dark:  #1f4fd8;
  --text:       #e8e8e8;
  --muted:      #a0aab4;
  --border:     rgba(255,255,255,0.12);
  --card-bg:    rgba(15,15,25,0.45);
  --card-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.35);
}

/* ── Base ────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

/* ── Background video ───────────────────────────────────────────────── */
#bgVideo {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
}

/* Scrim over the background video. The footage is bright and high-contrast in places,
   which makes hero copy unreadable on some frames. This keeps text legible regardless
   of what's on screen behind it, while still letting the video show through. */
#bgScrim {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% 22%, rgba(0,0,0,0.72), rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.2) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.3) 45%, rgba(0,0,0,0.6) 100%);
}

body {
  font-family: 'Figtree', sans-serif;
  background: transparent;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Navigation ──────────────────────────────────────────────────────── */
.site-nav {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: 'Figtree', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.3px;
  color: var(--white);
  line-height: 1;
  text-decoration: none;
}

.logo .plus { color: var(--blue); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Phones: the header keeps to one line; the full guide name stays in the link's tooltip */
.nav-short-cap { text-transform: none; }
@media (max-width: 600px) {
  .nav-tool-label, .nav-user-name, .nav-long { display: none; }
  .nav-short-cap { text-transform: uppercase; }
  .nav-right { gap: 0.75rem; }
}

.nav-tool-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.01em;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
}

.nav-admin-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  letter-spacing: 0.01em;
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
  transition: background 0.15s;
}

.nav-admin-link:hover { background: rgba(51,105,255,0.15); }

.btn-signout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Figtree', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: border-color 0.15s, color 0.15s;
}

.btn-signout:hover {
  border-color: rgba(255,255,255,0.45);
  color: rgba(255,255,255,0.85);
}

/* ── Sign-in screen ──────────────────────────────────────────────────── */
#signinScreen {
  display: none;
  position: relative;
  min-height: 100vh;
  background: transparent;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

#signinScreen.active { display: flex; }

#signinScreen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}

#signinScreen .signin-card {
  position: relative;
  z-index: 1;
}

.signin-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.signin-logo {
  font-family: 'Figtree', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.3px;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.signin-logo .plus { color: var(--blue); }

.signin-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
  font-weight: 400;
}

.signin-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1.25rem;
}

.btn-signin-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 1.25rem;
  border-radius: 4px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: var(--white);
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 0.75rem;
}

.btn-signin-provider:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.18);
}

.btn-signin-provider:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-signin-provider svg { flex-shrink: 0; }

.signin-error {
  display: none;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: #fff1f2;
  border-left: 3px solid #f43f5e;
  border-radius: 3px;
  font-size: 0.82rem;
  color: #9f1239;
  text-align: left;
}

.signin-error.show { display: block; }

.signin-note {
  margin-top: 1.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── App shell (shown after sign-in) ─────────────────────────────────── */
#appShell { display: none; }
#appShell.active { display: block; }

/* ── Auth loading overlay ────────────────────────────────────────────── */
#authLoading {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: transparent;
}

#authLoading.hidden { display: none; }

.auth-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(51,105,255,0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  background: transparent;
  padding: 7rem 2rem 1rem;
  color: var(--white);
}

.hero-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

/* The Glassbox wordmark is dark artwork, so it is inverted to white on the video. */
.glassbox-mark { height: 15px; width: auto; display: block; filter: brightness(0) invert(1); opacity: 0.85; }
.glassbox-mark.hero-mark { height: 52px; opacity: 1; }

.hero h1 {
  font-family: 'Figtree', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--white);
  max-width: 640px;
  margin: 0 auto;
}

/* The hero "wordmark" is an image, so the h1's text line-height doesn't reserve its
   height: set an explicit height and gap so it can't collide with the paragraph below. */
.hero h1.hero-wordmark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  margin-bottom: 1.75rem;
}

.hero p {
  font-size: 1.05rem;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  max-width: 560px;
  line-height: 1.65;
  margin-top: 1.25rem;
  margin-left: auto;
  margin-right: auto;
}

/* ── Main content ────────────────────────────────────────────────────── */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

/* ── Annual report reading choice (native PDF / text-only) ────────────── */
.ingest-modes { margin: 0.9rem 0; text-align: left; }
.ingest-modes-label {
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 0.5rem;
}
.ingest-mode {
  display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.6rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.10); border-radius: 4px; margin-bottom: 0.5rem;
  cursor: pointer; background: rgba(255,255,255,0.02);
}
.ingest-mode:hover { border-color: rgba(255,255,255,0.24); }
.ingest-mode input { margin-top: 0.2rem; accent-color: var(--blue); flex-shrink: 0; }
.ingest-mode span { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.ingest-mode strong { display: block; color: var(--text); font-size: 0.83rem; margin-bottom: 0.1rem; }

/* Peers to compare with (Full Diagnostic card) */
.peer-panel { margin: -0.4rem 0 1rem; padding: 0.9rem; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; }
.peer-panel[hidden] { display: none; }
.peer-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; }
.peer-hint { font-size: 0.75rem; color: var(--muted); line-height: 1.5; margin: 0.3rem 0 0.6rem; }
.peer-list { list-style: none; margin: 0; padding: 0; }
.peer-list li { margin-bottom: 0.6rem; }
.peer-fields { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 0.4rem; align-items: center; }
.peer-fields .path2-input { margin: 0; padding: 0.55rem 0.7rem; font-size: 0.85rem; }
.peer-reason { font-size: 0.72rem; color: var(--muted); margin: 0.25rem 0 0; line-height: 1.45; }
@media (max-width: 600px) { .peer-fields { grid-template-columns: 1fr auto; } .peer-fields .peer-site { grid-column: 1; grid-row: 2; } }
.btn-link { background: none; border: 0; padding: 0.2rem 0; color: #8aa8ff; font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-link:hover, .btn-link:focus-visible { color: var(--text); }
.btn-link:disabled { opacity: 0.5; cursor: wait; }
.ingest-modes-note { font-size: 0.74rem; color: var(--muted); line-height: 1.5; font-style: italic; }

/* ── Side-by-side path grid ──────────────────────────────────────────── */
.paths-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
}

.paths-grid .card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.paths-grid .card .btn-primary {
  margin-top: auto;
}

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

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  letter-spacing: -0.2px;
}

/* ── Drop zone ───────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--blue);
  background: rgba(51,105,255,0.08);
}

.drop-zone svg {
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.drop-zone p {
  color: var(--muted);
  font-size: 0.95rem;
}

.drop-zone .filename {
  margin-top: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  font-size: 0.95rem;
  word-break: break-all;
}

.drop-zone input[type="file"] { display: none; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  letter-spacing: -0.1px;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--blue);
  color: var(--white);
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.9rem;
  font-size: 1rem;
}

.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
}

.btn-secondary:hover:not(:disabled) { border-color: var(--text); }

.btn-view {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.55);
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.btn-view:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.85); }

/* ── Status bar ──────────────────────────────────────────────────────── */
.status-bar {
  display: none;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-top: 1rem;
}

.status-bar.info  {
  background: rgba(51,105,255,0.15);
  color: #a5b8ff;
  border-left: 3px solid var(--blue);
}
.status-bar.error {
  background: rgba(244,63,94,0.15);
  color: #fda4af;
  border-left: 3px solid #f43f5e;
}
.status-bar.success {
  background: rgba(34,197,94,0.15);
  color: #86efac;
  border-left: 3px solid #22c55e;
}
.status-bar.warning {
  background: rgba(245,158,11,0.15);
  color: #fcd34d;
  border-left: 3px solid #f59e0b;
}
.status-bar.show { display: flex; }
.status-bar { flex-direction: column; gap: 0.5rem; }

.status-bar-row { display: flex; align-items: center; gap: 0.75rem; }
/* The live progress bar spans the full status box (see assets/progress.js) */
.status-progress { align-self: stretch; }

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(51,105,255,0.25);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ── Report section ──────────────────────────────────────────────────── */
#reportsGrid { display: none; }

.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.report-toolbar h2 { margin-bottom: 0.2rem; }

.report-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

/* Report body: pre-wrap during streaming, normal prose when rendered */
.report-body {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
  max-height: 72vh;
  overflow-y: auto;
}

.report-body.rendered { white-space: normal; }

/* Markdown styles inside report */
.report-body.rendered h1,
.report-body.rendered h2,
.report-body.rendered h3,
.report-body.rendered h4 {
  font-family: 'Figtree', sans-serif;
  color: #111;
  margin: 1.5rem 0 0.5rem;
  line-height: 1.25;
  letter-spacing: -0.2px;
}
.report-body.rendered h1 { font-size: 1.2rem; font-weight: 800; }
.report-body.rendered h2 { font-size: 1.05rem; font-weight: 700; }
.report-body.rendered h3 { font-size: 0.95rem; font-weight: 700; }
.report-body.rendered h4 { font-size: 0.9rem;  font-weight: 600; }
.report-body.rendered p  { margin: 0.6rem 0; }
.report-body.rendered ul,
.report-body.rendered ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.report-body.rendered li { margin: 0.3rem 0; }
.report-body.rendered strong { color: #111; }
.report-body.rendered a { color: var(--blue); text-decoration: underline; }

.report-body.rendered table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.85rem;
}
.report-body.rendered th,
.report-body.rendered td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  text-align: left;
}
.report-body.rendered th {
  background: #f3f4f6;
  font-weight: 700;
  color: #111;
}
.report-body.rendered tr:nth-child(even) td { background: #fafafa; }

.report-body.rendered code {
  background: #f3f4f6;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: 'Courier New', monospace;
}
.report-body.rendered pre {
  background: #f3f4f6;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.75rem 0;
}
.report-body.rendered pre code { background: none; padding: 0; }
.report-body.rendered blockquote {
  border-left: 3px solid var(--blue);
  padding-left: 1rem;
  color: var(--muted);
  margin: 0.75rem 0;
}
.report-body.rendered hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* ── Path 2 input ────────────────────────────────────────────────────── */
/* Read by screen readers, not shown */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.path2-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.975rem;
  font-weight: 400;
  color: var(--white);
  background: rgba(255,255,255,0.08);
  transition: border-color 0.2s;
  outline: none;
}

.path2-input:focus { border-color: var(--blue); }
.path2-input::placeholder { color: var(--muted); }

/* ── Narrative Assurance editor ──────────────────────────────────────── */
#assurancePanel { display: none; margin-bottom: 1.5rem; }
#assurancePanel.show { display: block; }
.as-intro { font-size: 0.9rem; color: var(--muted); line-height: 1.6; margin-bottom: 1.25rem; max-width: 75ch; }
.as-section-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); margin: 1.5rem 0 0.75rem; }
.as-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 0.9rem; }
.as-pillar { border: 1px solid rgba(255,255,255,0.12); border-radius: 4px; padding: 0.9rem 1rem; background: rgba(255,255,255,0.03); }
.as-pillar.excluded { opacity: 0.5; }
.as-pillar-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.as-pillar-head strong { color: var(--white); font-size: 0.95rem; }
.as-pillar-head label { font-size: 0.78rem; color: var(--muted); display: flex; gap: 0.35rem; align-items: center; cursor: pointer; }
.as-pillar textarea { width: 100%; min-height: 96px; resize: vertical; padding: 0.6rem 0.7rem; border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: var(--white);
  font: 400 0.88rem/1.5 'Figtree', sans-serif; outline: none; }
.as-pillar textarea:focus { border-color: var(--blue); }
.as-meta { font-size: 0.74rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.45; }
.as-tag { display: inline-block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.1rem 0.45rem; border-radius: 3px; margin-right: 0.35rem; background: rgba(255,255,255,0.1); color: var(--white); }
.as-tag.low { background: rgba(244,63,94,0.2); color: #fda4af; }
.as-tag.medium { background: rgba(245,158,11,0.2); color: #fcd34d; }
.as-tag.high { background: rgba(34,197,94,0.2); color: #86efac; }
.as-tag.edited { background: rgba(51,105,255,0.25); color: #a5b8ff; }
.as-sources { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.as-sources th { text-align: left; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0.4rem; }
.as-sources td { padding: 0.35rem 0.4rem; vertical-align: middle; }
.as-sources input, .as-sources select { width: 100%; padding: 0.45rem 0.55rem; border-radius: 4px; border: 1.5px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06); color: var(--white); font: 400 0.84rem 'Figtree', sans-serif; outline: none; }
.as-sources select option { color: #111; }
.as-remove { background: none; border: 1px solid rgba(255,255,255,0.2); color: var(--muted); border-radius: 4px; padding: 0.35rem 0.6rem; cursor: pointer; font: 600 0.78rem 'Figtree', sans-serif; }
.as-remove:hover { color: var(--white); border-color: var(--white); }
.as-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1.25rem; }
.as-actions .btn { width: auto; padding: 0.75rem 1.5rem; margin-top: 0; }
.as-runs { font-size: 0.85rem; margin-top: 0.75rem; }
.as-runs button { margin: 0.3rem 0.4rem 0 0; }
@media (max-width: 700px) { .as-sources thead { display: none; } .as-sources tr { display: grid; grid-template-columns: 1fr; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.1); } }

/* ── Sources panel ───────────────────────────────────────────────────── */
.sources-panel {
  margin-bottom: 1.25rem;
}

.sources-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 0;
}

.sources-summary::before {
  content: '▶';
  font-size: 0.6rem;
  transition: transform 0.15s;
  display: inline-block;
}

details[open] .sources-summary::before { transform: rotate(90deg); }

.sources-list {
  margin-top: 0.6rem;
  padding-left: 0;
  list-style: none;
}

.sources-list li {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.2rem 0;
  word-break: break-all;
}

.sources-list a {
  color: var(--blue);
  text-decoration: none;
}

.sources-list a:hover { text-decoration: underline; }

/* ── Admin panel ─────────────────────────────────────────────────────── */
#adminPanel { display: none; }
#adminPanel.active { display: block; }

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.admin-tab {
  background: none;
  border: none;
  font-family: 'Figtree', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.admin-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.admin-tab:hover:not(.active) { color: var(--text); }

.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
}

.audit-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.audit-page-info {
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f3f4f6;
  font-weight: 700;
  color: #111;
}

.admin-table tr:nth-child(even) td { background: #fafafa; }

.role-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.role-badge.admin { background: #dbeafe; color: #1e40af; }
.role-badge.user  { background: #f3f4f6; color: #374151; }

.btn-role-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: 'Figtree', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s;
}

.btn-role-toggle:hover { border-color: var(--blue); color: var(--blue); }
.btn-role-toggle:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 0.8rem;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}
.footer-brand { color: var(--white); font-weight: 700; letter-spacing: -0.2px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links a:hover, .footer-links a:focus-visible { color: var(--white); text-decoration: underline; }

/* ── Narrative Assurance's own pages (narrative-assurance.html, assurance-project.html) ── */
.as-page { max-width: 1100px; padding-top: 2rem; }
.as-crumbs { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.25rem; }
.as-crumbs a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.as-crumbs a:hover, .as-crumbs a:focus-visible { color: var(--white); }
.as-page-head { margin-bottom: 1.75rem; }
.as-page-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 300; color: var(--white); letter-spacing: -0.5px; line-height: 1.15; margin: 0.3rem 0 0.75rem; }
.as-page-head > p { color: var(--text); max-width: 75ch; line-height: 1.6; font-size: 0.95rem; }
.as-steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 0.75rem; margin-top: 1.25rem; padding: 0; }
.as-steps li { counter-increment: step; border: 1px solid var(--border); border-radius: 4px; padding: 0.8rem 1rem 0.8rem 3rem;
  position: relative; background: rgba(0,0,0,0.25); font-size: 0.85rem; color: var(--muted); }
.as-steps li::before { content: counter(step); position: absolute; left: 0.9rem; top: 0.8rem; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 1.5px solid var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem; }
.as-steps li strong { display: block; color: var(--text); font-size: 0.92rem; margin-bottom: 0.15rem; }
.as-steps li.current { border-color: var(--blue); background: rgba(51,105,255,0.14); }
.as-steps li.current::before { background: var(--blue); border-color: var(--blue); color: var(--white); }
.as-steps li.done::before { content: "✓"; background: rgba(34,197,94,0.25); border-color: #86efac; color: #86efac; }
.as-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 1.5rem; align-items: start; }
.as-two .card { margin-bottom: 0; }
.as-small { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.5; }
.as-project-list ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.as-project-list a, .as-run-link { display: block; width: 100%; text-align: left; padding: 0.7rem 0.9rem; border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); text-decoration: none; background: rgba(255,255,255,0.04); font: inherit; cursor: pointer; }
.as-project-list a:hover, .as-project-list a:focus-visible, .as-run-link:hover, .as-run-link:focus-visible { border-color: var(--blue); background: rgba(51,105,255,0.12); }
.as-project-list a .as-small, .as-run-link .as-small { margin-left: 0.4rem; }
.as-signed-out { max-width: 520px; margin: 18vh auto 0; position: relative; z-index: 2; }
.as-signed-out a { color: var(--white); }
.as-page #editor, .as-page #runCard { margin-bottom: 1.5rem; }
