* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    background: #f2f4f8;
    color: #333;
    font-size: 14px;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 960px; margin: 0 auto; padding: 16px; }

/* 顶栏 */
.topbar { background: #fff; border-bottom: 1px solid #e5e7eb; }
.topbar .inner { max-width: 960px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; height: 52px; gap: 20px; }
.brand { font-weight: bold; font-size: 17px; color: #111; white-space: nowrap; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: #555; padding: 4px 2px; }
.nav a.active, .nav a:hover { color: #2563eb; font-weight: bold; text-decoration: none; }
.userbox { margin-left: auto; color: #777; white-space: nowrap; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }

/* 概览 */
.summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.summary .item { flex: 1; min-width: 150px; background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.summary .label { color: #888; font-size: 12px; }
.summary .val { font-size: 20px; font-weight: bold; margin-top: 4px; }

.expense { color: #e02020; }
.income { color: #16a34a; }

/* 表单 */
input, select, textarea, button { font: inherit; }
input[type=text], input[type=password], input[type=email], input[type=month], input[type=date], select, textarea {
    border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 10px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #2563eb; }
input[disabled] { background: #f3f4f6; color: #888; }
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; color: #555; margin-bottom: 4px; font-size: 13px; }
label.inline { display: inline-block; margin-right: 16px; cursor: pointer; }

.btn {
    display: inline-block; border: none; border-radius: 6px; padding: 8px 18px; cursor: pointer;
    background: #2563eb; color: #fff; font-size: 14px;
}
.btn:hover { background: #1d4ed8; text-decoration: none; }
.btn-gray { background: #6b7280; }
.btn-gray:hover { background: #4b5563; }
.btn-danger { background: #dc2626; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 表格 */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; text-align: left; }
table.list th { color: #888; font-weight: normal; font-size: 12px; }
table.list tr:hover td { background: #fafbfc; }

/* 标签与徽章 */
.tag {
    display: inline-block; background: #eef2ff; color: #4338ca; border-radius: 4px;
    padding: 1px 8px; font-size: 12px; margin-right: 4px;
}
.tag:hover { background: #e0e7ff; text-decoration: none; }
.badge { display: inline-block; border-radius: 4px; padding: 1px 8px; font-size: 12px; }
.badge.expense { background: #fee2e2; color: #b91c1c; }
.badge.income { background: #dcfce7; color: #15803d; }
.pin-star { color: #f59e0b; font-size: 12px; margin-left: 4px; }

/* 记账记录卡片 */
.record { border-bottom: 1px solid #f0f0f0; padding: 12px 4px; display: flex; gap: 12px; }
.record:last-of-type { border-bottom: none; }
.record .main { flex: 1; min-width: 0; }
.record .title b { margin: 0 4px; }
.record .meta { color: #999; font-size: 12px; margin-top: 3px; }
.meta-inline { color: #888; font-size: 12px; }
.record .content { margin-top: 6px; line-height: 1.6; word-break: break-word; }
.record .content img { max-width: 180px; max-height: 180px; border-radius: 6px; margin: 4px 6px 0 0; cursor: pointer; }
.record .amount { font-weight: bold; white-space: nowrap; font-size: 15px; }
.record .ops { white-space: nowrap; font-size: 12px; }
.record .ops a { display: inline-block; margin-left: 8px; }
.record .ops a.danger { color: #dc2626; }

/* 富文本编辑器 */
.editor-toolbar {
    border: 1px solid #d1d5db; border-bottom: none; border-radius: 6px 6px 0 0;
    padding: 6px 8px; background: #f9fafb; display: flex; gap: 6px; align-items: center;
}
.editor-toolbar button,
.editor-toolbar .tool-btn {
    border: 1px solid #d1d5db; background: #fff; border-radius: 4px;
    padding: 3px 10px; cursor: pointer; font-size: 13px; color: #333;
}
.editor-toolbar button:hover,
.editor-toolbar .tool-btn:hover { background: #eef2ff; text-decoration: none; }
.editor {
    border: 1px solid #d1d5db; border-radius: 0 0 6px 6px; min-height: 160px;
    padding: 10px 12px; background: #fff; outline: none; line-height: 1.6;
    word-break: break-word;
}
.editor:focus { border-color: #2563eb; }
.editor img { max-width: 100%; border-radius: 6px; }
.upload-status { color: #888; font-size: 12px; }

/* 消息提示 */
.msg-ok { background: #dcfce7; color: #15803d; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.msg-err { background: #fee2e2; color: #b91c1c; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }

/* 分页 */
.pager { margin-top: 14px; text-align: center; color: #888; }
.pager a, .pager span { margin: 0 6px; }

/* 登录页 */
.login-box { max-width: 360px; margin: 12vh auto; }

/* 图片弹层（imgBox） */
.imgbox-overlay {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    z-index: 9999; display: none;
    align-items: center; justify-content: center;
    padding: 24px 24px 36px;
    background: rgba(0, 0, 0, .82);
}
.imgbox-overlay.show { display: flex; }
.imgbox-overlay img {
    max-width: 100%; max-height: 100%; width: auto; height: auto;
    border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
    cursor: default; -webkit-user-select: none; user-select: none;
}
.imgbox-close {
    position: absolute; top: 14px; right: 18px;
    width: 40px; height: 40px; padding: 0;
    border: none; border-radius: 50%;
    background: rgba(255, 255, 255, .16); color: #fff;
    font-size: 26px; line-height: 1; text-align: center;
    cursor: pointer; transition: background .2s;
}
.imgbox-close:hover { background: rgba(255, 255, 255, .34); }

@media (max-width: 640px) {
    .record { flex-direction: column; }
    .record .ops { margin-top: 6px; }
    .imgbox-overlay { padding: 12px; }
    .imgbox-close { top: 8px; right: 8px; }
}
