* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: #f4f6fb; color: #222; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: inherit; outline: none; }
a { color: #3478ff; }

/* 登录页 */
.auth-body { min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { background: #fff; border-radius: 20px; padding: 36px 30px 30px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.auth-title { margin: 0; text-align: center; font-size: 28px; }
.auth-sub { margin: 6px 0 24px; text-align: center; color: #888; font-size: 14px; }

/* 按钮与表单 */
.btn-primary { background: linear-gradient(135deg, #3478ff, #5d5bff); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px; font-weight: 600; transition: 0.2s; }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-secondary { background: #eef1f8; color: #333; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; transition: 0.2s; }
.btn-secondary:hover { background: #e3e8f2; }
.btn-danger { background: #fde8e8; color: #d83a3a; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; transition: 0.2s; }
.btn-danger:hover { background: #f9cfcf; }
.btn-ghost { background: transparent; color: #888; padding: 8px 10px; border-radius: 8px; font-size: 13px; transition: 0.2s; }
.btn-ghost:hover { background: #f1f3f8; color: #333; }

.form .field { margin-bottom: 16px; }
.form label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; font-weight: 500; }
.form input, .form textarea, .form select {
    width: 100%; padding: 12px 14px; border: 1px solid #e2e6ef; border-radius: 10px;
    background: #fafbfe; font-size: 15px; transition: 0.2s;
}
.form input:focus, .form textarea:focus, .form select:focus {
    border-color: #3478ff; background: #fff; box-shadow: 0 0 0 3px rgba(52,120,255,0.1);
}

.tip { margin-top: 12px; font-size: 13px; text-align: center; min-height: 20px; }
.tip.error { color: #d83a3a; }
.tip.success { color: #1f9d55; }

/* 快捷 chip */
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
    padding: 7px 14px;
    background: #f3f5fa;
    color: #475569;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
}
.chip:hover { background: #e8ecf5; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.chip:active { transform: translateY(0); }
.chip.active {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}
.chip.chip-add {
    color: #0f766e;
    background: #f0fdfa;
    border: 1px dashed #5eead4;
}
.chip.chip-add:hover { background: #ccfbf1; }
.chip .close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    margin-left: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    color: inherit;
    font-size: 12px;
    line-height: 1;
    transition: 0.2s;
}
.chip .close:hover { background: #ef4444; color: #fff; }

/* ========= 记账主页面 ========= */
.app-container { max-width: 1400px; margin: 0 auto; padding: 20px 24px 80px; }
.app-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.app-header h1 { margin: 0; font-size: 24px; }
.user-info { display: flex; align-items: center; gap: 10px; color: #666; font-size: 14px; }

.main-tabs { display: flex; gap: 10px; background: #fff; padding: 6px; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); margin-bottom: 18px; }
.main-tabs button {
    flex: 1; padding: 14px; background: transparent; border-radius: 10px; color: #555;
    font-size: 15px; font-weight: 600; transition: 0.2s;
}
.main-tabs button.active {
    background: linear-gradient(135deg, #3478ff, #5d5bff);
    color: #fff; box-shadow: 0 6px 18px rgba(52,120,255,0.3);
}

.panel { display: none; animation: fade 0.25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* 左右布局（电脑端：左表单 / 右记录） */
.split { display: grid; grid-template-columns: minmax(360px, 420px) 1fr; gap: 20px; align-items: start; }

@media (min-width: 1200px) {
    .split { grid-template-columns: 420px 1fr; }
}
@media (max-width: 960px) {
    .split { grid-template-columns: 1fr; }
}

.col-form { position: sticky; top: 20px; }
.card { background: #fff; border-radius: 16px; padding: 22px 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.card-title { margin: 0 0 18px; font-size: 18px; }

.col-list { min-width: 0; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; padding: 22px 24px; border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); position: relative; overflow: hidden; }
.stat-card .label { color: rgba(255,255,255,0.88); font-size: 13px; margin-bottom: 8px; font-weight: 500; letter-spacing: 0.5px; }
.stat-card:not(.accent-1):not(.accent-2):not(.accent-3) .label { color: #888; }
.stat-card .value { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.stat-card .sub { color: rgba(255,255,255,0.8); font-size: 13px; margin-top: 6px; }
.stat-card:not(.accent-1):not(.accent-2):not(.accent-3) .sub { color: #94a3b8; }
.stat-card:not(.accent-1):not(.accent-2):not(.accent-3) .value { color: #1e293b; }
.stat-card.accent-1 { background: linear-gradient(135deg, #4facfe, #00c6ff); color: #fff; }
.stat-card.accent-2 { background: linear-gradient(135deg, #fa709a, #fee140); color: #fff; }
.stat-card.accent-3 { background: linear-gradient(135deg, #30cfd0, #330867); color: #fff; }

/* 筛选条 */
.filter-bar {
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-bar .label { color: #64748b; font-size: 13px; margin-right: 4px; font-weight: 600; }
.filter-bar input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    background: #fafbfe;
    cursor: pointer;
    color: #334155;
    transition: 0.2s;
}
.filter-bar input[type="date"]:hover { border-color: #94a3b8; background: #fff; }
.filter-bar input[type="date"]:focus {
    border-color: #3b82f6;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* 记录列表 */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.record-card {
    background: #fff; padding: 18px 20px; border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    display: flex; gap: 16px; align-items: flex-start; transition: 0.2s;
}
.record-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,0.08); }
.record-card .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.record-card .row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.record-card .title { font-size: 16px; font-weight: 600; color: #1f2937; }
.record-card .amount { font-size: 22px; font-weight: 700; color: #3478ff; }
.record-card .amount.red { color: #e85454; }
.record-card .amount.green { color: #1f9d55; }
.record-card .category { font-size: 12px; padding: 4px 12px; border-radius: 20px; background: #eef1f8; color: #555; font-weight: 600; }
.record-card .date { color: #64748b; font-size: 13px; }
.record-card .remark { color: #475569; font-size: 14px; line-height: 1.6; }
.record-card .actions { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; gap: 12px; min-height: 100px; }
.record-card .thumb { width: 86px; height: 86px; border-radius: 14px; object-fit: cover; background: #f3f5fa; cursor: zoom-in; box-shadow: 0 2px 8px rgba(0,0,0,0.08); display: block; flex-shrink: 0; transition: transform 0.2s; }
.record-card .thumb:hover { transform: scale(1.04); }
.record-card .thumb-placeholder { display: none; }

.empty { text-align: center; padding: 80px 20px; color: #94a3b8; font-size: 15px; }
.empty .emoji { font-size: 56px; margin-bottom: 12px; }

/* 上传区 */
.upload-zone { border: 2px dashed #d4d9e4; border-radius: 12px; padding: 18px 14px; text-align: center; color: #888; font-size: 13px; transition: 0.2s; }
.upload-zone .hint { margin-top: 4px; color: #b5bdcf; font-size: 12px; }

.upload-preview { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.preview-item img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.preview-item .remove { color: #d83a3a; cursor: pointer; font-size: 12px; }

/* 状态徽章 */
.status-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-done { background: #d1fae5; color: #047857; }

.check-btn {
    width: 42px; height: 42px; border-radius: 50%; background: #f3f5fa; color: #b5bdcf;
    font-size: 20px; line-height: 42px; text-align: center; transition: 0.2s;
}
.check-btn:hover { background: #d1fae5; color: #047857; }
.check-btn.checked { background: #10b981; color: #fff; }

/* 图片预览 */
.img-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.88); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; cursor: zoom-out; }
.img-mask.active { display: flex; animation: fade 0.2s ease; }
.img-mask img { max-width: 95%; max-height: 95%; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
.img-mask .close-tip { position: absolute; top: 20px; right: 20px; color: #fff; font-size: 14px; }

/* toast */
.toast { position: fixed; top: 26px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,0.92); color: #fff; padding: 10px 22px; border-radius: 22px; font-size: 14px; z-index: 300; opacity: 0; transition: 0.25s; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }

@media (max-width: 700px) {
    .stats { grid-template-columns: 1fr; }
}
