:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --danger: #dc2626;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font: 16px/1.5 "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 40px 16px;
}

.page-wrap {
  max-width: 920px;
  margin: 0 auto;
}

.app-shell {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--surface-muted);
  flex-shrink: 0;
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.env-badge {
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.notice-block {
  margin-bottom: 20px;
}

.notice-card {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.notice-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}

.notice-card p {
  margin: 0;
  color: #374151;
  font-size: 14px;
}

.risk-line {
  margin-top: 10px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #991b1b;
  font-size: 13px;
  font-weight: 500;
}

.trust-tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trust-tags span {
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
}

.tabs {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.tab-btn:hover {
  color: #1f2937;
}

.tab-btn:focus-visible,
.input:focus-visible,
.btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.tab-btn.active {
  border-color: #bfdbfe;
  color: var(--primary);
  background: #ffffff;
}

.tab-pane {
  display: none;
  opacity: 0;
  transform: translateY(4px);
}

.tab-pane.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 200ms ease, transform 200ms ease;
}

.inline-note {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 12px;
  color: #374151;
  font-size: 14px;
  margin-bottom: 16px;
}

.form-row {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.required::before {
  content: "*";
  color: var(--danger);
  margin-right: 4px;
}

.input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input.error {
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.help {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.field-tip.validation {
  margin-top: 4px;
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
}

.checkbox-group {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  margin-right: 16px;
  margin-bottom: 8px;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-inline input {
  margin-right: 6px;
}

.btn {
  width: 100%;
  height: 46px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, opacity 160ms ease;
}

.btn-primary {
  background: var(--primary);
}

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

.btn-success {
  background: var(--success);
}

.btn-success:hover {
  background: #047857;
}

.btn:disabled,
.btn.is-loading {
  cursor: not-allowed;
  opacity: 0.75;
}

.result-card {
  display: none;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px;
}

.result-item {
  margin-bottom: 12px;
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.result-value {
  color: #111827;
  font: 13px/1.6 SFMono-Regular, Consolas, "Liberation Mono", monospace;
  word-break: break-all;
}

.status-ok {
  color: var(--success);
  font-weight: 600;
}

.status-off {
  color: var(--text-muted);
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translate(-50%, -8px);
  min-width: 240px;
  max-width: min(90vw, 560px);
  border-radius: 10px;
  border-left: 4px solid var(--primary);
  background: #111827;
  color: #f9fafb;
  padding: 10px 14px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 10000;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-type="success"] {
  border-left-color: var(--success);
}

.toast[data-type="error"] {
  border-left-color: var(--danger);
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 16px;
}

.modal {
  width: min(100%, 560px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  padding: 20px;
}

.modal h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal .modal-body {
  color: #374151;
  font-size: 14px;
  line-height: 1.6;
  max-height: 60vh;
  overflow: auto;
}

.modal .modal-footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.modal .modal-footer .btn {
  width: auto;
  min-width: 96px;
  padding: 0 14px;
}

.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(245, 246, 248, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9997;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid #d1d5db;
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1023px) {
  body {
    padding: 28px 14px;
  }

  .app-shell {
    padding: 22px;
  }
}

@media (max-width: 767px) {
  body {
    padding: 14px 10px;
  }

  .app-shell {
    padding: 16px;
    border-radius: 14px;
  }

  .brand-head {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-head h1 {
    font-size: 19px;
  }

  .env-badge {
    width: fit-content;
  }

  .checkbox-inline {
    display: flex;
    margin-right: 0;
  }

  .toast {
    top: 12px;
    min-width: 0;
    width: calc(100vw - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
