:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --ink: #17201a;
  --muted: #5c675f;
  --line: #cfd8d2;
  --panel: #ffffff;
  --green: #1f7a4a;
  --blue: #255c99;
  --amber: #a66114;
  --red: #b42318;
  --shadow: 0 12px 28px rgba(26, 39, 30, 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;
  line-height: 1.45;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.08;
}

h2 {
  font-size: 1rem;
}

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

main {
  width: min(1220px, calc(100% - 32px));
  margin: 24px auto 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(360px, 1.12fr);
  gap: 18px;
  align-items: stretch;
}

.workspace.lower {
  margin-top: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 32px;
  margin-bottom: 14px;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ee;
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  min-height: 36px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.segmented input:checked + span {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(22, 32, 26, 0.12);
}

.agent-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.agent {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.agent strong {
  display: block;
  font-size: 0.9rem;
}

.agent small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.field span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

textarea,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  font: 0.92rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 10px 11px;
  resize: vertical;
}

textarea:focus,
input[type="text"]:focus,
button:focus,
pre:focus {
  outline: 2px solid rgba(37, 92, 153, 0.35);
  outline-offset: 2px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

button {
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  min-height: 38px;
  padding: 9px 13px;
}

button.secondary {
  border-color: var(--line);
  background: #f8faf7;
  color: var(--ink);
}

pre {
  min-height: 465px;
  max-height: 680px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid #29372f;
  border-radius: 8px;
  background: #101914;
  color: #e8f1ea;
  font: 0.88rem/1.52 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.audit-results {
  display: grid;
  gap: 8px;
}

.finding {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px;
}

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

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

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

.finding strong {
  display: block;
  margin-bottom: 2px;
}

.finding span {
  color: var(--muted);
  font-size: 0.86rem;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
}

.sources a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 700;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  padding: 16px 18px 28px;
  color: var(--muted);
  font-size: 0.84rem;
}

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

  nav {
    justify-content: start;
  }

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

  .agent-list {
    grid-template-columns: 1fr;
  }

  pre {
    min-height: 360px;
  }
}

@media (max-width: 520px) {
  main {
    width: min(100% - 20px, 1220px);
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented span {
    text-align: left;
  }
}
