/*========================================================
   记账系统样式 style.css
========================================================*/
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --in:   #10b981;   /* 收入绿 */
    --out:  #ef4444;   /* 支出红 */
    --pri:  #2563eb;   /* 主色 */
    --bg:   #f1f5f9;
    --line: #e5e7eb;
    --txt:  #1f2937;
    --muted:#9ca3af;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--txt);
    font-size: 14px;
    line-height: 1.6;
}

/* ---------- 顶部导航 ---------- */
.topbar { background: #1e293b; color: #fff; }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 18px; font-weight: 700; }
.topbar nav a { color: #cbd5e1; text-decoration: none; margin-left: 18px; padding: 4px 2px; }
.topbar nav a:hover { color: #fff; }
.topbar nav a.active { color: #fff; border-bottom: 2px solid var(--pri); }

/* ---------- 布局 ---------- */
.container { max-width: 1080px; margin: 20px auto; padding: 0 16px; }

/* ---------- 汇总卡片 ---------- */
.cards { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.card { flex: 1; min-width: 180px; background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-label { color: var(--muted); font-size: 13px; }
.card-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.card-in .card-value { color: var(--in); }
.card-out .card-value { color: var(--out); }
.card-balance .card-value { color: var(--pri); }

/* ---------- 筛选栏 ---------- */
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar label { color: var(--muted); }

/* ---------- 面板/表格 ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px; overflow: hidden; }
.panel-title { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f8fafc; text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:hover td { background: #f8fafc; }
.r { text-align: right; } .c { text-align: center; }
.t-in { color: var(--in); font-weight: 700; }
.t-out { color: var(--out); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }
.remark-cell { color: #4b5563; }
.muted { color: var(--muted); }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag-in { background: #d1fae5; color: #047857; }
.tag-out { background: #fee2e2; color: #b91c1c; }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px; background: #fff; color: var(--txt); border: 1px solid var(--line); }
.btn:hover { opacity: .9; }
.btn-primary { background: var(--pri); color: #fff; border-color: var(--pri); }
.btn-plain { color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn-edit { color: var(--pri); border-color: #bfdbfe; }
.btn-del { color: var(--out); border-color: #fecaca; }
.form-actions { margin-top: 8px; display: flex; gap: 10px; }

/* ---------- 表单 ---------- */
.form-panel { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #374151; }
.form-control { width: 100%; max-width: 420px; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.form-control.sel { width: auto; }
textarea.form-control { resize: vertical; }
.radio-group { display: flex; gap: 20px; }
.radio { display: flex; align-items: center; gap: 5px; font-weight: normal; }
.checkbox { display: flex; align-items: center; gap: 6px; font-weight: normal; color: var(--out); }
.img-preview { margin-top: 10px; max-width: 320px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.cur-img { display: block; }

/* ---------- 提示框 ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }

/* ---------- 分页 ---------- */
.pager { padding: 12px 16px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager-info { color: var(--muted); margin-right: 6px; }

/* ---------- 弹窗 ---------- */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 10px; max-width: 640px; width: 92%; overflow: hidden; }
.modal-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal-close { text-decoration: none; color: var(--muted); font-size: 22px; line-height: 1; }
.modal-body { padding: 14px; text-align: center; }
.modal-body img { max-width: 100%; max-height: 70vh; border-radius: 6px; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg,#1e293b,#2563eb); }
.login-box { background: #fff; border-radius: 12px; padding: 34px 32px; width: 100%; max-width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.login-title { font-size: 22px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 20px; }
.login-tip { margin-top: 18px; text-align: center; color: var(--muted); font-size: 12px; }
.login-box .form-group label { color: #374151; }

/* ---------- 统计图表 ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; padding: 20px 16px 10px; height: 240px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-wrap { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; max-width: 44px; justify-content: center; }
.bar { width: 12px; border-radius: 3px 3px 0 0; }
.bar-in { background: var(--in); }
.bar-out { background: var(--out); }
.bar-label { margin-top: 6px; font-size: 12px; color: var(--muted); }
.legend { padding: 0 16px 14px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.dot-in { background: var(--in); } .dot-out { background: var(--out); }

.pct-bar { background: #f1f5f9; border-radius: 4px; height: 14px; width: 100%; }
.pct-fill { background: var(--pri); height: 100%; border-radius: 4px; }
.sub-nav { padding: 12px 16px 0; display: flex; gap: 8px; }
.sub-nav .btn { margin-bottom: 12px; }

/* ---------- 保存成功弹窗（toast） ---------- */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px); padding: 12px 28px; border-radius: 8px; color: #fff; font-size: 15px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 999; box-shadow: 0 6px 18px rgba(0,0,0,.18); white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }

/* ---------- 账户选项卡 ---------- */
.acc-nav { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-label { color: var(--muted); font-weight: 600; }
.acc-nav .btn-primary { box-shadow: 0 1px 4px rgba(37,99,235,.3); }

/* ---------- 各账户余额卡片 ---------- */
.acc-bal { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.acc-bal-card { display: block; background: linear-gradient(135deg, #eef2ff, #ffffff); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-decoration: none; transition: box-shadow .2s; }
.acc-bal-card:hover { box-shadow: 0 4px 14px rgba(37,99,235,.18); }
.acc-bal-name { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.acc-bal-val { color: var(--ink); font-size: 22px; font-weight: 700; }
.acc-bal-val.neg { color: var(--out); }

@media (max-width:768px){
    .acc-bal { grid-template-columns: 1fr 1fr; }
    .acc-bal-val { font-size: 18px; }
}

/* ---------- 后台管理：内联添加表单 ---------- */
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.inline-form .form-control { display: inline-block; width: auto; }



