/* ==================== 基础变量与重置 ==================== */
:root {
  --primary: #2f6fed;
  --primary-dark: #1d5bd8;
  --text: #1f2329;
  --text-light: #86909c;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e5e6eb;
  --danger: #e5484d;
  --danger-bg: #fdebec;
  --success: #2e9e5b;
  --success-bg: #e9f7ef;
  --warning: #d97706;
  --warning-bg: #fef3e2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #f3f7fd 0%, #e9eff8 100%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 背景装饰光斑 */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -1;
  pointer-events: none;
}
body::before {
  width: 460px; height: 460px;
  background: rgba(47, 111, 237, .13);
  top: -140px; right: -100px;
}
body::after {
  width: 420px; height: 420px;
  background: rgba(159, 203, 237, .25);
  bottom: -140px; left: -110px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==================== 通用组件 ==================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.btn {
  display: inline-block;
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

.btn-sm { padding: 4px 12px; font-size: 13px; border-radius: 6px; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c93a3f; }

/* 续签按钮（正向操作，绿色系） */
.btn-renew { background: var(--success); }
.btn-renew:hover { background: #27854e; }
/* 未到续签时间：视觉上置灰提示，但仍可点击（点击后弹出"还没到提前续签哦"） */
.btn-renew.btn-renew-notyet { background: #9ca3af; }
.btn-renew.btn-renew-notyet:hover { background: #6b7280; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  outline: none;
}
.input:focus { border-color: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.badge-ok   { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-off  { background: var(--danger-bg);  color: var(--danger); }

/* ==================== 前台查询页 ==================== */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 56px 20px 40px;
}

/* 顶部品牌区 */
.hero { text-align: center; margin-bottom: 24px; }
.hero-mark {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 5px solid #d9a441;
  box-shadow: inset 0 0 0 3px #f3d489, 0 8px 18px rgba(217, 164, 65, .35);
}
.site-title { font-size: 30px; font-weight: 800; letter-spacing: 1px; color: #17345e; }
.site-desc { margin-top: 10px; color: var(--text-light); font-size: 15px; }

.query-card {
  width: 100%;
  max-width: 560px;
  text-align: center;
  border: none;
  border-radius: 20px;
  padding: 30px 30px 26px;
  box-shadow: 0 18px 50px rgba(31, 66, 135, .12), 0 2px 8px rgba(31, 66, 135, .06);
}

/* 查询输入区 */
.input-row { display: flex; gap: 12px; }
.input-wrap { position: relative; flex: 1; }
.search-ico {
  position: absolute;
  left: 14px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.input-wrap .input {
  height: 48px;
  padding: 0 14px 0 40px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}

.query-btn {
  height: 48px;
  padding: 0 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #3b7bff, #2456e6);
  box-shadow: 0 8px 18px rgba(47, 111, 237, .30);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.query-btn:hover {
  background: linear-gradient(135deg, #2f6ff0, #1e4fd6);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(47, 111, 237, .36);
}

/* 特性标签 */
.feature-chips {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.feature-chips li {
  font-size: 12.5px;
  color: #5b7ba6;
  background: #f0f5fc;
  border: 1px solid #dfe9f6;
  padding: 5px 12px;
  border-radius: 999px;
}

.query-hint { margin: 14px 2px 0; font-size: 13px; line-height: 1.6; color: var(--text-light); text-align: left; }

.result { margin-top: 20px; text-align: left; }
.result.hidden { display: none; }

.result.error p {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
}

/* ===== 通行证样式结果卡片 ===== */
.permit-card {
  position: relative;
  margin-top: 22px;
  border-radius: 14px;
  padding: 16px 18px;
  text-align: left;
  color: #123c66;
  background:
    radial-gradient(120% 90% at 88% 8%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(140% 110% at 8% 96%, rgba(94, 146, 196, .35) 0%, rgba(94, 146, 196, 0) 60%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .15) 0 2px, rgba(255, 255, 255, 0) 2px 9px),
    linear-gradient(135deg, #d3e9f9 0%, #b6dbf3 45%, #9fcbed 100%);
  border: 1px solid #8fbcdf;
  box-shadow: 0 10px 26px rgba(30, 80, 130, .20);
  overflow: hidden;
}

.permit-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(20, 64, 110, .28);
}

.permit-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #d9a441;
  box-shadow: inset 0 0 0 2px #f3d489;
  flex-shrink: 0;
}

.permit-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #14406e;
}

.permit-no {
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #9c2f24;
}

.permit-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.permit-label-row {
  flex-shrink: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #14406e;
}

.permit-body {
  display: flex;
  gap: 14px;
  padding-top: 14px;
}

.permit-info { flex: 1; min-width: 0; }

.permit-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #14406e;
}

.permit-name-en {
  margin: 2px 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  color: #2b6296;
  text-transform: uppercase;
  word-break: break-all;
}

.permit-field {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(20, 64, 110, .30);
  font-size: 13px;
}

.permit-field:last-child { border-bottom: none; padding-bottom: 0; }

.permit-field .f-label { color: #1c5288; font-weight: 600; flex-shrink: 0; }

.permit-field .f-value { font-weight: 700; color: #12365c; word-break: break-all; }
.permit-field .f-value.danger { color: #a03028; }

/* ===== 多条记录数量提示 ===== */
.multi-count-hint {
  margin-top: 22px;
  margin-bottom: -10px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-light);
  background: rgba(30, 91, 148, .06);
  border: 1px solid rgba(30, 91, 148, .12);
  border-radius: 8px;
  text-align: center;
}

.multi-count-hint strong {
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  margin: 0 2px;
}

@media (max-width: 640px) {
  .permit-card { padding: 14px 12px; border-radius: 12px; }
  .permit-title { font-size: 14px; letter-spacing: 1px; }
  .permit-no { font-size: 12px; }
  .permit-label-row { font-size: 18px; }
  .permit-name { font-size: 18px; }
  .permit-field { font-size: 12px; }
}

.footer {
  margin-top: 24px;
  color: var(--text-light);
  font-size: 12px;
  text-align: left;
}

/* ==================== 后台管理（专属控制台 UI） ==================== */

/* ---------- 侧边栏（电脑端固定，移动端抽屉） ---------- */
.admin-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 232px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #173352 0%, #0f2238 100%);
  box-shadow: 2px 0 18px rgba(15, 34, 56, .22);
}

/* 移动端抽屉遮罩 */
.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(13, 28, 46, .48);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.admin-overlay.show { opacity: 1; visibility: visible; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 4px solid #d9a441;
  box-shadow: inset 0 0 0 2px rgba(243, 212, 137, .45);
  flex-shrink: 0;
}
.brand-text strong {
  display: block;
  color: #fff;
  font-size: 15px;
  letter-spacing: 1px;
  line-height: 1.35;
}
.brand-text small {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 3px;
  color: #7d96b4;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 10px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 9px;
  color: #b3c6dd;
  font-size: 14px;
  line-height: 1.4;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.sidebar-nav a.active {
  background: linear-gradient(135deg, #3b7bff, #2f6fed);
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 111, 237, .38);
}
.sidebar-nav a.nav-logout { margin-top: auto; color: #8fa6c2; }
.sidebar-nav a.nav-logout:hover { background: rgba(229, 72, 77, .18); color: #ff9b9f; }

/* 导航待办角标（续签审核待处理数量） */
.sidebar-nav a .nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}
.sidebar-nav a.active .nav-badge { background: rgba(255, 255, 255, .28); }

.sidebar-footer {
  padding: 13px 18px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 11px;
  color: #68809e;
  white-space: nowrap;
}

/* ---------- 主内容区 ---------- */
.admin-main {
  margin-left: 232px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 17px; font-weight: 700; }

/* 汉堡按钮：仅移动端显示 */
.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.menu-toggle svg { width: 20px; height: 20px; }

.admin-wrap {
  flex: 1;
  width: 100%;
  padding: 22px 24px 56px;
}

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 17px;
  box-shadow: 0 1px 3px rgba(31, 66, 135, .05);
}
.stat-ico {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-ico svg { width: 22px; height: 22px; }
.stat-ico.blue  { background: #e8f0fe; color: #2f6fed; }
.stat-ico.green { background: var(--success-bg); color: var(--success); }
.stat-ico.amber { background: var(--warning-bg); color: var(--warning); }
.stat-ico.red   { background: var(--danger-bg);  color: var(--danger); }
.stat-num { font-size: 24px; font-weight: 800; line-height: 1.25; }
.stat-label { font-size: 12.5px; color: var(--text-light); }

/* ---------- 通用后台组件 ---------- */
.flash {
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  background: var(--success-bg);
  color: var(--success);
}
.flash.error { background: var(--danger-bg); color: var(--danger); }

.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* 桌面端 4 列：新增记录 7 个字段正好排成 2 排（4+3），避免孤行 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.form-item label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 5px;
}
.form-item .req::after { content: " *"; color: var(--danger); }

.form-actions { margin-top: 16px; display: flex; gap: 10px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 12px;
}
.search-form { display: flex; gap: 8px; flex: 1; max-width: 640px; }
/* 输入框占满按钮之外的剩余空间，按钮保持固有宽度不被压缩 */
.search-form .input { flex: 1 1 auto; width: auto; min-width: 180px; }
.search-form .btn, .search-form .export-dd { flex-shrink: 0; }

/* 导出 Excel 下拉菜单（购买管理 / 我的客户共用） */
.export-dd { position: relative; display: inline-block; }
.export-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12); min-width: 190px; z-index: 60; overflow: hidden;
}
.export-menu.show { display: block; }
.export-menu a { display: block; padding: 9px 14px; font-size: 13px; color: var(--text); text-decoration: none; white-space: nowrap; }
.export-menu a:hover { background: var(--bg); }

.hint { font-size: 13px; color: var(--text-light); }

.table-wrap { padding: 0; overflow-x: auto; }

table.list {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
table.list th, table.list td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}
table.list th {
  background: #fafbfc;
  color: var(--text-light);
  font-weight: 600;
}
table.list tbody tr { transition: background .12s ease; }
table.list tbody tr:hover { background: #f6f9ff; }
table.list tr:last-child td { border-bottom: none; }
table.list th:last-child, table.list td.actions { text-align: right; }
table.list td.actions form { display: inline; }

/* 代理备注 */
.remark-cell { white-space: normal; max-width: 240px; word-break: break-word; line-height: 1.45; }
.renew-apply-form { display: inline; margin: 0; }
.renew-rejected-tip { margin-top: 4px; font-size: 12px; }

/* 备注编辑弹窗 */
.remark-modal .modal-card {
  max-width: 280px;
  text-align: left;
  padding: 18px 18px 14px;
}
.remark-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #17345e;
}
.remark-modal textarea {
  width: 100%;
  margin-top: 10px;
  min-height: 40px;
  resize: none;
  font-family: inherit;
}
.remark-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ==================== 通用表单弹窗（新增/编辑客户、代理等） ==================== */
.form-modal { padding: 24px; }
.form-modal .modal-card {
  max-width: 620px;
  max-height: 92vh;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.form-modal form { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* 头部 */
.form-modal-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 56px 18px 24px;
  background: linear-gradient(135deg, #f5f8ff 0%, #eef3ff 100%);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.form-modal-ico {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 111, 237, .3);
}
.form-modal-ico svg { width: 22px; height: 22px; }
.form-modal-headtext { min-width: 0; }
.form-modal-title { font-size: 18px; font-weight: 700; color: #17345e; line-height: 1.3; }
.form-modal-sub { margin-top: 2px; font-size: 12.5px; color: var(--text-light); line-height: 1.4; }
.form-modal-head .modal-close { top: 10px; right: 12px; }

/* 表单主体（超高时滚动） */
.form-modal-body {
  padding: 20px 24px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}
.form-modal-note {
  display: flex;
  gap: 8px;
  background: #f5f8ff;
  border: 1px solid #e3ecff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #4e5969;
}
.form-modal-note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--primary); }
.form-section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .5px;
  margin: 4px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title::before {
  content: "";
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--primary);
}
.form-section-title:not(:first-child) { margin-top: 22px; }

.form-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-field { min-width: 0; }
.form-field-wide { grid-column: 1 / -1; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #4e5969;
  margin-bottom: 6px;
}
.form-field .req::after { content: " *"; color: var(--danger); }
.form-field .input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}
.form-field .hint { display: inline-block; margin-top: 6px; }

/* 弹窗内文件选择器 */
.file-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 5px 6px 5px 5px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fafbfd;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.file-pick:hover { border-color: var(--primary); background: #f5f8ff; }
.file-pick-btn {
  flex: none;
  padding: 7px 14px;
  border-radius: 8px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}
.file-pick-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-modal .qr-preview-row { margin: 10px 0 0; }
.form-modal .qr-preview-img { width: 76px; height: 76px; }

/* 弹窗内复选项行 */
.form-checks {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 4px 0;
}
.form-checks .checkbox-line {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfd;
  font-size: 13.5px;
}
.form-checks .checkbox-line:has(input:checked) {
  border-color: var(--primary);
  background: #f5f8ff;
  color: var(--primary);
  font-weight: 600;
}

/* 底部按钮栏 */
.form-modal-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  background: #fafbfd;
  border-top: 1px solid var(--border);
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.form-modal-foot .btn {
  min-width: 104px;
  height: 42px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.form-modal-submit {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 111, 237, .25);
}
.form-modal-submit:hover { background: var(--primary-dark); }
.form-modal-submit svg { width: 16px; height: 16px; }

/* 平板 / 手机端自适应 */
@media (max-width: 640px) {
  .form-modal { padding: 16px; }
  .form-modal .modal-card { max-height: 94vh; }
  .form-modal-head { padding: 18px 48px 15px 18px; gap: 12px; }
  .form-modal-ico { width: 38px; height: 38px; border-radius: 10px; }
  .form-modal-ico svg { width: 19px; height: 19px; }
  .form-modal-title { font-size: 16.5px; }
  .form-modal-body { padding: 16px 18px 18px; }
  .form-modal-foot { padding: 12px 18px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .form-modal { padding: 12px; }
  .form-modal-grid { grid-template-columns: 1fr; gap: 13px; }
  .form-section-title:not(:first-child) { margin-top: 18px; }
  .form-modal-foot .btn { flex: 1; min-width: 0; }
  .form-checks { gap: 10px; }
  .form-checks .checkbox-line { flex: 1; justify-content: center; }
  .pass-gen-row { flex-wrap: wrap; }
  .pass-gen-row .input { flex-basis: 100%; }
}

/* 续签确认弹窗 */
.confirm-modal .modal-card {
  max-width: 400px;
  text-align: center;
  padding: 26px 24px 20px;
}
.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #fff7ed;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-icon svg { width: 28px; height: 28px; }
/* 删除类确认弹窗：红色图标变体（消息中心删除等危险操作） */
.confirm-icon.danger { background: #fef2f2; color: var(--danger); }
/* 提示类弹窗：蓝色信息图标变体 */
.confirm-icon.info { background: #eff6ff; color: #1677ff; }

/* 轻量提示弹窗（替代浏览器原生 alert） */
.toast-modal .modal-card { max-width: 320px; padding: 28px 24px 22px; }
.toast-title {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 700;
  color: #17345e;
}
.toast-message {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  white-space: pre-line;
}
.toast-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}
.toast-actions .btn { min-width: 100px; }
.confirm-title {
  font-size: 17px;
  font-weight: 700;
  color: #17345e;
}
.confirm-body {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f6f9ff;
  border-radius: 10px;
  text-align: left;
}
.confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.confirm-row + .confirm-row { border-top: 1px dashed #dde5f2; }
.confirm-row-label { color: var(--text-light); flex-shrink: 0; }
.confirm-row-val   { color: var(--text); font-weight: 500; text-align: right; margin-left: 12px; }
.confirm-row-val strong { color: var(--success); }
.confirm-note {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.6;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ==================== 客户详情弹窗（查看） ==================== */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border-radius: 12px;
  border: 1px solid #dbeafe;
}
.detail-hero-ico {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(47,111,237,.28);
}
.detail-hero-ico svg { width: 26px; height: 26px; }
.detail-hero-main { flex: 1; min-width: 0; }
.detail-hero-name {
  font-size: 17px; font-weight: 700; color: var(--text);
  letter-spacing: .5px;
}
.detail-hero-sub {
  margin-top: 2px;
  font-size: 12.5px; color: var(--text-light);
  font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.detail-hero-badge { flex-shrink: 0; }

.detail-section {
  background: #fafbfc;
  border: 1px solid #eef1f5;
  border-radius: 10px;
  padding: 14px 16px 4px;
  margin-bottom: 12px;
}
.detail-section-title {
  font-size: 12px; font-weight: 700;
  color: var(--primary); letter-spacing: .6px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.detail-section-title::before {
  content: ""; width: 3px; height: 12px;
  border-radius: 2px; background: var(--primary);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}
.detail-grid .full { grid-column: 1 / -1; }
.detail-field-label {
  font-size: 11.5px; color: var(--text-light);
  margin-bottom: 3px; letter-spacing: .3px;
  text-transform: uppercase;
}
.detail-field-value {
  font-size: 14px; color: var(--text); font-weight: 500;
  line-height: 1.55;
  word-break: break-all;
}
.detail-field-value .hint { font-weight: 400; }
.detail-field-value .badge { vertical-align: middle; }
.detail-field-value.remark-text {
  white-space: pre-wrap;
  font-family: inherit;
  background: #fff;
  border: 1px solid #eef1f5;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 2px;
}
table.list th:last-child:not(:only-child) { text-align: right; }

/* 备注列居中显示（优先级需高于上方 th:last-child 右对齐规则） */
table.list th.col-remark:last-child { text-align: center; }
table.list td.col-remark { text-align: center; }

.pagination {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--card);
}
.pagination a:hover { text-decoration: none; background: var(--bg); }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { color: var(--text-light); background: var(--bg); }

/* ==================== 移动端适配 ==================== */
@media (max-width: 640px) {
  .card { padding: 18px 16px; }

  /* 查询页移动端：竖排大触控 */
  .page { padding: 28px 16px; }
  .hero { margin-bottom: 18px; }
  .hero-mark { width: 38px; height: 38px; border-width: 4px; }
  .site-title { font-size: 24px; }
  .site-desc { font-size: 14px; }
  .query-card { padding: 22px 16px 20px; border-radius: 16px; }
  .input-row { flex-direction: column; gap: 12px; }
  .input-row .btn { width: 100%; }
  .feature-chips { gap: 8px; }
  .feature-chips li { font-size: 12px; padding: 4px 11px; }
}

/* ---------- 后台：平板/手机专属布局（≤959px） ---------- */
@media (max-width: 959px) {
  /* 侧边栏变为抽屉 */
  .admin-sidebar {
    width: 264px;
    transform: translateX(-100%);
    transition: transform .28s ease;
    box-shadow: 4px 0 24px rgba(10, 24, 42, .35);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }

  /* 显示汉堡按钮 */
  .menu-toggle { display: inline-flex; }

  .admin-topbar { height: 54px; padding: 0 14px; }
  .topbar-title { font-size: 16px; }
  .admin-wrap { padding: 16px 14px 48px; }

  /* 统计卡片单排五列（紧凑竖排，隐藏图标，文字居中、字号随屏幕自适应） */
  .stat-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .stat-card { flex-direction: column; align-items: center; text-align: center; padding: 9px 5px; gap: 3px; }
  .stat-ico { display: none; }
  .stat-num { font-size: clamp(14px, 3.2vw, 19px); }
  .stat-label { font-size: clamp(8.5px, 1.9vw, 11.5px); line-height: 1.35; }

  /* 表单平板 2 列自适应、大字号防止 iOS 聚焦缩放 */
  .form-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .input { font-size: 16px; }
  .form-actions { gap: 8px; }
  .form-actions .btn { flex: 1; padding: 11px 20px; }

  /* 搜索栏竖排：输入框独占一行，按钮行自动换行均分 */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; margin: 16px 0 12px; }
  .search-form { max-width: none; flex-wrap: wrap; }
  .search-form .input { flex: 1 1 100%; min-width: 0; height: 42px; }
  .search-form .btn, .search-form .export-dd { flex: 1 1 auto; }
  .search-form .export-dd .btn { width: 100%; }
  .toolbar .hint { text-align: right; }
  /* 导出下拉菜单：按钮下方居中弹出，避免超出屏幕右缘 */
  .export-menu { left: 50%; right: auto; transform: translateX(-50%); max-width: calc(100vw - 40px); }

  /* 表格 → 卡片列表（无需横向滚动） */
  .table-wrap {
    overflow-x: visible;
    border: none;
    background: transparent;
    padding: 0;
  }
  table.list { min-width: 0; }
  table.list thead { display: none; }
  table.list tr {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 2px 0;
    box-shadow: 0 2px 10px rgba(31, 66, 135, .06);
  }
  table.list tbody tr:hover { background: #fff; }
  table.list td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
    text-align: right;
    white-space: normal;
    word-break: break-word;
  }
  table.list td::before {
    content: attr(data-label);
    flex-shrink: 0;
    text-align: left;
    color: var(--text-light);
    font-size: 12px;
  }
  table.list tr:last-child td,
  table.list tr td:last-child { border-bottom: none; }
  table.list td.empty-cell { justify-content: center; padding: 28px 16px; }
  table.list td.empty-cell::before { content: none; }
  table.list td.actions { gap: 8px; }
  table.list td.actions .btn { padding: 7px 16px; font-size: 13px; }

  /* 备注行整体居中 */
  table.list td.col-remark { justify-content: center; }

  .pagination { justify-content: center; }
}

/* ---------- 手机（≤ 640px）：表单恢复竖排 ---------- */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  /* 搜索栏按钮 2 个一行，均分宽度不挤压 */
  .search-form .btn, .search-form .export-dd { flex: 1 1 40%; }
}

/* ==================== 消息中心（messages.php） ==================== */

/* 未读消息行高亮（代理收件箱） */
table.list tr.unread-row { background: #fff8e1; }
table.list tr.unread-row:hover { background: #fff3c4; }

/* 消息中心表格自适应：
   列数多（7-9 列），放宽全局 860px 最小宽度并允许换行，
   侧边栏挤占内容区后不再撑出横向滚动；≤959px 自动进入全局卡片式布局 */
table.msg-table { min-width: 0; }
table.msg-table th, table.msg-table td { white-space: normal; word-break: break-word; }
table.msg-table td.actions { white-space: nowrap; }
/* 内容列限宽：超长文案换行而不是把整表撑宽 */
table.msg-table td.col-content { min-width: 220px; max-width: 460px; line-height: 1.55; }
table.msg-table td.col-content .badge { vertical-align: baseline; }

/* ≤959px 进入卡片式布局后解除内容列限宽，完全跟随屏幕宽度 */
@media (max-width: 959px) {
  table.msg-table td.col-content { min-width: 0; max-width: none; }
}

/* 公告表单标签与输入控件 */
.form-label {
  display: block;
  margin: 8px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-label + input[type="text"],
.form-label + textarea {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  box-sizing: border-box;
}
.form-label + textarea { resize: vertical; min-height: 96px; }

/* ==================== 后台登录页（专属 UI，命名隔离 admin-login） ==================== */

/* ---------- 电脑端：左右分栏 ---------- */
body.admin-login {
  min-height: 100vh;
  background: linear-gradient(180deg, #f3f7fd 0%, #e9eff8 100%);
  display: flex;
  align-items: stretch;
  padding: 0;
}
/* 隐藏 body 原本的光斑，改用品牌区渐变 */
body.admin-login::before,
body.admin-login::after { display: none; }

.admin-login .al-wrap {
  flex: 1;
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

/* 左侧品牌区 */
.admin-login .al-brand {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 85% 10%, rgba(120, 180, 255, .35) 0%, rgba(120, 180, 255, 0) 55%),
    radial-gradient(90% 80% at 10% 90%, rgba(237, 212, 137, .22) 0%, rgba(237, 212, 137, 0) 60%),
    linear-gradient(160deg, #173352 0%, #0f2238 58%, #0a1928 100%);
  color: #e7eef7;
  overflow: hidden;
}
.admin-login .al-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.9), transparent 80%);
  pointer-events: none;
}
.admin-login .al-brand-inner {
  position: relative;
  padding: 48px 44px;
  max-width: 440px;
}
.admin-login .al-mark {
  display: inline-block;
  width: 56px; height: 56px;
  margin-bottom: 20px;
  border-radius: 50%;
  border: 6px solid #d9a441;
  box-shadow: inset 0 0 0 3px rgba(243, 212, 137, .55), 0 10px 26px rgba(0,0,0,.35);
  background: rgba(255,255,255,.06);
}
.admin-login .al-brand-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  line-height: 1.3;
}
.admin-login .al-brand-sub {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 4px;
  color: #7ea1c7;
  text-transform: uppercase;
}
.admin-login .al-brand-features {
  list-style: none;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-login .al-brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
  color: #c8d6e8;
}
.admin-login .al-brand-features svg {
  width: 20px; height: 20px;
  color: #f3d489;
  flex-shrink: 0;
}
.admin-login .al-brand-foot {
  position: absolute;
  left: 44px; right: 44px; bottom: 28px;
  font-size: 12px;
  color: #5c7694;
  letter-spacing: 1px;
}

/* 右侧登录卡片区 */
.admin-login .al-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: transparent;
}
.admin-login .al-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 38px 36px 34px;
  box-shadow: 0 22px 56px rgba(31, 66, 135, .14), 0 2px 10px rgba(31, 66, 135, .06);
}
.admin-login .al-card-title {
  font-size: 24px;
  font-weight: 700;
  color: #17345e;
}
.admin-login .al-card-desc {
  margin-top: 6px;
  margin-bottom: 26px;
  color: var(--text-light);
  font-size: 14px;
}
.admin-login .al-form .flash { margin-bottom: 18px; }

.admin-login .al-field { margin-bottom: 18px; }
.admin-login .al-field label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.admin-login .al-field .input {
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-login .al-field .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}
.admin-login .al-captcha-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.admin-login .al-captcha-row .input { flex: 1; }
.admin-login .al-captcha-img {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  background: #fff;
}
.admin-login .al-submit {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 4px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b7bff, #2456e6);
  box-shadow: 0 8px 18px rgba(47, 111, 237, .30);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.admin-login .al-submit:hover {
  background: linear-gradient(135deg, #2f6ff0, #1e4fd6);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(47, 111, 237, .36);
}
.admin-login .al-tip {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}

/* ---------- 移动端（≤ 640px）：单栏紧凑 ---------- */
@media (max-width: 640px) {
  body.admin-login {
    min-height: 100vh;
    align-items: stretch;
  }
  .admin-login .al-wrap {
    flex-direction: column;
    min-height: 100vh;
  }

  /* 品牌区缩小为顶部横条 */
  .admin-login .al-brand {
    flex: none;
    min-height: auto;
    padding: 28px 20px 22px;
  }
  .admin-login .al-brand::before { display: none; }
  .admin-login .al-brand-inner {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .admin-login .al-mark {
    width: 44px; height: 44px;
    margin-bottom: 12px;
    border-width: 5px;
  }
  .admin-login .al-brand-title { font-size: 22px; letter-spacing: 1.5px; }
  .admin-login .al-brand-sub { font-size: 11.5px; letter-spacing: 3px; }
  .admin-login .al-brand-features { display: none; }
  .admin-login .al-brand-foot { display: none; }

  /* 卡片拉满，底部留白用 safe-area */
  .admin-login .al-form-side {
    flex: 1;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    align-items: flex-start;
  }
  .admin-login .al-card {
    max-width: 100%;
    border-radius: 16px;
    padding: 26px 20px 22px;
    box-shadow: 0 12px 34px rgba(31, 66, 135, .10);
  }
  .admin-login .al-card-title { font-size: 20px; }
  .admin-login .al-card-desc { font-size: 13px; margin-bottom: 22px; }

  /* iOS 防聚焦缩放 */
  .admin-login .al-field .input { font-size: 16px; height: 46px; }
  .admin-login .al-captcha-img { height: 46px; }
  .admin-login .al-submit { height: 50px; font-size: 17px; }
}

/* ==================== 前台：续费按钮与二维码弹窗 ==================== */

/* 剩余过期时间 + 续费按钮 并排行 */
.permit-bottom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 5px;
}

.permit-field-flex {
  flex: 1;
  min-width: 0;
  padding-bottom: 0 !important;
  border-bottom: none !important;
}

.renew-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #2bc46d 0%, #0ea85a 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(14, 168, 90, .32);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  white-space: nowrap;
}
.renew-btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(14, 168, 90, .40); }
.renew-btn:active { transform: translateY(0); }
.renew-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

@media (max-width: 480px) {
  .permit-bottom-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .renew-btn { width: 100%; }
}

/* 弹窗遮罩与卡片 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(13, 28, 46, .55);
  backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 18px;
  padding: 26px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(10, 24, 42, .35);
  animation: modal-pop .22s ease;
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-title { font-size: 18px; font-weight: 700; color: #17345e; }
.modal-agent { margin-top: 4px; font-size: 13.5px; color: var(--text-light); }

.modal-qr {
  width: 220px;
  height: 220px;
  margin: 16px auto 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.modal-qr img { width: 100%; height: 100%; object-fit: contain; display: block; }

.modal-wechat {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.modal-wechat .wechat-text { user-select: all; }
.modal-wechat .wechat-copy {
  flex-shrink: 0;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #1677ff;
  background: #e8f1ff;
  border: 1px solid #b9d4ff;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.6;
}
.modal-wechat .wechat-copy:hover:not(:disabled) { background: #d6e6ff; }
.modal-wechat .wechat-copy:disabled { opacity: .45; cursor: not-allowed; }
.modal-tip { margin-top: 6px; font-size: 12.5px; color: var(--text-light); }

/* ==================== 后台：续费代理二维码管理 ==================== */
.qr-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: zoom-in;
  vertical-align: middle;
}

.qr-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.qr-preview-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.checkbox-line input { width: 16px; height: 16px; cursor: pointer; }
.agent-default-item { display: flex; flex-direction: column; }

/* 密码输入框 + 随机生成/显隐按钮并排 */
.pass-gen-row { display: flex; gap: 8px; }
.pass-gen-row .input { flex: 1; min-width: 0; }
.pass-gen-row .btn { flex: none; white-space: nowrap; align-self: stretch; }

/* 新增客户表单网格：桌面/移动端均两列，minmax(0,1fr) 允许收缩避免日期框溢出 */
.purchase-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 16px;
}
.purchase-form-grid > div { min-width: 0; }
.purchase-form-grid .input { min-width: 0; }

/* 弹窗移动端紧凑适配 */
@media (max-width: 640px) {
  .modal-card { max-width: 100%; padding: 22px 18px 20px; }
  .modal-qr { width: 200px; height: 200px; }
  .purchase-form-grid { gap: 10px 12px; }
}


/* ==================== 后台：修改密码页 ==================== */
.pwd-card {
  max-width: 460px;
  margin: 24px auto 0;
  padding: 36px 32px 28px;
  border-radius: 16px;
  border: 1px solid #edf1f8;
  box-shadow: 0 14px 40px rgba(31, 66, 135, .10), 0 2px 8px rgba(31, 66, 135, .04);
}

.pwd-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #17345e;
  margin-bottom: 4px;
}

.pwd-card .flash {
  text-align: center;
  margin: 16px 0;
}

.pwd-form { margin-top: 20px; }
.pwd-form .form-item { margin-bottom: 16px; }
.pwd-form .form-item label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 7px;
}
.pwd-form .form-item .input {
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pwd-form .form-item .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}

.pwd-submit {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b7bff, #2456e6);
  box-shadow: 0 8px 18px rgba(47, 111, 237, .30);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.pwd-submit:hover {
  background: linear-gradient(135deg, #2f6ff0, #1e4fd6);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(47, 111, 237, .36);
}

.pwd-hint {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--text-light);
  text-align: center;
  line-height: 1.7;
}
.pwd-hint-divider {
  margin: 0 6px;
  color: #c9d1dc;
}

/* 改密页移动端：卡片拉满 + 触控尺寸放大 */
@media (max-width: 959px) {
  .pwd-card { max-width: 100%; margin: 8px auto 0; padding: 28px 22px 22px; }
}
@media (max-width: 640px) {
  .pwd-card {
    max-width: 100%;
    margin: 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(31, 66, 135, .08);
  }
  .pwd-title { font-size: 17px; }
  .pwd-form .form-item { margin-bottom: 14px; }
  .pwd-form .form-item .input { font-size: 16px; height: 46px; }
  .pwd-submit { height: 50px; font-size: 17px; }
  .pwd-hint { font-size: 12px; }
}

/* ---------- 仪表盘：数据可视化图表 ---------- */
.dash-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.chart-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px 12px;
  box-shadow: 0 1px 3px rgba(31, 66, 135, .05);
}
.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.chart-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.chart-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chart-dot.dot-blue  { background: var(--primary); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.chart-dot.dot-green { background: var(--success); box-shadow: 0 0 0 3px rgba(46, 158, 91, .12); }
.chart-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; }
.chart-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.chart-sub { font-size: 11px; color: var(--text-light); white-space: nowrap; }
.chart-sub.delta-up   { color: var(--success); font-weight: 600; }
.chart-sub.delta-down { color: var(--danger); font-weight: 600; }
.chart-body { flex: 1 1 auto; min-height: 220px; position: relative; }
.chart-body svg { display: block; width: 100%; height: 100%; }
.chart-foot {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-light);
}

/* 环图卡片 */
.chart-donut-body {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 2px 0 6px;
}
.donut-fig {
  width: clamp(100px, 28%, 162px);
  aspect-ratio: 1 / 1;
  flex: none;
}
.donut-fig svg { width: 100%; height: 100%; }
.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
}
.donut-legend li { display: flex; align-items: center; gap: 7px; font-size: 12px; cursor: default; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lg-label { color: var(--text); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { display: flex; align-items: baseline; gap: 5px; flex: none; }
.lg-val b { font-size: 13.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.lg-val i { font-style: normal; font-size: 11px; color: var(--text-light); font-variant-numeric: tabular-nums; }

/* 图表入场动画 */
.dash-bar { transition: filter .15s ease; }
.dash-bar:hover { filter: brightness(.93); }
.dash-bar-grow { animation: dashBarGrow .7s cubic-bezier(.22, .8, .3, 1) both; }
@keyframes dashBarGrow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
.dash-area-fill { animation: dashFadeIn 1s ease .3s both; }
.dash-area-line { animation: dashLineDraw 1.1s cubic-bezier(.22, .8, .3, 1) .1s both; }
@keyframes dashFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dashLineDraw {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}
.dash-halo {
  transform-box: fill-box;
  transform-origin: center;
  animation: dashHalo 2.2s ease-out .9s infinite;
}
@keyframes dashHalo {
  0%   { transform: scale(.45); opacity: .3; }
  70%  { transform: scale(2); opacity: 0; }
  100% { transform: scale(2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-bar-grow, .dash-area-fill, .dash-area-line, .dash-halo { animation: none !important; }
}

/* 图表响应式：平板两列、手机单列 */
@media (max-width: 959px) {
  .dash-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .chart-card { padding: 13px 14px 11px; }
  .chart-body { min-height: 188px; }
  .donut-fig { width: clamp(104px, 38%, 150px); }
}
@media (max-width: 600px) {
  .dash-charts { grid-template-columns: minmax(0, 1fr); }
  .chart-value { font-size: 20px; }
  .chart-body { min-height: 190px; }
  .donut-fig { width: clamp(112px, 34%, 148px); }
}
