/* ============================================================
   组件层：iOS 玻璃材质
   ============================================================ */

/* ============ 按钮（胶囊 / 填充，无边框） ============ */
.btn {
  --btn-bg: var(--fill);
  --btn-fg: var(--label);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 18px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: none; border-radius: var(--r-pill);
  font-size: var(--fs-md); font-weight: 590; white-space: nowrap;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease),
              opacity var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }

.btn-primary { --btn-bg: var(--blue); --btn-fg: #fff; }
.btn-primary:hover { --btn-bg: var(--blue-press); }

.btn-ink { --btn-bg: var(--label); --btn-fg: #fff; }
.btn-ink:hover { --btn-bg: #000; }

.btn-quiet { --btn-bg: transparent; --btn-fg: var(--label-2); }
.btn-quiet:hover { --btn-bg: var(--fill); }

.btn-link { --btn-bg: transparent; --btn-fg: var(--blue); padding: 8px 10px; }
.btn-link:hover { --btn-bg: var(--blue-soft); }

/* 危险操作不做大面积填色，白底红字 + 细红边 */
.btn-danger {
  --btn-bg: rgba(255, 255, 255, .62);
  --btn-fg: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, .22);
}
.btn-danger:hover { --btn-bg: rgba(255, 59, 48, .08); }

.btn-ok { --btn-bg: var(--green-soft); --btn-fg: var(--green); }
.btn-ok:hover { --btn-bg: rgba(52, 199, 89, .22); }

.btn-lg { min-height: var(--tap); padding: 11px 24px; font-size: var(--fs-lg); }
.btn-sm { min-height: 30px; padding: 4px 12px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn-icon { min-width: 38px; padding: 8px; }

.btn-checkout {
  min-height: 50px; font-size: var(--fs-lg); font-weight: 650;
  border-radius: var(--r-pill); letter-spacing: -.01em;
}

/* ============ 玻璃卡片 ============ */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-bright);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
/* 已经在 flex/grid 间隙里排好的卡片不再重复留白 */
.two-col > .card, .stack > .card { margin-bottom: 0; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card { background: rgba(255, 255, 255, .94); }
}
.card-pad { padding: 18px 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px 10px;
}
.card-head h2, .card-head h3 {
  font-size: var(--fs-md); font-weight: 640; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 7px;
}
.card-head h3 svg { color: var(--label-3); }
.card-head .hint { font-size: var(--fs-sm); color: var(--label-3); font-weight: 400; }
.card-body { padding: 8px 16px 18px; }
.card-foot {
  padding: 12px 16px; border-top: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .28); border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.section-title {
  font-size: var(--fs-sm); font-weight: 620; color: var(--label-3);
  letter-spacing: .01em; margin: 0 0 8px 2px;
}

/* 收据卡：改成干净的 iOS 分组卡，去掉撕边 */
.receipt {
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
}
.receipt-inner { padding: 18px 16px 14px; }

/* 发丝分隔线（保留类名，视觉换成实线） */
.rule-dashed {
  border: none; border-top: 1px solid var(--stroke); margin: 12px 0;
}

/* ============ 标签 / 状态 ============ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap; line-height: 1.5;
}
.tag-gray   { background: var(--fill); color: var(--label-2); }
.tag-ok     { background: var(--green-soft); color: var(--green); }
.tag-warn   { background: var(--fill); color: var(--amber); }
.tag-danger { background: var(--red-soft); color: var(--red); }
.tag-info   { background: var(--teal-soft); color: var(--teal); }
.tag-brand  { background: var(--blue-soft); color: var(--blue); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.badge-demo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--fill); color: var(--label-3);
  font-size: var(--fs-xs); font-weight: 550;
}
/* 同步出问题时才变色，正常状态保持低调 */
.badge-demo.badge-bad {
  background: var(--amber-soft); color: var(--amber);
}

/* 计数徽标用主色蓝，红色只留给真正的错误 */
.count-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--blue); color: #fff;
  font-size: 10.5px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ============ 输入控件 ============ */
.field { display: block; margin-bottom: 18px; }
.field > label, .field-label {
  display: block; font-size: var(--fs-sm); color: var(--label-2);
  margin-bottom: 6px; font-weight: 550;
}
.input, .select, .textarea {
  width: 100%; min-height: 44px;
  padding: 10px 14px;
  background: var(--glass-input);
  color: var(--label);
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  font-size: 16px; /* ≥16px 防止 iOS 聚焦放大 */
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
  appearance: none;
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--label-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3.5px var(--blue-soft);
  background: rgba(255, 255, 255, .95);
}
.input:disabled, .select:disabled {
  background: var(--fill); color: var(--label-3); cursor: not-allowed;
}
.input-mono, .input-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.input-right { text-align: right; }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2386868B' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 34px; cursor: pointer;
}

.input-search { position: relative; }
.input-search .input { padding-left: 40px; border-radius: var(--r-sm); }
.input-search > svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--label-3); pointer-events: none; z-index: 1;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 460px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}
.field-hint { font-size: var(--fs-xs); color: var(--label-3); margin-top: 5px; line-height: 1.45; }

/* 商品图上传：拍照 / 相册 */
.prod-photo-row { display: flex; align-items: flex-start; gap: 12px; }
.prod-photo-box {
  position: relative; width: 96px; height: 96px; flex: none; padding: 0;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--stroke);
  background: #fff; display: flex; align-items: center; justify-content: center; color: var(--label-3);
}
.prod-photo-box.is-empty { border-style: dashed; border-color: var(--stroke-strong); background: rgba(255,255,255,.52); color: var(--blue); }
.prod-photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prod-photo-empty { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: var(--fs-xs); }
.prod-photo-empty em { font-style: normal; }
.prod-photo-busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(255,255,255,.9); font-size: var(--fs-xs); color: var(--label-3);
}
.prod-photo-busy .spinner { width: 13px; height: 13px; border-color: rgba(10,132,255,.22); border-top-color: var(--blue); }
.prod-photo-info { flex: 1; min-width: 0; padding-top: 2px; }
@media (max-width: 520px) { .prod-photo-box { width: 84px; height: 84px; } }
.field-err  { font-size: var(--fs-sm); color: var(--red); margin-top: 6px; min-height: 18px; }

/* ============ Chips（胶囊，两级选中） ============ */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-scroll {
  display: flex; gap: 8px; overflow-x: auto; flex-wrap: nowrap;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px; margin-bottom: -2px;
}
.chips-scroll::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 33px; padding: 6px 14px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--fill); color: var(--label-2);
  font-size: var(--fs-sm); font-weight: 550; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { background: var(--fill-2); color: var(--label); }
/* 默认选中只做轻微染色；主动筛选才实心蓝 */
.chip[aria-pressed="true"] {
  background: var(--blue-soft); color: var(--blue); font-weight: 620;
}
.chip.is-on {
  background: var(--blue); color: #fff; font-weight: 620;
}
.chip-brand[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); }
.chip-brand.is-on { background: var(--blue); color: #fff; }
.chip-lg { min-height: var(--tap); padding: 10px 20px; font-size: var(--fs-md); }
.chip-count {
  font-size: var(--fs-xs); opacity: .6; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* iOS 分段控件 */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--fill); border-radius: var(--r-sm);
  margin-bottom: 14px;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 18px; border-radius: 9px;
  font-size: var(--fs-sm); font-weight: 550; color: var(--label-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.seg-btn .mono { font-size: var(--fs-xs); opacity: .55; }
.seg-btn.is-on {
  background: #fff; color: var(--label); font-weight: 620;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 0 0 .5px rgba(0, 0, 0, .04);
}

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { font-size: var(--fs-md); }
.tbl th {
  text-align: left; padding: 8px 10px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--label-3);
  border-bottom: 1px solid var(--stroke); white-space: nowrap;
  background: transparent;
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-compact td, .tbl-compact th { padding: 7px 9px; }

/* ============ 列表行 ============ */
.lrow {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 0; border-bottom: 1px solid var(--stroke);
}
.lrow:last-child { border-bottom: none; }
.lrow-main { flex: 1; min-width: 0; }
.lrow-title { font-size: var(--fs-md); font-weight: 550; }
.lrow-sub { font-size: var(--fs-sm); color: var(--label-3); margin-top: 1px; }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 38px 18px; color: var(--label-3); }
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto 12px;
  border-radius: 14px; background: var(--fill);
  display: flex; align-items: center; justify-content: center; color: var(--label-3);
}
.empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--label-2); margin-bottom: 3px; }
.empty-text { font-size: var(--fs-sm); max-width: 300px; margin: 0 auto; line-height: 1.55; }
.empty .btn { margin-top: 16px; }

.loading-block { text-align: center; padding: 38px 16px; color: var(--label-3); font-size: var(--fs-sm); }

/* ============ 弹层：iOS 玻璃抽屉 ============ */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in var(--dur) var(--ease);
}
.sheet {
  width: 100%; max-width: 540px;
  max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-bright);
  border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh-pop);
  animation: sheet-up .32s var(--ease);
  overflow: hidden;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sheet { background: rgba(255, 255, 255, .97); }
}
/* 中宽抽屉：套餐配置等需要一行多字段的弹窗 */
.sheet-medium { max-width: 760px; }
.sheet-medium .sheet-body { padding: 10px 20px 20px; }
/* 宽版抽屉：iPad / 桌面用来放三栏分类 */
.sheet-wide { max-width: 900px; }
.sheet-wide .sheet-body { padding: 10px 22px 22px; }
/* 超宽抽屉：批量导入的在线表格 */
.sheet-xwide { max-width: 1120px; }
.sheet-xwide .sheet-body { padding: 10px 22px 22px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }

/* 商品大图预览 */
.image-viewer {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: rgba(7, 12, 20, .9);
  animation: fade-in var(--dur) var(--ease);
}
.image-viewer-close {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .14);
  transition: background var(--dur) var(--ease);
}
.image-viewer-close:hover { background: rgba(255, 255, 255, .24); }
.image-viewer-stage {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 94vw; max-height: calc(100dvh - 48px); margin: 0; user-select: none;
}
.image-viewer-stage img {
  display: block; width: auto; height: auto;
  max-width: min(94vw, 1200px); max-height: calc(100dvh - 120px);
  object-fit: contain; border-radius: 10px; background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.image-viewer-stage figcaption {
  max-width: 90vw; padding: 0 12px;
  color: rgba(255, 255, 255, .82); font-size: var(--fs-sm); text-align: center;
}
.image-viewer-error { color: rgba(255, 255, 255, .75); font-size: var(--fs-sm); }
@media (max-width: 680px) {
  .image-viewer { padding: 16px; }
  .image-viewer-close { top: max(10px, env(safe-area-inset-top)); right: 12px; }
  .image-viewer-stage img { max-height: calc(100dvh - 96px); }
}

.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 12px; flex: none;
}
.sheet-head h2 { font-size: var(--fs-lg); font-weight: 650; flex: 1; letter-spacing: -.015em; }
.sheet-grab {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 5px; border-radius: var(--r-pill);
  background: var(--stroke-strong);
}
.sheet-body { padding: 10px 18px 20px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .34);
  display: flex; gap: 10px; flex: none;
}
.sheet-foot .btn { flex: 1; }

@media (min-width: 680px) {
  .sheet-mask { align-items: center; padding: 24px; }
  .sheet { border-radius: var(--r-xl); border-bottom: 1px solid var(--stroke-bright); max-height: 86vh; }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 16px; }
  .sheet-foot { padding-bottom: 14px; }
}

/* ============ Toast ============ */
.toast-layer {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top));
  transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-pill);
  background: rgba(16, 38, 66, .86);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  color: #fff; font-size: var(--fs-md); font-weight: 550;
  box-shadow: var(--sh-2);
  animation: toast-in .24s var(--ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-warn { background: rgba(215, 0, 21, .92); }
.toast-ok   { background: rgba(36, 138, 61, .92); }
.toast svg { flex: none; }

/* ============ 外壳 ============ */
.shell { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 10px;
  padding-left: 16px; padding-right: 16px;
  background: var(--glass-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  backdrop-filter: var(--blur-chrome);
  border-bottom: 1px solid var(--stroke);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.02em;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(160deg, #5FB2FF 0%, var(--blue) 55%, var(--blue-deep) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(10, 132, 255, .32), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.brand-sub { font-size: var(--fs-xs); color: var(--label-3); font-weight: 450; }

.content {
  flex: 1; width: 100%; max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}

.page-head { margin-bottom: 18px; }
.page-title {
  font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.028em; line-height: 1.15;
}
.page-sub { font-size: var(--fs-sm); color: var(--label-3); margin-top: 3px; }

/* 底部标签栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: var(--glass-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  backdrop-filter: var(--blur-chrome);
  border-top: 1px solid var(--stroke);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--label-3); font-size: 10px; font-weight: 500;
  position: relative; transition: color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--blue); font-weight: 600; }
.tab .count-badge { position: absolute; top: 6px; right: calc(50% - 22px); }

/* 侧栏 */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 35;
  width: var(--sidebar-w);
  display: none; flex-direction: column;
  background: var(--glass-chrome);
  -webkit-backdrop-filter: var(--blur-chrome);
  backdrop-filter: var(--blur-chrome);
  border-right: 1px solid var(--stroke);
  padding: 18px 12px calc(18px + env(safe-area-inset-bottom));
}
.side-brand { padding: 0 2px 12px; border-bottom: 1px solid var(--stroke); margin-bottom: 12px; text-align: center; }
.side-nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: var(--r-sm);
  color: var(--label-2); font-size: 13px; font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  text-align: left; width: 100%;
}
.side-link svg { width: 18px; height: 18px; flex: none; color: var(--label-3); transition: color var(--dur) var(--ease); }
.side-link:hover { background: var(--fill); color: var(--label); }
.side-link[aria-current="page"] {
  background: var(--blue-soft); color: var(--blue); font-weight: 600;
}
.side-link[aria-current="page"] svg { color: var(--blue); }
.side-link .count-badge { margin-left: auto; height: 16px; min-width: 16px; padding: 0 4px; font-size: 10px; }
.side-foot { padding-top: 10px; border-top: 1px solid var(--stroke); margin-top: 10px; text-align: center; }
.sidebar .brand { flex-direction: column; justify-content: center; gap: 5px; font-size: 12px; letter-spacing: -.01em; }
.sidebar .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.sidebar .side-brand-name { font-size: 12px; font-weight: 650; white-space: nowrap; }
.sidebar .brand-sub { margin-top: 2px; font-size: 10.5px; }
.sidebar .badge-demo { margin: 8px auto 0; padding: 2px 7px; font-size: 10.5px; }
.sidebar .side-foot .xs { font-size: 10.5px; }

@media (min-width: 900px) {
  .sidebar { display: flex; }
  .tabbar { display: none; }
  .topbar { display: none; }
  .shell { flex-direction: row; }
  .content {
    margin-left: var(--sidebar-w);
    padding: 30px 34px 70px;
    max-width: calc(var(--content-max) + var(--sidebar-w));
  }
}

/* ============ 统计卡 ============ */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke-bright);
  border-radius: var(--r-md); padding: 16px 16px 15px;
  box-shadow: var(--sh-1); position: relative; overflow: hidden;
}
.stat-label { font-size: var(--fs-xs); color: var(--label-3); font-weight: 550; letter-spacing: .01em; }
.stat-value {
  font-size: var(--fs-2xl); font-weight: 680; line-height: 1.18; margin-top: 5px;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.stat-foot { font-size: var(--fs-xs); color: var(--label-3); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat.is-click { cursor: pointer; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.stat.is-click:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
/* 去掉左侧色条，改用数值着色；主指标保持黑色，只让异常状态带色 */
.stat-accent .stat-value { color: var(--label); }
.stat-ok .stat-value     { color: var(--green); }
.stat-warn .stat-value   { color: var(--amber); }
.stat-danger .stat-value { color: var(--red); }

/* 巨号金额：蓝色渐变，作为全站唯一的大色块 */
.hero-amount {
  font-size: var(--fs-hero); font-weight: 700; line-height: 1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  background: linear-gradient(180deg, #4FA8FF 0%, var(--blue) 46%, var(--blue-deep) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--blue-deep);
}
.hero-amount .cur {
  font-size: .42em; font-weight: 600; margin-right: 3px; vertical-align: .2em;
  -webkit-text-fill-color: rgba(10, 132, 255, .45);
}
.hero-amount-zero,
.hero-amount-zero .cur {
  background: none; -webkit-text-fill-color: var(--label-4); color: var(--label-4);
}
.stat-unit { font-size: 14px; color: var(--label-3); font-weight: 500; margin-left: 3px; }

/* ============ 图表 / 排行 ============ */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 108px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; gap: 4px; }
.bar {
  width: 100%; max-width: 28px; border-radius: 6px;
  background: linear-gradient(180deg, #3395FF 0%, var(--blue) 100%);
  min-height: 2px; transition: height .4s var(--ease);
}
.bar.is-zero { background: var(--fill); }
.bar.is-today { background: linear-gradient(180deg, #2F8DFF 0%, var(--blue-deep) 100%); }
.bar-val { font-size: 9.5px; color: var(--label-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-lbl { font-size: 9.5px; color: var(--label-3); white-space: nowrap; }

.rank-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.rank-no {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  background: var(--fill); color: var(--label-3);
  font-size: 10.5px; font-weight: 650;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.rank-row:nth-child(1) .rank-no { background: var(--blue); color: #fff; }
.rank-row:nth-child(2) .rank-no { background: var(--blue-soft); color: var(--blue); }
.rank-row:nth-child(3) .rank-no { background: var(--blue-soft); color: var(--blue); }
.rank-name { flex: 1; min-width: 0; font-size: var(--fs-md); }
.rank-track { height: 5px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 4px; }
.rank-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blue), #5FB0FF); }
.rank-val { font-size: var(--fs-sm); color: var(--label-2); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.split-bar { display: flex; height: 12px; border-radius: var(--r-pill); overflow: hidden; background: var(--fill); gap: 2px; }
.split-seg { height: 100%; transition: width .4s var(--ease); }

/* ============ 步进器 ============ */
.stepper {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--fill); border-radius: var(--r-pill); padding: 2px;
}
.stepper button {
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; border: none; color: var(--label);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1; font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .10);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.stepper button:hover { background: #F2F2F7; }
.stepper button:active { transform: scale(.92); }
.stepper-val {
  min-width: 32px; text-align: center;
  font-size: var(--fs-md); font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ============ 开关 ============ */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 44px; height: 26px; border-radius: var(--r-pill);
  background: var(--fill-2); position: relative; flex: none;
  transition: background var(--dur) var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .16);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ============ 进度 ============ */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 提示条 ============ */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.divider { height: 1px; background: var(--stroke); margin: 12px 0; }
.pill-note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--fill); color: var(--label-2);
  font-size: var(--fs-sm); line-height: 1.5;
}
.pill-note svg { flex: none; margin-top: 1px; }
.pill-note-warn   { background: var(--amber-soft); color: var(--amber); }
.pill-note-danger {
  background: rgba(255, 255, 255, .55); color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, .18);
}
.pill-note-ok     { background: var(--green-soft); color: var(--green); }
.pill-note-info   { background: var(--blue-soft);  color: var(--blue); }

/* ============ 触屏输入防聚焦放大 ============ */
/* iOS Safari 在输入控件字号小于 16px 时，聚焦会把整页放大。
   手机/平板统一到 16px；桌面大屏保持原有紧凑字号。 */
@media (max-width: 1024px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
    touch-action: manipulation;
  }
}

/* 电脑端管理入口：扩展导航空间，复用现有业务页面。 */
@media (min-width: 900px) {
  .admin-shell { --sidebar-w: 200px; }
  .admin-shell .side-brand { text-align: left; padding: 4px 10px 18px; }
  .admin-shell .sidebar .brand { flex-direction: row; justify-content: flex-start; font-size: 15px; }
  .admin-shell .sidebar .side-brand-name { font-size: 15px; }
  .admin-shell .sidebar .brand-sub { margin: 7px 0 0 36px; font-size: 12px; }
  .admin-shell .sidebar .badge-demo { margin: 12px 0 0; }
  .admin-shell .side-nav { gap: 4px; }
  .admin-shell .side-link { padding: 11px 12px; font-size: 14px; }
  .admin-shell .side-foot { text-align: left; padding: 14px 10px 0; }
  .admin-shell .side-foot .btn { margin-bottom: 12px; }
}
