:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #172026;
  --muted: #63717c;
  --line: #dce2e7;
  --panel: #ffffff;
  --blue: #2357d9;
  --green: #0f8a68;
  --amber: #b46a09;
  --red: #c13f34;
  --shadow: 0 16px 45px rgba(23, 32, 38, 0.08);
}

* { box-sizing: border-box; }

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

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.status-pill, .badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.running {
  color: var(--blue);
  border-color: rgba(35, 87, 217, 0.35);
}

.audit-panel, .panel, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.audit-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.url-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  height: 46px;
  border: 1px solid #cbd4dc;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(35, 87, 217, 0.14);
}

button {
  height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.method-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.metric {
  padding: 16px;
  box-shadow: none;
}

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

.metric strong {
  display: block;
  margin-top: 9px;
  font-size: 24px;
  line-height: 1.1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 18px;
}

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

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.opportunity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.opportunity-list li {
  padding-left: 4px;
  line-height: 1.45;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.signal {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 78px;
}

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

.signal strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  word-break: break-word;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 10px;
  overflow-x: auto;
}

.tab {
  height: 40px;
  background: #e8edf2;
  color: #26323b;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
}

.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  vertical-align: top;
}

.type {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.type.Measured { background: rgba(15, 138, 104, 0.12); color: var(--green); }
.type.Inferred { background: rgba(180, 106, 9, 0.13); color: var(--amber); }
.type.Needs { background: rgba(35, 87, 217, 0.12); color: var(--blue); }

.cards {
  display: grid;
  gap: 12px;
}

.rec-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
}

.rec-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rec-card p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.impl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.impl-box ul {
  margin-bottom: 0;
  padding-left: 20px;
}

pre {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #eaf2f8;
  padding: 14px;
  font-size: 12px;
}

.empty {
  color: var(--muted);
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .shell { width: min(100% - 24px, 1440px); padding-top: 18px; }
  .topbar, .input-row, .content-grid { grid-template-columns: 1fr; display: grid; }
  .summary-grid, .impl-grid { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 28px; }
}

@media (max-width: 560px) {
  .summary-grid, .signal-grid, .impl-grid { grid-template-columns: 1fr; }
  button { width: 100%; }
  .table { font-size: 13px; }
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
