/* =========================================================================
   聚账后台 · 设计系统
   纯 CSS 增强层：在 Bootstrap 5 之上统一品牌观感，不替换 Bootstrap 功能。
   ========================================================================= */

:root {
    --brand: #1E88E5;
    --brand-strong: #1565C0;
    --brand-soft: rgba(30, 136, 229, .10);
    --ink: #1b2540;          /* 侧边栏深底 */
    --ink-2: #232f52;
    --ink-line: rgba(255, 255, 255, .08);
    --bg: #f4f6fa;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e8ecf2;
    --radius: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
    --shadow-lg: 0 16px 40px rgba(16, 24, 40, .12);
    --expense: #ef4444;
    --income: #16a34a;
    --warning: #f59e0b;
}

* { -webkit-text-size-adjust: 100%; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { text-decoration: none; }

/* ---------- 布局骨架 ---------- */
.admin-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* 侧边栏深色背景：放在 flex 容器上，用伪元素拉到全高，
   避开 position: sticky 不参与 flex 拉伸的坑。 */
.admin-shell::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 230px;
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
    z-index: 0;
}

.admin-sidebar {
    padding: 0;
    color: #cdd6ea;
    width: 230px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1;
    background: transparent;
}
.admin-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    padding: 20px 20px;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--ink-line);
}
.admin-sidebar .brand .logo {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: var(--brand);
    border-radius: 10px;
    color: #fff;
}
.admin-sidebar .brand small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #8b97b8;
    letter-spacing: 0;
}
.admin-sidebar .nav { padding: 12px 12px; }
.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c1cbe4;
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.admin-sidebar .nav-link svg,
.admin-sidebar .nav-link i { width: 19px; height: 19px; flex: none; }
.admin-sidebar .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-sidebar .nav-link.active {
    background: var(--brand-soft);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--brand);
}
.admin-sidebar .nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6f7ba0;
    padding: 16px 14px 6px;
}

.admin-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-sm);
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}
.admin-topbar .hamburger {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    cursor: pointer;
    color: var(--text);
}
.admin-topbar .hamburger:hover { background: var(--bg); }
.admin-topbar .topbar-title { font-weight: 600; font-size: 16px; }
.admin-content { padding: 26px 26px 12px; }
.admin-content .page-title { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.admin-content .page-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 1040;
    display: none;
}
.sidebar-overlay.show { display: block; }

/* ---------- 卡片 ---------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}
.card.shadow-sm { box-shadow: var(--shadow-sm); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: 14px 18px;
}

/* ---------- 统计卡 ---------- */
.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 18px 18px;
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
    position: absolute; top: 16px; right: 16px;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-label { color: var(--muted); font-size: 13px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat-card.is-warning .stat-icon { background: rgba(245, 158, 11, .12); color: var(--warning); }
.stat-card.is-primary .stat-icon { background: var(--brand-soft); color: var(--brand); }
.stat-card.is-danger .stat-value { color: var(--expense); }
.stat-card.is-success .stat-value { color: var(--income); }

/* ---------- 表格 ---------- */
.table { margin-bottom: 0; font-size: 13.5px; }
.table thead th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: none;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    padding: 12px 16px;
}
.table tbody td { padding: 13px 16px; border-color: #f0f2f6; vertical-align: middle; }
.table tbody tr:hover { background: #fafbfe; }
.table-sm tbody td { padding: 9px 14px; }

/* ---------- 徽章 ---------- */
.badge { font-weight: 500; border-radius: 7px; padding: 4px 9px; font-size: 12px; }
.badge.bg-success { background: rgba(22, 163, 74, .12) !important; color: #15803d; }
.badge.bg-danger { background: rgba(239, 68, 68, .12) !important; color: #dc2626; }
.badge.bg-warning { background: rgba(245, 158, 11, .14) !important; color: #b45309; }
.badge.bg-info { background: rgba(30, 136, 229, .12) !important; color: #1565c0; }
.badge.bg-secondary { background: #eceff3 !important; color: #64748b; }
.badge.bg-light { background: #f1f3f7 !important; color: #475569; border: 1px solid #e3e8ef !important; }

/* ---------- 按钮 ---------- */
.btn { border-radius: 10px; font-weight: 500; padding: 8px 16px; }
.btn-sm { border-radius: 8px; padding: 5px 12px; font-size: 12.5px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-outline-secondary { color: var(--muted); border-color: #d8dee7; }
.btn-outline-secondary:hover { background: #f3f5f9; color: var(--text); }
.btn-outline-primary { color: var(--brand); border-color: #bcdcfa; }
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand-strong); }
.btn-outline-danger { color: #dc2626; border-color: #f3c2c2; }
.btn-outline-danger:hover { background: rgba(239, 68, 68, .08); }
.btn-outline-success { color: #15803d; border-color: #bfe3c8; }
.btn-outline-success:hover { background: rgba(22, 163, 74, .08); }
.btn-check:checked + .btn-outline-primary { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- 表单 ---------- */
.form-label { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-control, .form-select {
    border-radius: 10px;
    border-color: #dde2ea;
    padding: 9px 13px;
    font-size: 14px;
    box-shadow: none !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft) !important;
}
.form-text { color: #9aa3b2; font-size: 12px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---------- 提示 ---------- */
.alert { border: none; border-radius: 12px; font-size: 13.5px; }
.alert-success { background: rgba(22, 163, 74, .10); color: #15803d; }
.alert-danger { background: rgba(239, 68, 68, .10); color: #dc2626; }
.alert-light { background: #f7f9fc; border: 1px solid var(--border) !important; color: #475569; }

/* ---------- 分页 ---------- */
.pagination { gap: 4px; }
.page-link {
    border: 1px solid var(--border);
    border-radius: 9px !important;
    color: var(--text);
    font-size: 13px;
    padding: 7px 13px;
    min-width: 38px;
    text-align: center;
}
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-item.disabled .page-link { color: #b8c0cc; }

/* ---------- 工具 ---------- */
.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 48px 12px;
}
.empty-state svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 10px; }
.text-amount-expense { color: var(--expense); font-weight: 600; }
.text-amount-income { color: var(--income); font-weight: 600; }
.copy-toast {
    position: fixed; left: 50%; bottom: 40px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(33, 37, 41, .92); color: #fff; padding: 10px 16px;
    border-radius: 8px; font-size: 13px; max-width: 90vw; word-break: break-all;
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1080;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 图表容器 */
.chart-card { height: 280px; }
.chart-card canvas { max-height: 100%; }

/* ---------- 响应式：移动端侧边栏抽屉 ---------- */
@media (max-width: 991.98px) {
    .admin-shell::before { display: none; }
    .admin-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 250px;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform .25s ease;
        background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-content { padding: 18px 16px 8px; }
}
@media (min-width: 992px) {
    .sidebar-overlay { display: none !important; }
}
