/* ============================================================
   企业名片小程序 - 后台样式 v2（现代化精简设计）
   覆盖全部后台页面 class（含 card-edit 独立页的对齐样式）
   ============================================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f2f4f9;
  color: #30354a;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: #2456d6; text-decoration: none; transition: color .15s; }
a:hover { color: #143a9e; }

.muted { color: #8a91a8; }
.small { font-size: 12px; }
.danger { color: #d14343; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 224px;
  background: linear-gradient(180deg, #16235e 0%, #1d2f7e 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 14px rgba(18, 28, 80, .14);
}
.logo {
  padding: 26px 20px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74,222,128,.9);
  flex-shrink: 0;
}
.sidebar nav { flex: 1; padding: 14px 0; overflow-y: auto; }
.sidebar nav a {
  display: block;
  color: rgba(255,255,255,.72);
  padding: 12px 22px;
  border-left: 3px solid transparent;
  font-size: 14px;
  transition: background .18s, color .18s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: #f6b64b;
  font-weight: 600;
}
.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.09);
}
.sidebar-bottom a { color: rgba(255,255,255,.72); font-size: 13px; }
.sidebar-bottom a:hover { color: #fff; }

/* ---------- 主区域 ---------- */
.main { margin-left: 224px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 58px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid #e8ebf3;
  position: sticky; top: 0; z-index: 50;
}
.topbar .muted { font-size: 13px; }
.content { padding: 26px 28px 40px; flex: 1; }

/* ---------- 页面标题 ---------- */
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 22px;
  color: #1c2340;
}
.page-title.between { display: flex; justify-content: space-between; align-items: center; }

/* ---------- 统计卡片 ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 26px;
  box-shadow: 0 1px 3px rgba(28,35,64,.06), 0 4px 14px rgba(28,35,64,.04);
  transition: transform .18s, box-shadow .18s;
  display: block;
  color: inherit;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(28,35,64,.10); }
.stat-num { font-size: 38px; font-weight: 800; color: #1d2f7e; line-height: 1.2; }
.stat-label { font-size: 13px; color: #8a91a8; margin-top: 8px; }

/* ---------- 面板 ---------- */
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 26px 30px;
  box-shadow: 0 1px 3px rgba(28,35,64,.06), 0 4px 14px rgba(28,35,64,.04);
  margin-bottom: 24px;
}
.panel-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef0f6;
  color: #1c2340;
}
.quick-list, .panel ol { padding-left: 18px; margin: 0; }
.quick-list li, .panel ol li { margin: 9px 0; line-height: 1.7; }
.quick-list a { font-weight: 500; }
code { background: #eef1f8; padding: 2px 7px; border-radius: 4px; font-size: 12px; color: #33407a; }

/* ---------- 表格 ---------- */
.table {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border-collapse: collapse;
  box-shadow: 0 1px 3px rgba(28,35,64,.06), 0 4px 14px rgba(28,35,64,.04);
}
.table th, .table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid #eef0f6;
}
.table th { background: #f8f9fd; font-weight: 600; color: #5a6180; font-size: 13px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f6f8ff; }
.table .empty { text-align: center; color: #a5abc2; padding: 46px; }
.table td a { margin-right: 12px; font-size: 13px; }
.table td a.danger { margin-right: 0; }

.thumb { max-width: 200px; max-height: 200px; border-radius: 8px; margin: 8px 0; display: block; background: #f2f4f9; }
.thumb.large { max-width: 500px; max-height: 600px; }
.thumb-mini { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #eef0f6; }

.tag { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag.on { background: #e4f7ec; color: #12905a; }
.tag.off { background: #fdeaea; color: #d14343; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 20px; }
.form-row > label { display: block; font-weight: 600; margin-bottom: 7px; color: #454b66; font-size: 13px; }
.form-row input[type=text],
.form-row input[type=number],
.form-row input[type=email],
.form-row input[type=password],
.form-row input[type=url],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #d9dde9;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input[type=text]:focus,
.form-row input[type=number]:focus,
.form-row input[type=email]:focus,
.form-row input[type=password]:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: #2456d6;
  box-shadow: 0 0 0 3px rgba(36,86,214,.12);
}
.form-row input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid #d9dde9; border-radius: 8px; background: #fff; }
.form-row textarea { resize: vertical; min-height: 90px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.form-actions { margin-top: 24px; padding-top: 18px; border-top: 1px solid #eef0f6; display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 8px;
  background: #fff;
  color: #4a5170;
  border: 1px solid #d9dde9;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: #f2f4f9; color: #30354a; }
.btn.primary { background: #2456d6; color: #fff; border-color: #2456d6; font-weight: 500; }
.btn.primary:hover { background: #143a9e; color: #fff; }
.btn.block { display: block; width: 100%; }

/* card-edit 独立页按钮（与外部样式对齐） */
.btn-save { background: #2456d6; color: #fff; border: none; border-radius: 8px; padding: 10px 28px; font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-save:hover { background: #143a9e; }
.btn-back { background: #eef0f6; color: #454b66; border: none; border-radius: 8px; padding: 10px 22px; cursor: pointer; transition: background .15s; }
.btn-back:hover { background: #e2e6f0; }
.btn-up { background: #3f6ede; color: #fff; border: none; border-radius: 6px; padding: 7px 16px; font-size: 13px; cursor: pointer; transition: background .15s; }
.btn-up:hover { background: #2456d6; }

/* ---------- 上传器 ---------- */
.uploader {
  border: 2px dashed #c9d2ea;
  border-radius: 10px;
  padding: 22px 16px;
  text-align: center;
  background: #f8faff;
  cursor: pointer;
  color: #6a76a8;
  font-size: 13px;
  transition: border-color .18s, background .18s;
}
.uploader:hover { background: #eef3ff; border-color: #2456d6; }
.uploader input[type=file] { display: none; }
.uploader .up-tip { color: #2456d6; font-weight: 500; }
.uploader .up-progress { height: 6px; background: #e2e8f8; border-radius: 3px; margin-top: 10px; overflow: hidden; display: none; }
.uploader .up-progress-bar { height: 100%; background: linear-gradient(90deg, #2456d6, #5a8dee); width: 0; transition: width .2s; }
.uploader .up-preview { margin-top: 12px; }
.uploader .up-preview img { max-width: 180px; max-height: 180px; border-radius: 8px; box-shadow: 0 2px 8px rgba(28,35,64,.12); }

/* ---------- 提示 ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert.success, .alert-ok { background: #e4f7ec; color: #12905a; }
.alert.error, .alert-err { background: #fdeaea; color: #d14343; }

/* ---------- card-edit 独立页布局（对齐外部风格） ---------- */
.top {
  background: linear-gradient(90deg, #16235e, #1d2f7e);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(18,28,80,.18);
}
.top a { color: rgba(255,255,255,.85); text-decoration: none; margin-left: 18px; font-size: 14px; }
.top a:hover { color: #fff; }
.wrap {
  max-width: 860px;
  margin: 26px auto;
  background: #fff;
  border-radius: 12px;
  padding: 28px 34px;
  box-shadow: 0 1px 3px rgba(28,35,64,.06), 0 6px 20px rgba(28,35,64,.08);
}
.wrap h2 { margin: 0 0 20px; font-size: 19px; color: #1c2340; }
.row { margin-bottom: 16px; display: flex; align-items: flex-start; }
.row label { width: 110px; padding-top: 9px; font-size: 14px; flex-shrink: 0; color: #454b66; }
.row label .req { color: #d14343; }
.row .field { flex: 1; }
.row .field input[type=text],
.row .field input[type=email],
.row .field input[type=number] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d9dde9;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.row .field input:focus { outline: none; border-color: #2456d6; box-shadow: 0 0 0 3px rgba(36,86,214,.12); }
input.half { width: 48%; display: inline-block; }
input.half + input.half { margin-left: 4%; }
.help { font-size: 12px; color: #8a91a8; margin-top: 5px; }
.preview { max-width: 110px; max-height: 110px; border: 1px dashed #c9d2ea; border-radius: 8px; padding: 4px; margin-bottom: 8px; display: none; }

/* ---------- 登录页 ---------- */
.login-page {
  background: linear-gradient(135deg, #101a4e 0%, #1d2f7e 55%, #2a4bb8 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,.97);
  padding: 42px 38px 36px;
  border-radius: 16px;
  box-shadow: 0 20px 70px rgba(8,12,50,.45);
}
.login-card h1 { margin: 0 0 6px; font-size: 23px; color: #1c2340; letter-spacing: .5px; }
.login-card form label { display: block; margin-top: 20px; color: #454b66; font-size: 13px; font-weight: 600; }
.login-card form input {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border: 1px solid #d9dde9;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.login-card form input:focus { outline: none; border-color: #2456d6; box-shadow: 0 0 0 3px rgba(36,86,214,.14); }
.login-card form button { margin-top: 30px; padding: 12px; font-size: 15px; }
.login-card .small { display: block; margin-top: 18px; text-align: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cards-grid { grid-template-columns: 1fr; }
  .content { padding: 18px 14px 30px; }
  .topbar { padding: 0 14px; }
  .table th, .table td { padding: 10px 10px; }
}
