/* 佐也小铺 · 深炭灰与暖铜的店铺运营工作台 */
:root {
  color-scheme: dark;
  --bg: #191a19;
  --panel: #222421;
  --surface-raised: #2a2c28;
  --surface-input: #1c1e1b;
  --line: #3c3f38;
  --text: #f1eee7;
  --muted: #b6b7ac;
  --brand: #d9996b;
  --brand-hover: #e9ae83;
  --brand-ink: #261a12;
  --red: #f09b91;
  --green: #a5c7a5;
  --amber: #e0bd80;
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
button, a, input, select, textarea { transition: background-color 150ms var(--ease), border-color 150ms var(--ease); }
button:disabled { opacity: .5; cursor: not-allowed; }
code { overflow-wrap: anywhere; background: var(--surface-input); padding: 2px 5px; border-radius: 3px; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 420px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--radius); padding: 36px 30px; }
.login-card h1 { margin: 0 0 8px; font-size: 23px; letter-spacing: 1px; }
.login-card p.sub { margin: 0 0 28px; color: var(--muted); }
.login-card .hint { margin-top: 24px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: 0 0 216px; border-right: 1px solid var(--line); padding: 30px 16px; position: sticky; top: 0; height: 100vh; background: var(--panel); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 36px; }
.brand .mark { width: 40px; height: 40px; border: 1px solid var(--brand); color: var(--brand); display: flex; align-items: center; justify-content: center; font-family: 'Songti SC', SimSun, serif; font-size: 23px; }
.brand b { font-size: 17px; letter-spacing: 2px; }
.brand span { display: block; font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 10px 14px; border-radius: 4px; color: var(--muted); border-left: 2px solid transparent; }
.nav a:hover { background: var(--surface-raised); color: var(--text); }
.nav a.on { border-left-color: var(--brand); background: #382d24; color: #edbc97; }
.badge { font-size: 11px; background: #57362f; color: var(--red); border-radius: 4px; padding: 1px 6px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 32px; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.who { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; }
.content { padding: clamp(18px, 3vw, 40px); max-width: 1800px; width: 100%; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 32px; }
.eyebrow { font-size: 11px; color: var(--brand); letter-spacing: 2px; }
.page-heading h1 { font-size: clamp(24px, 2.5vw, 32px); font-weight: 600; margin: 6px 0 8px; letter-spacing: 1px; }
.page-heading p { color: var(--muted); margin: 0; max-width: 720px; font-size: 13px; }
.btn { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-raised); border-radius: 5px; padding: 9px 16px; font-size: 13px; flex-shrink: 0; }
.btn:hover { border-color: var(--muted); background: #33362f; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--red); border-color: #805049; }
.btn.sm { padding: 8px 12px; font-size: 12px; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 0; background: transparent; color: var(--brand); padding: 6px 8px; font-size: 12.5px; }
.btn-link:hover, .text-link:hover { text-decoration: underline; }
.btn-link.red, .form-error { color: var(--red); }
.text-link { color: var(--brand); }
.input, .select, .textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 5px; padding: 9px 12px; background: var(--surface-input); font-size: 13px; }
.input::placeholder, .textarea::placeholder { color: #979b8e; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); }
.textarea { min-height: 84px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); }
.field .err { color: var(--red); font-size: 12px; }
.row2, .row3 { display: grid; gap: 16px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.row3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.grow, .toolbar .grow { flex: 1; min-width: 0; }
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; max-width: 100%; }
.filter-form { align-items: flex-end; }
.filter-form .field, .picker-card .toolbar .field { margin: 0; flex: 1 1 160px; }
.filter-form .input, .filter-form .select { width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-body { padding: 20px; }
.table-scroll { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--surface-input); white-space: nowrap; }
tbody tr:hover { background: #2a2d27; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.sub, td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.thumb { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 4px; background: var(--surface-input); object-fit: cover; display: block; }
.thumb.empty { display: flex; align-items: center; justify-content: center; padding: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.ops { white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; line-height: 20px; border: 1px solid var(--line); white-space: nowrap; }
.tag.on { color: var(--green); background: #29382c; border-color: #465c48; }
.tag.off { color: var(--muted); background: var(--surface-input); }
.tag.draft { color: var(--amber); background: #3b3324; border-color: #665535; }
.tag.red { color: var(--red); background: #3e2b28; border-color: #6b4640; }
.tag.blue { color: #c4c9b4; background: #34382b; border-color: #555d40; }
.stock-low { color: var(--red); font-weight: 600; }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 8px; font-size: 15px; }
.empty p { margin: 10px 0 20px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.cards.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.card { background: var(--panel); padding: 24px; min-width: 0; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: clamp(22px,2.3vw,32px); font-weight: 500; margin-top: 14px; letter-spacing: -.5px; overflow-wrap: anywhere; }
.card .v small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 7px; letter-spacing: 0; }
.card.alert .v { color: var(--amber); }
.todo { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.chip { border-bottom: 1px solid var(--line); min-height: 44px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.chip b { color: var(--brand); margin: 0 4px; }
.grid2 { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 24px; align-items: start; }
.drawer-mask { position: fixed; inset: 0; background: #0a0c0ad9; z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 620px; max-width: 100vw; background: var(--panel); border-left: 1px solid var(--line); z-index: 41; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 18px; }
.drawer-body { flex: 1; overflow: auto; padding: 24px; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 12px; background: var(--panel); flex-wrap: wrap; }
.group { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 24px; }
.group > h4 { margin: 0 0 20px; font-size: 13px; color: var(--brand); font-weight: 600; letter-spacing: 1px; }
.spec-row { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,.8fr) minmax(0,.8fr) minmax(0,.7fr) 44px; gap: 8px; margin-bottom: 12px; align-items: center; }
.spec-row .x { border: 1px solid var(--line); background: var(--surface-raised); border-radius: 4px; width: 44px; height: 44px; color: var(--red); }
.product-images > p { margin: -8px 0 20px; }
.image-editor { padding: 16px 0; border-top: 1px solid var(--line); min-width: 0; }
.image-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.image-editor-head b { font-size: 13px; }
.image-editor-head b span { margin-left: 6px; font-weight: 400; }
.image-gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 12px; }
.image-gallery[data-image-gallery="cover"] { grid-template-columns: minmax(120px,164px); }
.image-tile { min-width: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--surface-input); }
.image-open { width: 100%; height: 148px; display: flex; align-items: center; justify-content: center; padding: 8px; border: 0; background: var(--surface-input); cursor: zoom-in; user-select: none; }
.image-open img { width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.image-open[data-image-drag] { cursor: grab; touch-action: none; }
.image-open[data-image-drag]:active { cursor: grabbing; }
.image-open:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; }
.image-open:hover { background: var(--surface-raised); }
.image-tile-bar { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding: 0 6px; gap: 2px; }
.image-tile-bar .btn-link { padding: 4px; min-width: 36px; }
.image-tile-bar .red { min-width: 44px; }
.image-order-hint { margin: 0 0 12px; line-height: 1.6; }
.image-tile.is-dragging { opacity: .4; }
.image-tile.drop-before { box-shadow: -3px 0 0 var(--brand); }
.image-tile.drop-after { box-shadow: 3px 0 0 var(--brand); }
.image-drag-ghost { position: fixed; z-index: 90; pointer-events: none; opacity: .9; border-color: var(--brand); box-shadow: 0 8px 24px #0006; }
.image-drag-ghost button { pointer-events: none; }
.image-empty { grid-column: 1 / -1; padding: 20px 12px; border: 1px dashed var(--line); color: var(--muted); text-align: center; font-size: 12px; }
.image-broken { display: block; padding: 16px 8px; color: var(--red); font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.image-addresses { margin-top: 8px; }
.image-addresses summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--brand); font-size: 12px; }
.image-addresses summary::before { content: '＋'; margin-right: 6px; }
.image-addresses[open] summary::before { content: '−'; }
.image-addresses label { display: block; margin-bottom: 8px; }
.image-upload-status { overflow-wrap: anywhere; }
.product-images > .image-upload-status { margin: 12px 0; }
.image-upload-status:empty { display: none; }
.modal-card.image-lightbox { width: 900px; }
.image-lightbox > img { width: 100%; height: auto; display: block; margin-top: 16px; }
.image-lightbox .image-editor-head { position: sticky; top: 0; padding: 8px 0; background: var(--panel); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: #090b09d9; padding: 24px; }
.modal-card { width: 440px; max-width: 100%; max-height: calc(100dvh - 48px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--brand); border-radius: var(--radius); padding: 28px; }
.modal-card h3 { margin: 0 0 8px; font-size: 19px; }
.modal-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.modal-card p.form-error { color: var(--red); }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.detail-head .no { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12px; margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.amount { font-size: 26px; font-weight: 500; white-space: nowrap; }
.kv { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 12px 16px; font-size: 13px; overflow-wrap: anywhere; }
.kv .k { color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 22px 20px; border-left: 1px solid var(--line); font-size: 13px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.timeline li:first-child::before { background: var(--brand); }
.timeline .t { color: var(--muted); font-size: 11px; display: block; margin-top: 4px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.caret { display: inline-flex; width: 28px; min-height: 44px; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; user-select: none; }
.caret.empty { visibility: hidden; }
.caret.open { color: var(--brand); }
.cat-name-cell { white-space: nowrap; }
.cat-name-cell .input { display: inline-block; width: auto; min-width: 160px; }
.cat-add-row td { background: var(--surface-input); }
.cat-add-row .input { margin-right: 8px; }
.cat-pick-trigger { text-align: left; color: var(--text); cursor: pointer; }
.cat-pick-trigger::after { content: '▾'; float: right; color: var(--brand); margin-left: 8px; }
.cat-pop { border: 1px solid var(--line); border-radius: 5px; margin-top: 8px; max-height: 280px; overflow: auto; background: var(--surface-input); padding: 4px 0; }
.cat-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.cat-row:hover { background: var(--surface-raised); }
.cat-row.sel { background: #3e3025; }
.cat-row .cat-name { flex: 1; }
.cat-row .cat-plus { color: var(--brand); font-weight: 600; padding: 10px; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 5px; font-size: 13px; z-index: 80; border: 1px solid var(--line); }
.toast.err { background: #482d28; color: #ffd1c9; border-color: #985f53; }
.notice { border-left: 2px solid var(--brand); padding: 12px 16px; color: var(--muted); background: var(--panel); margin: 0 0 24px; font-size: 13px; }
.section-gap, .merch-group { margin-top: 24px; }
.merch-fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,2fr) 140px; gap: 16px; }
.selected-product { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.selected-product b { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.selected-product:last-child { border-bottom: 0; }
.picker-card { width: 820px; padding: 0; }
.picker-card .panel-head h3 { font-size: 16px; }
.picker-card .pager { padding: 16px 0 0; }
.member-card { width: 650px; }
.member-info { margin: 24px 0; }
.member-orders { max-height: 280px; overflow: auto; }
.visitor-chart { padding: 16px; }
.visitor-chart svg { width: 100%; height: auto; display: block; max-height: 330px; }
.visitor-chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-axis { stroke: var(--line); }
.chart-pv { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.chart-uv { fill: none; stroke: var(--green); stroke-width: 2; stroke-dasharray: 6 4; stroke-linejoin: round; }
.chart-legend { color: var(--muted); font-size: 12px; }
.data-details summary { cursor: pointer; min-height: 44px; padding: 12px 20px; color: var(--brand); }
.path-cell { overflow-wrap: anywhere; }
@media (max-width: 1200px) {
  .cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid2 { grid-template-columns: minmax(0,1fr); }
  .sidebar { width: 190px; flex-basis: 190px; }
  .card { padding: 20px; }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { width: 100%; height: auto; position: static; padding: 16px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 0 16px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 10px; }
  .nav a { flex-shrink: 0; white-space: nowrap; gap: 8px; border-left: 0; border-bottom: 2px solid transparent; padding: 10px 14px; }
  .nav a.on { border-bottom-color: var(--brand); }
  .topbar { padding: 12px 18px; min-height: 60px; }
  .page-heading { align-items: flex-start; gap: 12px; margin-bottom: 24px; }
  .page-heading > .btn { padding-inline: 10px; }
  .eyebrow { font-size: 10px; letter-spacing: 1px; }
  .page-heading p { font-size: 12px; }
  .cards.three { grid-template-columns: minmax(0,1fr); }
  .card { padding: 18px; }
  .merch-fields { grid-template-columns: minmax(0,1fr); gap: 0; }
  .selected-product { flex-wrap: wrap; gap: 10px; }
  .selected-product .ops { margin-left: auto; }
  .detail-head { flex-direction: column; }
  .drawer-body { padding: 20px 16px; }
  .drawer-foot { padding: 12px 16px; gap: 8px; }
  .row2, .row3 { grid-template-columns: minmax(0,1fr); gap: 0; }
  .modal { padding: 12px; }
  .modal-card { padding: 20px; max-height: calc(100dvh - 24px); }
  .picker-card { padding: 0; }
  .toolbar .input { min-width: 0 !important; }
  .toolbar > .input, .toolbar > .select { flex: 1 1 160px; }
  .spec-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 44px; }
  .spec-row > :nth-child(4) { grid-column: 1 / -1; }
  .spec-row > :first-child { grid-column: 1 / -1; }
  .panel-head, .panel-body { padding: 16px; }
  .pager { padding: 14px 16px; }
  .login-card { padding: 28px 22px; }
}
.payment-review { margin-bottom: 24px; }
.payment-notice { margin: 0 0 18px; padding: 12px 16px; border-left: 3px solid var(--amber); background: var(--surface-input); color: var(--amber); }
.payment-proof { margin-top: 20px; min-height: 44px; overflow-wrap: anywhere; }
.payment-proof-open { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; padding: 12px; color: var(--brand); background: var(--surface-input); border: 1px solid var(--line); border-radius: var(--radius); }
.payment-proof-open img { display: block; width: 240px; max-width: 100%; height: 200px; object-fit: contain; background: #fff; }
.payment-proof-large { display: block; width: 100%; height: auto; margin: 16px 0; background: #fff; }
.payment-settings-image { margin: 8px 0 20px; }
.payment-qr-preview { margin-top: 16px; min-height: 44px; overflow-wrap: anywhere; }
.payment-qr-preview img { display: block; width: 220px; max-width: 100%; height: 220px; padding: 8px; object-fit: contain; background: #fff; border-radius: var(--radius); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* 备案页脚：编号由服务端按环境变量注入（admin/server/beian.js），未配置时整块不渲染 */
.site-beian { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 16px 20px 24px; color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; }
.site-beian-item { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
a.site-beian-item { border-bottom: 1px dotted transparent; }
a.site-beian-item:hover { color: var(--brand); border-bottom-color: var(--brand); }
.site-beian-item img { display: block; width: 14px; height: 14px; }
.site-beian-sep { color: var(--line); }
body:has(.site-beian) .login-wrap { min-height: calc(100vh - 62px); }
