/* ==================== 全局样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --bg: #f5f7fa;
  --bg-white: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --border: #e8e8e8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-sm: 4px;
}

body {
  font-family: "SimSun", "宋体", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ==================== 登录页面 ==================== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #096dd9 100%);
}

.login-box {
  background: var(--bg-white);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  width: 400px;
  max-width: 90%;
}

.login-box h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 30px;
  font-size: 28px;
}

.login-box .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #389e0d;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #cf1322;
}

.btn-default {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-default:hover {
  background: var(--border);
}

.btn-block {
  width: 100%;
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

/* ==================== 主布局 ==================== */
.main-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 16px;
  color: var(--primary);
}

.sidebar-header .role-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  border-radius: 10px;
  margin-top: 5px;
}

.sidebar-header .role-badge.subuser {
  background: var(--success);
}

.sidebar-nav {
  flex: 1;
  padding: 15px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--primary);
}

.nav-item.active {
  background: rgba(24, 144, 255, 0.1);
  color: var(--primary);
  border-left-color: var(--primary);
}

.nav-item i {
  margin-right: 10px;
  font-size: 18px;
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.user-details {
  flex: 1;
}

.user-details .username {
  font-weight: 500;
  font-size: 14px;
}

.user-details .province {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content-header {
  background: var(--bg-white);
  padding: 15px 25px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content-header h1 {
  font-size: 20px;
  font-weight: 600;
}

.content-body {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
}

/* ==================== 卡片 ==================== */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* ==================== 表格 ==================== */
.table-container {
  overflow-x: auto;
  min-width: 600px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  min-width: 80px;
}

table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
}

table tr:hover {
  background: rgba(24, 144, 255, 0.02);
}

.table-actions {
  display: flex;
  gap: 8px;
}

.table-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* ==================== 表单 ==================== */
.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.filter-bar .form-group {
  min-width: 150px;
  margin-bottom: 0;
}

.filter-bar input,
.filter-bar select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.btn-group {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

/* ==================== 统计面板 ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card .stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card.success .stat-value {
  color: var(--success);
}

.stat-card.warning .stat-value {
  color: var(--warning);
}

/* ==================== 模态框 ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius);
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==================== 标签页 ==================== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.3s;
}

.tab-item:hover {
  color: var(--primary);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 15px;
  color: var(--text-light);
}

.empty-state p {
  font-size: 14px;
}

/* ==================== 工具提示 ==================== */
.tooltip {
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--text);
  color: white;
  font-size: 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 100;
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
  .quarterly-table {
    font-size: 11px;
  }

  .quarterly-table th,
  .quarterly-table td {
    padding: 6px 4px;
  }
}

@media (max-width: 768px) {
  /* 主布局 */
  .main-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: nowrap;
    padding: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    padding: 8px 12px;
    font-size: 13px;
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .nav-item.active {
    border-left: none;
    border-bottom-color: var(--primary);
  }

  /* 内容区域 */
  .content-body {
    padding: 15px;
    overflow-x: hidden;
  }

  .content-header {
    padding: 12px 15px;
  }

  .content-header h1 {
    font-size: 16px;
  }

  /* 卡片 */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .card-header h3 {
    font-size: 14px;
    word-break: break-word;
  }

  /* 标签页 */
  .tab-header {
    flex-wrap: nowrap;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-tab-btn,
  .subuser-tab-btn {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* 表格 */
  .table-container {
    min-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 12px;
    table-layout: fixed;
  }

  table th,
  table td {
    padding: 6px 8px;
    min-width: 80px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* 功能区1表格（zone1-table）样式 */
  .zone1-table {
    table-layout: fixed;
  }

  .zone1-table th,
  .zone1-table td {
    min-width: 60px;
    font-size: 11px;
    padding: 5px 4px;
  }

  /* 区域汇总表格 */
  .region-summary-table {
    table-layout: fixed;
  }

  .region-summary-table th,
  .region-summary-table td {
    min-width: 50px;
    font-size: 11px;
    padding: 4px 3px;
  }

  .quarterly-table {
    min-width: 1200px;
    font-size: 10px;
    table-layout: fixed;
  }

  .quarterly-table th,
  .quarterly-table td {
    padding: 4px 2px;
    min-width: 40px;
  }

  /* 表单 */
  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .filter-bar {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }

  .filter-bar .form-group {
    width: 100%;
    margin-bottom: 0;
  }

  .btn-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .btn-group .btn {
    flex: 1 1 auto;
    min-width: 100px;
  }

  /* 模态框 */
  .modal {
    width: 95%;
    max-width: 95%;
    margin: 10px;
  }

  .modal-body {
    padding: 15px;
    max-height: 50vh;
  }

  /* 按钮 */
  .btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* 工具栏 */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
  }

  .filter-bar .btn {
    width: 100%;
    margin-top: 5px;
  }

  /* 统计卡片 */
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* 移动端横屏 */
@media (max-width: 768px) and (orientation: landscape) {
  .sidebar {
    height: auto;
    max-height: 150px;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
  }
}

/* 超小屏幕 */
@media (max-width: 480px) {
  .login-box {
    padding: 25px 20px;
  }

  .login-box h1 {
    font-size: 22px;
  }

  .form-group input,
  .form-group select {
    padding: 10px 12px;
    font-size: 13px;
  }

  table th,
  table td {
    padding: 5px 6px;
    min-width: 70px;
    font-size: 11px;
  }

  .zone1-table th,
  .zone1-table td {
    font-size: 10px;
    min-width: 50px;
    padding: 4px 3px;
  }

  .region-summary-table th,
  .region-summary-table td {
    font-size: 9px;
    min-width: 40px;
    padding: 3px 2px;
  }

  .quarterly-table {
    min-width: 1000px;
  }

  /* 表格横向滚动提示 */
  .table-container::after {
    content: '← 左右滑动查看更多 →';
    display: block;
    text-align: center;
    color: var(--text-light);
    font-size: 11px;
    padding: 5px;
    background: var(--bg);
  }

  .admin-tab-btn,
  .subuser-tab-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* 防止文字溢出 */
  .card-header h3 {
    font-size: 13px;
  }
}

/* 大屏幕优化 */
@media (min-width: 1920px) {
  .quarterly-table {
    font-size: 13px;
  }

  .quarterly-table th,
  .quarterly-table td {
    padding: 10px 8px;
  }

  .content-body {
    padding: 30px;
  }
}

/* 表格文字不换行优化 */
table {
  white-space: nowrap;
}

table th,
table td {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* 功能区表格支持换行 */
.zone1-table th,
.zone1-table td,
.region-summary-table th,
.region-summary-table td {
  white-space: normal;
  word-break: break-all;
}

/* 表格操作列按钮不换行 */
.table-actions {
  white-space: nowrap;
}

/* ==================== 行内编辑样式 ==================== */
.inline-edit {
  display: block !important;
  width: 100% !important;
  padding: 4px 8px !important;
  border: 1px solid #d9d9d9 !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  background: #fff !important;
  transition: all 0.2s !important;
  box-sizing: border-box;
}

.inline-edit:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2) !important;
}

.inline-edit[type="number"] {
  width: 70px !important;
  text-align: center;
}

table select.inline-edit {
  width: auto !important;
  min-width: 80px;
}

table td {
  vertical-align: middle;
}

.running-total {
  color: var(--primary);
  font-weight: bold;
}
  }

  .form-row {
    flex-direction: column;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar .form-group {
    width: 100%;
  }

  .btn-group {
    width: 100%;
  }

  .btn-group .btn {
    flex: 1;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== 加载状态 ==================== */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.loading::after {
  content: "";
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== 省份标签 ==================== */
.province-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(24, 144, 255, 0.1);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* ==================== 导出按钮 ==================== */
.export-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.export-section .info {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ==================== 确认对话框 ==================== */
.confirm-msg {
  text-align: center;
  padding: 20px 0;
  font-size: 16px;
}

/* ==================== 管理员看板标签 ==================== */
.admin-tab-btn {
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  font-size: 13px;
}

.admin-tab-btn:hover {
  color: var(--primary);
}

.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ==================== 管理员内容区 ==================== */
.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* ==================== 子用户标签 ==================== */
.subuser-tab-btn {
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  font-size: 13px;
}

.subuser-tab-btn:hover {
  color: var(--primary);
}

.subuser-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ==================== 子用户内容区 ==================== */
.subuser-tab-content {
  display: none;
}

.subuser-tab-content.active {
  display: block;
}

/* ==================== 季度统计表格 ==================== */
.quarterly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  min-width: 1400px;
}

.quarterly-table th,
.quarterly-table td {
  padding: 5px 4px;
  text-align: center;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.quarterly-table th {
  background: var(--bg);
  font-weight: 600;
}

.quarterly-table .total-row {
  background: #e6f7ff;
  font-weight: bold;
}

/* 可悬停单元格样式 */
.has-tooltip {
  cursor: pointer;
  position: relative;
  background: rgba(24, 144, 255, 0.05);
  transition: background-color 0.2s;
}

.has-tooltip:hover {
  background: rgba(24, 144, 255, 0.15);
}

/* 悬停提示框 */
.hover-tooltip {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 0;
  max-width: 400px;
  min-width: 200px;
  z-index: 9999;
  pointer-events: none;
}

.hover-tooltip .tooltip-header {
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.hover-tooltip .tooltip-subheader {
  background: #e6f7ff;
  color: var(--primary);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #91d5ff;
}

.hover-tooltip .tooltip-content {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.8;
  max-height: 300px;
  overflow-y: auto;
  color: var(--text);
}

/* ==================== 导航标签容器 ==================== */
.tab-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
