/* 美客多利润计算器 —— 样式（CSS 变量 / 移动端优先 / 深色模式） */

/* ===== 浅色（默认） ===== */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1a2b25;
  --muted: #6b7b74;
  --brand: #0f6f4f;
  --brand-2: #149e72;
  --accent: #f5a623;
  --border: #e3e8e6;
  --input-bg: #f7f9f9;
  --toggle-off: #e3e8e6;
  --toggle-on: #0f6f4f;
  --net: #0f6f4f;
  --shadow: 0 2px 12px rgba(15, 111, 79, .08);
  --ok: #1f9d5b;
  --err: #d9534f;
}

/* ===== 深色（手动） ===== */
[data-theme="dark"] {
  --bg: #0f1214;
  --card: #1a1f22;
  --text: #e6edea;
  --muted: #8b9a93;
  --brand: #2bbf8e;
  --brand-2: #36c89a;
  --accent: #f5a623;
  --border: #2a3236;
  --input-bg: #232a2e;
  --toggle-off: #2a3236;
  --toggle-on: #2bbf8e;
  --net: #4fd6a3;
  --shadow: 0 2px 12px rgba(0, 0, 0, .45);
  --ok: #36c89a;
  --err: #ff7a75;
}

/* ===== 深色（跟随系统，未手动设置时） ===== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0f1214;
    --card: #1a1f22;
    --text: #e6edea;
    --muted: #8b9a93;
    --brand: #2bbf8e;
    --brand-2: #36c89a;
    --accent: #f5a623;
    --border: #2a3236;
    --input-bg: #232a2e;
    --toggle-off: #2a3236;
    --toggle-on: #2bbf8e;
    --net: #4fd6a3;
    --shadow: 0 2px 12px rgba(0, 0, 0, .45);
    --ok: #36c89a;
    --err: #ff7a75;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  transition: background-color .25s ease, color .25s ease;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 4px 12px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-2) transparent;
}
main::-webkit-scrollbar { width: 6px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: var(--brand-2); border-radius: 3px; }

/* 各一级视图填满 main 并在自身内部滚动（避免整页无限滚动） */
#viewCalc, #viewRules, #viewAccounting, #viewSystem, #viewWeather {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#viewSystem { display: flex; flex-direction: column; }

/* ===== 头部 ===== */
.app-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 5px 14px;
  flex: 0 0 auto;
}
.app-header-row {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.app-header h1, .app-header .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header h1 { font-size: 16px; margin: 0; line-height: 1.3; }
.app-header .sub { font-size: 11px; margin: 0; opacity: .9; }
.footer-date { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 0; text-align: center; }


/* ===== 顶部 Tab 切换：利润计算 / 运费规则 / 主题 ===== */
.app-tabs {
  display: flex; gap: 8px;
  flex: 0 0 auto;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 12px;
  background: var(--bg);
}
.app-tab, .theme-tab {
  border: 1px solid var(--border); border-radius: 11px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.app-tab {
  flex: 1; background: var(--card); color: var(--muted);
  padding: 8px 0; font-size: 13px; font-weight: 700;
}
.app-tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.app-tab { position: relative; }
.tab-badge {
  position: absolute; top: -6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #e53935; color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.tab-badge.pulse { animation: badgePulse .7s ease 3; }
@keyframes badgePulse {
  0%   { transform: scale(1);    box-shadow: 0 1px 3px rgba(0,0,0,.3); }
  50%  { transform: scale(1.45); box-shadow: 0 0 0 6px rgba(229,57,53,.25); }
  100% { transform: scale(1);    box-shadow: 0 1px 3px rgba(0,0,0,.3); }
}
.theme-tab {
  flex: 0 0 auto; padding: 8px 10px; font-size: 12px; font-weight: 600;
  background: var(--input-bg); color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.theme-tab:active { background: var(--toggle-off); }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  margin-top: 4px;
  box-shadow: var(--shadow);
}
.card-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--brand);
}

/* ===== 汇率（紧凑单行） ===== */
.rate-card { padding: 8px 12px; }
.rate-top { display: flex; align-items: center; gap: 6px; }
.rate-label { font-size: 13px; font-weight: 700; color: var(--brand); flex: 0 0 auto; }
.rate-main { display: flex; align-items: baseline; gap: 3px; flex: 0 0 auto; margin-left: auto; }
.rate-num { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1; }
.rate-unit { font-size: 12px; color: var(--muted); }
.rate-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 11px; }

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

/* ===== 表单 ===== */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.field > span { font-size: 11px; color: var(--muted); }
.field.full { margin-top: 8px; }
.field input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 14px;
  outline: none;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 22%, transparent); }

/* 商品参数：两列大字体布局（进价/希望利润/重量 + 长/宽/高） */
.param-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.param-col { display: flex; flex-direction: column; gap: 10px; }
.param-cols .field > span { font-size: 12px; }
.param-cols .field input { font-size: 16px; padding: 10px 12px; }
.param-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

.weight-info {
  display: flex; gap: 10px; margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--border); font-size: 12px;
}
.weight-info > div { flex: 1; display: flex; flex-direction: column; }
.weight-info b { font-size: 14px; color: var(--text); }
.weight-info .hl b { color: var(--brand); }

/* ===== 结果表 ===== */
.table-wrap { overflow-x: auto; }
.result-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.result-table th, .result-table td { padding: 6px 5px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.result-table th { color: var(--muted); font-weight: 600; font-size: 11px; }
.result-table td.net { font-weight: 800; color: var(--net); }
.formula { margin: 8px 0 0; line-height: 1.5; }

/* ===== 包邮开关 ===== */
.toggle { display: inline-flex; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.toggle button {
  border: none; background: var(--toggle-off); color: var(--text);
  padding: 5px 8px; font-size: 12px; cursor: pointer; transition: background .15s, color .15s;
}
.toggle button.on { background: var(--toggle-on); color: #fff; }

/* ===== 按钮 ===== */
.btn {
  border: none; background: var(--brand); color: #fff;
  border-radius: 12px; padding: 9px 14px; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: filter .15s, transform .05s; width: 100%;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-mini { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 10px; background: var(--brand); color: #fff; flex: 0 0 auto; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }

.btn-row { display: flex; gap: 6px; }
.btn-row .btn { width: auto; flex: 1; }

/* ===== 进度 ===== */
.progress { margin: 12px 0 4px; }
.progress.hidden, .hidden { display: none !important; }
.progress-bar { height: 8px; background: var(--toggle-off); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .3s ease; }
.status-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 12.5px; }
.status-list li { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.status-list li.ok { color: var(--ok); }
.status-list li.err { color: var(--err); }

/* ===== 弹层（改页面链接） ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal-box {
  background: var(--card); color: var(--text); width: 100%; max-width: 560px;
  border-radius: 18px 18px 0 0; padding: 16px; max-height: 85vh; overflow-y: auto;
  display: flex; flex-direction: column;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-tip { font-size: 12px; line-height: 1.5; margin: 0 0 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button {
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 99px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.edit-body label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.edit-body input[type="url"], .edit-body input[type="text"] {
  width: 100%; border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
}
.edit-body input:focus { border-color: var(--brand); }
.edit-test-msg { font-size: 12.5px; margin-top: 8px; min-height: 18px; }
.edit-test-msg.ok { color: var(--ok); }
.edit-test-msg.err { color: var(--err); }
.modal-foot { display: flex; gap: 8px; margin-top: 16px; }
.modal-foot .btn { flex: 1; }

/* 退出确认：居中对话框（区别于底部抽屉弹窗） */
#exitConfirm { align-items: center; }
.exit-confirm-box { max-width: 320px; border-radius: 16px; animation: none; }
.exit-confirm-text { font-size: 15px; font-weight: 600; margin: 4px 0 6px; color: var(--text); }
.exit-confirm-sub { font-size: 12px; line-height: 1.5; margin: 0; }

/* 记账编辑弹窗 */
.acc-edit-box { max-height: 92vh; }
.acc-edit-body { overflow-y: auto; }
.acc-edit-body .grid2 { margin-top: 10px; }
.acc-edit-body .field { margin-top: 10px; }
#accEditPreview { margin-top: 8px; }
#accEditPreview img { max-width: 100%; max-height: 180px; border-radius: 10px; display: block; }
.acc-edit-remove { margin-top: 6px; border: 1px solid var(--border); background: var(--input-bg); color: var(--err); border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; }

.app-footer { text-align: center; margin-top: 0; padding: 2px 0 4px; font-size: 11px; }

/* ===== 汇率换算（最底部：各国汇率 + 当地货币/美元/人民币 表格） ===== */
.rate-detail { font-size: 13px; }
.rd-head { font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.rd-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rd-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 5px 9px;
}
.rd-chip i { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.rd-chip b { font-size: 12px; color: var(--text); white-space: nowrap; }
.rate-table td.rd-local { color: var(--text); font-weight: 700; }
.rate-table td.rd-cny { color: var(--accent); font-weight: 700; }

/* ===== 运费规则明细（国家 Tab） ===== */
.rd-country-head { font-size: 14px; font-weight: 700; margin: 4px 0 8px; }
.rules-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rules-table th, .rules-table td { padding: 5px 4px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rules-table th { color: var(--muted); font-weight: 600; font-size: 11px; }
#rulesTabs { margin-bottom: 10px; }

/* ===== 桌面端更好看 ===== */
@media (min-width: 600px) {
  .modal { align-items: center; padding: 16px; }
  .modal-box { border-radius: 18px; }
}

/* ===== 授权锁屏 ===== */
/* 临时模式横幅（授权服务器不可达时提示已跳过校验，2026-10-04 起） */
.temp-banner { margin: 8px 12px 0; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  background: #fff8e6; border: 1px solid #f0d49a; color: #8a5a00; }
@media (prefers-color-scheme: dark) {
  .temp-banner { background: #2e2410; border-color: #6b5320; color: #f0c674; }
}
.lic-lock { position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; }
.lic-card { width: 100%; max-width: 340px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.25); text-align: center; }
.lic-logo { font-size: 40px; margin-bottom: 6px; }
.lic-card h2 { margin: 0 0 8px; font-size: 20px; color: var(--text); }
.lic-card .muted { font-size: 13px; line-height: 1.6; margin: 0 0 18px; }
.lic-card .field { text-align: left; margin-bottom: 14px; }
.lic-card .field input { letter-spacing: 1px; text-transform: uppercase; }
.lic-card .btn { width: 100%; }
.lic-msg { margin-top: 12px; font-size: 13px; min-height: 18px; color: #e5484d; }
.lic-msg.ok { color: #46a758; }

/* ===== 系统：资讯 + 授权码 + 外观 ===== */
#viewSystem { display: flex; flex-direction: column; gap: 10px; min-height: 0; height: 100%; }
#viewSystem .code-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 14px 16px;
}
.code-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex: 0 0 auto; }
.code-status-tabs { flex: 0 0 auto; }
.code-action-row { flex: 0 0 auto; }
.help-icon { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); color: var(--muted); font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.help-icon:active { transform: scale(.96); }

/* 授权码列表：单独滚动 */
.codes-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-2) transparent;
  margin: 0 -4px;
  padding: 0 4px;
}
.codes-list-scroll::-webkit-scrollbar { width: 5px; }
.codes-list-scroll::-webkit-scrollbar-track { background: transparent; }
.codes-list-scroll::-webkit-scrollbar-thumb { background: var(--brand-2); border-radius: 3px; }

/* 类别 1：管理员 / 用户（分段控制器） —— 注意：不能用 flex:1 撑高，否则会占据整块面板 */
.code-kind-tabs { flex: 0 0 auto; display: flex; gap: 3px; padding: 2px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px; }
.code-kind-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 3px 6px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.code-kind-tab .tab-icon { font-size: 12px; line-height: 1; }
.code-kind-tab.on { background: var(--card); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 类别 2：未使用 / 已使用（文字 tab） */
.code-status-tabs { display: flex; gap: 14px; margin: 0 0 6px; padding: 0 2px; border-bottom: 1px solid var(--border); }
.code-status-tab { position: relative; padding: 4px 2px 6px; border: none; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; transition: color .15s; }
.code-status-tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--brand); transform: scaleX(0); transition: transform .2s; }
.code-status-tab.on { color: var(--text); font-weight: 600; }
.code-status-tab.on::after { transform: scaleX(1); }

/* 类别 3：生成 / 刷新操作（一行紧凑） */
.code-action-row { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.code-action-row .stepper { display: flex; align-items: center; background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex: 0 0 auto; }
.code-action-row .stepper-btn { width: 34px; height: 36px; border: none; background: transparent; color: var(--text); font-size: 17px; line-height: 1; cursor: pointer; transition: background .15s; }
.code-action-row .stepper-btn:active { background: var(--border); }
.code-action-row .stepper-input { width: 48px; height: 36px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: transparent; color: var(--text); text-align: center; font-size: 15px; font-weight: 600; -moz-appearance: textfield; }
.code-action-row .stepper-input::-webkit-outer-spin-button,
.code-action-row .stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.code-action-row .btn { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.code-action-row .btn-primary { flex: 1; }
.code-action-row .btn-icon { width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }

/* 授权码列表 */
.codes-list { display: flex; flex-direction: column; gap: 8px; }
.code-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); transition: transform .1s, box-shadow .1s, border-color .1s; cursor: pointer; }
.code-item:active { transform: scale(.995); }
.code-item:hover { border-color: var(--brand-2); box-shadow: var(--shadow); }
.code-item .code-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; letter-spacing: .5px; color: var(--text); }
.code-item .code-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.code-actions { display: flex; align-items: center; gap: 8px; }
.code-badge { font-size: 12px; padding: 5px 11px; border-radius: 20px; color: #fff; white-space: nowrap; }
.code-badge.unused { background: #1a9e4b; }   /* 绿：未使用 */
.code-badge.active { background: #8a9499; }   /* 灰：已使用 */
.code-badge.revoked { background: #c0392b; }  /* 红：已吊销 */
.code-info-btn { font-size: 12px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--input-bg); color: var(--accent); cursor: pointer; white-space: nowrap; }
.code-info-btn:hover { background: var(--accent); color: #1a1a1a; }
.code-act-btn { font-size: 12px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); cursor: pointer; white-space: nowrap; }
.code-act-btn:hover { border-color: var(--brand-2); color: var(--accent); }

/* 授权码详情视图（点击列表项进入） */
.codes-detail { display: flex; flex-direction: column; gap: 10px; }
.codes-detail-back { align-self: flex-start; background: transparent; border: none; color: var(--accent); font-size: 13px; padding: 4px 2px; cursor: pointer; }
.codes-detail-back:hover { text-decoration: underline; }
.codes-detail-body { display: flex; flex-direction: column; gap: 8px; }
.codes-detail-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.codes-detail-card .code-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: .5px; color: var(--text); font-weight: 600; }
.codes-detail-card .code-meta { font-size: 12px; color: var(--muted); }
.codes-detail-card .detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.codes-detail-card .detail-actions .btn { flex: 1; min-width: 0; }

/* 功能权限弹窗 */
.perm-groups { display: flex; flex-direction: column; gap: 12px; max-height: 46vh; overflow-y: auto; }
.perm-group-name { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.perm-items { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-item { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--input-bg); cursor: pointer; user-select: none; }
.perm-item input { margin: 0; width: auto; }
.perm-item:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft, rgba(255, 205, 40, .15)); }
.perm-input { width: 100%; min-width: 0; margin-top: 10px; }
#permTip, #editCodeTip { margin: 0 0 8px; word-break: break-all; }

/* 说明弹窗内容 */
.help-body { font-size: 14px; line-height: 1.7; color: var(--text); }
.help-body p { margin: 0 0 10px; }
.help-body ul { margin: 0 0 14px; padding-left: 20px; color: var(--muted); }
.help-body li { margin-bottom: 4px; }
.help-legend { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-item .dot.unused { background: #1a9e4b; }
.legend-item .dot.active { background: #8a9499; }
.legend-item .dot.revoked { background: #c0392b; }

/* 复制提示 toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: rgba(20,25,28,.94); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 设备信息详情 */
.device-info { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 4px; }
.di-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px solid var(--border); font-size: 14px; }
.di-row:last-child { border-bottom: none; }
.di-k { color: var(--muted); flex: none; }
.di-v { color: var(--text); text-align: right; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* 系统：菜单入口列表 */
.system-menu-card { padding: 10px; }
.sys-menu-list { display: flex; flex-direction: column; }
.sys-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: none; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--text); font-size: 15px; cursor: pointer;
  text-align: left; transition: background .12s;
}
.sys-menu-item:last-child { border-bottom: none; }
.sys-menu-item:active { background: var(--input-bg); }
.sys-menu-icon { font-size: 18px; width: 24px; text-align: center; flex: none; }
.sys-menu-label { flex: 1; min-width: 0; }
.sys-menu-value { font-size: 13px; color: var(--muted); flex: none; }
.sys-menu-arrow { font-size: 18px; color: var(--muted); flex: none; margin-left: 4px; }

/* 系统：二级面板 */
.system-panel { padding: 12px; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.system-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sys-back {
  border: none; background: transparent; color: var(--brand); font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 4px 6px; border-radius: 8px; flex: none;
}
.sys-back:active { background: var(--input-bg); }
.system-panel-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }

/* 系统：资讯（顶部分类切换 + 单类列表） */
.sys-news-source { font-size: 12px; color: var(--muted); margin-bottom: 8px; flex: 0 0 auto; }
.sys-news-list { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.sys-news-tabs { flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 8px; margin-bottom: 6px; }
.sys-news-tabs::-webkit-scrollbar { display: none; }
.sys-news-tab { flex: 0 0 auto; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); border-radius: 99px; padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.sys-news-tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.sys-news-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }

.sys-news-feed { border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.sys-news-feed-title { font-size: 13px; font-weight: 700; color: var(--text); padding: 10px 12px; background: var(--input-bg); border-bottom: 1px solid var(--border); }
.sys-news-feed-items { display: flex; flex-direction: column; }

.sys-news-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; text-decoration: none; border-bottom: 1px solid var(--border); }
.sys-news-item:last-child { border-bottom: none; }
.sys-news-rank { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--input-bg); color: var(--muted); font-size: 12px; font-weight: 700; flex: none; }
.sys-news-item:nth-child(1) .sys-news-rank { background: #ffe0d0; color: #d9534f; }
.sys-news-item:nth-child(2) .sys-news-rank { background: #e8f0e8; color: #5cb85c; }
.sys-news-item:nth-child(3) .sys-news-rank { background: #fff3cd; color: #f0ad4e; }
.sys-news-main { min-width: 0; flex: 1; }
.sys-news-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.45; word-break: break-word; white-space: normal; }
.sys-news-line-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.sys-news-meta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.sys-news-tag { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--input-bg); color: var(--muted); }
.sys-news-hot { font-size: 11px; color: var(--accent); flex: none; }
.sys-news-error { font-size: 13px; color: #c0392b; text-align: center; padding: 16px 12px; }

.sys-news-feed-quote .sys-news-feed-items { padding: 12px; }
.sys-news-quote { text-align: center; }
.sys-news-quote-text { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.6; }
.sys-news-quote .sys-news-meta { margin-top: 8px; }

/* 资讯条目可点击查看详情 */
.sys-news-item, .sys-news-quote { cursor: pointer; transition: background .12s; }
.sys-news-item:active, .sys-news-quote:active { background: var(--input-bg); }
.sys-news-item::after { content: '›'; margin-left: auto; align-self: center; color: var(--muted); font-size: 18px; font-weight: 700; flex: none; padding-left: 6px; }

/* 资讯 / 每日 详情：整页视图（点击条目进入，自带返回，返回不退出 App） */
.page-detail { position: fixed; inset: 0; z-index: 1200; background: var(--bg); display: flex; flex-direction: column; }
.page-detail-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--card); }
.page-detail-back { font-size: 15px; font-weight: 600; }
.page-detail-tag { font-size: 13px; color: var(--muted); font-weight: 600; }
.page-detail-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 32px; }
.pd-title { font-size: 19px; font-weight: 700; line-height: 1.5; margin: 0 0 10px; color: var(--text); word-break: break-word; }
.pd-hot { color: var(--err); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.pd-meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.pd-desc { font-size: 15px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; background: var(--input-bg); color: var(--text); padding: 12px 14px; border-radius: 10px; margin-bottom: 10px; }
.pd-link { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pd-link-label { color: var(--muted); flex: none; }
.pd-link-text { flex: 1; min-width: 0; word-break: break-all; color: var(--brand); }
.pd-view, .pd-ext { align-self: flex-start; margin-bottom: 8px; }
.pd-frame-wrap { margin-top: 4px; }
.pd-frame-wrap iframe { width: 100%; height: 62vh; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.pd-frame-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.pd-example { font-size: 14px; color: var(--text); background: var(--input-bg); border-radius: 10px; padding: 11px 13px; margin-bottom: 10px; }
.pd-ex-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pd-extract { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.pd-extract-text { font-size: 13px; color: var(--text); line-height: 1.7; white-space: pre-wrap; max-height: 34vh; overflow-y: auto; background: var(--input-bg); border-radius: 10px; padding: 11px 13px; margin-top: 10px; }

/* 系统：店铺管理（内嵌 iframe，填满面板，禁止跳出 App） */
.store-frame-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.store-frame-wrap iframe { flex: 1 1 auto; min-height: 0; width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.store-frame-note { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 每日精选 */
.daily-card { display: flex; flex-direction: column; }
.daily-sub { font-size: 12px; margin: -4px 0 10px; }
.daily-list { display: flex; flex-direction: column; gap: 14px; }
.daily-sec { background: var(--input-bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.daily-sec-label { font-size: 14px; font-weight: 700; color: var(--brand); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--card); }
.daily-sec-item { padding: 11px 14px; cursor: pointer; transition: background .15s; border-bottom: 1px solid var(--border); }
.daily-sec-item:last-child { border-bottom: none; }
.daily-sec-item:active { background: var(--brand-2); }
.daily-item-title { font-size: 14px; color: var(--text); line-height: 1.45; }
.daily-item-meta { font-size: 12px; margin-top: 3px; }
.daily-item-desc { font-size: 12px; line-height: 1.55; margin-top: 4px; white-space: normal; word-break: break-word; }
.daily-sec-hint { font-size: 12px; margin-top: 4px; }
.daily-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.daily-empty { padding: 20px; text-align: center; color: var(--muted); }

/* 资讯（实时资讯 + 每日精选，水平栏目切换） */
.news-head { display: flex; align-items: center; justify-content: space-between; }
.news-refresh { font-size: 13px; font-weight: 700; }
.news-sub { font-size: 12px; margin: -4px 0 8px; }
.news-source { font-size: 11px; margin-top: 6px; }
.news-cats { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 8px; margin-bottom: 4px; }
.news-cats::-webkit-scrollbar { display: none; }
.news-cat { flex: 0 0 auto; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); border-radius: 99px; padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.news-cat.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.news-cat-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
.news-radar-frame { width: 100%; height: 100%; min-height: 72vh; border: none; border-radius: 10px; background: #fff; }
#sysPanelNews { padding: 12px; gap: 8px; }
#sysPanelNews .system-panel-head { margin-bottom: 0; }
#sysPanelNews .news-sub { margin: -2px 0 0; }
#sysPanelNews .news-source { font-size: 11px; margin-top: -4px; }

/* 每日详情弹窗（旧弹窗样式，保留以备回退，当前详情改为整页 #pageDetail） */
.daily-detail-box { max-width: 520px; }
.daily-detail-body { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.daily-detail-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.5; }
.daily-detail-desc { font-size: 14px; color: var(--text); line-height: 1.7; white-space: pre-wrap; }
.daily-detail-example { font-size: 13px; color: var(--text); background: var(--input-bg); border-radius: 10px; padding: 10px 12px; }
.daily-ex-label { font-size: 12px; margin-bottom: 4px; }
.daily-detail-extract { border-top: 1px solid var(--border); padding-top: 10px; }
.daily-detail-extract-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.daily-detail-extract-text { font-size: 13px; color: var(--text); line-height: 1.7; white-space: pre-wrap; max-height: 28vh; overflow-y: auto; background: var(--input-bg); border-radius: 10px; padding: 10px 12px; }


/* 系统：外观分段控制器 */
.look-segments { display: flex; gap: 0; background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.look-seg { flex: 1; border: none; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 8px; cursor: pointer; transition: background .15s, color .15s; }
.look-seg + .look-seg { border-left: 1px solid var(--border); }
.look-seg.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* 系统：授权码面板内微调 */
#sysPanelCodes.code-card { padding: 10px 12px 12px; }
#sysPanelCodes .system-panel-head { margin-bottom: 6px; }
#sysPanelCodes .code-kind-tabs { margin-bottom: 4px; }
#sysPanelCodes .code-status-tabs { margin-bottom: 4px; }
#sysPanelCodes .code-action-row { margin-bottom: 6px; }
#sysPanelCodes .codes-list-scroll { max-height: 66vh; }

/* ===== 记账 ===== */
/* 记账视图：分段 tab + 两个面板，面板占满剩余高度（最近记录不再被压扁） */
#viewAccounting { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.acc-seg-tabs { display: flex; gap: 14px; margin: 0 0 2px; padding: 0 2px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.acc-seg-tab { position: relative; padding: 7px 2px 9px; border: none; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; transition: color .15s; }
.acc-seg-tab.on { color: var(--text); font-weight: 700; }
.acc-seg-tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--brand); }
/* 订单页拉店铺列表失败时的横条提示 + 重试按钮（避免只剩 1 个店铺时一脸懵） */
.order-fetch-error { background: #fff7e6; color: #d97706; border: 1px solid #ffd591; border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.order-fetch-error .link-btn { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 4px; padding: 2px 10px; cursor: pointer; font-size: 13px; }
.order-fetch-error .link-btn:hover { background: rgba(217, 119, 6, 0.1); }
/* 订单状态筛选条 */
.order-status-filter { display: flex; gap: 6px; margin: 4px 0 8px; flex-wrap: wrap; }
.status-filter-tab {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel, transparent); color: var(--muted);
  font-size: 13px; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 4px;
}
.status-filter-tab:hover { border-color: var(--brand); color: var(--text); }
.status-filter-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.status-filter-tab .sf-count {
  display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 8px;
  background: rgba(127, 127, 127, .18); font-size: 11px; line-height: 16px; text-align: center;
}
.status-filter-tab.on .sf-count { background: rgba(255, 255, 255, .25); }
/* ---------- 天气页 ---------- */
.weather-group-tabs { margin: 6px 0 2px; }
.weather-city-tabs { display: flex; gap: 6px; margin: 8px 0 10px; flex-wrap: wrap; }
.weather-city-chip {
  padding: 3px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; transition: all .15s;
}
.weather-city-chip:hover { border-color: var(--brand); color: var(--text); }
.weather-city-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.weather-body { margin-top: 2px; }
.weather-empty { padding: 22px 10px; text-align: center; color: var(--muted); font-size: 14px; }
.weather-empty .link-btn { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 4px; padding: 2px 10px; cursor: pointer; font-size: 13px; margin-left: 6px; }
.weather-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: linear-gradient(135deg, rgba(15, 111, 79, .08), rgba(20, 158, 114, .04));
  margin-bottom: 10px;
}
.weather-head-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.weather-now-icon { font-size: 30px; line-height: 1; }
.weather-now-city { font-size: 17px; font-weight: 700; color: var(--text); }
.weather-now-text { font-size: 13px; color: var(--muted); margin-top: 2px; }
.weather-season-badge {
  flex: 0 0 auto; padding: 4px 12px; border-radius: 999px; font-size: 12px;
  background: var(--brand); color: #fff; font-weight: 600; white-space: nowrap;
}
/* 近期节日 / 大促提醒 */
.weather-holidays {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 10px;
  background: var(--card);
}
.hol-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(245, 166, 35, .14), rgba(245, 166, 35, .04));
}
.hol-title { font-size: 13px; font-weight: 700; color: var(--text); }
.hol-count { font-size: 12px; color: var(--muted); }
.hol-list { max-height: 260px; overflow-y: auto; }
.hol-row {
  display: grid; grid-template-columns: 84px 1fr auto auto;
  align-items: center; gap: 8px; padding: 7px 12px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.hol-row:last-child { border-bottom: none; }
.hol-row.hol-sale { background: rgba(245, 166, 35, .08); }
.hol-date { display: flex; flex-direction: column; line-height: 1.25; color: var(--text); font-weight: 600; }
.hol-dow { font-size: 11px; font-weight: 400; color: var(--muted); }
.hol-name { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hol-flag { margin-right: 4px; }
.hol-kind {
  font-size: 11px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.hol-left { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hol-left.hot { color: var(--accent); font-weight: 700; }
.hol-foot { padding: 6px 12px; font-size: 11px; border-top: 1px solid var(--border); }
@media (max-width: 420px) {
  .hol-row { grid-template-columns: 74px 1fr auto; }
  .hol-kind { display: none; }
}
.weather-days { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.weather-day {
  display: grid; grid-template-columns: 74px 34px 1fr auto 76px;
  align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.weather-day:last-child { border-bottom: none; }
.weather-day.today { background: rgba(15, 111, 79, .06); }
.wd-date { display: flex; flex-direction: column; line-height: 1.25; }
.wd-label { font-weight: 600; color: var(--text); }
.wd-dow { font-size: 11px; color: var(--muted); }
.wd-icon { font-size: 20px; text-align: center; }
.wd-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.wd-desc { color: var(--text); }
.wd-extra { font-size: 11px; color: var(--muted); }
.wd-temp { text-align: right; white-space: nowrap; }
.wd-max { font-weight: 700; color: #d9534f; }
.wd-min { color: #1f9d5b; margin-left: 6px; }
.wd-season { text-align: right; font-size: 11px; color: var(--muted); }
.weather-foot { margin-top: 8px; text-align: right; font-size: 12px; }
@media (max-width: 420px) {
  .weather-day { grid-template-columns: 60px 28px 1fr auto; }
  .wd-season { display: none; }
}
/* 底部 Tab 增至 6 个：窄屏允许横向滑动，避免挤压换行 */
.app-tabs { overflow-x: auto; scrollbar-width: none; }
.app-tabs::-webkit-scrollbar { display: none; }
.app-tab { flex: 1 0 auto; min-width: 60px; white-space: nowrap; }
.status-filter-tab { background: var(--input-bg); color: var(--muted); border: 1px solid var(--border); border-radius: 14px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all .15s; }
.status-filter-tab:hover { border-color: var(--brand); color: var(--brand); }
.status-filter-tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.status-filter-tab .sf-count { display: inline-block; min-width: 16px; text-align: center; background: rgba(255,255,255,.25); border-radius: 8px; padding: 0 4px; margin-left: 3px; font-size: 11px; }
.status-filter-tab:not(.on) .sf-count { background: var(--toggle-off); color: var(--muted); }
[data-theme="dark"] .order-fetch-error { background: #2a2415; color: #ffc107; border-color: #5a4a1a; }
[data-theme="dark"] .order-fetch-error .link-btn:hover { background: rgba(255,193,7,.1); }
#viewAccounting .accounting-card, #viewAccounting .accounting-list-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#viewAccounting .accounting-list-card { padding: 10px; }
#viewAccounting .acc-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.accounting-card .card-title { margin-bottom: 8px; }
.accounting-modes { display: flex; gap: 6px; margin-bottom: 8px; }
.acc-mode {
  flex: 1; border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 99px; padding: 6px 8px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.acc-mode.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.acc-image-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.acc-image-row .btn-mini { width: auto; padding: 6px 12px; font-size: 12px; }
.acc-preview { position: relative; max-width: 150px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; margin-bottom: 8px; cursor: zoom-in; }
.acc-preview img { width: 100%; height: auto; max-height: 150px; object-fit: cover; display: block; }
.acc-preview-remove {
  position: absolute; top: 4px; right: 4px;
  border: none; border-radius: 12px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 12px; line-height: 1; padding: 5px 9px; cursor: pointer;
}
.acc-preview-remove:active { background: rgba(0,0,0,.85); }
.acc-preview-hint { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.acc-edit-hint { font-size: 12px; color: var(--accent); margin-bottom: 8px; font-weight: 600; }
.acc-server { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.acc-server .muted { font-size: 12px; white-space: nowrap; }
.acc-server input { flex: 1; min-width: 0; font-size: 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); }
.acc-sync-status { font-size: 11px; color: var(--muted); margin: -4px 0 10px; }

/* 记账图片点击放大 */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox.hidden { display: none; }
.accounting-card .grid2 { gap: 6px; margin-bottom: 6px; }
.accounting-card .field > span { font-size: 11px; }
.accounting-card .field input,
.accounting-card .field select {
  width: 100%; border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 9px; padding: 6px 9px; font-size: 14px; outline: none; appearance: none;
}
.accounting-card .field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7b74' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px; }
.accounting-card .field input:focus,
.accounting-card .field select:focus { border-color: var(--brand); }
.accounting-card .btn-row { margin-top: 10px; }
.accounting-card .btn-row .btn { padding: 8px 10px; font-size: 13px; }

/* 记账表单：内部滚动（高度由 #viewAccounting flex 布局决定） */
.accounting-card { overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* 渠道/店铺字段：下拉 + ＋ 按钮一行 */
.acc-select-field > .select-add { display: flex; align-items: stretch; gap: 6px; }
.acc-select-field > .select-add select { flex: 1; min-width: 0; }
.add-opt-btn {
  flex: 0 0 auto; width: 34px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--input-bg); color: var(--brand); font-size: 18px; font-weight: 700;
  line-height: 1; cursor: pointer;
}
.add-opt-btn:active { background: var(--brand); color: #fff; }

/* 最近记录：占满高度，内部滚动 */
.accounting-list-card { display: flex; flex-direction: column; }
.acc-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 2px; }
.acc-list::-webkit-scrollbar { width: 5px; }
.acc-list::-webkit-scrollbar-thumb { background: var(--brand-2); border-radius: 3px; }
.acc-pager { flex: 0 0 auto; }
.acc-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  cursor: pointer;
}
.acc-item:hover { border-color: var(--brand-2); box-shadow: var(--shadow); }
.acc-item:active { transform: scale(.995); }
.acc-item-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); flex: 0 0 auto; }
.acc-item-main { min-width: 0; }
.acc-item-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.acc-item-right { text-align: right; }
.acc-item-amount { font-size: 15px; font-weight: 800; color: var(--brand); }
.acc-item-del { font-size: 11px; color: var(--err); background: transparent; border: none; padding: 2px 4px; cursor: pointer; }
.acc-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 14px 0; }

.acc-stats-body { display: flex; flex-direction: column; gap: 10px; }
.acc-stat { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--input-bg); border-radius: 10px; }
.acc-stat span { font-size: 12px; color: var(--muted); }
.acc-stat b { font-size: 18px; color: var(--brand); }
.acc-stat-total { background: var(--brand); }
.acc-stat-total span { color: rgba(255,255,255,.85); }
.acc-stat-total b { color: #fff; font-size: 22px; }
.acc-month-detail { display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.acc-month-row { display: flex; justify-content: space-between; padding: 6px 8px; border-bottom: 1px dashed var(--border); font-size: 13px; }

/* 批量添加确认弹层 */
.acc-batch-body { max-height: 56vh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 0; }
.acc-batch-tip { font-size: 11px; color: var(--muted); margin: 0 0 8px; }
.acc-batch-list { display: flex; flex-direction: column; gap: 8px; }
.acc-batch-row {
  display: grid; grid-template-columns: 20px 1fr 62px 60px 66px 46px 30px; align-items: center; gap: 6px;
  padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  font-size: 13px;
}
.acc-batch-row .muted { font-size: 11px; }
.acc-batch-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-batch-amt { font-weight: 700; color: var(--brand); text-align: right; }
.acc-batch-channel, .acc-batch-date { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.acc-batch-add { flex: none; width: 46px; padding: 5px 0; font-size: 12px; font-weight: 600; border: none; border-radius: 7px; background: var(--brand); color: #fff; cursor: pointer; }
.acc-batch-add:active { transform: scale(.96); }
.acc-batch-rm { flex: none; width: 30px; padding: 5px 0; font-size: 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--input-bg); color: var(--muted); cursor: pointer; }
.acc-batch-rm:active { transform: scale(.96); }
.acc-month-row span { color: var(--muted); }

/* ===== 订单推送 ===== */
.order-title-row { display: flex; align-items: center; justify-content: space-between; }
.order-refresh { margin-left: 8px; }
.order-sub { margin: 0 0 10px; font-size: 12px; }
.order-cache-info { font-size: 11px; font-weight: 400; color: var(--muted); }
.order-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.order-item {
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 10px 12px; cursor: pointer; transition: transform .1s, box-shadow .15s;
}
.order-item:active { transform: scale(.99); }
.order-item.unread { border-color: #e53935; background: linear-gradient(0deg, rgba(229,57,53,.07), rgba(229,57,53,.07)), var(--card); }
.order-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.order-store { font-weight: 700; font-size: 15px; }
.oi-head-tags { display: inline-flex; gap: 6px; align-items: center; }
.order-badge-new {
  background: #e53935; color: #fff; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 8px; letter-spacing: .5px;
}
.oi-tag {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 8px;
  background: rgba(25,118,210,.12); color: #1976d2; border: 1px solid rgba(25,118,210,.3);
}
.oi-tag.sync { background: rgba(25,118,210,.12); color: #1976d2; border-color: rgba(25,118,210,.3); }
.order-item-body { font-size: 13px; }
.oi-row { display: flex; gap: 8px; padding: 2px 0; }
.oi-k { color: var(--muted); flex: 0 0 52px; }
.oi-v { color: var(--text); flex: 1; word-break: break-word; }
.order-empty { margin-top: 14px; text-align: center; padding: 20px 0; }
/* 履约时间提醒横幅（距最晚发货 <12h / 已超时） */
.order-fulfill-alert {
  margin: 8px 0; padding: 9px 12px; border-radius: 10px;
  background: #fff4e6; border: 1px solid #ffd8a8; color: #ed7b2f;
  font-size: 13px; font-weight: 600; line-height: 1.45;
}
.fulfill-row { font-weight: 600; }
.seg-badge {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px;
  margin-left: 4px; border-radius: 8px; background: #e53935; color: #fff; font-size: 11px; font-weight: 700; text-align: center;
}

/* 订单详情弹层 */
.order-detail-body { max-height: 64vh; overflow: auto; }
.od-rows { display: flex; flex-direction: column; }
.od-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.od-k { color: var(--muted); flex: 0 0 64px; }
.od-v { flex: 1; word-break: break-word; }
.od-sec { margin: 12px 0 6px; font-weight: 700; color: var(--brand); border-left: 3px solid var(--brand); padding-left: 8px; }
.od-item { display: flex; gap: 10px; padding: 6px 0; }
.od-img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; background: var(--input-bg); }
.od-sms { white-space: pre-wrap; word-break: break-word; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 13px; line-height: 1.6; }

/* 订单视图：整页高度自适应手机；标题/店铺tab固定，列表框在可见高度内滚动，底部分页（替代整页无限滑动） */
#viewOrders { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#viewOrders .card { flex: 1 1 auto; min-height: 0; margin: 0; border-radius: 0; display: flex; flex-direction: column; }
#viewOrders .order-sub { flex: 0 0 auto; }
#viewOrders .order-tabs-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#viewOrders .order-tabs-row .acc-seg-tabs { flex: 1 1 auto; min-width: 0; margin-bottom: 0; overflow-x: auto; scrollbar-width: none; }
#viewOrders .order-tabs-row .acc-seg-tabs::-webkit-scrollbar { display: none; }
#viewOrders .order-mark-read { flex: 0 0 auto; padding: 6px 12px; border-radius: 16px; font-size: 13px; font-weight: 600; }
#viewOrders .order-mark-read:disabled { opacity: .4; cursor: default; }
.order-list {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  scrollbar-color: var(--brand-2) transparent;
  display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding-right: 2px;
}
.order-list::-webkit-scrollbar { width: 5px; }
.order-list::-webkit-scrollbar-thumb { background: var(--brand-2); border-radius: 3px; }
.order-pager { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0 6px; }
.op-btn {
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 9px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  line-height: 1;
}
.op-btn:active { transform: scale(.97); }
.op-btn:disabled { opacity: .45; cursor: default; }
.op-info { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 记账分页按钮/信息（与订单分页同一外观，跟随主题变色） */
.acc-pg-btn {
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 9px; padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
  line-height: 1;
}
.acc-pg-btn:active { transform: scale(.97); }
.acc-pg-btn:disabled { opacity: .45; cursor: default; }
.acc-pg-info { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 订单/记账通用：分页条（每页条数下拉 + 上下页），跟随主题变色 */
.op-bar, .acc-pager-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap;
  padding: 10px 4px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--card); z-index: 1;
}
.op-pg-size, .acc-pg-size {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px;
}
.op-pg-size-sel, .acc-pg-size-sel {
  border: none; background: transparent; color: var(--text); font-size: 13px; font-weight: 600;
  padding: 2px 0; cursor: pointer; outline: none;
  -webkit-appearance: none; appearance: none;
}

/* 订单详情：每个商品的所有图片都显示（多图缩略图行） */
.od-imgs { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.od-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--input-bg); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.od-noimg { width: 56px; height: 56px; border-radius: 8px; background: var(--input-bg); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.od-item { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.od-item-meta { width: 100%; }
.od-title { font-size: 14px; line-height: 1.45; word-break: break-word; overflow-wrap: anywhere; }

/* 订单图片灯箱：全屏查看、左右滑动、长按保存 */
.img-lightbox { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.img-lightbox.hidden { display: none; }
.img-lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.92); }
.img-lightbox-stage { position: relative; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y; }
.img-lightbox-stage img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.img-lightbox-hint { position: absolute; bottom: 62px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.65); font-size: 12px; pointer-events: none; }
.img-lightbox-count { position: absolute; top: 16px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.img-lightbox-close { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border: none; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; font-size: 26px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.img-lightbox-menu { position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); background: #ffffff; border: 1px solid rgba(0,0,0,.12); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.35); overflow: hidden; min-width: 170px; }
.img-lightbox-menu.hidden { display: none; }
.img-lightbox-menu-item { display: block; width: 100%; border: none; background: none; padding: 13px 20px; font-size: 16px; color: #1a2b25; text-align: center; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,.08); }
.img-lightbox-menu-item:last-child { border-bottom: none; }
.img-lightbox-menu-item:active { background: #f0f0f0; }
