:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #15803d;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #e8efff 0, var(--bg) 45%, #f8fafc 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

[hidden] {
  display: none !important;
}

.survey,
.admin-page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.admin-page {
  max-width: 1040px;
}

.survey-page,
.report-section,
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.survey-page {
  padding: 32px 32px 28px;
}

.survey-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.survey-kicker,
.admin-kicker {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.survey-title,
.admin-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}

.admin-title {
  font-size: 30px;
}

.progress {
  margin: 0 0 22px;
  padding: 9px 14px;
  background: #eff6ff;
  border-radius: 999px;
  color: #1e40af;
  font-size: 14px;
  font-weight: 600;
  display: inline-block;
}

.form-error {
  margin: 0 0 20px;
  padding: 11px 14px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.question-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.question {
  margin: 0;
  padding: 0;
}

.prompt {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.5;
}

.required-mark {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
  font-weight: 600;
  vertical-align: 2px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdff;
}

.option:hover {
  border-color: #bfdbfe;
  background: #f5f9ff;
}

.option input {
  margin-top: 4px;
  accent-color: var(--primary);
}

.option-label {
  flex: 1;
  cursor: pointer;
}

.text-input,
.select-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
}

.text-input:focus,
.select-input:focus,
.option input:focus-visible,
.primary:focus-visible,
.report-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
  border-color: var(--primary);
}

.actions {
  margin-top: 30px;
  display: flex;
  justify-content: flex-end;
}

.primary {
  padding: 11px 26px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

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

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.loading,
.load-error {
  margin: 0 0 18px;
  color: var(--muted);
}

.thank-you-page {
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.thank-you {
  margin: 0;
  font-size: 28px;
  line-height: 1.4;
}

.admin-head {
  margin-bottom: 22px;
}

.admin-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-status {
  min-height: 24px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.admin-status.is-error {
  color: var(--danger);
  font-weight: 600;
}

.report-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.report-section {
  padding: 20px 22px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.definition-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 8px 18px;
}

.definition-list dt {
  color: var(--muted);
  font-size: 14px;
}

.definition-list dd {
  margin: 0;
  word-break: break-all;
}

.table-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.data-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #f8fbff;
}

.empty-note {
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

.compliance-form {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 6px 0 16px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  accent-color: var(--primary);
}

.form-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.form-hint.is-error {
  color: var(--danger);
  font-weight: 600;
}

.report-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

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

.admin-page-wide .table-wrap {
  background: var(--card);
}

.reports-table td {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .survey,
  .admin-page {
    padding: 20px 12px 48px;
  }

  .survey-page {
    padding: 22px 18px 20px;
  }

  .survey-title {
    font-size: 22px;
  }

  .definition-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .definition-list dd {
    margin-bottom: 8px;
  }

  .actions .primary {
    width: 100%;
  }
}
