:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --panel: #ffffff;
  --line: #dce5ed;
  --text: #172331;
  --muted: #617083;
  --teal: #097c83;
  --teal-dark: #055f65;
  --amber: #a76200;
  --red: #b42318;
  --green: #047857;
  --soft-teal: #e7f4f4;
  --soft-amber: #fff6df;
  --soft-red: #fff0ef;
  --shadow: 0 16px 40px rgba(23, 35, 49, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
textarea,
input {
  font: inherit;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
}

.brand span,
.section-title p,
label,
.meta-grid span,
.summary-line,
.feedback-box p {
  color: var(--muted);
}

.brand span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.status-strip {
  max-width: 52vw;
  color: var(--teal-dark);
  background: var(--soft-teal);
  border: 1px solid #c7e6e8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.35fr);
  gap: 20px;
  padding: 24px;
  max-width: 1480px;
  margin: 0 auto;
}

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

.section-title {
  margin-bottom: 18px;
}

.section-title h1,
.section-title h2 {
  margin: 0;
  line-height: 1.15;
}

.section-title h1 {
  font-size: 24px;
}

.section-title h2 {
  font-size: 17px;
}

.section-title p {
  margin: 7px 0 0;
  font-size: 13px;
}

.section-title.compact {
  margin-bottom: 10px;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfdfe;
  color: var(--text);
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(9, 124, 131, 0.12);
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  margin-bottom: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  text-transform: none;
}

.toggle-control input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--teal);
}

.toggle-control small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.ai-gate {
  margin-top: 10px;
}

.ai-gate-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.ai-gate-row[hidden] {
  display: none;
}

.ai-gate-row input {
  padding: 9px 10px;
}

.ai-gate-row span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

button:hover {
  border-color: #9fb2c2;
}

button.primary {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

button.primary:hover {
  background: var(--teal-dark);
}

.examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.examples button {
  text-align: left;
  font-weight: 650;
}

.feedback-box {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.feedback-box h2 {
  margin: 0;
  font-size: 17px;
}

.feedback-box p {
  margin: 4px 0 0;
  font-size: 13px;
}

.feedback-box input {
  margin-top: 12px;
}

.answer-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  padding: 16px;
  min-height: 150px;
}

.answer-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.answer-text {
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 15px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.meta-grid div {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #ffffff;
}

.meta-grid span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chip-green {
  color: var(--green);
}

.chip-amber {
  color: var(--amber);
}

.chip-red {
  color: var(--red);
}

.regression-panel {
  margin-top: 20px;
}

.summary-line {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--soft-teal);
  font-size: 13px;
}

.table-wrap {
  margin-top: 10px;
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #eef4f8;
  color: #364657;
  font-size: 11px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.status-pass {
  color: var(--green);
  font-weight: 800;
}

.status-fail {
  color: var(--red);
  font-weight: 800;
}

.loading {
  opacity: 0.65;
  pointer-events: none;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .status-strip {
    max-width: 100%;
    white-space: normal;
  }

  .shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

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

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

  .ai-gate-row {
    grid-template-columns: 1fr;
  }

  .ai-gate-row span {
    white-space: normal;
  }
}
