* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  margin: 0 !important;
  padding: 0 !important;
}

body {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  font-size: 13px;
  color: #333;
  margin: 0 !important;
  padding: 0 !important;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 防御性：任何首屏首个元素都不允许产生顶部外边距（消除主页面顶部空白） */
body > *:first-child {
  margin-top: 0 !important;
}

/* 顶部导航 */
.header {
  background: #409eff;
  color: #fff;
  padding: 0 24px;
  height: 62px;
  margin-top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.header h1 {
  font-size: 33px;
  font-weight: 600;
  line-height: 1;
  margin: 0;
}

/* 布局容器（body 为 flex 纵向：header + container(flex:1) + icp-footer，footer 永不被裁切） */
.container {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ICP 备案页脚：固定在视口底部，不随内容滚动、不被裁切 */
#icp-footer {
  flex-shrink: 0;
}

/* 侧边栏 */
.sidebar {
  width: 180px;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-y: auto;
}

/* 菜单项统一 */
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  padding: 0 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  font-size: 15px;
}

/* 一级菜单 */
.menu-item.level-1 {
  font-weight: 500;
}

.menu-item:hover {
  background: #f5f7fa;
  color: #409eff;
}

.menu-item.active {
  background: #e6f7ff;
  color: #409eff;
}

/* 二级菜单 */
.submenu {
  display: none;
  background: #fafafa;
}

.submenu.show {
  display: block;
}

.menu-item.level-2 {
    height: 40px;
    padding-left: 40px;
    font-size: 13px;
    color: #555;
}

.menu-item.level-2:hover {
  background: #f0f0f0;
}

.menu-item.level-2.active {
  background: #e6f7ff;
  color: #409eff;
}

/* 客服联系方式 */
.sidebar {
  display: flex;
  flex-direction: column;
}

.customer-service-container {
  margin-top: auto;
  padding: 20px 10px 15px 10px;
  border-top: 1px solid #e8e8e8;
}

.customer-service-title {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 12px;
  text-align: center;
}

.customer-service-content {
  font-size: 12px;
  color: #555;
}

.service-item {
  margin-bottom: 10px;
  padding: 10px 8px;
  background: #fafafa;
  border-radius: 4px;
}

.service-line {
  line-height: 1.8;
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 主内容区 */
.main {
  flex: 1;
  padding: 5px;
  overflow: auto;
  min-width: 0;
  background: #f5f7fa;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 500;
  color: #333;
}

/* 按钮 */
.btn {
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  border: none;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.btn-primary {
  background: #409eff;
  color: #fff;
}

.btn-success {
  background: #67c23a;
  color: #fff;
}

.btn-danger {
  background: #f56c6c;
  color: #fff;
}

.btn-secondary {
  background: #909399;
  color: #fff;
}

/* 搜索区域 */
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.search-bar input,
.search-bar select {
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  font-size: 12px;
  min-width: 120px;
}

/* 表格 */
.table-container {
  overflow-x: auto;
  overflow-y: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

table th,
table td {
  padding: 6px 4px;
  text-align: center;
  border: 1px solid #e8e8e8;
}

table th {
  background: #fafafa;
  font-weight: 600;
  color: #262626;
  height: 32px;
}

table td {
  height: 36px;
  overflow: visible;
}

table tr:hover {
  background: #f5f7fa;
}

/* 空数据 */
.empty-state {
  text-align: center;
  padding: 40px 0;
  color: #999;
}

/* 右上角头像下拉 */
.avatar-dropdown {
  position: relative;
  cursor: pointer;
}

.avatar {
  width: 34px;
  height: 34px;
  background: #3a8ee5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

.logout-menu {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-width: 90px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 999;
}

.logout-menu.show {
  display: block;
}

.logout-menu button {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: #333;
}

.logout-menu button:hover {
  background: #f5f5f5;
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 8px;
  padding: 28px;
  min-width: 500px;
  max-width: 90%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 500;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
}

.modal-header .close {
  font-size: 20px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.modal-header .close:hover {
  color: #333;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.permission-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 6px;
}

/* 全局 Loading 遮罩 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  background: #fff;
  padding: 24px 32px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.loading-spinner .loading {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #409eff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-spinner p {
  margin-top: 12px;
  color: #606266;
  font-size: 14px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== 全局 Toast 容器（顶部水平居中，替代原内联 top:20px;right:20px） ========== */
#message-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#message-container .message {
  pointer-events: auto;
  min-width: 200px;
  max-width: 500px;
  padding: 12px 24px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
  border-left: 4px solid #2385bb;
  animation: msgSlideDown 0.3s ease;
}
#message-container .message.hide {
  opacity: 0;
  transition: opacity 0.3s ease;
}
#message-container .message-success { border-left-color: #4caf50; }
#message-container .message-error   { border-left-color: #f44336; }
#message-container .message-warning { border-left-color: #ff9800; }
#message-container .message-info    { border-left-color: #2196f3; }
#message-container .message-icon { font-weight: 600; font-size: 16px; vertical-align: middle; line-height: 1; display: inline-flex; align-items: center; }
#message-container .message-success .message-icon { color: #4caf50; }
#message-container .message-error   .message-icon { color: #f44336; }
#message-container .message-warning .message-icon { color: #ff9800; }
#message-container .message-info    .message-icon { color: #2196f3; }

@keyframes msgSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== 旧的 global-toast（window.showToast）也走顶部居中堆叠容器 ========== */
#global-toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
/* 卡片定位交给容器（支持堆叠），其余卡片样式由 JS 内联提供 */
#global-toast-container .global-toast {
  pointer-events: auto;
  position: static;
  transform: none;
}

/* ========== 阻断性 Modal（showBlockError）基础样式 ========== */
.global-block-overlay { pointer-events: auto; }
.global-block-modal {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  min-width: 320px;
  max-width: 480px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  border-top: 4px solid #f44336;
}

/* ========== 移动端适配（窄屏 ≤480px） ========== */
@media (max-width: 480px) {
  #message-container,
  #global-toast-container {
    top: 12px;
    left: 12px;
    right: 12px;
    transform: none;
    width: auto;
  }
  #message-container .message,
  #global-toast-container .global-toast {
    max-width: 100%;
  }
  .global-block-modal {
    min-width: 0 !important;
    max-width: calc(100vw - 32px) !important;
  }
}

/* ========== 全站统一分页位置：列表外右下角（2026-09-07） ========== */
/* 高特异性覆盖各页本地 .pagination 的 center/flex-start，分页容器一律靠右 */
.card .pagination,
.main .pagination,
.main-container .pagination {
  justify-content: flex-end;
}
/* 商品网格页（mall/products）分页容器 */
.mall-container .pagination-wrap {
  justify-content: flex-end;
}

/* ========== 全站统一分页组件样式（PaginationUtils 渲染结构，2026-09-07） ========== */
/* 此前只有部分页面本地定义了分页样式，未定义的页面（考勤/合同/部门等）按钮挤成一行靠左，现收口到全局 */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination button {
  padding: 6px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-size: 13px;
}
.pagination button:hover:not(:disabled) { border-color: #1890ff; color: #1890ff; }
.pagination button.active { background: #1890ff; border-color: #1890ff; color: #fff; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination span { font-size: 13px; color: #666; }
