:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --surface: #ffffff;
  --ink: #17212b;
  --muted: #5e6b77;
  --line: #d8e0e7;
  --primary: #0b5c6b;
  --primary-strong: #084954;
  --accent: #c2410c;
  --good: #177245;
  --warn: #a35d00;
  --bad: #b42318;
  --critical: #7a271a;
  --shadow: 0 10px 30px rgba(15, 35, 50, 0.09);
}

* {
  box-sizing: border-box;
}

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

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

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 44px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

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

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

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

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 44px) 40px;
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.hero-copy,
.score-panel,
.editor-pane,
.result-pane {
  min-width: 0;
  max-width: 100%;
}

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

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

h1 {
  max-width: 820px;
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.lede {
  max-width: 800px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.score-panel {
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.score-label,
.score-panel span {
  display: block;
  color: rgba(255, 255, 255, 0.78);
}

.score-panel strong {
  display: block;
  font-size: 4rem;
  line-height: 1;
  margin: 5px 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.84fr);
  gap: 18px;
  align-items: stretch;
}

.editor-pane,
.result-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.pane-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

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

button,
.file-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  min-height: 38px;
  padding: 0 13px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

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

.primary:hover {
  background: var(--primary-strong);
}

.secondary:hover,
.file-btn:hover {
  border-color: var(--primary);
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 1.35rem;
}

.file-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

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

textarea {
  display: block;
  width: 100%;
  min-height: 560px;
  resize: vertical;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  color: #10202d;
  background: #fbfdff;
  font: 0.9rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

textarea:focus,
button:focus-visible,
.file-btn:focus-within {
  outline: 3px solid rgba(11, 92, 107, 0.22);
  outline-offset: 2px;
}

.run-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

#statusText {
  color: var(--muted);
  font-size: 0.93rem;
  text-align: right;
}

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

.metric-grid div {
  background: #fff;
  padding: 13px;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
}

.recommendations {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.recommendations:empty {
  display: none;
}

.recommendations h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.recommendations ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.findings {
  max-height: 560px;
  overflow: auto;
  padding: 14px;
}

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

.finding {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 12px;
  background: #fff;
}

.finding.critical {
  border-left-color: var(--critical);
}

.finding.high {
  border-left-color: var(--bad);
}

.finding.medium {
  border-left-color: var(--warn);
}

.finding.low {
  border-left-color: var(--good);
}

.finding-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.finding h3 {
  margin: 0;
  font-size: 0.98rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf2f7;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.finding p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.evidence {
  margin-top: 10px;
  padding: 10px;
  border-radius: 7px;
  background: #f4f7f9;
  color: #243441;
  overflow-wrap: anywhere;
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.reference-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 24px;
  padding: 20px 0 0;
}

.reference-band ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 44px) 34px;
  color: var(--muted);
}

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

  textarea,
  .findings {
    min-height: 380px;
    max-height: none;
  }
}

@media (max-width: 620px) {
  .topbar,
  .pane-head,
  .run-row,
  footer {
    align-items: stretch;
    flex-direction: column;
  }

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

  h1 {
    font-size: 2rem;
    line-height: 1.04;
    overflow-wrap: anywhere;
  }

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

  .score-panel strong {
    font-size: 3.2rem;
  }
}
