:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --ink: #1c211e;
  --muted: #5c6560;
  --line: #d7ddd8;
  --accent: #0f6e56;
  --accent-ink: #084536;
  --danger: #9b1c1c;
  --warn: #9a6700;
  --ok: #0f6e56;
  --code: #14201b;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: var(--accent-ink);
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem;
  z-index: 20;
}

.skip:focus {
  left: 0.75rem;
  top: 0.75rem;
}

.site-header,
.intro,
.workbench,
.section,
.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
}

.workbench {
  padding-bottom: 5.5rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 1rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.intro h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.03em;
  margin: 0.4rem 0 0.35rem;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}

.flow {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow span {
  color: var(--accent);
}

.banner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.8rem 1rem;
  margin-bottom: 0.75rem;
}

.banner-error {
  color: var(--danger);
  border-color: #f0b4b4;
}

.banner-diff ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}

.banner-actions {
  display: flex;
  gap: 0.4rem;
}

.mobile-tabs {
  display: none;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0.45rem 0.7rem;
  font: inherit;
  cursor: pointer;
}

.tab.is-active {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.bench-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 1fr) minmax(240px, 1fr);
  gap: 0.75rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.9rem;
  min-height: 100%;
}

.panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

label,
.field-label,
.item-top {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin: 0.65rem 0 0.3rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

input[type="text"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0.55rem 0.6rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

textarea,
.output {
  font-family: var(--mono);
  font-size: 0.8rem;
}

input:focus,
select:focus,
textarea:focus,
.tab:focus,
.btn:focus,
.output:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 1px;
}

.mode-row,
.inline-fields,
.item-actions,
.export-actions,
.add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.inline-fields label,
.add-form {
  flex: 1;
  min-width: 140px;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.5rem 0.8rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7fff9;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
  margin-top: 0.7rem;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 0.8rem;
  font-weight: 500;
}

.section-block {
  border-top: 1px solid var(--line);
  margin-top: 0.8rem;
  padding-top: 0.6rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.item {
  border: 1px solid var(--line);
  padding: 0.45rem;
  margin: 0.4rem 0;
}

.item textarea {
  margin-top: 0.35rem;
}

.source-tag {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 0.05rem 0.35rem;
  color: var(--muted);
}

.source-tag.detected {
  border-color: var(--ok);
  color: var(--ok);
}

.source-tag.suggested {
  border-color: var(--warn);
  color: var(--warn);
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 28rem;
}

.preview-tabs {
  display: flex;
  gap: 0.35rem;
}

.status-pill {
  margin: 0.6rem 0;
  font-weight: 700;
}

.status-pill[data-state="ready"] {
  color: var(--ok);
}

.status-pill[data-state="needs-review"] {
  color: var(--warn);
}

.status-pill[data-state="blocked"] {
  color: var(--danger);
}

.output {
  flex: 1;
  margin: 0;
  background: var(--code);
  color: #dbece4;
  padding: 0.8rem;
  overflow: auto;
  min-height: 18rem;
  white-space: pre-wrap;
}

.checks {
  margin: 0;
  padding-left: 1.1rem;
}

.checks li {
  margin: 0.45rem 0;
}

.export-bar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--panel);
  border: 1px solid var(--line);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.section {
  padding-top: 1.5rem;
}

.steps {
  color: var(--muted);
}

.faq details {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 650;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.legal {
  max-width: 720px;
}

.legal h1 {
  letter-spacing: -0.03em;
}

.legal p,
.legal li {
  color: var(--muted);
}

@media (max-width: 960px) {
  .mobile-tabs {
    display: flex;
  }

  .bench-grid {
    grid-template-columns: 1fr;
  }

  .col {
    display: none;
  }

  .col.is-visible {
    display: block;
  }

  .nav a:nth-child(1),
  .nav a:nth-child(2) {
    display: none;
  }

  .export-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
