/* ===== Nova 主题：PC / 手机自适应 ===== */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #efede7;
  --ink: #15171c;
  --ink-2: #4a505c;
  --ink-3: #8b909a;
  --line: #e6e3dc;
  --accent: #e8590c;
  --accent-soft: #fff1e8;
  --ok: #138a5b;
  --ok-soft: #e7f6ef;
  --warn: #b7791f;
  --warn-soft: #fdf4e3;
  --danger: #d63b3b;
  --danger-soft: #fdecec;
  --info: #2a62d4;
  --info-soft: #ebf1fd;
  --radius: 14px;
  --radius-sm: 10px;
  --max: 1240px;
  --header-h: 68px;
  --tab-h: 58px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 26px; height: 26px; }

.n-wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.n-main { flex: 1; padding: 24px 0 56px; }

/* ---------- Header ---------- */
.n-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.n-header .n-wrap { height: var(--header-h); display: flex; align-items: center; gap: 28px; }
.n-logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; }
.n-logo .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 15px; }
.n-logo img { height: 32px; }
.n-nav { display: flex; gap: 22px; }
.n-nav a { color: var(--ink-2); font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; }
.n-nav a:hover, .n-nav a.on { color: var(--ink); border-color: var(--ink); }
.n-search { flex: 1; max-width: 420px; margin-left: auto; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 6px 0 14px; background: var(--surface-2); border-radius: 21px; border: 1px solid transparent; transition: .2s; }
.n-search:focus-within { background: #fff; border-color: var(--ink); }
.n-search svg { color: var(--ink-3); }
.n-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; }
.n-search button { height: 32px; padding: 0 14px; border-radius: 16px; background: var(--ink); color: #fff; font-size: 13px; }
.n-tools { display: flex; align-items: center; gap: 6px; }
.n-tool { position: relative; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 20px; color: var(--ink-2); font-weight: 500; }
.n-tool:hover { background: var(--surface-2); color: var(--ink); }
.n-tool img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.n-badge { position: absolute; top: 2px; left: 24px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.n-badge:empty { display: none; }

/* ---------- Tabbar (mobile) ---------- */
.n-tabbar { display: none; }

/* ---------- Footer ---------- */
.n-footer { background: var(--ink); color: rgba(255,255,255,.62); padding: 40px 0 32px; font-size: 13px; }
.n-footer .n-wrap { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; }
.n-footer .f-brand { font-size: 18px; color: #fff; font-weight: 800; margin-bottom: 8px; }
.n-footer .f-meta p { margin-top: 4px; }

/* ---------- Buttons ---------- */
.n-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 21px; font-weight: 600; font-size: 14px; white-space: nowrap; transition: .18s; border: 1px solid transparent; }
.n-btn:disabled { opacity: .45; cursor: not-allowed; }
.n-btn-primary { background: var(--ink); color: #fff; }
.n-btn-primary:not(:disabled):hover { background: #2b2f38; }
.n-btn-accent { background: var(--accent); color: #fff; }
.n-btn-accent:not(:disabled):hover { filter: brightness(1.06); }
.n-btn-line { background: #fff; border-color: var(--line); color: var(--ink); }
.n-btn-line:not(:disabled):hover { border-color: var(--ink); }
.n-btn-ghost { color: var(--ink-2); }
.n-btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.n-btn-danger { background: #fff; border-color: #f2c4c4; color: var(--danger); }
.n-btn-danger:hover { background: var(--danger-soft); }
.n-btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 17px; }
.n-btn-lg { height: 50px; padding: 0 28px; font-size: 15px; border-radius: 25px; }
.n-btn-block { width: 100%; }

/* ---------- Cards / Section ---------- */
.n-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.n-panel-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.n-panel-h .more { margin-left: auto; font-weight: 500; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; }
.n-panel-b { padding: 20px; }
.n-section { margin-top: 40px; }
.n-section-h { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.n-section-h h2 { font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.n-section-h .kicker { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 2px; }
.n-section-h .more { margin-left: auto; display: flex; align-items: center; gap: 2px; color: var(--ink-2); font-weight: 500; }
.n-section-h .more:hover { color: var(--ink); }
.n-page-title { font-size: 26px; font-weight: 800; margin-bottom: 20px; }
.n-crumb { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; margin-bottom: 18px; flex-wrap: wrap; }
.n-crumb a:hover { color: var(--ink); }
.n-crumb b { color: var(--ink-2); font-weight: 500; }

/* ---------- Product grid ---------- */
.n-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.n-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.n-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.n-card { position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden; cursor: pointer; border: 1px solid var(--line); transition: transform .25s, box-shadow .25s; display: flex; flex-direction: column; }
.n-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(21,23,28,.35); }
.n-card-img { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); overflow: hidden; }
.n-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.n-card:hover .n-card-img img { transform: scale(1.04); }
.n-card-tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.n-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.n-tag-hot { background: var(--accent); color: #fff; }
.n-tag-new { background: var(--ink); color: #fff; }
.n-tag-off { background: var(--accent-soft); color: var(--accent); }
.n-card-b { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.n-card-name { font-weight: 600; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.n-card-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-card-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 4px; }
.n-price { color: var(--accent); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.n-price small { font-size: .7em; margin-right: 1px; }
.n-price-old { color: var(--ink-3); font-size: 12px; text-decoration: line-through; margin-left: 6px; font-variant-numeric: tabular-nums; }
.n-card-sales { font-size: 12px; color: var(--ink-3); }
.n-add { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; transition: .18s; }
.n-add:hover { background: var(--accent); }

/* ---------- Forms ---------- */
.n-field { margin-bottom: 16px; }
.n-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.n-input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; outline: none; transition: .18s; }
textarea.n-input { height: auto; padding: 12px 14px; resize: vertical; }
.n-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,23,28,.07); }
.n-input:disabled { background: var(--surface-2); color: var(--ink-3); }
.n-input-wrap { position: relative; }
.n-input-wrap .n-input { padding-right: 44px; }
.n-input-wrap .eye { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-3); border-radius: 8px; }
.n-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.n-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.n-check input { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }

/* ---------- Qty ---------- */
.n-qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 20px; background: #fff; height: 38px; }
.n-qty button { width: 38px; height: 100%; display: grid; place-items: center; color: var(--ink-2); }
.n-qty button:hover { color: var(--ink); }
.n-qty input { width: 44px; height: 100%; border: none; outline: none; text-align: center; font-weight: 600; background: none; -moz-appearance: textfield; }
.n-qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.n-qty.sm { height: 32px; }
.n-qty.sm button { width: 30px; }
.n-qty.sm input { width: 36px; }

/* ---------- Status pill ---------- */
.n-status { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.n-status.s0 { background: var(--warn-soft); color: var(--warn); }
.n-status.s1 { background: var(--info-soft); color: var(--info); }
.n-status.s2 { background: var(--accent-soft); color: var(--accent); }
.n-status.s3 { background: var(--ok-soft); color: var(--ok); }
.n-status.s4 { background: var(--surface-2); color: var(--ink-3); }
.n-status.s5 { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tabs / Chips ---------- */
.n-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.n-tabs::-webkit-scrollbar { display: none; }
.n-chip { flex: none; height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; cursor: pointer; transition: .15s; white-space: nowrap; }
.n-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.n-chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.n-chip.sm { height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------- Pager ---------- */
.n-pager { display: flex; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.n-pager button { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 19px; border: 1px solid var(--line); background: #fff; font-weight: 600; display: grid; place-items: center; }
.n-pager button:hover:not(:disabled) { border-color: var(--ink); }
.n-pager button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.n-pager button:disabled { opacity: .4; cursor: default; }
.n-pager .gap { line-height: 38px; color: var(--ink-3); }

/* ---------- Empty / Skeleton ---------- */
.n-empty { text-align: center; padding: 56px 20px; color: var(--ink-3); grid-column: 1 / -1; }
.n-empty .ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.n-empty p { margin-bottom: 16px; }
.sk { background: linear-gradient(90deg, #ebe8e1 25%, #f4f2ed 50%, #ebe8e1 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Toast（api.js showToast 使用） ---------- */
.toast { position: fixed; left: 50%; top: 84px; z-index: 999; transform: translate(-50%, -12px); opacity: 0; transition: .3s; background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 22px; font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); max-width: calc(100vw - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.toast-error { background: var(--danger); }
.toast.toast-warning { background: var(--warn); }

/* ---------- Modal / Sheet ---------- */
.n-mask { position: fixed; inset: 0; z-index: 200; background: rgba(15,16,20,.45); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .2s; }
.n-mask.show { opacity: 1; }
.n-modal { width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: 18px; overflow: hidden; transform: translateY(12px); transition: transform .25s; }
.n-mask.show .n-modal { transform: none; }
.n-modal.wide { max-width: 680px; }
.n-modal-h { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 700; }
.n-modal-h button { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.n-modal-h button:hover { background: var(--surface-2); color: var(--ink); }
.n-modal-b { padding: 22px; overflow-y: auto; }
.n-modal-f { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Key/Value rows ---------- */
.n-kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 14px; }
.n-kv > :first-child { color: var(--ink-3); flex: none; }
.n-kv > :last-child { text-align: right; word-break: break-all; }
.n-divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- Line item (cart/order) ---------- */
.n-line { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.n-line + .n-line { border-top: 1px solid var(--line); }
.n-line img { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); flex: none; }
.n-line .nm { flex: 1; min-width: 0; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.n-line .q { color: var(--ink-3); flex: none; }
.n-line .p { font-weight: 700; flex: none; min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Auth ---------- */
.n-auth { flex: 1; display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.n-auth-art { position: relative; background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.n-auth-art::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, var(--accent) 0%, transparent 65%); opacity: .55; }
.n-auth-art .n-logo .mark { background: #fff; color: var(--ink); }
.n-auth-art h1 { font-size: 44px; line-height: 1.2; font-weight: 800; position: relative; z-index: 1; }
.n-auth-art h1 em { font-style: normal; color: var(--accent); }
.n-auth-art p { color: rgba(255,255,255,.6); margin-top: 16px; position: relative; z-index: 1; }
.n-auth-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: #fff; }
.n-auth-box { width: 100%; max-width: 380px; }
.n-auth-box h2 { font-size: 28px; font-weight: 800; }
.n-auth-box .sub { color: var(--ink-3); margin: 6px 0 28px; }
.n-auth-box .alt { text-align: center; margin-top: 22px; color: var(--ink-3); }
.n-auth-box .alt a { color: var(--ink); font-weight: 700; border-bottom: 1.5px solid var(--ink); }
.n-strength { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.n-strength i { display: block; height: 100%; width: 0; transition: .25s; }
.n-strength-t { font-size: 12px; margin-top: 4px; min-height: 18px; }

/* ===================== 响应式 ===================== */
@media (max-width: 1100px) {
  .n-grid, .n-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .n-nav { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); font-size: 14px; }
  body.no-tab { padding-bottom: 0; }
  .n-wrap { padding: 0 14px; }
  .n-main { padding: 14px 0 32px; }
  .n-header .n-wrap { gap: 12px; }
  .n-logo { font-size: 17px; }
  .n-logo .mark { width: 28px; height: 28px; font-size: 13px; }
  .n-logo .txt.hide-m { display: none; }
  .n-search { height: 38px; max-width: none; }
  .n-search button { display: none; }
  .n-tools { display: none; }
  .n-header.back .n-search { display: none; }
  .n-header.back .n-back { display: grid; }
  .n-header.back .n-htitle { display: block; }

  .n-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .n-tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--ink-3); font-weight: 500; }
  .n-tabbar a.on { color: var(--ink); font-weight: 700; }
  .n-tabbar .n-badge { left: 50%; top: 5px; margin-left: 6px; }
  body.no-tab .n-tabbar { display: none; }

  .n-footer { padding: 28px 0 24px; }
  .n-grid, .n-grid.cols-5, .n-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .n-card-b { padding: 10px 10px 12px; gap: 4px; }
  .n-card-name { font-size: 13px; }
  .n-card-sub { display: none; }
  .n-price { font-size: 16px; }
  .n-add { width: 30px; height: 30px; }
  .n-add svg { width: 16px; height: 16px; }
  .n-section { margin-top: 26px; }
  .n-section-h { margin-bottom: 12px; }
  .n-section-h h2 { font-size: 18px; }
  .n-page-title { font-size: 20px; margin-bottom: 14px; }
  .n-panel-h { padding: 14px 16px; }
  .n-panel-b { padding: 16px; }
  .n-row2 { grid-template-columns: 1fr; }
  .toast { top: 66px; }

  .n-mask { align-items: flex-end; padding: 0; }
  .n-modal, .n-modal.wide { max-width: none; border-radius: 18px 18px 0 0; max-height: 90vh; transform: translateY(100%); }
  .n-modal-f { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

  .n-auth { grid-template-columns: 1fr; min-height: auto; }
  .n-auth-art { padding: 28px 22px 34px; min-height: 0; gap: 26px; }
  .n-auth-art h1 { font-size: 26px; }
  .n-auth-art p { margin-top: 8px; font-size: 13px; }
  .n-auth-form { padding: 28px 20px 40px; align-items: flex-start; }
  .n-auth-box h2 { font-size: 22px; }
  .n-auth-box .sub { margin-bottom: 20px; }
}

/* 移动端头部的返回按钮 / 标题（桌面隐藏） */
.n-back { display: none; width: 34px; height: 34px; margin-left: -6px; place-items: center; border-radius: 50%; }
.n-htitle { display: none; flex: 1; text-align: center; font-weight: 700; font-size: 16px; margin-right: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  .n-header.back .n-logo { display: none; }
}
