/* ══════════════════════════════════════════════════════════
   记账助手 · 主题样式
   ══════════════════════════════════════════════════════════ */

:root {
    --brand: #4f6ef7;
    --brand-2: #6a5cff;
    --brand-grad: linear-gradient(135deg, #4f6ef7 0%, #6a5cff 100%);
    --bg: #eef1f8;
    --card-radius: 0.9rem;
    --shadow-sm: 0 1px 3px rgba(30, 41, 90, 0.06), 0 1px 2px rgba(30, 41, 90, 0.04);
    --shadow-md: 0 6px 20px rgba(30, 41, 90, 0.09);
    --success: #16a34a;
    --danger: #ef4444;
}

/* ─────────── 全局 ─────────── */

body {
    background:
        radial-gradient(1200px 400px at 100% -50px, rgba(106, 92, 255, 0.10), transparent),
        radial-gradient(1000px 400px at -50px 0, rgba(79, 110, 247, 0.10), transparent),
        var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #1f2937;
}

main.container { flex: 1; }

a { color: var(--brand); }
a:hover { color: var(--brand-2); }

/* ─────────── 导航栏 ─────────── */

.navbar.bg-primary {
    background: var(--brand-grad) !important;
    box-shadow: 0 4px 18px rgba(79, 110, 247, 0.35);
}

.navbar-brand { letter-spacing: .5px; }
.navbar-brand i { opacity: .9; }

.navbar .nav-link {
    border-radius: .5rem;
    padding: .4rem .8rem !important;
    margin: 0 .1rem;
    color: rgba(255, 255, 255, 0.85) !important;
    transition: background .15s ease, color .15s ease;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus { background: rgba(255, 255, 255, 0.14); color: #fff !important; }

.dropdown-menu {
    border: none;
    border-radius: .7rem;
    box-shadow: var(--shadow-md);
    padding: .35rem;
}
.dropdown-item { border-radius: .45rem; padding: .5rem .75rem; }
.dropdown-item:hover { background: #f1f3fb; }

/* ─────────── 卡片 ─────────── */

.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    background-color: #fbfcff;
    border-bottom: 1px solid rgba(30, 41, 90, 0.06);
    font-weight: 600;
    color: #33415c;
}
.card-header i { color: var(--brand); margin-right: .15rem; }

/* 首页汇总卡片 */
.card.border-success, .card.border-danger, .card.border-primary {
    border: none !important;
    transition: transform .18s ease, box-shadow .18s ease;
}
.card.border-success:hover, .card.border-danger:hover, .card.border-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.card.border-success { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.card.border-danger  { background: linear-gradient(135deg, #fef2f2, #fee2e2); }
.card.border-primary { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }

/* ─────────── 表格 ─────────── */

.table { margin-bottom: 0; }
.table th { font-weight: 600; white-space: nowrap; color: #475569; }
.table td { vertical-align: middle; }
.table thead th { font-size: .85rem; text-transform: none; }
.table-hover tbody tr:hover { background-color: #f6f8fe; }

/* ─────────── 按钮 / 徽章 ─────────── */

.btn { border-radius: .55rem; font-weight: 500; }
.btn-primary { background: var(--brand-grad); border: none; box-shadow: 0 3px 10px rgba(79,110,247,.3); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-group .btn { border-radius: .45rem; }
.badge { font-weight: 600; }

/* ─────────── 表单 ─────────── */

.form-control:focus, .form-select:focus {
    border-color: #b7c3ff;
    box-shadow: 0 0 0 .2rem rgba(79, 110, 247, 0.15);
}
.alert { border: none; border-radius: .7rem; box-shadow: var(--shadow-sm); }

/* ─────────── 认证页 ─────────── */

.card.shadow-sm {
    border-radius: 1rem;
    box-shadow: var(--shadow-md) !important;
    border: none;
}

/* ─────────── 页脚 ─────────── */

footer.text-center.text-muted { color: #94a3b8 !important; }

/* ════════════════ 管理后台 ════════════════ */

.admin-title { color: #1e293b; font-weight: 700; }
.admin-title i { color: var(--brand); }

.admin-badge {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
    padding: .45rem .8rem;
    border-radius: 2rem;
    font-size: .85rem;
}

.admin-tabs { border-bottom: 2px solid #e6e9f5; }
.admin-tabs .nav-link {
    border: none;
    color: #64748b;
    font-weight: 600;
    padding: .6rem 1.1rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    background: transparent !important;
}
.admin-tabs .nav-link:hover { color: var(--brand); }
.admin-tabs .nav-link.active {
    color: var(--brand);
    background: transparent !important;
    border-bottom-color: var(--brand);
}

/* 统计卡 */
.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease;
    border-left: 4px solid var(--brand);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: .8rem;
    display: grid; place-items: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: #1e293b; }
.stat-label { font-size: .82rem; color: #94a3b8; }

.stat-users   { border-left-color: #4f6ef7; }
.stat-users   .stat-icon { background: #eef2ff; color: #4f6ef7; }
.stat-records { border-left-color: #0ea5e9; }
.stat-records .stat-icon { background: #e0f2fe; color: #0ea5e9; }
.stat-income  { border-left-color: #16a34a; }
.stat-income  .stat-icon { background: #dcfce7; color: #16a34a; }
.stat-expense { border-left-color: #ef4444; }
.stat-expense .stat-icon { background: #fee2e2; color: #ef4444; }

/* 分类占比行 */
.cat-row { margin-bottom: .8rem; }
.cat-row:last-child { margin-bottom: 0; }
.progress { background: #eef1f8; border-radius: 1rem; }

/* 排行榜 */
.rank-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .7rem;
    border-radius: .7rem;
    background: #f8fafc;
    height: 100%;
}
.rank-no {
    width: 28px; height: 28px; flex-shrink: 0;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700; font-size: .85rem;
    background: #e2e8f0; color: #475569;
}
.rank-item:nth-child(1) .rank-no { background: #fde68a; color: #92400e; }
.rank-name { font-weight: 600; font-size: .9rem; }
.rank-cnt { font-size: .78rem; color: #94a3b8; }

/* ─────────── 错误页 ─────────── */

.error-icon { font-size: 4rem; color: #cbd5e1; }

/* ─────────── 响应式微调 ─────────── */

@media (max-width: 576px) {
    .card-body h2 { font-size: 1.5rem; }
    .stat-value { font-size: 1.2rem; }
    .admin-tabs .nav-link { padding: .5rem .7rem; font-size: .9rem; }
}
