/* ==========================================================================
   买菜比价 · 前端样式
   配色：静谧夜航（墨蓝 #24406b + 琥珀金 #c9a227）
   ========================================================================== */

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

/* 重要：下面若干组件用了 display:flex，会覆盖 UA 对 [hidden] 的 display:none，
   导致 hidden 元素仍然可见。这里统一兜住。 */
[hidden] { display: none !important; }

:root {
  --ink:        #24406b;
  --ink-2:      #2f5490;
  --ink-3:      #3a6bb0;
  --ink-deep:   #1a2f4f;
  --amber:      #c9a227;
  --amber-2:    #ddb63c;
  --amber-soft: #f9f2dc;
  --amber-line: #eddfae;

  --bg:      #f0f3f8;
  --bg-2:    #e8eef6;
  --card:    #ffffff;
  --line:    #e4eaf2;
  --line-2:  #d5dfec;

  --text:    #182636;
  --text-2:  #3d5570;
  --muted:   #6b7f96;
  --muted-2: #93a3b6;

  --up:      #d64545;
  --down:    #2e9e6b;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(16, 30, 54, .05);
  --sh-2: 0 2px 6px rgba(16, 30, 54, .06), 0 10px 26px -18px rgba(16, 30, 54, .45);
  --sh-3: 0 6px 16px rgba(16, 30, 54, .10), 0 24px 48px -28px rgba(16, 30, 54, .5);
  --sh-4: 0 20px 60px -20px rgba(16, 30, 54, .35);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 22px; }

/* ============================ 启动画面 ============================ */
.boot {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #1a3054 0%, #24406b 50%, #35619f 100%);
  transition: opacity .4s var(--ease), visibility .4s;
}
.boot.hide { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; color: #fff; }
.boot-logo {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--amber);
  color: #2c2508;
  font-size: 30px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px -10px rgba(201, 162, 39, .7);
  animation: pop .5s var(--ease);
}
@keyframes pop { from { transform: scale(.7); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.boot-text { font-size: 13.5px; color: rgba(255, 255, 255, .72); letter-spacing: .5px; }
.boot-bar { width: 140px; height: 3px; margin: 16px auto 0; background: rgba(255, 255, 255, .16); border-radius: 3px; overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; background: var(--amber); border-radius: 3px; animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { 0% { transform: translateX(-100%) } 100% { transform: translateX(350%) } }

/* ============================ 登录 / 设置密码 ============================ */
.gate {
  position: fixed; inset: 0; z-index: 250;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(201, 162, 39, .16), transparent 60%),
    linear-gradient(150deg, #1a3054 0%, #24406b 55%, #35619f 100%);
}
.gate-card {
  width: 100%; max-width: 384px;
  background: #fff;
  border-radius: var(--r-xl);
  padding: 34px 30px 26px;
  box-shadow: var(--sh-4);
  animation: rise .4s var(--ease);
}
@keyframes rise { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
.gate-logo {
  display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: 2px;
  color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-line);
  padding: 3px 10px; border-radius: 6px; margin-bottom: 14px;
}
.gate-card h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; color: var(--ink); }
.gate-desc { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }
.gate-err {
  background: #fdf2f2; border: 1px solid #f3d2d2; color: #b93a3a;
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--r-sm); margin-bottom: 12px;
}
.gate-foot { margin: 18px 0 0; font-size: 11.5px; color: var(--muted-2); text-align: center; }

/* ============================ 顶栏 ============================ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, var(--ink) 0%, var(--ink-3) 100%);
  color: #fff; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px -4px rgba(36, 64, 107, .6);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt b { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .3px; }
.brand-txt em { font-size: 10.5px; font-style: normal; color: var(--muted-2); letter-spacing: .6px; }

.topbar-search { position: relative; flex: 1 1 auto; max-width: 340px; min-width: 0; }
.topbar-search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: none; stroke: var(--muted-2); stroke-width: 2; stroke-linecap: round;
}
.topbar-search input {
  width: 100%; padding: 8px 12px 8px 33px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-size: 13px; color: var(--text);
  transition: .18s var(--ease);
}
.topbar-search input:focus { outline: none; background: #fff; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(58, 107, 176, .1); }

.topbar-nav { display: flex; gap: 3px; margin-left: auto; }
.topbar-nav a {
  padding: 7px 13px; border-radius: 9px;
  font-size: 13.5px; color: var(--muted); font-weight: 500;
  transition: .16s var(--ease);
}
.topbar-nav a:hover { background: var(--bg-2); color: var(--ink); }
.topbar-nav a.active { background: var(--ink); color: #fff; }

/* ============================ 按钮 ============================ */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 15px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; white-space: nowrap; line-height: 1.35;
  transition: .16s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 4px 14px -6px rgba(36, 64, 107, .7); }
.btn-primary:hover:not(:disabled) { background: var(--ink-deep); }
.btn-amber { background: var(--amber); color: #332a06; font-weight: 600; box-shadow: 0 4px 14px -6px rgba(201, 162, 39, .8); }
.btn-amber:hover:not(:disabled) { background: var(--amber-2); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-light:hover:not(:disabled) { border-color: var(--ink-3); background: #fafcff; }
.btn-ghost { background: var(--bg-2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--line); }
.btn-danger { background: #fff; color: var(--up); border-color: #f0cfcf; }
.btn-danger:hover:not(:disabled) { background: #fdf4f4; border-color: #e3b5b5; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.btn-icon {
  width: 32px; height: 32px; padding: 0; border-radius: 9px;
  background: rgba(255, 255, 255, .82); border: 1px solid rgba(255, 255, 255, .5);
  color: var(--ink); font-size: 16px; line-height: 1;
  box-shadow: 0 2px 8px rgba(16, 30, 54, .18);
}
.btn-icon:hover { background: #fff; }

/* 移动端右下角悬浮记账按钮（宽屏隐藏，顶栏已有入口） */
.fab { display: none; }

/* ============================ 主视图 ============================ */
.view-root { padding-top: 26px; padding-bottom: 70px; min-height: 60vh; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 600; color: var(--ink); letter-spacing: .2px; }
.page-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.section { margin-bottom: 34px; }
.section-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-h h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.section-h h2::before {
  content: ""; display: inline-block; width: 3px; height: 13px; border-radius: 2px;
  background: var(--amber); margin-right: 9px; vertical-align: -1px;
}
.section-h .sub { font-size: 12px; color: var(--muted); }
.section-h .sp { flex: 1; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 18px;
}

/* ============================ 商品卡片网格 ============================ */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.chip {
  appearance: none; border: 1px solid var(--line-2); background: #fff;
  color: var(--muted); border-radius: 999px; padding: 5px 14px;
  font-size: 12.5px; cursor: pointer; transition: .16s var(--ease); font-family: inherit;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 18px; }
/* 关键：grid/flex 子项默认最小宽度是内容宽度，会让卡片撑破容器 */
.grid > * { min-width: 0; }

.gcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s;
  display: flex; flex-direction: column;
}
.gcard:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--line-2); }
.gcard:hover .gcard-img i { transform: scale(1.06); }
.gcard:hover .gcard-img .no-cover { transform: scale(1.05); }

.gcard-img {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: linear-gradient(140deg, #eaf0f8, #dde7f3);
}
.gcard-img i {
  display: block; width: 100%; height: 100%;
  background-size: cover; background-position: center;
  transition: transform .5s var(--ease);
}
.gcard-img .no-cover {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: rgba(36, 64, 107, .26);
  background: linear-gradient(140deg, #e7eef8, #d9e5f4);
  transition: transform .5s var(--ease);
  letter-spacing: 2px;
}
.gcard-badge {
  position: absolute; left: 10px; top: 10px;
  background: rgba(255, 255, 255, .93); color: var(--ink);
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 7px;
  backdrop-filter: blur(6px); box-shadow: 0 1px 4px rgba(16, 30, 54, .12);
}
.gcard-best {
  position: absolute; right: 10px; bottom: 10px;
  background: linear-gradient(135deg, var(--amber-2), var(--amber));
  color: #332a06; font-size: 12.5px; font-weight: 700;
  padding: 4px 11px; border-radius: 9px;
  box-shadow: 0 5px 16px -6px rgba(201, 162, 39, .95);
  font-variant-numeric: tabular-nums;
}
.gcard-best em { font-style: normal; font-size: 10px; font-weight: 600; opacity: .75; }

.gcard-body { padding: 13px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.gcard-name { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .2px; line-height: 1.3; }
.gcard-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.gcard-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.gcard-foot {
  margin-top: auto; padding-top: 9px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--muted); flex-wrap: wrap;
}
.gcard-foot > span { min-width: 0; }
.gcard-foot .save { color: var(--down); font-weight: 600; }
.gcard-foot .none { color: var(--muted-2); }

.gcard-empty { border-style: dashed; background: #fbfcfe; }
.gcard-empty .gcard-img { background: #f4f7fb; }
.gcard-add {
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; color: var(--muted);
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg);
  cursor: pointer; transition: .2s var(--ease); background: #fbfcfe;
  min-height: 190px;
}
.gcard-add:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.gcard-add span:first-child { font-size: 26px; line-height: 1; }
.gcard-add span:last-child { font-size: 12.5px; }

/* ============================ 商品详情 ============================ */
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted-2); }
.crumbs b { color: var(--text); font-weight: 500; }

.detail-hero { display: grid; grid-template-columns: 300px 1fr; gap: 26px; margin-bottom: 28px; }
.hero-cover {
  aspect-ratio: 4 / 3; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(140deg, #e7eef8, #d9e5f4); position: relative;
  box-shadow: var(--sh-2);
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.hero-cover .no-cover {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 54px; font-weight: 700; color: rgba(36, 64, 107, .22);
}
.hero-info { display: flex; flex-direction: column; }
.hero-title { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 8px; }
.hero-title h1 { margin: 0; font-size: 25px; font-weight: 600; color: var(--ink); letter-spacing: .2px; }
.hero-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.hero-verdict {
  background: linear-gradient(135deg, #fdfaf0, var(--amber-soft));
  border: 1px solid var(--amber-line); border-radius: var(--r);
  padding: 15px 17px; margin-bottom: 18px;
}
.hero-verdict .lbl { font-size: 11.5px; color: #9a7f1c; letter-spacing: .3px; }
.hero-verdict .big { display: flex; align-items: baseline; gap: 10px; margin: 5px 0 3px; flex-wrap: wrap; }
.hero-verdict .big b { font-size: 26px; font-weight: 700; color: #8a6d0b; font-variant-numeric: tabular-nums; }
.hero-verdict .big em { font-style: normal; font-size: 13px; color: #7d6a2c; }
.hero-verdict .note { font-size: 12px; color: #9a7f1c; }
.hero-verdict .note b { color: #7d5f08; }
.hero-acts { display: flex; gap: 9px; flex-wrap: wrap; margin-top: auto; }

/* 平台价格行 */
.prow {
  display: grid; grid-template-columns: 178px 1fr 124px 92px;
  gap: 14px; align-items: center; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; margin-bottom: 9px; cursor: pointer;
  transition: .18s var(--ease); position: relative;
}
.prow:hover { border-color: var(--ink-3); box-shadow: var(--sh-2); transform: translateX(2px); }
.prow.is-best { border-color: var(--amber-line); background: linear-gradient(100deg, #fffcf2, #fff); }
.prow.is-off { opacity: .55; }
.prow-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.prow-name b { font-size: 13px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-name .badge { font-size: 10.5px; padding: 1px 6px; flex: none; }
.prow-bar { height: 24px; background: var(--bg-2); border-radius: 7px; overflow: hidden; position: relative; }
.prow-bar i {
  display: block; height: 100%; border-radius: 7px;
  background: linear-gradient(90deg, #a8bdd6, #6d8fb4);
  transition: width .5s var(--ease);
}
.prow-bar i.best { background: linear-gradient(90deg, var(--amber-2), var(--amber)); }
.prow-price { text-align: right; font-variant-numeric: tabular-nums; }
.prow-price b { font-size: 15px; font-weight: 600; color: var(--text); }
.prow-price b.best { color: #8a6d0b; }
.prow-price div { font-size: 11px; color: var(--muted); margin-top: 1px; }
.prow-right { text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.prow-right .cnt { display: block; color: var(--ink-3); }

.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--bg-2); color: var(--muted); white-space: nowrap;
}
.badge-amber { background: var(--amber-soft); color: #8a6d0b; border: 1px solid var(--amber-line); font-weight: 600; }
.badge-online { background: #eaf1fb; color: #2f5490; }
.badge-offline { background: #eef7ec; color: #3f7a35; }
.badge-group { background: #fdf0e6; color: #a95c17; }
.badge-on { background: #e8f7f0; color: #1f7d52; }
.badge-off { background: #f1f5f9; color: #6b7f96; }

/* ============================ 图表 ============================ */
.chart-box { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 18px 14px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.chart-head .unit { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.chart-svg { width: 100%; }
.chart-svg text { font-family: inherit; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-item .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-item .up { color: var(--up); font-variant-numeric: tabular-nums; }
.legend-item .down { color: var(--down); font-variant-numeric: tabular-nums; }
.legend-item .flat { color: var(--muted-2); }

/* ============================ 表格 ============================ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px;
  padding: 9px 11px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fbfcfe; position: sticky; top: 0;
}
.tbl th:first-child { border-top-left-radius: var(--r-sm); }
.tbl th:last-child  { border-top-right-radius: var(--r-sm); }
.tbl td { padding: 10px 11px; border-bottom: 1px solid #f2f5fa; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafcff; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl input[type=number] { padding: 6px 9px; text-align: right; max-width: 92px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.tbl-wrap .tbl th { background: #f7fafd; }
/* 规格内联显示：仅手机端启用（配合隐藏独立的规格列） */
.spec-inline { display: none; }
/* 手机上隐藏的次要列（管理页表格等） */
.m-hide { display: table-cell; }

/* ============================ 表单 ============================ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 13px; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field .help { font-size: 11.5px; color: var(--muted-2); }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; min-width: 0; font-family: inherit; font-size: 13.5px; color: var(--text);
  background: #fbfcfe; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: .16s var(--ease);
}
input:focus, select:focus, textarea:focus {
  background: #fff; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(58, 107, 176, .11);
}
input::placeholder, textarea::placeholder { color: #a9b7c7; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7f96' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 11px; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-acts { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-top: 6px; }

/* 封面选择器 */
.cover-picker { display: flex; gap: 13px; align-items: flex-start; flex-wrap: wrap; }
.cover-preview {
  width: 132px; aspect-ratio: 4 / 3; border-radius: var(--r); overflow: hidden;
  border: 1.5px dashed var(--line-2); background: #fbfcfe;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; transition: .18s var(--ease); flex: none;
}
.cover-preview:hover { border-color: var(--amber); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview .ph { font-size: 12px; color: var(--muted-2); text-align: center; line-height: 1.5; }
.cover-preview .ph b { display: block; font-size: 19px; color: var(--muted); margin-bottom: 3px; }
.cover-tools { flex: 1; min-width: 190px; }
.cover-tools .row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cover-tools .help { font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }

/* ============================ 清单 ============================ */
.list-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; margin-bottom: 16px; box-shadow: var(--sh-1); }
.list-card > header { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; flex-wrap: wrap; }
.list-card > header h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); }
.list-card > header .sp { flex: 1; }
.best-box {
  background: linear-gradient(135deg, #fdfaf0, var(--amber-soft));
  border: 1px solid var(--amber-line); border-radius: var(--r); padding: 16px 18px; margin: 15px 0;
}
.best-box .lbl { font-size: 11.5px; color: #9a7f1c; letter-spacing: .3px; }
.best-box .big { font-size: 26px; font-weight: 700; color: #8a6d0b; margin: 4px 0 3px; font-variant-numeric: tabular-nums; }
.best-box .note { font-size: 12px; color: #9a7f1c; }
.best-box .note b { color: #7d5f08; }

.meter { display: grid; grid-template-columns: 128px 1fr 104px; gap: 12px; align-items: center; padding: 6px 0; }
.meter .nm { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter .bar { height: 22px; background: var(--bg-2); border-radius: 7px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, #a8bdd6, #6d8fb4); transition: width .5s var(--ease); }
.meter .bar i.best { background: linear-gradient(90deg, var(--amber-2), var(--amber)); }
.meter .bar i.off { background: #e3e9f1; }
.meter .val { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter .val.off { color: var(--muted-2); font-weight: 400; font-size: 12px; }

/* ============================ 空状态 ============================ */
.empty { text-align: center; padding: 58px 22px; color: var(--muted); }
.empty .ico { font-size: 44px; margin-bottom: 14px; opacity: .5; line-height: 1; }
.empty b { display: block; font-size: 15.5px; color: var(--ink); font-weight: 600; margin-bottom: 7px; }
.empty p { margin: 0 0 18px; font-size: 13px; }
.empty .acts { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

/* ============================ 弹窗 ============================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(18, 30, 48, .48);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: var(--r-xl); width: 100%;
  max-width: 560px; max-height: 88vh; overflow: auto;
  box-shadow: var(--sh-4); animation: rise .26s var(--ease);
}
.modal.wide { max-width: 720px; }
.modal > header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px 15px; position: sticky; top: 0; background: #fff; z-index: 2;
  border-bottom: 1px solid var(--line);
}
.modal > header h3 { margin: 0; font-size: 16.5px; font-weight: 600; color: var(--ink); }
.modal > header .sp { flex: 1; }
.modal > header .x {
  appearance: none; border: 0; background: var(--bg-2); width: 30px; height: 30px;
  border-radius: 9px; font-size: 17px; color: var(--muted); cursor: pointer; line-height: 1;
}
.modal > header .x:hover { background: var(--line); color: var(--text); }
.modal .body { padding: 20px 24px 24px; }
.modal .foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ============================ 离线提示条 ============================ */
.offline-bar {
  background: linear-gradient(90deg, #4d3d10, #6f5a17 55%, #4d3d10);
  color: #fdf5d8;
  font-size: 12.5px; line-height: 1.45; text-align: center;
  padding: 9px 16px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.offline-bar::before { content: "⚠"; font-size: 13px; flex: none; }

/* ============================ Toast / Lightbox ============================ */
.toast {
  position: fixed; left: 50%; bottom: 34px; z-index: 400;
  transform: translateX(-50%) translateY(16px);
  background: rgba(26, 47, 79, .96); color: #fff;
  padding: 12px 22px; border-radius: 12px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: .26s var(--ease);
  box-shadow: 0 16px 40px -14px rgba(16, 30, 54, .7);
  max-width: 88vw; text-align: center;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(160, 45, 45, .97); }
.toast.ok::before { content: "✓"; color: var(--amber-2); font-weight: 700; }

.lightbox {
  position: fixed; inset: 0; z-index: 350; background: rgba(12, 20, 34, .88);
  display: flex; align-items: center; justify-content: center; padding: 30px;
  cursor: zoom-out; animation: fade .2s var(--ease);
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r); box-shadow: var(--sh-4); }

/* ============================ 页脚 ============================ */
.foot { border-top: 1px solid var(--line); background: #fff; padding: 18px 0; margin-top: 40px; }
.foot .wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.foot a:hover { color: var(--ink); }

/* ============================ 骨架屏 ============================ */
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, #f2f6fb 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: sk 1.3s linear infinite; border-radius: var(--r); }
@keyframes sk { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ============================ 响应式 ============================ */
@media (max-width: 900px) {
  .detail-hero { grid-template-columns: 1fr; gap: 18px; }
  .hero-cover { max-width: 340px; }
  .prow { grid-template-columns: 1fr 96px; grid-template-areas: "name price" "bar right"; gap: 8px 12px; }
  .prow .prow-name { grid-area: name; }
  .prow .prow-bar { grid-area: bar; }
  .prow .prow-price { grid-area: price; }
  .prow .prow-right { grid-area: right; }
}

/* ---------------- 手机 ---------------- */
@media (max-width: 720px) {
  .wrap { padding: 0 15px; }
  .view-root { padding-top: 16px; padding-bottom: 92px; }

  /* 顶栏：第一行 品牌 + 导航；第二行 搜索框通栏 */
  .topbar-in { height: auto; flex-wrap: wrap; padding: 9px 15px; gap: 9px 8px; }
  .brand { order: 1; flex: 0 1 auto; min-width: 0; }
  .brand-txt em { display: none; }
  .brand-txt b { font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
  .topbar-nav { order: 2; margin-left: auto; gap: 2px; flex: none; }
  .topbar-nav a { padding: 7px 11px; font-size: 13px; }
  #btnQuickAdd { display: none; }              /* 换成右下角悬浮按钮，拇指够得到 */
  .topbar-search { order: 3; flex: 1 1 100%; max-width: none; min-width: 0; }
  .topbar-search input { padding: 9px 12px 9px 33px; font-size: 16px; }

  /* 卡片网格 */
  .grid { grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 13px; }
  .gcard-body { padding: 12px 12px 13px; }
  .gcard-name { font-size: 14px; }
  .gcard-best { font-size: 12px; padding: 4px 9px; }

  .page-head h1 { font-size: 18.5px; }
  .page-head .sub { font-size: 12px; }
  .page-head { margin-bottom: 15px; }
  .section { margin-bottom: 26px; }
  .card { padding: 15px; border-radius: 13px; }

  /* 详情页：封面缩成小方块，让"最低价"和渠道列表尽早上屏 */
  .detail-hero {
    display: grid;
    grid-template-columns: 84px 1fr;
    grid-template-areas:
      "cover title"
      "cover sub"
      "verdict verdict"
      "acts acts";
    gap: 9px 13px;
    margin-bottom: 22px;
  }
  .hero-cover {
    grid-area: cover; width: 84px; height: 84px; max-width: none;
    aspect-ratio: 1 / 1; border-radius: 14px; align-self: start;
  }
  .hero-cover .no-cover { font-size: 30px; letter-spacing: 0; }
  .hero-info { display: contents; }
  .hero-title { grid-area: title; align-self: end; margin-bottom: 0; gap: 7px; }
  .hero-title h1 { font-size: 19px; }
  .hero-title .badge { font-size: 11px; padding: 2px 7px; }
  .hero-sub { grid-area: sub; align-self: start; margin-bottom: 0; font-size: 12px; }
  .hero-verdict { grid-area: verdict; margin-bottom: 0; padding: 13px 15px; }
  .hero-verdict .big b { font-size: 23px; }
  .hero-verdict .big em { font-size: 12.5px; }
  .hero-acts { grid-area: acts; margin-top: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .hero-acts .btn:first-child { grid-column: 1 / -1; }

  /* 渠道价格行：条形变细，一行塞更多 */
  .prow { padding: 11px 13px; gap: 6px 10px; border-radius: 11px; margin-bottom: 8px; }
  .prow-bar { height: 7px; }
  .prow-right { display: flex; align-items: center; justify-content: flex-end; gap: 9px; font-size: 11.5px; }
  .prow-right .cnt { display: inline; }
  .prow-price b { font-size: 15.5px; }
  .prow-price div { font-size: 10.5px; }

  /* 表格：不折行 + 收起次要列，避免挤成一团 */
  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { white-space: nowrap; padding: 9px 8px; }
  .c-note { display: none; }
  .c-spec { display: none; }
  .m-hide { display: none; }
  .spec-inline { display: inline; color: var(--muted); font-size: 11.5px; }
  .tbl-wrap { border-radius: 11px; }

  /* 清单 */
  .meter { grid-template-columns: 84px 1fr 78px; gap: 8px; }
  .meter .nm { font-size: 12px; }
  .list-card { padding: 15px; border-radius: 13px; }
  .best-box { padding: 14px 15px; }
  .best-box .big { font-size: 24px; }
  .section-h h2 { font-size: 14.5px; }

  /* 小节标题：说明文字换到下一行，避免把标题挤断 */
  .section-h { flex-wrap: wrap; gap: 5px 10px; }
  .section-h h2 { order: 1; flex: none; white-space: nowrap; }
  .section-h .sp { order: 2; }
  .section-h .btn { order: 2; }
  .section-h .sub { order: 3; flex: 1 1 100%; font-size: 11.5px; }

  /* 图表 */
  .chart-box { padding: 14px 11px 11px; }
  .legend { gap: 12px; margin-top: 12px; padding-top: 11px; }
  .legend-item { font-size: 12px; }

  /* 弹窗改成底部抽屉：操作按钮常驻，不用滚到底 */
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none; width: 100%; max-height: 92vh;
    display: flex; flex-direction: column;
    border-radius: 20px 20px 0 0; overflow: hidden;
    animation: sheet-up .28s var(--ease);
  }
  @keyframes sheet-up { from { transform: translateY(100%) } to { transform: none } }
  .modal::before {
    content: ""; flex: none; width: 38px; height: 4px; border-radius: 2px;
    background: var(--line-2); margin: 9px auto 0;
  }
  .modal > header { position: static; flex: none; padding: 12px 18px; border-bottom: 0; }
  .modal > header h3 { font-size: 16px; }
  .modal .body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 18px 0; }
  .modal .foot {
    position: sticky; bottom: 0; z-index: 3;
    margin: 16px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line);
    justify-content: stretch; gap: 9px; flex-wrap: nowrap;
  }
  .modal .foot .btn { flex: 1; padding: 12px; font-size: 14px; }

  /* 表单控件放大，手指好点；16px 同时避免 iOS 聚焦时自动放大页面 */
  input[type=text], input[type=number], input[type=password], input[type=search], input[type=date], select, textarea {
    padding: 11px 12px; font-size: 16px;
  }
  .field > label { font-size: 12.5px; }
  .chip { padding: 7px 14px; font-size: 13px; }
  .btn-xs { padding: 7px 11px; font-size: 12.5px; }

  /* 右下角悬浮记账按钮 */
  .fab {
    display: flex; position: fixed; right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 54px; height: 54px; border-radius: 17px; padding: 0;
    font-size: 26px; line-height: 1; z-index: 90;
    box-shadow: 0 12px 28px -8px rgba(201, 162, 39, .9), 0 4px 12px rgba(16, 30, 54, .14);
  }

  .foot { padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); }
  .foot .wrap { font-size: 11.5px; padding-right: 78px; }   /* 给右下角悬浮按钮让位 */
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .gcard-body { padding: 10px 10px 11px; }
  .gcard-best { font-size: 11.5px; padding: 3px 8px; }
  .gcard-foot { font-size: 11px; }
  .btn { padding: 9px 12px; font-size: 13px; }
  .meter { grid-template-columns: 74px 1fr 72px; }
}

/* ============================ PWA 独立窗口 ============================ */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
  .boot, .gate { padding-top: env(safe-area-inset-top); }
  /* 独立窗口下桌面端不需要"添加到主屏幕"之类的浏览器 UI 占位 */
  .foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media print {
  .topbar, .foot, .filters, .hero-acts, .btn { display: none !important; }
}
