:root {
  color-scheme: light;
  --ink: #1c1d20;
  --muted: #676b73;
  --line: #d9dde4;
  --surface: #ffffff;
  --surface-soft: #f4f6f8;
  --accent: #0d6b63;
  --accent-strong: #084c47;
  --accent-soft: #dff3ef;
  --accent-tint: rgba(13, 107, 99, 0.08);
  --amber: #d58a00;
  --blue: #255f9c;
  --danger: #9b3d30;
  --shadow: 0 18px 50px rgba(22, 29, 38, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(13, 107, 99, 0.08), transparent 34%),
    linear-gradient(45deg, rgba(213, 138, 0, 0.1), transparent 42%),
    #eef1f4;
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

.status-pill {
  min-width: 128px;
  padding: 10px 14px;
  border: 1px solid rgba(13, 107, 99, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(28, 29, 32, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.output-panel {
  border-color: rgba(13, 107, 99, 0.14);
  background: rgba(255, 255, 255, 0.96);
}

.input-panel,
.output-panel {
  padding: 18px;
}

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

.panel-header h2 {
  margin-bottom: 3px;
  font-size: 1.16rem;
  letter-spacing: 0;
}

.panel-header p {
  max-width: 54ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.icon-button,
.secondary-action,
.primary-action {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  font-size: 1.45rem;
  line-height: 1;
}

.secondary-action {
  min-height: 38px;
  padding: 0 12px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 24px rgba(13, 107, 99, 0.18);
}

.icon-button:hover,
.secondary-action:hover,
.primary-action:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  background: var(--accent-strong);
  box-shadow: 0 14px 28px rgba(13, 107, 99, 0.22);
}

.primary-action:disabled {
  cursor: progress;
  opacity: 0.76;
  transform: none;
  box-shadow: none;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

.field span,
.goals legend {
  color: #2d3136;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #d5dae2;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea::placeholder,
input::placeholder {
  color: #7a7f87;
}

textarea {
  min-height: 104px;
  padding: 12px;
  line-height: 1.45;
  resize: vertical;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

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

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 107, 99, 0.14);
}

.primary-textarea {
  min-height: 170px;
  border-color: rgba(13, 107, 99, 0.28);
  background: linear-gradient(180deg, #ffffff, #fbfefd);
  font-size: 1.02rem;
}

.goals {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.goals legend {
  padding: 0 4px;
}

.goal-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.goal-options label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.goal-options input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.goal-options span {
  display: block;
  padding: 0 10px;
  pointer-events: none;
}

.goal-options label:has(input:checked) {
  border-color: rgba(13, 107, 99, 0.58);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(13, 107, 99, 0.16), 0 4px 10px rgba(13, 107, 99, 0.08);
}

.goal-options label:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(13, 107, 99, 0.16);
}

.goal-options label:hover {
  border-color: rgba(13, 107, 99, 0.38);
  transform: translateY(-1px);
}

.custom-goals-field {
  margin: 10px 0 0;
}

.role-selector {
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(13, 107, 99, 0.06), rgba(13, 107, 99, 0.02));
  border-color: rgba(13, 107, 99, 0.2);
}

.role-options {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.role-other-field {
  margin-top: 10px;
}

.role-other-field[hidden] {
  display: none;
}

.other-model-field[hidden] {
  display: none;
}

.other-model-field {
  grid-column: 1 / -1;
}

.score-strip {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 13px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--accent-soft), rgba(37, 95, 156, 0.08));
}

.score-strip > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.score-label {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 850;
}

.score-label em {
  margin-left: 7px;
  color: var(--muted);
  font-style: normal;
  font-weight: 750;
}

#scoreText {
  color: var(--accent-strong);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--accent), var(--blue));
  transition: width 240ms ease;
}

.score-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.score-meta span {
  padding: 4px 8px;
  border: 1px solid rgba(103, 107, 115, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.score-meta span.is-met {
  border-color: rgba(13, 107, 99, 0.28);
  background: rgba(13, 107, 99, 0.1);
  color: var(--accent-strong);
}

.output-field textarea {
  min-height: 430px;
  border-color: rgba(13, 107, 99, 0.16);
  background: #fbfcfd;
}

.change-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  transition: border-color 140ms ease, background 140ms ease;
}

.change-card h3 {
  margin-bottom: 5px;
  font-size: 0.96rem;
}

.insight-hint {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.change-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: #34373d;
  line-height: 1.38;
}

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

  .output-field textarea {
    min-height: 340px;
  }
}

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

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    width: 100%;
  }

  .field-grid,
  .goal-options {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.3rem;
  }
}
