:root {
    --ink: #182230;
    --muted: #7c8798;
    --soft-muted: #a5afbc;
    --line: #e7ebf1;
    --paper: #ffffff;
    --canvas: #f5f7fb;
    --accent: #e77558;
    --accent-dark: #c85e44;
    --navy: #193a54;
    --teal: #258c85;
    --shadow: 0 22px 70px rgba(29, 48, 75, .09);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: 'Noto Sans SC', 'Manrope', sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button:disabled { cursor: wait; opacity: .6; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.is-hidden { display: none !important; }
.page-noise { position: fixed; inset: 0; pointer-events: none; opacity: .16; z-index: 0; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"); }

.login-view { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 32px; background: #f4f6f9; }
.login-view::before { content: ''; position: absolute; width: 740px; height: 740px; border: 1px solid rgba(25, 58, 84, .07); border-radius: 50%; transform: translate(38%, -22%); }
.login-view::after { content: ''; position: absolute; width: 620px; height: 620px; border: 1px solid rgba(231, 117, 88, .08); border-radius: 50%; transform: translate(-58%, 36%); }
.login-orbit { position: absolute; border-radius: 999px; opacity: .8; }
.orbit-a { width: 9px; height: 9px; background: var(--accent); top: 18%; left: 21%; box-shadow: 0 0 0 7px rgba(231,117,88,.1); }
.orbit-b { width: 6px; height: 6px; background: var(--teal); right: 20%; bottom: 22%; box-shadow: 0 0 0 7px rgba(37,140,133,.1); }
.login-card { width: min(100%, 440px); position: relative; z-index: 1; padding: 52px 55px 42px; border: 1px solid rgba(255,255,255,.92); border-radius: 25px; background: rgba(255,255,255,.88); box-shadow: 0 28px 90px rgba(25,58,84,.11); backdrop-filter: blur(12px); animation: rise-in .6s ease both; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--navy); box-shadow: 0 8px 18px rgba(25,58,84,.16); }
.brand-mark span { font-size: 21px; font-weight: 800; letter-spacing: -.1em; transform: translateX(-1px); }
.brand-mark-large { width: 54px; height: 54px; margin-bottom: 35px; border-radius: 17px; background: var(--accent); box-shadow: 0 12px 25px rgba(231,117,88,.2); }
.brand-mark-large span { font-size: 26px; }
.eyebrow { margin: 0; color: var(--soft-muted); font: 600 10px/1.3 'DM Mono', monospace; letter-spacing: .16em; }
.login-card h1 { margin: 13px 0 12px; color: var(--ink); font-size: 37px; line-height: 1.15; letter-spacing: -.06em; }
.login-card h1 span, .welcome-row h1 span { color: var(--accent); }
.login-copy { margin: 0 0 37px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.login-form label { display: block; margin-bottom: 9px; color: #677386; font-size: 12px; font-weight: 700; }
.input-wrap { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 15px; border: 1px solid #e3e8ef; border-radius: 12px; background: #fbfcfd; transition: border-color .2s, box-shadow .2s; }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(231,117,88,.11); }
.input-wrap svg { width: 18px; height: 18px; color: #a4afbd; }
.input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.input-wrap input::placeholder { color: #b3bcc7; }
.primary-button { border: 0; color: #fff; background: var(--accent); box-shadow: 0 10px 22px rgba(231,117,88,.18); transition: transform .2s, background .2s, box-shadow .2s; }
.primary-button:hover { background: var(--accent-dark); box-shadow: 0 13px 27px rgba(231,117,88,.27); transform: translateY(-1px); }
.login-button { width: 100%; height: 52px; display: flex; align-items: center; justify-content: space-between; margin-top: 17px; padding: 0 17px 0 20px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.login-button svg { width: 19px; height: 19px; }
.form-error { min-height: 18px; margin: 9px 0 0; color: #c95243; font-size: 12px; }
.login-footnote { display: flex; align-items: center; gap: 8px; margin: 27px 0 0; color: #a1aab6; font-size: 11px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #55b39a; box-shadow: 0 0 0 4px rgba(85,179,154,.11); }
.login-side-note { position: absolute; z-index: 1; right: 36px; bottom: 30px; display: flex; gap: 13px; color: #aeb7c2; font: 10px 'DM Mono', monospace; letter-spacing: .08em; transform: rotate(-90deg) translateX(100%); transform-origin: right bottom; }

.app-view { position: relative; z-index: 1; min-height: 100vh; animation: fade-in .45s ease both; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 4vw, 68px); border-bottom: 1px solid rgba(221,228,236,.7); background: rgba(255,255,255,.72); backdrop-filter: blur(14px); }
.topbar-left, .topbar-right, .user-chip, .sync-state { display: flex; align-items: center; }
.topbar-left { gap: 12px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { color: var(--ink); font-size: 14px; font-weight: 800; letter-spacing: -.03em; }
.brand-copy small { color: #a5aebb; font: 9px 'DM Mono', monospace; letter-spacing: .12em; }
.topbar-right { gap: 23px; }
.sync-state { gap: 7px; color: #7f8c99; font-size: 11px; }
.sync-icon { width: 7px; height: 7px; border-radius: 50%; background: #4aaf91; box-shadow: 0 0 0 4px rgba(74,175,145,.1); }
.sync-state.is-saving .sync-icon { background: var(--accent); box-shadow: 0 0 0 4px rgba(231,117,88,.1); animation: pulse 1s infinite; }
.user-chip { gap: 9px; padding-left: 22px; border-left: 1px solid var(--line); color: #586679; font-size: 12px; }
.avatar { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: #7c9a9b; font-size: 12px; font-weight: 700; }
.icon-button { width: 31px; height: 31px; display: grid; place-items: center; border: 0; border-radius: 9px; color: #a1acb9; background: transparent; transition: color .2s, background .2s; }
.icon-button:hover { color: var(--accent); background: #fff2ee; }
.icon-button svg { width: 17px; height: 17px; }
.content-wrap { width: min(100% - 48px, 1420px); margin: 0 auto; padding: 58px 0 32px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 37px; }
.welcome-row h1 { margin: 12px 0 9px; color: var(--ink); font-size: clamp(29px, 3vw, 40px); line-height: 1.2; letter-spacing: -.065em; }
.welcome-copy { margin: 0; color: #8a95a4; font-size: 13px; }
.today-card { min-width: 132px; display: grid; gap: 3px; padding: 12px 17px 13px; border-left: 2px solid var(--accent); background: rgba(255,255,255,.55); }
.today-label, .today-weekday { color: #a4adba; font-size: 11px; }
.today-card strong { color: var(--ink); font: 500 19px 'DM Mono', monospace; letter-spacing: -.06em; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 27px; }
.summary-card { min-height: 138px; display: flex; align-items: flex-start; gap: 14px; padding: 21px 20px; border: 1px solid rgba(224,230,238,.8); border-radius: var(--radius); background: rgba(255,255,255,.83); box-shadow: 0 10px 35px rgba(37,53,79,.03); }
.summary-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; }
.summary-icon svg { width: 17px; height: 17px; }
.card-income .summary-icon { color: #4d9f87; background: #e8f5f0; }
.card-expense .summary-icon { color: #dd8068; background: #fff0eb; }
.card-balance .summary-icon { color: #6a86b5; background: #edf1fa; }
.card-records .summary-icon { color: #9b80b8; background: #f4eef9; }
.summary-card > div:last-child { min-width: 0; display: grid; gap: 4px; }
.summary-label { color: #9aa4b1; font-size: 11px; }
.summary-card strong { color: var(--ink); font: 600 21px 'DM Mono', monospace; letter-spacing: -.07em; white-space: nowrap; }
.summary-card strong em { color: #9aa4b1; font: 400 12px 'Noto Sans SC', sans-serif; letter-spacing: 0; }
.summary-card small { color: #b0b8c3; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-panel { overflow: hidden; border: 1px solid rgba(222,229,237,.92); border-radius: 21px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.report-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding: 31px 32px 24px; }
.section-kicker { display: flex; align-items: center; gap: 9px; color: #adb5bf; font: 10px 'DM Mono', monospace; letter-spacing: .12em; }
.kicker-line { width: 23px; height: 1px; background: var(--accent); }
.report-heading h2 { width: fit-content; max-width: 100%; margin: 11px 0 3px; padding: 2px 4px; border-radius: 5px; color: var(--ink); font-size: 22px; letter-spacing: -.045em; outline: 0; transition: background .2s, box-shadow .2s; }
.report-heading h2:focus, .report-heading p:focus { background: #fff9f6; box-shadow: 0 0 0 3px rgba(231,117,88,.1); }
.report-heading p { width: fit-content; max-width: 100%; margin: 0; padding: 2px 4px; color: #9ca6b3; font-size: 12px; line-height: 1.7; outline: 0; border-radius: 5px; }
.report-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 13px; }
.secondary-button, .save-button { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 9px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.secondary-button { border: 1px solid #e4e9ef; color: #758194; background: #fff; transition: border-color .2s, color .2s, background .2s; }
.secondary-button:hover { border-color: #f2c1b3; color: var(--accent-dark); background: #fff9f7; }
.secondary-button svg, .save-button svg { width: 15px; height: 15px; }
.save-button { padding: 0 15px; }
.table-hint { display: flex; align-items: center; gap: 7px; min-height: 41px; padding: 0 32px; border-top: 1px solid #f0f2f5; border-bottom: 1px solid #eceff3; color: #a1aab6; background: #fbfcfd; font-size: 11px; }
.table-hint svg { width: 14px; height: 14px; color: #c0c7d0; }
.shortcut-hint { margin-left: auto; color: #b8c0ca; font: 10px 'DM Mono', monospace; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 870px; border-collapse: collapse; table-layout: fixed; }
col { transition: width .2s; }
thead { background: #fcfcfd; }
th { position: relative; height: 46px; padding: 0 30px 0 16px; border-right: 1px solid #eef1f4; border-bottom: 1px solid #e8ecf1; color: #7a8796; text-align: left; font-size: 11px; font-weight: 700; }
th:last-child { border-right: 0; }
.column-label { width: 100%; height: 29px; padding: 4px 0; border: 0; outline: 0; color: inherit; background: transparent; font: inherit; }
.column-label:focus { color: var(--accent-dark); }
.column-remove { position: absolute; top: 14px; right: 8px; width: 17px; height: 17px; display: grid; place-items: center; border: 0; border-radius: 5px; color: #c9d0d8; background: transparent; opacity: 0; transition: opacity .2s, color .2s, background .2s; }
th:hover .column-remove { opacity: 1; }
.column-remove:hover { color: #c85e44; background: #fff0ec; }
.column-remove svg { width: 12px; height: 12px; }
th.actions-head { width: 55px !important; padding: 0; border-right: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fffaf8; }
td { position: relative; height: 57px; padding: 0 14px; border-right: 1px solid #eef1f4; border-bottom: 1px solid #edf0f3; color: #566476; vertical-align: middle; font-size: 12px; }
td:last-child { border-right: 0; }
.cell-editor { display: block; width: 100%; min-height: 28px; max-height: 160px; overflow-y: auto; padding: 5px 20px 5px 2px; margin: 8px 0; border: 0; background: transparent; color: #425267; resize: none; border-radius: 6px; outline: 0; line-height: 1.55; word-break: break-word; }
.cell-editor::placeholder { color: #a5afbd; }
.cell-editor:focus { background: #fff; box-shadow: 0 0 0 2px rgba(231,117,88,.14); }
.cell-editor:empty::before { content: '点击填写'; color: #c2c9d1; pointer-events: none; }
.cell-editor img { display: block; max-width: 100%; max-height: 115px; margin: 4px 0; border-radius: 6px; object-fit: contain; cursor: zoom-in; }
.cell-image-button { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; color: #c2cad3; background: transparent; opacity: 0; transition: opacity .2s, color .2s, background .2s; }
td:hover .cell-image-button, td:focus-within .cell-image-button { opacity: 1; }
.cell-image-button:hover { color: var(--accent); background: #fff0eb; }
.cell-image-button svg { width: 13px; height: 13px; }
.cell-date-control { position: absolute; top: 4px; right: 3px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; color: #8799ac; cursor: pointer; }
.cell-date-control svg { width: 15px; height: 15px; pointer-events: none; }
.cell-date-control:hover, .cell-date-control:focus-within { color: var(--accent); background: #fff0eb; }
.cell-date-control:focus-within { outline: 2px solid var(--accent); }
.cell-date-input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.cell-date-input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; }
.row-remove { width: 25px; height: 27px; display: grid; place-items: center; margin: 0 auto; padding: 0; border: 0; border-radius: 7px; color: #c7cfd8; background: transparent; opacity: 0; transition: opacity .2s, color .2s, background .2s; }
tr:hover .row-remove { opacity: 1; }
.row-remove:hover { color: #d46651; background: #fff0ec; }
.row-remove svg { width: 14px; height: 14px; }
.table-footer { min-height: 45px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; color: #b0b8c2; font-size: 10px; }
.table-footer span:first-child { color: #8f9aa7; font-family: 'DM Mono', monospace; }
.app-footer { display: flex; justify-content: space-between; padding: 24px 2px 0; color: #b2bbc5; font: 10px 'DM Mono', monospace; letter-spacing: .02em; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; min-width: 220px; max-width: calc(100vw - 48px); display: flex; align-items: center; gap: 10px; padding: 13px 16px; border: 1px solid rgba(255,255,255,.75); border-radius: 11px; color: #fff; background: rgba(24,34,48,.93); box-shadow: 0 12px 35px rgba(24,34,48,.2); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .25s, transform .25s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: rgba(190,78,62,.95); }
.toast-icon { width: 7px; height: 7px; border-radius: 50%; background: #69d0ab; }
.toast.is-error .toast-icon { background: #ffd0c5; }
.sync-state { cursor: pointer; }
.sync-state.is-error { color: #be4e3e; }
.sync-state.is-error .sync-icon { background: #be4e3e; }
.cell-images { display: flex; flex-wrap: wrap; gap: 7px; }
.cell-images:not(:empty) { padding-bottom: 10px; }
.cell-picture { position: relative; max-width: 100%; }
.image-preview { display: block; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.cell-picture img { display: block; max-width: 100%; max-height: 108px; border-radius: 6px; object-fit: contain; }
.image-remove { position: absolute; top: -4px; right: -4px; width: 21px; height: 21px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; background: white; color: #b65542; }
.image-remove svg { width: 11px; height: 11px; }
.row-actions { padding: 0; }
.is-drop-target { background: #fff2e9; box-shadow: inset 0 0 0 2px var(--accent); }
.cell-image-button { opacity: .55; }
.cell-image-button:focus-visible, .row-remove:focus-visible, .column-remove:focus-visible { opacity: 1; outline: 2px solid var(--accent); }
.table-hint { color: #7b8998; }
.summary-label { color: #6c7a8d; }
.summary-card small { color: #8490a0; }
.summary-card strong { letter-spacing: -.04em; font-size: clamp(16px, 1.6vw, 23px); }
.summary-card strong, .today-card strong { font-family: 'Segoe UI', system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.eyebrow, .section-kicker, .brand-copy small { font-family: Consolas, 'SFMono-Regular', monospace; }
.image-lightbox { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 40px; background: rgba(20,30,42,.75); backdrop-filter: blur(4px); }
.image-lightbox img { max-width: min(90vw, 1000px); max-height: 85vh; border-radius: 10px; box-shadow: 0 20px 80px rgba(0,0,0,.35); }
.lightbox-close, #lightbox-close { position: fixed; top: 22px; right: 25px; width: 37px; height: 37px; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.14); font-size: 27px; line-height: 1; }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 1050px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .report-heading { display: block; }
    .report-actions { justify-content: flex-start; padding-top: 21px; }
}
@media (max-width: 680px) {
    .login-view { padding: 18px; }
    .login-card { padding: 38px 27px 32px; }
    .login-side-note { display: none; }
    .topbar { height: 67px; padding: 0 18px; }
    .brand-copy small, .user-chip > span:last-child { display: none; }
    .sync-state { display: flex; font-size: 10px; gap: 6px; }
    #sync-label { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-right { gap: 8px; }
    .user-chip { padding-left: 11px; }
    .content-wrap { width: min(100% - 28px, 1420px); padding-top: 36px; }
    .welcome-row { display: block; margin-bottom: 27px; }
    .today-card { width: fit-content; margin-top: 19px; }
    .summary-grid { gap: 10px; }
    .summary-card { min-height: 124px; display: block; padding: 15px; }
    .summary-icon { margin-bottom: 11px; }
    .summary-card strong { font-size: 17px; }
    .summary-card small { font-size: 9px; }
    .report-heading { padding: 25px 19px 20px; }
    .report-heading h2 { font-size: 20px; }
    .report-actions { gap: 6px; }
    .secondary-button, .save-button { padding: 0 9px; font-size: 10px; }
    .table-hint { align-items: flex-start; padding: 11px 19px; line-height: 1.6; }
    .table-hint > span:first-of-type::after { content: ' 左右滑动可查看全部列。'; }
    .shortcut-hint { display: none; }
    .table-footer { padding: 0 19px; }
    .table-footer span:last-child { display: none; }
    .cell-image-button { width: 26px; height: 26px; opacity: .85; right: 2px; top: 4px; }
    .column-remove, .row-remove { opacity: .7; }
    .cell-image-button svg { width: 16px; height: 16px; }
    .cell-editor { font-size: 16px; }
    .table-scroll { -webkit-overflow-scrolling: touch; }
    .app-footer { padding-bottom: 12px; }
}
