/* ═══════════════════════════════════════════════════════════
   拾光管理台 Web — 设计系统 v2（主流后台风格）
   参考：Ant Design Pro / Arco Design 的信息架构与视觉语言
   品牌主色与小程序端 DESIGN.md 保持一致（#00A86B）
   ═══════════════════════════════════════════════════════════ */

:root {
    /* 品牌色 */
    --brand-50: #E6F7F0;
    --brand-100: #CCEFDF;
    --brand-500: #00A86B;
    --brand-600: #00925D;
    --brand-700: #007A4D;

    /* 中性色 */
    --ink-900: #0F172A;
    --ink-800: #1E293B;
    --ink-700: #334155;
    --ink-600: #475569;
    --ink-400: #94A3B8;
    --ink-300: #CBD5E1;
    --ink-200: #E2E8F0;
    --ink-100: #F1F5F9;
    --ink-50:  #F8FAFC;

    /* 功能色 */
    --success: #16A34A;  --success-bg: #ECFDF3;
    --warning: #EA9010;  --warning-bg: #FFF6E6;
    --error:   #DC2626;  --error-bg:   #FEF1F1;
    --info:    #2563EB;  --info-bg:    #EFF4FF;

    /* 布局 */
    --sidebar-w: 232px;
    --topbar-h: 60px;
    --radius-lg: 14px;
    --radius: 10px;
    --radius-sm: 8px;

    /* 阴影 */
    --shadow-card: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
    --shadow-hover: 0 4px 12px rgba(15,23,42,.08);
    --shadow-pop: 0 12px 32px rgba(15,23,42,.14);

    --font-num: "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
    background: var(--ink-50);
    color: var(--ink-800);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--brand-100); }

/* 细滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════ 侧边栏（深色） ═══════════ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #10231C 0%, #0C1A15 100%);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}

.brand {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px;
    color: #fff;
    font-size: 16px; font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
    width: 30px; height: 30px; flex: none;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-500), #00C57E);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,168,107,.45);
}
.brand-logo svg { width: 17px; height: 17px; }
.brand small {
    display: block; font-size: 11px; font-weight: 400;
    color: rgba(255,255,255,.45); line-height: 1.2; margin-top: 1px;
}

.sidebar nav {
    flex: 1;
    padding: 14px 12px;
    display: flex; flex-direction: column; gap: 3px;
    overflow-y: auto;
}
.nav-group {
    font-size: 11px;
    color: rgba(255,255,255,.35);
    letter-spacing: .08em;
    padding: 14px 12px 5px;
    text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.62);
    text-decoration: none;
    font-size: 14px;
    position: relative;
    transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(0,168,107,.22), rgba(0,168,107,.10));
    color: #fff; font-weight: 600;
}
.nav-item.active::before {
    content: "";
    position: absolute; left: -12px; top: 22%; bottom: 22%;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--brand-500);
}
.nav-item.active svg { opacity: 1; color: var(--brand-500); }
.nav-lock { margin-left: auto; }
.nav-lock svg { width: 12px; height: 12px; opacity: .45; }

.sidebar-footer {
    padding: 14px 20px;
    font-size: 12px;
    color: rgba(255,255,255,.30);
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ═══════════ 主区 ═══════════ */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.main.fullpage { margin-left: 0; }

.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--ink-200);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--ink-900); }
.topbar-crumb { font-size: 12px; color: var(--ink-400); }
.topbar-crumb b { color: var(--ink-700); font-weight: 600; }

.topbar-user { position: relative; }
.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    transition: background .15s, border-color .15s;
}
.user-chip:hover { background: var(--ink-100); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-500), #00C57E);
    color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex: none;
}
.avatar.super { background: linear-gradient(135deg, #9333EA, #C084FC); }
.user-meta { line-height: 1.25; text-align: left; }
.user-name { font-size: 13px; font-weight: 600; color: var(--ink-800); }
.user-badge {
    display: inline-block;
    font-size: 11px; padding: 0 7px; border-radius: 999px;
    background: var(--brand-50); color: var(--brand-700);
}
.user-badge.super { background: #F5EBFF; color: #9333EA; }
.user-chip .chev { display: flex; }
.user-chip .chev svg { width: 14px; height: 14px; color: var(--ink-400); transition: transform .2s; }
.user-chip.open .chev svg { transform: rotate(180deg); }

.user-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 12px;
    box-shadow: var(--shadow-pop);
    min-width: 168px;
    padding: 6px;
    display: none;
    z-index: 50;
}
.user-menu.open { display: block; animation: menuIn .16s ease; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.user-menu a, .user-menu button.menu-item {
    display: flex; align-items: center; gap: 9px;
    width: 100%; padding: 9px 11px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--ink-700);
    text-decoration: none;
    border: none; background: none; cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}
.user-menu a:hover, .user-menu button.menu-item:hover { background: var(--ink-100); }
.user-menu svg { width: 16px; height: 16px; color: var(--ink-400); }
.user-menu hr { border: none; border-top: 1px solid var(--ink-200); margin: 5px 8px; }
.user-menu .danger, .user-menu .danger svg { color: var(--error); }
.user-menu .danger:hover { background: var(--error-bg); }

.content { padding: 24px 28px 48px; flex: 1; width: 100%; }

/* 移动端汉堡按钮 */
.hamburger {
    display: none;
    border: none; background: none; cursor: pointer;
    padding: 8px; margin-left: -8px;
    color: var(--ink-700); border-radius: 8px;
}
.hamburger:hover { background: var(--ink-100); }
.hamburger svg { width: 20px; height: 20px; display: block; }

@media (max-width: 1100px) {
    :root { --sidebar-w: 68px; }
    .nav-label, .nav-group, .brand-text, .sidebar-footer, .nav-lock { display: none; }
    .brand { justify-content: center; padding: 0; }
    .nav-item { justify-content: center; padding: 11px; }
    .content { padding: 20px; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 240px; }
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-pop); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .hamburger { display: block; }
    .user-meta { display: none; }
    .grid-2 { grid-template-columns: 1fr !important; }
}

/* ═══════════ 卡片 ═══════════ */
.card {
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}
.card h2 {
    font-size: 15px; font-weight: 700; color: var(--ink-900);
    margin: 0 0 14px;
    display: flex; align-items: center; gap: 8px;
}
.card h2 .muted { font-weight: 400; }
.card-sub { color: var(--ink-400); font-size: 12.5px; margin-top: 6px; }

/* ═══════════ 统计卡片 ═══════════ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-card);
    transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-icon {
    width: 44px; height: 44px; border-radius: 12px; flex: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.blue   { background: var(--info-bg); color: var(--info); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: #F5EBFF; color: #9333EA; }
.stat-icon svg { width: 21px; height: 21px; }
.stat-num {
    font-size: 26px; font-weight: 700; line-height: 1.15;
    color: var(--ink-900);
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}
.stat-num small { font-size: 13px; font-weight: 600; color: var(--ink-400); margin-left: 2px; }
.stat-label { color: var(--ink-400); font-size: 12px; margin-top: 2px; }

/* ═══════════ 表格 ═══════════ */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--ink-100); white-space: nowrap; }
.tbl th {
    color: var(--ink-400); font-weight: 600; font-size: 12px;
    background: var(--ink-50);
    letter-spacing: .03em;
    border-bottom: 1px solid var(--ink-200);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--ink-50); }
.tbl td b { color: var(--ink-900); }

/* 表格内文字按钮 */
.link-btn {
    border: none; background: none; cursor: pointer;
    color: var(--brand-600); font-size: 13px; font-weight: 500;
    padding: 3px 6px; border-radius: 6px;
    font-family: inherit;
}
.link-btn:hover { background: var(--brand-50); }
.link-btn.danger { color: var(--error); }
.link-btn.danger:hover { background: var(--error-bg); }

/* ═══════════ 表单 ═══════════ */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-700); margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--ink-300); border-radius: var(--radius-sm);
    font-size: 14px; outline: none; background: #fff;
    color: var(--ink-900);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-300); }
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(0,168,107,.14); }
select.input { appearance: auto; }

/* ═══════════ 按钮 ═══════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 9px 18px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    background: var(--brand-500); color: #fff;
    font-family: inherit;
    transition: background .15s, box-shadow .15s, transform .05s;
    box-shadow: 0 1px 2px rgba(0,168,107,.3);
}
.btn:hover { background: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,168,107,.28); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
    background: #fff; color: var(--ink-700);
    border-color: var(--ink-300);
    box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.btn-secondary:hover { background: var(--ink-50); border-color: var(--ink-400); }

.btn-danger { background: var(--error); box-shadow: 0 1px 2px rgba(220,38,38,.3); }
.btn-danger:hover { background: #B91C1C; }

.btn-ghost { background: transparent; color: var(--ink-600); box-shadow: none; }
.btn-ghost:hover { background: var(--ink-100); color: var(--ink-900); }

.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ═══════════ 徽标/标签 ═══════════ */
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500;
    line-height: 1.7;
}
.tag-green  { background: var(--success-bg); color: var(--success); }
.tag-gray   { background: var(--ink-100); color: var(--ink-600); }
.tag-red    { background: var(--error-bg); color: var(--error); }
.tag-orange { background: var(--warning-bg); color: var(--warning); }
.tag-blue   { background: var(--info-bg); color: var(--info); }
.tag-purple { background: #F5EBFF; color: #9333EA; }
.tag .dot { margin: 0; width: 6px; height: 6px; }

/* ═══════════ 提示条 ═══════════ */
.alert {
    padding: 11px 14px; border-radius: var(--radius);
    font-size: 13px; margin-bottom: 14px;
    border: 1px solid transparent;
    display: flex; align-items: flex-start; gap: 8px;
    line-height: 1.55;
}
.alert-error   { background: var(--error-bg);   color: #991B1B; border-color: #FECACA; }
.alert-info    { background: var(--info-bg);    color: #1E40AF; border-color: #C7D7FE; }
.alert-ok      { background: var(--success-bg); color: #14532D; border-color: #BBE9CB; }
.alert-warning { background: var(--warning-bg); color: #854D0E; border-color: #FDE4AD; }

/* ═══════════ 对话框 <dialog> ═══════════ */
.dlg {
    border: none; border-radius: 16px;
    padding: 24px; min-width: 320px; max-width: 440px; width: 92vw;
    box-shadow: 0 24px 64px rgba(15,23,42,.22);
}
.dlg[open] { animation: dlgIn .18s cubic-bezier(.2,.9,.3,1.2); }
@keyframes dlgIn { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: none; } }
.dlg::backdrop { background: rgba(15,23,42,.5); backdrop-filter: blur(2px); }
.dlg h3 { margin: 0 0 18px; font-size: 16px; color: var(--ink-900); }
.dlg .dlg-foot, .dlg .row[style*="flex-end"] { margin-top: 4px; }

/* 自定义弹窗 */
.dialog-mask {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center;
    z-index: 100;
}
.dialog-mask.open { display: flex; }
.dialog {
    background: #fff; border-radius: 16px;
    width: min(480px, 92vw); max-height: 86vh; overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 64px rgba(15,23,42,.22);
    animation: dlgIn .18s cubic-bezier(.2,.9,.3,1.2);
}
.dialog h3 { margin: 0 0 16px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; color: var(--ink-900); }
.dialog-close { border: none; background: var(--ink-100); font-size: 14px; cursor: pointer; color: var(--ink-600); width: 26px; height: 26px; border-radius: 8px; }
.dialog-close:hover { background: var(--ink-200); }

/* ═══════════ Toast（site.js 提供） ═══════════ */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
    background: var(--ink-900); color: #fff;
    padding: 10px 18px; border-radius: 10px;
    font-size: 13.5px; box-shadow: var(--shadow-pop);
    display: flex; align-items: center; gap: 8px;
    animation: toastIn .22s cubic-bezier(.2,.9,.3,1.2);
}
.toast.ok   { background: #0E5A38; }
.toast.err  { background: #7F1D1D; }
.toast.out  { opacity: 0; transform: translateY(-8px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ═══════════ 看板图表（纯 CSS） ═══════════ */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 20px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar {
    width: 58%; max-width: 40px;
    background: linear-gradient(180deg, #00C57E, var(--brand-600));
    border-radius: 5px 5px 2px 2px; min-height: 3px;
    transition: filter .15s;
}
.bar-col:hover .bar { filter: brightness(1.1); }
.bar-val { font-size: 11px; color: var(--ink-600); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bar-label { font-size: 11px; color: var(--ink-400); margin-top: 6px; }

.peak-list { display: flex; flex-direction: column; gap: 9px; }
.peak-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.peak-label { width: 76px; color: var(--ink-600); }
.peak-track { flex: 1; height: 10px; background: var(--ink-100); border-radius: 999px; overflow: hidden; }
.peak-fill { height: 100%; background: linear-gradient(90deg, var(--brand-500), #00C57E); border-radius: 999px; transition: width .5s ease; }
.peak-count { width: 36px; text-align: right; color: var(--ink-400); font-variant-numeric: tabular-nums; }

.split-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--ink-100); }
.split-recharge { background: linear-gradient(90deg, var(--brand-500), #00C57E); }
.split-cash { background: #F59E0B; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot-green { background: var(--brand-500); }
.dot-orange { background: #F59E0B; }

.ring-track { height: 12px; background: var(--ink-100); border-radius: 999px; overflow: hidden; }
.ring-fill { height: 100%; background: linear-gradient(90deg, var(--brand-500), #00C57E); border-radius: 999px; transition: width .5s; }

.insight-item {
    padding: 11px 14px;
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: var(--radius);
    font-size: 13px; margin-bottom: 9px; line-height: 1.6;
}
.insight-item:last-child { margin-bottom: 0; }

/* ═══════════ 登录页（左右分栏） ═══════════ */
.login-wrap { min-height: 100vh; display: flex; }
.login-hero {
    flex: 1;
    background:
        radial-gradient(ellipse 80% 55% at 20% 10%, rgba(0,197,126,.28), transparent),
        radial-gradient(ellipse 70% 60% at 85% 90%, rgba(37,99,235,.20), transparent),
        linear-gradient(160deg, #0D1F18 0%, #0A1410 100%);
    color: #fff;
    display: flex; flex-direction: column; justify-content: center;
    padding: 8vh 7vw;
    position: relative; overflow: hidden;
}
.login-hero h1 { font-size: 34px; margin: 0 0 14px; letter-spacing: -.01em; }
.login-hero p.lead { font-size: 15px; color: rgba(255,255,255,.65); max-width: 420px; margin: 0 0 34px; }
.hero-points { display: flex; flex-direction: column; gap: 16px; max-width: 380px; }
.hero-point { display: flex; gap: 12px; align-items: flex-start; }
.hero-point .hp-ico {
    width: 36px; height: 36px; flex: none; border-radius: 10px;
    background: rgba(0,168,107,.18); border: 1px solid rgba(0,197,126,.35);
    display: flex; align-items: center; justify-content: center;
    color: #4ADE9C;
}
.hero-point .hp-ico svg { width: 18px; height: 18px; }
.hero-point b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.hero-point span { font-size: 12.5px; color: rgba(255,255,255,.5); }
.login-panel {
    width: min(480px, 100%);
    background: #fff;
    display: flex; flex-direction: column; justify-content: center;
    padding: 48px clamp(32px, 6vw, 72px);
    box-shadow: -8px 0 32px rgba(15,23,42,.06);
}
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; color: var(--ink-900); margin-bottom: 4px; }
.login-sub { color: var(--ink-400); font-size: 13px; margin-bottom: 30px; }
.login-form .field label { font-size: 13px; }
.login-copyright { margin-top: 42px; font-size: 12px; color: var(--ink-300); }

@media (max-width: 900px) {
    .login-wrap { flex-direction: column; }
    .login-hero { padding: 44px 28px; min-height: 220px; }
    .hero-points { display: none; }
    .login-hero h1 { font-size: 24px; }
    .login-panel { width: 100%; flex: 1; }
}

/* ═══════════ 分页 ═══════════ */
.pager { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--ink-400); }
.pager button { padding: 5px 12px; }
.pager .pg-cur { background: var(--brand-500); color: #fff; border: none; }

/* ═══════════ 工具类 ═══════════ */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--ink-400); font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.inline-form { display: inline; }

/* 空状态 */
.empty {
    text-align: center; padding: 42px 0; color: var(--ink-400); font-size: 13px;
}
.empty svg { width: 40px; height: 40px; color: var(--ink-200); margin-bottom: 8px; }
