:root {
  color-scheme: light;
  --ink: #15202b;
  --muted: #5b6673;
  --line: #dfe5ea;
  --paper: #f7f9fb;
  --panel: #ffffff;
  --panel-alt: #f3f6f8;
  --blue: #1f6d6a;
  --blue-deep: #15504d;
  --green: #177245;
  --amber: #a46300;
  --red: #b83a35;
  --teal: #0b7a75;
  --violet: #7157a8;
  --shadow: 0 10px 28px rgba(21, 32, 43, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 10px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 253, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  width: 184px;
  height: auto;
  display: block;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid #93b3ce;
  background: #e7f1f8;
  color: var(--blue-deep);
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.82rem;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand strong {
  font-size: 1.02rem;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.top-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: #354253;
  text-decoration: none;
  font-size: 0.92rem;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  background: #e8eef3;
  outline: none;
}

.freshness {
  padding: 7px 10px;
  border: 1px solid #d1d9e0;
  border-radius: 8px;
  color: #3f4d5c;
  background: #ffffff;
  font-size: 0.84rem;
  white-space: nowrap;
}

.tool-band,
.work-band,
.about-band,
.source-band {
  padding: clamp(18px, 3vw, 36px) clamp(16px, 4vw, 44px);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(360px, 0.8fr);
  gap: clamp(18px, 2.8vw, 32px);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}

.input-panel,
.result-panel,
.sku-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.input-panel,
.result-panel {
  padding: clamp(18px, 2.2vw, 26px);
}

.result-panel {
  position: sticky;
  top: 94px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.48rem, 2.05vw, 2rem);
  line-height: 1.12;
}

h2 {
  font-size: 1.02rem;
  line-height: 1.25;
}

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

.field {
  min-width: 0;
}

.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #2d3947;
  font-size: 0.86rem;
  font-weight: 700;
}

.help-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 1px solid #bcc8d1;
  border-radius: 50%;
  color: #52616f;
  background: #f7f9fb;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.help-tip::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 40;
  width: min(260px, 72vw);
  transform: translateX(-50%);
  border: 1px solid #b9c4ce;
  border-radius: 8px;
  padding: 9px 10px;
  background: #15202b;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(21, 32, 43, 0.22);
  content: attr(data-tip);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
}

.field input,
.field select,
textarea {
  width: 100%;
  min-height: 43px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.field input:focus,
.field select:focus,
textarea:focus {
  border-color: #4b8cc4;
  box-shadow: 0 0 0 3px rgba(75, 140, 196, 0.16);
}

.search-row,
.action-row,
.preset-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-row input {
  flex: 1 1 auto;
}

.ghost-button,
.primary-button,
.secondary-button,
.preset {
  min-height: 42px;
  border: 1px solid #b9c6d2;
  border-radius: 8px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  font-weight: 760;
  white-space: nowrap;
}

.ghost-button,
.secondary-button,
.preset {
  background: #ffffff;
  color: #263545;
}

.primary-button {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

.ghost-button:hover,
.secondary-button:hover,
.preset:hover,
.primary-button:hover {
  filter: brightness(0.97);
}

.suggestions {
  display: none;
  margin-top: 8px;
  border: 1px solid #cbd3dd;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.suggestions.is-open {
  display: block;
}

.suggestion-button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #ecf0f4;
  background: #ffffff;
  padding: 11px 12px;
  text-align: left;
}

.suggestion-button:last-child {
  border-bottom: 0;
}

.suggestion-button:hover,
.suggestion-button:focus {
  background: #f0f5f8;
  outline: none;
}

.suggestion-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #1c2834;
  font-weight: 800;
}

.suggestion-main span:last-child {
  color: var(--blue);
  font-size: 0.83rem;
  white-space: nowrap;
}

.suggestion-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.field-note,
.page-intro,
.platform-note,
.section-copy,
.quiet-disclaimer {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.page-intro {
  max-width: 620px;
  margin: 9px 0 0;
}

.platform-note {
  margin: -4px 0 14px;
}

.field-note {
  margin: 8px 0 0;
}

.subsection {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e4e9ee;
}

.subsection-heading,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.subsection-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.soft-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.soft-badge {
  border: 1px solid #d4c4a0;
  background: #fff8e8;
  color: var(--amber);
}

.status-badge {
  border: 1px solid rgba(23, 114, 69, 0.24);
  background: #eaf6ef;
  color: var(--green);
}

.status-badge.is-loss {
  border-color: rgba(184, 58, 53, 0.25);
  background: #fff0ee;
  color: var(--red);
}

.suffix-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid #cbd3dd;
  border-radius: 8px;
  background: #ffffff;
}

.suffix-input:focus-within {
  border-color: #4b8cc4;
  box-shadow: 0 0 0 3px rgba(75, 140, 196, 0.16);
}

.suffix-input input {
  border: 0;
  box-shadow: none;
}

.suffix-input span {
  padding: 0 11px 0 6px;
  color: var(--muted);
  font-weight: 800;
}

.preset-row {
  flex-wrap: wrap;
  margin-top: 10px;
}

.preset {
  min-width: 62px;
  min-height: 36px;
}

.preset.is-selected {
  border-color: var(--blue);
  background: #e7f1f8;
  color: var(--blue-deep);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  color: #334151;
  font-size: 0.9rem;
  line-height: 1.35;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--blue);
}

.hero-metric {
  padding: 18px 0;
  border-top: 1px solid #e4e9ee;
  border-bottom: 1px solid #e4e9ee;
}

.hero-metric span,
.hero-metric small,
.metrics span {
  display: block;
  color: var(--muted);
}

.hero-metric strong {
  display: block;
  margin: 5px 0 3px;
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 3.05rem);
  line-height: 1;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid #e4e9ee;
}

.metrics div {
  min-width: 0;
  padding: 14px 0;
  border-top: 1px solid #e4e9ee;
}

.metrics div:nth-child(odd) {
  padding-right: 14px;
}

.metrics div:nth-child(even) {
  padding-left: 14px;
  border-left: 1px solid #e4e9ee;
}

.metrics strong {
  display: block;
  margin-top: 3px;
  font-size: 1.22rem;
}

.stack-chart {
  margin-top: 18px;
}

.stack-track {
  display: flex;
  width: 100%;
  height: 34px;
  overflow: hidden;
  border: 1px solid #d3dbe4;
  border-radius: 8px;
  background: #eef2f5;
}

.stack-segment {
  min-width: 1px;
  height: 100%;
}

.stack-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
  color: #405060;
  font-size: 0.82rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 2px;
}

.detail-table-wrap,
.scenario-table-wrap {
  overflow-x: auto;
}

.detail-table,
.scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.detail-table {
  margin-top: 18px;
}

.detail-table td,
.scenario-table td,
.scenario-table th {
  border-bottom: 1px solid #e4e9ee;
  padding: 10px 0;
  text-align: right;
  vertical-align: top;
}

.detail-table td:first-child,
.scenario-table th:first-child,
.scenario-table td:first-child {
  text-align: left;
}

.detail-table td:first-child {
  color: var(--muted);
}

.scenario-block {
  margin-top: 22px;
}

.scenario-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.positive {
  color: var(--green);
  font-weight: 800;
}

.negative {
  color: var(--red);
  font-weight: 800;
}

.quiet-disclaimer {
  margin: 18px 0 0;
}

.work-band {
  background: #edf3f3;
}

.calculator-band {
  padding: clamp(18px, 3vw, 34px) clamp(16px, 4vw, 44px);
  background: #ffffff;
}

.calculator-layout {
  max-width: 1440px;
  margin: 0 auto;
}

.calculator-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.calculator-card {
  display: block;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  text-decoration: none;
}

.calculator-card:hover,
.calculator-card:focus-visible {
  border-color: #9fb7cc;
  outline: none;
}

.calculator-card strong,
.calculator-card span {
  display: block;
}

.calculator-card strong {
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.25;
}

.calculator-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.content-grid,
.source-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}

.section-copy {
  max-width: 620px;
  margin: 8px 0 16px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.action-row {
  flex-wrap: wrap;
  margin-top: 12px;
}

.sku-results {
  padding: clamp(16px, 2.2vw, 24px);
  min-height: 286px;
}

.source-band {
  background: #ffffff;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-list a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 15px;
  text-decoration: none;
  background: #fbfcfd;
}

.source-list a:hover,
.source-list a:focus-visible {
  border-color: #9fb7cc;
  outline: none;
}

.source-list strong,
.source-list span {
  display: block;
}

.source-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 44px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer strong,
.site-footer span {
  display: block;
}

.site-footer strong {
  color: var(--ink);
}

.footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.footer-links a {
  color: #304151;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--blue-deep);
  text-decoration: underline;
  outline: none;
}

.about-band {
  background: #ffffff;
}

.about-layout {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, 34px) 0;
}

.about-layout h1 {
  max-width: 780px;
}

.about-lede {
  max-width: 760px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.about-grid section {
  border-top: 2px solid #d7e2e1;
  padding-top: 14px;
}

.about-grid h2 {
  margin-bottom: 8px;
}

.about-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.about-grid a {
  color: var(--blue-deep);
  font-weight: 700;
}

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

@media (max-width: 1040px) {
  .tool-grid,
  .content-grid,
  .source-layout {
    grid-template-columns: 1fr;
  }

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

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

  .result-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .freshness {
    width: fit-content;
  }

  .brand-logo {
    width: 174px;
  }

  .input-panel,
  .result-panel,
  .sku-results {
    padding: 16px;
  }

  .input-grid,
  .metrics,
  .stack-legend {
    grid-template-columns: 1fr;
  }

  .metrics div:nth-child(odd),
  .metrics div:nth-child(even) {
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
  }

  .subsection-heading,
  .result-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .search-row {
    align-items: stretch;
  }

  .ghost-button {
    min-width: 58px;
  }

  .site-footer {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 460px) {
  .tool-band,
  .work-band,
  .calculator-band,
  .source-band {
    padding-left: 10px;
    padding-right: 10px;
  }

  .calculator-card-grid {
    grid-template-columns: 1fr;
  }

  .search-row,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ghost-button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
