/* ============================================================
   HySing IMS PC 后台 主题
   主色 #165DFF / 深蓝头部 #052e66 / 页面背景 #F2F3F5
   与小程序的深蓝商务风保持一致
   ============================================================ */

/* 覆写 Element Plus 主色为品牌蓝 #165DFF */
:root {
  --el-color-primary: #165DFF;
  --el-color-primary-light-3: #4f7fff;
  --el-color-primary-light-5: #8aaeff;
  --el-color-primary-light-7: #c2d4ff;
  --el-color-primary-light-8: #dbe5ff;
  --el-color-primary-light-9: #eef3ff;
  --el-color-primary-dark-2: #1146c3;
  --brand-deep: #052e66;
  --page-bg: #F2F3F5;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
#app { height: 100%; }
body {
  font-family: "Microsoft YaHei", "Source Han Sans SC", -apple-system, sans-serif;
  background: var(--page-bg);
  color: #1D2129;
}

/* 布局 */
.layout { display: flex; height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--brand-deep);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar .brand .logo {
  width: 30px; height: 30px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 10px; font-size: 15px;
}
.sidebar .menu { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar .menu-item {
  display: flex; align-items: center;
  height: 48px; padding: 0 22px;
  font-size: 14px; color: rgba(255, 255, 255, 0.78);
  cursor: pointer; user-select: none;
  border-left: 3px solid transparent;
}
.sidebar .menu-item .ico { margin-right: 10px; font-size: 16px; }
.sidebar .menu-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar .menu-item.active {
  background: #165DFF; color: #fff;
  border-left-color: #3A7CFF; font-weight: 600;
}
.sidebar .foot { padding: 16px 20px; font-size: 12px; color: rgba(255,255,255,0.45); border-top: 1px solid rgba(255,255,255,0.08); }

/* 主区域 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: var(--brand-deep); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-toggle {
  display: none;
  width: 36px; height: 36px; border-radius: 8px;
  align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer;
  background: rgba(255,255,255,0.12);
}
.sidebar-mask { display: none; }
.topbar .title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center;
}
.content { flex: 1; padding: 20px 24px; overflow-y: auto; background: var(--page-bg); }

/* 通用卡片 */
.panel { background: #fff; border-radius: 8px; padding: 18px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); margin-bottom: 16px; }
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; }
.panel-title .bar { width: 4px; height: 16px; background: #165DFF; border-radius: 2px; margin-right: 8px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.stat-card .label { font-size: 13px; color: #86909C; margin-bottom: 10px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #165DFF; }
.stat-card .value.warn { color: #FF7D00; }
.stat-card .value.green { color: #00B42A; }

/* 登录页 */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #052e66 0%, #165DFF 100%); }
.login-card { width: 380px; background: #fff; border-radius: 12px; padding: 36px 32px; box-shadow: 0 12px 40px rgba(0,0,0,0.2); }
.login-card h2 { margin: 0 0 6px; font-size: 22px; color: #1D2129; }
.login-card .sub { margin: 0 0 24px; font-size: 13px; color: #86909C; }
.login-card .brand-row { display: flex; align-items: center; margin-bottom: 20px; }
.login-card .brand-row .logo { width: 36px; height: 36px; border-radius: 9px; background: #052e66; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-right: 10px; }
.login-card .brand-row .name { font-size: 18px; font-weight: 700; color: #052e66; }

/* ============================================================
   手机端响应式适配 (<= 768px)
   侧边栏收起为抽屉, 顶栏出现 ☰ 按钮
   ============================================================ */
@media (max-width: 768px) {
  /* 侧边栏 -> 左侧抽屉 */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 2001;
    width: 230px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.45);
  }
  .sidebar .menu-item { height: 52px; } /* 加大触控目标 */

  /* 顶栏 */
  .menu-toggle { display: flex; }
  .topbar { padding: 0 12px; }
  .topbar .user { gap: 6px; font-size: 13px; }
  .topbar .user .user-name { display: none; } /* 窄屏隐藏"超级管理员"文字 */
  .topbar .user .avatar { width: 28px; height: 28px; }

  /* 内容区 */
  .content { padding: 12px; }
  .panel { padding: 14px 12px; border-radius: 8px; }

  /* 统计卡片: 5列 -> 2列 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 22px; }

  /* 登录页 */
  .login-card { width: calc(100vw - 40px); max-width: 380px; padding: 28px 22px; }

  /* Element Plus 组件窄屏适配 */
  .el-dialog { --el-dialog-width: 92vw !important; width: 92vw !important; max-width: 92vw !important; }
  .el-message-box { max-width: 88vw !important; width: auto !important; }
  .el-message { max-width: 90vw; }
  .el-pagination { flex-wrap: wrap; row-gap: 6px; }
  .el-form-item__label { float: none; display: block; text-align: left; }

  /* 表格允许横向滑动(el-table 自带滚动, 这里兜底外层容器) */
  .panel .el-table { max-width: 100%; }

  /* 工具条/筛选行自动换行 */
  .el-row, .toolbar { flex-wrap: wrap; row-gap: 8px; }
}

/* 更窄屏 (<= 400px) 统计卡片进一步压缩 */
@media (max-width: 400px) {
  .stat-card .value { font-size: 19px; }
  .stat-card .label { font-size: 12px; }
}

/* ============================================================
   移动端卡片列表 (替代 el-table, 由 JS isMobile 控制渲染)
   用于 App / 手机浏览器中的商家管理、到期商家等列表
   ============================================================ */
.m-list { display: flex; flex-direction: column; gap: 10px; }
.m-card { background: #fafbfc; border: 1px solid #e5e6eb; border-radius: 10px; padding: 12px 14px; }
.m-card-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.m-card-name { font-size: 15px; font-weight: 600; color: #1D2129; word-break: break-all; }
.m-card-sub { font-size: 12px; color: #86909C; flex-shrink: 0; }
.m-card-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.m-card-row .m-label { color: #86909C; flex-shrink: 0; }
.m-card-row .m-val { color: #1D2129; font-weight: 500; text-align: right; word-break: break-all; }
.m-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* 问题与建议反馈 (邮箱式) */
.fb-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-right: 6px; vertical-align: middle; flex-shrink: 0; }
.fb-dot.on { background: #165DFF; box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.15); }
.el-table .fb-row-unread { font-weight: 600; }
.el-table .fb-row-unread td { background: #F7FAFF !important; }
.fb-card { cursor: pointer; }
.fb-content { font-size: 14px; color: #1D2129; line-height: 1.6; margin: 6px 0 8px; white-space: pre-wrap; word-break: break-all; }
.fb-detail-content { font-size: 15px; color: #1D2129; line-height: 1.7; background: #F7F8FA; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; white-space: pre-wrap; word-break: break-all; }
.fb-detail-meta { display: flex; flex-direction: column; gap: 8px; }
.fb-meta-row { display: flex; gap: 12px; font-size: 14px; }
.fb-meta-label { color: #86909C; width: 70px; flex-shrink: 0; }
.fb-meta-val { color: #1D2129; word-break: break-all; }

/* 机型库规格列 */
.spec-ok { color: #1D2129; font-size: 13px; }
.spec-empty { color: #C9CDD4; font-size: 13px; }

/* 最新机型一键导入 */
.latest-tip { font-size: 13px; color: #86909C; background: #F7F8FA; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.latest-actions { display: flex; align-items: center; margin-bottom: 12px; }
