/* ===== 桐屹观山奢品商家后台 · 有赞风格 ===== */
:root {
  --primary: #1C1C1E;
  --primary-dark: #16151a;
  --primary-light: #a8353f;
  --bg: #f5f6f8;
  --card: #fff;
  --border: #e6e7eb;
  --text: #333;
  --text-2: #666;
  --text-3: #999;
  --green: #2e9e5b;
  --orange: #e6a23c;
  --red: #e64340;
  --blue: #3f6f8f;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ---------- 登录页 ---------- */
.login-page { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #16151a 0%, #322c24 55%, #c8a96a 100%); }
.login-bg { position: absolute; inset: 0; opacity: .12; background: radial-gradient(circle at 20% 20%, #fff 0, transparent 40%), radial-gradient(circle at 80% 80%, #fff 0, transparent 40%); }
.login-card { position: relative; width: 380px; background: #fff; border-radius: 10px; padding: 40px 36px 30px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo { width: 56px; height: 56px; line-height: 56px; margin: 0 auto 12px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.login-brand h1 { font-size: 20px; color: var(--primary); }
.login-brand p { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.login-form .form-item { margin-bottom: 16px; }
.login-form label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.login-form input { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; font-size: 14px; outline: none; transition: border .2s; }
.login-form input:focus { border-color: var(--primary); }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 16px; border: none; border-radius: var(--radius); font-size: 13px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f0c4c3; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #237c47; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; height: 40px; font-size: 15px; }
.btn-outline-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); }
.btn-outline-light:hover { background: rgba(255,255,255,.15); }
.link-btn { color: var(--blue); background: none; border: none; cursor: pointer; font-size: 13px; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

/* ---------- 布局 ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 56px; background: linear-gradient(90deg, var(--primary-dark), var(--primary)); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 34px; height: 34px; line-height: 34px; text-align: center; background: rgba(255,255,255,.18); border-radius: 8px; font-weight: 700; letter-spacing: 1px; }
.brand-name { font-size: 16px; font-weight: 600; line-height: 1.2; }
.brand-sub { font-size: 11px; opacity: .75; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.admin-chip { background: rgba(255,255,255,.16); padding: 4px 12px; border-radius: 20px; font-size: 13px; }
.layout { display: flex; padding-top: 56px; min-height: 100vh; }
.sidebar { width: 180px; background: #fff; border-right: 1px solid var(--border); position: fixed; top: 56px; bottom: 0; left: 0; overflow-y: auto; z-index: 90; }
.menu { padding: 12px 0; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 12px 22px; color: var(--text-2); text-decoration: none; cursor: pointer; font-size: 14px; border-left: 3px solid transparent; transition: all .15s; }
.menu-item .mi { font-size: 15px; width: 18px; text-align: center; opacity: .8; }
.menu-item:hover { color: var(--primary); background: #faf6f6; }
.menu-item.active { color: var(--primary); font-weight: 600; background: #faf3f4; border-left-color: var(--primary); }
.sidebar-foot { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--text-3); }
.main { flex: 1; margin-left: 180px; padding: 20px 24px 40px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { font-size: 18px; font-weight: 600; }

/* ---------- 卡片 / 面板 ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 14px; font-weight: 600; }
.panel-body { padding: 16px 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.stat-icon { width: 46px; height: 46px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th { background: #fafbfc; font-weight: 500; color: var(--text-2); text-align: left; padding: 11px 12px; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid #f2f3f5; font-size: 13px; vertical-align: middle; }
.table tr:hover td { background: #fafafb; }
.table .gthumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); cursor: pointer; }
.table .gthumb-ph { width: 44px; height: 44px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; overflow: hidden; }
.empty { text-align: center; color: var(--text-3); padding: 40px 0; }
.money { color: var(--primary); font-weight: 600; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag-green { background: #e8f7ee; color: var(--green); }
.tag-orange { background: #fdf3e3; color: var(--orange); }
.tag-red { background: #fdeaea; color: var(--red); }
.tag-gray { background: #f0f1f2; color: var(--text-3); }
.tag-blue { background: #eaf1f6; color: var(--blue); }
.tag-primary { background: #faecec; color: var(--primary); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-item label .req { color: var(--red); margin-left: 2px; }
.input, .select, textarea.input { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 10px; font-size: 13px; outline: none; background: #fff; transition: border .2s; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 70px; line-height: 1.6; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); }
.input-sm { height: 30px; font-size: 12px; }
.select { cursor: pointer; }

/* ---------- 工具栏 / 分页 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 0 4px; }
.pager span { font-size: 13px; color: var(--text-2); }

/* ---------- Tab 切换 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 18px; font-size: 14px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.tab .badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; text-align: center; padding: 0 5px; margin-left: 4px; }

/* ---------- 模态框 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { width: 640px; max-width: 100%; background: #fff; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.2); animation: modalIn .18s ease; }
@keyframes modalIn { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-3); cursor: pointer; line-height: 1; }
.modal-body { padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- 规格编辑器 ---------- */
.spec-group { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.spec-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #fafbfc; border-bottom: 1px solid var(--border); }
.spec-head .spec-name { font-weight: 600; font-size: 13px; }
.spec-values { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
.spec-val { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; font-size: 13px; }

/* ---------- 图片上传 ---------- */
.upload-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-preview { width: 64px; height: 64px; border: 1px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fafbfc; cursor: pointer; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .ph { color: var(--text-3); font-size: 22px; }

/* ---------- 详情描述 ---------- */
.detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 8px 14px; }
.detail-grid .k { color: var(--text-3); font-size: 13px; line-height: 1.8; }
.detail-grid .v { font-size: 13px; line-height: 1.8; word-break: break-all; }
.detail-items .ditem { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #f0f1f2; }
.detail-items .ditem:last-child { border-bottom: none; }
.ditem .dthumb { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.ditem .dthumb-ph { width: 46px; height: 46px; border-radius: 6px; background: #eee; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; flex-shrink: 0; }

/* ---------- 图表 ---------- */
.chart-box { position: relative; }
.chart-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.chart-seg { display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.chart-seg button { border: none; background: #fff; padding: 5px 14px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.chart-seg button.active { background: var(--primary); color: #fff; }

/* ---------- 条形分布 ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-name { width: 90px; color: var(--text-2); flex-shrink: 0; }
.bar-track { flex: 1; height: 12px; background: #f0f1f2; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 6px; transition: width .4s; min-width: 2px; }
.bar-val { width: 50px; text-align: right; color: var(--text-2); flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast { position: fixed; top: 72px; left: 50%; transform: translateX(-50%) translateY(-8px); background: rgba(0,0,0,.8); color: #fff; padding: 10px 22px; border-radius: 6px; font-size: 13px; z-index: 400; opacity: 0; transition: all .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 图片预览 ---------- */
#imgPreview { align-items: center; justify-content: center; cursor: zoom-out; }
#imgPreview img { max-width: 80vw; max-height: 80vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.3); }

/* ---------- 其他 ---------- */
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--text-3); font-size: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb16 { margin-bottom: 16px; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.order-num { font-weight: 600; }
.spec-line { font-size: 12px; color: var(--text-3); }
.score-card { text-align: center; padding: 6px 0; }
.score-card .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.score-card .lbl { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #f0f1f2; font-size: 13px; }
.rank-row .idx { width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 4px; background: #f0f1f2; color: var(--text-3); font-weight: 600; font-size: 12px; flex-shrink: 0; }
.rank-row .idx.top { background: var(--primary); color: #fff; }
.rank-row .rname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.modal-lg { width: 860px; }
@media (max-width: 900px) { .sidebar { width: 60px; } .menu-item { padding: 12px 0; justify-content: center; } .menu-item .mi { font-size: 18px; } .menu-item span.mi ~ * , .main { margin-left: 0; } .sidebar-foot, .brand-sub { display: none; } .form-grid { grid-template-columns: 1fr; } }
