/* ==========================================================
   连接后端 / 安装向导 / 系统设置 → 数据库
   用控制台的主题变量，浅色和深色都适用
   ========================================================== */
.setup { position: relative; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); color: var(--ink); overflow-x: hidden; isolation: isolate; }
.setup-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url(../img/tactical-map.webp) center / cover no-repeat; opacity: .07;
  -webkit-mask-image: radial-gradient(90% 70% at 50% 30%, #000 20%, transparent 75%); mask-image: radial-gradient(90% 70% at 50% 30%, #000 20%, transparent 75%); }
:root[data-theme="dark"] .setup-bg { opacity: .16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-theme="white"]) .setup-bg { opacity: .16; } }
.setup-top { display: flex; align-items: center; height: 64px; padding: 0 28px; }
.setup-main { display: grid; justify-items: center; align-content: start; padding: 4vh 20px 72px; }

.setup-card { width: min(520px, 100%); box-sizing: border-box; padding: 36px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-pop); }
.setup-card.wide { width: min(900px, 100%); padding: 0; overflow: hidden; }
.setup-card h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.3; font-weight: 700; letter-spacing: -.005em; }
.setup-lead { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; line-height: 1.65; max-width: 40em; }
.setup-lead code, .setup-ok code { padding: 1px 6px; border-radius: 4px; background: var(--sunk); font-size: .92em; }
.setup .stack { display: flex; flex-direction: column; gap: 16px; }
.setup .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.setup .field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.setup .hint { font-size: 12.5px; color: var(--faint); }
.setup .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.setup-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.setup-acts.left { justify-content: flex-start; }
.setup-acts .btn svg { width: 16px; height: 16px; }
.setup .field-err, .store-view .field-err { margin: 0; padding: 9px 12px; border-radius: var(--r-ctl); background: var(--high-bg); color: var(--high); font-size: 13.5px; line-height: 1.5; }
.code-in { height: 52px; font-size: 22px; font-weight: 600; letter-spacing: .3em; text-align: center; text-transform: uppercase; }

/* ---------- 向导：左侧步骤 + 右侧内容 ---------- */
.wiz { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 460px; }
.wiz-rail { list-style: none; margin: 0; padding: 36px 22px; background: var(--sunk); border-right: 1px solid var(--line); }
.wiz-rail li { position: relative; display: flex; align-items: center; gap: 12px; height: 44px; font-size: 14px; font-weight: 500; color: var(--faint); transition: color var(--t-std, 320ms) var(--ease-out, ease); }
.wiz-rail li + li::before { content: ''; position: absolute; left: 10.5px; top: -12px; width: 1px; height: 24px; background: var(--line-2); }
.wiz-rail li i { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); box-sizing: border-box;
  transition: border-color var(--t-std, 320ms) var(--ease-out, ease), background var(--t-std, 320ms) var(--ease-out, ease), box-shadow var(--t-std, 320ms) var(--ease-out, ease); }
.wiz-rail li.on { color: var(--ink); }
.wiz-rail li.on i { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.wiz-rail li.done { color: var(--ink-2); }
.wiz-rail li.done i { background: var(--accent); border-color: var(--accent); }
.wiz-rail li.done i::after { content: ''; width: 8px; height: 4px; margin-top: -2px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(-45deg); }
.wiz-body { padding: 36px 40px 32px; min-width: 0; }
.wiz-body.wiz-in > * { animation: wiz-in var(--t-std, 320ms) var(--ease-out, cubic-bezier(.16, 1, .3, 1)) both; }
@keyframes wiz-in { from { opacity: 0; transform: translateX(14px); } }

/* ---------- 数据存储二选一 ---------- */
.store-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.store-opt { position: relative; cursor: pointer; }
.store-opt input { position: absolute; opacity: 0; pointer-events: none; }
.store-opt > span { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; height: 100%; box-sizing: border-box; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r-card); background: var(--surface);
  transition: border-color var(--t-fast, 180ms) var(--ease-out, ease), box-shadow var(--t-fast, 180ms) var(--ease-out, ease), background var(--t-fast, 180ms) var(--ease-out, ease); }
.store-opt:hover > span { border-color: var(--muted); }
.store-opt svg { width: 20px; height: 20px; color: var(--muted); }
.store-opt b { font-size: 15px; }
.store-opt small { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.store-opt input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.store-opt input:checked + span svg { color: var(--accent); }
.store-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.my-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 4px; }

/* ---------- 自检清单：逐行出现 ---------- */
.chk { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.chk-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface);
  animation: chk-in var(--t-std, 320ms) var(--ease-out, ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.chk-row:first-child { border-top: 0; }
@keyframes chk-in { from { opacity: 0; transform: translateY(4px); } }
.chk-ic { display: grid; place-items: center; height: 20px; }
.chk-ic svg { width: 18px; height: 18px; }
.chk-row.is-ok .chk-ic { color: var(--accent); }
.chk-row.is-warn .chk-ic { color: var(--mid); }
.chk-row.is-fail .chk-ic { color: var(--high); }
.chk-row.is-skip .chk-ic, .chk-row.is-wait .chk-ic { color: var(--faint); }
.chk-row.is-fail { background: var(--high-bg); }
.chk-t b { display: block; font-size: 13.5px; font-weight: 600; }
.chk-t span { display: block; font-size: 12.5px; color: var(--muted); word-break: break-word; }
.chk-t em { display: block; margin-top: 6px; padding: 6px 9px; border-radius: 6px; background: var(--sunk); font-style: normal; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.chk-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: chk-spin .8s linear infinite; box-sizing: border-box; }
@keyframes chk-spin { to { transform: rotate(360deg); } }

/* ---------- 连接后端：测试成功 ---------- */
.setup-ok { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; padding: 18px; border-radius: var(--r-card); background: var(--sunk); border: 1px solid var(--line); }
.setup-ok p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.setup-ok-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.setup-ok-h svg { width: 20px; height: 20px; color: var(--accent); }
.setup-ok-h span { font-size: 13px; color: var(--muted); }

/* ---------- 安装完成 ---------- */
.done-pane .done-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.done-pane .done-ic svg { width: 24px; height: 24px; }
.done-pane .faint { margin: 0; font-size: 13.5px; }

/* ---------- 系统设置 → 数据库 ---------- */
.store-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }
.store-view .card { padding: 22px 24px; }
.store-now-h { display: flex; align-items: center; gap: 12px; }
.store-now-h svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.store-now-h b { display: block; font-size: 16px; }
.store-now-h span { font-size: 13px; color: var(--muted); word-break: break-all; }
.store-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; margin: 18px 0; }
.store-counts dt { font-size: 12px; color: var(--muted); }
.store-counts dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; }
.store-move h3 { margin: 0 0 4px; font-size: 16px; }
.store-move > p { margin: 0 0 16px; font-size: 13.5px; }
.store-move form { display: flex; flex-direction: column; gap: 14px; }
.store-view .field { display: flex; flex-direction: column; gap: 6px; }
.store-view .field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .setup-top { padding: 0 18px; }
  .setup-main { padding-top: 8px; }
  .setup-card { padding: 26px 22px; }
  .wiz { grid-template-columns: 1fr; min-height: 0; }
  .wiz-rail { display: flex; gap: 18px; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .wiz-rail li { height: 32px; white-space: nowrap; font-size: 13px; }
  .wiz-rail li + li::before { display: none; }
  .wiz-body { padding: 24px 20px; }
  .store-pick, .my-grid, .setup .row-2, .store-view { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .wiz-body.wiz-in > *, .chk-row { animation: none; }
  .chk-spin { animation-duration: 2.4s; }
}

/* 连接后端：nginx 配置指引 */
.setup-hint-nginx { margin: 12px 0 4px; font-size: 13.5px; }
.setup-hint-nginx > summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.setup-hint-nginx p { margin: 10px 0; color: var(--muted); line-height: 1.7; }
.setup-hint-nginx code { padding: 1px 5px; border-radius: 4px; background: var(--sunk); }
.setup-hint-nginx pre { margin: 10px 0; padding: 12px 14px; border-radius: var(--r-ctl);
  background: var(--sunk); font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; }
