/* 垚睿商贸 — 暗色科技风库存看板 v2.0 */
:root {
    --bg-primary: #0B0F1A;
    --bg-secondary: #111827;
    --bg-card: #1A1F2E;
    --bg-card-hover: #222840;
    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border-color: #2A3040;
    --border-glow: rgba(59, 130, 246, 0.25);

    --blue: #3B82F6;
    --blue-glow: rgba(59, 130, 246, 0.35);
    --cyan: #00D4FF;
    --cyan-glow: rgba(0, 212, 255, 0.3);
    --purple: #8B5CF6;
    --purple-glow: rgba(139, 92, 246, 0.3);
    --green: #22C55E;
    --green-glow: rgba(34, 197, 94, 0.25);
    --amber: #F59E0B;
    --amber-glow: rgba(245, 158, 11, 0.25);
    --red: #EF4444;
    --red-glow: rgba(239, 68, 68, 0.25);
    --pink: #EC4899;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.06);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.10);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--cyan); text-decoration: none; }

/* ======= 表格 ======= */
table { border-collapse: collapse; width: 100%; }
th, td {
    border-bottom: 1px solid var(--border-color);
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    color: var(--text-primary);
}
th {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tr.low-row { background: rgba(239, 68, 68, 0.08) !important; }
tr.low-row td { color: var(--red) !important; font-weight: 600 !important; }
tr:hover td { background: rgba(59, 130, 246, 0.04); }

/* ======= 表单控件（保持原有功能，改暗色） ======= */
input, select, button { font: inherit; outline: none; }
input, select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    max-width: 420px;
    transition: var(--transition);
}
input:focus, select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--blue), #2563EB);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    transition: var(--transition);
}
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}
button.secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
}
button.secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--blue);
    box-shadow: none;
    transform: none;
}
button.danger {
    background: linear-gradient(135deg, var(--red), #DC2626);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
button.success {
    background: linear-gradient(135deg, var(--green), #16A34A);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.2);
}
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: 999px; font-size: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.pill:hover { border-color: var(--blue); }
.pill input { margin: 0; }

/* ======= 布局 ======= */
.shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 240px; flex: 0 0 240px;
    border-right: 1px solid var(--border-color);
    background: linear-gradient(180deg, #0F1525, #0B0F1A);
    padding: 20px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.brand {
    font-weight: 800; font-size: 18px;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.brand-sub {
    font-size: 11px; color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 450;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid transparent;
}
.nav a:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
    text-decoration: none;
}
.nav a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(0, 212, 255, 0.08));
    color: #fff;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.08);
}
.nav .sep {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 8px 0;
}
.main {
    flex: 1; min-width: 0;
    padding: 24px 28px;
    box-sizing: border-box;
    overflow-y: auto;
}
.mobileTop { display: none; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.menuBtn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
}
.menuBtn:hover { border-color: var(--blue); }
#navToggle { display: none; }
.overlay { display: none; }

/* ======= 公用类 ======= */
.page { padding: 0; }
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin: 16px 0;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}
.card:hover { border-color: rgba(59, 130, 246, 0.15); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--text-muted); }
.sep-v { width: 1px; height: 24px; background: var(--border-color); margin: 0 8px; }

/* ======= 页面标题 ======= */
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ======= 筛选区 ======= */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.filter-bar .time-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.filter-bar .time-tab {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: transparent;
    box-shadow: none;
}
.filter-bar .time-tab:hover { color: var(--text-primary); background: rgba(59, 130, 246, 0.08); }
.filter-bar .time-tab.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-bar .filter-group label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.filter-bar input[type="date"] {
    padding: 7px 10px;
    font-size: 13px;
    max-width: 150px;
}

/* ======= KPI 环形卡片行 ======= */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.kpi-card.blue::before { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.kpi-card.green::before { background: linear-gradient(90deg, var(--green), #34D399); }
.kpi-card.purple::before { background: linear-gradient(90deg, var(--purple), var(--pink)); }
.kpi-card.amber::before { background: linear-gradient(90deg, var(--amber), #F97316); }
.kpi-card.red::before { background: linear-gradient(90deg, var(--red), #F87171); }
.kpi-card:hover {
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}

/* 环形图容器 */
.kpi-ring {
    width: 80px;
    height: 80px;
    flex: 0 0 80px;
    position: relative;
}
.kpi-ring .ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
}
.kpi-ring .ring-inner {
    position: absolute;
    top: 12px; left: 12px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.kpi-ring .ring-value {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.1;
}
.kpi-ring .ring-label {
    font-size: 8px;
    color: var(--text-muted);
    line-height: 1;
}
.kpi-ring .ring-pct {
    position: absolute;
    top: -4px; right: -4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}
.kpi-info { flex: 1; min-width: 0; }
.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.kpi-number {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 6px;
}
.kpi-change {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
}
.kpi-change.up { color: var(--green); background: rgba(34, 197, 94, 0.1); }
.kpi-change.down { color: var(--red); background: rgba(239, 68, 68, 0.1); }
.kpi-change.neutral { color: var(--text-muted); background: rgba(100, 116, 139, 0.1); }
.kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ======= 图表区域 ======= */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-card);
}
.chart-card.full { grid-column: 1 / -1; }
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-title .badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue);
}
.chart-body {
    min-height: auto;
    position: relative;
}

/* ======= 柱状图（重写原有 barList 样式） ======= */
.bar-chart { overflow-x: auto; padding: 4px 0; }
.bar-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 0;
}
.bar-col {
    flex: 0 0 80px;
    width: 80px;
    text-align: center;
}
.bar-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}
.bar-track {
    height: 100px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 8px;
}
.bar-fill {
    width: 24px;
    border-radius: 12px 12px 4px 4px;
    min-height: 2px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.bar-fill.blue { background: linear-gradient(180deg, var(--cyan), var(--blue)); }
.bar-fill.green { background: linear-gradient(180deg, #34D399, var(--green)); }
.bar-fill.purple { background: linear-gradient(180deg, #A78BFA, var(--purple)); }
.bar-fill.red { background: linear-gradient(180deg, #F87171, var(--red)); }
.bar-fill.amber { background: linear-gradient(180deg, #FBBF24, var(--amber)); }
.bar-label {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
    max-height: 2.4em;
    overflow: hidden;
    word-break: break-word;
}

/* ======= 滞销/预警产品 ======= */
.slow-bar-list { overflow-x: auto; }
.slow-bar-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 0;
}
.slow-bar-col {
    flex: 0 0 96px;
    width: 96px;
    text-align: center;
}
.slow-bar-val {
    font-size: 12px; font-weight: 600;
    color: var(--red);
    margin-bottom: 6px;
}
.slow-bar-track {
    height: 100px;
    display: flex; align-items: flex-end; justify-content: center;
    margin-bottom: 8px;
}
.slow-bar-fill {
    width: 24px;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(180deg, #F87171, #991B1B);
    min-height: 2px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.slow-bar-inv {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;
}

/* ======= 店铺占比环形图 ======= */
.donut-section { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.donut-main { flex: 0 0 140px; position: relative; }
.donut-ring {
    width: 140px; height: 140px;
    border-radius: 50%;
    position: relative;
}
.donut-center {
    position: absolute;
    top: 20px; left: 20px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.donut-center .num {
    font-size: 22px; font-weight: 700;
}
.donut-center .lbl {
    font-size: 11px; color: var(--text-muted);
}
.donut-legend {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.donut-legend-item .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
}
.donut-legend-item .name { flex: 1; color: var(--text-primary); }
.donut-legend-item .pct { font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ======= Top SKU 排行 ======= */
.sku-list { display: flex; flex-direction: column; gap: 6px; }
.sku-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    transition: var(--transition);
}
.sku-item:hover { background: rgba(59, 130, 246, 0.06); }
.sku-rank {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 26px;
}
.sku-rank.top1 { background: var(--amber); color: #000; }
.sku-rank.top2 { background: #9CA3AF; color: #000; }
.sku-rank.top3 { background: #B45309; color: #fff; }
.sku-rank.normal { background: var(--bg-secondary); color: var(--text-muted); }
.sku-info { flex: 1; min-width: 0; }
.sku-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sku-code {
    font-size: 11px;
    color: var(--text-muted);
}
.sku-qty {
    font-size: 16px;
    font-weight: 700;
    color: var(--cyan);
    font-variant-numeric: tabular-nums;
}
.sku-bar-track {
    width: 60px;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    flex: 0 0 60px;
}
.sku-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======= 库存健康卡片 ======= */
.health-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.health-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
}
.health-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex: 0 0 40px;
}
.health-icon.good { background: rgba(34, 197, 94, 0.1); }
.health-icon.warn { background: rgba(245, 158, 11, 0.1); }
.health-icon.danger { background: rgba(239, 68, 68, 0.1); }
.health-info { flex: 1; }
.health-label {
    font-size: 12px;
    color: var(--text-muted);
}
.health-num {
    font-size: 22px;
    font-weight: 700;
}
.health-num.good { color: var(--green); }
.health-num.warn { color: var(--amber); }
.health-num.danger { color: var(--red); }
.health-link {
    font-size: 12px;
    color: var(--blue);
}
.health-link:hover { color: var(--cyan); }

/* ======= 折线趋势图（纯CSS） ======= */
.trend-chart {
    position: relative;
    height: 180px;
    padding: 10px 0;
    margin: 0 10px;
}
.trend-line {
    position: absolute;
    bottom: 30px;
    left: 20px;
    right: 20px;
    top: 10px;
}
.trend-point {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--cyan);
    border: 2px solid var(--bg-card);
    transform: translate(-50%, 50%);
    z-index: 2;
    cursor: pointer;
    transition: var(--transition);
}
.trend-point:hover {
    width: 14px; height: 14px;
    box-shadow: 0 0 16px var(--cyan-glow);
    z-index: 3;
}
.trend-point .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    margin-bottom: 6px;
}
.trend-point:hover .tooltip { opacity: 1; }
.trend-axis {
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

/* ======= 响应式 ======= */
@media (max-width: 1100px) {
    .charts-grid { grid-template-columns: 1fr; }
    .kpi-row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}
@media (max-width: 900px) {
    .page { padding: 0; }
    .shell { display: block; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        width: 78vw; max-width: 320px;
        z-index: 50;
    }
    #navToggle:checked ~ .shell .sidebar { transform: translateX(0); }
    .overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 40;
    }
    #navToggle:checked ~ .overlay { display: block; }
    .main { padding: 16px; }
    .mobileTop { display: flex; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .time-tabs { align-self: flex-start; }
    .filter-bar .filter-group { flex-direction: column; align-items: stretch; }
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    table { display: block; overflow-x: auto; }
    th, td { white-space: nowrap; }
    input, select, button { width: 100%; box-sizing: border-box; max-width: none; }
    .health-grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
    .kpi-row { grid-template-columns: 1fr; }
    .donut-section { flex-direction: column; align-items: center; }
}

/* ======= 保留登录页样式 ======= */
.loginPage { background: var(--bg-primary) !important; }
.loginPage .loginCard { background: var(--bg-card) !important; border-color: var(--border-color) !important; }
.loginPage .loginCard input { background: var(--bg-secondary) !important; border-color: var(--border-color) !important; color: var(--text-primary) !important; }
.loginPage .loginCard input:focus { border-color: var(--blue) !important; }

/* ======= 页面分隔区域 ======= */
.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title .count {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue);
}
