/* ============================================================
   e账 全局样式
   版权所有：山东数扩网络科技有限公司
   风格：活泼轻快 / 卡片式 / 圆角轻阴影 / 响应式
   ============================================================ */

:root {
    --primary: #2BA8A0;        /* 主色：青绿 */
    --primary-dark: #1E8F88;
    --primary-light: #E3F5F4;
    --navy: #1F4E79;           /* 辅色：藏蓝（logo文字色） */
    --accent: #F5A623;         /* 强调色：暖橙金 */
    --accent-light: #FFF4E0;
    --bg: #F3F8F8;
    --card: #FFFFFF;
    --text: #2C3E50;
    --muted: #90A4AE;
    --line: #E8F0F0;
    --danger: #EF6C61;
    --radius: 16px;
    --shadow: 0 4px 16px rgba(43, 168, 160, 0.10);
}

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

html, body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    min-height: 100%;
}

a { color: var(--primary); text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }

/* ---------- 顶部导航 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 60px;
}
.topbar .logo { height: 36px; display: flex; align-items: center; }
.topbar .logo img { height: 36px; }
.topbar .book-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    border: none;
    border-radius: 20px;
    padding: 7px 14px;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    max-width: 200px;
}
.topbar .book-switch .book-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.topbar .user-box { display: flex; align-items: center; gap: 10px; position: relative; cursor: pointer; }
.topbar .avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700;
}
.topbar .user-menu {
    display: none;
    position: absolute;
    top: 48px; right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    min-width: 150px;
    overflow: hidden;
}
.topbar .user-menu.open { display: block; }
.topbar .user-menu a {
    display: block;
    padding: 11px 16px;
    color: var(--text);
    font-size: 14px;
}
.topbar .user-menu a:hover { background: var(--primary-light); }

/* ---------- 主导航 ---------- */
.main-nav {
    max-width: 1080px;
    margin: 16px auto 0;
    padding: 0 20px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}
.main-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 22px;
    color: var(--muted);
    font-size: 15px;
    white-space: nowrap;
    transition: all .2s;
}
.main-nav a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(43, 168, 160, 0.35);
}
.main-nav a:not(.active):hover { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- 页面容器 ---------- */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 20px 96px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin: 14px 0 4px;
}
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.card .card-head h3 { font-size: 16px; color: var(--navy); }

/* ---------- 统计卡片 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    right: -20px; top: -20px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    opacity: .6;
}
.stat-card .label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stat-card .value { font-size: 24px; font-weight: 700; color: var(--navy); position: relative; z-index: 1; }
.stat-card.orange .value { color: var(--accent); }
.stat-card.teal .value { color: var(--primary); }
.stat-card .unit { font-size: 13px; font-weight: 400; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 15px; }
.form-item label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}
.form-item input,
.form-item select,
.form-item textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 15px;
    color: var(--text);
    background: #FAFDFD;
    outline: none;
    transition: border .2s;
    font-family: inherit;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus { border-color: var(--primary); background: #fff; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 12px;
    padding: 11px 22px;
    font-size: 15px;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost {
    background: transparent;
    color: var(--primary-dark);
    border: 1.5px solid var(--primary);
}
.btn-ghost:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 记账快捷按钮 ---------- */
.fab {
    position: fixed;
    right: 28px; bottom: 84px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #F7C35F);
    color: #fff;
    font-size: 30px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.45);
    border: none;
    cursor: pointer;
    z-index: 90;
    transition: transform .2s;
}
.fab:hover { transform: scale(1.08); }

/* ---------- 流水列表 ---------- */
.record-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px dashed var(--line);
}
.record-item:last-child { border-bottom: none; }
.record-item .rec-icon {
    width: 42px; height: 42px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.rec-icon.expense { background: var(--accent-light); }
.rec-icon.income { background: var(--primary-light); }
.rec-icon.transfer { background: #E8F1FA; }
.record-item .rec-main { flex: 1; min-width: 0; }
.record-item .rec-title { font-size: 15px; font-weight: 600; }
.record-item .rec-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.record-item .rec-money { font-size: 17px; font-weight: 700; text-align: right; }
.record-item .rec-money.income-m { color: var(--primary-dark); }
.record-item .rec-money.expense-m { color: var(--accent); }
.record-item .rec-money.transfer-m { color: var(--navy); }
.record-item .rec-ops { display: flex; gap: 6px; margin-left: 8px; }
.record-item .rec-ops button {
    border: none;
    background: #F1F6F6;
    border-radius: 8px;
    width: 30px; height: 30px;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    transition: all .15s;
}
.record-item .rec-ops button:hover { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- 筛选条 ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-bar select,
.filter-bar input {
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

/* ---------- 账户卡片 ---------- */
.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}
.account-card {
    border-radius: var(--radius);
    padding: 18px;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 108px;
}
.account-card.bank { background: linear-gradient(135deg, #1F4E79, #3A7CA5); }
.account-card.wx { background: linear-gradient(135deg, #21A366, #4CBF8B); }
.account-card.alipay { background: linear-gradient(135deg, #1677FF, #5B9BFF); }
.account-card.cash { background: linear-gradient(135deg, #2BA8A0, #57CCC5); }
.account-card.licai { background: linear-gradient(135deg, #F5A623, #F7C35F); }
.account-card .acc-type { font-size: 22px; }
.account-card .acc-name { font-weight: 700; margin-top: 6px; font-size: 15px; }
.account-card .acc-balance { font-size: 22px; font-weight: 700; margin-top: 6px; }
.account-card .acc-balance .u { font-size: 13px; font-weight: 400; opacity: .85; }
.account-card .acc-badge {
    position: absolute;
    top: 12px; right: 12px;
    font-size: 11px;
    background: rgba(255,255,255,.25);
    padding: 3px 9px;
    border-radius: 10px;
}
.account-card .acc-ops { position: absolute; bottom: 10px; right: 12px; display: flex; gap: 6px; }
.account-card .acc-ops button {
    border: none;
    background: rgba(255,255,255,.25);
    color: #fff;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.account-card .acc-ops button:hover { background: rgba(255,255,255,.4); }
.account-card.disabled-card { opacity: .55; }

/* ---------- 标签chip ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1.5px solid var(--line);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .del-x { color: inherit; opacity: .6; font-size: 12px; padding: 2px; }
.chip .del-x:hover { opacity: 1; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(31, 78, 121, 0.35);
    backdrop-filter: blur(3px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px;
    animation: pop .25s ease;
}
@keyframes pop {
    from { transform: scale(.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal h3 { color: var(--navy); margin-bottom: 16px; font-size: 18px; text-align: center; }
.modal .modal-foot { display: flex; gap: 10px; margin-top: 20px; }
.modal .modal-foot .btn { flex: 1; }

/* 记账类型切换 */
.type-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.type-tabs button {
    flex: 1;
    border: 1.5px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 10px 0;
    font-size: 15px;
    cursor: pointer;
    color: var(--muted);
    transition: all .2s;
    font-family: inherit;
}
.type-tabs button.active-1 { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); font-weight: 700; }
.type-tabs button.active-2 { background: var(--accent-light); border-color: var(--accent); color: #D98E00; font-weight: 700; }
.type-tabs button.active-3 { background: #E8F1FA; border-color: var(--navy); color: var(--navy); font-weight: 700; }

/* ---------- 分类网格 ---------- */
.cate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.cate-cell {
    background: #FAFDFD;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}
.cate-cell:hover { border-color: var(--primary); }
.cate-cell.selected { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.cate-cell .sys-tag { font-size: 11px; color: var(--muted); }
.cate-cell.selected .sys-tag { color: rgba(255,255,255,.8); }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; }
.pager button {
    border: 1.5px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 7px 16px;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .page-info { font-size: 13px; color: var(--muted); }

/* ---------- 空状态 ---------- */
.empty-tip { text-align: center; color: var(--muted); padding: 34px 0; font-size: 14px; }
.empty-tip .empty-emoji { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- Toast ---------- */
#ez-toast {
    position: fixed;
    top: 74px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 78, 121, 0.92);
    color: #fff;
    padding: 10px 22px;
    border-radius: 22px;
    font-size: 14px;
    z-index: 500;
    display: none;
    max-width: 80vw;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

/* ---------- 图表 ---------- */
.chart-wrap { width: 100%; }
canvas.chart-canvas { width: 100%; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; justify-content: center; }
.chart-legend .lg-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.chart-legend .lg-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- 设置页 ---------- */
.set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 2px;
    border-bottom: 1px dashed var(--line);
}
.set-row:last-child { border-bottom: none; }
.set-row .set-label { font-size: 15px; }
.set-row .set-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 登录页 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(600px 300px at 15% 10%, rgba(43,168,160,.14), transparent),
        radial-gradient(500px 300px at 85% 90%, rgba(245,166,35,.13), transparent),
        var(--bg);
}
.login-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(43, 168, 160, 0.16);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
}
.login-card .login-logo { text-align: center; margin-bottom: 26px; }
.login-card .login-logo img { width: 120px; }
.login-card .login-slogan {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 22px;
    letter-spacing: 1px;
}
.login-tabs { display: flex; margin-bottom: 22px; background: #F1F7F7; border-radius: 14px; padding: 4px; }
.login-tabs button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    border-radius: 11px;
    font-size: 15px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.login-tabs button.active { background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: 0 2px 8px rgba(43,168,160,.15); }

/* ---------- 底部 ---------- */
.footer-note {
    text-align: center;
    color: #B8C7CC;
    font-size: 12px;
    padding: 26px 0 90px;
}

/* ============================================================
   响应式适配：平板 / 手机
   ============================================================ */
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .topbar { padding: 0 14px; height: 54px; }
    .topbar .logo img { height: 30px; }
    .topbar .book-switch { max-width: 130px; font-size: 13px; padding: 6px 10px; }
    .topbar .nickname-text { display: none; }
    .container { padding: 12px 14px 130px; }
    .page-title { font-size: 19px; }
    .stat-card .value { font-size: 19px; }
    .stat-card { padding: 14px; }

    /* 导航移到底部，方便手指点击 */
    .main-nav {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        margin: 0;
        max-width: none;
        background: rgba(255,255,255,.97);
        border-top: 1px solid var(--line);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        z-index: 100;
        overflow-x: visible;
    }
    .main-nav a {
        flex-direction: column;
        gap: 2px;
        font-size: 11px;
        padding: 5px 8px;
        border-radius: 12px;
    }
    .main-nav a .nav-ico { font-size: 20px; }

    .fab { bottom: 92px; right: 18px; width: 54px; height: 54px; font-size: 26px; }
    .filter-bar select, .filter-bar input { flex: 1 1 45%; }
    .record-item .rec-ops { flex-direction: column; }
    .login-card { padding: 28px 22px; }
}
