:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #60707a;
  --line: #d8e0e4;
  --surface: #ffffff;
  --surface-soft: #f4f7f8;
  --accent: #0b806f;
  --accent-dark: #075f54;
  --warn: #b45f06;
  --danger: #b42318;
  --ok: #177245;
  --shadow: 0 18px 50px rgba(16, 36, 46, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(11, 128, 111, 0.12), rgba(220, 233, 235, 0.3) 42%, rgba(255, 255, 255, 0.4)),
    #eef3f4;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 24px;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.workspace,
.results {
  display: grid;
  gap: 16px;
  align-content: start;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  padding: 4px 4px 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.77rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.panel,
.score-card,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.input-panel {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

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

.field {
  display: grid;
  gap: 7px;
}

.field span,
.range-field span {
  color: #34434b;
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c7d2d8;
  border-radius: 6px;
  background: #fbfcfc;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 128, 111, 0.15);
}

.ghost-button {
  min-height: 40px;
  border: 1px solid #b9c8cd;
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--accent);
}

.primary-button {
  min-height: 40px;
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 740;
  cursor: pointer;
}

.primary-button:disabled {
  border-color: #a8b7bd;
  background: #a8b7bd;
  cursor: not-allowed;
}

.monetise-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.monetise-panel h2 {
  max-width: 620px;
  margin: 0;
  line-height: 1.35;
}

.credit-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.slider-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 18px;
}

.range-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.range-field input {
  grid-column: 1 / -1;
  min-height: 28px;
  padding: 0;
  accent-color: var(--accent);
}

output {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.results {
  position: sticky;
  top: 24px;
}

.score-card {
  padding: 22px;
}

.score-row {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
}

.score-row strong {
  font-size: 3.8rem;
  line-height: 0.85;
}

.score-row span {
  max-width: 210px;
  color: var(--muted);
  font-weight: 700;
}

.score-bar {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e3eaed;
}

.score-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

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

.metric {
  min-height: 104px;
  padding: 16px;
}

.metric span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric strong {
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  letter-spacing: 0;
}

.premium-output {
  position: relative;
}

.premium-output.locked > * {
  filter: blur(4px);
  opacity: 0.48;
  pointer-events: none;
}

.premium-output.locked::after {
  content: "Unlock full breakdown";
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  border: 1px dashed #a9b8be;
  border-radius: 6px;
  background: rgba(244, 247, 248, 0.88);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.compact {
  box-shadow: none;
}

.verdict {
  margin: 12px 0;
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  background: var(--surface-soft);
  font-weight: 700;
}

.comparison-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
  margin-top: 12px;
}

.comparison-row span {
  color: var(--muted);
}

.note,
.sources p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

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

.flags li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfc;
  color: #34434b;
  font-size: 0.9rem;
}

.flags li.warning {
  border-color: rgba(180, 95, 6, 0.35);
  background: rgba(180, 95, 6, 0.08);
}

.flags li.danger {
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.08);
}

.flags li.ok {
  border-color: rgba(23, 114, 69, 0.35);
  background: rgba(23, 114, 69, 0.08);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .results {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding: 12px 0;
  }

  .topbar,
  .monetise-panel,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .credit-actions {
    justify-content: start;
    width: 100%;
  }

  .form-grid,
  .evidence-grid,
  .slider-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .score-card {
    padding: 16px;
  }
}
