:root {
  color-scheme: light;
  --ink: #17191d;
  --muted: #626973;
  --paper: #fffdf8;
  --canvas: #f2eee7;
  --line: #d8cec0;
  --red: #9d1b20;
  --red-dark: #741217;
  --amber: #a86311;
  --green: #176f49;
  --blue: #2d5f8b;
  --shadow: 0 22px 70px rgba(36, 28, 17, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(157, 27, 32, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(45, 95, 139, 0.045) 1px, transparent 1px),
    var(--canvas);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.42;
}

a { color: inherit; }
button, input, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 3vw, 42px);
  border-bottom: 1px solid rgba(216, 206, 192, 0.9);
  background: rgba(242, 238, 231, 0.92);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 0.78rem; }

nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

nav a { text-decoration: none; }
main { width: min(1500px, 100%); margin: 0 auto; }

.hero-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 0.78fr) minmax(360px, 1fr) minmax(310px, 0.78fr);
  gap: 18px;
  min-height: calc(100vh - 67px);
  padding: clamp(18px, 3vw, 42px);
  align-items: stretch;
}

.dossier-intro, .search-panel, .report-preview, .source-grid article, .bulk-tool, .bulk-results, .seo-grid a, .answer-panel, .route-content article, .faq-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

.dossier-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 560px;
  padding: clamp(22px, 3vw, 34px);
  border-top: 4px solid var(--red);
}

.eyebrow, .label {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 12ch;
  margin-bottom: 18px;
  font-size: 4rem;
  line-height: 0.96;
  letter-spacing: 0;
}

h2 { margin-bottom: 0; font-size: 1.35rem; line-height: 1.14; letter-spacing: 0; }
h3 { margin-bottom: 5px; font-size: 1rem; letter-spacing: 0; }

.intro-copy, .bulk-copy p, .microcopy, .source-grid p, .result-summary p, .answer-panel p, .route-content p, .faq-list p { color: var(--muted); }
.intro-copy { max-width: 39ch; font-size: 1.03rem; }

.answer-panel {
  margin-top: 22px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
}
.answer-panel h2 { margin-bottom: 10px; font-size: 1.08rem; }
.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.answer-grid span {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 0.9rem;
}
.answer-grid strong {
  color: var(--ink);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.evidence-stack { display: grid; gap: 9px; }
.evidence-stack span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.evidence-stack strong { color: var(--ink); font-family: "SFMono-Regular", Consolas, monospace; }

.search-panel, .report-preview { min-height: 560px; padding: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }

.status-pill, .risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.ready, .risk-badge.good { background: #e1f0e8; color: var(--green); }
.risk-badge.bad { background: #f6dddd; color: var(--red); }
.risk-badge.warn { background: #fff0d4; color: var(--amber); }
.risk-badge.neutral { background: #eee7d9; color: var(--muted); }

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}
input { min-height: 48px; padding: 0 14px; }
textarea { min-height: 160px; padding: 14px; resize: vertical; font-family: "SFMono-Regular", Consolas, monospace; }
input:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(157, 27, 32, 0.16); }

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 900;
}
.primary { background: var(--red); color: white; }
.primary:hover { background: var(--red-dark); }
.primary:disabled { cursor: not-allowed; background: #d99b9c; }
.ghost { border-color: var(--line); background: white; color: var(--ink); }
.full { width: 100%; margin-top: 14px; }

.sample-row, .button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.result-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.result-summary p { margin-bottom: 0; }

.result-list { display: grid; gap: 10px; margin-top: 14px; }
.record-card { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.72); }
.record-card strong { display: block; margin-bottom: 10px; }
dl { display: grid; gap: 0; margin: 18px 0 0; }
dl div { display: grid; grid-template-columns: 0.62fr 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
dt { color: var(--muted); font-weight: 900; }
dd { margin: 0; }

.report-sheet {
  min-height: 430px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(157,27,32,0.05) 1px, transparent 1px),
    white;
  background-size: 22px 22px;
}
.folio-line { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.78rem; }
.stamp { display: inline-block; margin: 24px 0 14px; padding: 8px 12px; border: 2px solid var(--line); transform: rotate(-2deg); color: var(--muted); font-weight: 900; text-transform: uppercase; }
.stamp.good { border-color: var(--green); color: var(--green); }
.stamp.warn { border-color: var(--amber); color: var(--amber); }
.stamp.bad { border-color: var(--red); color: var(--red); }
.report-sheet p { color: var(--muted); }
.report-lines { display: grid; gap: 9px; margin-top: 28px; }
.report-lines span { height: 7px; border-radius: 999px; background: #dfd7c9; }
.report-lines span:nth-child(1) { width: 82%; }
.report-lines span:nth-child(2) { width: 60%; }
.report-lines span:nth-child(3) { width: 74%; }
.report-lines span:nth-child(4) { width: 44%; }

.source-band, .bulk-section, .faq-section {
  display: grid;
  grid-template-columns: 0.6fr 1.4fr;
  gap: 18px;
  padding: 0 clamp(18px, 3vw, 42px) clamp(24px, 4vw, 42px);
}
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.source-grid article { padding: 18px; }
.source-grid strong { display: block; margin-bottom: 8px; text-transform: uppercase; }

.bulk-section { grid-template-columns: 0.62fr 0.9fr 1.1fr; align-items: start; }
.bulk-tool, .bulk-results { padding: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; }

.seo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 0 clamp(18px, 3vw, 42px) clamp(30px, 4vw, 54px);
}
.seo-grid a { display: block; padding: 16px; text-decoration: none; }
.seo-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.72rem; font-weight: 900; text-transform: uppercase; overflow-wrap: anywhere; }

.faq-list {
  display: grid;
  gap: 12px;
}
.faq-list article { padding: 18px; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 3vw, 42px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
footer p { max-width: 780px; margin-bottom: 0; }
footer a { font-weight: 900; }

.route-page { display: grid; gap: 24px; padding: clamp(18px, 4vw, 54px); }
.route-hero { max-width: 960px; min-height: 50vh; align-content: center; border-top: 4px solid var(--red); border-bottom: 1px solid var(--line); }
.route-hero h1 { max-width: 13ch; }
.route-hero p { max-width: 62ch; color: var(--muted); font-size: 1.08rem; }
.route-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.route-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 8px; background: var(--red); color: white; text-decoration: none; font-weight: 900; }
.route-button.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.route-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.route-content article { padding: 18px; }
.route-content strong {
  display: block;
  margin-bottom: 8px;
  text-transform: uppercase;
}

@media (max-width: 1120px) {
  .hero-workspace, .bulk-section, .source-band, .faq-section, .route-content { grid-template-columns: 1fr; }
  .dossier-intro, .search-panel, .report-preview { min-height: auto; }
  h1 { max-width: 13ch; font-size: 3.35rem; }
  .source-grid, .seo-grid { grid-template-columns: repeat(2, 1fr); }
  .answer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  nav { width: 100%; justify-content: space-between; }
  .hero-workspace { padding: 14px; }
  .input-row, .result-summary { grid-template-columns: 1fr; }
  .source-grid, .seo-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2.3rem; }
}
