:root {
  --ink: #17232b;
  --muted: #65727b;
  --paper: #f3f4ef;
  --panel: #ffffff;
  --line: #d8ddd9;
  --orange: #f06432;
  --orange-dark: #c6471d;
  --green: #267858;
  --red: #b83b3b;
  --blue-grey: #314955;
  --shadow: 0 18px 45px rgba(30, 45, 52, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(49, 73, 85, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 73, 85, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  color: white;
  background: var(--ink);
  border-bottom: 4px solid var(--orange);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.35);
  background: var(--orange);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand small { color: #aeb9be; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; }

.service-state { font-size: 13px; color: #c8d1d5; }
.service-state span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #53c891;
  box-shadow: 0 0 0 4px rgba(83,200,145,.12);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 68px;
}

.workspace-heading {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 44px;
  align-items: end;
  margin-bottom: 30px;
}

.eyebrow, .step {
  margin: 0 0 8px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(31px, 4vw, 49px); line-height: 1.06; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.015em; }
.workspace-heading > div > p:last-child, .section-heading > p { color: var(--muted); margin-bottom: 0; }

.access-panel {
  padding: 18px;
  background: #e5e8e4;
  border-left: 3px solid var(--blue-grey);
}

.access-panel label, .file-grid label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.key-row { display: flex; gap: 8px; }
.key-row input {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #bdc5c2;
  outline: none;
}
.key-row input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(240,100,50,.12); }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  cursor: pointer;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(240,100,50,.3); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.primary { color: white; background: var(--orange); }
.primary:hover { background: var(--orange-dark); }
.secondary { color: white; background: var(--blue-grey); }
.secondary:hover { background: var(--ink); }
.wide { width: 100%; }

.notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  color: #73301c;
  background: #fff0e9;
  border: 1px solid #efb6a2;
}

.progress-card { margin-bottom: 22px; padding-top: 20px; padding-bottom: 20px; }
.progress-header { margin-bottom: 14px; }
.stage-track { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.stage-node { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 12px 14px; background: #f5f7f4; border: 1px solid var(--line); }
.stage-node strong, .stage-node small { display: block; }
.stage-node strong { font-size: 13px; }
.stage-node small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.stage-number { display: grid; flex: none; place-items: center; width: 32px; height: 32px; color: white; background: var(--blue-grey); font-weight: 800; }
.stage-node.passed { background: #edf7f2; border-color: #baddcc; }
.stage-node.passed .stage-number { background: var(--green); }
.stage-node.in-progress { background: #fff6f0; border-color: #efc4b4; }
.stage-node.in-progress .stage-number { background: var(--orange); }
.stage-node.locked { opacity: .58; }
.stage-arrow { color: var(--orange); font-size: 22px; font-weight: 800; }
.progress-message { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 22px; }
.card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.step { margin-bottom: 4px; font-size: 10px; }
.badge {
  flex: none;
  padding: 5px 8px;
  color: var(--blue-grey);
  background: #eef1ef;
  border: 1px solid #dce1de;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.badge.success { color: var(--green); background: #e7f4ee; border-color: #baddcc; }
.variant-note { margin: -8px 0 16px; color: var(--muted); font-size: 12px; }
.starter-kit-panel { margin-bottom: 18px; padding: 14px; background: #f5f7f4; border: 1px solid var(--line); }
.starter-kit-panel .button { width: 100%; }
.starter-kit-panel .button:disabled { cursor: not-allowed; }
.starter-kit-panel .field-hint { font-size: 12px; }

.empty-state {
  min-height: 222px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 35px;
  color: var(--muted);
  text-align: center;
  background: #f8f9f6;
  border: 1px dashed #c8cfcb;
}
.empty-state p { max-width: 300px; margin: 10px 0 0; }
.empty-icon { color: var(--orange); font: 34px/1 Georgia, serif; }

.variant-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.variant-data div { min-width: 0; padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.variant-data div.full { grid-column: 1 / -1; }
.variant-data dt { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.variant-data dd { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-line; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

.drop-field {
  min-height: 171px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 24px;
  cursor: pointer;
  background: #f8f9f6;
  border: 1px dashed #aeb9b5;
  text-align: left;
}
.drop-field:hover { border-color: var(--orange); background: #fffaf7; }
.drop-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-field strong, .drop-field small { display: block; }
.drop-field small { margin-top: 3px; color: var(--muted); }
.file-symbol { display: grid; place-items: center; width: 48px; height: 48px; color: var(--orange-dark); background: #fee9df; font: 700 16px "SFMono-Regular", Consolas, monospace; }

.xsd-section { margin-top: 48px; }
.lock-note { margin-bottom: 18px; padding: 12px 14px; color: #674434; background: #fff5ef; border-left: 3px solid var(--orange); font-size: 12px; }
.xsd-section fieldset { margin: 0; padding: 0; border: 0; }
.xsd-section fieldset:disabled { opacity: .5; }
.history-section { margin-top: 22px; }
.history-header { margin-bottom: 12px; }
.text-button { padding: 4px 0; color: var(--orange-dark); background: transparent; border: 0; cursor: pointer; font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.history-empty { margin: 0; color: var(--muted); font-size: 13px; }
.attempts-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.attempt-row { display: grid; gap: 3px; padding: 10px 12px; background: #f6f7f4; border-left: 3px solid var(--line); }
.attempt-row.passed { border-left-color: var(--green); }
.attempt-row.failed { border-left-color: var(--red); }
.attempt-row strong { font-size: 12px; }
.attempt-row span { color: var(--muted); font-size: 11px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 18px; }
.section-heading > p { max-width: 430px; text-align: right; }
.file-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.file-grid label { margin: 0; padding: 12px; color: var(--muted); background: #f5f7f4; border: 1px solid var(--line); }
.file-grid input { display: block; width: 100%; margin-top: 8px; color: var(--ink); font-size: 11px; text-transform: none; }

.result { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.scoreline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.scoreline strong { font-size: 20px; }
.status-pass { color: var(--green); }
.status-fail { color: var(--red); }
.check-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.check-list li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; padding: 9px 10px; background: #f6f7f4; font-size: 12px; }
.check-list small { display: block; margin-top: 2px; color: var(--muted); }
.check-points { white-space: nowrap; font-family: "SFMono-Regular", Consolas, monospace; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px max(24px, calc((100vw - 1180px) / 2));
  color: #9eaaaf;
  background: var(--ink);
  font-size: 11px;
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  .workspace-heading, .grid { grid-template-columns: 1fr; }
  .workspace-heading { gap: 24px; }
  .file-grid { grid-template-columns: 1fr 1fr; }
  .attempts-list { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: start; flex-direction: column; gap: 7px; }
  .section-heading > p { text-align: left; }
}

@media (max-width: 580px) {
  main { width: min(100% - 24px, 1180px); padding-top: 30px; }
  .topbar { padding: 0 14px; }
  .service-state { display: none; }
  .key-row { flex-direction: column; }
  .stage-track { grid-template-columns: 1fr; }
  .stage-arrow { transform: rotate(90deg); justify-self: center; }
  .card { padding: 18px; }
  .file-grid, .variant-data { grid-template-columns: 1fr; }
  .attempts-list { grid-template-columns: 1fr; }
  .variant-data div.full { grid-column: auto; }
  footer { flex-direction: column; padding: 20px 14px; }
}
.lab-navigation { display: flex; gap: 1rem; flex-wrap: wrap; }
.lab-navigation a { color: inherit; text-decoration: none; font-size: .9rem; }
.lab-navigation a[aria-current="page"] { font-weight: 700; }
.integration-receipt { padding: 1rem; border-radius: .75rem; background: #edf7f2; }
