/* 佳屿商家 · 商家工作台样式（绿松石主题，与平台端视觉区分） */
:root {
  --primary: #0f9f7a;
  --primary-soft: #e8f8f3;
  --primary-line: #c7ece1;
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1b1b1f;
  --text-2: #5f6673;
  --text-3: #9aa1ab;
  --line: #ecedf0;
  --ok: #17945f;
  --warn: #b47500;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(23, 26, 40, .06);
}

* { box-sizing: border-box; }
/* 关键：作者样式中的 display 会覆盖 UA 的 [hidden]，必须显式兜底 */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; font-size: 14px; }
table { border-collapse: collapse; width: 100%; }
.muted { color: var(--text-3); }

/* ------------------------------- 登录门禁 ------------------------------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: #f0f2f5; z-index: 50; }
.gate-card { width: 400px; background: #fff; border-radius: 18px; padding: 32px; box-shadow: 0 20px 50px rgba(20, 24, 40, .12); }
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: #10312a; color: #52e0b5; font-size: 19px;
}
.gate-brand b, .brand b { display: block; font-size: 15px; line-height: 1.2; }
.gate-brand em, .brand em { font-style: normal; font-size: 9.5px; letter-spacing: 1.8px; color: var(--text-3); }
.gate-card h2 { font-size: 20px; margin: 0 0 6px; }
.gate-tip { font-size: 12.5px; color: var(--text-3); margin: 0 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; border: 1px solid #e3e5ea; border-radius: 9px; padding: 0 12px; outline: none;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 159, 122, .12); }
.btn {
  height: 40px; padding: 0 18px; border-radius: 9px; border: 0; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0c8a69; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-plain { background: #f4f5f7; color: var(--text-2); border: 1px solid #e6e8ec; }
.btn-plain:hover { color: var(--primary); border-color: var(--primary-line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
#gateForm .btn { width: 100%; height: 44px; margin-top: 6px; }
.gate-err { background: #fdeceb; color: #c0392b; font-size: 12.5px; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.gate-demo {
  margin-top: 16px; padding: 10px 12px; border: 1px dashed #e3e5ea; border-radius: 9px;
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3);
}
.gate-demo button { border: 0; background: var(--primary-soft); color: var(--primary); padding: 3px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.gate-back { display: block; text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-3); }
.gate-back:hover { color: var(--primary); }

/* --------------------------------- 布局 --------------------------------- */
.admin { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line); padding: 22px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; border-bottom: 1px solid var(--line); }
.side-nav { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  padding: 11px 14px; border-radius: 9px; font-size: 13.5px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.side-nav a:hover { background: #f6f7f9; color: var(--text); }
.side-nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-nav a { position: relative; }
.nav-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #e5341a; margin-left: auto;
  box-shadow: 0 0 0 3px rgba(229, 52, 26, .12);
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: var(--text-3); padding: 0 8px; }
.side-foot a:hover { color: var(--primary); }
.side-foot button { border: 0; background: transparent; color: var(--text-3); text-align: left; padding: 0; cursor: pointer; }
.side-foot button:hover { color: var(--primary); }

.main { padding: 0 26px 40px; min-width: 0; }
.topbar {
  display: flex; align-items: center; height: 68px; gap: 16px;
  border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.topbar h1 { font-size: 19px; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 12.5px; }
.who { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }
.who i { font-style: normal; }

/* --------------------------------- 卡片 --------------------------------- */
.grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 27px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 14px; font-weight: 600; margin-right: 2px; }
.kpi .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.kpi.accent .val { color: var(--primary); }

.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 14px; }
.panel-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15px; margin: 0; }
.panel-head .right { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.panel-body { padding: 18px 20px 22px; }

.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.two-col > .panel { margin-top: 14px; }

/* 柱状趋势 */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.chart .bar {
  width: 100%; max-width: 44px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #4fd8b2, #0f9f7a); min-height: 3px;
  transition: height .5s ease; position: relative;
}
.chart .bar.zero { background: #e9ecf0; }
.chart .bar:hover { filter: brightness(1.06); }
.chart .bar .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #22262f; color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 5px;
  white-space: nowrap; opacity: 0; transition: .15s; pointer-events: none;
}
.chart .bar:hover .tip { opacity: 1; }
.chart .date { font-size: 11.5px; color: var(--text-3); }
.chart .empty { margin: auto; color: var(--text-3); font-size: 13px; }

/* 排行 / 占比 */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.rank-row:last-child { border-bottom: 0; }
.rank-no { width: 20px; height: 20px; border-radius: 6px; background: #f4f5f7; color: var(--text-2); font-size: 11.5px; display: grid; place-items: center; font-weight: 700; }
.rank-row:nth-child(1) .rank-no { background: var(--primary); color: #fff; }
.rank-row:nth-child(2) .rank-no { background: #ffd9cf; color: #cf3a17; }
.rank-row:nth-child(3) .rank-no { background: #fff0e8; color: #cf3a17; }
.rank-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; }

.share-row { padding: 8px 0; }
.share-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.share-top b { color: var(--text); font-weight: 600; }
.share-bar { height: 7px; background: #f2f3f6; border-radius: 999px; margin-top: 6px; overflow: hidden; }
.share-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8fe8cd, #0f9f7a); border-radius: 999px; }

/* --------------------------------- 表格 --------------------------------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input[type="text"] {
  height: 36px; border: 1px solid #e4e6ea; border-radius: 8px; padding: 0 12px; outline: none; width: 220px;
}
.toolbar input:focus { border-color: var(--primary); }
.seg { display: flex; gap: 4px; background: #f4f5f7; padding: 3px; border-radius: 9px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--primary); font-weight: 700; box-shadow: 0 1px 4px rgba(20, 24, 40, .08); }
.toolbar .spacer { margin-left: auto; font-size: 12.5px; color: var(--text-3); }

table.list { font-size: 13px; }
table.list th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 12.5px;
  padding: 12px 14px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.list td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fcfcfd; }
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-cell img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #f5f6f8; }
.prod-cell .t { font-size: 13px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-cell .s { font-size: 11.5px; color: var(--text-3); }
.price { color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.stock-low { color: #c0392b; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.on { background: #e8f6ef; color: var(--ok); }
.badge.off { background: #f2f3f6; color: var(--text-3); }
.badge.pending { background: #fff4e5; color: var(--warn); }
.badge.paid { background: #fff0eb; color: #d1401d; }
.badge.shipped { background: #eaf1ff; color: #2a5bd7; }
.badge.done { background: #e8f6ef; color: var(--ok); }
.badge.refunding { background: #fff4e5; color: var(--warn); }
.badge.refunded { background: #f3f4f6; color: var(--text-3); }
.badge.approved { background: #e8f6ef; color: var(--ok); }
.badge.rejected { background: #fdeceb; color: #c0392b; }
.badge.cancelled { background: #f3f4f6; color: var(--text-3); }
.row-actions { display: flex; gap: 8px; white-space: nowrap; }
.row-actions button { border: 0; background: transparent; color: var(--primary); font-size: 12.5px; cursor: pointer; padding: 0; }
.row-actions button:hover { text-decoration: underline; }
.row-actions .danger { color: #c0392b; }

.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 20px; font-size: 12.5px; color: var(--text-3); }
.pager button { border: 1px solid #e4e6ea; background: #fff; height: 30px; padding: 0 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager b { color: var(--text); }

/* -------------------------------- 弹窗 / Toast ------------------------------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 22, 30, .42); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 14px; width: min(460px, 100%); box-shadow: 0 24px 60px rgba(0, 0, 0, .2); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; padding: 18px 22px 8px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { margin-left: auto; border: 0; background: #f4f5f7; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; color: var(--text-2); }
.modal-body { padding: 8px 22px 4px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast-root { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #22262f; color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px; box-shadow: 0 10px 26px rgba(0, 0, 0, .18); animation: drop .22s ease; }
.toast.ok { background: #17945f; }
.toast.err { background: #c0392b; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

.empty { text-align: center; padding: 56px 0; color: var(--text-3); }
.empty .ico { font-size: 40px; opacity: .7; }
.skeleton { background: linear-gradient(90deg, #f2f3f5 25%, #e9ebee 37%, #f2f3f5 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

@media (max-width: 1080px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; padding: 12px; flex-wrap: wrap; }
  .brand { border: 0; padding: 0; }
  .side-nav { flex-direction: row; margin: 0; }
  .side-foot { margin-left: auto; flex-direction: row; }
  .main { padding: 0 14px 30px; }
  .toolbar input[type="text"] { width: 100%; }
  table.list { display: block; overflow-x: auto; white-space: nowrap; }
}

/* SKU 编辑表格 */
.sku-table td { padding: 8px 10px; }
.sku-input {
  height: 30px; border: 1px solid #e3e5ea; border-radius: 7px; padding: 0 8px;
  width: 100%; outline: none; font-size: 12.5px;
}
.sku-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 159, 122, .12); }

/* 弹窗表单补充 */
.field textarea {
  width: 100%; border: 1px solid #e3e5ea; border-radius: 9px; padding: 10px 12px;
  outline: none; resize: vertical; line-height: 1.7; font-size: 13px;
}
.field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 159, 122, .12); }
.form-tip { font-size: 11.5px; color: var(--text-3); margin-top: 6px; line-height: 1.7; }

/* 物流时间线 */
.logi-line { position: relative; padding-left: 6px; }
.logi-node { position: relative; padding: 0 0 18px 22px; border-left: 2px solid #eef0f3; }
.logi-node:last-child { border-left-color: transparent; padding-bottom: 4px; }
.logi-dot {
  position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #d9dde3; border: 2px solid #fff;
}
.logi-node.on .logi-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(255, 77, 45, .14); }
.logi-title { font-size: 13px; font-weight: 600; }
.logi-node.on .logi-title { color: var(--primary); }
.logi-detail { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.logi-time { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------------------- 商家管理（三端分离后新增） ---------------------- */
.shop-logo {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; border-radius: 10px;
  background: linear-gradient(135deg, #e9f9f4, #d3f2e9);
}
.field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line, #e6e8ee);
  border-radius: 10px; font: inherit; resize: vertical;
  background: #fff; color: inherit; outline: none;
}
.field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 159, 122, .12); }
