/* 朱雀后台的公共色板与控件尺寸 */
:root {
  --primary: #1677ff;
  --primary-dark: #095ec9;
  --primary-light: #e7f1ff;
  --success: #24634b;
  --success-light: #e8f2ec;
  --warning: #805116;
  --warning-light: #fbf0da;
  --danger: #ad332e;
  --danger-light: #faecea;
  --text-primary: #1d2839;
  --text-secondary: #465469;
  --text-tertiary: #657286;
  --bg: #f4f7fa;
  --card: #fff;
  --border: #e6ebf2;
  --control-border: #d5dce7;
  --subtle: #f7f8fb;
  --row-hover: #f5f9ff;
  --radius: 10px;
  --shadow: 0 12px 36px rgba(22, 43, 73, .13);
  --sidebar-w: 192px;
  --sidebar-bg: #fff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 19px 21px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.section__head h2 { font-size: 16px; margin: 0; font-weight: 650; flex-shrink: 0; }
.section__hint { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mobile-cell-label { display: none; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; }
tbody tr:hover { background: var(--row-hover); }
.table-wrap { overflow: auto; max-height: 65vh; position: relative; scrollbar-gutter: stable; }
.table-wrap table { border-collapse: separate; border-spacing: 0; }
.table-wrap th { position: sticky; top: 0; z-index: 2; background: var(--subtle); }
.row-number { width: 52px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.table-wrap .row-number { position: sticky; left: 0; z-index: 1; background: #fff; border-right: 1px solid var(--border); }
.table-wrap th.row-number { z-index: 4; background: var(--subtle); }
.table-wrap tbody tr:hover .row-number { background: var(--row-hover); }
.order-retention-note { padding: 10px 12px; margin-bottom: 14px; background: var(--primary-light); color: var(--text-secondary); border-radius: 8px; font-size: 12px; line-height: 1.7; }
.order-table { min-width: 1010px; }
.order-table .cell-truncate { display: block; max-width: clamp(98px, 9vw, 170px); overflow: hidden; text-overflow: ellipsis; }
.product-actions { min-width: 170px; }
.modal-box.order-detail-box { max-width: 700px; }
.modal-box.withdraw-review-box { max-width: 1040px; }
.withdraw-actions { position: sticky; right: 0; z-index: 1; background: #fff; border-left: 1px solid var(--border); }
.table-wrap th.withdraw-actions { z-index: 3; }
.withdraw-review-controls { display: flex; align-items: center; gap: 8px; }
.withdraw-review-list-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.withdraw-review-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 8px; margin: 14px 0; }
.withdraw-review-summary div { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.withdraw-review-summary strong { display: block; margin-top: 3px; font-size: 16px; }
.withdraw-review-alerts { margin-bottom: 12px; color: var(--danger); line-height: 1.7; }
.withdraw-review-table { max-height: 42vh; margin: 8px 0; }
.withdraw-review-table td { vertical-align: top; }
.withdraw-review-table .badge { display: table; margin-bottom: 4px; }
.withdraw-review-order { border: 0; padding: 0; background: none; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; }
.withdraw-review-order:disabled { opacity: .6; cursor: wait; }
.withdraw-review-pages { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.order-detail-grid { margin: 16px 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px 16px; font-size: 13px; line-height: 1.8; }
.order-detail-grid dt { color: var(--text-secondary); }
.order-detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.order-detail-grid .btn { margin: 4px 0 0 8px; }
.order-detail-box .order-retention-note { margin-top: 16px; }
@media (max-width: 600px) {
  .order-detail-grid { grid-template-columns: 1fr; gap: 3px; }
  .order-detail-grid dd { margin-bottom: 12px; }
}
.empty { color: var(--text-tertiary); padding: 32px 0; text-align: center; font-size: 13px; }

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  margin-right: 6px;
  font-family: inherit;
  font-weight: 600;
  transition: background-color .15s, opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: var(--card); border-color: var(--control-border); color: var(--text-primary); }
.btn-outline:hover { background: var(--subtle); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; display: block; text-align: center; }

.badge { padding: 2px 7px; border-radius: 4px; font-size: 12px; font-weight: 500; display: inline-block; }
.badge-on, .badge-success { background: var(--success-light); color: var(--success); }
.badge-off { background: #eef1f6; color: var(--text-secondary); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.form-row input, .form-row select, .field > input:not([type=checkbox]), .field > select {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
/* 有些表单(比如产品管理)填好值之后 placeholder 会被盖住,光看输入框完全不知道哪格是哪格,
   所以这几个字段用 .field 包一层,label 常驻显示在输入框上方,不随有没有值而消失 */
.form-row .field { display: flex; flex-direction: column; flex: 1; min-width: 120px; }
.form-row .field input, .form-row .field select { flex: none; width: 100%; min-width: 0; }
.form-row .field .field-label { margin-bottom: 6px; }
textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
}
.field-label { display: block; font-size: 12.5px; color: var(--text-secondary); margin: 0 0 6px; font-weight: 600; }

/* ---------- 弹窗(新增/编辑用),平时藏着,点按钮才出现 ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 40, 64, .38);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-box__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-box__head h3 { margin: 0; font-size: 17px; }
.modal-box__close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--text-tertiary);
  padding: 4px;
}
.modal-box__close:hover { color: var(--text-primary); }
.modal-box__hint { font-size: 12px; color: var(--text-tertiary); line-height: 1.6; margin-bottom: 18px; }
.modal-box__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-box__subhead {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.modal-box__subhead:first-of-type { margin-top: 4px; padding-top: 0; border-top: none; }
#p-color { padding: 4px; height: 38px; cursor: pointer; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }

.hint { font-size: 12px; color: var(--text-tertiary); line-height: 1.6; }
.hint.error { color: var(--danger); }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: #1a1d24;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* 导航和页面骨架 */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button, input, select, textarea { font-family: inherit; }
.svg-library { display: none; }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--text-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}
.sidebar__brand { display: flex; align-items: center; gap: 9px; height: 55px; flex: none; padding: 0 14px; border-bottom: 1px solid var(--border); }
.sidebar__brand .dot { width: 32px; height: 32px; border-radius: 7px; object-fit: cover; flex: none; background: #fff; }
.sidebar__brand strong { font-size: 16px; letter-spacing: .03em; }
.sidebar small { display: block; color: var(--text-tertiary); font-size: 11px; line-height: 1.45; }
.sidebar__nav { flex: 1; min-height: 0; overflow: auto; padding: 8px 8px 12px; }
.nav-group + .nav-group { margin-top: 8px; }
.nav-group__label { color: var(--text-tertiary); font-size: 11px; padding: 7px 10px 4px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  min-height: 33px;
  margin: 1px 0;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}
.nav-item:hover { background: var(--subtle); color: var(--text-primary); }
.nav-item .icon { width: 16px; height: 16px; }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 650; }
.nav-item.active .icon { color: var(--primary); }
.badge-count { margin-left: auto; min-width: 20px; padding: 0 5px; border-radius: 4px; text-align: center; font-size: 11px; background: var(--warning-light); color: var(--warning); font-variant-numeric: tabular-nums; }
.sidebar__footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding: 11px 13px; }
.sidebar__admin { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13px; }
.sidebar__admin > div { min-width: 0; }
.sidebar__admin strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__admin .avatar { display: grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 7px; background: var(--primary-light); color: var(--primary-dark); font-weight: 650; }
.sidebar-logout { display: grid; place-items: center; color: var(--text-secondary); background: none; border: 0; border-radius: 6px; padding: 6px; cursor: pointer; }
.sidebar-logout:hover { color: var(--primary-dark); background: var(--primary-light); }
.sidebar-scrim, .menu-toggle { display: none; }
.main { flex: 1; min-width: 0; }
.main__header { display: flex; align-items: center; gap: 12px; height: 55px; padding: 9px 22px; position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13px; color: var(--text-tertiary); white-space: nowrap; }
.breadcrumb__divider { color: #8290a4; }
.breadcrumb strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); font-weight: 650; }
.header-date { margin-left: auto; display: flex; flex: none; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.main__body { max-width: 1680px; margin: 0 auto; padding: 23px 29px 50px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 19px; }
.page-heading h1 { margin: 0; font-size: 27px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; }
.page-heading p { margin: 5px 0 0; color: var(--text-secondary); font-size: 13px; }
.overview-refresh { display: inline-flex; align-items: center; gap: 6px; margin: 0; flex: none; }
.panel { display: none; }
.panel.active { display: block; }

/* 经营概览 */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 15px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.overview-loading { grid-column: 1 / -1; padding: 21px; color: var(--text-tertiary); }
.stat-card { min-width: 0; padding: 15px 18px; }
.stat-card + .stat-card { border-left: 1px solid var(--border); }
.stat-card .label { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.stat-card .value { margin: 4px 0; color: var(--text-primary); font-size: clamp(21px, 2.2vw, 30px); line-height: 1.18; font-weight: 680; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card:first-child .value { color: var(--primary-dark); }
.stat-card .unit { color: var(--text-tertiary); font-size: 12px; margin-left: 3px; letter-spacing: 0; }
.stat-card .meta { color: var(--text-tertiary); font-size: 11px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 15px; margin-bottom: 15px; }
.overview-grid .section { margin: 0; min-width: 0; }
.overview-grid .section__head { margin-bottom: 12px; }
.period-label { font-size: 11px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.chart-readout { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; margin-bottom: 12px; color: var(--text-tertiary); font-size: 12px; min-height: 27px; }
.chart-readout strong { color: var(--text-primary); font-weight: 680; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.chart-frame { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; }
.chart-scale { height: 123px; display: flex; flex-direction: column; justify-content: space-between; color: var(--text-tertiary); text-align: right; font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-plot { min-width: 0; }
.chart-bars { height: 123px; position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: stretch; border-bottom: 1px solid var(--border); }
.chart-lines { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-lines i { border-top: 1px dashed var(--border); }
.chart-day { border: 0; position: relative; display: flex; justify-content: center; align-items: flex-end; background: transparent; cursor: pointer; padding: 0; min-width: 0; }
.chart-day:hover { background: rgba(22, 119, 255, .055); }
.chart-day i { display: block; width: 52%; max-width: 33px; min-height: 2px; height: var(--bar-height); background: #a8cdfb; border-radius: 3px 3px 0 0; }
.chart-day[aria-pressed=true] i, .chart-day:hover i { background: var(--primary); }
.chart-dates { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding-top: 5px; text-align: center; color: var(--text-tertiary); font-size: 10px; font-variant-numeric: tabular-nums; }
.task-list { border-top: 1px solid var(--border); }
.task-row { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto 14px; align-items: center; gap: 8px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 12px 0; color: var(--text-primary); cursor: pointer; }
.task-row:hover { background: var(--row-hover); }
.task-row strong { display: block; font-size: 13px; font-weight: 650; }
.task-row small { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 11px; }
.task-row .task-icon { width: 30px; height: 30px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); border-radius: 6px; }
.task-row .task-count { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.task-row .task-arrow { width: 14px; color: var(--text-tertiary); }
.overview-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 12px; }
.overview-totals strong { display: block; margin-top: 2px; color: var(--text-primary); font-size: 17px; font-variant-numeric: tabular-nums; }
.overview-services { margin-bottom: 0; }
.status-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 9px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; min-width: 0; }
.status-row .name { font-size: 13px; font-weight: 650; }
.status-row .desc { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; overflow-wrap: anywhere; }
.status-row .badge { flex: none; }

/* 列表和详情 */
.work-tabs { position: sticky; top: 55px; z-index: 5; height: 44px; display: flex; align-items: flex-end; gap: 4px; padding: 0 15px; overflow: auto hidden; scrollbar-width: none; background: var(--card); border-bottom: 1px solid var(--border); }
.work-tabs::-webkit-scrollbar { display: none; }
.work-tab { flex: none; display: flex; align-items: center; min-height: 35px; padding: 0 4px; border-radius: 7px 7px 0 0; color: var(--text-secondary); }
.work-tab.active { color: var(--primary-dark); background: var(--primary-light); }
.work-tab button { display: grid; place-items: center; border: 0; border-radius: 4px; background: none; color: inherit; padding: 6px 9px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.work-tab button:hover { background: var(--subtle); }
.work-tab .work-tab-close { padding: 2px 7px; font-size: 16px; margin-right: 2px; }
.list-view .main__body { max-width: none; padding: 12px 13px 14px; }
.list-view .page-heading { display: none; }
.list-search { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.list-search summary { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 13px; cursor: pointer; border-radius: var(--radius); font-size: 13px; font-weight: 600; list-style: none; }
.list-search summary::-webkit-details-marker { display: none; }
.list-search summary::before { content: ""; flex: none; width: 6px; height: 6px; border: solid var(--text-secondary); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.list-search[open] summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.list-search[open] summary::before { transform: translateY(-2px) rotate(45deg); }
.list-section { padding: 10px 12px; margin-bottom: 0; isolation: isolate; }
.list-section .section__head { flex-wrap: wrap; gap: 5px 12px; margin-bottom: 8px; }
.list-section .section__head h2 { flex: 1 1 auto; font-size: 15px; }
.list-section .section__head .section__hint { order: 1; flex-basis: 100%; }
.list-section .list-option { margin: 0 0 6px; }
.list-refresh { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.list-refresh .icon { width: 14px; height: 14px; }
.list-section .table-wrap { border: 1px solid var(--border); border-radius: 6px; max-height: none; scrollbar-gutter: auto; }
.list-section .table-wrap :is(th, td) { padding: 4px 9px; vertical-align: middle; }
.list-section .table-wrap th { height: 35px; color: var(--text-primary); }
.list-section .table-wrap td { height: 44px; font-variant-numeric: tabular-nums; }
.list-section .table-wrap tbody tr:last-child td { border-bottom: 0; }
.list-section .table-wrap .row-number { width: 45px; min-width: 45px; border-right: 0; color: var(--text-secondary); }
.list-section .table-wrap :is(.fixed-action, .product-actions, .withdraw-actions) { position: sticky; right: 0; background: var(--card); z-index: 1; border-left: 1px solid var(--border); box-shadow: -4px 0 7px -7px #5d7190; white-space: nowrap; }
.list-section .table-wrap th:is(.fixed-action, .withdraw-actions) { z-index: 3; background: var(--subtle); }
.list-section .table-wrap tr:hover td:is(.fixed-action, .product-actions, .withdraw-actions) { background: var(--row-hover); }
.order-table .fixed-action { width: 76px; text-align: center; }
.list-section .badge { border: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.list-toolbar { margin: 0; padding: 12px 15px 14px; gap: 10px; }
.list-toolbar .field { min-width: 112px; }
.list-toolbar .search-field { flex: 2.2 1 230px; }
.list-footer { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 10px; }
.list-footer .list-pager { margin-left: auto; }
.list-footer .list-help { margin: 8px 0 0; }
.list-footer .list-help[open] { flex-basis: 100%; }
.list-pager { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 9px; font-size: 12px; color: var(--text-secondary); }
.list-pager > span:first-child { margin-right: 6px; }
.list-pager button { min-width: 28px; height: 28px; border: 1px solid var(--control-border); background: var(--card); color: var(--text-primary); border-radius: 5px; padding: 0 6px; font: inherit; cursor: pointer; }
.pager-size { white-space: nowrap; padding: 3px 7px; background: var(--subtle); border: 1px solid var(--border); border-radius: 5px; }
.list-pager button:hover:not(:disabled), .list-pager button[aria-current="page"] { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.list-pager button:disabled { cursor: default; background: var(--subtle); color: #8995a6; }
.pager-gap { padding: 0 3px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; padding: 12px 0 0; border-top: 1px solid var(--border); }
.detail-actions .btn { margin: 0; white-space: normal; }
.list-help { margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.list-help summary { cursor: pointer; width: fit-content; }
.list-help p { margin: 6px 0 0; }
.table-link { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; border-radius: 3px; color: var(--primary-dark); padding: 0; cursor: pointer; font-size: 12px; font-weight: 650; text-align: left; }
.table-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.table-link .icon { width: 14px; height: 14px; }
.cell-ellipsis { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.log-summary { max-width: clamp(140px, 32vw, 560px); }
.row-more { margin: 0 0 0 5px; }
.row-menu { position: fixed; z-index: 14; min-width: 126px; padding: 4px; border: 1px solid var(--border); border-radius: 7px; box-shadow: var(--shadow); background: var(--card); }
.row-menu button { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 4px; background: none; color: var(--text-primary); text-align: left; cursor: pointer; }
.row-menu button:hover { background: var(--subtle); }
.row-menu button.row-menu-danger { color: var(--danger); }
.table-id { font-family: ui-monospace, Consolas, monospace; font-size: 12px; letter-spacing: -.015em; overflow-wrap: anywhere; }
.detail-actions .btn-danger, .withdraw-actions .btn-danger, .product-actions .btn-danger { background: var(--card); color: var(--danger); border-color: #edd2ce; }
.detail-actions .btn-danger:hover, .withdraw-actions .btn-danger:hover, .product-actions .btn-danger:hover { background: var(--danger-light); }
.withdraw-table { table-layout: fixed; min-width: 812px; }
.withdraw-table td { white-space: normal; overflow-wrap: anywhere; }
.withdraw-table .withdraw-actions { white-space: nowrap; }
.withdraw-table .withdraw-actions .btn { margin-right: 4px; }
.table-wrap th.withdraw-actions { background: var(--subtle); }
.table-meta { margin-top: 3px; color: var(--text-tertiary); font-size: 11px; overflow-wrap: anywhere; }
.table-amount { font-weight: 650; }
#order-detail-modal, #withdraw-review-modal, #user-detail-modal { justify-content: flex-end; align-items: stretch; padding: 0; }
#order-detail-modal .modal-box, #withdraw-review-modal .modal-box, #user-detail-modal .modal-box { max-height: 100%; border-radius: 0; padding: 22px; }
#withdraw-review-modal .modal-box, #user-detail-modal .modal-box { max-width: min(1050px, 100vw); }
#order-detail-modal .modal-box { max-width: min(640px, 100vw); }
#withdraw-review-modal .modal-box__head, #order-detail-modal .modal-box__head, #user-detail-modal .modal-box__head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
#reason-modal, #risk-modal { z-index: 1002; }
.user-detail-identity strong { margin-right: 4px; }
.user-detail-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.user-detail-tabs .btn { margin: 0; }
.user-detail-tabs .active { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-light); }
.user-detail-table { max-height: 58dvh; border: 1px solid var(--border); border-radius: 6px; }
.withdraw-review-summary div { background: var(--subtle); }
.withdraw-review-order { color: var(--primary-dark); }
.withdraw-review-table { max-height: 54dvh; }

/* 桌面列表把剩余高度留给表格和页码。按表格可用空间平分十行，过短窗口保留内部滚动。 */
@media (min-width: 861px) and (min-height: 600px) {
  .list-view .main { display: flex; flex-direction: column; height: 100dvh; }
  .list-view :is(.main__header, .work-tabs) { flex: none; }
  .list-view .main__body { display: flex; flex: 1; min-height: 0; margin: 0; }
  .list-view .panel.active { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
  .list-view .list-search { flex: none; position: relative; z-index: 4; }
  .list-view .list-search[open] .list-toolbar {
    position: absolute; inset: 100% -1px auto; background: var(--card);
    border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow);
  }
  .list-view .list-section { display: flex; flex: 1; flex-direction: column; min-height: 0; }
  .list-view .list-section > :not(.table-wrap) { flex: none; }
  .list-view .list-section > .table-wrap { flex: 1; min-height: 0; container-type: size; }
  .list-section .table-wrap > table { --table-row: clamp(32px, calc((100cqh - 36px) / 10), 54px); }
  .list-section .table-wrap td { height: var(--table-row); padding-block: 2px; }
  .list-section .table-wrap .table-meta { margin-top: 0; line-height: 1.3; }
}

@media (min-width: 861px) and (max-width: 1330px) {
  .list-section .order-table :is(th, td) { padding-inline: 8px; }
}

@media (min-width: 861px) and (max-height: 720px) {
  .list-view :is(.main__header, .sidebar__brand) { height: 47px; }
  .list-view .work-tabs { top: 47px; height: 37px; }
  .list-view .work-tab { min-height: 31px; }
  .list-view .main__body { padding-block: 8px 10px; }
  .list-view .list-search { margin-bottom: 8px; }
  .list-view .list-search summary { min-height: 34px; padding-block: 5px; }
  .list-view .list-section { padding-block: 8px; }
  .list-view .list-section .section__head { margin-bottom: 6px; }
  .list-view .list-section .table-wrap td { padding-block: 1px; line-height: 1.25; }
  .list-view .list-section .table-meta { line-height: 1.2; }
  .list-view .list-pager { padding-top: 7px; }
  .list-view .list-pager button { height: 26px; }
}

@media (max-width: 1100px) {
  .main__body, .main__header { padding-left: 20px; padding-right: 20px; }
  .stat-card { padding-left: 13px; padding-right: 13px; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 21; visibility: hidden; transform: translateX(-100%); transition: transform .2s, visibility .2s; }
  .sidebar.open { visibility: visible; transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 20; border: 0; background: rgba(23, 40, 64, .38); }
  .menu-toggle { display: inline-flex; padding: 5px; margin: 0; }
  .main__body { padding: 17px 13px 40px; }
  .main__header { padding: 8px 13px; }
  .page-heading h1 { font-size: 23px; }
}
@media (max-width: 620px) {
  .section { padding: 14px; }
  .list-view .main__body { padding: 10px 8px 24px; }
  .list-section { padding: 10px; }
  .list-section .section__head h2 { min-width: 0; }
  .work-tabs { padding-inline: 8px; }
  .section__head { flex-wrap: wrap; }
  .overview-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card:nth-child(3) { border-left: 0; }
  .stat-card:nth-child(n+3) { border-top: 1px solid var(--border); }
  .page-heading p { font-size: 12px; }
  .overview-refresh { font-size: 12px; padding: 6px 8px; }
  .overview-refresh .icon { width: 14px; height: 14px; }
  #order-detail-modal .modal-box, #withdraw-review-modal .modal-box, #user-detail-modal .modal-box { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* 登录 */
.login-page { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; height: auto; padding: 22px; }
.login-layout { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1fr); width: min(780px, 100%); min-height: 438px; border-radius: 13px; overflow: hidden; border: 1px solid var(--border); background: var(--card); }
.login-brand { background: var(--primary-light); color: var(--text-primary); padding: 31px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.login-brand__identity { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.login-brand__identity img { width: 36px; height: 36px; border-radius: 8px; background: #fff; }
.login-brand__rule { width: 26px; border-top: 2px solid var(--primary); margin-bottom: 14px; }
.login-brand__copy strong { font-size: 31px; font-weight: 680; letter-spacing: -.02em; }
.login-brand__copy p { margin: 6px 0 0; color: var(--text-secondary); }
.login-brand__footer { color: var(--text-tertiary); font-size: 12px; }
.login-card { align-self: center; padding: 31px 38px; }
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.login-card .sub { color: var(--text-secondary); margin: 4px 0 23px; }
.login-card label { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.login-card input { width: 100%; border: 1px solid var(--control-border); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; background: var(--card); }
.login-card .btn { margin: 3px 0 0; padding: 10px 12px; }
.login-hint { color: var(--text-tertiary); margin-top: 10px; font-size: 12px; line-height: 1.65; }
.login-hint.error { color: var(--danger); }
.login-hint:empty { display: none; }
@media (max-width: 600px) {
  .login-layout { max-width: 415px; grid-template-columns: 1fr; }
  .login-brand { padding: 17px 22px; }
  .login-brand__copy, .login-brand__footer { display: none; }
  .login-card { padding: 23px 22px 29px; }
}

/* 表单与筛选 */
.list-toolbar input, .list-toolbar select, .filter-actions .btn { height: 36px; }
.filter-actions { display: flex; align-items: center; gap: 7px; }
.filter-actions .btn { margin: 0; min-width: 58px; }
#order-filter-form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
#order-filter-form .field { min-width: 0; }
#order-filter-form .search-field { grid-column: 1 / 4; grid-row: 1; }
#order-filter-form .order-trade-field { grid-column: 4 / -1; grid-row: 1; }
#order-filter-form .filter-actions { grid-column: 4 / -1; justify-self: end; }

.modal-box.product-editor { padding: 0; max-width: 610px; display: flex; flex-direction: column; overflow: hidden; }
.product-editor .modal-box__head { padding: 17px 22px 13px; margin: 0; border-bottom: 1px solid var(--border); }
.product-editor .modal-box__head p { margin: 4px 0 0; overflow-wrap: anywhere; }
.product-editor__body { min-height: 0; overflow: auto; padding: 17px 22px; }
.edit-group { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.edit-group legend { font-weight: 650; padding: 0; margin-bottom: 10px; }
.product-authorization { margin: 15px 0 0; }
.product-authorization .switch-row { margin-bottom: 4px; }
.product-authorization .field-help { margin: 0; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.edit-grid .field input { display: block; width: 100%; min-width: 0; height: 38px; }
.amount-control { position: relative; }
.amount-control > span { position: absolute; top: 8px; left: 11px; color: var(--text-secondary); pointer-events: none; }
.amount-control > input { padding: 8px 10px 8px 27px; border: 1px solid var(--control-border); border-radius: 6px; font-size: 13px; }
.field-help, .field-error { font-size: 12px; margin: 4px 0 0; line-height: 1.55; }
.field-help { color: var(--text-tertiary); }
.field-error { color: var(--danger); }
.product-editor input[aria-invalid=true] { border-color: var(--danger); background: var(--danger-light); }
.product-editor .modal-box__actions { margin: 0; align-items: center; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--border); }
.product-editor .modal-box__actions .btn { margin: 0; }
.editor-message { flex: 1 0 100%; }
.editor-details { background: var(--subtle); padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.editor-details summary { color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.editor-details .hint { margin-top: 7px; }

.settings-nav { position: sticky; top: 99px; z-index: 4; display: flex; gap: 4px; overflow-x: auto; background: var(--bg); padding: 6px 0 10px; margin-bottom: 6px; }
.settings-nav button { flex: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; background: var(--card); color: var(--text-secondary); cursor: pointer; }
.settings-nav button:hover { background: var(--primary-light); color: var(--primary-dark); }
.settings-group { scroll-margin-top: 150px; }
.settings-group .section__head { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 15px; }
.settings-group .form-row { align-items: flex-start; gap: 12px; }
.settings-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 15px; padding-top: 11px; border-top: 1px solid var(--border); }
.settings-actions .btn { margin: 0; }
.settings-actions--split { justify-content: space-between; }
.settings-group .table-wrap { border: 1px solid var(--border); border-radius: 7px; }
.settings-group td input { padding: 7px 9px; border: 1px solid var(--control-border); border-radius: 6px; font-size: 13px; }

@media (max-width: 620px) {
  #order-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #order-filter-form .search-field, #order-filter-form .order-trade-field, #order-filter-form .filter-actions { grid-column: 1 / -1; grid-row: auto; }
  .settings-group .form-row .field { flex-basis: 100%; }
  .modal-box.product-editor { max-height: min(90vh, 90dvh); }
}
@media (max-width: 420px) {
  .edit-grid { grid-template-columns: 1fr; }
  .product-editor__body, .product-editor .modal-box__head, .product-editor .modal-box__actions { padding-left: 15px; padding-right: 15px; }
}

@media (max-width: 620px) {
  body:has(.sidebar.open) { overflow: hidden; }
  .sidebar { width: min(280px, 85vw); }
  .nav-item, .menu-toggle, .sidebar-logout { min-height: 44px; }
  .menu-toggle, .sidebar-logout { min-width: 44px; justify-content: center; }
  .login-layout { min-height: 0; }
  .login-card .btn { min-height: 44px; }
  .login-card input, .field > input:not([type=checkbox]), .field > select, .field > textarea, .form-row textarea { font-size: 16px; }
  .list-toolbar input, .list-toolbar select, .filter-actions .btn { height: 44px; }
  .list-toolbar input[type=date] { min-width: 0; max-width: 100%; }
  .list-pager button { min-width: 42px; min-height: 42px; }
  .list-refresh, .detail-actions .btn, .modal-box__actions .btn, .user-detail-tabs .btn { min-height: 44px; }
  .modal-overlay { padding: 10px; }
  .modal-box { max-height: 92dvh; padding: 16px; }
  .modal-box__close { min-width: 44px; min-height: 44px; }
  .modal-box__actions { flex-wrap: wrap; }
  .order-detail-grid { grid-template-columns: minmax(76px, 30%) minmax(0, 1fr); gap: 8px; }
  .user-detail-identity, .withdraw-review-alerts { overflow-wrap: anywhere; }

  .table-wrap:has(> .mobile-card-table) {
    overflow: visible;
    max-height: none;
    border: 0;
  }
  .mobile-card-table, .mobile-card-table tbody { display: block; min-width: 0; }
  .mobile-card-table colgroup { display: none; }
  .mobile-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .mobile-card-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
  }
  .table-wrap .mobile-card-table td {
    position: static;
    width: auto;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table-wrap .mobile-card-table td:is(.fixed-action, .product-actions, .withdraw-actions) {
    grid-column: 1 / -1;
    position: static;
    border: 0;
    border-top: 1px solid var(--border);
    padding-top: 6px;
    background: none;
    box-shadow: none;
    white-space: normal;
  }
  .mobile-card-table :is(.cell-truncate, .cell-ellipsis) {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .mobile-card-table .mobile-cell-label {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    color: var(--text-tertiary);
  }
  .mobile-card-table .mobile-cell-label:empty { display: none; }
  .mobile-card-table :is(.btn, .table-link, .withdraw-review-order) {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
  }
  .mobile-card-table .btn { margin: 3px 4px 0 0; }
}
