:root {
  --bg-top: #f2f6f0;
  --bg-bottom: #fbfcf8;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #d8dfd2;
  --text: #21332b;
  --muted: #6d7d75;
  --brand-deep: #173f34;
  --brand: #255849;
  --shadow: 0 20px 45px rgba(36, 62, 49, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(208, 227, 214, 0.9), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 22px 44px;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(225, 230, 221, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px 28px 18px;
}

.hero-title-row,
.section-heading,
.toggle-row,
.hero-meta,
.modal-header,
.modal-actions,
.modal-grid,
.modal-action-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
}

h1,
h2,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

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

.hero-card p,
.hero-meta,
.field-label {
  color: var(--muted);
}

.section-heading-simple {
  justify-content: flex-start;
}

.hero-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.panel {
  padding: 22px;
}

.action-panel,
.report-panel,
.stage-panel,
.admin-panel {
  grid-column: 1 / -1;
}

.action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-panel {
  border-color: #cfdad2;
  background: linear-gradient(180deg, rgba(248, 250, 247, 0.98), rgba(255, 255, 255, 0.94));
}

.admin-panel-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.admin-action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.text-input,
.text-area,
select {
  width: 100%;
  border: 1px solid #cfd8cd;
  border-radius: 16px;
  padding: 15px 16px;
  background: #fff;
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.text-input:focus,
.text-area:focus,
select:focus {
  border-color: #8ea89a;
  box-shadow: 0 0 0 4px rgba(58, 98, 78, 0.12);
}

.text-area {
  min-height: 168px;
  resize: vertical;
}

.text-area.compact {
  min-height: 110px;
}

.upload-field {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.upload-tip {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.chip,
.ghost-button,
.primary-button,
.modal-close {
  border: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.chip {
  min-width: 220px;
  padding: 16px 22px;
  border-radius: 999px;
  color: var(--brand-deep);
  font-size: 16px;
  font-weight: 600;
  background: #f6f8f3;
  border: 1px solid #dce4d8;
}

.chip.active {
  color: #fff;
  background: linear-gradient(180deg, #34414f, #23313d);
  box-shadow: 0 10px 22px rgba(38, 55, 66, 0.18);
}

.toggle-row-balanced {
  justify-content: flex-start;
  gap: 18px;
  margin-top: 10px;
  margin-bottom: 8px;
}

.ghost-button {
  padding: 12px 20px;
  border-radius: 14px;
  color: #3b4b45;
  background: #f7f8f6;
  border: 1px solid #cfd7d4;
}

.primary-button {
  min-width: 240px;
  padding: 16px 24px;
  border-radius: 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  box-shadow: 0 16px 28px rgba(28, 66, 52, 0.24);
}

.primary-button:hover,
.ghost-button:hover,
.chip:hover,
.modal-close:hover {
  transform: translateY(-1px);
}

.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.report-output {
  margin-top: 18px;
  min-height: 420px;
  padding: 22px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(242, 246, 240, 0.68), rgba(255, 255, 255, 0.96)),
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 27px,
      rgba(36, 56, 45, 0.05) 27px,
      rgba(36, 56, 45, 0.05) 28px
    );
  border: 1px solid #e0e6dc;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Consolas", "Courier New", monospace;
  line-height: 1.8;
  overflow: auto;
}

.compact-output {
  min-height: 260px;
  font-size: 13px;
  line-height: 1.7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 34, 28, 0.28);
  backdrop-filter: blur(8px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(225, 230, 221, 0.95);
  box-shadow: 0 26px 60px rgba(26, 44, 37, 0.22);
}

.admin-login-card {
  width: min(520px, 100%);
}

.modal-header p {
  margin-top: 6px;
  color: var(--muted);
}

.modal-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 24px;
  color: var(--brand-deep);
  background: #eff4ed;
}

.modal-grid > * {
  flex: 1;
}

.quick-model-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #f7f8f6;
  border: 1px solid #dce4d8;
}

.quick-model-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.search-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-weight: 700;
  color: var(--brand-deep);
}

.search-toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.modal-actions {
  margin-top: 20px;
}

.modal-save-button {
  min-width: 180px;
}

.llm-test-result {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid #dbe3d8;
  background: #f7faf6;
}

.llm-test-result strong {
  display: block;
  font-size: 15px;
}

.llm-test-result p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.llm-test-result.is-success {
  border-color: #bdd6c3;
  background: #edf7ef;
}

.llm-test-result.is-success strong {
  color: #1f6840;
}

.llm-test-result.is-error {
  border-color: #e4c6c6;
  background: #fff4f4;
}

.llm-test-result.is-error strong {
  color: #9b2f2f;
}

.llm-test-result.is-testing {
  border-color: #d4dcd0;
  background: #f3f6f2;
}

.llm-test-result.is-testing strong {
  color: #385247;
}

@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .action-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px 14px 30px;
  }

  .hero-card,
  .panel {
    border-radius: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .hero-title-row,
  .section-heading,
  .hero-meta,
  .hero-actions,
  .admin-action-row,
    .modal-header,
    .modal-actions,
    .modal-grid,
    .quick-model-row,
    .search-toggle-row,
    .modal-action-group {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-button,
  .modal-save-button {
    width: 100%;
    min-width: 0;
  }

  .chip {
    min-width: 0;
    width: 100%;
  }

  .toggle-row-balanced {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .modal-card {
    padding: 20px;
  }
}
