/* ============================================================
   电商销量日报系统 · 设计系统 v2
   现代 SaaS 风格 · 精致 / 一致 / 有呼吸感
   ============================================================ */

/* 字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
    /* 主色 — 靛蓝紫，沉稳又现代 */
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-400: #818cf8;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;

    /* 语义色 */
    --success: #10b981;
    --success-50: #ecfdf5;
    --warning: #f59e0b;
    --warning-50: #fffbeb;
    --danger: #ef4444;
    --danger-50: #fef2f2;
    --info: #3b82f6;
    --info-50: #eff6ff;
    --purple: #8b5cf6;
    --purple-50: #f5f3ff;

    /* 中性色 */
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* 侧边栏 — 深色靛蓝渐变 */
    --sidebar-bg-1: #1e1b4b;
    --sidebar-bg-2: #312e81;
    --sidebar-text: #c7d2fe;
    --sidebar-text-dim: #818cf8;
    --sidebar-active: #818cf8;

    /* 尺寸 */
    --header-height: 64px;
    --sidebar-width: 248px;

    /* 阴影 — 柔和分层 */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
    --shadow-primary: 0 8px 20px rgba(79, 70, 229, 0.28);

    /* 圆角 */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-600: #6366f1;
    --primary-400: #a5b4fc;
    --primary-50: #312e81;
    --primary-100: #3730a3;
    --success: #34d399;
    --success-50: #064e3b;
    --warning: #fbbf24;
    --warning-50: #451a03;
    --danger: #f87171;
    --danger-50: #450a0a;
    --info: #60a5fa;
    --info-50: #0c2d4d;
    --purple: #a78bfa;
    --purple-50: #2e1065;

    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --bg: #0b1120;
    --card-bg: #131b2c;
    --border: #1e293b;
    --border-strong: #334155;

    --sidebar-bg-1: #0c0a26;
    --sidebar-bg-2: #181554;
    --sidebar-text: #c7d2fe;
    --sidebar-text-dim: #818cf8;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 100%);
    z-index: 1000; display: flex; flex-direction: column;
    transition: transform var(--transition); box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
}

.sidebar-header {
    padding: 22px 22px 18px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(135deg, #818cf8, #4f46e5);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}
.brand-logo svg { width: 22px; height: 22px; color: #fff; }

.sidebar-header .brand-text { display: flex; flex-direction: column; }
.sidebar-header h2 { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.02em; }
.sidebar-header small { color: var(--sidebar-text-dim); font-size: 11px; font-weight: 500; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; scrollbar-width: thin; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }

.nav-group { margin-bottom: 14px; }
.nav-group-title {
    padding: 4px 14px 8px; font-size: 10.5px; color: var(--sidebar-text-dim);
    text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin-bottom: 2px; border-radius: 10px;
    color: var(--sidebar-text); text-decoration: none;
    font-size: 13.5px; font-weight: 500; transition: all var(--transition);
    cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(2px); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(129, 140, 248, 0.22), rgba(129, 140, 248, 0.06));
    color: #fff; font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: var(--sidebar-active); }
.nav-item.active::before {
    content: ''; position: absolute; left: 0; width: 3px; height: 22px;
    background: var(--sidebar-active); border-radius: 0 3px 3px 0; margin-left: -12px;
}
.nav-item { position: relative; }

.sidebar-footer {
    padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}
.sidebar-footer .user-info { display: flex; align-items: center; gap: 11px; }
.sidebar-footer .avatar {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}
.sidebar-footer .user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-footer .user-role { color: var(--sidebar-text-dim); font-size: 11px; }

/* ============================================================
   主内容区
   ============================================================ */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left var(--transition); }

.top-bar {
    position: sticky; top: 0; z-index: 100; height: var(--header-height);
    background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
}
[data-theme="dark"] .top-bar { background: rgba(19, 27, 44, 0.8); }

.top-bar-left { display: flex; align-items: center; gap: 14px; }
.top-bar-left h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }

.top-bar-right { display: flex; align-items: center; gap: 6px; }
.top-bar-right .icon-btn {
    width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
    background: var(--card-bg); cursor: pointer; font-size: 17px;
    color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
    position: relative; transition: all var(--transition);
}
.top-bar-right .icon-btn:hover { color: var(--primary); border-color: var(--primary-400); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.top-bar-right .badge-dot {
    position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
    background: var(--danger); border-radius: 50%; border: 2px solid var(--card-bg);
}
.top-bar-right .btn { margin-left: 6px; }

.content-area { padding: 28px; max-width: 1480px; }

/* ============================================================
   页面标题区
   ============================================================ */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.page-head p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

.page-icon {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-50); color: var(--primary);
}
.page-icon svg { width: 18px; height: 18px; }
[data-theme="dark"] .page-icon { background: var(--primary-50); color: var(--primary-400); }

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--card-bg); border-radius: var(--radius-lg);
    border: 1px solid var(--border); padding: 22px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.card-header h4 { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.card-header h4 .ico { color: var(--primary); display: inline-flex; }
.card-header h4 .ico svg { width: 18px; height: 18px; }

/* ============================================================
   统计卡片 (KPI)
   ============================================================ */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px; margin-bottom: 26px;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border);
    padding: 22px; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow-sm); transition: all var(--transition); position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px;
    border-radius: 50%; opacity: 0.06; background: var(--accent, var(--primary));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    background: var(--accent-bg, var(--primary-50)); color: var(--accent, var(--primary));
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.02);
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.blue { --accent: var(--info); --accent-bg: var(--info-50); }
.stat-icon.green { --accent: var(--success); --accent-bg: var(--success-50); }
.stat-icon.orange { --accent: var(--warning); --accent-bg: var(--warning-50); }
.stat-icon.red { --accent: var(--danger); --accent-bg: var(--danger-50); }
.stat-icon.purple { --accent: var(--purple); --accent-bg: var(--purple-50); }

.stat-meta { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 27px; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* ============================================================
   表格
   ============================================================ */
.table-container { overflow-x: auto; border-radius: var(--radius); }
.tag {
    display: inline-block; padding: 2px 9px; margin: 2px 4px 2px 0;
    font-size: 12px; font-weight: 600; line-height: 1.6;
    background: var(--primary-50, #eef2ff); color: var(--primary, #6366f1);
    border-radius: 999px; white-space: nowrap;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; font-size: 13.5px; }
th {
    font-weight: 600; font-size: 12px; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg);
    border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
[data-theme="dark"] th { background: #0e1626; }
td { border-bottom: 1px solid var(--border); color: var(--text); }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-50); }
[data-theme="dark"] tbody tr:hover { background: rgba(129, 140, 248, 0.08); }
tbody tr:last-child td { border-bottom: none; }
td strong { font-weight: 600; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    padding: 9px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text); transition: all var(--transition); text-decoration: none; white-space: nowrap;
    letter-spacing: -0.01em;
}
.btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--primary-600); color: #fff; border-color: var(--primary-600); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: transparent; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { padding: 4px 10px; font-size: 11.5px; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.btn-icon svg { width: 15px; height: 15px; }

/* ============================================================
   表单
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 13.5px; background: var(--card-bg);
    color: var(--text); transition: all var(--transition); font-family: inherit;
}
.form-control::placeholder { color: var(--text-tertiary); }
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus {
    border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); background: #fff;
}
[data-theme="dark"] .form-control:focus { background: #0e1626; }
select.form-control { cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px;
}
textarea.form-control { resize: vertical; min-height: 84px; line-height: 1.6; }

/* ============================================================
   模态框
   ============================================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.modal {
    background: var(--card-bg); border-radius: var(--radius-xl); width: 100%; max-width: 580px;
    max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
    animation: slideUp 0.26s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid var(--border);
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h4 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
    width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
    background: var(--bg); color: var(--text-secondary); font-size: 18px;
    display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-50); color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ============================================================
   状态标签
   ============================================================ */
.status-tag {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
    border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.status-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending { background: var(--warning-50); color: #b45309; }
.status-approved, .status-completed, .status-arrived, .status-stocked { background: var(--success-50); color: #047857; }
.status-rejected, .status-cancelled { background: var(--danger-50); color: #b91c1c; }
.status-purchasing, .status-producing { background: var(--info-50); color: #1d4ed8; }
.status-active { background: var(--success-50); color: #047857; }
.status-inactive { background: var(--bg); color: var(--text-secondary); }
.status-normal { background: var(--bg); color: var(--text-secondary); }
.status-urgent { background: var(--danger-50); color: #b91c1c; }
.status-external { background: var(--info-50); color: #1d4ed8; }
.status-internal { background: var(--purple-50); color: #6d28d9; }

/* ============================================================
   空 / 加载
   ============================================================ */
.loading { text-align: center; padding: 56px 20px; color: var(--text-secondary); }
.loading .spinner {
    width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; margin: 0 auto 14px; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state .icon { font-size: 44px; margin-bottom: 12px; opacity: 0.8; }
.empty-state p { font-size: 14px; }

/* ============================================================
   进度条
   ============================================================ */
.progress-bar { height: 8px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--success), #34d399); border-radius: 5px; transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

/* ============================================================
   网格
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ============================================================
   通知 / 日志
   ============================================================ */
.notification-item {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition); position: relative;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--primary-50); }
[data-theme="dark"] .notification-item:hover { background: rgba(129, 140, 248, 0.08); }
.notification-item.unread { background: var(--primary-50); }
.notification-item.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.notification-item .title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.notification-item .time { font-size: 11.5px; color: var(--text-tertiary); }

.log-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; display: flex; gap: 14px; align-items: baseline; }
.log-item:last-child { border-bottom: none; }
.log-item .time { color: var(--text-tertiary); white-space: nowrap; min-width: 150px; font-variant-numeric: tabular-nums; }
.log-item .actor { font-weight: 600; min-width: 64px; color: var(--primary); }

/* ============================================================
   图标按钮 / 抽屉
   ============================================================ */
.menu-toggle {
    display: none; background: var(--card-bg); border: 1px solid var(--border);
    width: 38px; height: 38px; border-radius: 10px; font-size: 18px;
    cursor: pointer; color: var(--text); align-items: center; justify-content: center;
    transition: all var(--transition);
}
.menu-toggle:hover { border-color: var(--primary-400); color: var(--primary); }

/* ============================================================
   图表容器
   ============================================================ */
.chart-container { position: relative; height: 300px; width: 100%; }

/* ============================================================
   Flash 消息
   ============================================================ */
.flash-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.flash-message {
    padding: 12px 18px; border-radius: 11px; font-size: 13.5px; font-weight: 500;
    box-shadow: var(--shadow-md); animation: slideUp 0.3s ease; max-width: 340px;
}
.flash-danger { background: var(--danger-50); color: #b91c1c; border: 1px solid #fecaca; }
.flash-success { background: var(--success-50); color: #047857; border: 1px solid #a7f3d0; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .content-area { padding: 16px; }
    .top-bar { padding: 0 16px; }
    .menu-toggle { display: inline-flex; }
    .modal { width: 100%; }
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
    min-height: 100vh; display: flex;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%);
    position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%;
    background: radial-gradient(circle, rgba(129,140,248,0.35), transparent 70%);
    top: -200px; right: -100px; filter: blur(20px);
}
.login-page::after {
    content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.25), transparent 70%);
    bottom: -150px; left: -100px; filter: blur(10px);
}
.login-brand { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 8vw; color: #fff; position: relative; z-index: 1; }
.login-brand .logo {
    width: 56px; height: 56px; border-radius: 16px; margin-bottom: 28px;
    background: linear-gradient(135deg, #818cf8, #4f46e5);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(79,70,229,0.5);
}
.login-brand .logo svg { width: 30px; height: 30px; color: #fff; }
.login-brand h1 { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 16px; }
.login-brand p { font-size: 16px; color: #c7d2fe; max-width: 420px; line-height: 1.7; }

/* ============================================================
   仪表盘增强（角色化：总览 / 我的平台）
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.page-sub { color: var(--text-secondary); font-size: 13.5px; margin-top: 5px; }
.perspective-pill {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; background: var(--primary-50); color: var(--primary-600);
    border: 1px solid var(--primary-100); white-space: nowrap;
}
[data-theme="dark"] .perspective-pill { background: var(--primary-50); color: var(--primary-400); border-color: transparent; }

/* 角色身份横幅（首屏一眼区分老板/运营视角） */
.role-banner {
  display: flex; align-items: center; gap: 16px;
  margin: 4px 0 22px; padding: 16px 22px; border-radius: 16px;
  background: linear-gradient(120deg, var(--primary), #7c73f0);
  color: #fff; box-shadow: 0 10px 30px rgba(79,70,229,.22);
}
.role-banner.op { background: linear-gradient(120deg, #0ea5e9, #38bdf8); box-shadow: 0 10px 30px rgba(14,165,233,.22); }
.role-banner .rb-icon {
  font-size: 26px; width: 52px; height: 52px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.18); border-radius: 14px;
}
.role-banner .rb-text { flex: 1; min-width: 0; }
.role-banner .rb-title { font-size: 18.5px; font-weight: 800; letter-spacing: -.01em; }
.role-banner .rb-sub { font-size: 13px; opacity: .92; margin-top: 3px; }
[data-theme="dark"] .role-banner { box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.delta { font-size: 11px; font-weight: 700; margin-left: 7px; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.delta.up { color: var(--success); background: var(--success-50); }
.delta.down { color: var(--danger); background: var(--danger-50); }
.delta.flat { color: var(--text-tertiary); background: var(--bg); }
.rank-list { display: flex; flex-direction: column; gap: 14px; padding: 8px 4px; }
.rank-row { display: grid; grid-template-columns: 116px 1fr auto; align-items: center; gap: 12px; }
.rank-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-track { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary-400), var(--primary)); transition: width .6s cubic-bezier(.4,0,.2,1); }
.rank-val { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-empty { color: var(--text-tertiary); text-align: center; padding: 36px 0; font-size: 13px; }
.login-features { margin-top: 36px; display: flex; flex-direction: column; gap: 16px; }
.login-features .feat { display: flex; align-items: center; gap: 12px; color: #e0e7ff; font-size: 14.5px; }
.login-features .feat .dot {
    width: 32px; height: 32px; border-radius: 9px; background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.login-features .feat .dot svg { width: 17px; height: 17px; color: #a5b4fc; }

.login-right { width: 480px; display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; z-index: 1; }
.login-box {
    background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
    border-radius: 22px; padding: 44px 40px; width: 100%; max-width: 400px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.4);
}
.login-box h2 { font-size: 24px; font-weight: 800; color: #0f172a; letter-spacing: -0.02em; margin-bottom: 6px; }
.login-box .subtitle { color: #64748b; font-size: 14px; margin-bottom: 30px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box label { font-size: 13.5px; font-weight: 600; margin-bottom: 7px; display: block; color: #0f172a; }
.login-box input {
    width: 100%; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 11px;
    font-size: 14.5px; transition: all 0.2s; font-family: inherit; background: #fff;
}
.login-box input:focus { border-color: #4f46e5; outline: none; box-shadow: 0 0 0 4px rgba(79,70,229,0.12); }
.login-box .btn { width: 100%; padding: 13px; font-size: 15px; margin-top: 8px; }
.login-box .flash-msg { padding: 11px 15px; border-radius: 11px; margin-bottom: 18px; font-size: 13.5px; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.demo-info {
    margin-top: 26px; padding-top: 22px; border-top: 1px dashed #e2e8f0;
    text-align: center; font-size: 12.5px; color: #94a3b8; line-height: 1.7;
}
.demo-info code { background: #f1f5f9; padding: 2px 7px; border-radius: 6px; color: #4f46e5; font-weight: 600; }

@media (max-width: 880px) {
    .login-brand { display: none; }
    .login-right { width: 100%; padding: 20px; }
    .login-page { background: linear-gradient(135deg, #1e1b4b, #4338ca); }
}

/* ===== 仪表盘：分析区块 ===== */
.analysis-head { display: flex; align-items: baseline; gap: 12px; margin: 26px 2px 14px; }
.analysis-head h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.analysis-head .page-sub { font-size: 13px; color: var(--text-secondary); }
.new-badge { display: inline-flex; align-items: center; justify-content: center; align-self: center; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 8px; border-radius: 999px; background: var(--primary, #4f46e5); color: #fff; letter-spacing: 0.02em; box-shadow: 0 2px 8px rgba(79,70,229,.35); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1080px) { .grid-3 { grid-template-columns: 1fr; } }

.muted { color: var(--text-secondary); font-weight: 400; font-size: 12px; }

.insight-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.insight-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 13px; border-radius: 11px; background: var(--bg-soft, #f8fafc);
    border-left: 3px solid var(--text-secondary); font-size: 13.5px; line-height: 1.5; color: var(--text-primary);
}
.insight-item .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--text-secondary); }
.tone-good { border-left-color: var(--success, #10b981); }
.tone-good .dot { background: var(--success, #10b981); }
.tone-bad  { border-left-color: var(--danger, #ef4444); }
.tone-bad .dot { background: var(--danger, #ef4444); }
.tone-warn { border-left-color: var(--warning, #f59e0b); }
.tone-warn .dot { background: var(--warning, #f59e0b); }
.tone-info { border-left-color: var(--primary, #4f46e5); }
.tone-info .dot { background: var(--primary, #4f46e5); }
.insight-empty { padding: 28px 0; text-align: center; color: var(--success, #10b981); font-size: 13.5px; }

#restockTable td .tag-in { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(79,70,229,.1); color: var(--primary, #4f46e5); }
#restockTable td .tag-none { font-size: 11px; color: var(--text-secondary); }
