* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #333;
  font-size: 14px;
}

/* 登录页 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0c1445 0%, #1a237e 30%, #0d47a1 60%, #006064 100%);
  position: relative;
  overflow: hidden;
}

/* 科技网格背景 */
.login-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(0, 200, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 255, 0.08) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
  0% { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

/* 动态光斑 */
.login-container::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.15) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: glowFloat 8s ease-in-out infinite;
}

@keyframes glowFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-100px, 100px) scale(1.2); }
}

/* 浮动几何图形 */
.tech-shape {
  position: absolute;
  border: 2px solid rgba(0, 200, 255, 0.3);
  animation: floatShape 15s ease-in-out infinite;
}

.tech-shape.circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  top: 15%;
  left: 10%;
  animation-delay: 0s;
}

.tech-shape.square {
  width: 60px;
  height: 60px;
  top: 60%;
  left: 8%;
  transform: rotate(45deg);
  animation-delay: -3s;
}

.tech-shape.triangle {
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid rgba(0, 200, 255, 0.2);
  border-top: none;
  top: 20%;
  right: 12%;
  animation-delay: -6s;
}

.tech-shape.circle2 {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  bottom: 15%;
  right: 15%;
  border: 1px dashed rgba(0, 255, 200, 0.3);
  animation-delay: -9s;
}

.tech-shape.line {
  width: 200px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.5), transparent);
  border: none;
  top: 40%;
  left: 5%;
  animation-delay: -12s;
}

@keyframes floatShape {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  25% { transform: translateY(-30px) rotate(90deg); opacity: 0.8; }
  50% { transform: translateY(0) rotate(180deg); opacity: 0.5; }
  75% { transform: translateY(30px) rotate(270deg); opacity: 0.8; }
}

/* 粒子效果 */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(0, 200, 255, 0.6);
  border-radius: 50%;
  animation: particleFloat 10s linear infinite;
}

@keyframes particleFloat {
  0% { transform: translateY(100vh) translateX(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100px) translateX(50px); opacity: 0; }
}

/* ========== 大圆角卡片登录页面样式 ========== */
.login-container {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #e8f0fe 0%, #f0f5ff 50%, #e6f0ff 100%) !important;
  padding: 20px;
  box-sizing: border-box;
}

/* 隐藏旧的浮动几何图形和粒子效果 */
.login-container .tech-shape,
.login-container .particle {
  display: none !important;
}

/* 大圆角卡片 */
.login-card {
  display: flex;
  width: 100%;
  max-width: 960px;
  height: 500px;
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0, 82, 217, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.08);
}

/* 左侧装饰区域 */
.login-left {
  flex: 1;
  position: relative;
  background: linear-gradient(135deg, #0052D9 0%, #003d99 50%, #002866 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px 0 0 24px;
}

.login-left-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(64, 128, 255, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 200, 255, 0.2) 0%, transparent 50%);
}

.login-left-content {
  position: relative;
  z-index: 10;
  color: white;
  padding: 30px 35px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-left-brand {
  display: inline-block;
  margin-bottom: 22px;
}

.login-left-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-left-title {
  font-size: 40px;
  font-weight: bold;
  letter-spacing: 3px;
  color: white;
  line-height: 1;
}

.login-left-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 6px;
  text-align: center;
  width: 100%;
}

.login-left-desc {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-left-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feature-icon {
  font-size: 22px;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
}

.feature-text {
  flex: 1;
}

.feature-title {
  font-size: 16px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

/* 装饰性圆形 */
.deco-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.deco-1 {
  width: 250px;
  height: 250px;
  top: -80px;
  right: -80px;
}

.deco-2 {
  width: 180px;
  height: 180px;
  bottom: 40px;
  left: -40px;
}

.deco-3 {
  width: 120px;
  height: 120px;
  top: 40%;
  right: 8%;
  background: rgba(64, 128, 255, 0.1);
}

/* 右侧登录区域 */
.login-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 0 24px 24px 0;
  overflow: hidden;
}

/* 右侧上部：软件名称 */
.login-right-header {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 30px 15px;
  border-bottom: 1px solid #f0f0f0;
}

.login-right-logo {
  flex-shrink: 0;
}

.login-right-name {
  display: flex;
  flex-direction: column;
}

.login-right-title {
  font-size: 24px;
  font-weight: bold;
  color: #0052D9;
  letter-spacing: 2px;
  line-height: 1.2;
}

.login-right-subtitle {
  font-size: 12px;
  color: #999;
  letter-spacing: 1px;
  margin-top: 3px;
}

/* 登录页面logo区域 */
.login-logo-area {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.login-logo-area img {
  max-width: 240px;
  height: auto;
  display: block;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

/* 右侧软件名称 */
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.login-brand-logo {
  flex-shrink: 0;
}

.login-brand-text {
  display: flex;
  flex-direction: column;
}

.login-brand-title {
  font-size: 26px;
  font-weight: bold;
  color: #0052D9;
  letter-spacing: 2px;
  line-height: 1.2;
}

.login-brand-subtitle {
  font-size: 12px;
  color: #999;
  letter-spacing: 2px;
  margin-top: 4px;
}

/* 下部：登录框 */
.login-box {
  background: white !important;
  backdrop-filter: none !important;
  padding: 25px 45px 35px !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  width: auto !important;
  position: relative !important;
  z-index: 10 !important;
  border: none !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-box::before {
  display: none !important;
}

.login-header {
  margin-bottom: 18px;
  text-align: center;
}

.login-welcome {
  font-size: 22px;
  font-weight: bold;
  color: #333;
}

.login-system-name {
  font-size: 14px;
  color: #999;
  letter-spacing: 1px;
  margin-top: 5px;
}

/* 输入框样式 */
.login-box .form-group {
  margin-bottom: 14px !important;
}

.login-box .form-group label {
  display: none !important;
}

.login-box .form-group input {
  width: 100%;
  padding: 13px 16px !important;
  border: 1px solid #e8e8e8 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  background: #f8f9fa !important;
  transition: all 0.3s ease !important;
  box-sizing: border-box !important;
}

.login-box .form-group input:focus {
  border-color: #0052D9 !important;
  background: white !important;
  box-shadow: 0 0 0 3px rgba(0, 82, 217, 0.1) !important;
  outline: none !important;
}

.login-box .form-group input::placeholder {
  color: #bbb !important;
}

/* 登录按钮样式 */
.login-btn {
  width: 100%;
  padding: 13px !important;
  background: linear-gradient(135deg, #0052D9 0%, #4080ff 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  color: white !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  margin-top: 8px !important;
  letter-spacing: 2px !important;
}

.login-btn:hover {
  background: linear-gradient(135deg, #003d99 0%, #0052D9 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px rgba(0, 82, 217, 0.3) !important;
}

.login-btn:active {
  transform: translateY(0) !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .login-card {
    flex-direction: column;
    height: auto;
    max-height: 90vh;
  }
  
  .login-left {
    flex: none;
    height: 200px;
    border-radius: 24px 24px 0 0;
  }
  
  .login-left-content {
    padding: 30px;
  }
  
  .login-left-desc {
    display: none;
  }
  
  .login-right {
    border-radius: 0 0 24px 24px;
  }
  
  .login-right-header {
    padding: 25px 20px 15px;
  }
}

/* 登录框科技感 */
.login-box {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 
    0 10px 40px rgba(0,0,0,0.3),
    0 0 60px rgba(0, 200, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  width: 400px;
  position: relative;
  z-index: 10;
  border: 1px solid rgba(0, 200, 255, 0.3);
}

/* 登录框顶部装饰线 */
.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00d4ff, #00ff88, #00d4ff);
  border-radius: 12px 12px 0 0;
  animation: lineGlow 3s ease-in-out infinite;
}

@keyframes lineGlow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; box-shadow: 0 0 20px rgba(0, 200, 255, 0.8); }
}

.login-title {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 30px;
  color: #333;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.btn-primary {
  background: #667eea;
  color: #fff;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-success {
  background: #52c41a;
  color: #fff;
}

.btn-success:hover {
  background: #49b018;
}

.btn-warning {
  background: #faad14;
  color: #fff;
}

.btn-warning:hover {
  background: #e09a0e;
}

.btn-danger {
  background: #f5222d;
  color: #fff;
}

.btn-danger:hover {
  background: #d91e28;
}

.btn-default {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}

.btn-default:hover {
  background: #f5f5f5;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

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

.sidebar {
  width: 220px;
  background: #ffffff;
  color: #333;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid #e8e8e8;
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
  /* 侧边栏必须盖过内容区的一切粘性表头（thead z-index:10）与下拉层，
     否则手机放大后横向平移、或内容超宽拖动时，表头会绘制到侧边栏之上 */
  z-index: 1100;
}

.sidebar-logo {
  padding: 20px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-menu {
  list-style: none;
  padding: 10px 0;
}

.sidebar-menu li {
  padding: 0;
  cursor: pointer;
  transition: background 0.3s;
  border-left: 3px solid transparent;
}

.sidebar-menu li > a {
  padding: 20px 20px;
  display: flex;
  align-items: center;
}

.sidebar-menu li:hover {
  background: #f5f7fa;
}

.sidebar-menu li.active {
  background: #f0f5ff;
  border-left-color: #0052D9;
  color: #0052D9;
  box-shadow: none;
  font-weight: 600;
}

.sidebar-menu li a {
  color: #555;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.3s;
  margin: 0;
  box-sizing: border-box;
}

/* 菜单分组 */
.sidebar-menu .menu-group {
  padding: 0;
  border-left: none;
}

.sidebar-menu .menu-group .menu-title {
  padding: 20px 20px;
  display: flex;
  align-items: center;
  margin: 0;
}

.sidebar-menu .menu-group:hover {
  background: transparent;
}

.sidebar-menu .menu-title {
  padding: 20px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s;
}

.sidebar-menu .menu-title:hover {
  background: #f5f7fa;
}

.sidebar-menu .menu-arrow {
  font-size: 10px;
  transition: transform 0.3s;
}

.sidebar-menu .menu-group.open .menu-arrow {
  transform: rotate(90deg);
}

.sidebar-menu .submenu {
  list-style: none;
  padding: 0;
  display: none;
  background: #fafafa;
}

.sidebar-menu .menu-group.open .submenu {
  display: block;
}

.sidebar-menu .submenu li {
  padding: 0;
  font-size: 13px;
}

.sidebar-menu .submenu li > a {
  padding: 20px 20px 20px 48px;
  display: flex;
  align-items: center;
}

.sidebar-menu .submenu li .menu-icon {
  font-size: 14px;
  margin-right: 8px;
}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid #f0f0f0;
  height: 70px;
  box-sizing: border-box;
  overflow: visible;

  user-select: none;
  -webkit-user-select: none;}

.sidebar-header .sidebar-logo {
  padding: 0 5px;
  font-size: 16px;
  border-bottom: none;
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-header .sidebar-logo img {
  width: 180px;
  height: 60px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.sidebar-header .sidebar-logo img::selection,
.sidebar-header .sidebar-logo img::-moz-selection {
  background: transparent;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 4px;
  transition: all 0.3s;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: #f0f0f0;
  color: #666;
}

/* 菜单图标和文字 */
.menu-icon {
  margin-right: 10px;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 0.3s;
  line-height: 1;
}

.sidebar-menu li:hover .menu-icon {
  transform: scale(1.1);
}

.menu-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  font-size: 14px;
  line-height: 1;
}



.sidebar-menu .menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-menu .menu-title .menu-text {
  flex: 1;
}

.sidebar-menu .menu-arrow {
  flex-shrink: 0;
  margin-left: 5px;
}

/* 折叠状态 */
.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  padding: 15px 0;
  width: 100%;
  text-align: center;
}

.sidebar.collapsed .menu-text,
.sidebar.collapsed .menu-arrow {
  display: none;
}

.sidebar.collapsed .menu-icon {
  margin-right: 0;
  text-align: center;
  width: 100%;
  justify-content: center;
  display: flex;
  align-items: center;
}

.sidebar.collapsed .sidebar-menu li {
  padding: 12px 0;
  text-align: center;
}

.sidebar.collapsed .sidebar-menu li a {
  justify-content: center;
  align-items: center;
  padding: 0;
}

.sidebar.collapsed .sidebar-menu .menu-title {
  justify-content: center;
  align-items: center;
  padding: 20px 20px;
}

.sidebar.collapsed .sidebar-menu .menu-title .menu-icon {
  margin-right: 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-menu .menu-title .menu-arrow {
  display: none;
}

.sidebar.collapsed .sidebar-menu .submenu {
  display: none !important;
}

.sidebar.collapsed .sidebar-menu .submenu li {
  padding: 0;
  text-align: center;
}

.sidebar.collapsed .sidebar-menu .submenu li > a {
  padding: 20px 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-menu .submenu li .menu-icon {
  justify-content: center;
  margin-right: 0;
}

/* 主内容区根据侧边栏状态调整 */
.main {
  flex: 1;
  min-width: 0;
  margin-left: 220px;
  padding: 20px;
  transition: margin-left 0.3s;
  overflow-y: auto;
  height: 100vh;
}

body.sidebar-collapsed .main {
  margin-left: 60px;
}

.header {
  background: #fff;
  padding: 0 20px;
  border-radius: 8px;
  margin: -20px 0 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  height: 70px;
  box-sizing: border-box;
}

.header-title {
  font-size: 18px;
  font-weight: bold;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-user span {
  color: #666;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stats-grid.overall-stats {
  grid-template-columns: 1fr 1fr 2fr;
}

.stat-card.filter-card {
  border-left-color: #667eea;
  padding: 15px 20px;
}

.stat-card.filter-card .filter-content {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.stat-card.filter-card .filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stat-card.filter-card .filter-row select,
.stat-card.filter-card .filter-row input {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  min-width: 120px;
}

.stat-card.filter-card .filter-buttons {
  margin-left: auto;
}

.stat-card.filter-card .filter-buttons .btn {
  padding: 5px 12px;
  font-size: 12px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 15px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #667eea;
}

.stat-card.receivable {
  border-left-color: #52c41a;
}

.stat-card.payable {
  border-left-color: #faad14;
}

.stat-card.warning {
  border-left-color: #f5222d;
}

.stat-label {
  color: #999;
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

/* 表格 */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: auto;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}

tr:hover {
  background: #f9f9f9;
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-receivable {
  background: #e6f0ff;
  color: #0052D9;
}

.tag-payable {
  background: #fff7e6;
  color: #fa8c16;
}

.tag-pending {
  background: #fffbe6;
  color: #faad14;
}

.tag-active {
  background: #e6f0ff;
  color: #0052D9;
}

.tag-completed {
  background: #f6ffed;
  color: #52c41a;
}

.tag-terminated {
  background: #fff1f0;
  color: #f5222d;
}

.tag-paid {
  background: #f6ffed;
  color: #52c41a;
}

.tag-overdue {
  background: #fff1f0;
  color: #f5222d;
}

/* 筛选栏 */
.filter-bar {
  background: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-item label {
  font-size: 12px;
  color: #666;
}

.filter-item input,
.filter-item select {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  min-width: 150px;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

.pagination span {
  color: #666;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 1100px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-large {
  width: 1200px;
  max-width: 95vw;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: #fff;
  z-index: 1;
}

.modal-title {
  font-size: 16px;
  font-weight: bold;
}

.modal-close {
  cursor: pointer;
  font-size: 20px;
  color: #999;
}

.modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: #fff;
  z-index: 1;
}

/* 详情页 */
.detail-section {
  margin-bottom: 20px;
}

/* 详情选项卡 */
.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e8e8e8;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #0052D9;
}

.tab-btn.active {
  color: #0052D9;
  border-bottom-color: #0052D9;
  font-weight: 500;
}

.tab-content {
  animation: fadeIn 0.3s;
}

.detail-tab-content {
  display: none;
}

.detail-tab-content.active {
  display: block;
  opacity: 1;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-item label {
  color: #999;
  font-size: 12px;
}

.detail-item span {
  color: #333;
  font-size: 14px;
  word-break: break-all;
}

.detail-label {
  color: #999;
  min-width: 100px;
}

.detail-value {
  color: #333;
  flex: 1;
}

/* 操作按钮组 */
.action-btns {
  display: flex;
  gap: 8px;
}

/* 金额显示 */
.amount {
  font-weight: bold;
}

.amount.receivable {
  color: #52c41a;
}

.amount.payable {
  color: #fa8c16;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

/* 提示消息 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 6px;
  color: #fff;
  z-index: 2000;
  animation: slideDown 0.3s;
}

.toast.success {
  background: #52c41a;
}

.toast.error {
  background: #f5222d;
}

.toast.info {
  background: #0052D9;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* 上传区域 */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s;
}

.upload-area:hover {
  border-color: #667eea;
}

.upload-area p {
  color: #999;
  margin-top: 10px;
}

/* 附件列表 */
.attachment-list {
  margin-top: 10px;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f9f9f9;
  border-radius: 4px;
  margin-bottom: 8px;
}

.attachment-item a {
  color: #0052D9;
  text-decoration: none;
}

.attachment-item a:hover {
  text-decoration: underline;
}

/* ==================== 列显示/隐藏 ==================== */
.col-settings-th {
  width: 45px;
  text-align: center;
  position: sticky;
  right: 0;
  background: #fafafa;
  z-index: 10;
}

.col-settings-icon {
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  transition: opacity 0.3s, transform 0.3s;
  display: inline-block;
}

.col-settings-icon:hover {
  opacity: 1;
  transform: rotate(45deg);
}

.column-panel {
  position: absolute;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  z-index: 2000;
  min-width: 180px;
  max-height: 400px;
  overflow-y: auto;
}

.column-panel-header {
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #262626;
  background: #fafafa;
  border-radius: 8px 8px 0 0;
}

.column-panel-body {
  padding: 8px 0;
}

.column-panel-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
  color: #595959;
}

.column-panel-item:hover {
  background: #f5f5f5;
}

.column-panel-item input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #0052D9;
}

/* 拖拽排序相关样式 */
.column-panel-item-drag {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: move;
  transition: background 0.2s;
  font-size: 13px;
  color: #595959;
  border-bottom: 1px solid #f5f5f5;
  user-select: none;
}

.column-panel-item-drag:hover {
  background: #f5f5f5;
}

.column-panel-item-drag.drag-over {
  background: #e6f0ff;
  border-top: 2px solid #0052D9;
}

.column-panel-item-drag input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #0052D9;
}

.drag-handle {
  cursor: move;
  color: #bfbfbf;
  margin-right: 6px;
  font-size: 12px;
  letter-spacing: -2px;
}

.drag-handle:hover {
  color: #0052D9;
}

.column-panel-footer {
  padding: 10px 16px;
  border-top: 1px solid #f0f0f0;
  text-align: center;
  background: #fafafa;
  border-radius: 0 0 8px 8px;
}

.column-panel-footer .btn {
  padding: 4px 12px;
  font-size: 12px;
}


/* ===== 弹窗内表格：滚动时表头锁定（吸顶） ===== */
.modal table { border-collapse: separate; border-spacing: 0; }
.modal th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fafafa !important;
  box-shadow: inset 0 -1px 0 #e8e8e8;
  white-space: nowrap;
}
/* 无内联固定高度的弹窗表格容器：不单独形成滚动条，交由 modal-body 统一滚动，使表头相对 modal-body 吸顶。
   带内联 max-height + overflow-y:auto 的容器（如详情关联合同表）内联优先级更高，仍保持内部滚动。*/
.modal .table-container {
  overflow-x: visible;
  overflow-y: visible;
}
.modal [id$="PickerList"],
.modal [id$="SelectList"],
.modal [id$="List"][style*="overflow"] {
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   移动端 / 小屏响应式适配（手机、小平板）
   侧边栏改为抽屉式，内容区全宽；多列栅格改单列；弹窗/筛选/表格自适应
   ============================================================ */
.mobile-menu-btn { display: none; }
.sidebar-mask { display: none; }

@media (max-width: 768px) {
  /* 顶部汉堡按钮 */
  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1200;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #0052D9;
    color: #fff;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }

  /* 遮罩 */
  .sidebar-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1050;
  }
  body:not(.mobile-sidebar-open) .sidebar-mask { display: none; }
  body.mobile-sidebar-open .sidebar-mask { display: block; }

  /* 侧边栏：抽屉，默认移出屏幕 */
  .sidebar {
    width: 240px !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1100;
    box-shadow: 2px 0 14px rgba(0,0,0,0.25);
  }
  body.mobile-sidebar-open .sidebar { transform: translateX(0); }
  /* 手机端不使用 PC 的折叠态，抽屉始终完整显示文字 */
  .sidebar.collapsed { width: 240px !important; }
  .sidebar.collapsed .menu-text,
  .sidebar.collapsed .menu-arrow { display: inline; }
  .sidebar.collapsed .menu-icon { margin-right: 10px; font-size: 16px; }
  .sidebar.collapsed .submenu { display: block; max-height: none; overflow: visible; }
  .sidebar-toggle { display: none !important; }

  /* 内容区全宽 */
  .main,
  body.sidebar-collapsed .main {
    margin-left: 0 !important;
    padding: 12px;
    padding-top: 60px;
    width: 100%;
    box-sizing: border-box;
  }

  /* 顶栏：避让汉堡按钮，取消固定高度、纵向自适应，避免内容重叠 */
  .header {
    height: auto !important;
    min-height: 48px;
    margin: 0 0 12px;
    padding: 10px 12px 10px 58px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .header-title { font-size: 16px; width: 100%; line-height: 1.4; }
  .header-user { flex-wrap: wrap; gap: 8px; font-size: 12px; width: 100%; align-items: center; }
  .header-user span { white-space: nowrap; }
  .header-user .btn { padding: 4px 10px; font-size: 12px; }
  .header > div { flex-wrap: wrap; }

  /* 多列详情/表单栅格改单列 */
  .detail-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr !important; }
  .form-row { flex-direction: column; gap: 0; }

  /* 统计卡片：总体统计三列改两列 */
  .stats-grid.overall-stats { grid-template-columns: 1fr 1fr; }
  /* 筛选卡横跨整行，避免输入框被挤到半栏 */
  .stats-grid.overall-stats .stat-card.filter-card { grid-column: 1 / -1; }
  .stats-grid { gap: 12px; margin-bottom: 12px; }
  .stat-value { font-size: 19px; }
  .stat-card { padding: 12px 14px; }

  /* 看板/图表横向排列改纵向 */
  .chart-row, .dashboard-row, .cards-row, .panel-row {
    flex-direction: column;
  }
  .chart-card, .panel-card { width: 100%; margin-bottom: 12px; }

  /* 筛选栏：每项占整行，输入框全宽 */
  .filter-bar { gap: 10px; padding: 12px; }
  .filter-item { width: 100%; }
  .filter-item input, .filter-item select { width: 100%; min-width: 0; box-sizing: border-box; }
  .stat-card.filter-card .filter-row { flex-wrap: wrap; width: 100%; }
  .stat-card.filter-card .filter-row select,
  .stat-card.filter-card .filter-row input { min-width: 0; flex: 1 1 45%; }
  .stat-card.filter-card .filter-buttons { margin-left: 0; width: 100%; display: flex; gap: 8px; }
  .stat-card.filter-card .filter-buttons .btn { flex: 1; }

  /* 弹窗几乎占满屏宽 */
  .modal, .modal-large { width: 96vw !important; max-width: 96vw; max-height: 92vh; }
  .modal-body { padding: 14px; }
  .modal-header, .modal-footer { padding: 12px 14px; }

  /* 表格：保持可横向滚动，单元格紧凑不换行 */
  .table-container { -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 10px; }

  /* 操作按钮组、分页、汇总栏换行 */
  .action-btns { flex-wrap: wrap; }
  .pagination { flex-wrap: wrap; gap: 6px; }
  .summary-bar { flex-wrap: wrap; gap: 8px; }

  /* 通用按钮在窄栏不被挤压 */
  .btn { white-space: nowrap; }

  /* 卡片间距收紧 */
  .card { margin-bottom: 12px; }

  /* ===== 业务页通用收敛：覆盖页面内联样式，使列表/详情/表单在手机端可用 ===== */

  /* 工具栏允许换行，搜索框占满整行（合同/回款/付款/发票/客户/供应商/产品页共用模式） */
  .card-title > div { flex-wrap: wrap; }
  .card-title > div input[type="text"] { width: 100% !important; min-width: 0; }

  /* 内联多列统计栅格 repeat(3/4/5,1fr) 收敛为两列 */
  [style*="grid-template-columns:repeat(3"], [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(4"], [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(5"], [style*="grid-template-columns: repeat(5"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* 内联双列栅格（1fr 1fr 的表单/详情区）收敛为单列 */
  [style*="grid-template-columns:1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* 手机端允许页面滚动 */
  html, body { overflow: auto !important; height: auto !important; }
  .main { overflow: visible !important; height: auto !important; }
  .table-container { max-height: none !important; overflow-x: auto; }

  /* 弹窗footer按钮换行 */
  .modal-footer { flex-wrap: wrap; justify-content: center; }
  .modal-footer .btn { flex: 1 1 auto; min-width: 80px; }

  /* 汇总栏手机端垂直排列，不重叠 */
  #summaryBar { flex-wrap: wrap !important; height: auto !important; line-height: 1.6 !important; padding: 10px 12px !important; white-space: normal !important; gap: 4px 8px; font-size: 13px; }
  #summaryBar > span, #summaryBar > div { flex: 1 1 45%; white-space: normal !important; word-break: break-all; }
  #summaryBar .pagination { justify-content: center; margin-top: 6px; width: 100%; flex: none; }

  /* 客户/供应商等页的 #summaryRow：汇总信息与分页分两行显示 */
  #summaryRow { flex-wrap: wrap !important; height: auto !important; line-height: 1.6 !important; padding: 10px 14px !important; white-space: normal !important; gap: 4px 8px; font-size: 13px; }
  #summaryRow > div:first-child { flex-wrap: wrap; flex: 1 1 100%; }
  #summaryRow .pagination { margin: 6px 0 0 0 !important; width: 100%; flex: none; justify-content: center; }

  /* 表格保持横向滚动 */
  .table-container { display: block; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .table-container table { min-width: 700px; }
  .table-container td, .table-container th { white-space: nowrap; }
}

/* ===== 合同列表行高35px + 分页紧凑 ===== */
.table-container table td, .table-container table th {
  padding: 0 12px;
  height: 39px !important;
  line-height: 39px;
  box-sizing: border-box;
}
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pagination button {
  padding: 2px 6px;
  font-size: 12px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.pagination button.active {
  background: #0052D9;
  color: #fff;
  border-color: #0052D9;
}
.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-container table tr { height: 39px !important; }

html, body { height: 100%; overflow: hidden; }
.table-container .action-btns { display:flex; justify-content:flex-end; gap:6px; }
.table-container th:last-child, .table-container th:nth-last-child(2) { text-align:right !important; }
.table-container th:last-child, .table-container td:last-child { text-align:right; }


/* 全局禁用图片拖拽与选中，防止logo点击/框选出现高亮 */
img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}