:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe3ee;
  --accent: #0f766e;
  --accent-2: #1d4ed8;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #047857;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-y: contain;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 14px;
  align-content: center;
  color: var(--muted);
}

.boot img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.app-shell {
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 10px) 12px calc(124px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -10px -12px 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(219, 227, 238, 0.75);
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.title {
  min-width: 0;
}

.title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.account {
  max-width: 126px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.log-filterbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 62px;
  gap: 6px;
  margin-top: 8px;
}

.channel-filterbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.log-statbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
}

.log-statbar div {
  min-width: 0;
  min-height: 48px;
  padding: 6px 7px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--line);
}

.log-statbar span,
.log-statbar em {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.05;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-statbar b {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.05;
  color: #111827;
}

.log-statbar .stat-quota b,
.log-statbar .stat-empty b {
  color: #1d4ed8;
}

.log-statbar .stat-error b {
  color: var(--danger);
}

.searchbox,
.field,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.announcement-editor {
  min-height: 220px;
  margin-top: 14px;
  line-height: 1.6;
}

.announcement-preview {
  margin-top: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.searchbox,
.field {
  height: 42px;
  padding: 0 12px;
}

.field.compact,
.btn.compact {
  min-height: 0;
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
}

.textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

.btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 650;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.blue {
  background: var(--accent-2);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn:disabled {
  opacity: 0.55;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

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

.tab {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.tab.active {
  background: #111827;
  color: #fff;
}

.grid {
  display: grid;
  gap: 10px;
}

.dense-list {
  display: grid;
  gap: 7px;
}

.log-list {
  margin: 0;
}

.log-row {
  min-height: 76px;
  padding: 9px 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.log-row:nth-child(even) {
  background: #fff;
}

.log-row.is-error {
  background: #fff1f2;
  border-color: #fecdd3;
}

.log-row.is-empty-completion {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.log-row.is-empty-completion .log-metrics b,
.log-row.is-empty-completion .log-model {
  color: #1d4ed8;
}

.log-row.is-retry-success {
  background: #fff7ed;
  border-color: #fdba74;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.13);
}

.log-row.is-retry-success .log-model,
.log-row.is-retry-success .log-metrics b {
  color: #b45309;
}

.log-retry-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fed7aa;
  color: #9a3412;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  vertical-align: middle;
  white-space: nowrap;
}

.log-retry-path {
  margin-top: 3px;
  color: #c2410c;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-top {
  display: grid;
  grid-template-columns: minmax(64px, 0.8fr) minmax(0, 1.4fr) 58px;
  align-items: center;
  gap: 8px;
}

.log-user,
.log-model,
.log-time,
.log-metrics b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-user,
.log-model {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
}

.log-time {
  color: var(--muted);
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

.log-metrics {
  display: grid;
  grid-template-columns: 0.78fr 0.95fr minmax(0, 1.25fr);
  gap: 6px;
  margin-top: 8px;
}

.log-metrics div {
  min-width: 0;
  padding: 5px 6px;
  border-radius: 7px;
  background: #f8fafc;
}

.log-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.log-metrics b {
  display: block;
  margin-top: 3px;
  color: #334155;
  font-size: 12px;
  line-height: 1.1;
}

.log-metrics div:first-child b {
  color: var(--ok);
}

.server-card {
  border-color: #b7e4dc;
  background: #f0fdfa;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.server-grid div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ccfbf1;
}

.server-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.server-grid b {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.redemption-create-card {
  background: #fff;
}

.redemption-create-form,
.redemption-result {
  display: grid;
  grid-template-columns: 76px minmax(0, 0.9fr) minmax(0, 1fr) 54px;
  gap: 6px;
  margin-top: 10px;
}

.redemption-result {
  grid-template-columns: minmax(0, 1fr) 58px;
  margin-top: 7px;
}

.redemption-result input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.channel-list {
  gap: 5px;
}

.channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main status"
    "metrics edit";
  gap: 6px 8px;
  align-items: center;
  min-height: 52px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.channel-main {
  grid-area: main;
  min-width: 0;
}

.channel-title {
  font-size: 13px;
  line-height: 1.15;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-row .badge {
  grid-area: status;
  max-width: 76px;
  padding: 3px 6px;
  font-size: 10px;
}

.channel-metrics {
  grid-area: metrics;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.channel-metrics div {
  min-width: 0;
  padding: 4px 5px;
  border-radius: 6px;
  background: #f8fafc;
}

.channel-metrics span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

.channel-metrics b {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-row > .btn {
  grid-area: edit;
  justify-self: end;
  width: 48px;
  height: 28px;
  min-height: 0;
  padding: 0;
  font-size: 12px;
}

.bill-list {
  gap: 4px;
}

.billing-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.billing-summary div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
}

.billing-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.billing-summary b {
  display: block;
  margin-top: 3px;
  color: #047857;
  font-size: 18px;
  line-height: 1.1;
}

.bill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, auto);
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.bill-main,
.bill-side {
  min-width: 0;
}

.bill-title {
  font-size: 13px;
  line-height: 1.18;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-sub,
.bill-side span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-side {
  max-width: 178px;
  text-align: right;
}

.bill-side b {
  display: block;
  color: #0f766e;
  font-size: 12px;
  line-height: 1.15;
}

.bill-side span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  box-shadow: var(--shadow);
}

.stat b {
  display: block;
  font-size: 20px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.card-title {
  min-width: 0;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.card-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badge {
  flex: 0 0 auto;
  max-width: 120px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  color: #334155;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.ok {
  background: #dcfce7;
  color: var(--ok);
}

.badge.warn {
  background: #fef3c7;
  color: var(--warn);
}

.badge.danger {
  background: #fee2e2;
  color: var(--danger);
}

.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.kv div {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: #f8fafc;
}

.kv span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.kv b {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.content {
  margin-top: 10px;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.actions .btn {
  flex: 0 0 auto;
  min-height: 36px;
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.traffic-overview {
  padding: 14px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  box-shadow: var(--shadow);
}

.traffic-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.traffic-actions small {
  color: #cbd5e1;
  font-size: 10px;
  line-height: 1.35;
  text-align: right;
}

.traffic-actions .btn.warning {
  flex: 0 0 auto;
  color: #fef3c7;
  background: rgba(245, 158, 11, .22);
  border-color: rgba(253, 230, 138, .36);
}

.traffic-actions .btn.warning:disabled {
  opacity: .65;
}

.traffic-total span,
.traffic-total small {
  display: block;
  color: #cbd5e1;
  font-size: 11px;
}

.traffic-total b {
  display: block;
  margin: 2px 0;
  font-size: 34px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.traffic-family-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.traffic-family-totals div {
  min-width: 0;
  padding: 9px;
  border-radius: 9px;
  background: rgba(255,255,255,.1);
}

.traffic-family-totals span,
.traffic-family-totals b {
  display: block;
}

.traffic-family-totals span { color: #cbd5e1; font-size: 10px; }
.traffic-family-totals b { margin-top: 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
.traffic-family-totals .gpt b { color: #5eead4; }
.traffic-family-totals .claude b { color: #fdba74; }
.traffic-family-totals .grok b { color: #c4b5fd; }

.traffic-updated {
  margin-top: 10px;
  color: #94a3b8;
  font-size: 10px;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,.15);
}

.traffic-family-list { display: grid; gap: 10px; margin-top: 10px; }
.traffic-family { overflow: hidden; }
.traffic-family.gpt { border-top: 3px solid #14b8a6; }
.traffic-family.claude { border-top: 3px solid #f97316; }
.traffic-family.grok { border-top: 3px solid #8b5cf6; }

.traffic-family-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.traffic-family-name { display: block; font-size: 18px; font-weight: 750; }
.traffic-family-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.traffic-family-rpm { text-align: right; }
.traffic-family-rpm b { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.traffic-family-rpm span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.traffic-bars { display: grid; gap: 14px; margin-top: 14px; }
.traffic-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.traffic-row-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.traffic-row-head strong { flex: 0 0 auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.traffic-bar { height: 10px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: #e8edf3; }
.traffic-bar i { display: block; height: 100%; border-radius: inherit; transition: width .35s ease; }
.traffic-family.gpt .traffic-bar i { background: linear-gradient(90deg, #0f766e, #2dd4bf); }
.traffic-family.claude .traffic-bar i { background: linear-gradient(90deg, #c2410c, #fb923c); }
.traffic-family.grok .traffic-bar i { background: linear-gradient(90deg, #6d28d9, #a78bfa); }
.traffic-split { display: flex; gap: 10px; margin-top: 4px; font-size: 10px; }
.traffic-split .ok { color: var(--ok); }
.traffic-split .error { padding: 0; color: var(--danger); }
.traffic-empty { padding: 24px 8px 16px; text-align: center; color: var(--muted); font-size: 12px; }

.nav-btn {
  min-width: 0;
  min-height: 48px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 650;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn.active {
  color: var(--accent);
  background: #ccfbf1;
}

.empty,
.error,
.loading {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.pager span {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-end;
}

.modal {
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px 8px 0 0;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-row label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.channel-multiselect {
  min-height: 44px;
  padding: 6px;
}

.channel-multiselect option {
  padding: 8px 6px;
}

.channel-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-choice {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.channel-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.channel-choice.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.14);
}

.channel-choice.is-selected span::before {
  content: '✓';
  margin-right: 5px;
}

.channel-save-status {
  margin-top: 8px;
  text-align: center;
}

.channel-save-status.is-warning { color: #b45309; }
.channel-save-status.is-success { color: #15803d; }
.channel-save-status.is-error { color: #dc2626; }

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
}

.code-row .btn {
  min-height: 42px;
  padding: 0 10px;
  white-space: nowrap;
}

.form-hint {
  min-height: 16px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.login {
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 28px) 18px 32px;
  display: grid;
  align-content: center;
}

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.login-card img {
  width: 54px;
  height: 54px;
  border-radius: 12px;
}

.login-card h1 {
  margin: 12px 0 4px;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(122px + env(safe-area-inset-bottom));
  z-index: 90;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.danger-zone {
  border-color: #fecaca;
  background: #fff7f7;
}

.hide {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    max-width: 720px;
    margin: 0 auto;
  }

  .topbar {
    border-left: 1px solid rgba(219, 227, 238, 0.75);
    border-right: 1px solid rgba(219, 227, 238, 0.75);
  }
}

/* ===== 2026-06-13 健康分 + 日志增强 ===== */
.health-text { font-variant-numeric: tabular-nums; }
.health-text.health-ok { color: #2f9e62; }
.health-text.health-warn { color: #d97706; }
.health-text.health-bad { color: #dc2626; }
.health-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.health-item { display: grid; grid-template-columns: minmax(0,1fr) 88px 48px; align-items: center; gap: 10px; }
.health-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-bar { height: 6px; border-radius: 999px; background: rgba(120,120,140,.16); overflow: hidden; }
.health-bar > i { display: block; height: 100%; border-radius: 999px; }
.health-bar > i.health-ok { background: #34c759; }
.health-bar > i.health-warn { background: #f59e0b; }
.health-bar > i.health-bad { background: #ef4444; }
.health-item b { text-align: right; font-size: 13px; }
.health-empty { color: #6b7280; font-size: 13px; padding: 6px 0; }
.log-error-content { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(239,68,68,.08); color: #b91c1c; font-size: 12px; line-height: 1.5; word-break: break-all; }
.log-time { font-size: 12px; white-space: nowrap; }

/* ===== 2026-07-19 手机兜底渠道 + 上游余额 ===== */
.mobile-panel {
  display: grid;
  gap: 10px;
}

.mobile-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 1px;
}

.mobile-actionbar > div:first-child {
  min-width: 0;
}

.mobile-actionbar b,
.mobile-actionbar span {
  display: block;
}

.mobile-actionbar b {
  font-size: 14px;
}

.mobile-actionbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.mobile-action-buttons {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.mobile-summary {
  display: grid;
  gap: 6px;
}

.mobile-summary.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mobile-summary.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mobile-summary > div {
  min-width: 0;
  padding: 9px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.mobile-summary span,
.mobile-summary b {
  display: block;
}

.mobile-summary span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.mobile-summary b {
  margin-top: 3px;
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mobile-panel .health-ok {
  color: var(--ok);
}

.mobile-panel .health-warn {
  color: var(--warn);
}

.mobile-panel .health-bad {
  color: var(--danger);
}

.panel-note {
  padding: 10px 11px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.panel-note b,
.panel-note span {
  display: block;
}

.panel-note b {
  color: #1d4ed8;
  font-size: 12px;
}

.panel-note span {
  margin-top: 3px;
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
}

.fallback-controls {
  padding-bottom: 10px;
}

.toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}

.toggle-row > div {
  min-width: 0;
}

.toggle-row b,
.toggle-row span {
  display: block;
}

.toggle-row b {
  font-size: 13px;
}

.toggle-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.mobile-switch {
  position: relative;
  width: 46px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background .18s ease;
}

.mobile-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
  transition: transform .18s ease;
}

.mobile-switch.on {
  background: var(--accent);
}

.mobile-switch.on i {
  transform: translateX(20px);
}

.automation-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.automation-state {
  min-width: 0;
  padding: 6px 4px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.automation-state i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: #94a3b8;
  vertical-align: 1px;
}

.automation-state.on {
  background: #ecfdf5;
  color: var(--ok);
}

.automation-state.on i {
  background: #10b981;
}

.mobile-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px 0;
}

.mobile-section-title b,
.mobile-section-title span {
  display: block;
}

.mobile-section-title b {
  font-size: 15px;
}

.mobile-section-title span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.error-card {
  padding: 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: var(--danger);
  font-size: 12px;
}

.fallback-rule-card {
  padding: 11px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .055);
}

.fallback-rule-card.is-active {
  border-color: #fdba74;
  background: #fffaf3;
}

.rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.rule-tags span {
  max-width: 130px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-tags span.group {
  background: #e0f2fe;
  color: #0369a1;
}

.rule-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
  align-items: stretch;
  gap: 5px;
  margin-top: 10px;
}

.rule-flow > div {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5eaf1;
}

.rule-flow > div:last-child {
  background: #f0fdfa;
  border-color: #ccfbf1;
}

.rule-flow span,
.rule-flow b,
.rule-flow small {
  display: block;
}

.rule-flow span {
  color: var(--muted);
  font-size: 9px;
}

.rule-flow b {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.15;
}

.rule-flow small {
  display: -webkit-box;
  margin-top: 4px;
  color: #64748b;
  font-size: 9px;
  line-height: 1.25;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rule-flow > i {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 18px;
  font-style: normal;
  font-weight: 800;
}

.fallback-list-label {
  margin: 10px 1px 5px;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
}

.fallback-channel-list {
  display: grid;
  gap: 5px;
}

.fallback-channel-line {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px;
  border: 1px solid #e5eaf1;
  border-radius: 8px;
  background: #fff;
}

.fallback-channel-line.is-primary {
  grid-template-columns: minmax(0, 1fr);
  border-style: dashed;
  background: #f8fafc;
}

.fallback-channel-line.is-taking-over {
  border-color: #fdba74;
  background: #fff7ed;
}

.fallback-rank {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 10px;
  font-weight: 850;
}

.fallback-channel-body {
  min-width: 0;
}

.fallback-channel-name {
  min-width: 0;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.fallback-channel-name em {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 999px;
  background: #dcfce7;
  color: var(--ok);
  font-size: 8px;
  font-style: normal;
  vertical-align: 1px;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
}

.mini-tags span {
  max-width: 150px;
  padding: 2px 4px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 8px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-tags .ok,
.mini-tags .health-ok,
.mini-tags .balance.ok,
.mini-tags .ready {
  background: #dcfce7;
  color: var(--ok);
}

.mini-tags .danger,
.mini-tags .health-bad,
.mini-tags .balance.low,
.mini-tags .balance.error,
.mini-tags .failure {
  background: #fee2e2;
  color: var(--danger);
}

.mini-tags .health-warn,
.mini-tags .balance.pending,
.mini-tags .taking,
.mini-tags .probing {
  background: #fef3c7;
  color: var(--warn);
}

.mini-tags .recover,
.mini-tags .probe {
  background: #dbeafe;
  color: #1d4ed8;
}

.mini-tags .probe.has-failure {
  background: #fee2e2;
  color: var(--danger);
}

.mini-tags .probe.is-skipped {
  background: #f1f5f9;
  color: #64748b;
}

.mini-tags .legacy {
  background: #ede9fe;
  color: #6d28d9;
}

.channel-reason {
  display: -webkit-box;
  margin-top: 4px;
  color: var(--danger);
  font-size: 9px;
  line-height: 1.3;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.fallback-probe-details {
  margin-top: 6px;
  border-top: 1px dashed #dbe3ec;
}

.fallback-probe-details summary {
  padding-top: 6px;
  color: #475569;
  font-size: 9px;
  font-weight: 750;
  cursor: pointer;
  list-style-position: inside;
}

.fallback-probe-grid {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding: 7px;
  border-radius: 7px;
  background: #f8fafc;
}

.fallback-probe-grid > div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.fallback-probe-grid span {
  color: var(--muted);
  font-size: 8px;
}

.fallback-probe-grid b {
  color: #334155;
  font-size: 8px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.fallback-test {
  width: 40px;
  height: 27px;
  padding: 0;
  font-size: 10px;
}

.compact-empty {
  padding: 12px 8px;
  font-size: 11px;
}

.primary-details,
.fallback-advanced {
  margin-top: 8px;
}

.primary-details > summary,
.fallback-advanced > summary {
  color: #334155;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.primary-list {
  margin-top: 7px;
}

.fallback-advanced > summary {
  font-size: 13px;
}

.fallback-advanced > p {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.legacy-code {
  margin-top: 8px;
}

.legacy-code > b {
  font-size: 11px;
}

.legacy-code pre {
  max-height: 120px;
  margin: 4px 0 0;
  padding: 8px;
  border-radius: 7px;
  background: #f8fafc;
  color: #475569;
  font-size: 9px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow: auto;
}

.legacy-list {
  margin-top: 9px;
}

.desktop-edit-link {
  width: 100%;
  margin-top: 10px;
  text-decoration: none;
}

.upstream-card-list {
  display: grid;
  gap: 6px;
}

.upstream-panel {
  gap: 7px;
}

.upstream-usage-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.upstream-usage-totals > div {
  min-width: 0;
  padding: 10px 9px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: linear-gradient(145deg, #ecfdf5, #fff);
}

.upstream-usage-totals span,
.upstream-usage-totals b,
.upstream-usage-totals small {
  display: block;
}

.upstream-usage-totals span {
  color: var(--muted);
  font-size: 10px;
}

.upstream-usage-totals b {
  margin-top: 3px;
  color: #047857;
  font-size: 17px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.upstream-usage-totals small {
  margin-top: 4px;
  color: #64748b;
  font-size: 8px;
  line-height: 1.35;
}

.upstream-panel .mobile-summary > div {
  padding: 6px 4px;
}

.upstream-panel .mobile-summary b {
  margin-top: 2px;
  font-size: 16px;
}

.upstream-alert-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #eff6ff;
  color: #475569;
  font-size: 9px;
}

.upstream-alert-hint b {
  color: #1d4ed8;
  font-size: 10px;
  white-space: nowrap;
}

.upstream-card {
  padding: 8px 9px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .045);
}

.upstream-card.is-low,
.upstream-card.has-error {
  border-color: #fecaca;
}

.upstream-card.is-rate-limited {
  border-color: #fcd34d;
  background: #fffbeb;
}

.upstream-card.is-low {
  background: #fff8f8;
}

.upstream-compact-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.upstream-compact-identity {
  min-width: 0;
}

.upstream-compact-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.upstream-compact-title .card-title {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-compact-title .badge {
  max-width: 76px;
  padding: 2px 5px;
  font-size: 9px;
}

.upstream-compact-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-compact-balance {
  min-width: 78px;
  text-align: right;
}

.upstream-compact-balance span,
.upstream-compact-balance b {
  display: block;
}

.upstream-compact-balance span {
  color: var(--muted);
  font-size: 8px;
}

.upstream-compact-balance b {
  margin-top: 1px;
  font-size: 18px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upstream-channel-strip {
  display: grid;
  grid-template-columns: .8fr 1.2fr 1fr;
  gap: 4px;
  margin-top: 6px;
}

.upstream-channel-strip > div {
  min-width: 0;
  padding: 5px 4px;
  border-radius: 6px;
  background: #f8fafc;
  text-align: center;
}

.upstream-channel-strip span,
.upstream-channel-strip b,
.upstream-channel-strip small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-channel-strip span {
  color: var(--muted);
  font-size: 8px;
}

.upstream-channel-strip b {
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.upstream-channel-strip small {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 7.5px;
}

.upstream-usage-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 5px;
}

.upstream-usage-strip > div {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.upstream-usage-strip span,
.upstream-usage-strip b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-usage-strip span {
  color: var(--muted);
  font-size: 8px;
}

.upstream-usage-strip b {
  margin-top: 1px;
  color: #334155;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.upstream-account-ratios {
  min-width: 0;
  margin-top: 5px;
  padding: 5px 6px;
  border-radius: 6px;
  background: #f8fafc;
}

.upstream-account-ratios span,
.upstream-account-ratios b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-account-ratios span {
  color: var(--muted);
  font-size: 8px;
}

.upstream-account-ratios b {
  margin-top: 1px;
  color: #475569;
  font-size: 9px;
  font-weight: 500;
}

.upstream-channel-section {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
}

.upstream-channel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
}

.upstream-channel-section-head b {
  color: #475569;
  font-size: 9px;
  font-weight: 600;
}

.upstream-channel-list {
  display: grid;
  gap: 3.5px;
  max-height: 166px;
  margin-top: 5px;
  padding-right: 2px;
  overflow-y: auto;
}

.upstream-channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  row-gap: 4px;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 7px;
  background: #f8fafc;
}

.upstream-channel-main,
.upstream-channel-name {
  min-width: 0;
}

.upstream-channel-name {
  display: flex;
  align-items: center;
  gap: 4px;
}

.upstream-channel-name > b {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-ratio-badge {
  flex: 0 0 auto;
  padding: 1.5px 4px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 8px;
  line-height: 1.1;
  white-space: nowrap;
}

.upstream-channel-main > small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 8px;
  line-height: 1.25;
}

.upstream-channel-badges {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
}

.upstream-channel-badges .badge {
  padding: 1.5px 4px;
  font-size: 8px;
}

.upstream-channel-empty {
  margin-top: 7px;
  padding: 7px;
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.upstream-compact-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.upstream-compact-foot > span {
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-compact-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.upstream-compact-actions .btn.compact {
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 10px;
}

.upstream-compact-notice {
  margin-top: 5px;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 9px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.upstream-compact-notice.alerted {
  background: #fff7ed;
  color: var(--warn);
}

.upstream-compact-notice.upstream-error {
  background: #fff1f2;
  color: var(--danger);
}

.upstream-compact-notice.rate-limit-note {
  background: #fef3c7;
  color: var(--warn);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-row span,
.check-row b,
.check-row small {
  display: block;
}

.check-row b {
  font-size: 12px;
}

.check-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.channel-upstream {
  display: inline-flex;
  max-width: 100%;
  margin-top: 4px;
  padding: 2px 5px;
  border-radius: 5px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-upstream.ok {
  background: #dcfce7;
  color: var(--ok);
}

.channel-upstream.low,
.channel-upstream.error {
  background: #fee2e2;
  color: var(--danger);
}

.channel-upstream.pending {
  background: #fef3c7;
  color: var(--warn);
}

@media (max-width: 350px) {
  .mobile-summary > div {
    padding-right: 3px;
    padding-left: 3px;
  }

  .mobile-summary span {
    font-size: 9px;
  }

  .rule-flow {
    grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
    gap: 3px;
  }
}

/* ===== 2026-08-05 上游余额窄屏适配 ===== */
#mainContent,
.mobile-panel,
.upstream-panel,
.upstream-card-list,
.upstream-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.upstream-card > *,
.upstream-channel-section,
.upstream-channel-list,
.upstream-channel-main {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 560px) {
  .upstream-usage-totals {
    grid-template-columns: minmax(0, 1fr);
  }

  .upstream-usage-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upstream-usage-totals > div,
  .upstream-usage-strip > div {
    width: 100%;
  }

  .upstream-alert-hint,
  .upstream-channel-section-head,
  .upstream-compact-foot {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .upstream-alert-hint b {
    white-space: normal;
  }

  .upstream-compact-sub,
  .upstream-account-ratios b,
  .upstream-channel-strip span,
  .upstream-channel-strip b,
  .upstream-channel-strip small,
  .upstream-channel-main > small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .upstream-compact-balance {
    min-width: 0;
    max-width: 112px;
  }

  .upstream-compact-balance b {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .upstream-channel-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .upstream-account-ratios b {
    line-height: 1.45;
  }

  .upstream-channel-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .upstream-channel-name {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .upstream-channel-name > b {
    flex: 1 1 150px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .upstream-ratio-badge {
    flex: 0 1 auto;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .upstream-channel-badges {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 350px) {
  .upstream-compact-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .upstream-compact-balance {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 6px;
    max-width: none;
    text-align: left;
  }

  .upstream-compact-balance b {
    margin-top: 0;
  }

  .upstream-channel-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upstream-channel-strip > div:last-child {
    grid-column: 1 / -1;
  }
}

/* 上游余额页整体可读性提升 5%，保持原有卡片宽度与列布局。 */
.upstream-panel .mobile-actionbar b {
  font-size: 14.7px;
}

.upstream-panel .mobile-actionbar span {
  font-size: 11.55px;
}

.upstream-panel > .mobile-actionbar .btn.compact {
  height: 33.6px;
  padding-right: 8.4px;
  padding-left: 8.4px;
  font-size: 12.6px;
}

.upstream-usage-totals span,
.upstream-panel .mobile-summary span,
.upstream-alert-hint b,
.upstream-channel-name > b,
.upstream-compact-actions .btn.compact {
  font-size: 10.5px;
}

.upstream-usage-totals b {
  font-size: 17.85px;
}

.upstream-usage-totals small,
.upstream-compact-balance span,
.upstream-channel-strip span,
.upstream-usage-strip span,
.upstream-account-ratios span,
.upstream-ratio-badge,
.upstream-channel-main > small,
.upstream-channel-badges .badge {
  font-size: 8.4px;
}

.upstream-panel .mobile-summary b {
  font-size: 16.8px;
}

.upstream-alert-hint,
.upstream-compact-title .badge,
.upstream-compact-sub,
.upstream-account-ratios b,
.upstream-channel-section-head,
.upstream-channel-section-head b,
.upstream-channel-empty,
.upstream-compact-foot > span,
.upstream-compact-notice {
  font-size: 9.45px;
}

.upstream-compact-title .card-title {
  font-size: 13.65px;
}

.upstream-compact-balance b {
  font-size: 18.9px;
}

.upstream-channel-strip b {
  font-size: 12.6px;
}

.upstream-channel-strip small {
  font-size: 7.875px;
}

.upstream-usage-strip b {
  font-size: 11.55px;
}

.upstream-compact-actions .btn.compact {
  height: 27.3px;
  padding-right: 7.35px;
  padding-left: 7.35px;
}
