:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e4e7ec;
  --line-soft: #eef0f4;
  --text: #101828;
  --muted: #667085;
  --muted-2: #98a2b3;
  --accent: #0b5cf0;
  --accent-dk: #0846bd;
  --accent-soft: #eaf1ff;
  --green: #067647;
  --green-soft: #e7f6ee;
  --amber: #b54708;
  --amber-soft: #fef6e7;
  --red: #b42318;
  --red-soft: #fee4e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .16);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
b { font-weight: 600; }

/* ---------- 品牌 ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #1a6bff, #0846bd);
  color: #fff; font-weight: 700; font-size: 19px;
  box-shadow: 0 6px 16px -6px rgba(11, 92, 240, .7);
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.brand-sm .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.brand-sm .brand-name { font-size: 14.5px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 20px; gap: 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 20px; margin: 26px 0 6px; letter-spacing: -.2px; }
.login-card p { margin: 0 0 22px; font-size: 13px; }
.login-foot {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted);
}
.link { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

.legal {
  max-width: 620px; text-align: center;
  font-size: 12px; line-height: 1.75; color: var(--muted-2);
}

/* ---------- 表单元素 ---------- */
.field-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: #344054; margin: 0 0 7px;
}
.input {
  width: 100%; display: block;
  padding: 11px 13px;
  border: 1px solid #d0d5dd; border-radius: 10px;
  background: #fff; color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 92, 240, .12);
}
.input-code {
  font-family: var(--mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.textarea {
  min-height: 168px; resize: vertical;
  font-family: var(--mono); font-size: 13px; line-height: 1.9;
  letter-spacing: .3px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 550; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(11, 92, 240, .35); }
.btn-primary:hover:not(:disabled) { background: var(--accent-dk); }
.btn-ghost { background: #fff; border-color: #d0d5dd; color: #344054; }
.btn-ghost:hover:not(:disabled) { background: #f9fafb; border-color: #98a2b3; }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fda29b; }
.btn-danger:hover:not(:disabled) { background: #fdd6d3; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 16px; padding: 12px; }

.msg {
  margin-top: 14px; padding: 10px 13px;
  border-radius: 9px; font-size: 13px;
  background: var(--red-soft); color: var(--red);
  border: 1px solid #fda29b;
}
.msg.ok { background: var(--green-soft); color: var(--green); border-color: #a6f4c5; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.balance-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dk);
  font-size: 13px; font-weight: 600;
}
.balance-pill .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ---------- 布局 ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 24px 64px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 22px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value {
  font-size: 27px; font-weight: 650; letter-spacing: -.5px;
  margin: 4px 0 2px; font-variant-numeric: tabular-nums;
}
.stat-hint { font-size: 12px; color: var(--muted-2); }
.stat-hint b { color: var(--muted); }

/* ---------- 标签页 ---------- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative; background: none; border: 0;
  padding: 10px 16px 12px; margin-bottom: -1px;
  font: inherit; font-size: 14px; font-weight: 550;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-badge {
  display: none; margin-left: 4px; padding: 1px 6px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-dk);
  font-size: 11.5px; font-weight: 600;
}

.panel {
  display: none; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px 24px; box-shadow: var(--shadow);
}
.panel.active { display: block; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 16.5px; margin: 0 0 4px; letter-spacing: -.2px; }
.panel-head h3 { font-size: 14.5px; margin: 0; }
.panel-head p { margin: 0; font-size: 12.5px; }
.panel-head.sub {
  margin: 26px 0 12px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  align-items: center;
}
.panel-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block; padding: 5px 10px; border-radius: 7px;
  background: #f2f4f7; color: var(--muted); font-size: 12px;
}
.tag-blue { background: var(--accent-soft); color: var(--accent-dk); }

/* ---------- 服务类型 ---------- */
.service-row { margin-bottom: 18px; }
.service {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; background: #fcfcfd;
}
.service.active { border-color: var(--accent); background: #f7faff; box-shadow: 0 0 0 3px rgba(11, 92, 240, .07); }
.service input { accent-color: var(--accent); }
.service-body { flex: 1; }
.service-title { font-weight: 600; font-size: 14px; }
.service-desc { font-size: 12.5px; color: var(--muted); }
.service-price { font-weight: 650; color: var(--accent-dk); font-size: 13.5px; }

.import-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; flex-wrap: wrap;
}
.import-count {
  margin-left: auto; font-size: 13px; font-weight: 600; color: var(--accent-dk);
  font-variant-numeric: tabular-nums;
}
.file-btn { position: relative; }

.submit-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--line-soft); flex-wrap: wrap;
}
.freeze-info { font-size: 13px; color: var(--muted); }
.freeze-info b { color: var(--text); font-variant-numeric: tabular-nums; }

.result {
  margin-top: 16px; padding: 14px 16px;
  border-radius: 11px; background: var(--green-soft);
  border: 1px solid #a6f4c5; color: #05603a; font-size: 13px;
}
.result.warn { background: var(--amber-soft); border-color: #fec84b; color: var(--amber); }
.result b { font-variant-numeric: tabular-nums; }
.result .result-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ---------- 过滤 ---------- */
.filter-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.chip:hover { border-color: #98a2b3; color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px;
  color: var(--muted); background: #fafbfc;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 11px 12px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty { text-align: center; color: var(--muted-2); padding: 34px 12px; }
.col-check { width: 38px; }
.table input[type=checkbox] { accent-color: var(--accent); }
.sku { font-family: var(--mono); font-size: 12.5px; letter-spacing: .3px; }
.time { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta-pos { color: var(--green); font-weight: 600; }
.delta-neg { color: var(--amber); font-weight: 600; }
.delta-zero { color: var(--muted-2); }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
}
.pill-frozen { background: var(--accent-soft); color: var(--accent-dk); }
.pill-submitted { background: var(--amber-soft); color: var(--amber); }
.pill-done { background: var(--green-soft); color: var(--green); }
.pill-refunded { background: #f2f4f7; color: var(--muted); }
.pill-prepared { background: #eef4ff; color: #1d4ed8; border: 1px solid #c7d7fe; }

/* ---------- 充值 ---------- */
.redeem-row { display: flex; gap: 10px; align-items: stretch; }
.redeem-row .input { flex: 1; font-size: 13.5px; }

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 28px; text-align: center;
  font-size: 12px; color: var(--muted-2);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #101828; color: #fff;
  padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 100;
  max-width: 90vw;
}
.toast.err { background: #7a271a; }


/* ---------- 材料包 ---------- */
.form-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.form-grid .input { font-size: 13.5px; }
.req { color: var(--red); }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dropzone {
  border: 1px dashed #d0d5dd; border-radius: 12px;
  padding: 16px; background: #fcfcfd;
}
.dz-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.dz-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.asset-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.asset-item {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 7px 9px; font-size: 12.5px;
}
.asset-item .an { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-item .as { color: var(--muted-2); font-variant-numeric: tabular-nums; }
.asset-item button {
  border: 0; background: none; color: var(--muted-2); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px;
}
.asset-item button:hover { color: var(--red); }
.asset-empty { font-size: 12.5px; color: var(--muted-2); }

.pack-box {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 20px; padding: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: #f7faff;
  flex-wrap: wrap;
}
.pack-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }

@media (max-width: 860px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .pack-box { flex-direction: column; align-items: stretch; }
  .pack-box .btn { width: 100%; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .wrap { padding: 18px 14px 48px; }
  .topbar-inner { padding: 10px 14px; }
  .panel { padding: 18px 16px; }
  .login-card { padding: 24px 20px; }
  .who { display: none; }
  .stat-value { font-size: 23px; }
  .redeem-row { flex-direction: column; }
  .submit-bar { flex-direction: column; align-items: stretch; }
  .submit-bar .btn { width: 100%; }
}
