:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #d9e1e7;
  --text: #122033;
  --muted: #607084;
  --teal: #097c83;
  --teal-dark: #055f65;
  --amber: #a76200;
  --red: #b42318;
  --green: #047857;
  --soft-teal: #e9f6f5;
  --soft-amber: #fff6df;
  --soft-red: #fff0ef;
  --shadow: 0 10px 28px rgba(18, 32, 51, 0.06);
}

* {
  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", "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

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

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

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

.brand span {
  display: block;
  margin-top: 2px;
  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;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.mode-link {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.mode-link:hover {
  text-decoration: underline;
}

.engineer-only {
  display: none !important;
}

body.engineer-mode .engineer-only {
  display: revert !important;
}

body.engineer-mode .meta-grid {
  display: grid !important;
}

body.engineer-mode .examples {
  display: grid !important;
}

body.engineer-mode .ai-gate-row[hidden],
body.engineer-mode .support-fallback[hidden] {
  display: none !important;
}

.shell {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(520px, 1.18fr);
  gap: 18px;
  padding: 22px;
  max-width: 1320px;
  margin: 0 auto;
}

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

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

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

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

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

.section-title p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

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

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

.notice-card {
  border: 1px solid #c7e6e8;
  border-radius: 6px;
  background: var(--soft-teal);
  padding: 13px;
  margin-bottom: 12px;
}

.notice-card strong,
.contact-card strong {
  display: block;
  font-size: 13px;
}

.notice-card p {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 16px;
}

.scope-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #405064;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  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: 12px;
  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: 13px;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 13px;
  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: 20px;
  padding-top: 16px;
  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: 8px;
  background: #fbfdfe;
  padding: 18px;
  min-height: 190px;
}

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

.answer-text {
  margin-top: 10px;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 16px;
}

.support-fallback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  border: 1px solid #f0d393;
  border-radius: 8px;
  background: var(--soft-amber);
  padding: 14px;
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  border: 1px solid #c7e6e8;
  border-radius: 8px;
  background: var(--soft-teal);
  padding: 14px;
}

.contact-card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.contact-card a {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  background: #ffffff;
  color: var(--teal-dark);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.support-fallback[hidden] {
  display: none;
}

.support-fallback strong {
  display: block;
  font-size: 13px;
}

.support-fallback span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.support-fallback a {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  background: #ffffff;
  color: var(--teal-dark);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.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;
  }

  .topbar-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .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;
  }

  .support-fallback {
    align-items: stretch;
    flex-direction: column;
  }

  .support-fallback a,
  .contact-card a {
    text-align: center;
  }

  .contact-card {
    align-items: stretch;
    flex-direction: column;
  }
}
