/* ============================================================
   次招 · 运营后台样式
   ============================================================ */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #16191f;
  --ink-2: #5a636f;
  --ink-3: #8d96a3;
  --line: #e5e8ed;
  --line-2: #eef0f4;
  --brand: #1a6ef5;
  --brand-ink: #0d4fc4;
  --brand-soft: #eaf1fe;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --side: #131a26;
  --side-2: #1b2434;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

/* 关键：.layout / .login-wrap 写了 display:grid，
   特异性与 [hidden] 相同且更靠后，会压掉 UA 的 display:none，
   导致 hidden 失效（登录成功但登录页还盖在上面）。必须显式兜住。 */
[hidden] { display: none !important; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------------- 品牌标记 ---------------- */
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a6ef5, #0d4fc4);
  color: #fff;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 4px 12px rgba(26, 110, 245, .28);
  flex: none;
}
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }

/* ============================================================
   登录页
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 12% -10%, #dfeaff 0%, rgba(223, 234, 255, 0) 62%),
    radial-gradient(900px 480px at 92% 108%, #e6f0ff 0%, rgba(230, 240, 255, 0) 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 384px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px 22px;
  box-shadow: 0 2px 4px rgba(16, 24, 40, .03), 0 18px 48px rgba(16, 24, 40, .09);
}

.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 26px;
}
.login-brand h1 { font-size: 19px; letter-spacing: .5px; }
.login-brand p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }

.field {
  display: block;
  margin-bottom: 14px;
}
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfd;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 110, 245, .12);
}
.field input::placeholder { color: #b3bac4; }

.login-err {
  background: var(--danger-soft);
  color: #a71d1d;
  border: 1px solid #f8d4d4;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.login-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #b3bac4;
  letter-spacing: .4px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: #f7f8fa; border-color: #d6dae1; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(26, 110, 245, .25);
}
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef1f5; color: var(--ink); }

.btn-block { width: 100%; height: 44px; font-size: 15px; letter-spacing: 1px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-danger { color: var(--danger); border-color: #f3d2d2; }
.btn-danger:hover { background: var(--danger-soft); }

/* ============================================================
   主布局
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 208px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--side);
  color: #c6cedb;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.side-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 2px 8px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #b7c0cd;
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item .ico { font-size: 13px; opacity: .8; width: 14px; text-align: center; }
.nav-item:hover { background: var(--side-2); color: #e8edf4; }
.nav-item.active { background: #1e2c45; color: #fff; }
.nav-item.active .ico { color: #6ea4ff; opacity: 1; }
.nav-item.disabled { opacity: .34; cursor: default; }
.nav-item.disabled:hover { background: transparent; color: #b7c0cd; }

.side-foot {
  padding: 10px 10px 2px;
  font-size: 11px;
  color: #5d6a7d;
  border-top: 1px solid #212c3d;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px;
  flex: none;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}
.crumb { font-size: 14.5px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { font-size: 13px; color: var(--ink-2); }

.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #cfd5de;
  display: inline-block;
}
.badge-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.badge-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.page {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

/* ============================================================
   卡片 / 表格 / 表单
   ============================================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); margin-left: 8px; font-weight: 400; }
.card-body { padding: 18px; }

/* 统计卡 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.stat .k { font-size: 12.5px; color: var(--ink-3); }
.stat .v {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.4px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tb {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.tb th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  font-size: 12.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  background: #fafbfc;
  white-space: nowrap;
}
table.tb td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  vertical-align: middle;
}
table.tb tbody tr:hover { background: #fafbfd; }
table.tb tbody tr:last-child td { border-bottom: none; }
.tb .num { font-variant-numeric: tabular-nums; }
.tb .muted { color: var(--ink-3); }

/* 状态标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.tag::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
.tag.on { color: var(--ok); background: var(--ok-soft); }
.tag.off { color: var(--ink-3); background: #f1f3f6; }
.tag.warn { color: var(--warn); background: var(--warn-soft); }

/* 空态 */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty .big { font-size: 30px; opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

/* 工具条 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.input-sm {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
  outline: none;
  min-width: 200px;
  transition: border-color .15s, box-shadow .15s;
}
.input-sm:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,110,245,.1); }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--ink-2);
}

/* ============================================================
   弹窗
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 22, 33, .42);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(10, 18, 30, .28);
  overflow: hidden;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: .6 } to { transform: none; opacity: 1 } }

.modal-head {
  padding: 18px 20px 0;
  font-size: 15.5px;
  font-weight: 600;
}
.modal-body { padding: 16px 20px 4px; }
.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-row { margin-bottom: 13px; }
.form-row label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-row label .req { color: var(--danger); margin-left: 2px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-row textarea { height: 68px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 110, 245, .1);
}
.form-row .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-err {
  background: var(--danger-soft);
  color: #a71d1d;
  border: 1px solid #f8d4d4;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: #1d2430;
  color: #fff;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(10, 18, 30, .3);
  z-index: 200;
  animation: toastIn .18s ease-out;
}
.toast.ok { background: #14803c; }
.toast.err { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }

/* 加载骨架 */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}
.spin {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid #dfe3e9;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: sp .7s linear infinite;
  vertical-align: -2px;
  margin-right: 7px;
}
@keyframes sp { to { transform: rotate(360deg) } }

/* 响应式 */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page { padding: 14px; }
}
