:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --ok: #059669;
  --err: #dc2626;
  --warn: #d97706;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(14, 165, 233, 0.35), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.2), transparent 50%),
    linear-gradient(160deg, #0b1224, #132039 45%, #0f172a);
  min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  min-height: 100vh;
}

.shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 28px 16px 48px;
}

.hero {
  text-align: center;
  color: #e2e8f0;
  margin-bottom: 28px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.02em;
}
.hero p { margin: 0; color: #94a3b8; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card.narrow { width: min(440px, 100%); }
.card h1, .card h2 { margin-top: 0; }

.login-grid {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; transform: translateY(-1px); }
.btn:disabled, .btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-block { width: 100%; }
.btn-ghost {
  background: #f1f5f9;
  color: #0f172a;
}
.btn-ghost:hover { background: #e2e8f0; }
.btn-qq { background: #12b7f5; }
.btn-qq:hover { background: #0ea5e9; }
.btn-agg { background: #2563eb; }
.btn-agg:hover { background: #1d4ed8; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.ok { color: var(--ok); }
.err { color: var(--err); }
.warn { color: var(--warn); }

.flash {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash.ok { background: #ecfdf5; color: #065f46; }
.flash.err { background: #fef2f2; color: #991b1b; }

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: #e2e8f0;
}
.user-bar .who {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-bar img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff;
}

.form-section {
  margin-bottom: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section h3 {
  margin: 0 0 14px;
  font-size: 16px;
  color: #0f172a;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
label.field span.req::after {
  content: " *";
  color: var(--err);
}
input[type="text"],
input[type="tel"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}
textarea { min-height: 90px; resize: vertical; }

.file-box {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}
.file-box input[type="file"] { width: 100%; font-size: 13px; }
.preview {
  margin-top: 8px;
  max-width: 160px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

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

/* Admin */
.admin-body {
  background: #f1f5f9;
  min-height: 100vh;
}
.admin-nav {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-nav a { color: #cbd5e1; margin-right: 14px; }
.admin-nav a:hover, .admin-nav a.active { color: #fff; }
.admin-wrap { width: min(1200px, 100%); margin: 0 auto; padding: 24px 16px 40px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
.stat .n { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .l { color: var(--muted); font-size: 13px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}
.toolbar .field { min-width: 160px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
table.data th, table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
table.data th { background: #f8fafc; color: var(--muted); font-weight: 600; }
table.data tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pending { background: #fffbeb; color: #b45309; }
.badge.passed { background: #ecfdf5; color: #047857; }
.badge.rejected { background: #fef2f2; color: #b91c1c; }

.pager {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pager a, .pager span {
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.pager .current { background: var(--primary); color: #fff; border-color: var(--primary); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}
.detail-item { background: #f8fafc; border-radius: 10px; padding: 12px; }
.detail-item .k { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.detail-item .v { font-size: 14px; word-break: break-all; }
.img-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.img-row a {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.img-row img { width: 100%; height: 160px; object-fit: cover; display: block; }
.img-row .cap { padding: 8px; font-size: 12px; color: var(--muted); text-align: center; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  margin-top: 12px;
}
.chart-bars .bar {
  flex: 1;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-radius: 8px 8px 4px 4px;
  min-height: 4px;
  position: relative;
}
.chart-bars .bar span {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.chart-bars .bar em {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-style: normal;
  color: var(--text);
}

@media (max-width: 800px) {
  .grid, .grid-3, .detail-grid, .stats, .img-row {
    grid-template-columns: 1fr;
  }
  .user-bar { flex-direction: column; align-items: flex-start; }
}

/* Wizard - 始终横铺 */
.wizard-steps {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  margin: 18px 0 22px;
  width: 100%;
}
.w-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  border-radius: 12px;
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  cursor: default;
  user-select: none;
  transition: all .2s ease;
  min-width: 0;
}
.w-step span {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #cbd5e1;
  color: #fff;
  font-size: 13px;
}
.w-step .w-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-step.active {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.35);
  transform: translateY(-2px);
  font-size: 15px;
}
.w-step.active span {
  background: #fff;
  color: #0284c7;
  font-weight: 700;
}
.w-step.done {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.w-step.done span { background: #059669; }
.wizard-panel { display: none; }
.wizard-panel.is-on { display: block; }
.wizard-actions {
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}
.badge.draft { background: #f1f5f9; color: #475569; }

@media (max-width: 800px) {
  .w-step { padding: 10px 6px; font-size: 12px; gap: 5px; }
  .w-step.active { font-size: 13px; }
  .w-step span { width: 22px; height: 22px; font-size: 12px; }
}

/* Modal popup */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.app-modal[hidden] { display: none !important; }
.app-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.app-modal-panel {
  position: relative;
  width: min(380px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 28px 24px 20px;
  text-align: center;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.app-modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}
.app-modal-icon.ok { background: #10b981; }
.app-modal-icon.err { background: #ef4444; }
.app-modal-icon.warn { background: #f59e0b; }
.app-modal-icon.info { background: #0ea5e9; }
.app-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}
.app-modal-msg {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  word-break: break-word;
  margin-bottom: 20px;
}
.app-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.app-modal-actions .btn { min-width: 96px; }
