/* ═══════════════════════════════════════════════════════════════════
   骑行商城后台 · 设计系统
   深墨侧栏 + 米白内容区；主色只出现在操作与选中态
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --ink:    #121E19;
  --ink2:   #1A2C24;
  --ink3:   #24382E;
  --paper:  #F7F4EE;
  --card:   #FFFFFF;
  --fg:     #1C2A24;
  --fg2:    #57675F;
  --fg3:    #8B9991;
  --ln:     #E3DED3;
  --ln2:    #EFEBE2;
  --accent: #E2542A;
  --accent-dk: #B23A18;
  --accent-bg: #FCEFE9;
  --forest: #1F3D2F;
  --brass:  #8C6A3F;
  --ok:     #2C7A57;
  --ok-bg:  #EAF4EF;
  --warn:   #A9741A;
  --warn-bg:#FBF3E3;
  --err:    #BE3A2B;
  --err-bg: #FBEDEB;
  --r:  7px;
  --r2: 4px;
  --sh1: 0 1px 2px rgba(28,42,36,.06);
  --sh2: 0 10px 30px rgba(28,42,36,.13);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --hit: 34px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13.5px; line-height: 1.55;
  color: var(--fg); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
::selection { background: var(--accent); color: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #CFC9BD; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #B5AEA0; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ══════════════ 骨架 ══════════════ */
#app { display: none; grid-template-columns: 236px minmax(0, 1fr); height: 100vh; }
#app.on { display: grid; }

/* ── 侧栏 ── */
.side {
  background: var(--ink); color: #C9D6CF;
  display: flex; flex-direction: column; min-height: 0;
}
.side-hd {
  padding: 17px 18px 15px; border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 30px; height: 30px; flex: none; border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dk));
  display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 700;
}
.side-hd b { color: #fff; font-size: 13.5px; font-weight: 600; letter-spacing: .02em; display: block; line-height: 1.25; }
.side-hd small { font-size: 9.5px; letter-spacing: .16em; color: #6E8378; font-family: var(--mono); }

.side-nav { flex: 1; overflow-y: auto; padding: 10px 0 20px; }
.nav-g {
  padding: 15px 20px 6px; font-size: 10px; letter-spacing: .14em;
  color: #5D7268; text-transform: uppercase; font-family: var(--mono);
}
.nav-i {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; margin: 1px 8px; border-radius: var(--r2);
  font-size: 13px; color: #B4C4BB; cursor: pointer; transition: .12s;
  border-left: 2px solid transparent;
}
.nav-i:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-i.on { background: rgba(226,84,42,.15); color: #fff; border-left-color: var(--accent); font-weight: 500; }
.nav-i .ic { width: 15px; text-align: center; opacity: .8; font-size: 12.5px; flex: none; }
.nav-i .bd {
  margin-left: auto; font-size: 10px; font-family: var(--mono);
  background: rgba(255,255,255,.1); color: #CDD9D3; padding: 1px 5px; border-radius: 3px;
}
.nav-i.on .bd { background: var(--accent); color: #fff; }

.side-ft {
  padding: 11px 16px; border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: #5D7268; display: flex; align-items: center; justify-content: space-between;
}
.side-ft button {
  background: none; border: 1px solid rgba(255,255,255,.14); color: #9FB3A9;
  padding: 3px 9px; border-radius: 3px; cursor: pointer; font-size: 11px;
}
.side-ft button:hover { color: #fff; border-color: rgba(255,255,255,.3); }

/* ── 主区 ── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.top {
  height: 54px; flex: none; background: var(--card);
  border-bottom: 1px solid var(--ln);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.crumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--fg3); min-width: 0; }
.crumb b { color: var(--fg); font-weight: 600; }
.crumb i { font-style: normal; opacity: .45; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-u {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--fg2);
  padding-left: 12px; border-left: 1px solid var(--ln);
}
.top-u .av {
  width: 24px; height: 24px; border-radius: 50%; background: var(--forest); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}

.view { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }

/* ══════════════ 通用块 ══════════════ */
.ph { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; }
.ph h1 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.ph p { font-size: 12.5px; color: var(--fg3); margin-top: 2px; }
.ph .sp { margin-left: auto; display: flex; gap: 8px; }

.card {
  background: var(--card); border: 1px solid var(--ln); border-radius: var(--r);
  box-shadow: var(--sh1);
}
.card + .card { margin-top: 14px; }
.card-hd {
  padding: 12px 16px; border-bottom: 1px solid var(--ln2);
  display: flex; align-items: center; gap: 10px;
}
.card-hd h2 { font-size: 13.5px; font-weight: 600; }
.card-hd .sp { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.card-bd { padding: 16px; }
.card-bd.tight { padding: 0; }

/* ══════════════ 按钮 ══════════════ */
.btn {
  height: 32px; padding: 0 13px; border-radius: var(--r2);
  border: 1px solid var(--ln); background: var(--card); color: var(--fg);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; transition: .12s; white-space: nowrap;
}
.btn:hover { border-color: #C9C2B3; background: #FCFAF6; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-p { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn-p:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-d { background: var(--card); border-color: #E8C9C4; color: var(--err); }
.btn-d:hover { background: var(--err-bg); border-color: var(--err); }
.btn-g { background: transparent; border-color: transparent; color: var(--fg2); padding: 0 8px; }
.btn-g:hover { background: var(--ln2); color: var(--fg); }
.btn-s { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 13px; }

/* ══════════════ 表单 ══════════════ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px 14px; }
.wide { grid-column: 1 / -1; }

.fg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fg > label {
  font-size: 11.5px; color: var(--fg2); font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.fg > label .req { color: var(--accent); }
.fg > label .hint { color: var(--fg3); font-weight: 400; font-size: 11px; margin-left: 5px; }

.fi, .fsel, .fta {
  height: 34px; padding: 0 10px; width: 100%;
  border: 1px solid var(--ln); border-radius: var(--r2); background: var(--card);
  font-size: 13px; transition: .12s; outline: none;
}
.fi:focus, .fsel:focus, .fta:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(226,84,42,.12);
}
.fi::placeholder, .fta::placeholder { color: #B9C2BB; }
.fi[readonly] { background: #F8F6F1; color: var(--fg2); }
.fta { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.7; }
.fi.num { font-family: var(--mono); text-align: right; letter-spacing: .01em; }
.fi.mono { font-family: var(--mono); letter-spacing: .02em; }
.fsel {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%238B9991'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
.fnote { font-size: 11px; color: var(--fg3); }

/* 元/分 单位后缀 */
.money { position: relative; }
.money .unit {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--fg3); pointer-events: none; font-family: var(--mono);
}
.money .fi { padding-right: 26px; }

/* 开关 */
.sw { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.sw input { display: none; }
.sw .tr {
  width: 34px; height: 19px; border-radius: 10px; background: #D8D3C8;
  position: relative; transition: .16s; flex: none;
}
.sw .tr::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; transition: .16s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.sw input:checked + .tr { background: var(--accent); }
.sw input:checked + .tr::after { left: 17px; }
.sw span { font-size: 12.5px; color: var(--fg2); }

/* 复选 */
.ck { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; }
.ck input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* 分段 */
.seg { display: inline-flex; border: 1px solid var(--ln); border-radius: var(--r2); overflow: hidden; }
.seg button {
  height: 30px; padding: 0 12px; background: var(--card); border: none; cursor: pointer;
  font-size: 12.5px; color: var(--fg2); border-right: 1px solid var(--ln);
}
.seg button:last-child { border-right: none; }
.seg button:hover { background: #FBF9F5; }
.seg button.on { background: var(--forest); color: #fff; font-weight: 500; }

/* ══════════════ 表格 ══════════════ */
.tbw { width: 100%; overflow-x: auto; }
.tb { width: 100%; font-size: 12.8px; }
.tb thead th {
  text-align: left; padding: 9px 12px; font-weight: 500; font-size: 11.5px;
  color: var(--fg3); background: #FBFAF6; border-bottom: 1px solid var(--ln);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.tb thead th.r, .tb td.r { text-align: right; }
.tb thead th.c, .tb td.c { text-align: center; }
.tb tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--ln2); vertical-align: middle;
}
.tb tbody tr:hover { background: #FCFAF6; }
.tb tbody tr.sel { background: var(--accent-bg); }
.tb tbody tr:last-child td { border-bottom: none; }
.tb .nm { font-weight: 500; color: var(--fg); }
.tb .sub { font-size: 11px; color: var(--fg3); font-family: var(--mono); }
.tb .mono { font-family: var(--mono); font-size: 12px; }
.tb .p { font-family: var(--mono); font-weight: 600; }

.tb .thumb {
  width: 38px; height: 38px; border-radius: 5px; flex: none;
  background: #EFEBE3; display: grid; place-items: center; overflow: hidden;
}
.tb .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tb .cellp { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* 状态标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 3px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag.on   { background: var(--ok-bg);   color: var(--ok); }
.tag.draft{ background: #F1EFE9;        color: var(--fg3); }
.tag.draft::before { background: var(--fg3); }
.tag.off  { background: var(--err-bg);  color: var(--err); }
.tag.new  { background: var(--accent-bg); color: var(--accent-dk); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.plain{ background: #F1EFE9; color: var(--fg2); }
.tag.plain::before { display: none; }

/* 分页 */
.pager {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  border-top: 1px solid var(--ln2); font-size: 12.5px; color: var(--fg2);
}
.pager .sp { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.pager button {
  min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--ln);
  background: var(--card); border-radius: var(--r2); cursor: pointer; font-size: 12px;
}
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* 工具条 */
.bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--ln2);
}
.bar .sp { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.srch { position: relative; }
.srch .fi { width: 230px; padding-left: 29px; }
.srch::before {
  content: '⌕'; position: absolute; left: 10px; top: 50%; transform: translateY(-52%);
  color: var(--fg3); font-size: 15px; pointer-events: none;
}

/* ══════════════ 分栏（商品编辑）══════════════ */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--ln);
  padding: 0 14px; background: #FBFAF6; overflow-x: auto;
}
.tabs button {
  height: 40px; padding: 0 14px; background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--fg2); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: .12s;
}
.tabs button:hover { color: var(--fg); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tabs button .cnt {
  font-size: 10.5px; font-family: var(--mono); background: var(--ln2);
  padding: 1px 5px; border-radius: 3px; margin-left: 5px; color: var(--fg2);
}
.tabs button.on .cnt { background: var(--accent-bg); color: var(--accent-dk); }

.tabpane { display: none; padding: 18px; }
.tabpane.on { display: block; }

/* ══════════════ SKU 矩阵 ══════════════ */
.skugrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.skuc {
  border: 1px solid var(--ln); border-radius: var(--r2); padding: 9px 10px;
  background: var(--card); transition: .12s; position: relative;
}
.skuc:hover { border-color: #CFC7B7; }
.skuc .c1 { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.skuc .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.skuc .sz { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.skuc .sku { font-family: var(--mono); font-size: 9.5px; color: var(--fg3); word-break: break-all; line-height: 1.3; }
.skuc .c2 { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.skuc .stk { font-family: var(--mono); font-size: 11px; color: var(--fg2); }
.skuc .stk.low { color: var(--err); font-weight: 600; }
.skuc .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border: none; background: none; color: var(--fg3); cursor: pointer; border-radius: 3px;
  font-size: 12px; opacity: 0; transition: .12s;
}
.skuc:hover .rm { opacity: 1; }
.skuc .rm:hover { background: var(--err-bg); color: var(--err); }

/* ══════════════ 弹层 ══════════════ */
.mask {
  position: fixed; inset: 0; background: rgba(18,30,25,.42); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 26px;
  backdrop-filter: blur(2px);
}
.mask.on { display: flex; }
.dlg {
  background: var(--card); border-radius: 9px; box-shadow: var(--sh2);
  width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .16s ease-out;
}
.dlg.wide { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.dlg-hd {
  padding: 15px 18px; border-bottom: 1px solid var(--ln2);
  display: flex; align-items: center; gap: 10px;
}
.dlg-hd h3 { font-size: 14.5px; font-weight: 600; }
.dlg-hd .x {
  margin-left: auto; width: 28px; height: 28px; border: none; background: none;
  cursor: pointer; color: var(--fg3); border-radius: 4px; font-size: 15px;
}
.dlg-hd .x:hover { background: var(--ln2); color: var(--fg); }
.dlg-bd { padding: 18px; overflow-y: auto; }
.dlg-ft {
  padding: 13px 18px; border-top: 1px solid var(--ln2);
  display: flex; gap: 8px; justify-content: flex-end; background: #FBFAF6;
  border-radius: 0 0 9px 9px;
}

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r2);
  font-size: 13px; z-index: 200; opacity: 0; pointer-events: none; transition: .2s;
  box-shadow: var(--sh2); display: flex; align-items: center; gap: 8px; max-width: 70vw;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* ══════════════ 登录 ══════════════ */
#login {
  position: fixed; inset: 0; display: none; place-items: center;
  background: var(--ink); z-index: 300;
}
#login.on { display: grid; }
#login::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(226,84,42,.16), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 2px, transparent 2px 8px);
}
.login-bx {
  position: relative; width: 350px; background: var(--card); border-radius: 11px;
  padding: 30px 28px 26px; box-shadow: 0 24px 70px rgba(0,0,0,.4);
}
.login-bx .lm {
  width: 40px; height: 40px; border-radius: 9px; margin-bottom: 16px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dk));
  display: grid; place-items: center; color: #fff; font-size: 19px; font-weight: 700;
}
.login-bx h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-bx p { font-size: 12.5px; color: var(--fg3); margin-bottom: 20px; }
.login-bx .fg { margin-bottom: 13px; }
.login-bx .fi { height: 38px; }
.login-bx .btn { width: 100%; height: 38px; margin-top: 6px; }
.login-err {
  font-size: 12px; color: var(--err); background: var(--err-bg);
  padding: 7px 10px; border-radius: var(--r2); margin-bottom: 12px; display: none;
}
.login-err.on { display: block; }
.login-bx .tip {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ln2);
  font-size: 11.5px; color: var(--fg3); text-align: center; font-family: var(--mono);
}

/* ══════════════ 工作台 ══════════════ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  background: var(--card); border: 1px solid var(--ln); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--sh1);
}
.kpi .k { font-size: 11.5px; color: var(--fg3); display: flex; align-items: center; gap: 5px; }
.kpi .v { font-size: 25px; font-weight: 600; letter-spacing: -.02em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 13px; font-weight: 400; color: var(--fg3); margin-left: 3px; }
.kpi .f { font-size: 11.5px; color: var(--fg3); margin-top: 3px; }
.kpi.hl { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-bg), var(--card) 60%); }
.kpi.hl .v { color: var(--accent-dk); }

/* 迷你柱图 */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 74px; padding: 0 2px; }
.spark .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.spark .bar {
  width: 100%; background: linear-gradient(180deg, var(--accent), #EF8A66);
  border-radius: 2px 2px 0 0; min-height: 2px; transition: .3s;
}
.spark .lb { font-size: 9.5px; color: var(--fg3); font-family: var(--mono); white-space: nowrap; }

/* 空态 */
.empty {
  padding: 46px 20px; text-align: center; color: var(--fg3);
}
.empty .ico { font-size: 30px; opacity: .3; margin-bottom: 8px; }
.empty p { font-size: 13px; margin-bottom: 12px; }

/* 行内编辑表 */
.inline-fi {
  height: 27px; padding: 0 7px; border: 1px solid transparent; border-radius: 3px;
  background: transparent; font-size: 12.5px; width: 100%; font-family: var(--mono);
}
.inline-fi:hover { border-color: var(--ln); background: var(--card); }
.inline-fi:focus { border-color: var(--accent); background: var(--card); outline: none; box-shadow: 0 0 0 2px rgba(226,84,42,.1); }

/* 兼容矩阵网格 */
.mx { overflow: auto; max-height: 560px; }
.mx table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.mx th, .mx td { border-right: 1px solid var(--ln2); border-bottom: 1px solid var(--ln2); padding: 0; }
.mx thead th {
  background: #FBFAF6; position: sticky; top: 0; z-index: 2;
  padding: 8px 6px; font-weight: 500; font-size: 10.5px; color: var(--fg2);
  white-space: nowrap; text-align: center;
}
.mx thead th:first-child { left: 0; z-index: 3; text-align: left; padding-left: 12px; }
.mx tbody th {
  position: sticky; left: 0; background: var(--card); z-index: 1;
  padding: 6px 12px; text-align: left; font-weight: 400; white-space: nowrap;
  font-size: 12px; border-right: 1px solid var(--ln);
}
.mx tbody tr:hover th { background: #FCFAF6; }
.mx td { text-align: center; width: 44px; }
.mx .cell {
  width: 100%; height: 32px; border: none; background: none; cursor: pointer;
  font-size: 13px; color: var(--fg3); border-radius: 0; transition: .1s;
}
.mx .cell:hover { background: var(--ln2); }
.mx .cell.ok { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.mx .cell.forbid { background: var(--err-bg); color: var(--err); font-weight: 700; }
.mx .cell.require { background: var(--warn-bg); color: var(--warn); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════════
   经营域组件：报表 / 流水 / 入库 / 盘点 / 退货 / 账号 / 备份
   ══════════════════════════════════════════════════════════════════ */

/* 键值对照块 */
.kv2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; }
.kv2 > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv2 span { font-size: 11.5px; color: var(--fg3); }
.kv2 b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* 筛选条 */
.fbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fbar .fi, .fbar .fsel { width: auto; min-width: 108px; }
.fbar .btn { flex: none; }

/* 提示条 */
.alert {
  padding: 11px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.75;
  margin-bottom: 14px; background: var(--ln2); color: var(--fg2);
}
.alert b { color: var(--fg); }
.alert.warn { background: var(--warn-bg); color: #7A5310; border-left: 3px solid var(--warn); }
.alert.err  { background: var(--err-bg);  color: #7A1F18; border-left: 3px solid var(--err); }
.alert code {
  font-family: var(--mono); font-size: 12px; background: rgba(28,42,36,.07);
  padding: 1px 5px; border-radius: 3px;
}

/* 增减色：库存/盘点用「增绿减红」，比红涨绿跌更贴近库存直觉 */
.up { color: var(--ok); }
.down { color: var(--err); }

.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-hd h3 { font-size: 13.5px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* 表格辅助 */
.tb th.ra, .tb td.ra, .ra { text-align: right; }
.tb .s, .s { font-size: 11.5px; color: var(--fg3); }
.tb tr.dim { opacity: .5; }
.tb.mini th, .tb.mini td { padding: 7px 10px; font-size: 12.5px; }
.tb.mini thead th { font-size: 11px; }
/* 列多的时候别让单号、金额、按钮被挤成竖排 */
.tb .nw { white-space: nowrap; }
.tb .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 手机端的退货卡片：一屏一条单，不用左右滑 */
.ret-cards { display: flex; flex-direction: column; gap: 10px; }
.ret-card {
  background: #fff; border: 1px solid var(--ln); border-radius: var(--r);
  padding: 12px 14px; box-shadow: var(--sh-sm, 0 1px 2px rgba(28,42,36,.04));
}
.ret-card .r1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ret-card .r1 b { font-family: var(--mono); font-size: 13.5px; color: var(--fg); letter-spacing: .2px; }
.ret-card .r2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ret-card .r2 .amt { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--ok); }
.ret-card .r2 span:last-child { font-size: 12px; color: var(--fg2); text-align: right; }
.ret-card .r3 { font-size: 11.5px; color: var(--fg3); font-family: var(--mono); }
.ret-card.dim { opacity: .55; }
.hint2 { font-size: 12px; color: var(--fg3); min-height: 18px; margin-top: 6px; }

/* 报表柱图 */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 156px; padding-top: 8px; }
.chart .col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.chart .bars { flex: 1; display: flex; align-items: flex-end; gap: 2px; }
.chart .b1, .chart .b2 { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; transition: .15s; }
.chart .b1 { background: linear-gradient(180deg, #E8643C, #CF4620); }
.chart .b2 { background: #C6C0B2; }
.chart .col:hover .b1 { background: #B23A18; }
.chart .lb { font-size: 10px; color: var(--fg3); text-align: center; margin-top: 6px; white-space: nowrap; }
.legend { display: flex; align-items: center; gap: 16px; font-size: 11.5px; color: var(--fg3); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 1px; }
.legend i.b1 { background: #E2542A; }
.legend i.b2 { background: #C6C0B2; }

/* 侧栏底部：显示「谁在用什么角色」 */
.side-ft { display: flex; align-items: center; gap: 6px; }
.side-me { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.side-me span { font-size: 12.5px; color: #D5E0DA; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-me small { font-size: 10.5px; color: #7A8A82; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw.sm { transform: scale(.86); transform-origin: left center; }

/* 手机端抽屉用的元素，桌面隐藏 */
.burger { display: none; }
.side-mask { display: none; }

/* ══ 响应式 ══════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* 平板：侧栏收成图标条 */
@media (max-width: 1100px) {
  #app.on { grid-template-columns: 58px minmax(0, 1fr); }
  .side-hd b, .side-hd small, .nav-i span:not(.ic), .nav-g, .nav-i .bd,
  .side-me, .side-ft button { display: none; }
  .nav-i { justify-content: center; padding: 9px 0; }
  .side-ft { justify-content: center; }
  .grid2, .grid3, .grid-2 { grid-template-columns: 1fr; }
}

/* 手机：侧栏变抽屉，表格横向滚动，一切单列 */
@media (max-width: 720px) {
  #app.on { grid-template-columns: 1fr; }

  /* 侧栏改为抽屉 */
  .side {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 236px;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .side.open { transform: translateX(0); }
  .side-hd b, .side-hd small, .nav-i span:not(.ic), .nav-g, .side-me { display: block; }
  .nav-i { justify-content: flex-start; padding: 10px 14px; }
  .side-ft { justify-content: space-between; }
  .side-ft button { display: block; }
  .side-mask.on {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(18,30,25,.45);
  }

  /* 顶栏加汉堡按钮 */
  .burger {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex: none; border: 1px solid var(--ln);
    background: var(--card); border-radius: var(--r2); font-size: 16px;
    color: var(--fg2); cursor: pointer;
  }
  .top { padding: 0 12px; gap: 8px; }
  .top-r #btnShop { display: none; }
  .top-u span { display: none; }
  .view { padding: 14px 12px 40px; }

  .ph { flex-direction: column; align-items: stretch; gap: 10px; }
  .ph h1 { font-size: 19px; }
  .ph .sp { display: flex; flex-wrap: wrap; gap: 8px; }
  .ph .sp .btn { flex: 1; justify-content: center; min-width: 120px; }
  .ph .sp input[type="date"], .ph .sp .fsel { flex: 1; min-width: 0; }
  /* 日期框在小屏上至少要能看全「2026/11/01」，否则只剩「20..」，等于没法筛 */
  .ph .sp input[type="date"] { flex: 1 1 44%; min-width: 128px; }
  .ph .sp .fsel { flex: 1 1 40%; min-width: 112px; }

  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi b { font-size: 18px; }
  .grid2, .grid3, .grid4, .grid-2 { grid-template-columns: 1fr; }
  .kv2 { grid-template-columns: 1fr 1fr; }
  .fbar { gap: 6px; }
  .fbar .fi, .fbar .fsel { flex: 1; min-width: 0; }

  /* 表格：允许横滚 + 首列粘住，手机上不至于完全看不了 */
  .tbw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tb { min-width: 620px; }
  .tb.mini { min-width: 460px; }
  .tb th, .tb td { padding: 9px 10px; }

  .chart { height: 120px; gap: 3px; }
  .chart .lb { font-size: 9px; }
  /* 30 根柱子全标日期会糊成一团：小屏只留每 5 天的标 */
  .chart .col.skip .lb { visibility: hidden; }

  .dlg { width: calc(100vw - 20px) !important; max-height: 88vh; }
  .dlg.wide { width: calc(100vw - 20px) !important; }
  .dlg-bd { padding: 14px; }
  .mask.on { padding: 10px; align-items: flex-end; }
  .toast { left: 12px; right: 12px; text-align: center; }
}

/* ══════════ 设置页：分标签 ══════════
 * 类名带 set 前缀：商品编辑页已经占了 .tabs/.tab，
 * 同名会让老规则的 button 选择器按更高优先级把我的胶囊样式盖掉（文字会变成橙底橙字看不见）。
 * 设置项从 6 项涨到 40+ 项，一屏到底会让人找不到东西。
 * 标签切换用显隐而不是重渲染：切走再切回来，没保存的输入还在。 */
.settabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 2px 0 16px; padding-bottom: 2px;
}
.settab {
  appearance: none; border: 1px solid var(--ln); background: var(--card);
  color: var(--fg2); font-size: 12.5px; padding: 7px 14px; border-radius: 999px;
  cursor: pointer; font-family: inherit; transition: .14s;
}
.settab:hover { border-color: var(--fg3); color: var(--fg); }
.settab.on {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.setpane { display: none; }
.setpane.on { display: block; animation: fadein .16s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* 开关旁的状态文字 */
.sw .sw-t { font-size: 12px; color: var(--fg3); min-width: 28px; }
.sw input:checked ~ .sw-t { color: var(--accent-dk); }

/* 设置里的多行文本（赠送规则 JSON） */
textarea.fi { resize: vertical; min-height: 96px; font-size: 12px; }
.hint.ok { color: var(--ok); }

@media (max-width: 720px) {
  /* 手机上标签一多会换行成三排，改成横滑一排 */
  .settabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 6px;
  }
  .settabs::-webkit-scrollbar { display: none; }
  .settab { flex: 0 0 auto; }
}
