/* ==========================================================================
   易支付 UI · components.css
   ========================================================================== */

/* ---------- 图标 ---------- */
.ico {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico--sm { width: 15px; height: 15px; }
.ico--lg { width: 22px; height: 22px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink-2);
  background: transparent;
  transition: transform .16s var(--ease), background-color .18s, border-color .18s, color .18s, box-shadow .18s;
  will-change: transform;
  user-select: none;
}
.btn:active { transform: scale(.975); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn .ico { width: 16px; height: 16px; }

.btn--primary {
  color: #fff;
  background: var(--brand);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(58, 92, 245, .3);
}
.btn--primary:hover {
  background: var(--brand-600);
  transform: translate3d(0, -1px, 0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--sh-brand);
}

.btn--ghost {
  border-color: var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--sh-1);
}
.btn--ghost:hover { border-color: var(--ink-4); color: var(--ink); }

.btn--soft { background: var(--brand-50); color: var(--brand); }
.btn--soft:hover { background: var(--brand-100); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.94); transform: translate3d(0, -1px, 0); }

.btn--ghost-danger { color: var(--danger); border-color: var(--line-2); background: var(--surface); }
.btn--ghost-danger:hover { border-color: var(--danger); background: var(--danger-50); }

.btn--link { height: auto; padding: 0; color: var(--brand); font-weight: 600; }
.btn--link:hover { color: var(--brand-600); text-decoration: underline; text-underline-offset: 3px; }

.btn--sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn--sm .ico { width: 14px; height: 14px; }
.btn--lg { height: 46px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.btn--block { width: 100%; }

.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.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--ghost.is-loading::after { border-color: var(--line-2); border-top-color: var(--brand); }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--ink-3);
  transition: background-color .18s, color .18s, transform .18s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }

.dot-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}

/* 金额明细 */
.amount-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.amount-breakdown__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--ink-2);
}
.amount-breakdown__row b { font-variant-numeric: tabular-nums; }
.amount-breakdown__row--total {
  margin-top: 4px;
  padding-top: 9px;
  border-top: 1px dashed var(--line-2);
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
.amount-breakdown__row--total b { font-size: 17px; letter-spacing: -.02em; color: var(--brand); }

.rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.rate-row:first-child { padding-top: 0; }
.rate-row:last-child { padding-bottom: 0; border-bottom: 0; }
.rate-row .input { width: 132px; flex: none; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink-2);
  background: var(--surface-3);
}
.badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge--ok { color: var(--ok); background: var(--ok-50); }
.badge--warn { color: var(--warn); background: var(--warn-50); }
.badge--danger { color: var(--danger); background: var(--danger-50); }
.badge--info { color: var(--info); background: var(--info-50); }
.badge--brand { color: var(--brand); background: var(--brand-50); }
.badge--muted { color: var(--ink-3); background: var(--surface-3); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  border: 1px solid var(--line);
  background: var(--surface);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card__title { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card__sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

/* ---------- 数据卡 ---------- */
.stat {
  padding: 17px 19px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), border-color .24s;
}
.stat:hover { transform: translate3d(0, -2px, 0); box-shadow: var(--sh-2); border-color: var(--line-2); }
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat__label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.stat__ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--brand);
  background: var(--brand-50);
}
.stat__ico .ico { width: 16px; height: 16px; }
.stat__value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat__value .unit { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-right: 2px; }
.stat__value .unit:last-child { margin-right: 0; margin-left: 3px; }
.stat__foot { margin-top: 8px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; }
.delta--up { color: var(--ok); }
.delta--down { color: var(--danger); }
.delta--flat { color: var(--ink-3); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child { border-radius: 0; }
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-2);
}
.table tbody tr { transition: background-color .16s; animation: fadeIn .36s var(--ease) both; }
.table tbody tr:hover { background: var(--brand-50); }
.table tbody tr:hover td { color: var(--ink); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:nth-child(1) { animation-delay: 0ms; }
.table tbody tr:nth-child(2) { animation-delay: 18ms; }
.table tbody tr:nth-child(3) { animation-delay: 36ms; }
.table tbody tr:nth-child(4) { animation-delay: 54ms; }
.table tbody tr:nth-child(5) { animation-delay: 72ms; }
.table tbody tr:nth-child(6) { animation-delay: 90ms; }
.table tbody tr:nth-child(7) { animation-delay: 108ms; }
.table tbody tr:nth-child(8) { animation-delay: 126ms; }
.table tbody tr:nth-child(n+9) { animation-delay: 140ms; }

.table .cell-main { color: var(--ink); font-weight: 600; }
.table .cell-sub { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }
.table .t-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .t-amount { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.table .t-actions { text-align: right; white-space: nowrap; }
.table--compact td { padding: 9px 14px; }
.table--compact th { padding: 8px 14px; }

/* ---------- 空状态 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 56px 24px;
  text-align: center;
}
.empty__ico {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface-3);
  color: var(--ink-3);
  margin-bottom: 6px;
}
.empty__ico .ico { width: 24px; height: 24px; }
.empty__title { font-size: 14px; font-weight: 600; color: var(--ink); }
.empty__text { font-size: 12.5px; color: var(--ink-3); max-width: 300px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 4px; }
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: background-color .16s, color .16s;
}
.pager a:hover { background: var(--surface-3); color: var(--ink); }
.pager .is-active { background: var(--brand); color: #fff; font-weight: 600; }
.pager .is-disabled { opacity: .4; pointer-events: none; }
.pager .is-gap { pointer-events: none; color: var(--ink-4); }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.input--mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .01em; }

.search { position: relative; }
.search .ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.search .input { padding-left: 33px; }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; height: 38px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-2);
  transition: background-color .22s var(--ease);
  flex: none;
  position: relative;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(14, 21, 38, .28);
  transition: transform .22s var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translate3d(16px, 0, 0); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px var(--brand-ring); }

/* 复选 */
.check { display: inline-flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  flex: none;
}

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  padding: 10px 2px 12px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-3);
  transition: color .18s;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); font-weight: 650; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
  animation: fadeIn .25s var(--ease) both;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 10px;
}
.seg a, .seg button {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg .is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-1);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface);
  transition: all .18s;
}
.chip:hover { border-color: var(--ink-4); }
.chip.is-active { border-color: var(--brand); background: var(--brand-50); color: var(--brand); font-weight: 600; }

/* ---------- 抽屉 ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 14, 26, .38);
  opacity: 0;
  transition: opacity .26s var(--ease);
  backdrop-filter: blur(1.5px);
}
.drawer__panel {
  position: relative;
  width: min(440px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--sh-3);
  transform: translate3d(24px, 0, 0);
  opacity: 0;
  transition: transform .3s var(--ease), opacity .26s var(--ease);
}
.drawer.is-open { pointer-events: auto; }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; opacity: 1; }
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer__title { font-size: 15px; font-weight: 650; }
.drawer__body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}
.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 14, 26, .42);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .24s var(--ease);
}
.modal__panel {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  opacity: 0;
  transform: translate3d(0, 12px, 0) scale(.975);
  transition: opacity .24s var(--ease), transform .3s var(--ease);
}
.modal--lg .modal__panel,
.modal__panel.modal--lg { width: min(640px, 100%); }
.modal.is-open { pointer-events: auto; }
.modal.is-open .modal__scrim { opacity: 1; }
.modal.is-open .modal__panel { opacity: 1; transform: none; }
.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 14px;
}
.modal__title { font-size: 16px; font-weight: 650; letter-spacing: -.012em; }
.modal__sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.modal__body { padding: 6px 22px 20px; overflow-y: auto; }
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ---------- 轻提示 ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 200px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  font-size: 13px;
  color: var(--ink);
  animation: popIn .32s var(--ease) both;
  pointer-events: auto;
}
.toast .ico { width: 17px; height: 17px; }
.toast--ok .ico { color: var(--ok); }
.toast--err .ico { color: var(--danger); }
.toast.is-out { animation: fadeOut .22s var(--ease) forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translate3d(0, 6px, 0); } }

/* ---------- 提示条 ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.notice .ico { width: 16px; height: 16px; margin-top: 1px; color: var(--ink-3); }
.notice--warn { color: #8a5a12; background: var(--warn-50); border-color: transparent; }
.notice--warn .ico { color: var(--warn); }
.notice--brand { color: var(--brand-700); background: var(--brand-50); border-color: transparent; }
.notice--brand .ico { color: var(--brand); }
.notice--danger { color: var(--danger); background: var(--danger-50); border-color: transparent; }
.notice--danger .ico { color: var(--danger); }

/* ---------- 骨架屏 ---------- */
.skel {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 640px 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel--text { height: 11px; }
.skel--line { height: 8px; }

/* ---------- 图表 ---------- */
.chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 176px;
  padding: 6px 2px 24px;
}
.chart__col {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart__bar {
  width: 100%;
  max-width: 30px;
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--brand) 0%, #8498ff 100%);
  transform-origin: bottom center;
  animation: barGrow .7s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: filter .18s;
}
.chart__col:hover .chart__bar { filter: brightness(1.08); }
.chart__x {
  position: absolute;
  bottom: -21px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
@keyframes barGrow {
  from { transform: scaleY(.02); opacity: .35; }
  to   { transform: scaleY(1); opacity: 1; }
}
.chart__grid {
  position: absolute;
  inset: 0 0 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.chart__grid span { display: block; height: 1px; background: var(--line); opacity: .7; }

.spark { width: 100%; height: 34px; overflow: visible; }
.spark path { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 环形图 */
.donut {
  --p1: 45%;
  --p2: 75%;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: conic-gradient(var(--brand) 0 var(--p1), #8b9cff var(--p1) var(--p2), var(--surface-3) var(--p2) 100%);
  display: grid;
  place-items: center;
  flex: none;
}
.donut__hole {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
}

/* ---------- 代码块 ---------- */
.codeblock {
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
}
.codeblock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.codeblock__lang { font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.codeblock pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
  tab-size: 2;
}
.codeblock code { font-family: inherit; }
.codeblock .k { color: #a855f7; }
.codeblock .s { color: #0f9f6e; }
.codeblock .c { color: var(--ink-3); }
.codeblock .n { color: #c07414; }

/* 复制条 */
.copybox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 13px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  transition: border-color .18s;
}
.copybox:hover { border-color: var(--ink-4); }
.copybox code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 键值列表 ---------- */
.kv { display: flex; flex-direction: column; }
.kv__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.kv__row:last-child { border-bottom: 0; }
.kv__k { color: var(--ink-3); flex: none; }
.kv__v { color: var(--ink); text-align: right; word-break: break-all; }

/* ---------- 头像 ---------- */
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #7b5cff);
  flex: none;
  letter-spacing: 0;
}
.avatar--lg { width: 40px; height: 40px; border-radius: 11px; font-size: 15px; }
.avatar--sm { width: 24px; height: 24px; border-radius: 7px; font-size: 10.5px; }

/* ---------- 支付方式图标 ---------- */
.pm {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  flex: none;
  letter-spacing: -.02em;
}
.pm--alipay { background: var(--alipay); }
.pm--wxpay { background: var(--wechat); }
.pm--qqpay { background: var(--qq); }
.pm--bank { background: #4a5568; }
.pm--demo { background: var(--ink); }

/* ---------- 门户骨架 ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 17px 18px 15px;
  flex: none;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand) 0%, #7b5cff 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: var(--sh-brand);
  flex: none;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__name { font-size: 14.5px; font-weight: 680; letter-spacing: -.01em; }
.brand__sub { font-size: 10.5px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.nav__label {
  padding: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .09em;
  color: var(--ink-4);
  text-transform: uppercase;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 1px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color .16s, color .16s;
  white-space: nowrap;
}
.nav__item .ico { width: 17px; height: 17px; color: var(--ink-3); transition: color .16s; }
.nav__item:hover { background: var(--surface-3); color: var(--ink); }
.nav__item:hover .ico { color: var(--ink-2); }
.nav__item.is-active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav__item.is-active .ico { color: var(--brand); }
.nav__item .badge { margin-left: auto; }

.sidebar__foot {
  flex: none;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar__foot .row { gap: 8px; font-size: 11.5px; color: var(--ink-3); }

/* 管理后台：深色侧栏，形成身份区分 */
[data-portal="admin"] .sidebar {
  background: #0b1220;
  border-right-color: #172038;
}
[data-portal="admin"] .brand__name { color: #f2f6ff; }
[data-portal="admin"] .brand__sub { color: #64748b; }
[data-portal="admin"] .nav__label { color: #46536b; }
[data-portal="admin"] .nav__item { color: #93a1b8; }
[data-portal="admin"] .nav__item .ico { color: #5f6f8c; }
[data-portal="admin"] .nav__item:hover { background: rgba(255, 255, 255, .05); color: #e6edf9; }
[data-portal="admin"] .nav__item:hover .ico { color: #b8c6dd; }
[data-portal="admin"] .nav__item.is-active { background: rgba(109, 136, 255, .14); color: #c3d0ff; }
[data-portal="admin"] .nav__item.is-active .ico { color: #8ea2ff; }
[data-portal="admin"] .sidebar__foot { border-top-color: #172038; }
[data-portal="admin"] .sidebar__foot .row { color: #64748b; }
[data-portal="admin"] .brand__mark { background: linear-gradient(140deg, #6d88ff, #a78bfa); }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--surface); }
}
.topbar__crumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); min-width: 0; }
.topbar__crumb b { color: var(--ink); font-weight: 600; }
.topbar__crumb .ico { width: 14px; height: 14px; color: var(--ink-4); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 10px 0 5px;
  border-radius: 10px;
  transition: background-color .16s;
  max-width: 280px;
}
.user-chip:hover { background: var(--surface-3); }
.user-chip__meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip__name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip__role { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }

.content { flex: 1; width: 100%; max-width: 1340px; margin: 0 auto; padding: 24px 28px 64px; }

.page { display: flex; flex-direction: column; gap: 18px; animation: riseIn .5s var(--ease) both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 680; letter-spacing: -.022em; }
.page-sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.toolbar__group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.breadcrumb-sep { color: var(--ink-4); }

/* 遮罩（移动端侧栏） */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(9, 14, 26, .4);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .26s var(--ease);
}
body.sidebar-open .scrim { opacity: 1; pointer-events: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  :root { --sidebar-w: 212px; }
  .content { padding: 20px 20px 56px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 274px;
    transform: translate3d(-100%, 0, 0);
    transition: transform .32s var(--ease);
    box-shadow: var(--sh-3);
  }
  body.sidebar-open .sidebar { transform: none; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 48px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

@media (max-width: 480px) {
  .topbar { gap: 8px; }
  .topbar__crumb span,
  .topbar__crumb .ico { display: none; }
  .topbar__crumb b { font-size: 13.5px; }
  .page-sub { font-size: 12px; }
}
