/* ============ 后台管理样式 ============ */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 232px; flex: none; background: linear-gradient(180deg, #0f2b52, #163f77);
  color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #c9a45c, #f0d9a0); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.side-brand b { font-size: 15px; display: block; line-height: 1.3; }
.side-brand span { font-size: 11px; opacity: .6; letter-spacing: 1px; }
#sideNav { padding: 14px 10px; flex: 1; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
#sideNav button {
  text-align: left; background: transparent; border: 0; color: #c8d6e8; cursor: pointer;
  font-size: 14.5px; padding: 11px 14px; border-radius: 9px; font-family: inherit; display: flex; gap: 10px; align-items: center;
}
#sideNav button:hover { background: rgba(255,255,255,.08); color: #fff; }
#sideNav button.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 #c9a45c; }
.side-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: 8px; }
.side-foot .btn-ghost { border-color: rgba(255,255,255,.35); color: #dfe8f4; }
.side-foot .btn-ghost:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,.08); }

.admin-main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.main-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.main-top h2 { margin: 0; font-size: 21px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid #edf0f4; text-align: left; white-space: nowrap; }
.table th { background: #f6f8fb; color: #57636f; font-weight: 600; position: sticky; top: 0; }
.table tr:hover td { background: #fafcff; }
.table .row-actions { display: flex; gap: 6px; }
.table .link-btn { color: var(--primary); background: none; border: 0; cursor: pointer; font-size: 13px; padding: 2px 4px; }
.table .link-btn:hover { text-decoration: underline; }
.table .link-btn.danger { color: var(--danger); }
.code { font-family: Consolas, monospace; color: #1d4e89; font-size: 12.5px; }
.muted2 { color: var(--muted); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid #eef1f5; }
.stat-card .num { font-size: 28px; font-weight: 800; margin: 6px 0 2px; }
.stat-card .lab { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.stat-card .trend { font-size: 12px; }
.stat-card.s1 .num { color: var(--primary); } .stat-card.s1 { border-top: 3px solid var(--primary); }
.stat-card.s2 .num { color: #0e8a5c; } .stat-card.s2 { border-top: 3px solid #16a34a; }
.stat-card.s3 .num { color: #b9800f; } .stat-card.s3 { border-top: 3px solid #eab308; }
.stat-card.s4 .num { color: var(--danger); } .stat-card.s4 { border-top: 3px solid var(--danger); }

/* 数据库连接状态条 */
.db-status { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: 13px; }
.db-status:empty { display: none; }
.db-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.15); flex: none; }

/* 工具栏 / 分页 */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid #edf0f4; gap: 10px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }
.pager .btn { padding: 5px 12px; font-size: 13px; }

/* 两栏 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

.row-form { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.row-form input, .row-form select { width: auto; flex: 1; min-width: 160px; }

/* 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(13, 30, 55, .5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 780px; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid #edf0f4; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-x { border: 0; background: #f1f4f8; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; color: #57636f; }
.modal-x:hover { background: #e4e9f0; }
#certForm { padding: 20px 24px 24px; }
.frow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.frow > div > label { font-size: 13px; }
.photo-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.photo-preview { width: 42px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid #dfe6ef; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid #edf0f4; margin-top: 8px; }

/* 导入 */
.dropzone { border: 2px dashed #c6d3e2; border-radius: 14px; padding: 30px; text-align: center; cursor: pointer; background: #fafcff; transition: all .15s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #f0f6ff; }
.dropzone .dz-ico { font-size: 42px; }
.dropzone p { margin: 6px 0 0; font-size: 15px; font-weight: 600; }
.import-result-box { border-radius: 12px; padding: 14px 18px; }
.import-errors { max-height: 220px; overflow: auto; font-size: 12.5px; background: #fff8f8; border-radius: 8px; padding: 10px 14px; color: #9b1c1c; line-height: 1.8; }

/* 导出 */
.exp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .exp-grid { grid-template-columns: 1fr; } }
.exp-item { border: 1px solid #e6ecf4; border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.exp-item .ei-ico { font-size: 32px; }
.exp-item b { font-size: 16px; }
.exp-item span { font-size: 13px; color: var(--muted); flex: 1; }
.exp-item .btn { align-self: flex-start; margin-top: 10px; }

/* 主题色点 */
.theme-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 6px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.08); }

/* ---------- 移动端适配 ---------- */
.menu-btn {
  display: none; border: 1px solid #cfd8e3; background: #fff; border-radius: 10px;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer; flex: none;
  align-items: center; justify-content: center; color: #344054;
}
.side-mask { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  /* 侧栏变为抽屉 */
  .admin-side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 80;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .admin-shell.side-open .admin-side { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,.35); }
  .admin-shell.side-open .side-mask {
    display: block; position: fixed; inset: 0;
    background: rgba(13,30,55,.45); z-index: 70;
  }
  .admin-main { padding: 14px 12px 40px; }
  .main-top h2 { font-size: 18px; }
  /* 工具栏 / 表单纵向堆叠 */
  .toolbar { gap: 8px; }
  .toolbar > div { width: 100% !important; flex: none !important; min-width: 0 !important; }
  .toolbar .btn { flex: 1; }
  .row-form input, .row-form select { width: 100% !important; flex: none; min-width: 0; }
  .row-form { gap: 8px; }
  /* 表格与卡片更紧凑（表格本身可横向滚动） */
  .admin-main .card { padding: 14px; }
  .table th, .table td { padding: 8px; }
  /* 弹层 */
  .modal-mask { padding: 10px; }
  .modal-head { padding: 14px 16px; }
  #certForm { padding: 14px 14px 18px; }
  .modal-foot .btn { flex: 1; }
  /* 导出按钮占满 */
  .exp-item .btn { align-self: stretch; justify-content: center; }
  .stat-card .num { font-size: 24px; }
}
