/* ============================================
   商品管理后台样式
   ============================================ */
body.admin-bg { background: var(--bg); }

.admin-header {
  background: var(--surface); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100;
}
.admin-header .container { display: flex; align-items: center; height: 64px; gap: 20px; }
.admin-header .logo { font-size: 18px; }
.admin-header .logo .logo-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
.admin-title { font-size: 16px; font-weight: 700; padding-left: 20px; border-left: 1px solid var(--line); color: var(--text-2); }
.admin-back { margin-left: auto; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.admin-back:hover { color: var(--primary); }

/* 流程条 */
.flow-bar { margin-top: 22px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 18px 26px; display: flex; align-items: center; gap: 0; }
.flow-step { flex: 1; display: flex; align-items: center; gap: 12px; position: relative; }
.flow-step:not(:last-child)::after {
  content: ""; position: absolute; right: -18px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 10px; height: 10px; border-top: 2px solid var(--line); border-right: 2px solid var(--line);
}
.flow-num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.flow-step b { font-size: 14px; display: block; }
.flow-step span { font-size: 12px; color: var(--text-3); }

/* 工具栏 */
.admin-toolbar { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn {
  padding: 10px 22px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1.5px solid var(--line); color: var(--text-2); background: var(--surface); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: #17a86b; color: #fff; }
.btn-success:hover { background: #128a58; }
.btn-danger-ghost { border: 1.5px solid var(--line); color: #e5484d; background: var(--surface); }
.btn-danger-ghost:hover { border-color: #e5484d; }
.btn-sm { padding: 6px 14px; border-radius: 8px; font-size: 13px; }
.admin-stats { margin-left: auto; display: flex; gap: 10px; }
.stat-chip { background: var(--surface); border-radius: 9px; padding: 8px 16px; font-size: 13px; color: var(--text-2); box-shadow: var(--shadow-sm); }
.stat-chip b { color: var(--primary); font-size: 16px; }

/* 表格 */
.table-card { margin-top: 18px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left; padding: 14px 18px; background: #fafbfd; color: var(--text-3);
  font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.admin-table td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: #f8faff; }

.p-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.p-thumb {
  width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0;
}
.p-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.p-id { font-size: 12px; color: var(--text-3); }

.tag-pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; background: var(--primary-light); color: var(--primary); }
.price-cell b { color: var(--accent); font-size: 15px; }
.price-cell small { color: var(--text-3); text-decoration: line-through; margin-left: 6px; }

.status-toggle {
  position: relative; width: 44px; height: 24px; border-radius: 12px; background: #d5d9e3;
  transition: background .2s; flex-shrink: 0;
}
.status-toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.status-toggle.on { background: #17a86b; }
.status-toggle.on::after { transform: translateX(20px); }
.status-text { font-size: 12px; margin-left: 8px; color: var(--text-3); }
.status-text.on { color: #17a86b; font-weight: 600; }

.op-btns { display: flex; gap: 8px; white-space: nowrap; }

.empty-tip { text-align: center; padding: 60px 0; color: var(--text-3); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 20, 34, .45); backdrop-filter: blur(2px);
  display: none; place-items: center; z-index: 200; padding: 20px;
}
.modal-mask.show { display: grid; }
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-lg); padding: 28px 30px; box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 18px; margin-bottom: 22px; display: flex; align-items: center; gap: 10px; }
.modal h3::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-item { display: flex; flex-direction: column; gap: 7px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 13px; color: var(--text-2); }
.form-item label i { color: #e5484d; font-style: normal; margin-left: 2px; }
.form-item input, .form-item select {
  height: 40px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 14px;
  font-size: 14px; transition: border-color .2s; background: #fff; width: 100%;
}
.form-item input:focus, .form-item select:focus { border-color: var(--primary); }
.emoji-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.emoji-opt {
  width: 40px; height: 40px; border-radius: 9px; border: 1.5px solid var(--line);
  font-size: 19px; display: grid; place-items: center; transition: all .15s; background: #fff;
}
.emoji-opt:hover { border-color: var(--primary); }
.emoji-opt.active { border-color: var(--primary); background: var(--primary-light); }
.modal-btns { margin-top: 26px; display: flex; gap: 14px; justify-content: flex-end; }
.modal-btns .btn { min-width: 110px; justify-content: center; }

/* 导入弹窗 */
.import-area {
  width: 100%; height: 180px; border: 1.5px dashed var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; font-family: Consolas, monospace; resize: vertical;
  color: var(--text-2);
}
.import-area:focus { border-color: var(--primary); outline: none; }
.import-hint { font-size: 12px; color: var(--text-3); margin-top: 8px; line-height: 1.7; }

/* ---------- 登录门禁 ---------- */
body.locked > .container { display: none; }
.login-mask {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: linear-gradient(135deg, #16224a 0%, #23408f 55%, #2b5cff 100%);
  place-items: center; padding: 20px;
}
.login-mask.show { display: grid; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 20px;
  padding: 40px 38px 34px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; justify-content: center; }
.login-logo .logo-mark { width: 40px; height: 40px; font-size: 20px; }
.login-sub { text-align: center; font-size: 13px; color: var(--text-3); margin: 8px 0 26px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; }
.login-field input {
  width: 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0 14px; font-size: 14px; transition: border-color .2s;
}
.login-field input:focus { border-color: var(--primary); }
.login-error {
  display: none; background: #fdecec; color: #d93025; font-size: 13px;
  border-radius: 8px; padding: 9px 14px; margin-bottom: 14px;
}
.login-error.show { display: block; }
.btn-login-submit {
  width: 100%; height: 46px; border-radius: 23px; background: var(--primary);
  color: #fff; font-size: 15px; font-weight: 700; transition: background .2s;
}
.btn-login-submit:hover { background: var(--primary-dark); }
.login-hint { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-3); line-height: 1.8; }
.btn-logout { margin-left: auto; }

@media (max-width: 860px) {
  .flow-bar { flex-direction: column; gap: 14px; }
  .flow-step:not(:last-child)::after { display: none; }
  .table-card { overflow-x: auto; }
  .admin-table { min-width: 720px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .admin-header .container { height: 56px; }
  .admin-header .logo { font-size: 16px; }
  .admin-title { display: none; }
  .admin-toolbar { gap: 8px; }
  .btn { padding: 9px 16px; }
  .admin-stats { margin-left: 0; width: 100%; }
  .stat-chip { padding: 6px 10px; font-size: 12px; }
  .flow-bar { padding: 16px 18px; }
  .flow-step span { display: none; }
  .login-card { padding: 30px 22px 26px; }
}

/* ---------- 管理标签页（商品 / 优惠券 / 拼团） ---------- */
.admin-tabs { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.a-tab { padding: 10px 24px; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--line); color: var(--text-2); font-size: 14px; font-weight: 600; transition: all .2s; }
.a-tab:hover { border-color: var(--primary); color: var(--primary); }
.a-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(43, 92, 255, .3); }
.a-panel { display: none; }
.a-panel.active { display: block; }
@media (max-width: 640px) {
  .a-tab { padding: 9px 16px; font-size: 13px; }
}
