:root {
    --primary: #4f6bff;
    --primary-2: #13d3c4;
    --primary-soft: rgba(79, 107, 255, .12);
    --danger: #ff5a7a;
    --warn: #ff9a3c;
    --ok: #00b894;
    --text: #1c2340;
    --text-2: #667099;
    --text-3: #9aa3c0;
    --bg: #f3f5fb;
    --card: rgba(255, 255, 255, .82);
    --border: rgba(120, 135, 190, .16);
    --radius: 18px;
    --shadow: 0 18px 40px -22px rgba(35, 48, 110, .45);
    --shadow-sm: 0 8px 22px -16px rgba(35, 48, 110, .5);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 620px at 8% -10%, rgba(79, 107, 255, .18), transparent 60%),
        radial-gradient(900px 520px at 96% 4%, rgba(19, 211, 196, .16), transparent 62%),
        radial-gradient(900px 700px at 60% 110%, rgba(255, 154, 60, .12), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(120, 135, 190, .3); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录 ---------- */
.login-wrap {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 90;
    background: linear-gradient(135deg, #eef2ff 0%, #f7f9ff 45%, #e6fbf7 100%);
}
.login-wrap::before,
.login-wrap::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(10px);
    animation: float 9s ease-in-out infinite;
}
.login-wrap::before {
    width: 460px; height: 460px; left: -120px; top: -120px;
    background: radial-gradient(circle at 30% 30%, rgba(79,107,255,.4), transparent 68%);
}
.login-wrap::after {
    width: 520px; height: 520px; right: -160px; bottom: -160px;
    background: radial-gradient(circle at 60% 60%, rgba(19,211,196,.38), transparent 68%);
    animation-delay: -4s;
}
@keyframes float {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(18px, -24px, 0) scale(1.06); }
}
.login-card {
    position: relative;
    width: 380px;
    padding: 38px 34px 30px;
    border-radius: 26px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: 0 30px 70px -30px rgba(35, 48, 110, .5);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    animation: pop .55s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes pop {
    from { opacity: 0; transform: translateY(22px) scale(.96); }
    to { opacity: 1; transform: none; }
}
.login-logo {
    width: 58px; height: 58px; border-radius: 18px;
    display: grid; place-items: center;
    font-size: 26px; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 14px 28px -12px rgba(79, 107, 255, .8);
    margin-bottom: 18px;
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: .5px; }
.login-card p.sub { margin: 0 0 26px; color: var(--text-2); font-size: 13px; }

/* ---------- 布局 ---------- */
.app {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.62));
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 20;
}
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 20px;
}
.brand .mark {
    width: 40px; height: 40px; border-radius: 13px;
    display: grid; place-items: center;
    color: #fff; font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 10px 22px -12px rgba(79, 107, 255, .9);
}
.brand .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand .name small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); margin-top: 3px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 13px;
    color: var(--text-2);
    font-size: 14px;
    cursor: pointer;
    transition: background .25s, color .25s, transform .25s;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item:hover { background: rgba(79, 107, 255, .08); color: var(--primary); transform: translateX(2px); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(79,107,255,.14), rgba(19,211,196,.14));
    color: var(--primary);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(79, 107, 255, .18);
}
.sidebar .spacer { flex: 1; }
.sidebar .logout {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 13px; border-radius: 13px; color: var(--text-2);
    font-size: 13px; cursor: pointer; transition: .25s;
}
.sidebar .logout:hover { background: rgba(255, 90, 122, .1); color: var(--danger); }

.main { min-width: 0; padding: 26px 30px 44px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.topbar h2 { margin: 0; font-size: 21px; letter-spacing: .3px; }
.topbar .crumb { color: var(--text-3); font-size: 12px; margin-top: 5px; }
.topbar .who {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; border-radius: 30px;
    background: var(--card); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); font-size: 13px; color: var(--text-2);
}
.topbar .who .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(0, 184, 148, .16); }

/* ---------- 卡片 / 表格 ---------- */
.card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    padding: 20px 22px;
    animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 16px;
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .hint { font-size: 12px; color: var(--text-3); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
    position: relative;
    overflow: hidden;
    padding: 20px 20px 18px;
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,255,255,.66));
    border: 1px solid rgba(255,255,255,.9);
    box-shadow: var(--shadow);
    transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s;
    animation: rise .55s cubic-bezier(.2,.8,.2,1) both;
}
.stat:hover { transform: translateY(-4px); box-shadow: 0 26px 50px -26px rgba(35,48,110,.55); }
.stat::after {
    content: ""; position: absolute; right: -34px; top: -44px;
    width: 130px; height: 130px; border-radius: 50%;
    background: radial-gradient(circle, rgba(79,107,255,.16), transparent 68%);
}
.stat .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 27px; font-weight: 700; margin-top: 10px; letter-spacing: .4px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .foot { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.stat.tone-a { background: linear-gradient(145deg, rgba(79,107,255,.16), rgba(255,255,255,.86)); }
.stat.tone-b { background: linear-gradient(145deg, rgba(19,211,196,.18), rgba(255,255,255,.86)); }
.stat.tone-c { background: linear-gradient(145deg, rgba(255,154,60,.18), rgba(255,255,255,.86)); }
.stat.tone-d { background: linear-gradient(145deg, rgba(255,90,122,.16), rgba(255,255,255,.86)); }

.table-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-2);
    padding: 11px 12px; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
tbody td { padding: 13px 12px; border-bottom: 1px solid rgba(120,135,190,.09); vertical-align: middle; }
tbody tr { transition: background .22s; }
tbody tr:hover { background: rgba(79, 107, 255, .045); }
tbody tr:last-child td { border-bottom: 0; }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

.thumb { width: 46px; height: 46px; border-radius: 11px; object-fit: cover; background: #eef1fa; }
.thumb.lg { width: 74px; height: 74px; border-radius: 14px; }

/* ---------- 状态标签：平滑变色 ---------- */
.tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 30px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    transition: background .5s ease, color .5s ease, box-shadow .5s ease;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; transition: background .5s; }
.tag.gray { color: #6b7499; background: rgba(107,116,153,.12); }
.tag.blue { color: #4f6bff; background: rgba(79,107,255,.12); box-shadow: 0 0 0 3px rgba(79,107,255,.07); }
.tag.green { color: #00a183; background: rgba(0,184,148,.14); box-shadow: 0 0 0 3px rgba(0,184,148,.08); }
.tag.orange { color: #d97316; background: rgba(255,154,60,.16); box-shadow: 0 0 0 3px rgba(255,154,60,.08); }
.tag.red { color: #e3485f; background: rgba(255,90,122,.14); box-shadow: 0 0 0 3px rgba(255,90,122,.08); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 11px; border: 1px solid transparent;
    background: rgba(79,107,255,.09); color: var(--primary);
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: transform .2s, box-shadow .25s, background .25s, opacity .25s;
    position: relative;
}
.btn:hover { background: rgba(79,107,255,.15); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 12px 26px -14px rgba(79,107,255,.9);
}
.btn.primary:hover { box-shadow: 0 16px 30px -14px rgba(79,107,255,1); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn.ghost:hover { background: rgba(79,107,255,.07); color: var(--primary); }
.btn.danger { color: #fff; background: linear-gradient(135deg, #ff6b81, #ff4d6d); box-shadow: 0 12px 24px -14px rgba(255,90,122,.9); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
    content: ""; position: absolute; width: 15px; height: 15px;
    border-radius: 50%; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
    animation: spin .7s linear infinite;
}
.btn.ghost.loading::after { border-color: rgba(79,107,255,.35); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.input, .select, .textarea {
    width: 100%; padding: 10px 13px; border-radius: 11px;
    border: 1px solid var(--border); background: rgba(255,255,255,.86);
    font-size: 13.5px; color: var(--text); outline: none;
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: rgba(79,107,255,.55);
    box-shadow: 0 0 0 4px rgba(79,107,255,.1);
    background: #fff;
}
.textarea { min-height: 86px; resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.pager .pg {
    min-width: 32px; height: 32px; padding: 0 9px; border-radius: 9px;
    display: grid; place-items: center; cursor: pointer;
    background: rgba(255,255,255,.8); border: 1px solid var(--border);
    transition: .2s;
}
.pager .pg:hover { border-color: rgba(79,107,255,.4); color: var(--primary); }
.pager .pg.on { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; }
.pager .pg.disabled { opacity: .4; pointer-events: none; }

/* ---------- 骨架屏 ---------- */
.skeleton { border-radius: 10px; background: linear-gradient(90deg, rgba(120,135,190,.1) 25%, rgba(120,135,190,.2) 37%, rgba(120,135,190,.1) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 13px 12px; }
.sk-row .sk-a { width: 46px; height: 46px; border-radius: 11px; }
.sk-row .sk-b { height: 12px; width: 26%; }
.sk-row .sk-c { height: 12px; width: 16%; margin-left: auto; }
.sk-stat { height: 116px; }
.sk-block { height: 14px; margin: 10px 0; }

/* ---------- 空状态 ---------- */
.empty { padding: 46px 16px; text-align: center; color: var(--text-3); animation: rise .4s ease both; }
.empty .pic {
    width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 24px;
    display: grid; place-items: center; font-size: 32px;
    background: linear-gradient(145deg, rgba(79,107,255,.12), rgba(19,211,196,.14));
}
.empty p { margin: 0; font-size: 13px; }

/* ---------- 弹窗 ---------- */
.mask {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(23, 30, 58, .38);
    backdrop-filter: blur(4px);
    display: grid; place-items: center; padding: 22px;
    animation: fade .25s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: min(680px, 100%); max-height: 86vh; overflow: auto;
    background: #fff; border-radius: 20px; padding: 24px;
    box-shadow: 0 40px 90px -40px rgba(20, 28, 60, .7);
    animation: pop .35s cubic-bezier(.2,.9,.3,1.15) both;
}
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .close {
    width: 32px; height: 32px; border-radius: 10px; border: 0; cursor: pointer;
    background: rgba(120,135,190,.12); color: var(--text-2); font-size: 16px;
}
.modal-head .close:hover { background: rgba(255,90,122,.15); color: var(--danger); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- 时间轴 ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
    content: ""; position: absolute; left: 8px; top: 5px; bottom: 5px; width: 2px;
    background: linear-gradient(180deg, rgba(79,107,255,.5), rgba(19,211,196,.28), transparent);
}
.tl-item { position: relative; padding-bottom: 18px; animation: rise .4s ease both; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
    content: ""; position: absolute; left: -22px; top: 4px;
    width: 10px; height: 10px; border-radius: 50%;
    background: #fff; border: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(79,107,255,.12);
}
.tl-item.done::before { background: var(--primary); }
.tl-item .tl-title { font-size: 13.5px; font-weight: 600; }
.tl-item .tl-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.6; }
.tl-item .tl-time { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* ---------- 详情 KV ---------- */
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 11px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }
.detail-imgs { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.detail-imgs img { width: 82px; height: 82px; border-radius: 12px; object-fit: cover; background: #eef1fa; cursor: zoom-in; }

/* ---------- 图表 ---------- */
.chart-box { position: relative; height: 240px; }
.chart-box svg { width: 100%; height: 100%; overflow: visible; }
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    min-width: 200px; max-width: 360px; padding: 12px 16px; border-radius: 13px;
    background: rgba(28, 35, 64, .92); color: #fff; font-size: 13px;
    box-shadow: 0 18px 40px -20px rgba(20,28,60,.9);
    backdrop-filter: blur(10px);
    animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2) both;
}
.toast.ok { background: linear-gradient(135deg, rgba(0,160,131,.95), rgba(0,184,148,.95)); }
.toast.err { background: linear-gradient(135deg, rgba(226,70,95,.95), rgba(255,90,122,.95)); }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(26px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(26px) scale(.96); } }

/* ---------- 配置分组 ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.tab {
    padding: 8px 15px; border-radius: 30px; font-size: 13px; color: var(--text-2);
    background: rgba(255,255,255,.7); border: 1px solid var(--border);
    cursor: pointer; transition: .25s;
}
.tab:hover { color: var(--primary); border-color: rgba(79,107,255,.35); }
.tab.on { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; box-shadow: 0 10px 22px -14px rgba(79,107,255,.9); }
.check-list { display: grid; gap: 9px; }
.check-item {
    display: flex; align-items: center; gap: 11px; padding: 11px 14px;
    border-radius: 12px; background: rgba(255,255,255,.7); border: 1px solid var(--border);
    font-size: 13px;
}
.check-item .pill { margin-left: auto; font-size: 11.5px; padding: 3px 10px; border-radius: 20px; }
.check-item .pill.ok { color: #00a183; background: rgba(0,184,148,.14); }
.check-item .pill.no { color: #d97316; background: rgba(255,154,60,.16); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .track {
    width: 44px; height: 25px; border-radius: 30px; background: rgba(120,135,190,.3);
    position: relative; transition: background .3s;
}
.switch .track::after {
    content: ""; position: absolute; left: 3px; top: 3px; width: 19px; height: 19px;
    border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(20,28,60,.3);
    transition: transform .3s cubic-bezier(.2,.9,.3,1.2);
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.switch input:checked + .track::after { transform: translateX(19px); }

.page { display: none; }
.page.on { display: block; animation: rise .35s ease both; }

@media (max-width: 1100px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; width: 232px;
        transform: translateX(-100%); transition: transform .3s; z-index: 50;
    }
    .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(20,28,60,.3); }
    .main { padding: 18px 16px 40px; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-row { grid-template-columns: 1fr; }
    .mobile-bar { display: flex !important; }
}
.mobile-bar {
    display: none; align-items: center; gap: 12px; margin-bottom: 16px;
}
.mobile-bar .burger {
    width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
    background: rgba(255,255,255,.8); cursor: pointer; font-size: 16px;
}
