:root {
  color-scheme: light;
  --bg: #f8fafc;
  --text: #102023;
  --muted: #536a6e;
  --line: #d7e3e4;
  --panel: #ffffff;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #b45309;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #047857;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: var(--primary-dark);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.brand {
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: end;
  gap: 28px;
  padding: 40px 0 28px;
}

.eyebrow {
  color: var(--primary-dark);
  font-weight: 700;
  margin: 0 0 10px;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1.02;
}

.lead {
  color: var(--muted);
  max-width: 760px;
  margin: 16px 0 0;
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-side {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: stretch;
  gap: 12px;
}

.hero-mark {
  width: 72px;
  height: 72px;
  align-self: center;
}

.score-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.score-panel {
  padding: 18px;
  min-height: 150px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.score-label {
  color: var(--muted);
  font-size: 0.86rem;
}

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

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

.panel {
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 14px;
}

textarea,
input {
  width: 100%;
  border: 1px solid #b7c8ca;
  border-radius: 6px;
  background: #fbfefe;
  color: var(--text);
  font: 0.94rem/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 11px;
}

textarea {
  min-height: 170px;
  resize: vertical;
}

textarea.small {
  min-height: 128px;
}

textarea:focus,
input:focus,
button:focus {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

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

button {
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  min-height: 42px;
  padding: 0 15px;
  font-weight: 800;
}

button.secondary {
  background: #fff;
  color: var(--primary-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-height: 72px;
}

.summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
}

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

.summary {
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0 14px;
}

.findings {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.finding {
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 6px;
  padding: 12px;
}

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

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

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

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

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

.severity {
  display: inline-block;
  border-radius: 999px;
  background: #ecfeff;
  color: var(--primary-dark);
  font-size: 0.72rem;
  padding: 3px 8px;
  margin-right: 6px;
  text-transform: uppercase;
}

.output-actions {
  margin-top: 16px;
}

.sources {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.sources h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.sources ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
  padding-left: 18px;
}

.sources li {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 22px, 760px);
    padding-top: 14px;
  }

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

  .topbar {
    align-items: flex-start;
  }

  nav {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 30px;
  }

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

  .hero-side {
    grid-template-columns: 58px 1fr;
  }

  .hero-mark {
    width: 58px;
    height: 58px;
  }

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

  .sources ul {
    grid-template-columns: 1fr;
  }
}

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

  .actions button {
    width: 100%;
  }
}
