/* 布局：手机端顶部标题 + 底部标签栏；电脑端（≥960px）左侧导航 + 右侧内容。
   配色取自冷库：深青绿主色，冷灰底；临期四档用独立的语义色。 */
:root {
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --ink: #142220;
  --muted: #5b6b68;
  --line: #d9e1df;
  --accent: #0d5c55;
  --accent-2: #0f766c;
  --accent-soft: #dcefeb;
  --on-accent: #ffffff;
  --focus: #2a9d8f;

  --expired: #8f1d1d; --expired-bg: #f6dcdc;
  --red: #c8281d;     --red-bg: #fde2df;
  --orange: #b85300;  --orange-bg: #ffe7d1;
  --yellow: #8a6500;  --yellow-bg: #fbf0c4;
  --ok: #24714a;      --ok-bg: #dcf1e4;
  --none: #5b6b68;    --none-bg: #e8eeec;
  --low: #6a3fb0;     --low-bg: #ece4fa;
  --repair: #8a5a00;  --repair-bg: #f8ead0;

  --font: "Plus Jakarta Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --r: 10px;
  --shadow: 0 1px 2px rgba(20, 34, 32, .06), 0 2px 8px rgba(20, 34, 32, .04);
  --tabbar-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1413; --surface: #151e1d; --surface-2: #1b2625; --ink: #e3ebe9; --muted: #93a5a1; --line: #293735;
    --accent: #3fb3a3; --accent-2: #58c4b4; --accent-soft: #173733; --on-accent: #06201d; --focus: #6fd6c7;
    --expired: #ff9a9a; --expired-bg: #3d1717;
    --red: #ff8a7f;     --red-bg: #3a1a17;
    --orange: #ffb067;  --orange-bg: #3a2511;
    --yellow: #f1d16a;  --yellow-bg: #353012;
    --ok: #7fd4a2;      --ok-bg: #15301f;
    --none: #a3b3af;    --none-bg: #222e2c;
    --low: #c5a8ff;     --low-bg: #2a2140;
    --repair: #f0c46a;  --repair-bg: #33280f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0; text-wrap: balance; }
a { color: var(--accent-2); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.loading { padding: 40vh 16px 0; text-align: center; color: var(--muted); }
.ico { width: 20px; height: 20px; flex: none; }
.logo { width: 32px; height: 32px; flex: none; display: block; }

/* ---------- 外框 ---------- */

.layout { min-height: 100vh; }
.side { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-title h1 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-brand .logo { width: 28px; height: 28px; }
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }
.role-pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); white-space: nowrap; }

.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.lang button { border: 0; background: none; padding: 4px 9px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.lang button.on { background: var(--accent); color: var(--on-accent); }

.content {
  display: flex; flex-direction: column; gap: 16px;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 1180px;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  padding: 4px max(4px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(4px, env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: calc(var(--tabbar-h) - 8px);
  text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; border-radius: 8px;
}
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab .ico { width: 22px; height: 22px; }
.tab.on { color: var(--accent-2); }
.tab.on .ico { stroke-width: 2.2; }
.dot {
  position: absolute; top: 2px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font: 700 11px/18px var(--font); font-style: normal; text-align: center;
}

@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 20px;
    position: sticky; top: 0; height: 100vh;
    padding: 20px 14px;
    background: var(--surface); border-right: 1px solid var(--line);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
  .brand b { display: block; font-size: 15px; font-weight: 800; line-height: 1.2; }
  .brand small { color: var(--muted); font-size: 12px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .nav-link {
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--ink); text-decoration: none; font-weight: 600;
  }
  .nav-link:hover { background: var(--surface-2); }
  .nav-link.on { background: var(--accent-soft); color: var(--accent-2); }
  .nav-link .dot { position: static; margin-left: auto; }
  .side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
  .who b { display: block; font-size: 14px; }
  .who small { color: var(--muted); font-size: 12px; }
  .m-brand, .tabbar, .role-pill, .m-only { display: none !important; }
  .main { padding-bottom: 32px; }
  .top { padding: 14px 28px; }
  .top-title h1 { font-size: 22px; }
  .content { padding: 20px 28px 0; gap: 20px; }
  .banner { margin: 16px 28px 0 !important; }
}

/* ---------- 通用部件 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 9px;
  font-weight: 700; font-size: 14.5px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { min-height: 32px; padding: 4px 11px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 50px; width: 100%; font-size: 16px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:not(:disabled):hover { background: var(--accent-2); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:not(:disabled):hover { border-color: var(--accent-2); color: var(--accent-2); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-ghost { background: var(--surface); border-color: var(--line); color: var(--red); }
.btn.warn-ghost { background: var(--surface); border-color: var(--line); color: var(--repair); }
.link { border: 0; background: none; padding: 0; color: var(--accent-2); font-weight: 600; cursor: pointer; text-decoration: underline; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; line-height: 20px; white-space: nowrap;
}
.lv-expired.chip { background: var(--expired-bg); color: var(--expired); }
.lv-red.chip { background: var(--red-bg); color: var(--red); }
.lv-orange.chip { background: var(--orange-bg); color: var(--orange); }
.lv-yellow.chip { background: var(--yellow-bg); color: var(--yellow); }
.lv-ok.chip, .st-ok.chip { background: var(--ok-bg); color: var(--ok); }
.lv-none.chip { background: var(--none-bg); color: var(--none); }
.lv-low.chip { background: var(--low-bg); color: var(--low); }
.st-repair.chip { background: var(--repair-bg); color: var(--repair); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 12px; }
.panel-h h2 { font-size: 16px; font-weight: 800; }
.panel-h small { color: var(--muted); font-size: 12.5px; }
.none { color: var(--muted); margin: 4px 0; }
.empty { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty h2 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 auto 16px; max-width: 34em; }
.explain { background: var(--accent-soft); color: var(--ink); border-radius: var(--r); padding: 12px 14px; font-size: 14px; }

.cols { display: grid; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.two { display: grid; gap: 16px; }
@media (min-width: 760px) {
  .two { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .cols { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 12px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  padding: 10px 14px; border-radius: var(--r);
  background: var(--red-bg); color: var(--ink); text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
}
.banner b { color: var(--red); font-size: 14px; }
.banner .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.banner .chip { background: var(--surface); }
.banner-go { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--red); }

.fchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.fchips::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ink);
}
.fchip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.toolbar-r { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.search {
  flex: 1 1 220px; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
}
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- 表单 ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
.form.inline input { flex: 1 1 240px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .flabel { font-size: 13px; font-weight: 700; color: var(--muted); }
.req { color: var(--red); font-style: normal; }
.field input, .field select, .form.inline input, .count-ed input, .eq-move input, .dates input {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
}
.field input:focus, .field select:focus { border-color: var(--focus); background: var(--surface); }
.grid2, .grid3 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) {
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.suffix { position: relative; }
.suffix input { padding-right: 70px; font-size: 18px; font-weight: 700; }
.suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.qty-row { display: flex; gap: 8px; }
.qty-row .suffix { flex: 1; min-width: 0; }
.hint-line { font-size: 13.5px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.hint-line b { color: var(--ink); }
.expbox { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.expbox legend { font-weight: 800; padding: 0 6px; font-size: 14px; }
.expbox .fchips { flex-wrap: wrap; overflow: visible; }
.exp-result { font-size: 14.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.form.edit { border-color: var(--accent-2); }

.picks { display: flex; flex-direction: column; gap: 6px; }
.pick {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: var(--surface);
}
.pick input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.pick.on { border-color: var(--accent-2); background: var(--accent-soft); }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-main small { color: var(--muted); font-size: 12.5px; }
.pick > b:last-child { margin-left: auto; white-space: nowrap; }
.preview { font-size: 13.5px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); }
.preview.err { background: var(--red-bg); color: var(--red); font-weight: 700; }

/* ---------- 看板 ---------- */

.today { margin: 0; color: var(--muted); font-size: 14px; }
.today b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; position: relative; overflow: hidden; min-width: 0;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: currentColor; }
.tile.on { outline: 2px solid currentColor; outline-offset: -2px; }
.tile-n { font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.tile-l { font-weight: 800; font-size: 14px; }
.tile-s { font-size: 12px; color: var(--muted); }
.tile.lv-expired { color: var(--expired); }
.tile.lv-red { color: var(--red); }
.tile.lv-orange { color: var(--orange); }
.tile.lv-yellow { color: var(--yellow); }
.tile.lv-low { color: var(--low); }
.tile.lv-repair { color: var(--repair); }

.alist, .mini, .llist, .clist, .ulist { display: flex; flex-direction: column; }
.arow {
  display: grid; gap: 4px 12px; align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "tag tag" "main qty" "act act";
  padding: 12px 0 12px 12px; border-top: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.arow:first-child { border-top: 0; }
.arow.lv-expired { border-left-color: var(--expired); }
.arow.lv-red { border-left-color: var(--red); }
.arow.lv-orange { border-left-color: var(--orange); }
.arow.lv-yellow { border-left-color: var(--yellow); }
.arow-tag { grid-area: tag; display: flex; align-items: center; gap: 8px; }
.arow-days { font-weight: 800; font-size: 13.5px; }
.arow.lv-expired .arow-days, .arow.lv-red .arow-days { color: var(--red); }
.arow-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; }
.arow-main small { color: var(--muted); font-size: 12.5px; }
.arow-qty { grid-area: qty; text-align: right; white-space: nowrap; }
.arow-qty b { font-size: 18px; }
.arow-act { grid-area: act; display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 760px) {
  .arow { grid-template-columns: 170px minmax(0, 1fr) auto auto; grid-template-areas: "tag main qty act"; }
  .arow-tag { flex-direction: column; align-items: flex-start; gap: 2px; }
  .arow-act { justify-content: flex-end; }
}

.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.mini-row:first-child { border-top: 0; }
.mini-row > div { min-width: 0; display: flex; flex-direction: column; }
.mini-row small { color: var(--muted); font-size: 12.5px; }
.mini-q { white-space: nowrap; color: var(--muted); }
.mini-q b { color: var(--ink); }
.mini-q .warn { color: var(--low); }

/* ---------- 库存 ---------- */

.sgroup { display: flex; flex-direction: column; gap: 8px; }
.sgroup-h { font-size: 14px; font-weight: 800; color: var(--muted); letter-spacing: .02em; }
.sgroup-h small { font-weight: 600; margin-left: 4px; }
.slist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.srow + .srow { border-top: 1px solid var(--line); }
.srow-head {
  width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
  display: grid; gap: 4px 12px; align-items: center;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name qty" "flags flags";
  padding: 12px 14px;
}
.srow.open .srow-head { background: var(--surface-2); }
.srow-name { grid-area: name; min-width: 0; display: flex; flex-direction: column; }
.srow-name small { color: var(--muted); font-size: 12.5px; }
.srow-flags { grid-area: flags; display: flex; flex-wrap: wrap; gap: 4px; }
.srow-flags:empty { display: none; }
.srow-qty { grid-area: qty; white-space: nowrap; text-align: right; }
.srow-qty b { font-size: 19px; }
.srow-qty small { color: var(--muted); }
.srow-qty.zero b { color: var(--muted); }
@media (min-width: 760px) {
  .srow-head { grid-template-columns: minmax(0, 1fr) auto 120px; grid-template-areas: "name flags qty"; }
  .srow-flags { justify-content: flex-end; }
}
.srow-body { padding: 4px 14px 14px; background: var(--surface-2); }

.blist { display: flex; flex-direction: column; }
.brow {
  display: grid; gap: 2px 12px; align-items: center;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "exp qty" "prod prod" "in in" "act act";
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.brow:first-child { border-top: 0; }
.bhead { display: none; }
.b-exp { grid-area: exp; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.b-exp small { color: var(--muted); }
.b-prod { grid-area: prod; color: var(--muted); font-size: 13px; }
.b-in { grid-area: in; color: var(--muted); font-size: 13px; }
.m-lbl { margin-right: 6px; }
.b-qty { grid-area: qty; text-align: right; white-space: nowrap; }
.b-qty b { font-size: 16px; }
.b-act { grid-area: act; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@media (min-width: 760px) {
  .brow { grid-template-columns: minmax(0, 1.6fr) 110px minmax(0, 1.2fr) 110px auto; grid-template-areas: "exp prod in qty act"; }
  .bhead { display: grid; font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 6px; }
  .bhead span:nth-child(1) { grid-area: exp; } .bhead span:nth-child(2) { grid-area: prod; } .bhead span:nth-child(3) { grid-area: in; }
  .bhead span:nth-child(4) { grid-area: qty; text-align: right; } .bhead span:nth-child(5) { grid-area: act; }
  .m-lbl { display: none; }
  .b-act { margin-top: 0; justify-content: flex-end; }
}
.count-ed { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.count-ed input { width: 110px; min-height: 34px; padding: 4px 8px; }

.eq { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.eq-block { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.eq-n { font-size: 20px; }
.eq-move { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.eq-move label { font-size: 13px; font-weight: 700; color: var(--muted); }
.eq-move input { width: 90px; min-height: 34px; padding: 4px 8px; }

/* ---------- 流水 ---------- */

.dates { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dates input { width: auto; min-height: 40px; background: var(--surface); }
.lgroup { display: flex; flex-direction: column; gap: 8px; }
.llist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
.lrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow-main { min-width: 0; display: flex; flex-direction: column; }
.lrow-main small { color: var(--muted); font-size: 12.5px; }
.lrow-main .note { color: var(--ink); }
.lrow-q { white-space: nowrap; text-align: right; color: var(--muted); }
.lrow-q b { font-size: 16px; color: var(--ink); }
.lrow-q.t-in b { color: var(--ok); }
.tbadge { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tbadge.t-in { background: var(--ok-bg); color: var(--ok); }
.tbadge.t-out { background: var(--accent-soft); color: var(--accent-2); }
.tbadge.t-adjust { background: var(--low-bg); color: var(--low); }
.tbadge.t-repair { background: var(--repair-bg); color: var(--repair); }
.tbadge.t-fixed { background: var(--ok-bg); color: var(--ok); }

/* ---------- 档案 ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabbtn { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabbtn.on { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.clist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
.crow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.crow:first-child { border-top: 0; }
.crow-main { min-width: 0; flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.crow-main .alt { color: var(--muted); }
.crow-main small { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.crow-act { display: flex; gap: 6px; }
.catgrid { display: grid; gap: 16px; }
@media (min-width: 1100px) { .catgrid { grid-template-columns: 1fr 1fr; } }
.lines .field label { color: inherit; }

/* ---------- 账号 / Telegram / 我的 ---------- */

.urow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.urow:first-child { border-top: 0; }
.urow.off { opacity: .6; }
.urow-main { display: flex; flex-direction: column; min-width: 0; }
.urow-main small { color: var(--muted); font-size: 12.5px; }
.urow-act { display: flex; flex-wrap: wrap; gap: 6px; }
.count-ed #f-u-pw { width: 150px; }

.tg { display: grid; gap: 16px; }
@media (min-width: 1100px) { .tg { grid-template-columns: 1fr 1fr; } }
.step .panel-h { align-items: center; }
.stepn { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.step p { margin: 0 0 10px; }
.steps-list { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.steps-list code, .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.steps-list code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.code { font-size: 32px; font-weight: 700; letter-spacing: .18em; padding: 10px 16px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r); text-align: center; margin-bottom: 10px; user-select: all; }

.me-card { display: flex; flex-direction: column; }
.me-card b { font-size: 18px; }
.me-card small { color: var(--muted); }
.mlinks { display: flex; flex-direction: column; }
.mlink { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.mlink:first-child { border-top: 0; }
.mlink .ico { color: var(--accent-2); }
.mlink .go { margin-left: auto; color: var(--muted); font-size: 18px; }
.langbig { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.langbig button { min-height: 48px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-weight: 700; cursor: pointer; }
.langbig button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- 登录 ---------- */

.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding-block: calc(24px + env(safe-area-inset-top, 0px)) 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth .brand { display: flex; align-items: center; gap: 10px; }
.auth .brand b { display: block; font-weight: 800; line-height: 1.2; }
.auth .brand small { color: var(--muted); font-size: 12px; }
.auth h1 { font-size: 22px; font-weight: 800; }
.auth p { margin: 0; }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed; left: 50%; z-index: 50;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 480px); padding: 11px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }
@media (min-width: 960px) { .toast { bottom: 28px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.code-input { font-size: 20px; letter-spacing: .08em; }

/* 总仓冷库 */
:root { --central: #1d5f9e; --central-bg: #dde9f6; }
@media (prefers-color-scheme: dark) { :root { --central: #8fc0f2; --central-bg: #162a40; } }
.lv-central.chip { background: var(--central-bg); color: var(--central); }
.tile.lv-central { color: var(--central); }
.srow-qty .cqty { display: block; color: var(--central); font-size: 12px; font-weight: 600; }
.wh-h { font-size: 13px; font-weight: 800; color: var(--muted); margin: 10px 0 2px; }
.wh-h.central { color: var(--central); border-top: 1px dashed var(--line); padding-top: 10px; }
.add-store { margin-top: 12px; }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (min-width: 700px) and (max-width: 1099px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
