/* =============================================================
   管理后台样式：手机 / 平板 / PC 自适应
   ============================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #2c5f8a;
  --brand-dark: #1e4466;
  --ink: #2b2b2b;
  --ink-2: #6b6b6b;
  --ink-3: #9a8f80;
  --line: #e8e2d8;
  --bg: #f6f3ed;
  --ok: #2e7d52;
  --warn: #b26a00;
  --danger: #c0392b;
  --shadow: 0 2px 14px rgba(60, 45, 25, .08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------- 后台登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(150deg, #2c5f8a 0%, #1e4466 55%, #16344f 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 30px 26px 26px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
}
.login-card .mark {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 25px;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 19px; text-align: center; color: var(--brand-dark); }
.login-card .sub { font-size: 12.5px; text-align: center; color: var(--ink-3); margin-bottom: 22px; }
.login-card .field input { font-size: 16px; }
.login-card .back {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-3);
  text-decoration: none;
}
.login-card .back:hover { color: var(--brand); }

/* ---------------------------------------------------------- 后台布局 */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.topbar .brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar .brand b { font-size: 16px; font-weight: 600; white-space: nowrap; }
.topbar .brand span { font-size: 11px; opacity: .75; display: block; }
.topbar .who { font-size: 12.5px; opacity: .9; display: flex; align-items: center; gap: 10px; }
.topbar .who a { color: #fff; text-decoration: none; opacity: .85; }
.topbar .who a:hover { opacity: 1; text-decoration: underline; }

.nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { height: 0; }
.nav button {
  border: none;
  background: none;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.nav button.active { color: var(--brand-dark); font-weight: 600; border-bottom-color: var(--brand); }

.main { padding: 16px; max-width: 1180px; margin: 0 auto; }
.pane { display: none; }
.pane.active { display: block; }

/* ---------------------------------------------------------- 卡片 / 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 25px; font-weight: 700; color: var(--brand-dark); line-height: 1.2; }
.stat .t { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.stat.hot .n { color: var(--warn); }

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel h3 { font-size: 15px; color: var(--brand-dark); margin-bottom: 12px; }
.panel .empty { font-size: 13px; color: var(--ink-3); padding: 14px 0; text-align: center; }

/* ---------------------------------------------------------- 搜索 / 工具条 */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=text] {
  flex: 1;
  min-width: 160px;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 9px;
  font-family: inherit;
}
.toolbar input:focus { outline: none; border-color: var(--brand); }

.btn {
  padding: 10px 16px;
  font-size: 14px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid #c9d6e2; }
.btn.danger { background: var(--danger); }
.btn.tiny { padding: 6px 11px; font-size: 13px; border-radius: 7px; }

/* ---------------------------------------------------------- 列表行 */
.row {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: #fffdf9;
}
.row .who { font-size: 15px; font-weight: 600; }
.row .meta { font-size: 12.5px; color: var(--ink-3); }
.row .acts { display: flex; gap: 7px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: 1px;
}
.tag.vip { background: #fdf3e0; color: var(--warn); }
.tag.on { background: #e8f5ec; color: var(--ok); }
.tag.off { background: #fdecea; color: var(--danger); }
.tag.warn { background: #fff4e5; color: #c47b1a; }
.row .meta.sub2 { font-size: 12px; color: #a89c8c; margin-top: 2px; }

/* 用户列表高亮：手机号 / 孩子姓名·年级；整行可点击进详情 */
.row.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.row.clickable:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(44, 95, 138, .12); }
.hl-phone { color: var(--brand-dark); font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.hl-child { color: #8a5b00; font-weight: 700; }

/* 注册信息键值表 */
.kv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 4px 0 12px; }
.kv-row { display: flex; gap: 10px; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { width: 88px; flex: none; color: var(--ink-3); }
.kv-row .v { flex: 1; word-break: break-all; }
.kid-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  margin-bottom: 7px; background: #fffdf9; font-size: 13px;
}
.temp-pw b { user-select: all; cursor: pointer; }
.modal select {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 9px;
  font-family: inherit;
  background: #fff;
}
.modal input[type=file] { border: none; background: none; padding: 6px 0; font-family: inherit; }

/* 平板：行内多列，接近表格观感；统计 3 列（5 列会挤到换行） */
@media (min-width: 760px) {
  .row {
    grid-template-columns: 1.4fr 1.2fr auto;
    align-items: center;
    gap: 14px;
  }
  .row .acts { justify-content: flex-end; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}

/* PC：左侧固定导航 */
@media (min-width: 1024px) {
  .shell { display: flex; min-height: 100vh; }
  .side {
    flex: 0 0 200px;
    background: linear-gradient(180deg, #244e70 0%, #16344f 100%);
    color: #fff;
    padding: 18px 12px;
  }
  .side .brand { display: flex; gap: 9px; align-items: center; margin-bottom: 22px; padding: 0 6px; }
  .side .brand b { font-size: 15px; }
  .side .brand span { display: block; font-size: 11px; opacity: .7; }
  .nav { flex-direction: column; background: none; border: none; padding: 0; overflow: visible; }
  .nav button {
    color: rgba(255, 255, 255, .8);
    text-align: left;
    padding: 11px 12px;
    border-radius: 9px;
    border: none;
    margin-bottom: 3px;
    font-size: 14px;
  }
  .nav button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .nav button.active { background: rgba(255, 255, 255, .16); color: #fff; border: none; }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .topbar { position: static; }
  .nav.mobile-only { display: none; }
  .main { padding: 22px 26px; max-width: none; }
  .stats { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 1023px) {
  .side { display: none; }
}
.nav.mobile-only { display: flex; }
@media (min-width: 1024px) { .nav.mobile-only { display: none !important; } }

/* ---------------------------------------------------------- 弹窗 */
.mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, .45);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.mask.show { display: flex; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 440px;
  border-radius: 16px 16px 0 0;
  padding: 20px 18px 24px;
  max-height: 88vh;
  overflow-y: auto;
}
@media (min-width: 600px) {
  .mask { align-items: center; padding: 20px; }
  .modal { border-radius: 14px; }
}
.modal h3 { font-size: 16px; color: var(--brand-dark); margin-bottom: 4px; }
.modal .sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
.modal input, .modal textarea, .modal select {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 9px;
  margin-bottom: 12px;
  font-family: inherit;
}
.modal input:focus, .modal textarea:focus { outline: none; border-color: var(--brand); }
.modal .modal-acts { display: flex; gap: 9px; }
.modal .modal-acts .btn { flex: 1; }
.temp-pw {
  background: #fdf3e0;
  border: 1px dashed #e0b769;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  margin-bottom: 14px;
}
.temp-pw b { font-size: 22px; letter-spacing: 3px; color: #8a5b00; font-family: ui-monospace, Consolas, monospace; }
.temp-pw p { font-size: 12px; color: var(--ink-2); margin-top: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 30, .92);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: all .22s;
  z-index: 200;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.log-item {
  border-bottom: 1px dashed var(--line);
  padding: 9px 0;
  font-size: 13px;
}
.log-item:last-child { border-bottom: none; }
.log-item .t { color: var(--ink-3); font-size: 12px; }
.log-item b { color: var(--brand-dark); }

.ent-item {
  border-bottom: 1px dashed var(--line);
  padding: 9px 0;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.ent-item.revoked { opacity: .5; text-decoration: line-through; }
