:root {
  --bg: #eef3f4;
  --ink: #12191c;
  --muted: #667174;
  --paper: #ffffff;
  --line: #d6e0e2;
  --accent: #1f6f68;
  --accent-2: #c36b3f;
  --deep: #172023;
  --gold: #d6a84f;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(67, 52, 37, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(31, 111, 104, 0.08), transparent 34%),
    linear-gradient(300deg, rgba(195, 107, 63, 0.12), transparent 40%),
    var(--bg);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand,
.link-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--deep);
  font-size: 13px;
}

.link-button,
.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
}

.intro {
  min-height: 280px;
  padding: 22px 0 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  grid-column: 1;
}

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

h1,
h2 {
  margin: 0;
  font-family: Unbounded, Inter, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  max-width: 640px;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.03;
}

h2 {
  font-size: clamp(21px, 3vw, 30px);
  line-height: 1.14;
}

.lead {
  max-width: 570px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.form-panel {
  grid-column: 1;
  padding: 20px;
}

.chart-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 640px;
  padding: 20px;
  background: var(--deep);
  color: var(--paper);
}

.result-panel {
  grid-column: 1 / -1;
  padding: 20px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

label span,
legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

input {
  min-height: 48px;
  padding: 11px 12px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 104, 0.14);
}

fieldset {
  margin: 2px 0 18px;
  padding: 0;
  border: 0;
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.segments label {
  margin: 0;
}

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

.segments span {
  min-height: 42px;
  padding: 10px 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--deep);
  background: #ffffff;
  cursor: pointer;
}

.segments input:checked + span {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--deep);
  font-weight: 800;
  cursor: pointer;
}

.privacy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chart-head,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.chart-wrap {
  width: min(100%, 520px);
  aspect-ratio: 1;
  margin: 24px auto 18px;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.matrix-grid div {
  min-height: 86px;
  padding: 12px;
  display: grid;
  align-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.matrix-grid span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.matrix-grid strong {
  color: var(--gold);
  font-size: 30px;
  line-height: 1;
}

.summary,
.ai-report {
  margin: 18px 0;
  padding: 16px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--deep);
}

.ai-report {
  min-height: 120px;
  border-left-color: var(--gold);
  white-space: pre-wrap;
}

.ai-report.is-loading {
  color: var(--muted);
}

.ai-report.is-error {
  border-left-color: #b42318;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .intro,
  .form-panel,
  .chart-panel,
  .result-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .chart-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .topbar,
  .workspace {
    width: min(100% - 24px, 1180px);
  }

  .workspace {
    padding-top: 10px;
  }

  .field-row,
  .segments,
  .matrix-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: 0;
  }
}
