/* admin/css/style.css - 管理控制台样式 */

/* 颜色令牌：全控制台就这一处写死色值，别的地方一律 var(--c-*)
   语义约定（C2）：中性=黑、待办=橙、正向=绿、告警/负向=红、信息/可点=蓝
   灰色只分三档：--c-muted 辅助说明 / --c-faint 空值占位 / --c-disabled 未生效 */
:root {
  /* 文字 */
  --c-text: #262626;         /* 主数字、强调文字 */
  --c-text-3: #333;          /* 页面默认文字 */
  --c-text-2: #595959;       /* 正文 */
  --c-muted: #8c8c8c;        /* 辅助说明：表头、副标题、label */
  --c-faint: #bfbfbf;        /* 空值占位「-」、划线原价 */
  --c-disabled: #999;        /* 未生效状态 */
  /* 语义色 */
  --c-info: #1890ff;
  --c-info-hover: #40a9ff;
  --c-info-bg: #e6f7ff;
  --c-info-soft: #1890ff22;
  --c-success: #52c41a;
  --c-success-bg: #f6ffed;
  --c-danger: #ff4d4f;
  --c-danger-hover: #ff7875;
  --c-danger-bg: #fff1f0;
  --c-warning: #fa8c16;
  --c-warning-2: #faad14;
  --c-warning-bg: #fff7e6;
  --c-warning-bg-2: #fffbe6;
  /* 结构 */
  --c-bg: #f0f2f5;
  --c-white: #fff;
  --c-line: #f0f0f0;
  --c-line-2: #e8e8e8;
  --c-line-3: #d9d9d9;
  --c-hover: #fafafa;
  --c-flat: #f5f5f5;
  --c-sidebar: #001529;
  --c-sidebar-line: #1f2d3d;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif; background: var(--c-bg); color: var(--c-text-3); font-size: 14px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar { width: 220px; background: var(--c-sidebar); color: var(--c-white); flex-shrink: 0; }
.sidebar-logo { padding: 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid var(--c-sidebar-line); display: flex; align-items: center; gap: 10px; }
.sidebar-logo .logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, var(--c-danger-hover), var(--c-danger)); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.sidebar-menu { padding: 12px 0; }
.menu-item { padding: 12px 24px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.2s; color: rgba(255,255,255,0.75); }
.menu-item:hover { color: var(--c-white); background: var(--c-info-soft); }
.menu-item.active { color: var(--c-white); background: var(--c-info); }
.menu-item .icon { font-size: 16px; }

/* 主内容区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.header { height: 56px; background: var(--c-white); border-bottom: 1px solid var(--c-line-2); display: flex; align-items: center; padding: 0 24px; justify-content: space-between; box-shadow: 0 1px 4px rgba(0,21,41,0.08); }
.header-title { font-size: 18px; font-weight: 500; }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--c-info); color: var(--c-white); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.header-user #adminName { font-size: 14px; color: var(--c-text-3); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-link { background: none; border: none; color: var(--c-muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.header-link:hover { color: var(--c-info); background: var(--c-info-bg); }
/* 数据源状态：绿的=后端真数据，灰的=js/mock.js 的演示数据 */
.backend-badge { padding: 2px 10px; border-radius: 10px; font-size: 12px; background: var(--c-line); color: var(--c-disabled); }
.backend-badge.on { background: var(--c-info-bg); color: var(--c-info); }
.backend-badge.off { background: var(--c-danger-bg); color: var(--c-danger); }
.backend-badge.warn { background: var(--c-warning-bg-2); color: var(--c-warning-2); }
.content { flex: 1; padding: 24px; overflow-y: auto; }

/* 卡片 */
.card { background: var(--c-white); border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.card-title { font-size: 16px; font-weight: 500; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { background: var(--c-white); border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.stat-card .label { font-size: 14px; color: var(--c-muted); }
.stat-card .value { font-size: 28px; font-weight: bold; margin-top: 8px; color: var(--c-text); }
/* 主数字默认中性黑，只有带语义的才上色（待办=橙、正向=绿、金额=红、量级=蓝） */
.stat-card .value.is-warning { color: var(--c-warning); }
.stat-card .value.is-success { color: var(--c-success); }
/* 金额=红：和列表里金额的写法一致（累计成交额、实付都是 text-danger） */
.stat-card .value.is-danger { color: var(--c-danger); }
/* 量级=蓝：只给「总数」这类体量数字，跟链接蓝同一个色 */
.stat-card .value.is-info { color: var(--c-info); }
/* 副标题一律辅助灰：它只是把上面那个数字说清楚，不承担语气。
   红绿留给真正的涨跌（tag-up/tag-down、price-up/price-down）和告警状态 */
.stat-card .trend { font-size: 12px; margin-top: 4px; color: var(--c-muted); }
/* 一张卡里并排放两个数字（入驻商家：总数 + 待审核） */
.stat-split { display: flex; align-items: flex-start; margin-top: 4px; }
.stat-col { flex: 1; min-width: 0; }
.stat-col + .stat-col { border-left: 1px solid var(--c-line); padding-left: 16px; }
.stat-col:first-child { padding-right: 16px; }
.stat-col-label { font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.stat-col .value { margin-top: 2px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--c-line); font-size: 14px; }
.table th { background: var(--c-hover); font-weight: 500; color: var(--c-text-2); }
.table tr:hover { background: var(--c-hover); }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-pending { background: var(--c-warning-bg); color: var(--c-warning); }
.tag-approved, .tag-open, .tag-online { background: var(--c-success-bg); color: var(--c-success); }
.tag-rejected, .tag-closed, .tag-offline { background: var(--c-danger-bg); color: var(--c-danger); }
.tag-suspended { background: var(--c-warning-bg); color: var(--c-warning); }
/* 封禁是平台处罚、比「已暂停」重一档：实心红，列表里一眼能扫出来 */
.tag-banned { background: var(--c-danger); color: #fff; }
.tag-flat { background: var(--c-flat); color: var(--c-muted); }
.tag-up { background: var(--c-danger-bg); color: var(--c-danger); }
.tag-down { background: var(--c-success-bg); color: var(--c-success); }
/* 经营品类列表里的 emoji 图标列：字大一点，居中 */
.cat-icon { font-size: 18px; text-align: center; }

/* 按钮 */
.btn { padding: 6px 16px; border-radius: 4px; border: none; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.btn-primary { background: var(--c-info); color: var(--c-white); }
.btn-primary:hover { background: var(--c-info-hover); }
.btn-danger { background: var(--c-danger); color: var(--c-white); }
.btn-danger:hover { background: var(--c-danger-hover); }
.btn-default { background: var(--c-white); color: var(--c-text-2); border: 1px solid var(--c-line-3); }
.btn-default:hover { color: var(--c-info); border-color: var(--c-info); }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* 操作链接 */
.action-link { color: var(--c-info); cursor: pointer; margin-right: 12px; font-size: 14px; }
.action-link:hover { color: var(--c-info-hover); }
.action-link.danger { color: var(--c-danger); }

/* 筛选栏 */
/* 二级页（商品监管 › 某家店）的面包屑：左边「商品监管 › 老王川菜馆 + 返回」，右边店铺摘要 */
.crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; flex-wrap: wrap; }
.crumb-link { color: var(--c-info); cursor: pointer; }
.crumb-link:hover { color: var(--c-info-hover); }
.crumb-sep { color: var(--c-faint); }
.crumb-cur { color: var(--c-text); font-weight: 500; }
.crumb-info { margin-left: auto; color: var(--c-muted); font-size: 13px; }

.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { padding: 6px 12px; border: 1px solid var(--c-line-3); border-radius: 4px; font-size: 14px; }
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--c-info); }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--c-white); border-radius: 8px; width: 480px; max-width: 90%; max-height: 80vh; overflow-y: auto; }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--c-line); font-size: 16px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.modal-close { cursor: pointer; color: var(--c-muted); font-size: 20px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 12px 24px; border-top: 1px solid var(--c-line); display: flex; justify-content: flex-end; gap: 12px; }

/* 表单 */
.form-item { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--c-text-2); }
.form-label .required { color: var(--c-danger); }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--c-line-3); border-radius: 4px; font-size: 14px; }
.form-input:focus { outline: none; border-color: var(--c-info); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* 详情信息 */
.detail-row { display: flex; padding: 8px 0; border-bottom: 1px dashed var(--c-line); }
.detail-row:last-child { border-bottom: 0; }
.detail-label { width: 100px; color: var(--c-muted); flex-shrink: 0; }
.detail-value { flex: 1; color: var(--c-text); }

/* 调整商家等级：三个档位纵向排列、左对齐，每个档位独占一行 */
.level-group { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.level-option {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--c-line-3); border-radius: 6px;
  cursor: pointer;
}
.level-option:hover { background: var(--c-hover); }
.level-option input[type="radio"] { flex-shrink: 0; }
.level-name { font-weight: 600; min-width: 64px; flex-shrink: 0; }
.level-meta { color: var(--c-muted); font-size: 13px; }
.level-hint { color: var(--c-muted); font-size: 12px; margin-top: 8px; }

/* 列表里的店铺简介：单行省略，全文靠 title 悬停看 */
.cell-intro { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 空状态 */
.empty { text-align: center; padding: 60px 0; color: var(--c-muted); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* 价格 */
.price-up { color: var(--c-success); }
.price-down { color: var(--c-danger); }
.price-flat { color: var(--c-muted); }

/* 商品图 */
.product-img { width: 50px; height: 50px; border-radius: 4px; object-fit: cover; vertical-align: middle; }

/* 多图：缩略图外面套一层定位壳，用来挂张数角标和「门脸图」小标签 */
.thumb-wrap { position: relative; display: inline-block; line-height: 0; cursor: pointer; }
.thumb-count { position: absolute; right: -6px; bottom: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgba(0,0,0,0.65); color: var(--c-white); font-size: 11px; line-height: 18px; text-align: center; }
.thumb-note { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.55); color: var(--c-white); font-size: 10px; line-height: 16px; text-align: center; border-radius: 0 0 6px 6px; }
/* 订单三级表的客户格：28px 圆头像 + 昵称 / 手机号两行。
   订单里那份 buyerAvatar 多半打不开（admin/images/mock 只有商品图），
   所以头像底下垫一层「昵称首字母」灰底圆，img 的 onerror 会把它 remove 掉。 */
.buyer-cell { display: inline-flex; align-items: center; gap: 8px; }
.buyer-avatar { position: relative; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; overflow: hidden; background: var(--c-flat); }
.buyer-initial { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--c-muted); }
.buyer-avatar-img { position: relative; display: block; width: 28px; height: 28px; object-fit: cover; }
.buyer-meta { display: inline-flex; flex-direction: column; line-height: 1.35; }
.buyer-phone { color: var(--c-muted); font-size: 12px; }
.buyer-phone-row { display: inline-flex; align-items: center; gap: 6px; }
.buyer-phone-view { font-size: 12px; margin-right: 0; }
.pic-wall { display: flex; flex-wrap: wrap; gap: 10px; }
.pic-wall-tip { margin-top: 8px; color: var(--c-muted); font-size: 12px; }

/* 图片画廊（详情/列表缩略图点开的大图） */
/* 画廊弹窗整窗 flex 竖排：头/底固定，主图吃满剩余高度，缩略图自然摊在下面（不出现滚动条） */
.modal-gallery { max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-gallery .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* 主图格：一个视口高度当基准（弹窗是内容撑高的，靠它才拿得到足够高度），
   shrink 给得极大，让它先让位、缩到 min-height 才轮到缩略图条 */
.gallery-stage { position: relative; display: flex; align-items: center; justify-content: center; background: var(--c-flat); border-radius: 6px; flex-grow: 1; flex-shrink: 1000; flex-basis: 46vh; min-height: 140px; padding: 8px; }
.gallery-img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: calc(100% - 16px); max-height: calc(100% - 16px); object-fit: contain; border-radius: 4px; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(0,0,0,0.45); color: var(--c-white); font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.gallery-nav:hover { background: rgba(0,0,0,0.7); }
.gallery-nav.left { left: 8px; }
.gallery-nav.right { right: 8px; }
.gallery-count { flex: 0 0 auto; text-align: center; color: var(--c-text-2); font-size: 13px; margin: 10px 0; }
/* 缩略图条：竖着摞若干「一排」，排数由 app.js 的 galleryRows() 决定（5 张以内一行）。
   默认全部摊开、不滚；只有窗口矮到主图已经触底，才由这一条自己滚 */
.gallery-thumbs { display: flex; flex-direction: column; gap: 8px; flex: 0 1 auto; min-height: 0; overflow-y: auto; }
/* 一排是一层：排内不换行、整排居中，5 张一排正好 312px */
.gallery-thumb-row { display: flex; flex-wrap: nowrap; gap: 8px; justify-content: center; flex: 0 0 auto; }
.gallery-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: 0.55; border: 2px solid transparent; }
.gallery-thumb.active { opacity: 1; border-color: var(--c-info); }
/* 图打不开时的灰底占位块（顶掉原来的「裂图」二字） */
.img-broken { background: var(--c-line-2); }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.pagination button { padding: 6px 12px; border: 1px solid var(--c-line-3); background: var(--c-white); border-radius: 4px; cursor: pointer; }
.pagination button.active { background: var(--c-info); color: var(--c-white); border-color: var(--c-info); }

/* 文字颜色工具类：同一种颜色只留一种写法，别再把 hex 写进标签的内联 style */
.text-body { color: var(--c-text-2); }
.text-muted { color: var(--c-muted); }
/* 「在地图上打开」外链：和详情里别处的蓝字链接一个口径 */
.loc-link { color: var(--c-info); }
.loc-link:hover { color: var(--c-info-hover); }
.text-faint { color: var(--c-faint); }

/* 投诉建议页：一页上下两个抬头（买家 / 商家），各自一套筛选和表格。
   卡片不留内边距，让表格的斑马/hover 底色铺满整卡（和别的列表页一个路数），
   抬头和筛选栏自己带左右内边距 */
.fb-card { padding: 0 0 4px; }
.fb-head { display: flex; align-items: center; font-size: 16px; font-weight: 500; padding: 18px 20px 0; }
.fb-head::before { content: ''; width: 3px; height: 15px; background: var(--c-info); border-radius: 2px; margin-right: 8px; }
.fb-body { padding: 16px 20px 0; }
/* 两张表共用一套列宽（app.js 的 FB_COLS）：加 fixed 让列宽只看 colgroup，
   不再按各自内容自动分配，上下两张表的列才会逐列对齐 */
.fb-table { table-layout: fixed; }
/* 固定列宽后内容必须自己收敛，否则会把格子撑破：昵称/手机号单行省略，
   操作列的最后一个链接不留右边距（省下 12px，三个链接正好一行放得下） */
.fb-table .buyer-cell { max-width: 100%; }
.fb-table .buyer-meta { min-width: 0; }
.fb-table .buyer-name, .fb-table .buyer-phone { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-table .action-link:last-child { margin-right: 0; }
/* 关联订单是「商品名 · 核销码」，长短差得多，不卡成一行的话整行会被它撑高 */
.fb-table .fb-col-order span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 图片列也是百分比，窗口很窄时缩略图跟着收窄，别溢到邻列去 */
.fb-table .thumb-wrap img { max-width: 100%; }
/* 状态/类型的标签不许内部折行：窄窗口下「待处理」被拆成两行会把整行撑高 */
.fb-table .tag { white-space: nowrap; }
/* 8 列挤在窄窗口里：内边距和标签左右留白各收一点，够放得下就不再折行 */
@media (max-width: 1100px) {
  .fb-table th, .fb-table td { padding-left: 8px; padding-right: 8px; }
  .fb-table .tag { padding-left: 4px; padding-right: 4px; }
}
.text-danger { color: var(--c-danger); }
.text-success { color: var(--c-success); }
.text-warning { color: var(--c-warning); }
.text-info { color: var(--c-info); }

/* 吐司提示 */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.75); color: var(--c-white); padding: 10px 24px; border-radius: 4px; z-index: 2000; font-size: 14px; }
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }

/* ---------------- 登录浮层 ---------------- */
.login-mask { position: fixed; inset: 0; background: linear-gradient(135deg, #001529, #003a70); display: flex; align-items: center; justify-content: center; z-index: 3000; }
.login-card { width: 360px; background: var(--c-white); border-radius: 10px; padding: 36px 32px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 48px; height: 48px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--c-danger-hover), var(--c-danger)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: bold; }
.login-title { font-size: 20px; font-weight: 600; color: var(--c-text); }
.login-sub { font-size: 13px; color: var(--c-muted); margin-top: 6px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; font-size: 13px; color: var(--c-muted); margin-bottom: 6px; }
.login-field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--c-line-3); border-radius: 6px; font-size: 14px; outline: none; transition: border-color 0.2s; }
.login-field input:focus { border-color: var(--c-info); box-shadow: 0 0 0 2px var(--c-info-soft); }
.login-error { color: var(--c-danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login-btn { width: 100%; height: 42px; background: var(--c-info); color: #fff; border: none; border-radius: 6px; font-size: 15px; cursor: pointer; transition: background 0.2s; }
.login-btn:hover { background: var(--c-info-hover); }
.login-btn:disabled { background: var(--c-disabled); cursor: not-allowed; }
