:root {
  color-scheme: light;
  --bg: #f5f0df;
  --paper: #fffaf0;
  --ink: #141414;
  --muted: #5c5a51;
  --line: #252525;
  --green: #b8ff42;
  --yellow: #ffe55c;
  --cyan: #b7eef5;
  --red: #ff6b4a;
  --ok: #166b32;
  --warn: #8a5200;
  --bad: #a8291a;
  --shadow: 0 16px 40px rgba(20, 20, 20, 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;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(20, 20, 20, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(20, 20, 20, 0.045) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
}

a {
  color: inherit;
}

.site-header {
  border-bottom: 3px solid var(--line);
  background: var(--paper);
}

.header-inner {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 36px;
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 30px;
  align-items: end;
}

.brand {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 3px solid var(--line);
  background: var(--green);
  color: var(--ink);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.brand-text {
  font-weight: 850;
  line-height: 1.05;
  text-transform: uppercase;
}

.header-copy {
  max-width: 980px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 980px;
  margin: 0;
  font-size: 5.2rem;
  line-height: 0.95;
  text-transform: uppercase;
}

.header-copy p:last-child {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.flow-band {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 28px minmax(150px, 1fr) 28px minmax(150px, 1fr) 28px minmax(150px, 1fr) 28px minmax(150px, 1fr);
  gap: 0;
  align-items: center;
  margin-bottom: 24px;
}

.flow-step {
  width: 100%;
  min-width: 0;
  min-height: 92px;
  padding: 14px;
  border: 3px solid var(--line);
  background: var(--paper);
}

.flow-step strong,
.flow-step span {
  display: block;
}

.flow-step strong {
  margin: 7px 0 3px;
  font-size: 1rem;
  text-transform: uppercase;
}

.flow-step span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.flow-index {
  display: inline-block;
  width: fit-content;
  padding: 2px 7px;
  background: var(--yellow);
  border: 2px solid var(--line);
  font-size: 0.74rem;
  font-weight: 850;
}

.flow-link {
  height: 3px;
  background: var(--line);
}

.flow-step.is-muted,
.flow-link.is-muted {
  opacity: 0.52;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr) minmax(320px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.config-column,
.selection-column,
.results-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.tool-panel,
.result-summary,
.result-block,
.metric,
.selector-group {
  border: 3px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.tool-panel,
.result-block,
.selector-group {
  min-width: 0;
  padding: 18px;
}

.panel-heading,
.section-title {
  margin-bottom: 16px;
}

.panel-heading h2,
.section-title h2,
.result-summary h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.section-title {
  padding: 2px 0 0;
}

.section-title p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

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

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.field span,
.switch-row strong {
  font-size: 0.9rem;
  font-weight: 780;
  line-height: 1.2;
}

.field input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.field small,
.switch-row small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid rgba(20, 20, 20, 0.18);
}

.switch-row span {
  display: grid;
  gap: 4px;
}

.switch-row input {
  width: 54px;
  height: 30px;
  accent-color: var(--green);
}

.selector-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.selector-head h3,
.result-block h3 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
}

.selector-head a {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.filter-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.filter-field span,
.filter-status,
.empty-state {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.filter-field span {
  text-transform: uppercase;
}

.filter-field select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
}

.filter-status,
.empty-state {
  margin: -4px 0 12px;
  line-height: 1.3;
}

.empty-state {
  margin: 10px 0 0;
}

.option-grid {
  display: grid;
  gap: 10px;
}

.option-card {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.option-select {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.option-card:hover,
.option-card:focus-within {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.option-card.is-selected {
  background: var(--green);
}

.option-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.option-title strong {
  font-size: 1rem;
  line-height: 1.15;
}

.option-title span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 2px solid var(--line);
  background: var(--yellow);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.option-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.option-card.is-selected p {
  color: #293012;
}

.option-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.option-facts div {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(20, 20, 20, 0.22);
  background: rgba(255, 255, 255, 0.55);
}

.option-facts dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.option-facts dd {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 820;
}

.datasheet-link {
  justify-self: start;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.results-column {
  position: sticky;
  top: 16px;
}

.result-summary {
  padding: 20px;
  background: var(--cyan);
}

.result-summary.is-ok {
  background: var(--green);
}

.result-summary.is-warn {
  background: var(--yellow);
}

.result-summary.is-bad {
  background: #ffd4c8;
}

.result-summary p:last-child {
  margin: 10px 0 0;
  line-height: 1.45;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-width: 0;
  padding: 14px;
}

.metric span,
.value-list dt {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  line-height: 1.05;
}

.value-list {
  display: grid;
  gap: 9px;
  margin: 0;
}

.value-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.14);
}

.value-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.value-list dd {
  margin: 0;
  font-weight: 820;
  text-align: right;
}

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

.checks-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 0.92rem;
  line-height: 1.35;
}

.check-dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
}

.check-ok .check-dot {
  background: var(--green);
}

.check-bad .check-dot {
  background: var(--red);
}

.is-hidden {
  display: none;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  }

  .results-column {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-summary,
  .metric-grid {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .flow-band {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .flow-link {
    width: 3px;
    height: 16px;
    margin-left: 22px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .results-column {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 3.6rem;
  }
}

@media (max-width: 620px) {
  .header-inner,
  .app-shell {
    width: calc(100% - 32px);
    max-width: none;
  }

  .header-inner {
    display: block;
  }

  .brand {
    grid-template-columns: 58px minmax(0, 1fr);
    max-width: 100%;
    margin-bottom: 34px;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    font-size: 34px;
  }

  .field-grid,
  .metric-grid,
  .option-facts {
    grid-template-columns: 1fr;
  }

  .tool-panel,
  .result-block,
  .selector-group,
  .result-summary {
    padding: 14px;
  }

  .header-copy,
  .header-copy p:last-child,
  .flow-band,
  .workspace,
  .tool-panel,
  .selector-group,
  .result-summary,
  .result-block,
  .metric {
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: 2.05rem;
  }
}
