:root {
  color-scheme: light;
  --ink: #14211f;
  --muted: #5d6f69;
  --line: #dbe6df;
  --paper: #ffffff;
  --mist: #f2f7f4;
  --deep: #0a352d;
  --deep-2: #123f69;
  --mint: #c7f2df;
  --gold: #f8cd5b;
  --coral: #ef765f;
  --blue: #5f88ff;
  --shadow: 0 22px 60px rgba(18, 33, 31, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(10, 53, 45, 0.04), transparent 36rem),
    var(--mist);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 54px);
  background: rgba(255, 255, 255, 0.93);
  border-bottom: 1px solid rgba(20, 33, 31, 0.1);
  backdrop-filter: blur(18px);
}

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

.brand small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, var(--deep), var(--deep-2));
  font-weight: 950;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

nav a,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  font-weight: 900;
}

nav a {
  border-color: rgba(10, 53, 45, 0.15);
  background: white;
}

nav a.active {
  color: white;
  background: var(--deep);
}

main {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 24px;
}

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

.hero-copy {
  padding: clamp(28px, 5vw, 58px);
  background:
    linear-gradient(135deg, rgba(10, 53, 45, 0.96), rgba(18, 63, 105, 0.9)),
    var(--deep);
  color: white;
}

.hero-copy h1 {
  max-width: 780px;
  margin: 10px 0 18px;
  font-size: clamp(40px, 7vw, 82px);
  line-height: 0.98;
}

.hero-copy p {
  max-width: 760px;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(18px, 2.5vw, 23px);
  line-height: 1.42;
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 30px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-card strong {
  font-size: 34px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 8px;
  color: #25715d;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy .eyebrow {
  color: var(--gold);
}

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

.panel {
  padding: clamp(20px, 3vw, 32px);
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h2 {
  font-size: clamp(26px, 4vw, 42px);
}

h3 {
  font-size: 21px;
}

.proposal-stack {
  display: grid;
  gap: 14px;
}

.proposal-card,
.result-card,
.sequence-card,
.history-row,
.metric,
.step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.proposal-card {
  padding: 18px;
}

.card-title-row,
.actions,
.metric-grid,
.result-head,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #21342f;
  font-weight: 850;
}

label.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #b8c9c1;
  border-radius: 8px;
  padding: 12px 13px;
  background: white;
  color: var(--ink);
  font-weight: 650;
}

textarea {
  resize: vertical;
}

.primary {
  color: white;
  background: var(--deep);
}

.primary:hover {
  background: #062820;
}

.secondary {
  color: #071c16;
  background: var(--gold);
}

.ghost {
  color: var(--deep);
  background: transparent;
  border-color: rgba(10, 53, 45, 0.22);
}

.hero-copy .ghost {
  color: white;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.small {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid #a9ded0;
  border-radius: 8px;
  color: #0d513f;
  background: #eefbf7;
  font-weight: 850;
}

.status.error {
  color: #7e2e22;
  background: #fff1ee;
  border-color: #f2b4a9;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}

.ranked-list,
.sequence-list,
.step-list,
.history-list {
  display: grid;
  gap: 12px;
}

.result-card,
.sequence-card,
.metric,
.step {
  padding: 16px;
}

.rank-pill {
  min-width: 44px;
  padding: 8px 10px;
  border-radius: 999px;
  color: white;
  background: var(--deep-2);
  font-weight: 950;
  text-align: center;
}

.score {
  color: #8a4b08;
  font-weight: 950;
}

.sequence-card ol {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding-left: 22px;
}

.next-action {
  padding: 12px;
  border-left: 5px solid var(--coral);
  background: #fff5ef;
  font-weight: 850;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.history-row {
  padding: 18px;
  text-decoration: none;
}

.history-row:hover {
  border-color: var(--deep);
}

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

.empty {
  padding: 28px;
  border: 1px dashed #afc3ba;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
}

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

.footer-note {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 900px) {
  .hero,
  .results-grid,
  .split,
  .summary-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
    width: 100%;
  }

  nav a {
    flex: 1 1 30%;
  }

  main {
    width: min(100vw - 20px, 1240px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 20px;
  }

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

  .card-title-row,
  .actions,
  .result-head,
  .history-row,
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-copy h1 {
    font-size: 42px;
  }
}
