/* ==================== Linear Aesthetic Theme ==================== */
:root[data-theme="dark"],
:root {
  /* Colors */
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #18181b;
  --bg-elevated: #1c1c1f;
  --bg-hover: #232326;
  
  --border-primary: rgba(255, 255, 255, 0.06);
  --border-secondary: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(99, 179, 237, 0.5);
  
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 8px;
  --spacing-lg: 8px;
  --spacing-xl: 8px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
:root[data-theme="light"] {
  /* Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --bg-elevated: #ffffff;
  --bg-hover: #e9ecef;
  
  --border-primary: rgba(0, 0, 0, 0.08);
  --border-secondary: rgba(0, 0, 0, 0.12);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-primary: #1a1a1b;
  --text-secondary: #4a4a4f;
  --text-tertiary: #6c6c73;
  
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 8px;
  --spacing-lg: 8px;
  --spacing-xl: 8px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== Reset & Base ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

/* ==================== App Layout ==================== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==================== Sidebar ==================== */
.sidebar {
  width: 180px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg);
  gap: var(--spacing-xl);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo svg {
  color: var(--accent-primary);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item svg {
  flex-shrink: 0;
}

/* ==================== Main Content ==================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.header {
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
}

.header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: var(--spacing-md);
}

.content {
  flex: 1;
  padding: var(--spacing-xl);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* ==================== Buttons ==================== */
.btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 13px;
}

/* ==================== Tables ==================== */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-tertiary);
}

th {
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-primary);
}

td {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  font-size: 14px;
  color: var(--text-primary);
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ==================== Forms ==================== */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn var(--transition-base);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--transition-slow);
}

.modal-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

/* ==================== Filters ==================== */
.filters {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

/* ==================== Advanced Date Filter ==================== */
.date-filter-advanced {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.date-filter-advanced .filter-group {
  flex: 1;
  min-width: 180px;
}

/* ==================== Badges ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* ==================== Empty State ==================== */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl) * 2;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ==================== Actions ==================== */
.actions {
  display: flex;
  gap: var(--spacing-sm);
}

/* ==================== Quantity Display ==================== */
.quantity {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-weight: 600;
  color: var(--accent-secondary);
}

/* ==================== Date Display ==================== */
.date {
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    padding: var(--spacing-md);
  }
  
  .logo span,
  .nav-item span {
    display: none;
  }
  
  .nav-item {
    justify-content: center;
  }
}

/* ==================== Form Container ==================== */
.form-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== Autocomplete ==================== */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 100;
  margin-top: 4px;
}

.autocomplete-item {
  padding: var(--spacing-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-primary);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--bg-hover);
}

.autocomplete-item-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.autocomplete-item-spec {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ==================== Login Page ==================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  padding: var(--spacing-lg);
}

.login-container {
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.login-header svg {
  color: var(--accent-primary);
  margin-bottom: var(--spacing-md);
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.login-demo-accounts {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-primary);
}

.login-demo-accounts p {
  color: var(--text-tertiary);
  font-size: 12px;
  margin-bottom: var(--spacing-sm);
}

.demo-accounts-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.demo-accounts-list span {
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.demo-accounts-list span:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ==================== User Info ==================== */
.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.user-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: 50%;
  color: var(--accent-secondary);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 12px;
  color: var(--text-tertiary);
}

.btn-logout {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

/* ==================== Link Button ==================== */
.btn-link {
  background: transparent;
  border: none;
  color: var(--accent-secondary);
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent-primary);
}

/* ==================== Nav Group & Submenu ==================== */
.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-toggle {
  position: relative;
}

.nav-arrow {
  position: absolute;
  right: var(--spacing-sm);
  transition: transform var(--transition-fast);
}

.nav-group.expanded .nav-arrow {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  flex-direction: column;
  padding-left: calc(var(--spacing-xl) + 20px);
  margin-top: var(--spacing-xs);
}

.nav-group.expanded .nav-submenu {
  display: flex;
}

.nav-subitem {
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-subitem:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-subitem.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
}

/* ==================== Remove Item Button ==================== */
.btn-remove-item {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-remove-item:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

/* ==================== Table Column Widths ==================== */
/* 通用表格列宽设置 */
table th:nth-child(1),
table td:nth-child(1) {
  min-width: 100px; /* 日期列 */
}

table th:nth-child(2),
table td:nth-child(2) {
  min-width: 180px; /* 名称/产品列 */
}

table th:nth-child(3),
table td:nth-child(3) {
  min-width: 80px; /* 批号/规格列 */
}

table th:nth-child(4),
table td:nth-child(4) {
  min-width: 60px; /* 数量/仓库列 */
}

table th:nth-child(5),
table td:nth-child(5) {
  min-width: 60px; /* 单价列 */
}

table th:nth-child(6),
table td:nth-child(6) {
  min-width: 60px; /* 金额列 */
}

table th:nth-child(7),
table td:nth-child(7) {
  min-width: 60px; /* 状态/已核销列 */
}

table th:nth-child(8),
table td:nth-child(8) {
  min-width: 100px; /* 待核销列 */
}

table th:nth-child(9),
table td:nth-child(9) {
  min-width: 100px; /* 日期/备注列 */
}

table th:nth-child(10),
table td:nth-child(10) {
  min-width: 280px; /* 操作列 */
}

/* 特殊列宽调整 */
.quantity {
  min-width: 80px;
}

.date {
  min-width: 100px;
}

/* 操作列固定宽度 */
.actions {
  min-width: 280px;
  max-width: 320px;
}

/* 自动完成下拉框样式 */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
}

.autocomplete-suggestion {
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid var(--border-primary);
}

.autocomplete-suggestion:last-child {
  border-bottom: none;
}

.autocomplete-suggestion:hover {
  background: var(--bg-tertiary);
}

.autocomplete-add-new {
  color: var(--accent-primary);
  font-weight: 500;
}

.autocomplete-add-new:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* ==================== 收款统计页面样式 ==================== */

.payment-statistics {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 统计概览卡片 */
.stats-overview {
  margin-bottom: 8px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

/* 销售统计卡片网格 - 响应式布局 */
.stats-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.stats-section-title:first-child {
  margin-top: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 默认4列 */
  gap: 16px;
  margin-bottom: 16px;
}

/* 中等屏幕：2列 */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 小屏幕：1列 */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.2;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* 统计卡片颜色变体 */
/* 统计标题卡片 */
.stats-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.stats-header-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stats-header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.stats-header-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent-primary);
  padding: 4px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
}

.stats-header-controls {
  display: flex;
  gap: 8px;
}

.stats-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.stats-nav-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.stats-nav-btn:active {
  transform: scale(0.95);
}

/* 年度统计 - 蓝色系 */
.stat-card-primary .stat-icon {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.stat-card-primary-light .stat-icon {
  background: rgba(59, 130, 246, 0.08);
  color: #60a5fa;
}

.stat-card-primary-lighter .stat-icon {
  background: rgba(59, 130, 246, 0.06);
  color: #93c5fd;
}

.stat-card-primary-avg .stat-icon {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

/* 月度统计 - 绿色系 */
.stat-card-success .stat-icon {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.stat-card-success-light .stat-icon {
  background: rgba(16, 185, 129, 0.08);
  color: #34d399;
}

.stat-card-success-lighter .stat-icon {
  background: rgba(16, 185, 129, 0.06);
  color: #6ee7b7;
}

.stat-card-success-avg .stat-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

/* 本周统计 - 青色系 */
.stat-card-info .stat-icon {
  background: rgba(6, 182, 212, 0.1);
  color: #06b6d4;
}

.stat-card-info-light .stat-icon {
  background: rgba(6, 182, 212, 0.08);
  color: #22d3ee;
}

.stat-card-info-lighter .stat-icon {
  background: rgba(6, 182, 212, 0.06);
  color: #67e8f9;
}

.stat-card-info-avg .stat-icon {
  background: rgba(6, 182, 212, 0.12);
  color: #0891b2;
}

/* 统计区块 */
.stats-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* 视图切换按钮 */
.view-toggle {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.toggle-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.toggle-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* 限制选择器 */
.limit-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.limit-selector label {
  font-size: 13px;
  color: var(--text-secondary);
}

.limit-selector .form-select {
  padding: 4px 8px;
  font-size: 13px;
  min-width: 100px;
}

/* 百分比条 */
.percentage-bar {
  position: relative;
  width: 100%;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.percentage-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.3s ease;
}

.percentage-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 1;
}

/* 统计汇总 */
.stats-summary {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 图表占位符 */
.chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  color: var(--text-tertiary);
}

.chart-placeholder p {
  margin: 4px 0;
  font-size: 14px;
}

/* 加载和错误状态 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.error-message {
  text-align: center;
  padding: 40px;
  color: var(--error-color);
  font-size: 14px;
}

.empty-message {
  text-align: center;
  padding: 40px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .stats-cards {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .view-toggle,
  .limit-selector {
    width: 100%;
  }

  .toggle-btn {
    flex: 1;
  }
}

/* ==================== 图表样式 ==================== */

.charts-section {
  margin-bottom: 24px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.chart-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chart-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chart-controls .form-select {
  padding: 4px 8px;
  font-size: 12px;
  min-width: 100px;
}

.chart-body {
  padding: 20px;
  height: 300px;
  position: relative;
}

.chart-card-wide .chart-body {
  height: 350px;
}

/* 图表响应式 */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card-wide {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .chart-controls {
    width: 100%;
  }

  .chart-body {
    height: 250px;
  }

  .chart-card-wide .chart-body {
    height: 300px;
  }
}

/* ==================== 滚动条样式优化 ==================== */

/* Webkit浏览器滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Firefox滚动条样式 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

/* 防止滚动时闪烁 */
* {
  -webkit-overflow-scrolling: touch;
}

/* 多选下拉框样式优化 */
select[multiple] {
  background-image: none;
  padding: 8px;
}

select[multiple] option {
  padding: 6px 8px;
  margin: 2px 0;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

select[multiple] option:checked {
  background: var(--accent-primary) linear-gradient(0deg, var(--accent-primary) 0%, var(--accent-primary) 100%);
  color: white;
}

select[multiple] option:hover {
  background-color: var(--bg-hover);
}

/* ==================== 到账客户搜索选择器 ==================== */

.payment-customer-selector {
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.selected-customers {
  padding: 8px 12px;
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border-bottom: 1px solid var(--border-primary);
}

.selected-customer-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-primary);
  color: white;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.selected-customer-tag:hover {
  background: var(--accent-secondary);
}

.selected-customer-tag .customer-name {
  white-space: nowrap;
}

.selected-customer-tag .remove-btn {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.selected-customer-tag .remove-btn:hover {
  opacity: 1;
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .form-input {
  border: none;
  border-radius: 0;
  background: transparent;
}

.search-input-wrapper .form-input:focus {
  outline: none;
  box-shadow: none;
}

.customer-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-secondary);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background-color 0.15s ease;
  border-bottom: 1px solid var(--border-primary);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ==================== 批号管理模块样式 ==================== */

.batch-management {
  padding: 0;
}

.batch-row-expired {
  opacity: 0.6;
  background-color: rgba(239, 68, 68, 0.05);
}

.batch-info-section {
  margin-bottom: 24px;
}

.batch-info-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item span {
  font-size: 14px;
  color: var(--text-primary);
}

.batch-selector {
  margin-top: 16px;
}

.batch-selector-empty,
.batch-selector-error {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.batch-info-detail {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.batch-info-detail span {
  color: var(--text-secondary);
}

.batch-info-detail strong {
  color: var(--text-primary);
}

.alert-summary {
  padding: 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.alert-summary p {
  margin: 0;
  color: var(--warning);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination button {
  min-width: 36px;
}

.pagination span {
  color: var(--text-tertiary);
  padding: 0 4px;
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-primary);
}

/* ==================== Theme Transition ==================== */
body,
.sidebar,
.main,
.header,
.content,
.modal,
.btn,
.form-input,
.form-select,
.table-container,
.nav-item,
.user-info,
.stat-card,
.stats-section,
.chart-card,
.form-container,
.login-container {
  transition: 
    background-color var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base),
    box-shadow var(--transition-base);
}

/* ==================== Theme Switch ==================== */
.theme-switch {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  margin-top: auto;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.icon-sun,
.icon-moon {
  position: absolute;
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.icon-sun {
  opacity: 0;
  transform: rotate(180deg) scale(0);
}

.icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light theme icon states */
:root[data-theme="light"] .icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

:root[data-theme="light"] .icon-moon {
  opacity: 0;
  transform: rotate(-180deg) scale(0);
}

.theme-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
}

/* Actions区域的功能开关样式 */
.filters-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filters-actions .filter-toggles {
  display: flex;
  gap: 16px;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.toggle-label:hover {
  color: var(--primary-color);
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
  border: 2px solid var(--border-color);
  border-radius: 3px;
  transition: all 0.2s;
}

.toggle-label input[type="checkbox"]:hover {
  border-color: var(--primary-color);
}

.toggle-label input[type="checkbox"]:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}


/* 三级菜单样式 */
.nav-submenu-group {
  position: relative;
}

.nav-submenu-toggle {
  display: block;
  padding: 8px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-submenu-toggle:hover {
  color: var(--primary-color);
  background: var(--hover-bg);
}

.nav-submenu-level3 {
  display: none;
  padding-left: 20px;
  background: var(--bg-secondary);
}

.nav-submenu-group:hover .nav-submenu-level3,
.nav-submenu-group.active .nav-submenu-level3 {
  display: block;
}

.nav-submenu-level3 .nav-subitem {
  padding-left: 30px;
  font-size: 13px;
}

