/* ==========================================================================
   设计系统（设计令牌 + 组件）。规则详见 docs/01-设计规范.md
   风格：「粉彩卡片」——薄荷 / 粉 / 奶油黄 / 薰衣草四种色块，大圆角，墨黑色做主按钮和选中状态，
   标题和大数字用 Outfit 字体。
   1. 颜色只用下面的变量（--accent、--mint…），组件里不写死颜色，深色模式才能自动跟着变。
   2. 间距用 4 的倍数（--sp-1…--sp-10）；圆角：输入框 14px，卡片 24px，色块 28px，大面板 36px，按钮是胶囊。
   3. 手机优先：点击区域至少 44px；底部浮动导航；表单在手机上从底部弹出（底部抽屉）。
   ========================================================================== */
@font-face {
  font-family: "Outfit"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/outfit-latin-wght.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  /* 底色：最外层薄荷灰 → 大面板 → 白色卡片 */
  --bg: #E5EDEA; --paper: #F5F5F2; --surface: #FFFFFF; --surface-2: #EEF1EF; --sunken: #EEF1EF;
  --text: #1C1E1D; --muted: #5A615E; --faint: #8C9390;
  --border: #D9E0DD; --hairline: #E7EBE9;
  /* 强调色是墨黑：主按钮、选中的导航、今天的日期 */
  --accent: #1C1E1D; --accent-2: #000000; --accent-weak: #DCEBE6; --on-accent: #FFFFFF;
  /* 四种色块（卡片底色），上面的文字一律用 --on-tile */
  --mint: #CFE5DF; --rose: #F8D3E4; --butter: #FAE3A2; --lilac: #DACDEB;
  --on-tile: #1C1E1D; --on-tile-muted: #3F4542;
  --ok: #15803D; --ok-weak: #DDF3E4; --warn: #B4530A; --warn-weak: #FCEBD7; --danger: #D62F32; --danger-weak: #FBE3E3;
  --idle: #6A55A8; --idle-weak: #ECE6F8;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --r-control: 14px; --r-card: 24px; --r-tile: 28px; --r-panel: 36px; --r-sheet: 28px;
  --shadow: 0 1px 2px rgba(28, 30, 29, .04);
  --shadow-float: 0 20px 60px rgba(28, 30, 29, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Outfit", var(--font-body);
  font-family: var(--font-body);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0D100F; --paper: #151918; --surface: #1C2120; --surface-2: #232927; --sunken: #191E1C;
  --text: #ECEFEE; --muted: #A9B1AE; --faint: #78807D;
  --border: #2E3533; --hairline: #262C2A;
  --accent: #ECEFEE; --accent-2: #FFFFFF; --accent-weak: #22332F; --on-accent: #0D100F;
  --mint: #1F3A35; --rose: #42253A; --butter: #433816; --lilac: #312845;
  --on-tile: #ECEFEE; --on-tile-muted: #C3CAC7;
  --ok: #4ADE80; --ok-weak: #102A1B; --warn: #F59E0B; --warn-weak: #2C1E08; --danger: #F87171; --danger-weak: #2E1415;
  --idle: #B9A6F2; --idle-weak: #241D3A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-float: 0 20px 60px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, .tile-title { text-wrap: balance; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--text) 55%, transparent); outline-offset: 2px; }
.ic { display: block; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.display { font-family: var(--font-display); letter-spacing: -.02em; }

/* ---------- 布局：电脑左侧图标栏 + 大面板；手机（或横着拿的手机）底部浮动导航 ----------
   内容区是一个「容器」（container: content）：首页、列表按内容区实际有多宽来排列，不按整个屏幕——
   所以有没有左侧栏、窗口拉多宽，都会自动换成最合适的列数。 */
:root { --gutter: clamp(16px, 3.2vw, 48px); --content-max: 1680px; }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 96px 1fr; gap: var(--sp-4); padding: var(--sp-4); }
.rail { position: sticky; top: var(--sp-4); height: calc(100dvh - 2 * var(--sp-4)); background: var(--surface); border-radius: var(--r-panel); padding: var(--sp-6) 0 var(--sp-4); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); overflow-y: auto; scrollbar-width: none; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.02em; flex: none; position: relative; }
.brand-mark::after { content: ""; position: absolute; right: -3px; bottom: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); border: 2px solid var(--surface); }
.rail .brand-mark { margin-bottom: var(--sp-6); }
.nav-btn { display: grid; justify-items: center; gap: 4px; width: 80px; padding: 4px 0; border: 0; border-radius: var(--r-control); background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.2; text-align: center; }
.nav-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; transition: background .18s var(--ease), color .18s var(--ease), transform .12s var(--ease); }
.nav-btn:hover .nav-ic { background: var(--sunken); color: var(--text); }
.nav-btn:active .nav-ic { transform: scale(.94); }
.nav-btn.on { color: var(--text); }
.nav-btn.on .nav-ic { background: var(--accent); color: var(--on-accent); }
.rail-foot { margin-top: auto; display: grid; gap: var(--sp-1); }
.main { min-width: 0; display: flex; flex-direction: column; background: var(--paper); border-radius: var(--r-panel); min-height: calc(100dvh - 2 * var(--sp-4)); }
.topbar { display: flex; align-items: center; gap: var(--sp-4); width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin-inline: auto; padding: var(--sp-8) var(--gutter) var(--sp-2); }
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: clamp(28px, 3.2vw, 46px); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; min-width: 0; }
.topbar .sp { flex: 1; }
.top-search { position: relative; width: clamp(200px, 28vw, 440px); }
.top-search .ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search .input { height: 56px; border-radius: 999px; border-color: transparent; padding-left: 52px; background: var(--surface); }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--rose); color: var(--on-tile); font-family: var(--font-display); font-weight: 600; font-size: 18px; transition: transform .12s var(--ease); }
.avatar:active { transform: scale(.94); }
@media (max-height: 620px) { .topbar { padding-top: var(--sp-4); } .rail { padding-top: var(--sp-4); } .rail .brand-mark { margin-bottom: var(--sp-2); } }
.content { container: content / inline-size; width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin-inline: auto; padding: var(--sp-4) var(--gutter) var(--sp-10); }
.dock { display: none; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  .shell { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .rail { display: none; }
  .main { border-radius: 0; min-height: 100dvh; }
  .topbar { padding: var(--sp-5) var(--sp-4) var(--sp-1); gap: var(--sp-3); }
  .top-search { display: none; }
  .avatar { width: 44px; height: 44px; font-size: 15px; }
  .content { padding: var(--sp-3) var(--sp-4) calc(var(--nav-h) + var(--safe-b) + var(--sp-8)); }
  /* 底部浮动导航：白色胶囊，选中的是墨黑圆；横屏或平板上不拉满，居中最宽 520px */
  .dock { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: max(var(--sp-3), calc(50% - 260px)); right: max(var(--sp-3), calc(50% - 260px)); bottom: calc(var(--sp-3) + var(--safe-b)); z-index: 30; height: var(--nav-h); padding: 6px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(28, 30, 29, .14); }
  .dock button { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; font-size: 10.5px; font-weight: 650; border-radius: 999px; min-width: 0; }
  .dock button .ic { transition: transform .12s var(--ease); }
  .dock button.on { background: var(--accent); color: var(--on-accent); }
  .dock button:active .ic { transform: scale(.9); }
}

/* ---------- 基础组件 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 48px; padding: 0 var(--sp-5); border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 650; transition: transform .12s var(--ease), background .16s, border-color .16s, opacity .16s; }
.btn:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { min-height: 40px; padding: 0 var(--sp-4); font-size: 13px; }
.btn.block { width: 100%; }
.btn.icon { width: 48px; padding: 0; }
.btn.sm.icon { width: 40px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.is-busy { pointer-events: none; opacity: .7; }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); box-shadow: var(--shadow); }
.card.pad { padding: var(--sp-5); }
.stack { display: grid; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.section-title { margin: var(--sp-8) 0 var(--sp-4); font-family: var(--font-display); font-size: clamp(22px, 2.2vw, 32px); font-weight: 500; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.section-title:first-child { margin-top: var(--sp-2); }
.section-title .count { color: var(--faint); font-weight: 400; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.warn { background: var(--warn-weak); color: var(--warn); } .badge.danger { background: var(--danger-weak); color: var(--danger); }
.badge.ok { background: var(--ok-weak); color: var(--ok); } .badge.idle { background: var(--idle-weak); color: var(--idle); } .badge.accent { background: var(--accent); color: var(--on-accent); }

/* 数字卡片（旧名 .kpi，首页之外也可以用） */
.grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
@media (max-width: 760px) { .grid-kpi { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); } }
.kpi { text-align: left; padding: var(--sp-5); border-radius: var(--r-tile); border: 0; background: var(--surface); animation: rise .45s var(--ease) both; animation-delay: var(--d, 0ms); }
.kpi small { color: var(--muted); font-weight: 600; } .kpi b { display: block; font-family: var(--font-display); font-size: 32px; font-weight: 500; letter-spacing: -.02em; margin-top: 2px; }

/* ---------- 色块卡片（tile）：整块可点；右下角圆形箭头，悬停时转向前方 ---------- */
/* 色块本身也是容器：标题和大数字的字号跟着色块的宽度变（cqi = 色块宽度的 1%） */
.tile { position: relative; container-type: inline-size; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--sp-1); min-width: 0; min-height: 168px; padding: var(--sp-5) var(--sp-5) var(--sp-5) var(--sp-6); border: 0; border-radius: var(--r-tile); background: var(--surface); color: var(--on-tile); text-align: left; overflow: hidden; transition: transform .16s var(--ease); animation: rise .45s var(--ease) both; animation-delay: var(--d, 0ms); }
.tile:active { transform: scale(.985); }
.tile.mint { background: var(--mint); } .tile.rose { background: var(--rose); } .tile.butter { background: var(--butter); } .tile.lilac { background: var(--lilac); }
.tile-title { font-family: var(--font-display); font-size: clamp(20px, 10cqi, 32px); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; padding-right: 64px; overflow-wrap: anywhere; }
.tile-sub { color: var(--on-tile-muted); font-size: 13px; font-weight: 550; padding-right: 64px; }
.tile-label { color: var(--on-tile); font-size: 15px; font-weight: 600; }
.tile-num { font-family: var(--font-display); font-size: clamp(40px, 26cqi, 76px); font-weight: 500; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
/* 窄的色块：箭头小一点，说明文字藏起来（标题还在） */
@container (max-width: 220px) {
  .go { width: 46px; height: 46px; right: var(--sp-3); bottom: var(--sp-3); }
  .tile-title, .tile-sub { padding-right: 52px; }
  .tile-sub { display: none; }
}
.tile-chip { position: absolute; top: var(--sp-4); right: var(--sp-4); display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.go { position: absolute; right: var(--sp-4); bottom: var(--sp-4); width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text); transition: transform .28s var(--ease); }
.tile:hover .go, .tile:focus-visible .go { transform: rotate(45deg); }
/* 「今天常用」：窄的时候两列（单出来的最后一块占满一行），够宽三列；特别窄一列 */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 120px; }
/* 「库存概况」：两列，够宽四列 */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.stats .tile { min-height: 160px; justify-content: space-between; }
.home-main { container: homemain / inline-size; min-width: 0; }
@container homemain (min-width: 640px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles > :last-child:nth-child(odd) { grid-column: auto; min-height: 168px; }
}
@container homemain (min-width: 700px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container homemain (max-width: 300px) { .tiles { grid-template-columns: minmax(0, 1fr); } .tiles > .tile, .tiles > :last-child:nth-child(odd) { min-height: 112px; } }
@container homemain (max-width: 560px) {
  .tiles, .stats, .restock { gap: var(--sp-3); }
  .tile { min-height: 136px; padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5); }
  .stats .tile { min-height: 128px; }
}

/* 需要补货：宽色块 + 进度条（现有 / 最低库存） */
.restock { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--sp-4); }
.restock .tile { min-height: 0; justify-content: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.restock-head { display: flex; align-items: center; gap: var(--sp-3); padding-right: 64px; min-width: 0; }
.restock-head .thumb { background: var(--surface); color: var(--text); }
.restock-head small { color: var(--on-tile-muted); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restock .go { top: var(--sp-4); bottom: auto; width: 48px; height: 48px; }
.meter { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--on-tile) 16%, transparent); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--on-tile); transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform .6s var(--ease); }
.restock-q { display: flex; align-items: baseline; gap: 6px; color: var(--on-tile-muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 首页两栏：左边动作和库存，右边动态日历 ---------- */
/* 内容区窄于 1040px：一栏（日历在下面）；够宽：两栏，右栏 320–480px */
.home { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.home > aside { container: side / inline-size; min-width: 0; }
.home > aside > .section-title:first-child { margin-top: var(--sp-8); }
@container content (min-width: 1040px) {
  .home { grid-template-columns: minmax(0, 1fr) clamp(320px, 30%, 480px); gap: clamp(32px, 3.5cqi, 64px); }
  .home > aside > .section-title:first-child { margin-top: var(--sp-2); }
}
/* 右栏（或一栏时的日历区）够宽：日历和当天记录并排 */
.side-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--sp-6); align-items: start; }
@container side (min-width: 720px) { .side-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .side-grid > [data-agenda] { margin-top: 0; } }

/* 日历：有出入库的日子是薄荷色，今天/选中是墨黑 */
.cal { padding: clamp(14px, 6cqi, 24px); border-radius: var(--r-tile); background: var(--surface); }
.cal-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.cal-head b { flex: 1; font-family: var(--font-display); font-size: clamp(20px, 6cqi, 26px); font-weight: 500; letter-spacing: -.02em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px 2px; text-align: center; }
.cal-dow { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-bottom: var(--sp-2); }
.cal-day { justify-self: center; width: min(44px, 100%); aspect-ratio: 1; padding: 0; border-radius: 50%; border: 0; background: transparent; color: var(--text); font-family: var(--font-display); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; transition: background .16s, color .16s, transform .12s var(--ease); }
.cal-day:hover { background: var(--sunken); }
.cal-day:active { transform: scale(.92); }
.cal-day.has { background: var(--mint); color: var(--on-tile); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-day.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.cal-day.out { color: var(--faint); }
.cal-legend { display: flex; gap: var(--sp-4); margin-top: var(--sp-4); font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 50%; background: var(--mint); }
.cal-legend i.today { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text); }
@container side (max-width: 360px) { .cal-day { font-size: 15px; } }

/* 动态 / 提醒列表：薄荷色胶囊，左边白色圆形图标 */
.agenda { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
.agenda-item { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-5) var(--sp-3) var(--sp-3); border-radius: var(--r-tile); background: var(--mint); color: var(--on-tile); border: 0; width: 100%; text-align: left; animation: rise .35s var(--ease) both; animation-delay: var(--d, 0ms); }
.agenda-item.rose { background: var(--rose); } .agenda-item.lilac { background: var(--lilac); } .agenda-item.butter { background: var(--butter); }
.agenda-ic { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text); }
.agenda-item b { display: block; font-size: 15px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.agenda-item small { display: block; color: var(--on-tile-muted); font-size: 13px; font-weight: 550; }
.agenda-item .q { margin-left: auto; font-family: var(--font-display); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.agenda-empty { padding: var(--sp-5); border-radius: var(--r-tile); border: 1.5px dashed var(--border); color: var(--muted); font-size: 14px; text-align: center; }

/* 表单：标签永远可见（不只靠 placeholder）；手机上字号 16px，iPhone 才不会自动放大 */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 650; color: var(--muted); }
.input, .select, textarea.input { width: 100%; min-height: 48px; padding: 0 var(--sp-4); border-radius: var(--r-control); border: 1px solid var(--border); background: var(--surface); outline: none; transition: border-color .16s, box-shadow .16s; }
textarea.input { padding: var(--sp-3) var(--sp-4); min-height: 96px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 70%, transparent); }
.input::placeholder { color: var(--faint); }
@media (max-width: 760px) { .input, .select { font-size: 16px; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.help { font-size: 13px; color: var(--muted); margin: 0; }
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 0; }

/* 搜索 + 筛选条 */
.toolbar { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.search { position: relative; flex: 1; min-width: min(100%, 200px); max-width: 720px; }
.search .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 48px; height: 52px; border-radius: 999px; border-color: transparent; background: var(--surface); }
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { flex: none; height: 40px; padding: 0 var(--sp-4); border-radius: 999px; border: 0; background: var(--surface); color: var(--muted); font-weight: 650; font-size: 13px; transition: background .16s, color .16s; }
.chip.on { background: var(--accent); color: var(--on-accent); }

/* 列表行：整行可点，信息分三块（图 · 名称/次要信息 · 数量） */
.list { display: grid; gap: var(--sp-2); }
/* 内容区够宽：列表自动排成 2–4 列（每列至少 400px）；展开的那一行、空状态占满整行 */
@container content (min-width: 880px) {
  .list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
  .list > .item.open, .list > .empty, .list > .help { grid-column: 1 / -1; }
}
/* 设置：够宽时卡片排成两列；入库表单不拉得太宽 */
@container content (min-width: 1000px) { #screen > .stack:has(> section.card) { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
#screen > .card.pad.stack { max-width: 760px; }
.item { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-3); border: 1px solid transparent; border-radius: 22px; background: var(--surface); text-align: left; transition: border-color .16s, transform .12s var(--ease); animation: rise .35s var(--ease) both; }
.item:hover { border-color: var(--border); }
.item:active { transform: scale(.99); }
.item.open { border-color: var(--text); }
.thumb { width: 48px; height: 48px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: hsl(var(--h, 160) 45% 88%); color: hsl(var(--h, 160) 40% 26%); font-family: var(--font-display); font-weight: 600; font-size: 15px; flex: none; }
:root[data-theme="dark"] .thumb { background: hsl(var(--h, 160) 25% 22%); color: hsl(var(--h, 160) 55% 82%); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-t { min-width: 0; } .item-t b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-t small { color: var(--muted); font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.item-q { text-align: right; } .item-q b { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .item-q small { color: var(--muted); font-size: 12px; }
.item-body { grid-column: 1 / -1; display: grid; gap: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--border); cursor: default; }
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--muted); border-radius: var(--r-tile); border: 1.5px dashed var(--border); }
.empty .ic { margin: 0 auto var(--sp-3); color: var(--faint); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }

/* 数量步进器：大按钮，单手好按 */
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: var(--sp-2); }
.stepper button { min-height: 56px; border-radius: 50%; border: 0; background: var(--sunken); font-size: 24px; font-weight: 600; transition: transform .12s var(--ease); }
.stepper button:active { transform: scale(.92); }
.stepper input { text-align: center; font-family: var(--font-display); font-size: 26px; font-weight: 600; min-height: 56px; border-radius: 999px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--sunken); }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 650; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--on-accent); }

/* ---------- 底部抽屉（手机）/ 侧边面板（电脑）：表单、详情都放这里 ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(13, 16, 15, .42); backdrop-filter: blur(2px); animation: fade .2s both; }
.sheet { position: fixed; z-index: 61; right: var(--sp-3); top: var(--sp-3); bottom: var(--sp-3); width: min(480px, calc(100vw - 24px)); background: var(--paper); border-radius: var(--r-panel); box-shadow: var(--shadow-float); display: flex; flex-direction: column; overflow: hidden; animation: slide-in .3s var(--ease) both; }
.sheet-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3) var(--sp-6); }
.sheet-head h2 { margin: 0; flex: 1; font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -.02em; min-width: 0; overflow-wrap: anywhere; }
.sheet-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: var(--sp-2) var(--sp-6) var(--sp-6); display: grid; gap: var(--sp-4); align-content: start; }
.sheet-foot { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) calc(var(--sp-4) + var(--safe-b)); border-top: 1px solid var(--hairline); }
.sheet-foot .sp { flex: 1; }
.sheet-grip { display: none; }
@media (max-width: 760px) {
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92dvh; border-radius: var(--r-sheet) var(--r-sheet) 0 0; animation: sheet-up .32s var(--ease) both; touch-action: pan-y; }
  .sheet-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin: 10px auto 0; }
  .sheet-head { padding: var(--sp-3) var(--sp-4) var(--sp-2) var(--sp-5); }
  .sheet-body { padding: var(--sp-2) var(--sp-5) var(--sp-5); }
  .sheet.dragging { transition: none; }
}

/* 提示条（toast）和「撤销」条 */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--sp-6) + var(--safe-b)); transform: translateX(-50%); display: grid; gap: var(--sp-2); width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) { .toasts { bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-6)); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: 10px 10px 10px 20px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-float); animation: rise .25s var(--ease) both; }
.toast.ok { background: var(--ok); color: #fff; } .toast.danger { background: var(--danger); color: #fff; } .toast.warn { background: var(--warn); color: #fff; }
:root[data-theme="dark"] .toast.ok, :root[data-theme="dark"] .toast.danger, :root[data-theme="dark"] .toast.warn { color: #0D100F; }
.toast button { margin-left: auto; flex: none; white-space: nowrap; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .22); color: inherit; font-weight: 800; }
.toast.out { animation: fade-out .2s both; }

/* 确认对话框：只用于不能撤销的操作 */
.dialog { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: var(--sp-4); background: rgba(13, 16, 15, .45); animation: fade .15s both; }
.dialog-card { width: min(420px, 100%); background: var(--paper); border-radius: var(--r-tile); padding: var(--sp-6); box-shadow: var(--shadow-float); animation: pop .2s var(--ease) both; }
.dialog-card h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -.02em; } .dialog-card p { margin: 0 0 var(--sp-5); color: var(--muted); }
.dialog-a { display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ---------- 登录页：左边表单，右边一组色块（只是装饰） ---------- */
.login { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-6); overflow: hidden; }
.login-lines { position: absolute; inset: 0; width: 100%; height: 100%; color: color-mix(in srgb, var(--text) 14%, transparent); pointer-events: none; }
.login-card { position: relative; width: min(1080px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--sp-4); padding: var(--sp-4); border-radius: 44px; background: var(--paper); box-shadow: 0 30px 80px rgba(28, 30, 29, .10); animation: pop .4s var(--ease) both; }
.login form { display: grid; align-content: center; gap: var(--sp-5); padding: var(--sp-10) var(--sp-10) var(--sp-8); }
.login-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.login-brand b { display: block; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.01em; } .login-brand small { color: var(--muted); font-size: 13px; }
.login h1 { margin: 0; font-family: var(--font-display); font-size: clamp(40px, 5vw, 60px); font-weight: 600; letter-spacing: -.035em; line-height: 1; }
.login h1 + p { margin: -6px 0 var(--sp-2); color: var(--muted); font-size: 15px; }
.login .input { height: 56px; border-radius: 999px; padding: 0 var(--sp-5); background: var(--surface); }
.pw { position: relative; } .pw .input { padding-right: 60px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.pw button:hover { background: var(--sunken); color: var(--text); }
.login-go { position: relative; height: 60px; font-size: 16px; padding-right: 72px; justify-content: flex-start; padding-left: var(--sp-6); }
.login-go .go { right: 6px; top: 6px; bottom: 6px; width: 48px; height: 48px; background: var(--surface); color: var(--text); }
.login-go:hover .go { transform: rotate(45deg); }
.login-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.login-art { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1.1fr 1fr 1fr; gap: var(--sp-3); min-height: 560px; }
.login-art .tile { min-height: 0; animation-duration: .6s; }
.login-art .tile:active { transform: none; }
.login-art .a1 { grid-column: 1 / -1; }
.login-art .a4 { grid-column: 1 / -1; }
.login-art .tile-num { font-size: clamp(48px, 5vw, 72px); }
.login-dots { display: flex; gap: 6px; }
.login-dots i { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--paper); margin-left: -12px; background: var(--surface); }
.login-dots i:first-child { margin-left: 0; } .login-dots i:nth-child(2) { background: var(--rose); } .login-dots i:nth-child(3) { background: var(--butter); } .login-dots i:nth-child(4) { background: var(--lilac); }
@media (max-width: 860px) {
  .login { padding: 0; place-items: stretch; }
  .login-card { grid-template-columns: 1fr; border-radius: 0; min-height: 100dvh; box-shadow: none; padding: var(--sp-4); align-content: start; }
  .login form { padding: var(--sp-6) var(--sp-2) var(--sp-4); }
  .login-art { order: -1; min-height: 0; grid-template-rows: none; grid-template-columns: repeat(4, 1fr); }
  .login-art .a1, .login-art .a4 { grid-column: auto; }
  .login-art .tile { height: 64px; padding: 0; border-radius: 22px; }
  .login-art .tile > * { display: none; }
  .login-brand { margin-bottom: var(--sp-2); }
}

/* 骨架屏：加载超过一瞬间时显示，不用转圈 */
.skel { height: 72px; border-radius: 22px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* 库存地图入口（地图自己的样式在 stockmap/stock-map.css） */
.map-entry { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); border-radius: var(--r-tile); border: 0; width: 100%; text-align: left; color: #E6F0FF; background: radial-gradient(500px 200px at 90% 0%, rgba(56, 225, 255, .25), transparent), linear-gradient(135deg, #0A1224, #10203F); }
.map-entry b { display: block; font-size: 17px; } .map-entry small { color: #9DB2D6; }
.map-entry .ic { color: #38E1FF; }
.notif { display: flex; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--hairline); }
.notif.unread { border-color: color-mix(in srgb, var(--idle) 40%, var(--hairline)); background: var(--idle-weak); }
.notif b { display: block; font-size: 14px; } .notif small { color: var(--muted); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } } @keyframes fade-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes slide-in { from { transform: translateX(105%); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
