/* ============================================
   订单管理系统样式 - Frontend Design Ultimate
   深色主题优化版
   ============================================ */

:root {
  /* 背景层次 */
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-hover: #21262d;
  --bg-active: #30363d;
  
  /* 卡片 */
  --card: #161b22;
  --card-border: #30363d;
  
  /* 文字 */
  --text: #e6edf3;
  --text-muted: #8b949e;
  
  /* 边框 */
  --border: #30363d;
  --border-strong: #484f58;
  
  /* 强调色 - OpenClaw 签名红优化版 */
  --accent: #ff6b6b;
  --accent-hover: #ff8787;
  --accent-subtle: rgba(255, 107, 107, 0.15);
  --accent-glow: rgba(255, 107, 107, 0.3);
  
  /* 语义色 */
  --ok: #2ea043;
  --ok-subtle: rgba(46, 160, 67, 0.15);
  --danger: #da3633;
  --danger-subtle: rgba(218, 54, 51, 0.15);
  --warning: #d29922;
  --warning-subtle: rgba(210, 153, 34, 0.15);
  
  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* 阴影 */
  --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 var(--accent-glow);
  
  /* 动画 */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* 布局 */
  --shell-topbar-height: 56px;
  --shell-nav-width: 240px;
  --shell-pad: 20px;
  --shell-gap: 20px;
}

/* ============================================
   基础重置
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   Shell 布局
   ============================================ */
.shell {
  display: grid;
  grid-template-columns: var(--shell-nav-width) 1fr;
  grid-template-rows: var(--shell-topbar-height) 1fr;
  grid-template-areas:
    "topbar topbar"
    "nav content";
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-elevated) 100%);
}

/* ============================================
   顶部栏
   ============================================ */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--shell-pad);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-collapse-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-out);
}

.nav-collapse-toggle:hover {
  background: var(--bg-hover);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================
   按钮
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-2px);
}

/* ============================================
   左侧导航
   ============================================ */
.nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform var(--duration-fast) var(--ease-out);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
}

.nav-item.active::before {
  transform: scaleY(1);
}

.nav-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item__label {
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   主内容区
   ============================================ */
.content {
  grid-area: content;
  overflow: auto;
  padding: var(--shell-pad);
  background: transparent;
  display: flex;
  flex-direction: column;
}

/* ============================================
   页面容器
   ============================================ */
.page {
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.3s var(--ease-out);
  flex: 1;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ============================================
   卡片
   ============================================ */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--duration-fast) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* ============================================
   统计卡片
   ============================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--shell-gap);
  margin-bottom: 28px;
}

.stat-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-fast) var(--ease-out);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card__label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}

.stat-card__value.muted {
  color: var(--text-muted);
}

.stat-card__value.accent {
  color: var(--accent);
}

.stat-card__value.ok {
  color: var(--ok);
}

/* ============================================
   表格
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table td {
  font-size: 14px;
  color: var(--text);
  transition: background var(--duration-fast) var(--ease-out);
}

.table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   表单元素
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: all var(--duration-fast) var(--ease-out);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* ============================================
   订单卡片
   ============================================ */
.order-card {
  padding: 16px 20px;
  transition: all var(--duration-fast) var(--ease-out);
}

.order-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* 第一行：订单信息 */
.order-row-1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.order-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}

.order-no {
  font-weight: 600;
  color: var(--accent);
}

.order-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.order-customer {
  color: var(--text);
  font-weight: 500;
}

.order-date {
  color: var(--text-muted);
  font-size: 13px;
}

/* 操作按钮 */
.order-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
  border: none;
}

.btn-warning:hover {
  opacity: 0.9;
}

.btn-danger-icon {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
}

.btn-danger-icon:hover {
  background: var(--danger-subtle);
}

/* 第二行：数据统计 */
.order-row-2 {
  display: flex;
  gap: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.order-stat {
  min-width: 100px;
}

.order-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.order-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   标签页
   ============================================ */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 8px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tab.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent-subtle);
}

/* ============================================
   状态标签
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.pending {
  background: var(--warning-subtle);
  color: var(--warning);
}

.badge.completed {
  background: var(--ok-subtle);
  color: var(--ok);
}

.badge.danger {
  background: var(--danger-subtle);
  color: var(--danger);
}

/* ============================================
   悬停提示框
   ============================================ */
.recent-orders-tooltip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-width: 400px;
  padding: 0;
  animation: fadeIn 0.2s var(--ease-out);
  pointer-events: none;
}

.tooltip-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tooltip-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.tooltip-orders {
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.tooltip-order-item {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-out);
}

.tooltip-order-item:hover {
  background: var(--bg-hover);
}

.tooltip-order-no {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.tooltip-order-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.tooltip-order-info span:last-child {
  font-size: 11px;
}

.tooltip-order-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
}

.tooltip-order-amount .text-ok {
  font-size: 11px;
  font-weight: 500;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   加载动画
   ============================================ */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   响应式 - 平板
   ============================================ */
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--shell-topbar-height) auto 1fr;
    grid-template-areas:
      "topbar"
      "nav"
      "content";
  }
  
  .nav {
    flex-direction: row;
    padding: 12px var(--shell-pad);
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    gap: 8px;
  }
  
  .nav-item {
    flex-direction: column;
    padding: 10px 14px;
    margin-bottom: 0;
    min-width: 72px;
  }
  
  .nav-item::before {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 3px;
    transform: scaleX(0);
  }
  
  .nav-item.active::before {
    transform: scaleX(1);
  }
  
  .nav-item__label {
    font-size: 11px;
    margin-top: 4px;
  }
  
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   响应式 - 手机
   ============================================ */
@media (max-width: 600px) {
  .shell {
    --shell-pad: 16px;
    --shell-gap: 16px;
  }
  
  .nav-collapse-toggle {
    display: flex;
  }
  
  .nav {
    display: none;
    position: fixed;
    left: 0;
    top: var(--shell-topbar-height);
    bottom: 0;
    width: 260px;
    background: var(--bg-elevated);
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  
  .nav.open {
    display: flex;
    flex-direction: column;
  }
  
  .nav-item {
    flex-direction: row;
    min-width: auto;
  }
  
  .nav-item::before {
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    height: auto;
    transform: scaleY(0);
  }
  
  .nav-item.active::before {
    transform: scaleY(1);
  }
  
  .nav-item__label {
    font-size: 14px;
    margin-top: 0;
  }
  
  .brand-sub {
    display: none;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-card__value {
    font-size: 24px;
  }
}

/* ============================================
   统计概览
   ============================================ */
.stats-overview {
  padding: 20px;
}

.stats-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.stats-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  height: 18px;
  cursor: default;
}

.stats-header h3 svg {
  display: inline-block;
  vertical-align: middle;
}

.stats-header h3:hover {
  color: var(--text);
}

#currentMonth {
  margin-left: auto;
  margin-right: 16px;
}

#toggleBtn {
  margin-left: 0;
}

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

.stats-section {
  padding: 16px 0;
}

.stats-section:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.stats-item {
  text-align: center;
  padding: 16px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all var(--duration-fast) var(--ease-out);
}

.stats-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* 敏感数据项 */
.stats-item.sensitive {
  position: relative;
}

.stats-item.sensitive::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 100%);
  border-radius: var(--radius-md);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.stats-item.sensitive.sensitive-active::after {
  opacity: 0;
}

.sensitive-value {
  position: relative;
}

.sensitive-value.blur {
  filter: blur(4px);
  user-select: none;
}

.stats-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-label svg {
  flex-shrink: 0;
}

.stats-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* 统计排行 3 列 */
.stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.stat-column {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
}

/* ============================================
   卡片头部
   ============================================ */
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  height: 18px;
}

.card-header h3 svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.ranking-header {
  padding: 0 0 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.ranking-header h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* 排行 3 列布局 */
.rankings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 20px 0;
}

.ranking-column {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
}

/* 进行中订单表格 */
.orders-table th {
  width: auto;
}

.orders-table th:nth-child(1) { width: 160px; }
.orders-table th:nth-child(2) { width: 100px; }
.orders-table th:nth-child(3) { width: 70px; }
.orders-table th:nth-child(4) { width: 70px; }
.orders-table th:nth-child(5) { width: 90px; }
.orders-table th:nth-child(6) { width: 90px; }

/* 排行列表 */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-out);
}

.ranking-item:hover {
  background: var(--bg-hover);
}

.ranking-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ranking-item:nth-child(1) .ranking-rank {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
}

.ranking-item:nth-child(2) .ranking-rank {
  background: linear-gradient(135deg, #9ca3af, #4b5563);
  color: #fff;
}

.ranking-item:nth-child(3) .ranking-rank {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #fff;
}

.ranking-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* 码数柱状图 */
.size-chart-container {
  padding: 20px 10px 10px;
}

.size-bars {
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 10px;
  margin-bottom: 12px;
}

.size-bars-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  width: 100%;
  height: 100%;
}

.size-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  flex: 1;
  max-width: 50px;
  margin: 0 4px;
}

.size-bar {
  width: 100%;
  min-height: 4px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
}

.size-bar:hover {
  opacity: 0.8;
  transform: scaleX(1.1);
}

.size-bar-value {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.size-labels {
  display: flex;
  justify-content: space-around;
  padding: 0 10px;
  margin-bottom: 12px;
}

.size-label {
  flex: 1;
  max-width: 50px;
  margin: 0 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 0;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.size-total {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.size-total strong {
  color: var(--text);
  font-weight: 600;
}

/* ============================================
   响应式 - 统计
   ============================================ */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .rankings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ranking-column:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-value {
    font-size: 16px;
  }
  
  .stats-label {
    font-size: 11px;
  }
  
  .rankings-grid {
    grid-template-columns: 1fr;
  }
  
  .ranking-column:last-child {
    grid-column: span 1;
  }
  
  .size-item {
    grid-template-columns: 25px 1fr 40px 40px;
    gap: 8px;
  }
}

/* 排行列表 */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-out);
}

.ranking-item:hover {
  background: var(--bg-hover);
}

.ranking-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ranking-item:nth-child(1) .ranking-rank {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
}

.ranking-item:nth-child(2) .ranking-rank {
  background: linear-gradient(135deg, #9ca3af, #4b5563);
  color: #fff;
}

.ranking-item:nth-child(3) .ranking-rank {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #fff;
}

.ranking-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* 扇形图 */
.pie-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
}

.pie-chart {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--bg-hover) 0% 100%);
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-normal) var(--ease-out);
}

.pie-chart:hover {
  transform: scale(1.05);
}

.pie-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pie-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.pie-total strong {
  color: var(--text);
  font-weight: 600;
}

/* 本月统计头部 */
.monthly-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.monthly-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.monthly-grid {
  grid-template-columns: repeat(6, 1fr);
}

/* ============================================
   响应式 - 统计排行
   ============================================ */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .monthly-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .monthly-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-card__value {
    font-size: 24px;
  }
}

/* ============================================
   工具类
   ============================================ */
.text-muted {
  color: var(--text-muted);
}

.text-accent {
  color: var(--accent);
}

.text-ok {
  color: var(--ok);
}

.text-danger {
  color: var(--danger);
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

.blur {
  filter: blur(4px);
  user-select: none;
}

/* ============================================
   颜色下拉框
   ============================================ */
.color-dropdown {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg);
}

.color-dropdown > div {
  transition: background var(--duration-fast) var(--ease-out);
}

/* ============================================
   产品图片占位符
   ============================================ */
.product-image-placeholder {
  opacity: 0.5;
  transition: opacity var(--duration-fast) var(--ease-out);
}

/* ============================================
   页脚
   ============================================ */
.footer {
  padding: 20px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  margin-top: auto;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.footer a:hover {
  color: var(--accent-hover);
}

/* ============================================
   加载状态
   ============================================ */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-muted);
  font-size: 14px;
}

/* 骨架屏 */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    var(--bg-hover) 50%,
    var(--bg) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-card {
  height: 120px;
  margin-bottom: 16px;
}

/* ============================================
   错误提示
   ============================================ */
.error-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--danger-subtle);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  color: var(--danger);
  margin-bottom: 16px;
  animation: slideIn 0.3s var(--ease-out);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.error-content {
  flex: 1;
}

.error-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.error-description {
  font-size: 13px;
  opacity: 0.9;
}

.error-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.error-close:hover {
  opacity: 1;
}

/* 成功提示 */
.success-message {
  background: var(--ok-subtle);
  border-color: var(--ok);
  color: var(--ok);
}

/* 警告提示 */
.warning-message {
  background: var(--warning-subtle);
  border-color: var(--warning);
  color: var(--warning);
}

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s var(--ease-out);
  min-width: 300px;
  max-width: 450px;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left: 4px solid var(--ok);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
