/* noon 看店 · 手机版
   布局：顶部黄条（店名+更新时间）→ 内容 → 底部导航。只用手机自带字体。 */
:root {
  --yellow: #FEEE00;
  --yellow-soft: #FFFBD1;
  --ink: #111111;
  --ink-2: #5E5E5A;
  --ink-3: #9A9A94;
  --bg: #F7F7F4;
  --card: #FFFFFF;
  --line: #ECECE7;
  --bar: #DCDCD4;
  --good-soft: #9FD3B0;
  --good: #1F8A4C;
  --warn: #B26B00;
  --bad: #D0352B;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --tab-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --yellow-soft: #2E2B0A;
    --ink: #F3F3EF;
    --ink-2: #B4B4AE;
    --ink-3: #7C7C77;
    --bg: #0E0E0D;
    --card: #1A1A18;
    --line: #2B2B28;
    --bar: #3A3A36;
    --good-soft: #3F7D57;
    --good: #4CC27C;
    --warn: #E0A040;
    --bad: #FF6B5E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num { font-variant-numeric: tabular-nums; }

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--yellow);
  color: #111;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px max(18px, env(safe-area-inset-right, 0px)) 12px max(18px, env(safe-area-inset-left, 0px));
}
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand-mark { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; }
.brand-name { font-weight: 600; font-size: 15px; }
.updated { font-size: 12px; opacity: .72; text-align: right; }

/* 内容区 */
.view {
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(var(--tab-h) + 28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 22px;
  max-width: 640px; margin: 0 auto;
}
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -0.4px; margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .4px; margin: 0; }
.section-note { font-size: 12px; color: var(--ink-3); }

/* 大数字 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat.hero { grid-column: 1 / -1; background: var(--yellow-soft); }
.stat.hero .stat-label, .stat.hero .stat-note { color: var(--ink-2); }
.stat-label { font-size: 12px; color: var(--ink-2); }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat.hero .stat-value { font-size: 40px; }
.stat-unit { font-size: 13px; font-weight: 500; margin-left: 3px; color: var(--ink-3); letter-spacing: 0; }
.stat-note { font-size: 12px; color: var(--ink-3); }

/* 卡片列表 */
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.row-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* 商品卡 */
.product { background: var(--card); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.product-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.product-sku { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.product-title { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kv-k { font-size: 11px; color: var(--ink-3); }
.kv-v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv-v s { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.kv-v.bad { color: var(--bad); }

/* 库龄条 */
.agebar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); }
.agebar span { display: block; height: 100%; }
.age-0 { background: var(--good-soft); }
.age-1 { background: var(--yellow); }
.age-2 { background: var(--warn); }
.age-3 { background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--ink-3); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }

/* 状态标签 */
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.chip.good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.chip.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.chip.new { color: #111; background: var(--yellow); }

/* 筛选 */
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex-shrink: 0; height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--yellow); color: #111; border-color: var(--yellow); font-weight: 600; }
.filter:focus-visible, .tab:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 柱状图 */
.chart { background: var(--card); border-radius: var(--radius); padding: 14px 14px 10px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--bar); }
.chart .bar.today { fill: var(--yellow); }
.chart .bar.zero { fill: var(--line); }
.chart .axis { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.chart .val { fill: var(--ink-2); font-size: 10px; font-weight: 600; font-family: var(--font); }
.chart .base { stroke: var(--line); stroke-width: 1; }

/* 需要注意 */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }
.alert-dot { width: 8px; height: 8px; border-radius: 4px; margin-top: 6px; flex-shrink: 0; background: var(--ink-3); }
.alert.bad .alert-dot { background: var(--bad); }
.alert.warn .alert-dot { background: var(--warn); }
.alert.good .alert-dot { background: var(--good); }

.empty { background: var(--card); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }
.more { display: block; width: 100%; padding: 12px; border: 0; background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; border-top: 1px solid var(--line); }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
}
.tab {
  flex: 1; height: var(--tab-h); border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: 11px; position: relative;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px;
  background: var(--yellow); border-radius: 0 0 3px 3px;
}

/* 登录 */
.login { position: fixed; inset: 0; z-index: 50; background: var(--yellow); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; color: #111; }
.login-mark { font-weight: 800; font-size: 44px; letter-spacing: -1.5px; line-height: 1; }
.login-card h1 { margin: -6px 0 18px; font-size: 20px; font-weight: 600; }
.login-card input { height: 50px; border-radius: 12px; border: 0; padding: 0 16px; background: #fff; color: #111; font-size: 16px; }
.login-card button { height: 50px; border-radius: 12px; border: 1.5px solid #111; background: transparent; color: #111; font-size: 16px; font-weight: 600; cursor: pointer; }
.login-card button:disabled { opacity: .6; }
.login-error { min-height: 20px; margin: 0; font-size: 13px; color: #8A1C14; }

.loading { padding: 60px 0; text-align: center; color: var(--ink-3); }

@media (prefers-reduced-motion: no-preference) {
  .view > * { animation: rise .28s ease-out both; }
  @keyframes rise { from { opacity: .001; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* 商品图 */
.thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--bg); object-fit: cover; flex-shrink: 0; display: block; }
.thumb.lg { width: 76px; height: 76px; border-radius: 12px; }
.thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 11px; font-weight: 600; }
.product-head { align-items: center; }
.product-id { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; }
.product-id > div { min-width: 0; }
.product-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 账号 */
.account { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); padding: 4px 2px; }
.link { border: 0; background: none; padding: 6px 0; color: var(--ink-2); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
