/* ========================================
   员工出单管理系统 - 企业级后台样式（极简灰白蓝）
======================================== */

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Microsoft YaHei", Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
  overflow-x: hidden;
}

/* 主容器：后台整体布局 */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* 左侧菜单栏 */
.sidebar {
  width: 220px;
  background-color: #001529;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: all 0.3s ease;
}

/* 侧边栏头部（logo 区域） */
.sidebar-header {
  padding: 20px 16px;
  background-color: #002140;
  border-bottom: 1px solid #001529;
  text-align: center;
}

.sidebar-header h1 {
  font-size: 18px;
  color: #fff;
  margin: 0;
  font-weight: 600;
}

/* 侧边栏菜单 */
.sidebar-menu {
  list-style: none;
  padding: 16px 0;
}

.sidebar-menu li {
  margin: 4px 0;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 14px;
}

.sidebar-menu a:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-menu a.active {
  background-color: #1677ff;
  color: #fff;
  border-left: 4px solid #40a9ff;
}

.sidebar-menu a i {
  margin-right: 12px;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* 右侧主内容区 */
.main-content {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
}

/* 顶部导航栏 */
.header {
  height: 64px;
  background-color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 99;
}

/* 用户信息区域 */
.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info .username {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.user-info .logout-btn {
  padding: 6px 12px;
  background-color: #1677ff;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.user-info .logout-btn:hover {
  background-color: #0958d9;
}

/* 内容容器 */
.content {
  padding: 24px;
  flex: 1;
}

/* 卡片组件（后台通用） */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 24px;
  margin-bottom: 24px;
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-title {
  font-size: 18px;
  color: #1f2937;
  margin-bottom: 20px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  gap: 6px;
}

.btn-primary { background-color: #1677ff; color: #fff; }
.btn-primary:hover { background-color: #0958d9; }
.btn-success { background-color: #52c41a; color: #fff; }
.btn-success:hover { background-color: #389e0d; }
.btn-warning { background-color: #faad14; color: #fff; }
.btn-warning:hover { background-color: #d48806; }
.btn-danger { background-color: #ff4d4f; color: #fff; }
.btn-danger:hover { background-color: #d9363e; }
.btn-default { background-color: #f5f7fa; color: #333; border: 1px solid #d9d9d9; }
.btn-default:hover { background-color: #e9eef5; }

/* 表单样式 */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; font-size: 14px; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; transition: all 0.2s; background-color: #fff; }
.form-control:focus { outline: none; border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1); }

/* 表格样式 */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #e5e7eb; font-size: 14px; }
.table th { background-color: #f9fafb; font-weight: 600; color: #374151; }
.table tr:hover { background-color: #f9fafb; }
.table tr:last-child td { border-bottom: none; }

/* 提示信息 */
.success { color: #52c41a; padding: 12px 0; font-size: 14px; }
.error { color: #ff4d4f; padding: 12px 0; font-size: 14px; }

/* 登录页面专属 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { width: 420px; background: #fff; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); padding: 36px 32px; }
.login-box h2 { text-align: center; margin-bottom: 28px; color: #1f2937; font-size: 24px; font-weight: 600; }

/* ========================================
   🔥 手机端 100% 无冲突 最终版
======================================== */
@media (max-width: 768px) {
  /* 布局 */
  .admin-layout { display: block !important; }
  .main-content { margin-left: 0 !important; }
  .content {
    padding: 10px !important;
    padding-bottom: 110px !important;
  }

  /* 底部导航 */
  .sidebar {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    z-index: 999999 !important;
    background: #001529 !important;
  }
  .sidebar-header { display: none !important; }
  .sidebar-menu {
    display: flex !important;
    overflow-x: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .sidebar-menu li { flex: 0 0 auto !important; }
  .sidebar-menu a {
    flex-direction: column !important;
    padding: 10px !important;
  }
  .sidebar-menu a i {
    margin-right: 0 !important;
    font-size: 18px !important;
  }
  .sidebar-menu a span { display: none !important; }

  /* 卡片 */
  .card {
    padding: 15px !important;
    margin: 10px 0 !important;
  }

  /* 表格 */
  .table, .table-strong {
    display: block !important;
    overflow-x: auto !important;
    width: 100% !important;
  }
  .table th, .table td {
    padding: 10px 8px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  /* 按钮 */
  .btn {
    padding: 5px 10px !important;
    font-size: 12px !important;
    margin: 2px !important;
  }

  /* 搜索框 */
  .search-box {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .search-box input,
  .search-box select {
    flex: 1 !important;
    min-width: 120px !important;
  }

  /* 顶部导航 */
  .header {
    padding: 0 15px !important;
  }

  /* ======================
     收款明细页面专用修复
  ======================= */
  /* 三个统计卡片竖排显示 */
  .summary-top {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .sum-box {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 客户回款 + 上家返款 上下排列 */
  .card-row {
    flex-direction: column !important;
    gap: 15px !important;
  }
  .card-row .card {
    width: 100% !important;
  }

  /* 分页整齐 */
  .page-box {
    text-align: center !important;
    margin: 15px 0 !important;
  }
  .page-box a {
    display: inline-block !important;
    padding: 6px 10px !important;
    margin: 0 2px !important;
    font-size: 13px !important;
  }
}

/* ========================================
   手机端 layer 弹窗自适应修复
======================================== */
@media (max-width: 768px) {
  /* 强制弹窗宽度适配屏幕 */
  .layui-layer {
    width: 90% !important;
    left: 5% !important;
    right: 5% !important;
    margin-left: 0 !important;
  }

  /* 弹窗内边距和文字大小优化 */
  .layui-layer-content {
    padding: 15px !important;
  }
  .pop-item label {
    font-size: 13px !important;
  }
  .pop-input {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }
}

/* ========================================
   手机端订单/出单/业绩统计文字自适应修复
======================================== */
@media (max-width: 768px) {
  /* 强制统计文字不换行，一行显示 */
  .stat-line,
  .summary-top,
  .page-info,
  div[style*="margin-bottom:10px"] {
    white-space: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 5px !important;
    margin-bottom: 10px !important;
  }

  /* 缩小字体，确保能完整放下 */
  .stat-line,
  .summary-top p,
  .summary-top span,
  .page-info span {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  /* 容器适配，不挤爆 */
  .card {
    padding: 12px !important;
  }
}

/* ========================================
✅ 仅追加：统计栏 + 表格 统一不换行（不影响任何原有功能）
======================================== */
@media (max-width: 768px) {

  /* --------------------------
  1. 所有页面统计栏：强制一行显示、不换行、可滑动、全部看得见
  --------------------------- */
  .stat-line,
  .stats-bar,
  .summary-top,
  .page-info,
  div[style*="总接单数量"],
  div[style*="总出单数量"],
  div[style*="总出单笔数"],
  div[style*="实际总业绩"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px 12px !important;
    margin: 10px 0 !important;
    gap: 16px !important;
    align-items: center !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 收款明细 3个卡片保持一行 */
  .summary-top {
    flex-direction: row !important;
  }
  .sum-box {
    flex: 1 !important;
    min-width: 120px !important;
  }

  /* --------------------------
  2. 所有表格：不换行、完整显示、横向滑动
  --------------------------- */
  .table,
  .table-strong,
  .card-table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    width: 100% !important;
  }

  .table th,
  .table td,
  .table-strong th,
  .table-strong td,
  .card-table th,
  .card-table td {
    white-space: nowrap !important;
  }

}

/* ========================================
✅ 收款明细/列表分页手机端优化：只显示固定数量页码
======================================== */
@media (max-width: 768px) {
  /* 分页容器居中 */
  .page-box {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding: 5px 0 !important;
  }

  /* 只显示当前页 + 前后各1页，其他隐藏 */
  .page-box a {
    display: none !important;
  }

  /* 显示：上一页/下一页 */
  .page-box a:first-child,
  .page-box a:last-child,
  .page-box a.active,
  .page-box a.active + a,
  .page-box a:nth-child(2),
  .page-box a:nth-child(3) {
    display: inline-block !important;
  }

  /* 优化分页按钮样式 */
  .page-box a {
    padding: 6px 10px !important;
    font-size: 13px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    text-decoration: none !important;
    color: #333 !important;
  }
  .page-box a.active {
    background: #1677ff !important;
    color: #fff !important;
    border-color: #1677ff !important;
  }
}

/* ========================================
✅ 上家/站点管理 手机端表格铺满优化
======================================== */
@media (max-width: 768px) {
  /* 让表格在卡片内100%宽度显示 */
  .card .table,
  .card .table-strong {
    display: table !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  /* 优化单元格，让内容铺满 */
  .table th,
  .table td,
  .table-strong th,
  .table-strong td {
    padding: 10px 6px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  /* 按钮大小适配 */
  .btn {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }
}

/* ========================================
✅ 收款明细汇总栏手机端优化：无滚动、全显示
======================================== */
@media (max-width: 768px) {
  /* 强制汇总栏取消横向滚动，自动换行显示 */
  .summary-top {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
    gap: 8px !important;
    overflow-x: visible !important;
    padding: 10px !important;
  }

  /* 让每个卡片自适应宽度，平分空间 */
  .sum-box {
    flex: 1 1 calc(33.33% - 6px) !important;
    min-width: 0 !important;
    text-align: center !important;
    padding: 10px 6px !important;
  }

  /* 缩小文字，保证内容能放下 */
  .sum-box h4 {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }
  .sum-box p {
    font-size: 13px !important;
    font-weight: 600 !important;
  }
}
