:root {
  --bg: #f8f7f1;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #667085;
  --line: #d9c69d;
  --gold: #987000;
  --green: #007a53;
  --red: #b42318;
  --amber: #b54708;
  --blue: #175cd3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 56px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

.back-link,
.ghost-button,
.primary-button,
.small-button {
  border: 1px solid var(--gold);
  background: var(--surface);
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
  padding: 10px 14px;
  min-height: 42px;
  cursor: pointer;
}

.primary-button {
  background: var(--gold);
  color: #fff;
}

.small-button {
  min-height: 34px;
  padding: 6px 10px;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 70px;
}

.hero {
  padding: 24px 0 28px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(44px, 8vw, 86px);
  line-height: 0.95;
  margin-bottom: 18px;
}

h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.hero p {
  max-width: 820px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.pipeline,
.overview-grid,
.workspace,
.persona-grid {
  display: grid;
  gap: 16px;
}

.pipeline {
  grid-template-columns: repeat(9, auto);
  align-items: center;
  justify-content: start;
  padding: 16px;
  background: #fffdf7;
  border: 1px solid var(--line);
  overflow-x: auto;
  margin-bottom: 24px;
}

.pipeline span {
  white-space: nowrap;
  font-weight: 700;
}

.overview-grid {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  margin-bottom: 20px;
}

.metric,
.panel,
.persona-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
}

.metric span,
.data-item span,
.audit-item span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.metric strong {
  display: block;
  font-size: 28px;
}

.workspace {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 28px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.link-form {
  display: grid;
  gap: 12px;
}

.link-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.link-form span {
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  padding: 11px 12px;
  min-height: 44px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.result-line {
  min-height: 24px;
  color: var(--muted);
  margin: 14px 0 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 14px 0;
}

.section-head > p {
  max-width: 460px;
  color: var(--muted);
  margin-bottom: 0;
}

.persona-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.persona-card {
  display: grid;
  gap: 14px;
}

.persona-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #cfd4dc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.badge.pass {
  border-color: #a6d8bd;
  color: var(--green);
  background: #effaf4;
}

.badge.warn {
  border-color: #fedf89;
  color: var(--amber);
  background: #fffaeb;
}

.badge.fail {
  border-color: #fda29b;
  color: var(--red);
  background: #fff1f0;
}

.badge.locked {
  border-color: #b2ccff;
  color: var(--blue);
  background: #eff4ff;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.data-item {
  border: 1px solid #ece3d0;
  padding: 12px;
  background: #fffdf7;
}

.data-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.persona-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.audit-item {
  border-left: 4px solid var(--gold);
  background: #fffdf7;
  padding: 10px 12px;
}

.audit-item strong {
  display: block;
  margin-bottom: 4px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 14px;
}

@media (max-width: 900px) {
  .overview-grid,
  .workspace,
  .persona-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
