/* mphistory 管理后台 —— 沿用用户站「晒图蓝」token（ui-ux.md 第 2 节），以信息密度与操作效率为先：无动效、无标题墙 */

:root {
  color-scheme: dark;
  --bg: #0B3A8F;
  --grid: rgba(255, 255, 255, .055);
  --panel: #0C3E98;
  --panel-2: rgba(255, 255, 255, .06);
  --sheet: #0D3F98;
  --ink: #F2F6FF;
  --muted: #A9C1EC;
  --line: rgba(255, 255, 255, .26);
  --line-soft: rgba(255, 255, 255, .14);
  --strong: #FFFFFF;
  --accent: #FFD34E;
  --accent-ink: #0A2A66;
  --accent-soft: rgba(255, 211, 78, .24);
  --ok: #8BE8BC;
  --ok-soft: rgba(139, 232, 188, .14);
  --bad: #FFA08F;
  --bad-soft: rgba(255, 110, 90, .18);
  --scrim: rgba(3, 20, 60, .72);
  --soft-btn: rgba(255, 255, 255, .10);
  --soft-btn-hover: rgba(255, 255, 255, .17);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --ctl-h: 44px;          /* 全后台表单控件（input / select / 按钮）统一高度 */
  --ph: rgba(169, 193, 236, .55);   /* placeholder 颜色 */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--ink);
  font: 14px/1.55 var(--sans);
  overflow-x: hidden;
}
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.mono, code { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.accent { color: var(--accent); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.boot { padding: 40px 16px; color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h); padding: 0 16px;
  border: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--ink);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--strong); color: var(--ink); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.btn.primary:hover:not(:disabled) { background: #ffe07e; border-color: #ffe07e; color: var(--accent-ink); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #3a0d05; font-weight: 800; }
.btn.soft { border-color: transparent; background: var(--soft-btn); }
.btn.soft:hover:not(:disabled) { background: var(--soft-btn-hover); border-color: transparent; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.xs { min-height: 26px; padding: 0 8px; font-size: 12px; font-weight: 500; }
.btn.block { width: 100%; }
.btn.lg { min-height: var(--ctl-h); font-size: 15px; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { color: var(--accent); }

/* ---------- 表单 ----------
 * 全后台统一「上下排布」：label（固定 20px 行高）→ 控件（44px）→ 说明 / 错误（控件下方，同一左边线）。
 * 栅格一律 align-items: start，说明文字只会撑高自己这一格，不影响同行其他控件的顶边。
 */
.input, select.input, textarea.input {
  display: block; width: 100%; margin: 0;
  padding: 0 12px; border: 1px solid var(--line); border-radius: 0;
  background: rgba(3, 20, 60, .28); color: var(--ink);
  font: 14px/1.4 var(--sans);
}
input.input, select.input { height: var(--ctl-h); }
textarea.input { min-height: 88px; padding: 11px 12px; line-height: 1.55; resize: vertical; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23A9C1EC' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
select.input option { background: var(--sheet); color: var(--ink); }
.input.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* 数字输入：右对齐、等宽、去掉步进箭头 */
input.input[type=number] { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
input.input[type=number]::-webkit-inner-spin-button, input.input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input::placeholder { color: var(--ph); opacity: 1; font-size: 14px; font-family: var(--sans); }
.input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.input:disabled { opacity: .5; cursor: not-allowed; }
.input.changed { border-color: var(--accent); background-color: rgba(255, 211, 78, .08); }
.input.invalid { border-color: var(--bad); }
/* 自定义文件选择：原生 input[type=file] 隐藏，只读文件名框 + 「选择图片」按钮 */
.file-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-pick { position: relative; }
.file-pick > .input[readonly] { cursor: pointer; text-overflow: ellipsis; }
.file-pick > .input[readonly]:focus { outline-offset: -2px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label {
  display: flex; align-items: baseline; gap: 6px; min-height: 20px; line-height: 20px;
  font-weight: 700; font-size: 13px; white-space: nowrap; min-width: 0;
}
.field > label .req { color: var(--accent); }
/* label 后面的配置键名：放不下时省略，不换行，保证同行各列 label 高度一致 */
.field .key { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.field .help { font-size: 12px; line-height: 1.5; color: var(--muted); }
.field .field-err { font-size: 12px; line-height: 1.5; color: var(--bad); }
.field .field-err:empty { display: none; }

/* 输入组：控件 + 后缀单位 / 附加按钮，无缝拼接、同高 */
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group > .input { flex: 1 1 auto; min-width: 0; }
.input-group > .input:not(:last-child) { border-right: 0; }
.input-group > .suffix {
  flex: 0 0 64px; display: flex; align-items: center; justify-content: center; padding: 0 6px;   /* 固定宽度：同组输入框等宽 */
  height: var(--ctl-h); border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 13px; white-space: nowrap;
}
.input-group > .btn { flex: none; min-height: 0; height: var(--ctl-h); min-width: 64px; border: 1px solid var(--line); background: var(--panel-2); }
.input-group > .btn:hover:not(:disabled) { background: var(--soft-btn-hover); border-color: var(--line); }
.input-group > .input.changed + .suffix { border-color: var(--accent); }
.input-group > .input.invalid + .suffix { border-color: var(--bad); }

/* 表单栅格：自动等宽列（配置页）/ 12 栅格（其他表单） */
.form-grid { display: grid; gap: 18px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; }
.fgrid { display: grid; gap: 18px 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.fgrid > * { grid-column: span 12; }
.fgrid > .c-2 { grid-column: span 2; }
.fgrid > .c-3 { grid-column: span 3; }
.fgrid > .c-4 { grid-column: span 4; }
.fgrid > .c-6 { grid-column: span 6; }
.fgrid > .c-8 { grid-column: span 8; }
/* 按钮组：右对齐、间距 8px；左侧可放状态 / 错误信息（固定在这一行，不把按钮推下去） */
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin-top: 18px; }
.form-actions.start { justify-content: flex-start; }
.form-actions > .form-msg { flex: 1 1 260px; min-width: 0; min-height: var(--ctl-h); display: flex; align-items: center; font-size: 13px; line-height: 1.5; }
.form-actions > .form-msg:empty { visibility: hidden; }
.form-msg .bad { color: var(--bad); }
.form-msg .warn-text, .warn-text { color: var(--accent); }
/* 「仍然添加 / 仍然更换」：黄色描边，表示需要确认的警告操作（不是错误） */
.btn.warn-btn { border-color: var(--accent); color: var(--accent); }
.btn.warn-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; vertical-align: middle; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login {
  width: 100%; max-width: 360px; padding: 28px 24px;
  background: var(--sheet); border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(3, 20, 60, .45);
}
.login h1 { margin: 0 0 4px; font-size: 24px; font-weight: 900; }
.login p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login form { display: grid; gap: 12px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 20px; line-height: 20px; }
.login > * + * { margin-top: 12px; }
.login > p { margin-top: 0; }
.login-info:empty, .login-ttl:empty { display: none; }
.login-ttl { font: 13px var(--mono); color: var(--muted); text-align: center; }
.login-ttl.warn { color: var(--accent); }
.login-ttl.bad { color: var(--bad); }
/* 登录口令框是唯一例外：6 位大号数字，高 56px（单独一行，不与其他控件并排） */
input.input.code-input {
  height: 56px; text-align: center; font: 700 32px/1 var(--mono); letter-spacing: .45em; padding-left: .45em;
  font-variant-numeric: tabular-nums;
}
.input.code-input::placeholder { color: rgba(255, 255, 255, .25); font: inherit; letter-spacing: inherit; }

/* ---------- R2 用量 ---------- */
.r2-meters { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.r2-meter { padding: 12px; background: var(--panel-2); border-left: 3px solid var(--line); }
.r2-meter .name { font-weight: 800; }
.r2-meter .val { font: 700 20px/1.3 var(--mono); font-variant-numeric: tabular-nums; margin-top: 4px; }
.r2-meter .val small { font-size: 12px; font-weight: 400; color: var(--muted); }
.r2-meter .pctv { font: 700 14px var(--mono); float: right; }
.r2-meter .progress { height: 8px; }
.r2-meter .progress > i { background: var(--ok); }
.r2-meter.warn { border-left-color: var(--accent); }
.r2-meter.warn .pctv, .r2-meter.warn .val { color: var(--accent); }
.r2-meter.warn .progress > i { background: var(--accent); }
.r2-meter.over { border-left-color: var(--bad); background: var(--bad-soft); }
.r2-meter.over .pctv, .r2-meter.over .val { color: var(--bad); }
.r2-meter.over .progress > i { background: var(--bad); }
.progress .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--accent); opacity: .7; }

/* ---------- 顶栏与导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(8, 44, 112, .96);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; min-height: 52px; }
.brand { font-weight: 900; font-size: 16px; letter-spacing: .02em; white-space: nowrap; text-decoration: none; }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 52px;
  color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.badge {
  display: inline-block; min-width: 20px; padding: 0 5px; line-height: 20px; text-align: center;
  font: 700 12px/20px var(--mono); background: var(--accent); color: var(--accent-ink);
}
.badge.dim { background: var(--soft-btn-hover); color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.balance-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line); text-decoration: none; white-space: nowrap; font-size: 13px;
}
.balance-chip b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.balance-chip.low { background: var(--bad); border-color: var(--bad); color: #3a0d05; font-weight: 700; }
.balance-chip.low:hover { color: #3a0d05; }
.balance-chip.unknown { color: var(--muted); }

.main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 900; }
.page-head .sub { color: var(--muted); font-size: 12px; }

/* ---------- 面板 ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); padding: 16px; }
.panel + .panel, .panel + .section, .section + .section { margin-top: 16px; }
.panel h2, .section-title { margin: 0 0 12px; font-size: 16px; font-weight: 900; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel h2 .aside, .section-title .aside { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); }
.section { margin-top: 16px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); }
.loading { padding: 28px 16px; color: var(--muted); }
.error-box { padding: 14px 16px; border: 1px solid var(--bad); background: var(--bad-soft); color: var(--ink); }
.error-box b { color: var(--bad); }
.notice { padding: 10px 12px; border: 1px dashed var(--line); background: var(--panel-2); font-size: 13px; }
.notice.warn { border: 1px solid var(--accent); background: rgba(255, 211, 78, .1); }
.notice.alert { border: 2px solid var(--bad); background: var(--bad-soft); }
.notice.alert b { color: var(--bad); }

/* ---------- 标签 / 状态 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; min-height: 22px;
  font-size: 12px; font-weight: 700; border: 1px solid var(--line); white-space: nowrap; color: var(--ink);
}
.tag.accent { border-color: var(--accent); color: var(--accent); }
.tag.accent-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.tag.bad { border-color: var(--bad); color: var(--bad); }
.tag.dim { color: var(--muted); border-color: var(--line-soft); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(139, 232, 188, .2); }
.dot.off { background: var(--bad); }

/* ---------- 筛选 tab ---------- */
.tabs { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px; min-height: 44px;
  color: var(--muted); font-weight: 700; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-family: var(--mono); font-size: 12px; margin-left: 4px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .btn { min-height: var(--ctl-h); }
.toolbar select.input { width: auto; min-width: 140px; }
.toolbar .grow { flex: 1; }

/* ---------- 概览 ---------- */
.ov-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.ov-grid > * { grid-column: span 12; margin: 0 !important; }
@media (min-width: 900px) {
  .ov-grid .span-4 { grid-column: span 4; }
  .ov-grid .span-6 { grid-column: span 6; }
  .ov-grid .span-8 { grid-column: span 8; }
}
.provider.low { border: 2px solid var(--bad); background: #5a2a55; background: linear-gradient(0deg, var(--bad-soft), var(--bad-soft)), var(--panel); }
.provider-head { display: flex; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; }
.provider-total { font: 700 40px/1 var(--mono); font-variant-numeric: tabular-nums; }
.provider.low .provider-total { color: var(--bad); }
.provider-alert { margin-top: 12px; padding: 12px 14px; background: var(--bad); color: #3a0d05; font-weight: 800; font-size: 15px; }
.provider-keys { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 14px; }
.pkey { padding: 10px 12px; background: var(--panel-2); }
.pkey .id { font: 700 13px var(--mono); color: var(--muted); }
.pkey .pts { font: 700 22px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.pkey .yuan { font: 600 14px var(--mono); }
.pkey.low .pts, .pkey.low .yuan { color: var(--bad); }
.kv-inline { display: flex; gap: 6px 22px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.kv-inline b { color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; }

.pending-card { display: block; text-decoration: none; }
.pending-card .big { font: 700 64px/1 var(--mono); font-variant-numeric: tabular-nums; }
.pending-card.has .big { color: var(--accent); }
.pending-card.has { border: 2px solid var(--accent); }
.pending-card:hover { color: var(--ink); border-color: var(--accent); }
.stats { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); background: var(--line-soft); border: 1px solid var(--line-soft); }
.stat { background: var(--panel); padding: 10px 12px; }
.stat .v { font: 700 26px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat a { text-decoration: none; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
.tbl th { font-weight: 700; color: var(--muted); font-size: 12px; white-space: nowrap; background: rgba(3, 20, 60, .2); }
.tbl td.n, .tbl th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.total td { font-weight: 800; background: var(--panel-2); }
.tbl tr.sel td { background: rgba(255, 211, 78, .08); }
.tbl .pct { display: block; font-size: 11px; color: var(--muted); }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .03); }

/* ---------- 订单卡片 ---------- */
.cards { display: grid; gap: 12px; }
@media (min-width: 1100px) { .cards.two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); padding: 14px; scroll-margin-top: 120px; min-width: 0; }
.card.hl { border: 2px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.card-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.order-code { font: 700 30px/1 var(--mono); letter-spacing: .08em; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.price { font: 700 18px var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); }
.acct { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; }
.acct img, .acct .ph { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; background: var(--panel-2); }
.acct .name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct .biz { font: 11px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-body { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 10px; }
.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; margin: 0; font-size: 13px; min-width: 0; }
.meta > div { min-width: 0; }
.meta dt { color: var(--muted); font-size: 12px; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.meta .claimed dd { font-weight: 800; }
.meta .wide { grid-column: 1 / -1; }
.voucher-thumb {
  display: block; width: 92px; height: 124px; padding: 0; border: 1px solid var(--line); background: var(--panel-2);
  cursor: zoom-in; overflow: hidden;
}
.voucher-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.voucher-none { width: 92px; height: 124px; display: grid; place-items: center; text-align: center; border: 1px dashed var(--line); color: var(--muted); font-size: 12px; padding: 6px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.card-actions .spacer { flex: 1; }
.card-actions .main-actions { display: flex; gap: 8px; margin-left: auto; }
.reject-reason { margin-top: 10px; padding: 8px 10px; border-left: 3px solid var(--bad); background: var(--bad-soft); font-size: 13px; }
.email-line { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--panel-2); margin-top: 6px; position: relative; }
.progress > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.progress.ok > i { background: var(--ok); }
.progress.bad > i { background: var(--bad); }
.pinned-title { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.more { display: flex; justify-content: center; margin-top: 14px; }

/* ---------- 任务卡片 ---------- */
.task-prog { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.task-prog .n { font: 700 20px var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 兑换码 ---------- */
.codes-result { border: 2px solid var(--accent); background: var(--sheet); padding: 16px; box-shadow: 0 12px 40px rgba(3, 20, 60, .4); }
.codes-result .warn { color: var(--accent); font-weight: 800; }
.codes-list { margin-top: 12px; max-height: 360px; overflow: auto; background: rgba(3, 20, 60, .3); padding: 10px 12px; font: 13px/1.8 var(--mono); }
.codes-list div { display: flex; gap: 14px; flex-wrap: wrap; }
.codes-list .c { color: var(--accent); font-weight: 700; }
.codes-list .u { color: var(--muted); overflow-wrap: anywhere; }
.note-edit { display: flex; gap: 6px; align-items: center; min-width: 180px; }
.note-edit .input { height: 32px; padding: 0 8px; }
.note-edit .btn { min-height: 32px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; background: var(--panel-2); margin-bottom: 10px; }

/* ---------- 配置 ---------- */
.pq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line); background: var(--panel); }
.pq > div { padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pq > div > .price-big { margin: -10px 0 0; }
.pq > div + div { border-left: 1px dashed var(--line); }
.pq .price-big { font: 700 44px/1 var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.pq .price-big small { font-size: 16px; color: var(--muted); font-family: var(--sans); }
.qr-box { width: 100%; max-width: 220px; aspect-ratio: 1 / 1; background: #fff; display: grid; place-items: center; border: 1px solid var(--line); overflow: hidden; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qr-box.none { background: var(--panel-2); color: var(--muted); font-size: 13px; text-align: center; padding: 10px; }
.qr-name { font: 700 14px var(--mono); margin-top: 8px; overflow-wrap: anywhere; }
.qr-name.bad { color: var(--bad); }
.qr-mismatch { margin-top: 10px; padding: 10px 12px; background: var(--bad); color: #3a0d05; font-weight: 700; font-size: 13px; }
.qr-match { margin-top: 10px; font-size: 13px; color: var(--ok); }
.calc { font-size: 12px; padding: 8px 10px; background: var(--panel-2); line-height: 1.7; }
.calc.bad { background: var(--bad-soft); border-left: 3px solid var(--bad); }
.calc b { font-family: var(--mono); }
.set-group + .set-group { margin-top: 16px; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: rgba(8, 44, 112, .97); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.savebar-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.savebar .grow { flex: 1; font-size: 13px; }
.savebar .btn { min-width: 96px; }

/* ---------- 弹层 ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 50; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--sheet); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.modal-head h3 { margin: 0; font-size: 20px; font-weight: 900; flex: 1; }
.modal-x { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 6px; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 14px 18px; display: grid; gap: 12px; }
.modal-body p { margin: 0; }
.modal-foot { padding: 12px 18px 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px dashed var(--line); }
.modal-foot .btn { min-height: 44px; }
.modal-err { color: var(--bad); font-size: 13px; line-height: 1.5; min-height: 20px; }
.modal .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.modal .kv dt { color: var(--muted); }
.modal .kv dd { margin: 0; overflow-wrap: anywhere; }
.modal .big-amount { font: 700 32px var(--mono); color: var(--accent); }
.modal .voucher-large { max-height: 46vh; width: auto; max-width: 100%; border: 1px solid var(--line); display: block; margin: 0 auto; }
.quick-reasons { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(3, 12, 36, .92); display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.lightbox .cap { position: fixed; top: 12px; left: 16px; right: 16px; color: var(--ink); font: 13px var(--mono); }
.fail-list { display: grid; gap: 8px; }
.fail-item { padding: 8px 10px; background: var(--panel-2); font-size: 13px; }
.fail-item .t { font-weight: 700; overflow-wrap: anywhere; }

/* ---------- toast ---------- */
#toast-root { position: fixed; z-index: 70; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { padding: 12px 14px; background: #0A2A66; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 14px; pointer-events: auto; }
.toast.ok { border-color: var(--ok); }
.toast.ok::before { content: "✔ "; color: var(--ok); }
.toast.bad { border-color: var(--bad); }
.toast.bad::before { content: "✖ "; color: var(--bad); }
body.has-savebar #toast-root { bottom: 84px; }

/* ---------- 服务商与 key ---------- */
.notice.intro ul { margin: 0; padding-left: 18px; }
.notice.intro li + li { margin-top: 2px; }
.pgroup-head { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pgroup-head h2 { margin: 0; }
.key-id { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.key-label { font-weight: 700; overflow-wrap: anywhere; }
.key-note { margin-top: 2px; max-width: 240px; overflow-wrap: anywhere; }
.key-err { color: var(--bad); font-size: 12px; display: block; max-width: 220px; overflow-wrap: anywhere; }
.key-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.keys-tbl td.n .tag { float: right; clear: both; }
.keys-tbl tr.off td:not(.c-state):not(.c-ops) { opacity: .5; }
.keys-tbl tr.flash td { background: var(--accent-soft); }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; user-select: none; white-space: nowrap; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch .track { position: relative; flex: none; width: 40px; height: 22px; border: 1px solid var(--line); background: var(--panel-2); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--muted); }
.switch input:checked + .track { background: var(--ok-soft); border-color: var(--ok); }
.switch input:checked + .track::after { left: 20px; background: var(--ok); }
.switch input:checked ~ .sw-txt { color: var(--ok); }
.switch .sw-txt { font-size: 13px; font-weight: 700; color: var(--muted); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.pkey .id { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pkey .lbl { color: var(--ink); font-family: var(--sans); font-weight: 700; overflow-wrap: anywhere; }
.pkey.off { opacity: .5; }
.add-key.locked .fgrid { opacity: .5; }
@media (max-width: 767px) {
  /* key 表格在手机上改为卡片 */
  .keys-wrap { border: 0; overflow: visible; }
  .keys-tbl, .keys-tbl tbody { display: block; }
  .keys-tbl thead { display: none; }
  .keys-tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; padding: 12px; border: 1px solid var(--line); background: var(--panel-2); }
  .keys-tbl tr + tr { margin-top: 10px; }
  .keys-tbl td, .keys-tbl td.n { display: block; padding: 0; border: 0; min-width: 0; text-align: left; white-space: normal; }
  .keys-tbl td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-family: var(--sans); margin-bottom: 2px; }
  .keys-tbl td.c-id, .keys-tbl td.c-err, .keys-tbl td.c-ops { grid-column: 1 / -1; }
  .keys-tbl td.c-id::before, .keys-tbl td.c-ops::before { display: none; }
  .keys-tbl td.c-err.none { display: none; }
  .keys-tbl td.n .tag { float: none; }
  .keys-tbl td.c-ops { border-top: 1px dashed var(--line); padding-top: 10px; }
  .key-ops .btn { flex: 1; min-height: 36px; }
  .key-err, .key-note { max-width: none; }
  .keys-tbl tbody tr:hover td { background: none; }
}

/* ---------- 手机（< 768px） ---------- */
@media (max-width: 767px) {
  body { font-size: 14px; }
  .topbar-in { flex-wrap: wrap; gap: 0 8px; padding: 0 12px; min-height: 0; }
  .brand { order: 1; min-height: 44px; display: flex; align-items: center; font-size: 15px; }
  .brand small { display: none; }
  .topbar-right { order: 2; margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -12px; padding: 0 4px; border-top: 1px solid var(--line-soft); }
  .nav a { min-height: 42px; padding: 0 10px; }
  .main { padding: 14px 12px 96px; }
  .page-head h1 { font-size: 20px; }
  .panel { padding: 12px; }
  .card { padding: 12px; }
  .order-code { font-size: 28px; }
  .card-body { grid-template-columns: 1fr 84px; gap: 10px; }
  .voucher-thumb, .voucher-none { width: 84px; height: 112px; }
  .meta { grid-template-columns: 1fr; gap: 4px; }
  .meta > div { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
  .meta dt { font-size: 12px; padding-top: 1px; }
  .card-actions .main-actions { margin-left: 0; width: 100%; display: grid; grid-template-columns: 1fr 1.6fr; }
  .card-actions .main-actions.single { grid-template-columns: 1fr; }
  .card-actions .main-actions .btn { min-height: 48px; font-size: 16px; }
  .pq { grid-template-columns: minmax(0, 1fr); }
  .pq > div { padding: 12px; }
  .pq > div + div { border-left: 0; border-top: 1px dashed var(--line); }
  .pq .price-big { font-size: 30px; }
  .provider-total { font-size: 34px; }
  .pending-card .big { font-size: 52px; }
  .modal-scrim { align-items: flex-end; padding: 0; }
  .modal { max-height: 92vh; border-left: 0; border-right: 0; border-bottom: 0; }
  .modal-foot { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .modal-foot .btn:only-child { grid-column: 1 / -1; }
  .modal-foot .btn.full { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .fgrid > [class*="c-"] { grid-column: span 12; }
  .form-actions > .btn { flex: 1 1 auto; }
  .form-actions > .form-msg { flex-basis: 100%; min-height: 0; }
  .toolbar > .input, .toolbar > select.input { flex: 1 1 100%; width: 100%; }
  .toolbar > .btn { flex: 1 1 auto; }
  .toolbar > .grow { display: none; }
  .savebar .grow { flex-basis: 100%; }
  .savebar .btn { flex: 1; }
}
