:root {
  --bg-deep: #f5f7fa;
  --bg-panel: #edf0f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --border: rgba(0, 0, 0, 0.06);
  --border-glow: rgba(0, 61, 165, 0.18);
  --accent-blue: #2563eb;
  --accent-gold: #d97706;
  --accent-emerald: #059669;
  --accent-rose: #e11d48;
  --accent-violet: #7c3aed;
  --accent-cyan: #0891b2;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bocom-red: #c41230;
  --bocom-blue: #003da5;
  --glass: rgba(255, 255, 255, 0.85);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0, 61, 165, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(196, 18, 48, 0.02) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}
.dashboard { position: relative; z-index: 1; padding: 20px 28px 40px; max-width: 1920px; margin: 0 auto; }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 16px; border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  animation: fadeSlideDown 0.6s ease-out;
}
.header-left { display: flex; align-items: center; gap: 18px; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--bocom-red), #e8354a);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  box-shadow: 0 4px 20px rgba(196, 18, 48, 0.3);
  letter-spacing: -1px; text-decoration: none; cursor: pointer;
}
.header-title h1 {
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(90deg, #1e293b 0%, var(--bocom-blue) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.header-title p { font-size: 11px; color: var(--text-secondary); margin-top: 2px; letter-spacing: 2px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.time-display {
  font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent-blue);
  background: rgba(37, 99, 235, 0.05); padding: 6px 14px; border-radius: var(--radius-sm);
  border: 1px solid rgba(37, 99, 235, 0.1);
}

/* Nav Bar */
.nav-bar {
  display: flex; align-items: center; gap: 2px; padding: 12px 0 20px;
  margin-bottom: 24px; border-bottom: 1px solid var(--border);
  animation: fadeSlideDown 0.6s ease-out 0.1s backwards;
}
.nav-item {
  padding: 7px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none; transition: all 0.2s;
  border: 1px solid transparent; cursor: pointer; background: transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-item:hover { color: var(--text-primary); background: rgba(0,0,0,0.03); }
.nav-item.active {
  color: var(--bocom-red); background: rgba(196, 18, 48, 0.06);
  border-color: rgba(196, 18, 48, 0.12); font-weight: 600;
}
.nav-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.nav-back {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none; transition: all 0.2s;
  margin-right: 8px; border: 1px solid var(--border);
}
.nav-back:hover { color: var(--text-primary); background: rgba(0,0,0,0.03); }
.nav-back svg { width: 14px; height: 14px; }

/* Period Tabs */
.period-tabs {
  display: flex; gap: 4px; background: var(--bg-panel); border-radius: var(--radius-sm);
  padding: 4px; border: 1px solid var(--border);
}
.period-tab {
  padding: 6px 16px; border-radius: 8px; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.25s; color: var(--text-secondary);
  border: none; background: transparent;
}
.period-tab.active {
  background: linear-gradient(135deg, var(--bocom-red), #e8354a);
  color: #fff; box-shadow: 0 2px 12px rgba(196, 18, 48, 0.3);
}
.period-tab:hover:not(.active) { color: var(--text-primary); background: rgba(0,0,0,0.04); }

/* KPI Cards */
.kpi-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.kpi-strip.cols-6 { grid-template-columns: repeat(6, 1fr); }
.kpi-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: all 0.3s; cursor: default;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.kpi-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.kpi-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; font-weight: 400; }
.kpi-value {
  font-family: 'DM Mono', monospace; font-size: 28px; font-weight: 500;
  line-height: 1; margin-bottom: 8px;
}
.kpi-sub { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.kpi-sub .rate { font-weight: 500; }
.kpi-sub .rate.up { color: var(--accent-emerald); }
.kpi-sub .rate.down { color: var(--accent-rose); }
.kpi-sub .label { color: var(--text-muted); }
.kpi-progress { margin-top: 10px; }
.kpi-progress-bar {
  height: 4px; border-radius: 2px; background: rgba(0,0,0,0.06); overflow: hidden;
}
.kpi-progress-fill { height: 100%; border-radius: 2px; transition: width 1.5s ease-out; }
.kpi-progress-text { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-align: right; }

/* Panels */
.main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.panel {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.panel-title .dot { width: 8px; height: 8px; border-radius: 50%; }
.panel-body { padding: 16px 20px; }
.chart-container { width: 100%; height: 320px; }
.full-width { grid-column: 1 / -1; }
.chart-lg { height: 380px; }
.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel-badge {
  font-size: 10px; padding: 3px 10px; border-radius: 6px;
  background: rgba(37, 99, 235, 0.06); color: var(--accent-blue);
  font-weight: 500;
}
.product-tabs {
  display: flex; gap: 3px; background: rgba(0,0,0,0.03); border-radius: 8px; padding: 3px;
}
.product-tab {
  padding: 4px 12px; border-radius: 6px; font-size: 11px; font-weight: 500;
  cursor: pointer; color: var(--text-muted); border: none; background: transparent;
  transition: all 0.2s;
}
.product-tab.active { background: rgba(37, 99, 235, 0.08); color: var(--accent-blue); }
.product-tab:hover:not(.active) { color: var(--text-secondary); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 500;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(37, 99, 235, 0.03); }
.data-table tbody td {
  padding: 11px 12px; font-size: 12.5px; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.data-table .num { font-family: 'DM Mono', monospace; font-size: 12px; }
.data-table .branch-name { font-weight: 500; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 500;
}
.badge-success { background: rgba(5, 150, 105, 0.08); color: var(--accent-emerald); }
.badge-warning { background: rgba(217, 119, 6, 0.08); color: var(--accent-gold); }
.badge-danger { background: rgba(225, 29, 72, 0.08); color: var(--accent-rose); }
.inline-bar { display: flex; align-items: center; gap: 8px; }
.inline-bar-track {
  flex: 1; height: 6px; background: rgba(0,0,0,0.06); border-radius: 3px; overflow: hidden;
}
.inline-bar-fill { height: 100%; border-radius: 3px; transition: width 1.2s ease-out; }

/* Rank list */
.rank-list { list-style: none; }
.rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 24px; height: 24px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  flex-shrink: 0;
}
.rank-num.top { background: linear-gradient(135deg, var(--accent-gold), #fbbf24); color: #1a1a1a; }
.rank-num.normal { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.rank-info { flex: 1; }
.rank-name { font-size: 13px; font-weight: 500; }
.rank-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rank-value { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; color: var(--accent-gold); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Animations */
@keyframes fadeSlideDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.kpi-strip .kpi-card { animation: fadeSlideUp 0.5s ease-out backwards; }
.kpi-strip .kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-strip .kpi-card:nth-child(2) { animation-delay: 0.15s; }
.kpi-strip .kpi-card:nth-child(3) { animation-delay: 0.2s; }
.kpi-strip .kpi-card:nth-child(4) { animation-delay: 0.25s; }
.kpi-strip .kpi-card:nth-child(5) { animation-delay: 0.3s; }
.kpi-strip .kpi-card:nth-child(6) { animation-delay: 0.35s; }
.panel { animation: fadeSlideUp 0.6s ease-out backwards; }
.main-grid .panel:nth-child(1) { animation-delay: 0.3s; }
.main-grid .panel:nth-child(2) { animation-delay: 0.35s; }
.main-grid .panel:nth-child(3) { animation-delay: 0.4s; }
.bottom-grid .panel:nth-child(1) { animation-delay: 0.45s; }
.bottom-grid .panel:nth-child(2) { animation-delay: 0.5s; }

/* Responsive */
@media (max-width: 1440px) {
  .kpi-strip.cols-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1200px) {
  .main-grid, .bottom-grid { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .kpi-strip { grid-template-columns: 1fr; }
  .header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .nav-bar { flex-wrap: wrap; }
}
