:root {
  color-scheme: light;
  --ink: #1b1c1f;
  --muted: #61646b;
  --paper: #fffdf8;
  --canvas: #f3f0e9;
  --line: #d8d0c2;
  --red: #a91d1d;
  --red-dark: #7f1414;
  --amber: #af6b13;
  --green: #1d7a4a;
  --slate: #2f3b45;
  --shadow: 0 22px 70px rgba(35, 29, 20, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(169, 29, 29, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(47, 59, 69, 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, 208, 194, 0.9);
  background: rgba(243, 240, 233, 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.75fr) 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 {
  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: 11ch;
  margin-bottom: 18px;
  font-size: 4.05rem;
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: normal;
}

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 {
  color: var(--muted);
}

.intro-copy {
  max-width: 38ch;
  font-size: 1.03rem;
}

.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 {
  background: #efe8d8;
  color: var(--muted);
}

.status-pill.ready,
.risk-badge.good {
  background: #e2f1e9;
  color: var(--green);
}

.status-pill.error,
.risk-badge.bad {
  background: #f7dfdc;
  color: var(--red);
}

.risk-badge.warn {
  background: #fff1d8;
  color: var(--amber);
}

.risk-badge.neutral {
  background: #efe8d8;
  color: var(--muted);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

input {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 180px;
  padding: 13px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9rem;
}

button,
.seo-grid a {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 900;
}

button {
  padding: 0 15px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary {
  background: var(--red);
  color: white;
}

.route-button {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 900;
}

.primary:hover {
  background: var(--red-dark);
}

.ghost {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.ghost:hover {
  border-color: #b9ad9b;
}

button:disabled {
  opacity: 0.48;
  pointer-events: none;
}

.full {
  width: 100%;
}

.quick-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.result-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  margin-top: 18px;
  padding: 14px 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;
  max-height: 268px;
  margin-top: 14px;
  overflow: auto;
}

.match-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.match-card strong {
  display: block;
  margin-bottom: 4px;
}

.match-card dl {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 10px 0 0;
  font-size: 0.84rem;
}

.match-card dt {
  color: var(--muted);
  font-weight: 850;
}

.match-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.report-preview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-sheet {
  position: relative;
  min-height: 440px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid #cfc4b4;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(169, 29, 29, 0.06) 1px, transparent 1px),
    white;
  background-size: 18px 18px;
}

.report-sheet::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 74px;
  height: 74px;
  border-left: 1px solid #cfc4b4;
  border-bottom: 1px solid #cfc4b4;
  background: #eee6d8;
  content: "";
}

.report-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 36px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
}

.stamp {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 14px;
  margin-bottom: 16px;
  border: 2px solid var(--line);
  color: var(--muted);
  font-weight: 950;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.stamp.bad {
  border-color: var(--red);
  color: var(--red);
}

.stamp.good {
  border-color: var(--green);
  color: var(--green);
}

.stamp.warn {
  border-color: var(--amber);
  color: var(--amber);
}

.report-sheet h2 {
  margin-bottom: 8px;
  font-size: 1.9rem;
}

.report-sheet p {
  color: var(--muted);
}

.report-sheet dl {
  display: grid;
  gap: 0;
  margin: 24px 0 0;
}

.report-sheet dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid #d8d0c2;
}

.report-sheet dt {
  color: var(--muted);
  font-weight: 900;
}

.report-sheet dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.report-lines {
  display: grid;
  gap: 9px;
  margin-top: 26px;
}

.report-lines span {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: #ded6c7;
}

.report-lines span:nth-child(1) {
  width: 84%;
}

.report-lines span:nth-child(2) {
  width: 62%;
}

.report-lines span:nth-child(3) {
  width: 76%;
}

.report-lines span:nth-child(4) {
  width: 38%;
}

.microcopy {
  margin: 0;
  font-size: 0.84rem;
}

.source-band,
.bulk-section {
  display: grid;
  gap: 18px;
  padding: 0 clamp(18px, 3vw, 42px) clamp(24px, 4vw, 42px);
}

.source-band {
  grid-template-columns: minmax(240px, 0.55fr) minmax(320px, 1.45fr);
}

.source-band > div:first-child,
.bulk-copy {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.source-grid article {
  padding: 18px;
}

.source-grid span,
.seo-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.source-grid strong {
  display: block;
  margin-bottom: 8px;
}

.source-grid p {
  margin-bottom: 0;
}

.bulk-section {
  grid-template-columns: minmax(240px, 0.6fr) minmax(320px, 0.85fr) minmax(320px, 1fr);
  align-items: start;
}

.bulk-tool {
  padding: 18px;
}

.bulk-results {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  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;
}

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: 760px;
  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-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.65fr) minmax(320px, 1fr);
  gap: 18px;
}

.route-panel > * {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
  .hero-workspace,
  .bulk-section,
  .source-band {
    grid-template-columns: 1fr;
  }

  .dossier-intro,
  .search-panel,
  .report-preview {
    min-height: auto;
  }

  h1 {
    max-width: 13ch;
    font-size: 3.45rem;
  }

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

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero-workspace {
    padding: 14px;
  }

  .search-box,
  .result-summary,
  .route-panel {
    grid-template-columns: 1fr;
  }

  .source-grid,
  .seo-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.35rem;
  }
}
