:root {
  --paper: #f7efe2;
  --paper-soft: #fffaf2;
  --ink: #18213d;
  --muted: #6f665b;
  --line: rgba(24, 33, 61, 0.16);
  --blue: #1e6f99;
  --blue-dark: #144761;
  --red: #9c2f28;
  --red-dark: #7d1f1a;
  --gold: #c99736;
  --shadow: 0 24px 70px rgba(47, 38, 27, 0.18);
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Source Sans 3", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  background: var(--paper);
}

body.record-page-body {
  background: linear-gradient(135deg, #fffaf2 0%, #f7efe2 56%, #ead8b9 100%);
}

body.review-page-body {
  background: #f7efe2;
}

body.pipeline-page-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #fffaf2 0%, #f7efe2 52%, #ead8b9 100%);
}

a {
  color: var(--blue-dark);
  font-weight: 800;
}

.atlas-shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) 1fr;
  min-height: 100vh;
}

.panel {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: auto;
  max-height: 100vh;
  padding: 1.35rem;
  border-right: 1px solid var(--line);
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3.25rem;
  aspect-ratio: 1;
  color: #fff;
  font: 700 1.05rem var(--font-serif);
  background: var(--red);
  border: 2px solid rgba(255, 255, 255, 0.74);
  box-shadow: 0 12px 24px rgba(180, 54, 44, 0.24);
  clip-path: polygon(50% 0%, 92% 18%, 92% 72%, 50% 100%, 8% 72%, 8% 18%);
}

.eyebrow,
.source-label,
.detail-kicker,
.search-wrap span,
.select-wrap span {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.94;
}

.source-card,
.detail-card,
.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.78);
}

.source-card {
  padding: 1rem;
}

.source-card h2 {
  margin-top: 0.25rem;
  font-family: var(--font-serif);
  font-size: 1.85rem;
  line-height: 1;
}

.source-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.42;
}

.source-actions {
  margin-top: 0.85rem;
  font-weight: 900;
}

.search-wrap,
.select-wrap {
  display: grid;
  gap: 0.4rem;
}

input,
select {
  width: 100%;
  min-height: 3rem;
  padding: 0 0.8rem;
  color: var(--ink);
  font: 800 1rem var(--font-sans);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.86);
}

button {
  font: 900 1rem var(--font-sans);
}

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

.panel > .select-wrap {
  max-width: 16rem;
}

.stats {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 800;
}

.map-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.map-status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.detail-card {
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.94), rgba(246, 235, 215, 0.9));
}

.detail-card h2 {
  margin: 0.1rem 0 0.45rem;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.75rem;
  line-height: 1;
}

.detail-card p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.42;
}

.record-list {
  display: grid;
  gap: 0.75rem;
}

.record-card {
  cursor: pointer;
  padding: 0.9rem;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.record-card:hover,
.record-card.is-active {
  border-color: rgba(30, 111, 153, 0.44);
  background: rgba(255, 255, 255, 0.7);
  transform: translateY(-1px);
}

.record-card.status-approved {
  border-color: rgba(35, 122, 78, 0.34);
}

.record-card.status-approved .record-meta span:last-child {
  color: #237a4e;
}

.record-card.status-rejected {
  border-color: rgba(156, 47, 40, 0.32);
}

.record-card.status-skipped {
  opacity: 0.78;
}

.record-card h3 {
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.1;
}

.record-heading-row,
.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.open-record {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--red);
  font-size: 1.35rem;
  text-decoration: none;
  border: 1px solid rgba(156, 47, 40, 0.28);
  border-radius: 999px;
  background: rgba(156, 47, 40, 0.06);
}

.detail-open {
  margin-top: 0.2rem;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  margin: 0.35rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.record-excerpt {
  margin: 0.6rem 0 0;
  color: #4d473f;
  line-height: 1.38;
}

.record-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.45rem;
  font-size: 0.95rem;
  font-weight: 900;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0 0.55rem;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
  border: 1px solid rgba(30, 111, 153, 0.2);
  border-radius: 999px;
  background: rgba(30, 111, 153, 0.09);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
}

.map-wrap {
  position: relative;
  min-height: 100vh;
}

#map {
  position: absolute;
  inset: 0;
  background: #efe0c3;
}

@media (max-width: 820px) {
  .atlas-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 52vh auto;
  }

  .map-wrap {
    grid-row: 1;
    min-height: 52vh;
  }

  .panel {
    grid-row: 2;
    max-height: none;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
}

.review-shell {
  width: min(1500px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.review-header,
.review-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.review-header h1 {
  font-size: clamp(3rem, 7vw, 6rem);
}

.review-nav,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.review-nav a,
.review-nav button,
.review-actions a,
.review-actions button,
.save-note {
  min-height: 2.65rem;
  padding: 0 0.85rem;
  color: var(--blue-dark);
  font: 900 0.95rem var(--font-sans);
  text-decoration: none;
  border: 1px solid rgba(30, 111, 153, 0.24);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.88);
  cursor: pointer;
}

.review-actions button[data-status="approved"] {
  color: #247a4e;
  border-color: rgba(35, 122, 78, 0.3);
}

.review-actions button[data-status="rejected"] {
  color: var(--red);
  border-color: rgba(156, 47, 40, 0.3);
}

.review-toolbar {
  align-items: center;
  margin: 1rem 0;
}

.review-toolbar .search-wrap {
  flex: 1 1 28rem;
  margin-bottom: 0;
}

.review-toolbar .select-wrap {
  flex: 0 1 18rem;
  margin-bottom: 0;
}

.review-workbench {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(360px, 0.95fr) minmax(360px, 1.05fr);
  gap: 1rem;
  align-items: start;
}

.review-list,
.review-detail,
.review-source {
  max-height: calc(100vh - 11rem);
  overflow: auto;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.8);
}

.review-list {
  display: grid;
  gap: 0.5rem;
}

.review-list-item {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.75rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
  cursor: pointer;
}

.review-list-item.is-active {
  border-color: rgba(30, 111, 153, 0.5);
  background: rgba(255, 255, 255, 0.8);
}

.review-list-item span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.review-warning {
  padding: 0.75rem 0.85rem;
  color: #6f3d00;
  border: 1px solid rgba(201, 151, 54, 0.38);
  border-radius: 8px;
  background: rgba(255, 238, 191, 0.42);
}

.review-detail h2 {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 0.9;
}

.review-note-wrap {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
}

.review-note-wrap span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-note-wrap textarea {
  min-height: 8rem;
  padding: 0.75rem;
  color: var(--ink);
  font: 700 1rem var(--font-sans);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.save-note {
  margin-top: 0.65rem;
}

.candidate-section {
  margin-top: 1rem;
}

.candidate-list {
  display: grid;
  gap: 0.75rem;
}

.candidate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.candidate-card h4 {
  margin: 0 0 0.2rem;
  color: var(--ink);
  font: 900 1.05rem var(--font-sans);
}

.candidate-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
}

.candidate-strength {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0 0.55rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.86);
}

.candidate-strength.strong {
  color: #176842;
  border-color: rgba(35, 122, 78, 0.34);
  background: rgba(222, 243, 232, 0.72);
}

.candidate-strength.good {
  color: var(--blue-dark);
  border-color: rgba(30, 111, 153, 0.3);
  background: rgba(232, 244, 249, 0.7);
}

.candidate-strength.possible {
  color: #735008;
  border-color: rgba(201, 151, 54, 0.34);
  background: rgba(255, 238, 191, 0.52);
}

.candidate-strength.weak {
  color: var(--red);
  border-color: rgba(156, 47, 40, 0.28);
  background: rgba(255, 230, 226, 0.52);
}

.candidate-card p {
  margin: 0.15rem 0;
}

.candidate-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.candidate-query,
.candidate-risk {
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 800;
}

.candidate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

.candidate-actions a,
.candidate-actions button {
  min-height: 2.3rem;
  padding: 0 0.75rem;
  color: var(--blue-dark);
  font: 900 0.88rem var(--font-sans);
  text-align: center;
  text-decoration: none;
  border: 1px solid rgba(30, 111, 153, 0.24);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.88);
  cursor: pointer;
}

.candidate-actions button {
  color: #247a4e;
  border-color: rgba(35, 122, 78, 0.3);
}

.manual-location-card {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
  padding: 0.9rem;
  border: 1px dashed rgba(30, 111, 153, 0.32);
  border-radius: 8px;
  background: rgba(232, 244, 249, 0.34);
}

.manual-location-card h4 {
  margin: 0;
  color: var(--ink);
  font: 900 1.05rem var(--font-sans);
}

.manual-location-card label {
  display: grid;
  gap: 0.25rem;
}

.manual-location-card label span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.manual-location-card input {
  min-height: 2.65rem;
}

.manual-location-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.manual-location-card > button {
  justify-self: start;
  min-height: 2.45rem;
  padding: 0 0.85rem;
  color: #247a4e;
  font: 900 0.9rem var(--font-sans);
  border: 1px solid rgba(35, 122, 78, 0.32);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.9);
  cursor: pointer;
}

.review-source-image {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 1100px) {
  .review-workbench {
    grid-template-columns: 1fr;
  }

  .review-list,
  .review-detail,
  .review-source {
    max-height: none;
  }

  .candidate-card {
    grid-template-columns: 1fr;
  }

  .manual-location-grid {
    grid-template-columns: 1fr;
  }

  .review-header,
  .review-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

.pipeline-shell {
  width: min(1380px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem) 0 3rem;
}

.pipeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.pipeline-header h1 {
  max-width: none;
  font-size: clamp(3rem, 7vw, 6.5rem);
}

.pipeline-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.7rem;
}

.pipeline-nav a,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0 1rem;
  text-decoration: none;
  border-radius: 999px;
  cursor: pointer;
}

.pipeline-nav a,
.secondary-button {
  color: var(--blue-dark);
  border: 1px solid rgba(30, 111, 153, 0.24);
  background: rgba(255, 250, 242, 0.74);
}

.primary-button {
  color: #fffaf2;
  border: 1px solid rgba(156, 47, 40, 0.08);
  background: #9c2f28;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.pipeline-card {
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.82);
  box-shadow: 0 12px 36px rgba(47, 38, 27, 0.08);
}

.pipeline-steps {
  margin: 0.85rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.pipeline-steps li + li {
  margin-top: 0.45rem;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 12rem;
  margin-top: 0.8rem;
  padding: 1rem;
  text-align: center;
  border: 2px dashed rgba(30, 111, 153, 0.34);
  border-radius: 8px;
  background: rgba(232, 244, 249, 0.3);
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--blue);
  background: rgba(232, 244, 249, 0.72);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 0.95;
}

.drop-zone span {
  color: var(--muted);
  font-weight: 800;
}

.pipeline-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.pipeline-form-wide {
  grid-column: 1 / -1;
}

.pipeline-form-grid label {
  display: grid;
  gap: 0.35rem;
}

.pipeline-form-grid label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pipeline-form-grid .toggle-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(232, 244, 249, 0.28);
}

.pipeline-form-grid .toggle-row input {
  width: 1.2rem;
  min-height: 1.2rem;
  padding: 0;
}

.advanced-range {
  padding: 0.85rem;
  border: 1px dashed rgba(30, 111, 153, 0.28);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.54);
}

.advanced-range summary {
  color: var(--blue-dark);
  font-weight: 900;
  cursor: pointer;
}

.nested-grid {
  margin-top: 0.85rem;
}

.pipeline-form-grid input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.form-note,
.muted-copy {
  color: var(--muted);
  line-height: 1.4;
}

.progress-card {
  margin-bottom: 1rem;
}

.progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.progress-head h2 {
  margin-top: 0.2rem;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.95;
}

.progress-track {
  height: 0.75rem;
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(24, 33, 61, 0.08);
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  transition: width 220ms ease;
}

.is-error {
  color: var(--red);
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.stage-item {
  min-height: 6rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.78);
}

.stage-item strong {
  display: block;
  color: var(--ink);
  line-height: 1.1;
}

.stage-item p,
.stage-item span {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.25;
}

.stage-item.status-running {
  border-color: rgba(30, 111, 153, 0.42);
  background: rgba(232, 244, 249, 0.5);
}

.stage-item.status-complete {
  border-color: rgba(35, 122, 78, 0.32);
  background: rgba(236, 248, 240, 0.54);
}

.stage-item.status-waiting {
  border-color: rgba(201, 151, 54, 0.42);
  background: rgba(252, 241, 209, 0.58);
}

.stage-item.status-failed {
  border-color: rgba(156, 47, 40, 0.32);
  background: rgba(255, 232, 229, 0.55);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.summary-cell,
.summary-wide {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.7);
}

.summary-cell span,
.summary-wide h3 {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-cell strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1;
}

.summary-wide {
  grid-column: span 2;
}

.summary-wide ul {
  display: grid;
  gap: 0.35rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.summary-wide li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.job-log {
  min-height: 20rem;
  max-height: 28rem;
  overflow: auto;
  margin: 0.8rem 0 0;
  padding: 0.9rem;
  white-space: pre-wrap;
  color: #2d2a26;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.job-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.job-list-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  text-align: left;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.76);
  cursor: pointer;
}

.job-list-item span {
  color: var(--muted);
}

@media (max-width: 900px) {
  .pipeline-header,
  .progress-head {
    flex-direction: column;
  }

  .pipeline-grid,
  .pipeline-form-grid,
  .stage-list,
  .summary-grid,
  .job-list {
    grid-template-columns: 1fr;
  }

  .summary-wide {
    grid-column: span 1;
  }
}
.source-excerpt-full {
  color: var(--muted);
  line-height: 1.58;
}

.source-excerpt-full p {
  margin: 0.9rem 0 0;
}

.source-excerpt-full p:first-child {
  margin-top: 0;
}
