:root {
  color-scheme: light;
  --bg: #f7faf9;
  --ink: #17211f;
  --muted: #5a6965;
  --line: #d7e1de;
  --panel: #ffffff;
  --accent: #256f62;
  --accent-dark: #174e45;
  --warn: #a54d18;
  --danger: #a82d35;
  --ok: #2f6b38;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  font-size: 14px;
}

main {
  padding: clamp(18px, 4vw, 48px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 24px;
  align-items: stretch;
  max-width: 1180px;
  margin: 0 auto 28px;
}

.hero-copy {
  padding: clamp(20px, 4vw, 44px) 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(34px, 6vw, 66px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.lede {
  max-width: 780px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.score-panel {
  align-self: center;
  min-height: 210px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 6px;
  box-shadow: 0 14px 36px rgba(23, 33, 31, 0.08);
}

.score-label {
  color: var(--muted);
  font-weight: 700;
}

#scoreValue {
  font-size: 70px;
  line-height: 1;
  color: var(--accent-dark);
}

#scoreGrade {
  color: var(--muted);
}

.workspace {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr);
  gap: 18px;
}

.editor-pane,
.result-pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.pane-head {
  min-height: 92px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.pane-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.actions,
.run-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button,
.icon-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 0 14px;
  cursor: pointer;
}

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

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.secondary:hover,
.icon-btn:hover {
  border-color: var(--accent);
}

.icon-btn {
  width: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 24px;
}

.file-btn input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

textarea {
  width: 100%;
  min-height: 470px;
  resize: vertical;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #15201d;
  background: #fbfdfc;
}

textarea:focus {
  outline: 2px solid rgba(37, 111, 98, 0.22);
  outline-offset: -2px;
}

.run-row {
  min-height: 64px;
  justify-content: space-between;
  padding: 12px 16px;
}

#statusText {
  color: var(--muted);
  font-size: 14px;
}

.metric-grid,
.inventory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-grid div,
.inventory div {
  background: #fbfdfc;
  padding: 14px;
  min-width: 0;
}

.metric-grid span,
.inventory span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-grid strong,
.inventory strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.recommendations {
  padding: 14px 16px 2px;
}

.recommendations p {
  border-left: 4px solid var(--accent);
  padding-left: 10px;
  color: var(--muted);
}

.findings {
  padding: 16px;
  display: grid;
  gap: 12px;
}

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

.finding {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.finding-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.finding-head span {
  flex: none;
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  background: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.severity-critical .finding-head span,
.severity-high .finding-head span {
  background: var(--danger);
}

.severity-medium .finding-head span {
  background: var(--warn);
}

.severity-low .finding-head span {
  background: var(--ok);
}

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

dl {
  margin: 0;
  display: grid;
  gap: 4px;
}

dt {
  font-weight: 800;
}

dd {
  margin: 0 0 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.reference-band {
  max-width: 1180px;
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.reference-band > div {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

li {
  margin: 8px 0;
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 48px);
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 30px;
}

.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;
}

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

  nav {
    justify-content: flex-start;
  }

  .hero,
  .workspace,
  .reference-band {
    grid-template-columns: 1fr;
  }

  .score-panel {
    min-height: 150px;
  }

  .pane-head {
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

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

@media (max-width: 520px) {
  main {
    padding: 16px;
  }

  h1 {
    font-size: 36px;
  }

  textarea {
    min-height: 360px;
  }
}
