:root {
  --ink: #15202b;
  --muted: #657789;
  --paper: #f5f8f7;
  --panel: #ffffff;
  --line: #d9e2e1;
  --blue: #145c8c;
  --teal: #087b72;
  --gold: #b57b2b;
  --coral: #b65341;
  --green: #537c45;
  --shadow: 0 18px 50px rgba(21, 32, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.landing-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 5vw, 48px);
  background: #f5f8f7;
}

.problem-shell {
  display: grid;
  gap: 14px;
  width: min(860px, 100%);
}

.problem-box {
  min-height: clamp(220px, 36vh, 360px);
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1.5;
  white-space: pre-wrap;
}

.problem-box:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(8, 123, 114, 0.16);
}

.run-button {
  justify-self: end;
  min-width: 116px;
  min-height: 46px;
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
  font-weight: 760;
}

.run-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

button,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 248, 247, 0.94);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  border-radius: 8px;
  font-weight: 850;
}

.brand strong,
.brand small {
  display: block;
}

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

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(480px, 1.14fr);
  gap: 18px;
  width: min(1520px, calc(100% - 32px));
  margin: 18px auto 32px;
}

.goal-panel,
.results-panel,
.summary-band,
.job-table-wrap,
.input-browser,
.brief-box,
.report-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.goal-panel {
  padding: 18px;
}

.results-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.panel-head,
.summary-band,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

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

h1 {
  font-size: clamp(1.6rem, 3vw, 2.7rem);
}

h2 {
  font-size: 1.22rem;
}

.status-pill {
  min-width: 94px;
  padding: 8px 10px;
  color: white;
  background: var(--green);
  border-radius: 8px;
  text-align: center;
  font-weight: 750;
}

.molecule-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  margin: 18px 0;
  align-items: stretch;
}

#moleculeCanvas {
  width: 100%;
  height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(20, 92, 140, 0.08), rgba(8, 123, 114, 0.08)),
    #fbfdfc;
}

.molecule-facts {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 0.92rem;
}

.molecule-facts strong {
  display: block;
  color: var(--ink);
  font-size: 1.55rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

button {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
}

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

button:hover {
  border-color: var(--teal);
}

.compact {
  margin-bottom: 0;
}

.editor-label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-weight: 700;
}

textarea,
pre,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

textarea {
  min-height: 420px;
  padding: 12px;
  resize: vertical;
  color: #21313f;
  line-height: 1.45;
  white-space: pre;
  overflow: auto;
}

.question-editor {
  min-height: 128px;
  white-space: pre-wrap;
}

.summary-band {
  padding: 16px;
  align-items: center;
}

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

.metrics span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 92px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--muted);
}

.metrics strong {
  color: var(--coral);
  font-size: 1.3rem;
}

.job-table-wrap {
  overflow: auto;
}

.job-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  background: #fbfdfc;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td:first-child {
  width: 190px;
  font-weight: 720;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 7px;
  color: #17313b;
  background: rgba(181, 123, 43, 0.16);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.78fr);
  gap: 14px;
}

.input-browser,
.brief-box,
.report-box {
  min-width: 0;
  padding: 14px;
}

select {
  max-width: 320px;
  min-height: 38px;
  padding: 8px 10px;
}

pre {
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  padding: 12px;
  color: #1e2f3b;
  line-height: 1.5;
  white-space: pre-wrap;
}

#inputPreview {
  white-space: pre;
}

#briefPreview {
  min-height: 220px;
}

#workdirText {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.8rem;
}

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

  textarea {
    min-height: 340px;
  }

  .question-editor {
    min-height: 128px;
  }
}

@media (max-width: 680px) {
  .topbar,
  .panel-head,
  .summary-band,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .workspace {
    width: min(100% - 20px, 1520px);
  }

  .molecule-strip {
    grid-template-columns: 1fr;
  }

  .molecule-facts {
    grid-template-columns: repeat(3, 1fr);
  }

  .run-button {
    justify-self: stretch;
  }
}
