/* 上品系统 v2 — 液态玻璃浅色主题（全新编写） */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #202329; font-size: 14px;
  --accent: #0071e3;
  --ink-soft: #5e6876;
  --ink-mute: #858d99;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: #202329;
  background:
    radial-gradient(ellipse at 8% 0%, #ffffff, transparent 55%),
    radial-gradient(ellipse at 100% 30%, #dbe7f6, transparent 55%),
    radial-gradient(ellipse at 50% 110%, #e8edf5, transparent 60%),
    linear-gradient(150deg, #eef1f5, #e4e9f0);
  background-attachment: fixed;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; transition: background .18s, transform .18s, box-shadow .18s; }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 3px solid #0071e340; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }

/* —— 液态玻璃基础 —— */
.glass {
  background: linear-gradient(135deg, #ffffffa6, #ffffff4d 60%, #ffffff80);
  border: 1px solid #ffffffe6;
  border-radius: 22px;
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  box-shadow: inset 0 1px 1px #fff, inset 0 -1px 0 #ffffff80, 0 12px 34px #394d6812;
}

/* —— 顶栏 —— */
.topbar {
  position: sticky; top: 14px; z-index: 40;
  max-width: 1240px; margin: 14px auto 0; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; font-size: 24px;
  border: 1px solid #fff; border-radius: 14px;
  background: linear-gradient(145deg, #fff9, #ffffff30);
  box-shadow: inset 0 1px 1px #fff, 0 4px 14px #4452660d;
}
.brand strong { font-size: 17px; }
.brand-sub { display: block; font-size: 11px; color: var(--ink-mute); letter-spacing: 2px; margin-top: 2px; }

/* —— 按钮 —— */
.btn {
  border: 1px solid #ffffffd9; border-radius: 14px; padding: 10px 16px;
  background: #ffffff80; color: var(--ink-soft); font-size: 13px;
}
.btn.primary {
  background: linear-gradient(180deg, #2f8ff0, #0071e3); color: #fff;
  border-color: #ffffff80; box-shadow: 0 6px 16px #0071e333, inset 0 1px 1px #ffffff70;
}
.btn.danger { background: #fff; color: #c0392b; border-color: #f0c9c4; }
.text-button { border: 0; background: none; color: var(--accent); font-size: 12px; padding: 6px; }

/* —— 主体 —— */
main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 120px; }
.page-title { padding: 6px 4px 18px; }
.page-title .eyebrow { font-size: 10px; letter-spacing: 2px; color: #7e8795; font-weight: 600; }
.page-title h1 { font-size: 30px; letter-spacing: -1px; margin: 6px 0 8px; }
.page-title p { color: #737b87; font-size: 13px; line-height: 1.7; }

.toolbar { padding: 16px; margin-bottom: 18px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: #ffffff80; border: 1px solid #fff; border-radius: 15px;
  padding: 0 14px; box-shadow: inset 0 1px 3px #24364b08;
}
.search-box .icon { font-size: 20px; color: #868e9b; }
.search-box input { flex: 1; border: 0; background: none; padding: 14px 0; outline: 0; min-width: 0; }
.search-box input::placeholder { color: #969da8; }
.search-box button { border: 0; background: none; color: var(--ink-mute); font-size: 15px; }
.filter-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.seg { display: flex; gap: 4px; background: #777f8c0d; padding: 4px; border-radius: 22px; }
.seg button { background: none; border: 0; padding: 9px 18px; color: #7e8591; border-radius: 20px; font-size: 13px; }
.seg button.active { color: #202329; background: #ffffffe6; box-shadow: 0 2px 8px #28374a12; }

.list-heading { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 14px; color: #7c8491; font-size: 12px; }

/* —— 商品卡片 —— */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.product {
  overflow: hidden; border: 1px solid #ffffffd9; border-radius: 20px; position: relative;
  background: linear-gradient(145deg, #ffffffb3, #ffffff73);
  box-shadow: inset 0 1px 1px #fff, 0 6px 20px #3b4b6208;
  cursor: pointer;
}
.product.chosen { border-color: #0071e366; box-shadow: 0 0 0 2px #0071e322, 0 6px 20px #3b4b6208; }
.product-image { height: 170px; background: #ffffff73; display: flex; align-items: center; justify-content: center; padding: 14px; }
.product-image img { height: 100%; width: 100%; object-fit: contain; border-radius: 12px; }
.image-empty { color: #969da8; font-size: 12px; }
.select-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; z-index: 2; }
.product-body { padding: 14px 16px 16px; }
.product-body h3 {
  font-size: 14px; font-weight: 600; line-height: 1.55; height: 43px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.product-meta { display: flex; gap: 6px; flex-wrap: wrap; color: #9299a4; font-size: 11px; margin-top: 10px; }
.tag { background: #7c899b0c; border-radius: 6px; padding: 4px 7px; }
.tag.flag { background: #fff4d6; color: #8a6d1a; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.price { font-size: 16px; letter-spacing: -.3px; }
.price small { color: var(--ink-mute); font-size: 11px; margin-right: 4px; }
.empty-grid {
  grid-column: 1/-1; padding: 64px 24px; text-align: center; color: var(--ink-mute);
  line-height: 2; border: 1px dashed #bac4d1; border-radius: 20px;
}

/* —— 底部生成条 —— */
.bottombar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 40;
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 20px;
  max-width: calc(100vw - 32px);
}
.bottombar .sel-info { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }

/* —— 弹窗 —— */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: #2b364833; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal.hidden { display: none; }
.modal-card { width: min(860px, 100%); max-height: calc(100vh - 60px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid #ffffffcc; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid #ffffffcc; }
.x-btn { border: 0; background: #ffffff80; border-radius: 10px; width: 32px; height: 32px; color: var(--ink-soft); }

.field-group { margin-bottom: 20px; }
.field-group > h3 { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; padding-left: 2px;
  border-left: 3px solid var(--accent); padding-left: 8px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  border: 1px solid #ffffffb3; background: #ffffffa6; border-radius: 10px;
  padding: 9px 11px; color: #202329; width: 100%;
}
.field textarea { min-height: 76px; resize: vertical; }

.issue-list { display: grid; gap: 8px; margin-top: 6px; }
.issue-item { background: #fff8f0; border: 1px solid #f3ddc2; border-radius: 12px; padding: 10px 14px; font-size: 13px; color: #8a5a1e; }

/* —— Toast —— */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 86px; z-index: 80;
  background: #202329ee; color: #fff; padding: 11px 20px; border-radius: 14px; font-size: 13px;
  box-shadow: 0 10px 30px #0003; max-width: calc(100vw - 40px);
}
.toast.hidden { display: none; }

/* —— 店铺设置面板 —— */
.tabs { display: flex; gap: 4px; background: #777f8c0d; padding: 4px; border-radius: 22px; width: max-content; }
.tabs button { background: none; border: 0; padding: 10px 22px; color: #7e8591; border-radius: 20px; font-size: 14px; }
.tabs button.active { color: #202329; background: #ffffffe6; box-shadow: 0 2px 8px #28374a12; }
.panel-note {
  margin: 16px 0; padding: 13px 18px; font-size: 13px; color: #5e6876; line-height: 1.7;
  background: #fffbefee; border: 1px solid #f0e2c4; border-radius: 14px;
}
.cfg-table-wrap { overflow-x: auto; }
table.cfg { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 860px; }
table.cfg th {
  text-align: left; font-size: 12px; color: var(--ink-mute); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid #ffffffcc; white-space: nowrap;
}
table.cfg td { padding: 9px 12px; border-bottom: 1px solid #ffffff70; vertical-align: middle; }
table.cfg tr:last-child td { border-bottom: 0; }
.col-key { font-size: 11px; color: var(--ink-mute); font-family: ui-monospace, monospace; display: block; margin-top: 2px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; white-space: nowrap; }
.badge.req { background: #ffe3e0; color: #b3261e; }
.badge.opt { background: #e8ecf1; color: #5e6876; }
.badge.forbid { background: #fff1cf; color: #8a6d1a; }
.cfg select, .cfg input[type="text"] {
  border: 1px solid #ffffffb3; background: #ffffffa6; border-radius: 10px;
  padding: 8px 10px; color: #202329; max-width: 230px; width: 100%;
}
.cfg .note-cell { font-size: 11px; color: var(--ink-mute); max-width: 200px; }
.savebar { position: sticky; bottom: 18px; display: flex; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 640px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-image { height: 120px; }
  .topbar { margin: 10px 10px 0; }
  main { padding: 16px 12px 120px; }
}
