/* ==========================================================================
   二手复印机租赁 —— 管理后台样式
   浅色主题 / 主色 #2563eb / 圆角 10-14px / 柔和阴影
   纯 CSS，不依赖任何外部字体与图标库（图标使用 emoji 或纯 CSS 绘制）
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;

  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #1f2937;
  --text-strong: #111827;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f1f3f7;

  --amber: #d97706;
  --amber-bg: #fef3c7;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --green: #059669;
  --green-bg: #d1fae5;
  --gray: #6b7280;
  --gray-bg: #f3f4f6;
  --red: #dc2626;
  --red-bg: #fee2e2;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text-strong); }

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

/* ============================ 顶部导航 ============================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
}

.brand-logo { font-size: 20px; line-height: 1; }
.brand-name { font-size: 17px; font-weight: 700; color: var(--text-strong); letter-spacing: .3px; }
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  background: var(--primary-soft);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  /* 菜单多了不把文字挤成竖排，横向滚动即可 */
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
  flex: 0 0 auto;
}

.nav-item:hover { background: var(--border-light); color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================ 提示条 ============================ */

.alert {
  max-width: 1400px;
  margin: 16px auto -4px;
  padding: 12px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.alert[hidden] { display: none; }

.alert-warn {
  background: var(--amber-bg);
  border: 1px solid #fcd34d;
  color: #92400e;
}

.alert-icon { font-size: 16px; }

/* ============================ 容器与面板 ============================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 24px 60px;
}

.view[hidden] { display: none; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 19px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head h3 { font-size: 15px; }
.panel-tip { color: var(--muted); font-size: 12.5px; }
.panel-body { padding: 20px; }

/* ============================ 工具栏 ============================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.toolbar-right { margin-left: auto; display: flex; gap: 10px; }

.search-box { position: relative; }

.search-box .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .55;
  pointer-events: none;
}

.search-box input { padding-left: 32px; width: 260px; }

.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; flex-wrap: wrap; }

.tab {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s ease;
}

.tab:hover { color: var(--text); }
.tab.is-active { background: var(--panel); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ============================ 按钮 ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.2;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:hover:not(:disabled) { border-color: #d1d5db; background: #fafafa; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .3); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-soft { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: #e0ecff; border-color: #93c5fd; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--border-light); color: var(--text); }

.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }

.btn-danger-soft { background: var(--red-bg); border-color: #fecaca; color: var(--red); }
.btn-danger-soft:hover:not(:disabled) { background: #fee2e2; border-color: #fca5a5; }

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

.btn-block { width: 100%; }

.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn-primary.is-loading::after { border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ 表单 ============================ */

.form { display: block; }

.form-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 4px;
  margin: 0 0 16px;
  background: #fcfdff;
}

.form-group > legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  padding: 0 8px;
  margin-left: -4px;
}

.grid { display: grid; gap: 14px 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-full { grid-column: 1 / -1; }

.field { display: block; margin-bottom: 12px; }
.field > label, .field-label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.req { color: var(--red); margin-left: 2px; }

input[type="text"], input[type="password"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea { resize: vertical; min-height: 76px; line-height: 1.7; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

input::placeholder, textarea::placeholder { color: var(--muted-light); }
select { cursor: pointer; appearance: none; background-image: none; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 4px 0 14px; flex-wrap: wrap; }

.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* 开关（纯 CSS 绘制） */
.switch-row { display: flex; gap: 10px; flex-wrap: wrap; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--panel);
  transition: all .15s ease;
  font-size: 13.5px;
}

.switch input { width: auto; margin: 0; accent-color: var(--primary); }
.switch:has(input:checked) { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ============================ 表格 ============================ */

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 900px;
}

.table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  background: #fafbfd;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-thumb { width: 72px; }
.table .col-actions { width: 190px; text-align: right; }
.table .nowrap { white-space: nowrap; }

.cell-title { font-weight: 600; color: var(--text-strong); }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.price { font-weight: 600; color: var(--text-strong); }
.price-muted { color: var(--muted-light); font-weight: 400; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .thumb-ph { display: none; font-size: 20px; }
.thumb.is-empty img { display: none; }
.thumb.is-empty .thumb-ph { display: block; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 46px 16px !important;
}

.empty-inline { color: var(--muted-light); font-size: 13px; padding: 18px; text-align: center; margin: 0; }

/* ============================ 徽章 ============================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.7;
}

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.st-pending   { background: var(--amber-bg);  color: var(--amber); }
.st-paid      { background: var(--blue-bg);   color: var(--blue); }
.st-shipping  { background: var(--purple-bg); color: var(--purple); }
.st-completed { background: var(--green-bg);  color: var(--green); }
.st-cancelled { background: var(--gray-bg);   color: var(--gray); }
.st-refunded  { background: var(--red-bg);    color: var(--red); }

.badge-on  { background: var(--green-bg); color: var(--green); }
.badge-off { background: var(--gray-bg);  color: var(--gray); }

/* ============================ 分页 ============================ */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.pager-info { color: var(--muted); font-size: 13px; }
.pager-info b { color: var(--text-strong); }
.pager-btns { display: flex; gap: 8px; }

/* ============================ 弹窗 ============================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}

.modal.is-open { opacity: 1; visibility: visible; }

.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }

.modal-box {
  position: relative;
  width: 100%;
  max-width: 780px;
  max-height: 88vh;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(14px) scale(.985);
  transition: transform .18s ease;
  overflow: hidden;
}

.modal.is-open .modal-box { transform: none; }

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: #fcfdff;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
}

.icon-btn:hover { background: var(--border-light); color: var(--text); }

/* ============================ 确认框 ============================ */

.confirm {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s ease, visibility .16s ease;
}

.confirm.is-open { opacity: 1; visibility: visible; }

.confirm-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  text-align: center;
  transform: translateY(10px);
  transition: transform .16s ease;
}

.confirm.is-open .confirm-box { transform: none; }
.confirm-title { font-size: 16px; margin-bottom: 8px; }
.confirm-text { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; word-break: break-word; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-icon { font-size: 30px; display: block; margin-bottom: 8px; }

/* ============================ 订单抽屉 ============================ */

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, .38);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.drawer-mask.is-open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  width: min(480px, 100%);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}

.drawer.is-open { transform: none; }

.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.drawer-head h3 { font-size: 16px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }

.drawer-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: #fcfdff;
  flex-shrink: 0;
}

/* 详情信息块 */
.detail-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.detail-block > h4 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border-light);
}

.detail-row:last-child { border-bottom: 0; }
.detail-key { color: var(--muted); width: 92px; flex-shrink: 0; }
.detail-val { color: var(--text); flex: 1; word-break: break-word; }

.machine-box { display: flex; gap: 12px; align-items: center; }
.machine-thumb { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.machine-thumb img { width: 100%; height: 100%; object-fit: cover; }
.machine-thumb.is-empty img { display: none; }
.machine-thumb .thumb-ph { font-size: 22px; }

.fee-total { color: var(--red); font-weight: 700; font-size: 17px; }

.call-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.call-link:hover { background: #e0ecff; text-decoration: none; }

/* ============================ 图片上传区 ============================ */

.img-field {
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius);
  background: var(--primary-soft);
  padding: 16px;
}

.img-field.is-drag { background: #dbeafe; border-color: var(--primary); }

.img-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.img-list:empty { display: none; }

.img-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
}

.img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.img-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, .62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}

.img-del:hover { background: var(--red); }

/* ============================ 轻提示 ============================ */

.toast-wrap {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
  max-width: 80vw;
  text-align: center;
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-out { opacity: 0; transition: opacity .3s ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ============================ 登录页 ============================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(1000px 420px at 12% -8%, #dbeafe 0%, rgba(219, 234, 254, 0) 60%),
    radial-gradient(900px 400px at 100% 100%, #e0e7ff 0%, rgba(224, 231, 255, 0) 62%),
    var(--bg);
}

.login-wrap { width: 100%; max-width: 420px; }

.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { font-size: 42px; line-height: 1; display: block; margin-bottom: 10px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text-strong); }
.login-slogan { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
}

.login-card .field { margin-bottom: 16px; }

.login-error {
  display: none;
  background: var(--red-bg);
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
  word-break: break-word;
}

.login-error.is-show { display: block; }

.login-demo {
  margin-top: 18px;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.login-demo code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.login-foot { text-align: center; color: var(--muted-light); font-size: 12px; margin-top: 18px; }

.login-alert { margin: 0 0 16px; }

/* ============================ 统计看板 ============================ */

.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  background: #fcfdff;
}

.stat-label { font-size: 12.5px; color: var(--muted); }

.stat-value {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-strong);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.stat-sub { font-size: 11.5px; color: var(--muted-light); margin-top: 2px; }

.stat-card.is-primary { background: var(--primary-soft); border-color: var(--primary-border); }
.stat-card.is-primary .stat-value { color: var(--primary); }
.stat-card.is-warn { background: var(--amber-bg); border-color: #fcd34d; }
.stat-card.is-warn .stat-value { color: var(--amber); }
.stat-card.is-danger { background: var(--red-bg); border-color: #fecaca; }
.stat-card.is-danger .stat-value { color: var(--red); }

/* 占比条 */
.ratio-row { margin-bottom: 14px; }

.ratio-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 6px;
}

.ratio-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

.ratio-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}

.ratio-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s ease; }
.ratio-fill.is-buy { background: var(--purple); }

/* 状态分布 */
.dist-list { display: flex; flex-direction: column; gap: 11px; }

.dist-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.dist-name { width: 72px; flex-shrink: 0; color: var(--muted); }

.dist-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}

.dist-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }

.dist-num { width: 42px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* 纯 CSS 柱状图 */
.chart-y {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted-light);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.chart {
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 210px;
}

.chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }

.chart-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-bar {
  width: 62%;
  max-width: 46px;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary) 0%, #60a5fa 100%);
  position: relative;
}

.chart-val {
  position: absolute;
  top: -19px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.chart-x { font-size: 11.5px; color: var(--muted); margin-top: 8px; white-space: nowrap; }

/* 排行榜 */
.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 13px;
}

.rank-item:last-child { border-bottom: 0; }

.rank-no {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--gray-bg);
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-item:nth-child(-n+3) .rank-no { background: var(--primary-soft); color: var(--primary); }

.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rank-bar {
  width: 72px;
  height: 6px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
  flex-shrink: 0;
}

.rank-fill { display: block; height: 100%; background: var(--primary); }

.rank-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ============================ 通知中心 ============================ */

.notify-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.notify-item:last-child { border-bottom: 0; }
.notify-item.is-unread { background: var(--primary-soft); }

.notify-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 9px;
  flex-shrink: 0;
}

.notify-item.is-unread .notify-dot { background: var(--primary); }

.notify-main { flex: 1; min-width: 0; }

.notify-title { font-weight: 600; color: var(--text-strong); }

.notify-content { color: var(--muted); font-size: 13px; margin-top: 3px; word-break: break-word; }

.notify-time { color: var(--muted-light); font-size: 12px; margin-top: 5px; }

/* ============================ 抽屉内嵌小表格 ============================ */

.sub-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.sub-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 8px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sub-table td { padding: 7px 8px; border-bottom: 1px dashed var(--border-light); vertical-align: middle; }
.sub-table tr:last-child td { border-bottom: 0; }
.sub-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sub-table .table-wrap { overflow-x: auto; }

/* ============================ 结算 / 续租预览 ============================ */

.preview-box {
  border: 1px solid var(--primary-border);
  background: var(--primary-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}

.preview-key { color: var(--muted); }
.preview-val { font-weight: 600; font-variant-numeric: tabular-nums; }

.preview-row.is-total {
  border-top: 1px dashed var(--primary-border);
  margin-top: 6px;
  padding-top: 8px;
}

.preview-row.is-total .preview-val { color: var(--red); font-size: 15px; }

/* ============================ 其他补充 ============================ */

.nav-badge {
  margin-left: 6px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.nav-badge[hidden] { display: none; }

.panel-row {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.table-compact { min-width: 540px; }

@media (max-width: 900px) {
  .panel-row { grid-template-columns: minmax(0, 1fr); }
}

/* ============================ 响应式 ============================ */

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .topbar-inner {
    height: auto;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav-item { flex-shrink: 0; }
  .topbar-right { margin-left: auto; }
  .admin-chip { max-width: 130px; }

  .container { padding: 16px 14px 48px; }
  .alert { margin: 12px 14px -2px; }

  .toolbar { padding: 12px 14px; }
  .search-box input { width: 100%; }
  .search-box { flex: 1 1 100%; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .toolbar-right .btn { flex: 1; }

  .panel-head, .panel-body { padding: 14px; }

  .table .hide-sm { display: none; }
  .table { min-width: 560px; }
  .table.order-table { min-width: 660px; }

  .pager { padding: 12px 14px; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-box { max-width: none; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-body { padding: 16px 14px; }
  .modal-foot { padding: 12px 14px; }
  .modal-foot .btn { flex: 1; }

  .drawer { width: 100%; }
  .login-card { padding: 24px 20px 20px; }
  .form-group { padding: 14px 12px 2px; }
}

@media (max-width: 480px) {
  .detail-key { width: 78px; }
  .brand-sub { display: none; }
}
/* ============================ 在线咨询 ============================ */

.chat-panel {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.chat-side {
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-side-title {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
}

.chat-conv-list {
  overflow-y: auto;
  max-height: 640px;
}

.chat-conv {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.chat-conv:hover { background: #f8fafc; }

.chat-conv.is-active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.chat-conv-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-conv-name {
  font-weight: 600;
  font-size: 13.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conv-time {
  font-size: 11.5px;
  color: var(--muted-light);
}

.chat-conv-phone {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.chat-conv-tag {
  display: inline-block;
  font-size: 11.5px;
  color: var(--primary-dark);
  background: var(--blue-bg);
  border-radius: 999px;
  padding: 1px 8px;
  margin-top: 6px;
}

.chat-conv-last {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 7px;
  flex-shrink: 0;
}

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

.chat-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
}

.chat-head-name { font-weight: 600; }
.chat-head-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.chat-head-openid {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-body {
  flex: 1;
  padding: 16px 18px;
  overflow-y: auto;
  max-height: 460px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg { max-width: 72%; }
.chat-msg.is-customer { align-self: flex-start; }
.chat-msg.is-admin { align-self: flex-end; text-align: right; }

.chat-bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  text-align: left;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-msg.is-customer .chat-bubble {
  background: #fff;
  border: 1px solid var(--border-light);
}

.chat-msg.is-admin .chat-bubble {
  background: var(--primary);
  color: #fff;
}

.chat-msg-time {
  font-size: 11px;
  color: var(--muted-light);
  margin-top: 4px;
}

.chat-reply {
  border-top: 1px solid var(--border-light);
  padding: 12px 18px;
}

.chat-reply textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  resize: vertical;
}

.chat-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .chat-panel { grid-template-columns: 1fr; }
  .chat-side { border-right: none; border-bottom: 1px solid var(--border-light); }
  .chat-conv-list { max-height: 220px; }
}

/* ============================ 客户即时消息栏 ============================ */

.btn-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.live-dot[hidden] { display: none; }

.chat-livebar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1400px;
  margin: 12px auto -4px;
  padding: 10px 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chat-livebar[hidden] { display: none; }

.chat-live-icon { font-size: 18px; }

.chat-live-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: #7c2d12;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ============================ 版本更新提示 ============================ */

.build-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1400px;
  margin: 12px auto -4px;
  padding: 10px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  color: #1e40af;
}

.build-tip[hidden] { display: none; }

/* ============================ 窄屏顶栏 ============================ */

/* 窗口不够宽时，菜单整体挪到第二行，横向滚动，不再把文字挤成竖排 */
@media (max-width: 1280px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    row-gap: 8px;
  }

  .brand { flex: 1; }

  .nav {
    order: 3;
    flex-basis: 100%;
    padding-bottom: 2px;
  }
}
