/* ═══════════════════════════════════════════════════════════════════════
   悟金林 · 出入库管理系统 —— 设计系统
   主题：唐卡装裱 / 藏墨底 / 金箔描边 / 朱砂法印 / 松石点缀
   纹样：吉祥结 · 仰覆莲瓣 · 联珠 · 回纹 · 云头卷草
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* — 藏墨基底 — */
  --ink-1000: #070403;
  --ink-900:  #0B0807;
  --ink-800:  #110C0B;
  --ink-700:  #181110;
  --ink-600:  #201715;
  --ink-500:  #2A1E1B;
  --ink-400:  #382925;

  /* — 金箔 — */
  --gold-100: #FBF0CD;
  --gold-200: #F2DCA2;
  --gold-300: #E4C377;
  --gold-400: #D3A854;
  --gold-500: #B98B3A;
  --gold-600: #8F6726;
  --gold-label: #D3A854;
  --gold-glow: rgba(228, 195, 119, 0.18);

  /* — 朱砂 / 法印 — */
  --cin-300: #E4715F;
  --cin-300-text: #E4715F;
  --cin-400: #CE5343;
  --cin-500: #B23A2C;
  --cin-600: #8C2519;

  /* — 松石 / 青金 — */
  --turq-300: #7FC4BD;
  --turq-400: #4E9C96;
  --turq-500: #35736F;
  --lapis-400: #4C6F9E;

  /* — 语义色 — */
  --ok-400: #7FB86A;
  --ok-500: #5B9B49;
  --warn-400: #E0A24A;
  --danger-400: #D9534A;

  /* — 文字 — */
  --tx-1: #F6EFE3;
  --tx-2: #D9CBB4;
  --tx-3: #A6957C;
  --tx-4: #8C7C66;
  --tx-5: #8A7C6A;

  /* — 线 — */
  --line-1: rgba(211, 168, 84, 0.09);
  --line-2: rgba(211, 168, 84, 0.16);
  --line-3: rgba(211, 168, 84, 0.28);
  --line-4: rgba(211, 168, 84, 0.45);

  /* — 阴影 — */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
  --sh-2: 0 8px 24px -8px rgba(0, 0, 0, .7);
  --sh-3: 0 24px 60px -20px rgba(0, 0, 0, .85);
  --sh-gold: 0 0 0 1px rgba(211, 168, 84, .22), 0 10px 30px -12px rgba(0, 0, 0, .8);

  /* — 圆角 — */
  --r-xs: 4px;
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* — 字体 — */
  --ff-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ff-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --ff-num: "SF Mono", "JetBrains Mono", "Cascadia Mono", "Menlo", Consolas, monospace;

  /* — 节奏 — */
  --gut: 22px;
  --pad: 26px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* ── 主题槽位：暗色默认值（浅色在文件末尾覆盖） ── */
  --shade: 0, 0, 0;           /* 纯投影通道（两种主题都用中性黑） */
  --sheen: 255, 255, 255;     /* 高光通道 */
  --shadow-ink: #000;         /* 投影色 */
  --tone: 0, 0, 0;            /* 凹陷 / 内衬底色通道 */
  --hollow-1: rgba(var(--tone), .32);   /* 浅凹陷：输入框、统计格 */
  --hollow-2: rgba(var(--tone), .45);   /* 深凹陷：聚焦、滚动槽 */
  --hollow-3: rgba(var(--tone), .55);   /* 印记外圈 */

  --ink-400-rgb: 56, 41, 37;
  --ink-500-rgb: 42, 30, 27;
  --ink-700-rgb: 24, 17, 16;
  --ink-800-rgb: 17, 12, 11;
  --ink-850-rgb: 13, 9, 8;
  --ink-900-rgb: 11, 8, 7;

  --gold-100-rgb: 251, 240, 205;
  --gold-300-rgb: 228, 195, 119;
  --gold-400-rgb: 211, 168, 84;
  --gold-600-rgb: 143, 103, 38;

  --cin-400-rgb: 206, 83, 67;
  --cin-500-rgb: 178, 58, 44;
  --cin-600-rgb: 140, 37, 25;
  --ok-400-rgb: 127, 184, 106;
  --ok-500-rgb: 91, 155, 73;
  --warn-400-rgb: 224, 162, 74;
  --danger-400-rgb: 217, 83, 74;
  --turq-500-rgb: 53, 115, 111;

  --surface-head-1: #17100F;  /* 表头渐层 */
  --surface-head-2: #100B0A;
  --modal-1: #241917;         /* 弹窗渐层 */
  --modal-2: #12100E;
  --modal-3: #0B0807;
  --mask: rgba(4, 2, 2, .78); /* 弹窗遮罩 */
}

/* ═════════════════════════════ 基底 ═════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* 底色挂在 html 上，保证超长页面滚动到底部也不会漏出白底 */
html { background: var(--ink-1000); }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--ff-sans);
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--tx-1);
  background-color: var(--ink-1000);
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(var(--cin-500-rgb), .13), transparent 58%),
    radial-gradient(90% 60% at 100% 0%, rgba(var(--gold-400-rgb), .07), transparent 55%),
    radial-gradient(70% 50% at 0% 100%, rgba(var(--turq-500-rgb), .07), transparent 60%),
    linear-gradient(180deg, var(--ink-900) 0%, var(--ink-1000) 100%);
  background-repeat: no-repeat;
  background-attachment: scroll;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* 吉祥结纹 —— 极低透明度肌理层 */
.paper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    /* 吉祥结网格 */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23D3A854' stroke-width='1' stroke-opacity='.055'%3E%3Cpath d='M60 20v80M20 60h80'/%3E%3Cpath d='M38 38h44v44H38z' stroke-opacity='.04'/%3E%3Cpath d='M60 44l16 16-16 16-16-16z' stroke-opacity='.05'/%3E%3C/g%3E%3C/svg%3E"),
    /* 细密斜纹织物质感 */
    repeating-linear-gradient(45deg, rgba(var(--sheen), .012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(var(--shade), .16) 0 1px, transparent 1px 3px);
}

::selection { background: rgba(var(--gold-400-rgb), .3); color: #fff; }

/* ═════════════════════════════ 滚动条 ═════════════════════════════ */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(var(--hollow-2), .3); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-600), rgba(var(--gold-600-rgb), .5));
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-500); background-clip: content-box; }

/* ═════════════════════════════ 顶栏 ═════════════════════════════ */

.masthead {
  position: sticky;
  top: 0;
  z-index: 200;
  background:
    linear-gradient(180deg, rgba(var(--ink-800-rgb), .97) 0%, rgba(var(--ink-900-rgb), .93) 100%);
  border-bottom: 1px solid var(--line-2);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 18px 40px -28px var(--shadow-ink), inset 0 1px 0 rgba(var(--gold-100-rgb), .06);
}

.masthead-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.4vw, 34px);
  height: 76px;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 34px);
}

/* — 回纹包边 — */
.masthead-fret {
  height: 7px;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='7' viewBox='0 0 22 7'%3E%3Cpath d='M0 .5h22M2 .5v4h6v-2H5M14 .5v4h6v-2h-3' fill='none' stroke='%23D3A854' stroke-opacity='.3' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  opacity: .8;
}

/* — 品牌印章 — */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: transform .4s var(--ease), filter .4s var(--ease);
}
.brand:hover { transform: translateY(-1px); filter: drop-shadow(0 6px 16px rgba(var(--gold-300-rgb), .25)); }

.brand-seal {
  width: 36px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  flex-shrink: 0;
}
.brand-seal img {
  width: auto;
  height: 42px;
  max-width: 36px;
  object-fit: contain;
  display: block;
  /* 深色主题下略微提亮，避免暗部糊成一团 */
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
}
[data-theme="light"] .brand-seal img {
  filter: drop-shadow(0 1px 3px rgba(90, 60, 20, .18));
}

@keyframes sealGlow {
  0%, 100% { box-shadow: 0 0 22px -8px rgba(var(--gold-400-rgb), .24); }
  50%      { box-shadow: 0 0 30px -6px rgba(var(--gold-400-rgb), .46); }
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: var(--ff-serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: .14em;
  background: linear-gradient(96deg, var(--gold-200) 0%, var(--gold-400) 42%, var(--gold-100) 70%, var(--gold-300) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 26px rgba(var(--gold-400-rgb), .18);
}
.brand-text em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: .34em;
  color: var(--tx-4);
  margin-top: 3px;
  padding-left: 1px;
}

/* — 导航 — */
.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border-radius: 99px;
  background: rgba(var(--hollow-1), .34);
  box-shadow: inset 0 0 0 1px var(--line-1);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.nav::-webkit-scrollbar { display: none; }

.nav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--tx-3);
  font-family: var(--ff-sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  white-space: nowrap;
  transition: color .3s var(--ease), background .3s var(--ease), box-shadow .3s var(--ease);
}
.nav-btn svg { width: 17px; height: 17px; opacity: .72; transition: opacity .3s, transform .35s var(--ease); flex-shrink: 0; }
.nav-btn:hover { color: var(--tx-1); background: rgba(var(--gold-400-rgb), .07); }
.nav-btn:hover svg { opacity: 1; transform: translateY(-1px); }

.nav-btn.active {
  color: #2B1B08;
  background: linear-gradient(160deg, var(--gold-200) 0%, var(--gold-400) 55%, var(--gold-500) 100%);
  box-shadow: 0 2px 14px -2px rgba(var(--gold-400-rgb), .45), inset 0 1px 0 rgba(var(--sheen), .45), inset 0 -1px 0 rgba(var(--shade), .18);
}
.nav-btn.active svg { opacity: 1; }

.masthead-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-num);
  font-size: 11.5px;
  letter-spacing: .1em;
  color: var(--tx-4);
  flex-shrink: 0;
  padding-left: 4px;
}
.dot-live {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok-400);
  box-shadow: 0 0 0 3px rgba(var(--ok-400-rgb), .16), 0 0 10px rgba(var(--ok-400-rgb), .7);
  animation: livePulse 2.6s ease-in-out infinite;
}
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ═════════════════════════════ 舞台 ═════════════════════════════ */

.stage {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 42px) clamp(16px, 2.4vw, 34px) 72px;
}

.booting {
  min-height: 48vh;
  display: grid;
  place-items: center;
  gap: 16px;
  color: var(--tx-4);
  font-size: 13.5px;
  letter-spacing: .22em;
}
.booting-wheel { width: 52px; height: 52px; color: var(--gold-500); }
.booting-wheel svg { width: 100%; height: 100%; animation: spin 2.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page { animation: pageIn .5s var(--ease) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* — 页首：标题 + 说明 — */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.page-head-text { min-width: 0; }
.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--ff-num);
  font-size: 10.5px;
  color: var(--gold-label) !important;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: 9px;
}
.page-eyebrow::before {
  content: '';
  width: 22px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-500));
}
.page-title {
  margin: 0;
  font-family: var(--ff-serif);
  font-size: clamp(21px, 2.3vw, 29px);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--tx-1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-title svg { width: 25px; height: 25px; color: var(--gold-400); flex-shrink: 0; }
.page-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--tx-4);
  max-width: 62ch;
  line-height: 1.7;
}

/* ═════════════════════════════ 通用面板（唐卡装裱） ═════════════════════════════ */

.panel {
  position: relative;
  background:
    linear-gradient(168deg, rgba(var(--ink-500-rgb), .82) 0%, rgba(var(--ink-800-rgb), .94) 58%, rgba(var(--ink-900-rgb), .97) 100%);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 0 0 1px var(--line-2),
    inset 0 1px 0 rgba(var(--gold-100-rgb), .05),
    var(--sh-2);
  margin-bottom: var(--gut);
  isolation: isolate;
}

/* 四角金线（唐卡装裱角饰） */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 26px; height: 26px;
  pointer-events: none;
  border-color: var(--line-3);
  border-style: solid;
  border-width: 0;
  border-radius: 2px;
  z-index: 2;
}
.panel::before { top: 7px; left: 7px; border-top-width: 1px; border-left-width: 1px; }
.panel::after  { bottom: 7px; right: 7px; border-bottom-width: 1px; border-right-width: 1px; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 19px var(--pad);
  border-bottom: 1px solid var(--line-1);
  flex-wrap: wrap;
}
.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-family: var(--ff-serif);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--tx-1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-head h2 svg,
.panel-head h3 svg { width: 19px; height: 19px; color: var(--gold-400); flex-shrink: 0; }
.panel-head .spacer { flex: 1; }
.panel-head .hint {
  font-size: 12px;
  color: var(--tx-4);
  letter-spacing: .04em;
}
.panel-body { padding: var(--pad); }
.panel-body.tight { padding: 18px var(--pad); }

/* 联珠分隔线 */
.beads {
  height: 10px;
  background-image: radial-gradient(circle, var(--line-3) 1.1px, transparent 1.3px);
  background-size: 11px 11px;
  background-position: center;
  opacity: .55;
}

/* ═════════════════════════════ 指标卡 ═════════════════════════════ */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gut);
  margin-bottom: var(--gut);
}

.metric {
  position: relative;
  padding: 22px 22px 20px;
  border-radius: var(--r-md);
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(var(--gold-400-rgb), .1), transparent 62%),
    linear-gradient(165deg, rgba(var(--ink-500-rgb), .95), rgba(var(--ink-850-rgb), .98));
  box-shadow: inset 0 0 0 1px var(--line-2), var(--sh-1);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.metric::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-400), var(--cin-400), var(--gold-400), transparent);
  opacity: .55;
}
.metric::after {
  content: '';
  position: absolute;
  width: 150px; height: 150px;
  right: -58px; top: -58px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  box-shadow: inset 0 0 0 12px rgba(var(--gold-400-rgb), .03), inset 0 0 0 26px rgba(var(--gold-400-rgb), .02);
  pointer-events: none;
}
.metric:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px var(--line-3), 0 22px 44px -22px rgba(var(--shade), .9), 0 0 34px -14px var(--gold-glow);
}

.metric-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.metric-glyph {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--gold-label);
  background: linear-gradient(160deg, rgba(var(--gold-400-rgb), .22), rgba(var(--gold-400-rgb), .05));
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(var(--sheen), .08);
  flex-shrink: 0;
}
.metric-glyph svg { width: 18px; height: 18px; }
.metric-label {
  font-size: 12.5px;
  color: var(--tx-3);
  letter-spacing: .12em;
  font-weight: 600;
}
.metric-num {
  font-family: var(--ff-num);
  font-size: clamp(26px, 2.9vw, 37px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--gold-100), var(--gold-300) 60%, var(--gold-500));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 12px rgba(var(--gold-400-rgb), .22));
}
.metric-num small {
  font-family: var(--ff-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  -webkit-text-fill-color: var(--tx-4);
  margin-left: 6px;
}
.metric-foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--tx-4);
}
.metric-foot .chip {
  font-family: var(--ff-num);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--tx-2);
}

/* ═════════════════════════════ 仓库卡 ═════════════════════════════ */

.warehouses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 18px;
}

/* 宽屏五仓并排，避免出现孤零零的第 5 张卡 */
@media (min-width: 1360px) {
  .warehouses { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.wh {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 21px;
  border-radius: var(--r-md);
  background: linear-gradient(170deg, rgba(var(--ink-500-rgb), .8), rgba(var(--ink-850-rgb), .96));
  box-shadow: inset 0 0 0 1px var(--line-1), var(--sh-1);
  overflow: hidden;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), background .45s var(--ease);
}
/* 仰莲瓣底纹 */
.wh::before {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='46' viewBox='0 0 40 46'%3E%3Cpath d='M20 0c6 8 10 16 10 24a10 10 0 0 1-20 0C10 16 14 8 20 0z' fill='none' stroke='%23D3A854' stroke-opacity='.13'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: bottom;
  opacity: .5;
  pointer-events: none;
}
.wh:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 1px var(--line-3), 0 26px 48px -24px var(--shadow-ink), 0 0 40px -18px var(--gold-glow);
  background: linear-gradient(170deg, rgba(var(--ink-400-rgb), .9), rgba(var(--ink-850-rgb), .98));
}

.wh-top { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
.wh-glyph {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--cin-300);
  background: linear-gradient(155deg, rgba(var(--cin-500-rgb), .3), rgba(var(--cin-600-rgb), .1));
  box-shadow: inset 0 0 0 1px rgba(var(--cin-400-rgb), .28), inset 0 1px 0 rgba(255, 220, 210, .1);
  flex-shrink: 0;
}
.wh-glyph svg { width: 21px; height: 21px; }
.wh-name {
  margin: 0;
  font-family: var(--ff-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--tx-1);
}
.wh-note { margin: 3px 0 0; font-size: 11.5px; color: var(--tx-4); letter-spacing: .02em; }
.wh-count {
  margin-left: auto;
  font-family: var(--ff-num);
  font-size: 11px;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: 99px;
  color: var(--gold-label);
  background: rgba(var(--gold-400-rgb), .14);
  box-shadow: inset 0 0 0 1px var(--line-2);
  white-space: nowrap;
}

.wh-stats { display: flex; gap: 1px; margin-bottom: 14px; border-radius: var(--r-sm); overflow: hidden; }
.wh-stat {
  flex: 1;
  padding: 11px 13px;
  background: rgba(var(--hollow-1), .32);
  box-shadow: inset 0 0 0 1px var(--line-1);
}
.wh-stat dt { font-size: 11px; color: var(--tx-4); letter-spacing: .08em; margin-bottom: 3px; }
.wh-stat dd {
  margin: 0;
  font-family: var(--ff-num);
  font-size: 17px;
  font-weight: 700;
  color: var(--tx-1);
  font-variant-numeric: tabular-nums;
}
.wh-stat dd small { font-size: 10.5px; font-weight: 500; color: var(--tx-4); margin-left: 2px; }
.wh-stat.is-low dd { color: var(--warn-400); }

.wh-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--ff-num);
  font-size: 11.5px;
  letter-spacing: .05em;
  color: var(--tx-4);
  margin-bottom: 17px;
}
.wh-flow b { font-weight: 700; }
.wh-flow .in { color: var(--ok-400); }
.wh-flow .out { color: var(--cin-300); }

.wh-actions { display: flex; gap: 9px; margin-top: auto; }

/* 五仓并排时卡片只有 ~250px，三个按钮原尺寸（3×77+2×9=250）会溢出裁切。
   这里收紧内距并让按钮等分宽度，保证不横向溢出。 */
@media (min-width: 1360px) {
  .wh { padding: 17px; }
  .wh-name { font-size: 15px; }
  .wh-stat dd { font-size: 15.5px; }
  .wh-actions { gap: 7px; }
  .wh-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 4px;
    font-size: 12px;
    gap: 5px;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .wh-actions .btn svg { width: 13px; height: 13px; flex-shrink: 0; }
}

/* ═════════════════════════════ 按钮 ═════════════════════════════ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 0;
  border-radius: var(--r-sm);
  font-family: var(--ff-sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  color: var(--tx-2);
  background: rgba(var(--gold-400-rgb), .07);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:hover { transform: translateY(-1px); background: rgba(var(--gold-400-rgb), .13); box-shadow: inset 0 0 0 1px var(--line-3), 0 8px 20px -10px var(--shadow-ink); color: var(--gold-100); }
.btn:active { transform: translateY(0) scale(.99); }

.btn.sm { padding: 8px 14px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }

.btn-gold {
  color: #2A1A06;
  background: linear-gradient(160deg, var(--gold-100) 0%, var(--gold-300) 45%, var(--gold-500) 100%);
  box-shadow: 0 2px 0 rgba(var(--shade), .35), inset 0 1px 0 rgba(var(--sheen), .55), 0 10px 26px -12px rgba(var(--gold-400-rgb), .6);
}
.btn-gold:hover {
  color: #1E1204;
  background: linear-gradient(160deg, #fff8e4 0%, var(--gold-200) 45%, var(--gold-400) 100%);
  box-shadow: 0 2px 0 rgba(var(--shade), .35), inset 0 1px 0 rgba(var(--sheen), .7), 0 14px 30px -12px rgba(var(--gold-400-rgb), .75);
}

.btn-cinnabar {
  color: #FFEDE8;
  background: linear-gradient(160deg, var(--cin-400), var(--cin-600));
  box-shadow: inset 0 1px 0 rgba(255, 210, 200, .28), 0 10px 24px -12px rgba(var(--cin-500-rgb), .6);
}
.btn-cinnabar:hover { color: #fff; background: linear-gradient(160deg, var(--cin-300), var(--cin-500)); }

.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-1); color: var(--tx-3); }
.btn-ghost:hover { color: var(--tx-1); box-shadow: inset 0 0 0 1px var(--line-3); background: rgba(var(--gold-400-rgb), .06); }

.btn-danger { color: #FFE9E6; background: linear-gradient(160deg, #C64A41, #8E2A22); box-shadow: inset 0 1px 0 rgba(255, 210, 200, .2); }
.btn-danger:hover { background: linear-gradient(160deg, #DA5A50, #A0332A); color: #fff; }

/* ═════════════════════════════ 表格 ═════════════════════════════ */

.table-wrap { overflow: auto; max-height: 620px; border-radius: 0 0 var(--r-lg) var(--r-lg); }

table { width: 100%; border-collapse: separate; border-spacing: 0; }

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--tx-4);
  white-space: nowrap;
  background: linear-gradient(180deg, var(--surface-head-1), var(--surface-head-2));
  box-shadow: inset 0 -1px 0 var(--line-2), 0 1px 0 rgba(var(--shade), .6);
  backdrop-filter: blur(8px);
}

tbody td {
  padding: 13px 18px;
  font-size: 13.5px;
  color: var(--tx-2);
  border-bottom: 1px solid rgba(var(--gold-400-rgb), .055);
  vertical-align: middle;
}
tbody tr { transition: background .22s var(--ease); }
tbody tr:hover td { background: rgba(var(--gold-400-rgb), .045); }
tbody tr:last-child td { border-bottom: 0; }

td .primary-cell { color: var(--tx-1); font-weight: 600; letter-spacing: .03em; }
td .sub-cell { font-size: 11.5px; color: var(--tx-4); margin-top: 2px; letter-spacing: .02em; white-space: nowrap; }
td.num { font-family: var(--ff-num); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
th.num { text-align: right; }

.qty-in { color: var(--ok-400); font-weight: 700; font-family: var(--ff-num); }
.qty-out { color: var(--cin-300-text); font-weight: 700; font-family: var(--ff-num); }
.qty-big { font-family: var(--ff-num); font-size: 15.5px; font-weight: 700; color: var(--gold-label); font-variant-numeric: tabular-nums; }
.qty-big small { font-size: 10.5px; color: var(--tx-4); font-weight: 500; margin-left: 2px; }

/* ═════════════════════════════ 标签 / 徽记 ═════════════════════════════ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  white-space: nowrap;
}
.tag svg { width: 12px; height: 12px; }
.tag-in  { color: var(--ok-400); background: rgba(var(--ok-400-rgb), .11); box-shadow: inset 0 0 0 1px rgba(var(--ok-400-rgb), .26); }
.tag-out { color: var(--cin-300-text); background: rgba(var(--cin-400-rgb), .12); box-shadow: inset 0 0 0 1px rgba(var(--cin-400-rgb), .3); }
.tag-ok  { color: var(--ok-400); background: rgba(var(--ok-400-rgb), .1); box-shadow: inset 0 0 0 1px rgba(var(--ok-400-rgb), .24); }
.tag-warn { color: var(--warn-400); background: rgba(var(--warn-400-rgb), .11); box-shadow: inset 0 0 0 1px rgba(var(--warn-400-rgb), .28); }
.tag-danger { color: var(--danger-400); background: rgba(var(--danger-400-rgb), .12); box-shadow: inset 0 0 0 1px rgba(var(--danger-400-rgb), .3); }
.tag-muted { color: var(--tx-4); background: rgba(var(--sheen), .03); box-shadow: inset 0 0 0 1px var(--line-1); }

/* ═════════════════════════════ 空态 ═════════════════════════════ */

.empty {
  padding: 54px 24px;
  text-align: center;
  color: var(--tx-4);
}
.empty svg { width: 46px; height: 46px; opacity: .22; color: var(--gold-400); margin-bottom: 14px; }
.empty p { margin: 0; font-size: 13.5px; letter-spacing: .1em; }
.empty small { display: block; margin-top: 6px; font-size: 12px; color: var(--tx-5); letter-spacing: .04em; }

/* ═════════════════════════════ 表单 ═════════════════════════════ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 17px 18px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > .lb {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--tx-3);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field > .lb .req { color: var(--cin-300-text); font-size: 13px; line-height: 1; }
.field > .lb .tip { text-transform: none; letter-spacing: .02em; font-weight: 400; color: var(--tx-4); font-size: 11px; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--tx-1);
  font-family: var(--ff-sans);
  font-size: 14px;
  background: rgba(var(--hollow-1), .4);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 3px rgba(var(--shade), .5);
  transition: box-shadow .25s var(--ease), background .25s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--tx-5); }
input:hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1px var(--line-3), inset 0 1px 3px rgba(var(--hollow-2), .5); }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: rgba(var(--hollow-2), .55);
  box-shadow: inset 0 0 0 1px rgba(var(--gold-300-rgb), .55), 0 0 0 3px rgba(var(--gold-400-rgb), .12), inset 0 1px 3px rgba(var(--shade), .5);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23A6957C' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
}
select option { background: var(--surface-head-1); color: var(--tx-1); }

input[type="number"] { font-family: var(--ff-num); font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-1);
  flex-wrap: wrap;
}
.form-actions .spacer { flex: 1; }
.form-note { font-size: 12px; color: var(--tx-4); letter-spacing: .02em; }

/* — 分段选择（仓库） — */
.seg {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--tx-3);
  background: rgba(var(--hollow-1), .35);
  box-shadow: inset 0 0 0 1px var(--line-1);
  transition: all .25s var(--ease);
}
.seg span svg { width: 15px; height: 15px; opacity: .75; }
.seg span:hover { color: var(--tx-1); box-shadow: inset 0 0 0 1px var(--line-3); }
.seg input:checked + span {
  color: var(--gold-label);
  background: linear-gradient(160deg, rgba(var(--gold-400-rgb), .24), rgba(var(--gold-400-rgb), .08));
  box-shadow: inset 0 0 0 1px rgba(var(--gold-300-rgb), .55), 0 0 18px -6px var(--gold-glow);
}
.seg input:checked + span svg { opacity: 1; }

/* ═════════════════════════════ 拍照存证 ═════════════════════════════ */

.shot {
  border-radius: var(--r-md);
  background:
    repeating-linear-gradient(45deg, rgba(var(--gold-400-rgb), .028) 0 10px, transparent 10px 20px),
    rgba(var(--hollow-1), .32);
  box-shadow: inset 0 0 0 1px var(--line-2);
  padding: 22px;
  transition: box-shadow .3s var(--ease);
}
.shot:hover { box-shadow: inset 0 0 0 1px var(--line-3); }

.shot-idle { text-align: center; }
.shot-icon {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--gold-400);
  background: radial-gradient(circle at 40% 30%, rgba(var(--gold-400-rgb), .18), rgba(var(--hollow-1), .3));
  box-shadow: inset 0 0 0 1px var(--line-2), 0 0 26px -12px var(--gold-glow);
}
.shot-icon svg { width: 24px; height: 24px; }
.shot-hint { font-size: 12.5px; color: var(--tx-4); margin: 0 0 15px; letter-spacing: .05em; }
.shot-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

video.cam {
  width: 100%;
  max-width: 460px;
  border-radius: var(--r-sm);
  display: block;
  margin: 0 auto 13px;
  background: var(--shadow-ink);
  box-shadow: 0 0 0 1px var(--line-3), 0 18px 40px -18px var(--shadow-ink);
}
.shot-live { text-align: center; }
.shot-done { text-align: center; }
.shot-done img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--r-sm);
  display: block;
  margin: 0 auto 13px;
  box-shadow: 0 0 0 1px var(--line-3), 0 18px 40px -18px var(--shadow-ink);
}

/* ═════════════════════════════ 图表 ═════════════════════════════ */

.chart { padding: 6px 2px 0; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 190px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line-1);
}
.bar-group {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 100%;
  position: relative;
}
.bar {
  width: 45%;
  max-width: 17px;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  transition: height .7s var(--ease), filter .3s;
  position: relative;
}
.bar.in {
  background: linear-gradient(180deg, var(--ok-400), rgba(var(--ok-500-rgb), .35));
  box-shadow: 0 0 14px -6px rgba(var(--ok-400-rgb), .8);
}
.bar.out {
  background: linear-gradient(180deg, var(--cin-300), rgba(var(--cin-500-rgb), .3));
  box-shadow: 0 0 14px -6px rgba(var(--cin-400-rgb), .8);
}
.bar:hover { filter: brightness(1.3); }

.chart-axis {
  display: flex;
  gap: 10px;
  padding-top: 9px;
}
.chart-axis span {
  flex: 1;
  text-align: center;
  font-family: var(--ff-num);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--tx-5);
}

.legend {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--tx-4);
  letter-spacing: .05em;
}
.legend i {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: -1px;
}
.legend .i-in { background: var(--ok-400); box-shadow: 0 0 8px rgba(var(--ok-400-rgb), .8); }
.legend .i-out { background: var(--cin-300); box-shadow: 0 0 8px rgba(var(--cin-400-rgb), .8); }

/* — 领用排行 — */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.rank li { display: flex; align-items: center; gap: 12px; }
.rank .no {
  width: 23px; height: 23px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: var(--ff-num);
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-4);
  box-shadow: inset 0 0 0 1px var(--line-2);
  flex-shrink: 0;
}
.rank li:nth-child(1) .no { color: #2A1A06; background: linear-gradient(160deg, var(--gold-100), var(--gold-400)); box-shadow: none; }
.rank li:nth-child(2) .no { color: var(--gold-label); box-shadow: inset 0 0 0 1px var(--line-4); }
.rank li:nth-child(3) .no { color: var(--cin-300-text); box-shadow: inset 0 0 0 1px rgba(var(--cin-400-rgb), .4); }
.rank .who { min-width: 0; flex: 1; }
.rank .who b { display: block; font-size: 13.5px; font-weight: 600; color: var(--tx-1); letter-spacing: .04em; }
.rank .who small { font-size: 11px; color: var(--tx-4); letter-spacing: .02em; }
.rank .val { font-family: var(--ff-num); font-size: 13px; font-weight: 700; color: var(--gold-label); font-variant-numeric: tabular-nums; }
.rank .bar-track {
  flex: 0 0 76px;
  height: 4px;
  border-radius: 99px;
  background: rgba(var(--sheen), .05);
  overflow: hidden;
}
.rank .bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-200));
  box-shadow: 0 0 8px rgba(var(--gold-400-rgb), .6);
}

/* ═════════════════════════════ 提示条 / 预警 ═════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.6;
  background: rgba(var(--warn-400-rgb), .07);
  box-shadow: inset 0 0 0 1px rgba(var(--warn-400-rgb), .24);
  color: var(--warn-400);
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.alert b { color: var(--tx-1); }

.low-list { display: flex; flex-direction: column; gap: 9px; }
.low-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: rgba(var(--danger-400-rgb), .06);
  box-shadow: inset 0 0 0 1px rgba(var(--danger-400-rgb), .2);
  transition: background .25s;
}
.low-item:hover { background: rgba(var(--danger-400-rgb), .1); }
.low-item .nm { flex: 1; min-width: 0; }
.low-item .nm b { display: block; font-size: 13.5px; font-weight: 600; color: var(--tx-1); }
.low-item .nm small { font-size: 11px; color: var(--tx-4); }
.low-item .q { font-family: var(--ff-num); font-size: 13px; font-weight: 700; color: var(--danger-400); white-space: nowrap; }

/* ═════════════════════════════ 过滤条 ═════════════════════════════ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
}
.toolbar .search {
  position: relative;
  flex: 1;
  min-width: 190px;
  max-width: 330px;
}
.toolbar .search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--tx-5);
  pointer-events: none;
}
.toolbar .search input { padding-left: 35px; }

.count-pill {
  font-family: var(--ff-num);
  font-size: 11.5px;
  letter-spacing: .06em;
  padding: 4px 11px;
  border-radius: 99px;
  color: var(--tx-3);
  background: rgba(var(--sheen), .03);
  box-shadow: inset 0 0 0 1px var(--line-1);
  white-space: nowrap;
}

/* ═════════════════════════════ 弹窗 ═════════════════════════════ */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: var(--mask);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: maskIn .25s var(--ease);
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 26px 28px 24px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(var(--cin-500-rgb), .12), transparent 55%),
    linear-gradient(168deg, var(--modal-1) 0%, var(--modal-2) 60%, var(--modal-3) 100%);
  box-shadow:
    inset 0 0 0 1px var(--line-3),
    inset 0 1px 0 rgba(var(--gold-100-rgb), .08),
    0 40px 90px -30px var(--shadow-ink),
    0 0 90px -40px var(--gold-glow);
  animation: modalIn .35s var(--ease);
}
.modal.wide { max-width: 780px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.modal::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--line-1);
  pointer-events: none;
}
.modal h3 {
  margin: 0 0 4px;
  font-family: var(--ff-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--tx-1);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 40px;
}
.modal h3 svg { width: 20px; height: 20px; color: var(--gold-400); }
.modal .modal-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--tx-4); letter-spacing: .03em; }
.modal .close {
  position: absolute;
  top: 15px; right: 15px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(var(--sheen), .04);
  color: var(--tx-3);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: all .25s var(--ease);
  z-index: 3;
}
.modal .close:hover { background: rgba(var(--cin-400-rgb), .2); color: #fff; transform: rotate(90deg); }

.divider {
  height: 1px;
  margin: 20px 0;
  background: linear-gradient(90deg, transparent, var(--line-3), transparent);
}

.img-view {
  max-width: 100%;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 1px var(--line-3), 0 24px 50px -24px var(--shadow-ink);
}

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 11px 16px; font-size: 13.5px; }
.kv dt { color: var(--tx-4); font-size: 12.5px; letter-spacing: .08em; }
.kv dd { margin: 0; color: var(--tx-1); }
.kv dd.mono { font-family: var(--ff-num); font-variant-numeric: tabular-nums; }

/* ═════════════════════════════ 提示条 toast ═════════════════════════════ */

.toast-root {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 460px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 19px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--gold-label);
  background: linear-gradient(160deg, rgba(var(--ink-500-rgb), .97), rgba(var(--ink-900-rgb), .98));
  box-shadow: inset 0 0 0 1px var(--line-3), 0 20px 44px -18px var(--shadow-ink);
  animation: toastIn .4s var(--ease);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
  max-width: 100%;
}
.toast.err { color: #FFDCD6; box-shadow: inset 0 0 0 1px rgba(var(--cin-400-rgb), .5), 0 20px 44px -18px var(--shadow-ink); }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ═════════════════════════════ 页脚 ═════════════════════════════ */

.colophon {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.4vw, 34px) 46px;
  text-align: center;
  color: var(--tx-4);
  font-size: 11.5px;
  letter-spacing: .14em;
}
.colophon-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.colophon-rule::before,
.colophon-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}
.colophon-rule span {
  width: 7px; height: 7px;
  rotate: 45deg;
  box-shadow: inset 0 0 0 1px var(--line-3);
}
.colophon p { margin: 0 0 5px; }
.colophon-sub { color: var(--tx-4); letter-spacing: .06em; font-size: 11px; }

/* ═════════════════════════════ 布局工具 ═════════════════════════════ */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--gut);
  align-items: start;
}
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ═════════════════════════════ 响应式 ═════════════════════════════ */

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .masthead-inner {
    height: auto;
    padding: 12px 14px;
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .masthead-meta { margin-left: auto; }
  .brand-text strong { font-size: 19px; }
  .brand-seal { width: 30px; height: 36px; }
  .brand-seal img { width: auto; height: 36px; max-width: 30px; }

  .stage { padding: 18px 12px 56px; }
  :root { --pad: 16px; --gut: 12px; }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
  }
  .metric {
    padding: 13px 14px 12px;
    border-radius: var(--r-sm);
  }
  .metric::after {
    width: 90px; height: 90px;
    right: -32px; top: -32px;
  }
  .metric-top { gap: 8px; margin-bottom: 8px; }
  .metric-glyph {
    width: 26px; height: 26px;
    border-radius: 7px;
  }
  .metric-glyph svg { width: 14px; height: 14px; }
  .metric-label {
    font-size: 11px;
    letter-spacing: .08em;
  }
  .metric-num {
    font-size: clamp(20px, 5.2vw, 24px);
    line-height: 1.05;
  }
  .metric-num small {
    font-size: 11px;
    margin-left: 4px;
  }
  .metric-foot {
    margin-top: 7px;
    font-size: 10.5px;
    gap: 5px;
    flex-wrap: wrap;
  }
  .metric-foot .chip {
    font-size: 10px;
    padding: 0 5px;
  }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .warehouses { grid-template-columns: 1fr; }
  .table-wrap { max-height: none; }
  thead th, tbody td { padding: 10px 12px; font-size: 12.5px; }
  .btn { padding: 11px 16px; }
}

@media (max-width: 520px) {
  /* 手机端保持一排 2 个，更紧凑精细 */
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  .metric {
    padding: 11px 12px 10px;
  }
  .metric-top { gap: 6px; margin-bottom: 6px; }
  .metric-glyph {
    width: 24px; height: 24px;
    border-radius: 6px;
  }
  .metric-glyph svg { width: 13px; height: 13px; }
  .metric-label {
    font-size: 10.5px;
    letter-spacing: .05em;
  }
  .metric-num {
    font-size: 21px;
  }
  .metric-num small { font-size: 10px; }
  .metric-foot {
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.3;
  }
  .metric-foot .chip {
    font-size: 9.5px;
    padding: 0 4px;
  }

  .stage { padding: 14px 10px 48px; }
  :root { --pad: 13px; --gut: 10px; }
  .panel { border-radius: var(--r-md); }
  .panel-head { padding: 11px 13px; }
  .panel-head h2 { font-size: 14px; gap: 7px; }
  .panel-head h2 svg { width: 16px; height: 16px; }
  .panel-body { padding: 13px; }
  .panel-body.tight { padding: 10px 12px; }

  /* 导航在手机上平分整行，4个标签一屏全显，绝无截断、无需横滑 */
  .nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 2px;
    padding: 2.5px;
    overflow-x: visible;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    width: 100%;
    min-width: 0;
    padding: 7px 1px;
    font-size: 11.5px;
    gap: 3px;
    justify-content: center;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .nav-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

  .masthead-inner { padding: 8px 10px; }
  .brand { gap: 7px; }
  .brand-seal { width: 26px; height: 32px; }
  .brand-seal img { width: auto; height: 32px; max-width: 26px; }
  .brand-text strong { font-size: 16px; letter-spacing: .08em; }
  .brand-text em { display: none; }
  .masthead-meta { font-size: 10px; gap: 6px; }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-title { font-size: 18px; gap: 8px; }
  .page-title svg { width: 20px; height: 20px; }
  .page-eyebrow { font-size: 8.5px; letter-spacing: .2em; margin-bottom: 5px; }
  .page-sub { font-size: 11.5px; line-height: 1.55; margin-top: 4px; }

  /* 表单与交互按钮手机触控增强（最小高度 44px） */
  input, select, textarea {
    font-size: 15px !important; /* 避免 iOS 自动缩放 */
  }
  .btn {
    min-height: 42px;
    padding: 10px 14px;
    font-size: 13.5px;
  }
  .btn.sm {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 12px;
  }
  .form-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .form-actions .spacer { display: none; }

  /* 筛选工具栏在手机下自适应满宽 */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .toolbar .search {
    max-width: 100%;
    min-width: 0;
  }
  .toolbar select {
    width: 100%;
    max-width: 100% !important;
  }

  /* 仓库卡手机适配 */
  .wh { padding: 14px 14px 12px; }
  .wh-head { margin-bottom: 10px; }
  .wh-title { font-size: 15px; }
  .wh-stats { flex-direction: row; gap: 8px; }
  .wh-stat { padding: 8px 10px; }
  .wh-stat-val { font-size: 17px; }

  /* 弹窗居底抽屉化或居中留安全区 */
  .modal-mask { padding: 12px; }
  .modal {
    padding: 18px 16px 16px;
    max-height: 92vh;
    border-radius: var(--r-md);
  }
  .modal h3 { font-size: 16.5px; }

  /* 拍照存证区在手机上更易按 */
  .shot { padding: 16px 12px; }
  .shot-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .shot-actions .btn { width: 100%; justify-content: center; }

  tbody td .sub-cell { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ═════════════════════════════ 打印 ═════════════════════════════ */

@media print {
  body { background: #fff; color: var(--shadow-ink); }
  .paper, .masthead, .colophon, .toolbar, .btn { display: none !important; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}

/* ═══════════════════════════════════════════════════════════════════════
   主题 · 浅色（宣纸 / 酥油灯 / 朱砂 / 鎏金）
   —— 只覆盖 token；组件层修正集中在文件末尾
   ═══════════════════════════════════════════════════════════════════════ */

:root[data-theme="dark"] { color-scheme: dark; }

:root[data-theme="light"] {
  color-scheme: light;

  /* — 宣纸基底 — */
  --ink-1000: #F7EFE0;
  --ink-900:  #FBF5EA;
  --ink-800:  #FFFDF7;
  --ink-700:  #F5EBDA;
  --ink-600:  #EFE3CE;
  --ink-500:  #E9DAC2;
  --ink-400:  #DFCDB0;

  --ink-400-rgb: 240, 228, 208;
  --ink-500-rgb: 253, 248, 238;
  --ink-700-rgb: 247, 238, 224;
  --ink-800-rgb: 255, 253, 247;
  --ink-850-rgb: 251, 244, 232;
  --ink-900-rgb: 246, 236, 221;

  /* — 鎏金（浅底上需要压深才够对比） — */
  --gold-100: #FFF9E9;
  --gold-200: #F2DFB2;
  --gold-300: #D8B676;
  --gold-400: #BC9040;
  --gold-500: #9B7226;
  --gold-600: #6E4F16;
  --gold-label: #7A5718;
  --gold-glow: rgba(188, 144, 64, 0.22);

  --gold-100-rgb: 255, 249, 233;
  --gold-300-rgb: 216, 182, 118;
  --gold-400-rgb: 188, 144, 64;
  --gold-600-rgb: 110, 79, 22;

  /* — 朱砂 — */
  --cin-300: #B23B27;
  --cin-300-text: #A83622;
  --cin-400: #AE3A27;
  --cin-500: #92251A;
  --cin-600: #76160E;

  --cin-400-rgb: 174, 58, 39;
  --cin-500-rgb: 146, 37, 26;
  --cin-600-rgb: 118, 22, 14;

  /* — 松石 / 青金 — */
  --turq-300: #2E827C;
  --turq-400: #2A6E69;
  --turq-500: #245B57;
  --lapis-400: #3A5786;

  /* — 语义色（压深以适配浅底） — */
  --ok-400: #3F6829;
  --ok-500: #3B6626;
  --warn-400: #7F5409;
  --danger-400: #AB342A;

  --ok-400-rgb: 74, 122, 51;
  --ok-500-rgb: 59, 102, 38;
  --warn-400-rgb: 154, 106, 18;
  --danger-400-rgb: 171, 52, 42;

  /* — 文字：深褐墨 — */
  --tx-1: #2B1F14;
  --tx-2: #473828;
  --tx-3: #6A5641;
  --tx-4: #6F5E48;
  --tx-5: #6E5E48;

  /* — 线：金线在浅底上要提亮透明度 — */
  --line-1: rgba(150, 105, 40, 0.13);
  --line-2: rgba(150, 105, 40, 0.21);
  --line-3: rgba(150, 105, 40, 0.34);
  --line-4: rgba(150, 105, 40, 0.52);

  /* — 阴影：暖褐投影，不用纯黑 — */
  --shade: 92, 68, 40;
  --shadow-ink: #5C4428;
  --sh-1: 0 1px 2px rgba(92, 68, 40, .16);
  --sh-2: 0 8px 24px -8px rgba(92, 68, 40, .28);
  --sh-3: 0 24px 60px -20px rgba(92, 68, 40, .34);
  --sh-gold: 0 0 0 1px rgba(188, 144, 64, .3), 0 10px 30px -12px rgba(92, 68, 40, .26);

  /* — 凹陷：暖砂 — */
  --tone: 132, 100, 58;
  --hollow-1: rgba(var(--tone), .07);
  --hollow-2: rgba(var(--tone), .12);
  --hollow-3: rgba(var(--tone), .16);

  /* — 表面 — */
  --surface-head-1: #F6EBD6;
  --surface-head-2: #EFE2C8;
  --modal-1: #FFFDF7;
  --modal-2: #FBF3E3;
  --modal-3: #F6EBDA;
  --mask: rgba(60, 42, 24, .42);
}

/* ── 浅色 · 组件层校正 ─────────────────────────────────────────────── */

/* 底色层：浅底要收敛渐变强度，避免奶白被洗成灰 */
:root[data-theme="light"] { color-scheme: light; }
html[data-theme="light"] { background: #F7EFE0; }
:root[data-theme="light"] body {
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(var(--cin-500-rgb), .07), transparent 58%),
    radial-gradient(90% 60% at 100% 0%, rgba(var(--gold-400-rgb), .11), transparent 55%),
    radial-gradient(70% 50% at 0% 100%, rgba(var(--turq-500-rgb), .05), transparent 60%),
    linear-gradient(180deg, var(--ink-900) 0%, var(--ink-1000) 100%);
}
:root[data-theme="light"] .paper { opacity: .85; }

/* 肌理：浅底用暗金细纹代替白色噪点 */
:root[data-theme="light"] .paper {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23A9781F' stroke-width='1' stroke-opacity='.085'%3E%3Cpath d='M60 20v80M20 60h80'/%3E%3Cpath d='M38 38h44v44H38z' stroke-opacity='.06'/%3E%3Cpath d='M60 44l16 16-16 16-16-16z' stroke-opacity='.075'/%3E%3C/g%3E%3C/svg%3E"),
    repeating-linear-gradient(45deg, rgba(var(--gold-400-rgb), .035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(var(--tone), .035) 0 1px, transparent 1px 3px);
}

/* 选中态：深底白字，保证可读 */
:root[data-theme="light"] ::selection { background: rgba(var(--gold-400-rgb), .34); color: #2B1F14; }

/* 滚动条 */
:root[data-theme="light"] ::-webkit-scrollbar-track { background: rgba(var(--tone), .07); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-400), rgba(var(--gold-600-rgb), .55));
  background-clip: content-box;
}

/* 顶栏：宣纸压印感，不用近黑 */
:root[data-theme="light"] .masthead {
  background: linear-gradient(180deg, rgba(255, 253, 247, .97) 0%, rgba(249, 241, 227, .94) 100%);
  box-shadow: 0 14px 34px -26px rgba(92, 68, 40, .5), inset 0 1px 0 rgba(255, 255, 255, .8);
}
:root[data-theme="light"] .masthead-fret {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='7' viewBox='0 0 22 7'%3E%3Cpath d='M0 .5h22M2 .5v4h6v-2H5M14 .5v4h6v-2h-3' fill='none' stroke='%23A9781F' stroke-opacity='.42' stroke-width='1'/%3E%3C/svg%3E");
}

/* 品牌印章：彩色唐卡徽章自带底影，保持通透自然 */
:root[data-theme="light"] .brand-seal {
  color: var(--gold-500);
  background: transparent;
  box-shadow: none;
}
:root[data-theme="light"] .brand-text strong {
  background: linear-gradient(96deg, #8A5E12 0%, var(--gold-400) 42%, #7A5310 70%, var(--gold-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
}
:root[data-theme="light"] .brand:hover { filter: drop-shadow(0 6px 14px rgba(var(--gold-400-rgb), .38)); }

/* 导航：胶囊底在浅色下要变浅 */
:root[data-theme="light"] .nav {
  background: rgba(var(--tone), .06);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
:root[data-theme="light"] .nav-btn.active { color: #2B1B08; }
:root[data-theme="light"] .nav-btn.active svg { opacity: 1; }

/* 表格头：浅色纸面 */
:root[data-theme="light"] thead th {
  color: var(--tx-3);
  background: linear-gradient(180deg, var(--surface-head-1), var(--surface-head-2));
  box-shadow: inset 0 -1px 0 var(--line-2), 0 1px 0 rgba(var(--tone), .1);
}

/* 金按钮：浅底上要压深字色才不至于糊 */
:root[data-theme="light"] .btn-gold { color: #3B2606; }
:root[data-theme="light"] .btn-gold:hover { color: #2A1A03; }
:root[data-theme="light"] .btn-cinnabar { color: #FFF4F0; }

/* 弹窗遮罩在浅色下要更轻，否则像关机 */
:root[data-theme="light"] .modal-mask { background: rgba(60, 42, 24, .42); }

/* 页脚：浅底上 tx-5 + opacity 会掉到 2.5:1，抬回可读 */
:root[data-theme="light"] .colophon { color: var(--tx-4); }
:root[data-theme="light"] .colophon-sub { color: var(--tx-4); opacity: 1; }

/* 金渐变文字在浅底会"消失"：数字改用深褐墨，金只留作描边点缀 */
:root[data-theme="light"] .metric-num {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: #3A2A17;
  color: #3A2A17;
}
:root[data-theme="light"] .metric-num small {
  -webkit-text-fill-color: var(--tx-4);
}

/* 统计卡图标：浅底上要压到深金才看得见 */
:root[data-theme="light"] .metric-glyph {
  color: var(--gold-600);
  background: linear-gradient(160deg, rgba(var(--gold-400-rgb), .3), rgba(var(--gold-400-rgb), .12));
  box-shadow: inset 0 0 0 1px var(--line-3);
}

/* 品牌字渐变：整段压深，保证 23px 粗体也过 3:1 */
:root[data-theme="light"] .brand-text strong {
  /* 必须用 background-image：简写 background 会重置 background-clip，
     导致文字填充变透明、品牌名整块消失 */
  background-image: linear-gradient(96deg, #5A3F10 0%, #6E4F16 26%, #8A5E12 52%, #5A3F10 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

/* 金按钮：最深那一档压到 4.5:1 以上 */
:root[data-theme="light"] .btn-gold { color: #241505; }
:root[data-theme="light"] .btn-gold:hover { color: #170D02; }

/* 金色渐变最暗档 #9B7226 的亮度上限只够 4.27:1（连纯黑都到不了 4.5）
   → 浅色主题下把渐变末端抬到 gold-400，深字才真正达标 */
:root[data-theme="light"] .nav-btn.active {
  color: #2B1B08;
  background: linear-gradient(160deg, var(--gold-200) 0%, var(--gold-300) 45%, var(--gold-400) 100%);
}
:root[data-theme="light"] .btn-gold {
  color: #241505;
  background: linear-gradient(165deg, var(--gold-200) 0%, var(--gold-300) 55%, var(--gold-400) 100%);
}
:root[data-theme="light"] .btn-gold:hover {
  color: #170D02;
  background: linear-gradient(165deg, var(--gold-100) 0%, var(--gold-200) 45%, var(--gold-300) 100%);
}

/* 视频 / 照片框保持深底（内容本身偏暗，浅框反而刺眼） */
:root[data-theme="light"] video.cam { background: #1A1208; }

/* 图例光晕在浅色下收敛 */
:root[data-theme="light"] .legend .i-in,
:root[data-theme="light"] .legend .i-out,
:root[data-theme="light"] .rank .bar-fill { box-shadow: none; }

/* 打印：无论主题都走黑白 */
@media print {
  :root[data-theme="light"] body,
  :root[data-theme="dark"] body { background: #fff; color: #000; }
}

/* ── 配色切换器 ───────────────────────────────────────────────────── */

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--hollow-1);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.theme-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tx-4);
  cursor: pointer;
  transition: background .22s var(--ease), color .22s var(--ease),
              box-shadow .22s var(--ease), transform .18s var(--ease);
}
.theme-btn svg { width: 14px; height: 14px; }

.theme-btn:hover { color: var(--gold-300); background: rgba(var(--gold-400-rgb), .1); }
.theme-btn:active { transform: scale(.92); }

.theme-btn.active {
  color: var(--gold-label);
  background: linear-gradient(160deg, rgba(var(--gold-400-rgb), .3), rgba(var(--cin-500-rgb), .26));
  box-shadow: inset 0 0 0 1px rgba(var(--gold-400-rgb), .42), 0 2px 8px -3px rgba(var(--shade), .8);
}

.theme-btn:focus-visible {
  outline: 2px solid var(--gold-300);
  outline-offset: 2px;
}

/* 浅色：选中态反过来（深金底 + 米白图标） */
:root[data-theme="light"] .theme-btn { color: var(--tx-4); }
:root[data-theme="light"] .theme-btn:hover { color: var(--gold-600); background: rgba(var(--gold-400-rgb), .14); }
:root[data-theme="light"] .theme-btn.active {
  color: #FFFBF0;
  background: linear-gradient(160deg, var(--gold-400), var(--gold-500));
  box-shadow: inset 0 0 0 1px rgba(var(--gold-600-rgb), .38), 0 2px 8px -3px rgba(92, 68, 40, .45);
}

/* 窄屏：顶栏让位给日期，切换器跟进第二行 */
@media (max-width: 720px) {
  .theme-switch { order: -1; }
  .theme-btn { width: 24px; height: 24px; }
}

/* 主题切换的过渡：只给颜色，别给布局属性，否则会掉帧 */
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim,
  html.theme-anim body,
  html.theme-anim .masthead,
  html.theme-anim .card,
  html.theme-anim .panel,
  html.theme-anim thead th {
    transition: background-color .28s var(--ease), color .28s var(--ease),
                border-color .28s var(--ease), box-shadow .28s var(--ease);
  }
}
