:root {
  --bg: #080d18;
  --bg-2: #0d1526;
  --card: rgba(18, 28, 48, 0.86);
  --card-solid: #121c30;
  --line: rgba(120, 155, 210, 0.18);
  --line-strong: rgba(120, 155, 210, 0.32);
  --text: #eaf1ff;
  --muted: #8fa3c9;
  --accent: #3ee0c5;
  --accent-2: #6b9cff;
  --danger: #ff7185;
  --ok: #46e39b;
  --warn: #ffc46b;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(62, 224, 197, 0.16), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(107, 156, 255, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px 26px 28px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: #06231e;
  background: linear-gradient(135deg, var(--accent), #7ff0dd);
  box-shadow: 0 8px 24px rgba(62, 224, 197, 0.3);
}

.brand h1 { font-size: 20px; margin: 0 0 3px; letter-spacing: 0.5px; }
.brand p { margin: 0; font-size: 13px; color: var(--muted); }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.7);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: rgba(62, 224, 197, 0.6);
  box-shadow: 0 0 0 4px rgba(62, 224, 197, 0.1);
}

.btn {
  height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.2s, border-color 0.2s;
}

.btn:active { transform: scale(0.985); }

.btn-primary {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, var(--accent) 0%, #53b8ff 100%);
  color: #041a18;
  box-shadow: 0 12px 30px rgba(62, 224, 197, 0.25);
}

.btn-primary:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost { background: transparent; }

.error {
  min-height: 20px;
  font-size: 13px;
  color: var(--danger);
  margin: 4px 0 12px;
}

/* ---------- 主框架 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(8, 13, 24, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.topbar-title { font-size: 16px; font-weight: 700; white-space: nowrap; }
.topbar-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 14px 60px;
}

/* ---------- 步骤条 ---------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 2px 18px;
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}

.step-dot {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.step.active { color: var(--text); }
.step.active .step-dot {
  background: linear-gradient(135deg, var(--accent), #59c8ff);
  color: #041a18;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(62, 224, 197, 0.28);
}
.step.done .step-dot {
  background: rgba(70, 227, 155, 0.16);
  border-color: rgba(70, 227, 155, 0.5);
  color: var(--ok);
}
.step-line { flex: 1; height: 1px; background: var(--line); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  padding: 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(14px);
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.card-title .num {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; color: var(--accent); background: rgba(62, 224, 197, 0.12);
  border: 1px solid rgba(62, 224, 197, 0.25);
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- 上传区 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 14px;
  cursor: pointer; transition: all 0.2s;
}
.tab.active {
  color: var(--text);
  border-color: rgba(62, 224, 197, 0.45);
  background: rgba(62, 224, 197, 0.1);
}

.dropzone {
  width: 100%;
  min-height: 132px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.5);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  padding: 18px;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:active, .dropzone:hover { border-color: rgba(62, 224, 197, 0.5); background: rgba(62, 224, 197, 0.05); }
.dropzone .big { font-size: 30px; line-height: 1; }
.dropzone small { color: var(--muted); font-size: 12px; }

.preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%) 0 0/24px 24px,
    linear-gradient(-45deg, rgba(255,255,255,0.035) 25%, transparent 25%) 0 12px/24px 24px,
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.035) 75%) 12px -12px/24px 24px,
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.035) 75%) -12px 0/24px 24px,
    rgba(5, 9, 18, 0.8);
  display: grid;
  place-items: center;
  min-height: 180px;
}
.preview img { display: block; max-width: 100%; max-height: 52vh; object-fit: contain; }
.preview.qr img { max-height: 260px; }

#photo-preview-wrap { cursor: pointer; }
.preview-inner {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}
.eye-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 38.8%;
  border-top: 2px dashed var(--warn);
  pointer-events: none;
}
.eye-line span {
  position: absolute;
  right: 8px;
  top: -20px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
  color: var(--warn);
  background: rgba(8, 13, 24, 0.78);
  border: 1px solid rgba(255, 196, 107, 0.35);
  white-space: nowrap;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.chip.ok { color: var(--ok); border-color: rgba(70, 227, 155, 0.35); background: rgba(70, 227, 155, 0.08); }

.photo-actions { margin-top: 12px; }
.photo-actions .btn { width: 100%; }

.camera { margin-top: 12px; }
.camera video {
  width: 100%;
  border-radius: 14px;
  background: #000;
  max-height: 52vh;
  object-fit: cover;
}
.camera-actions { display: flex; gap: 10px; margin-top: 10px; }
.camera-actions .btn { flex: 1; }

/* ---------- 二维码裁剪 ---------- */
.qr-tools { display: flex; gap: 8px; margin-top: 10px; }
.qr-tools .btn { flex: 1; height: 44px; font-size: 13px; }

.cropper { margin-top: 14px; }
.cropper-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  touch-action: none;
  line-height: 0;
  border-radius: 12px;
  overflow: hidden;
}
.cropper-stage img {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  user-select: none;
  -webkit-user-drag: none;
}
.crop-box {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border: 2px solid var(--accent);
  box-sizing: border-box;
  cursor: move;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  touch-action: none;
}
.crop-handle {
  position: absolute;
  right: -13px;
  bottom: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #041a18;
  box-sizing: border-box;
  cursor: nwse-resize;
}
.cropper-actions { display: flex; gap: 8px; margin-top: 12px; }
.cropper-actions .btn { flex: 1; height: 44px; font-size: 13px; }

.hidden { display: none !important; }

/* ---------- 确认与提交 ---------- */
.checkline {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}
.checkline input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }

.submit-row { display: flex; gap: 10px; margin-top: 14px; }
.submit-row .btn-primary { flex: 1 1 0; width: auto; min-width: 140px; }
.submit-row .btn-white-bg { flex: 1 1 0; width: auto; min-width: 140px; }

.btn-white-bg {
  border: none;
  background: #ffffff;
  color: #0a1420;
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.16);
}

.btn-white-bg:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

.reset-wrap { display: flex; justify-content: center; margin-top: 16px; }

.btn-reset {
  width: auto;
  min-width: 280px;
  height: 60px;
  padding: 0 40px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff4d68 0%, #ff8497 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 34px rgba(255, 77, 104, 0.32);
  cursor: pointer;
}

.btn-reset:active { transform: scale(0.985); }

.submit-hint { display: block; margin-top: 10px; }

/* ---------- 进度 ---------- */
.progress-list { display: flex; flex-direction: column; gap: 2px; }
.pitem { display: flex; gap: 12px; padding: 9px 2px; }
.pdot {
  flex: 0 0 auto;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}
.pitem.running .pdot {
  border-color: rgba(107, 156, 255, 0.6);
  color: var(--accent-2);
  animation: pulse 1.1s ease-in-out infinite;
}
.pitem.done .pdot { border-color: rgba(70, 227, 155, 0.55); color: var(--ok); background: rgba(70, 227, 155, 0.1); }
.pitem.error .pdot { border-color: rgba(255, 113, 133, 0.6); color: var(--danger); background: rgba(255, 113, 133, 0.1); }
.pitem.skip .pdot { border-color: rgba(255, 196, 107, 0.45); color: var(--warn); }
.pbody { min-width: 0; padding-top: 1px; }
.ptitle { font-size: 14px; }
.pdetail { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.pitem.running .ptitle { color: var(--text); }
.pitem.pending { opacity: 0.55; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(107, 156, 255, 0.28); }
  50% { box-shadow: 0 0 0 6px rgba(107, 156, 255, 0); }
}

.result {
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
}
.result.success { border-color: rgba(70, 227, 155, 0.4); background: rgba(70, 227, 155, 0.08); }
.result.error { border-color: rgba(255, 113, 133, 0.4); background: rgba(255, 113, 133, 0.08); }
.result .rtitle { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.result .rline { color: var(--muted); font-size: 13px; word-break: break-all; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  max-width: min(90vw, 480px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(20, 30, 50, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 统计 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 14px;
  text-align: center;
}
.stat-card .v { font-size: 26px; font-weight: 800; letter-spacing: 0.5px; }
.stat-card .k { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.accent .v { color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: rgba(255, 255, 255, 0.03); }
tr:last-child td { border-bottom: none; }
.tag { padding: 3px 8px; border-radius: 999px; font-size: 11px; }
.tag.ok { color: var(--ok); background: rgba(70, 227, 155, 0.12); }
.tag.fail { color: var(--danger); background: rgba(255, 113, 133, 0.12); }

@media (max-width: 420px) {
  .topbar-sub { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .card { padding: 15px; }
}

/* ---------- 统计筛选与新增管理员 ---------- */
.filter-row { display: flex; gap: 8px; align-items: center; }
.select {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background-color: rgba(8, 14, 26, 0.7);
  color: var(--text);
  font-size: 15px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.select:focus { border-color: rgba(62, 224, 197, 0.6); }
.link-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}
.link-btn.danger { color: var(--danger); }
.link-btn.armed {
  color: #fff;
  background: rgba(255, 113, 133, 0.85);
  border-radius: 8px;
  padding: 4px 10px;
}
.link-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.add-user-row { display: flex; flex-direction: column; gap: 10px; }
.text-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.7);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.text-input:focus { border-color: rgba(62, 224, 197, 0.6); }
.add-user-row .btn { width: 100%; }
@media (min-width: 560px) {
  .add-user-row { flex-direction: row; }
  .add-user-row .btn { width: auto; flex: 0 0 120px; }
}

/* ---------- 底部备案号 ---------- */
.icp-footer {
  margin: 26px 0 30px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.icp-footer a {
  color: var(--muted);
  text-decoration: none;
  opacity: 0.75;
}

.icp-footer a:hover { opacity: 1; }
