:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --ink: #142033;
  --muted: #5d6b7c;
  --line: #d9e0ea;
  --line-strong: #b8c3d2;
  --blue: #1664d9;
  --blue-soft: #e9f1ff;
  --green: #16845b;
  --green-soft: #e7f6ef;
  --amber: #9a6200;
  --amber-soft: #fff2d8;
  --red: #bd3030;
  --red-soft: #ffe8e6;
  --code: #111827;
  --shadow: 0 18px 45px rgba(20, 32, 51, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, var(--bg) 320px),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 0 clamp(20px, 4vw, 56px);
  border-bottom: 1px solid rgba(217, 224, 234, 0.86);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--code);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  font-size: 14px;
  font-weight: 660;
}

.navlinks a {
  color: var(--muted);
}

.workspace {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.not-found {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18vh 0 56px;
}

.not-found .primary-link {
  margin-top: 18px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.02;
}

h2 {
  font-size: 22px;
  line-height: 1.18;
}

.intro-copy {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 320px;
}

.trust-strip span,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.app-grid,
.output-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intake,
.preview-panel,
.output-panel,
.pilot-panel {
  padding: clamp(18px, 2vw, 26px);
}

.panel-heading {
  margin-bottom: 20px;
}

.row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.recommendation {
  min-height: 54px;
  margin: -2px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
  color: #24466f;
  font-size: 14px;
  font-weight: 650;
}

.control-group {
  min-width: 0;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

legend,
label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5f9;
}

.segmented label,
.stacked-options label,
.checks label {
  cursor: pointer;
}

.segmented input,
.stacked-options input,
.checks input {
  accent-color: var(--blue);
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
}

.segmented input:checked + span {
  border-color: #a8c8fb;
  background: var(--surface);
  color: var(--blue);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.field-row label {
  display: grid;
  gap: 8px;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

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

.checks label,
.stacked-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--muted);
}

.stacked-options {
  display: grid;
  gap: 8px;
}

.risk-meter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.risk-meter div {
  display: grid;
  gap: 2px;
  min-height: 84px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.count {
  font-size: 28px;
  font-weight: 820;
  line-height: 1;
}

.safe {
  color: var(--green);
}

.review {
  color: var(--amber);
}

.dangerous {
  color: var(--red);
}

.plan-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.plan-table-body {
  display: contents;
}

.plan-table [role="row"] {
  display: grid;
  grid-template-columns: 110px minmax(0, 0.75fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 54px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.plan-table [role="row"] > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-table [role="row"]:first-child {
  border-top: 0;
}

.table-head {
  background: #eff3f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.risk-tag {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
}

.risk-tag.safe {
  background: var(--green-soft);
}

.risk-tag.review {
  background: var(--amber-soft);
}

.risk-tag.dangerous {
  background: var(--red-soft);
}

.output-grid {
  margin-top: 18px;
}

.icon-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.code-output {
  min-height: 310px;
  max-height: 430px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: 8px;
  background: var(--code);
  color: #e7eef9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

.pilot-panel {
  margin-top: 18px;
}

.pilot-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
}

.pilot-grid p {
  margin: 0 0 18px;
  color: var(--muted);
}

.primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 760;
}

.primary-link:hover {
  text-decoration: none;
  background: #0f56bd;
}

.checklist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--muted);
}

@media (max-width: 980px) {
  .intro,
  .app-grid,
  .output-grid,
  .pilot-grid {
    grid-template-columns: 1fr;
  }

  .trust-strip {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
  }

  .workspace {
    width: min(100% - 24px, 1220px);
    padding-top: 24px;
  }

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

  .segmented,
  .field-row,
  .checks,
  .risk-meter {
    grid-template-columns: 1fr;
  }

  .plan-table [role="row"] {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .code-output {
    min-height: 240px;
    font-size: 12px;
  }
}
