/* ============ 值买优选 管理后台样式 ============ */
:root {
  --primary: #e8432f;
  --blue: #3488e0;
  --bg: #f2f3f5;
  --sidebar: #1f2329;
  --text: #333;
  --muted: #909399;
  --border: #e6e6e6;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--blue); text-decoration: none; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f2329, #3a2f35); }
.login-card { width: 360px; max-width: calc(100vw - 32px); background: #fff; border-radius: 14px; padding: 40px 36px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-logo { text-align: center; font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 26px; }
.login-logo span { color: var(--blue); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form input { padding: 11px 13px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; outline: none; }
.login-form input:focus { border-color: var(--primary); }
.login-tip { text-align: center; color: var(--muted); font-size: 12px; }

/* 布局：整站一屏显示，页面本身不滚动，滚动发生在内容区内部 */
#app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 200px; background: var(--sidebar); color: #fff; flex-shrink: 0; overflow-y: auto; }
.side-logo { padding: 18px 20px; font-size: 18px; font-weight: 800; color: var(--primary); border-bottom: 1px solid rgba(255,255,255,.08); }
.side-logo span { color: var(--blue); }
#sideNav a { display: flex; align-items: center; gap: 8px; padding: 12px 20px; color: #b8c0cc; font-size: 13px; cursor: pointer; border-left: 3px solid transparent; }
#sideNav a:hover { background: rgba(255,255,255,.05); color: #fff; }
#sideNav a.active { background: rgba(232,67,47,.15); color: #fff; border-left-color: var(--primary); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.main-head { background: #fff; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0; }
.main-head h2 { font-size: 17px; margin-right: auto; }
.head-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.content { padding: 20px; flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.stat-card .num { font-size: 26px; font-weight: 800; margin: 6px 0; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .num.red { color: var(--primary); }
.stat-card .num.blue { color: var(--blue); }
.stat-card .num.green { color: #1f9d55; }

/* 卡片 */
.panel { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.05); margin-bottom: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }
.table th { background: #fafafa; color: #666; font-weight: 600; }
.table tr:hover td { background: #fafafa; }
.td-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #f2f4f5; vertical-align: middle; }
.muted-cell { color: var(--muted); font-size: 12px; }

/* 工具条 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input { height: 34px; border: 1px solid #ddd; border-radius: 6px; padding: 0 10px; font-size: 13px; outline: none; }
.chip { padding: 5px 14px; border-radius: 16px; background: #f2f2f2; color: #555; cursor: pointer; font-size: 12px; }
.chip.active { background: var(--primary); color: #fff; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-size: 13px; background: #fff; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost { color: #666; }
.btn-danger { background: #fff; color: var(--primary); border-color: #ffd5cf; }
.btn-danger:hover { background: #fff5f3; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-green { background: #1f9d55; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn + .btn { margin-left: 6px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag.pending { background: #fff7e6; color: #b8860b; }
.tag.approved { background: #f0faf4; color: #1f9d55; }
.tag.rejected { background: #fff1f0; color: var(--primary); }
.tag.off { background: #f0f0f0; color: #666; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.pagination button { min-width: 32px; height: 32px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 12px; padding: 24px; width: 520px; max-width: 92vw; max-height: 88vh; overflow-y: auto; }
.modal-box h3 { margin-bottom: 16px; }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-form label { font-size: 13px; color: #666; }
.modal-form input, .modal-form textarea, .modal-form select { width: 100%; padding: 9px 11px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; outline: none; font-family: inherit; }
.modal-form input:focus, .modal-form textarea:focus { border-color: var(--primary); }
.form-row { display: flex; gap: 10px; }
.form-row > div { flex: 1; }

/* 独立编辑页表单（非弹窗） */
.page-form { display: flex; flex-direction: column; gap: 14px; max-width: 920px; }
.page-form label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.page-form input, .page-form textarea, .page-form select { width: 100%; padding: 9px 11px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; outline: none; font-family: inherit; }
.page-form input:focus, .page-form textarea:focus, .page-form select:focus { border-color: var(--primary); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.loading { text-align: center; color: var(--muted); padding: 30px 0; }

/* Tab 菜单 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-item { padding: 9px 18px; cursor: pointer; font-size: 13px; color: #666; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* 批量导入面板 */
.imp-card { background: #fff; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.05); padding: 18px; }
.imp-tip { background: #fff8f6; border: 1px solid #ffd5cf; color: #a35245; font-size: 12.5px; line-height: 1.9; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.imp-tip b { color: var(--primary); }
.imp-block { margin-bottom: 14px; }
.imp-block > label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.imp-block textarea, .imp-block input[type=file], .imp-block select, .imp-block input[type=text] { width: 100%; padding: 9px 11px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; outline: none; font-family: inherit; box-sizing: border-box; }
.imp-block textarea:focus, .imp-block select:focus { border-color: var(--primary); }
.imp-stat { background: #f6f9ff; border: 1px solid #d7e3ff; color: #35507a; font-size: 12.5px; line-height: 1.9; padding: 10px 14px; border-radius: 8px; margin: 14px 0; }
.imp-ok { background: #eafaf1; border-color: #b7e5cc; color: #1a7f4e; }
.imp-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.imp-link { color: var(--blue); text-decoration: none; }
.sec-title { font-size: 12px; color: #999; margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }

/* ---------- 移动端菜单 ---------- */
.side-toggle { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 6px; font-size: 16px; line-height: 1; cursor: pointer; color: #555; flex-shrink: 0; }
.side-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 250; display: none; }
.side-mask.show { display: block; }

/* ---------- 响应式 ---------- */
/* 手机 / 平板：侧边栏抽屉化，内容区继续内部滚动 */
@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 220px; z-index: 300; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 2px 0 14px rgba(0,0,0,.22); }
  .sidebar.open { transform: translateX(0); }
  .side-toggle { display: inline-flex; }
  .main-head { padding: 12px 14px; }
  .main-head h2 { font-size: 15px; }
  .head-right { gap: 10px; font-size: 12px; }
  .content { padding: 14px; }
  .panel { padding: 14px; margin-bottom: 14px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 21px; }
  .table th, .table td { padding: 8px 10px; font-size: 12px; }
  .modal-box { width: 520px; max-width: 94vw; padding: 18px; max-height: 84vh; }
  .page-form { max-width: 100%; }
  .pagination { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .head-right a { display: none; }
  .content { padding: 10px; }
  .panel { padding: 12px; }
  .toolbar > .btn { padding: 6px 12px; font-size: 12px; }
  .table th, .table td { padding: 7px 8px; font-size: 11.5px; }
  .td-thumb { width: 36px; height: 36px; }
  .login-card { padding: 28px 22px; }
  .btn + .btn { margin-left: 4px; }
}
