/* 拾光好物 · 共用样式
   不加载外部字体：国内网络下首屏更快，中文用系统字体（苹方 / 微软雅黑 / 思源黑体）。 */
:root {
  --bg: #F6F2EF; --surface: #FFFFFF; --sunk: #EFE8E3; --ink: #221815; --muted: #6E615B; --line: #E4DAD4;
  --accent: #E3402A; --accent-ink: #FFFFFF; --accent-soft: #FCE5DF; --price: #E3402A;
  --ok: #1E7F55; --ok-soft: #DDF1E7; --warn: #A8670B; --warn-soft: #FBEBD2; --bad: #B03030; --bad-soft: #F8DEDE;
  --info: #2D5FA8; --info-soft: #DFE8F6;
  --stage: #140E0C; --glass: rgba(20, 12, 10, .46); --gold: #FFC24A;
  --f-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --f-display: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --f-num: "DIN Alternate", "Barlow Condensed", "Bahnschrift", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --r: 14px; --r-sm: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161110; --surface: #1F1816; --sunk: #2A211E; --ink: #F3EBE7; --muted: #A8988F; --line: #382C28;
    --accent: #FF5B41; --accent-ink: #1A0D0A; --accent-soft: #3E1F19; --price: #FF7A62;
    --ok: #53C793; --ok-soft: #173527; --warn: #E9A63F; --warn-soft: #3A2B12; --bad: #F08A8A; --bad-soft: #3A1B1B;
    --info: #8DB4F0; --info-soft: #1B2A40;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.55;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 通用控件 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-sm); padding: 8px 14px; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.lg { padding: 12px 20px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.inp { border: 1px solid var(--line); background: var(--bg); border-radius: var(--r-sm); padding: 9px 11px; width: 100%; min-width: 0; }
.inp:focus { border-color: var(--accent); outline: none; }
textarea.inp { resize: vertical; min-height: 70px; }
select.inp { padding-right: 28px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel > h2 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.panel > h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 24px 10px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.st { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.st-wait { background: var(--warn-soft); color: var(--warn); }
.st-ship { background: var(--info-soft); color: var(--info); }
.st-done, .st-on { background: var(--ok-soft); color: var(--ok); }
.st-cancel, .st-off { background: var(--sunk); color: var(--muted); }
.st-pay { background: var(--bad-soft); color: var(--bad); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--accent-soft); color: var(--accent); }
.pill.live i { animation: blink 1.4s infinite; }
.pill.off { background: var(--sunk); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
@keyframes blink { 50% { opacity: .25; } }
.banner { border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px; background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 100;
  background: #221815; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  max-width: calc(100% - 32px); text-align: center; }
.toast.err { background: #B03030; }

/* 商品图（无图时用色块 + 首字） */
.art { position: relative; display: grid; place-items: center; overflow: hidden; flex: none; border-radius: 10px;
  background: linear-gradient(145deg, hsl(var(--h, 14) 58% 64%), hsl(calc(var(--h, 14) + 28) 48% 34%)); }
.art span { font-family: var(--f-display); font-weight: 900; color: rgba(255,255,255,.92); font-size: 24px; line-height: 1; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 价格 */
.price { color: var(--price); font-family: var(--f-num); font-weight: 700; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.price small { font-size: 13px; margin-right: 1px; }
.orig { color: #998a83; text-decoration: line-through; font-family: var(--f-num); font-size: 13px; }

/* ---------- 后台外框（主播端、管理端） ---------- */
.console { padding: 0 max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.brand { display: flex; align-items: baseline; gap: 8px; margin-right: auto; text-decoration: none; color: inherit; }
.brand b { font-family: var(--f-display); font-weight: 900; font-size: 20px; letter-spacing: .02em; }
.brand small { font-size: 12px; color: var(--muted); letter-spacing: .12em; }
.nav { display: flex; gap: 2px; background: var(--sunk); border-radius: 999px; padding: 3px; }
.nav a { text-decoration: none; color: var(--muted); padding: 5px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--sunk); border-radius: var(--r-sm); padding: 10px 14px; min-width: 0; }
.kpi .lbl { display: block; }
.kpi .v { font-family: var(--f-num); font-size: 28px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 15px; margin-right: 2px; }
.kpi.hl .v { color: var(--price); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-family: var(--f-display); font-weight: 900; font-size: 28px; margin: 0; }
.login p { margin: 0; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs em { font-style: normal; font-family: var(--f-num); background: var(--sunk); border-radius: 999px; padding: 0 7px; margin-left: 5px; font-size: 12px; }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.n, th.n { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.acts { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

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

/* ---------- 客户头像菜单（主播端、管理端） ---------- */
.avbtn { border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; flex: none; display: inline-grid; line-height: 0; }
.avbtn:hover .av { box-shadow: 0 0 0 2px var(--accent); }
.st-block { background: #2A2220; color: #fff; }
.st-mod { background: #EFE6FA; color: #6B3FA0; }
.umenu { position: fixed; z-index: 90; width: 300px; max-width: calc(100vw - 24px); background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 16px 48px rgba(20,10,8,.22); overflow: hidden; }
.umenu.sheet-mode { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.um-head { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.um-av { width: 48px !important; height: 48px !important; font-size: 18px !important; }
.um-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.um-who b { font-size: 15px; }
.um-who .rmk { align-self: flex-start; margin: 2px 0; }
.um-who small { color: var(--muted); font-size: 12px; }
.um-chips { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.um-acts { display: flex; flex-direction: column; padding: 6px; }
.um-acts > button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 10px; border-radius: 8px; font-size: 14px; color: var(--ink); }
.um-acts > button:hover, .um-acts > button:focus-visible { background: var(--sunk); }
.um-acts > button svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.um-acts > button.danger, .um-acts > button.danger svg { color: var(--bad); }
.um-confirm { margin: 4px; padding: 10px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.um-confirm p { margin: 0 0 8px; }
.um-confirm .row { justify-content: flex-end; }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; }
.um-remark { display: flex; gap: 6px; padding: 12px 14px 0; }
.um-remark .inp { flex: 1; padding: 6px 10px; }
.um-note { margin: 6px 14px 0; font-size: 12px; color: var(--muted); }
.rmk { display: inline-block; font-size: 11px; line-height: 1.5; color: var(--info); background: var(--info-soft); border-radius: 4px; padding: 0 6px; white-space: nowrap; }
