:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171717;
  background: #f5f5f3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f7f5 0%, #eeeeea 100%);
}

button, input, select, textarea { font: inherit; }

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

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

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #b41f2d;
  margin-bottom: 8px;
}

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

h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  margin-bottom: 10px;
}

.subhead {
  max-width: 720px;
  color: #616161;
  font-size: 17px;
  line-height: 1.5;
}

.status-pill,
.state-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill {
  background: #fff;
  border: 1px solid #deded9;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
}

.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dfdfda;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.05);
}

.card h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ccccca;
  background: #fff;
  border-radius: 12px;
  padding: 12px 13px;
  color: #171717;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8e8e89;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.helper {
  color: #6a6a67;
  font-size: 12px;
  line-height: 1.5;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: #171717;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

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

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.summary {
  padding: 16px;
  border-radius: 14px;
  background: #f5f5f2;
  color: #373737;
  line-height: 1.55;
  min-height: 78px;
}

.state-badge.muted { background: #ececea; color: #60605d; }
.state-badge.stable { background: #e5f4e9; color: #1e6b34; }
.state-badge.shifting { background: #fff0ce; color: #8b5b00; }
.state-badge.drift { background: #f9dfe2; color: #9a2030; }
.state-badge.error { background: #efe7e7; color: #8b2525; }

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

.metrics > div {
  border: 1px solid #e1e1dd;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.metrics span {
  display: block;
  font-size: 12px;
  color: #747470;
  margin-bottom: 6px;
}

.metrics strong {
  font-size: 18px;
  word-break: break-word;
}

.raw-panel {
  margin-top: 18px;
  border-top: 1px solid #e5e5e1;
  padding-top: 16px;
}

.raw-panel summary {
  cursor: pointer;
  font-weight: 700;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #171717;
  color: #f5f5f5;
  padding: 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 840px) {
  .topbar { flex-direction: column; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 22px; }
  .card { padding: 18px; border-radius: 16px; }
  .metrics { grid-template-columns: 1fr; }
}
