:root {
  --red: #e02e24;
  --red-dark: #c91e17;
  --red-soft: #fff1f0;
  --green: #15803d;
  --green-soft: #edf9f0;
  --amber: #b45309;
  --amber-soft: #fff8e8;
  --ink: #242424;
  --muted: #737373;
  --line: #e9e9e7;
  --surface: #ffffff;
  --canvas: #f7f7f5;
  --sidebar: #20211f;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(30, 30, 25, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(224, 46, 36, 0.18); outline-offset: 1px; }
.hidden { display: none !important; }

body.view-locked { overflow: hidden; }
body.view-locked .app-shell,
body.view-locked dialog,
body.view-locked .toast { visibility: hidden; }
.view-gate { position: fixed; inset: 0; z-index: 1000; display: none; place-items: center; padding: 20px; background: #f7f7f5; }
body.view-locked .view-gate { display: grid; }
.view-gate-panel { width: min(390px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.view-gate-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--red); }
.view-gate-mark svg { width: 22px; height: 22px; }
.view-gate-brand { margin: 20px 0 4px; color: var(--red); font-size: 12px; font-weight: 800; }
.view-gate-panel h1 { font-size: 24px; }
.view-gate-copy { margin: 8px 0 24px; color: var(--muted); line-height: 1.6; }
.view-gate-field { display: grid; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 700; }
.view-gate-field input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #dcdcd8; border-radius: 6px; color: var(--ink); background: #fff; outline: 0; }
.view-gate-field input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 46, 36, .09); }
.view-gate-panel .form-error { margin: 10px 0 0; }
.view-gate-submit { width: 100%; margin-top: 18px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 220px; padding: 24px 14px 18px; background: var(--sidebar); color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 28px; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 8px; background: var(--red); font-size: 19px; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { margin-top: 3px; color: #a9aaa6; font-size: 11px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { height: 44px; border: 0; border-radius: 6px; padding: 0 12px; color: #bfc0bc; background: transparent; display: flex; align-items: center; gap: 11px; cursor: pointer; text-align: left; }
.nav-item:hover { color: #fff; background: #2b2c29; }
.nav-item.active { color: #fff; background: var(--red); font-weight: 700; }
.nav-icon, .nav-icon svg { width: 18px; height: 18px; }
.sidebar-foot { margin-top: auto; padding: 0 8px; color: #90918d; }
.storage-note { padding: 12px; border: 1px solid #383936; border-radius: 7px; display: flex; align-items: flex-start; gap: 7px; line-height: 1.5; font-size: 11px; }
.storage-note svg { width: 15px; flex: 0 0 15px; }
.sidebar-foot small { display: block; margin-top: 12px; text-align: center; font-size: 10px; }

.main-content { min-width: 0; grid-column: 2; padding: 26px clamp(20px, 4vw, 54px) 24px; }
.topbar { max-width: 1240px; margin: 0 auto 25px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
h1 { margin: 0; font-size: 25px; line-height: 1.25; }
.header-actions { display: flex; gap: 9px; }
.button, .icon-button, .month-label, .text-button { border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.button { min-height: 40px; padding: 0 15px; border-radius: 6px; gap: 7px; font-weight: 700; }
.button svg { width: 17px; height: 17px; }
.button-primary { color: #fff; background: var(--red); }
.button-primary:hover { background: var(--red-dark); }
.button-secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.button-secondary:hover { border-color: #cfcfca; background: #fafaf8; }
.button-danger { color: #fff; background: #b42318; }
.button-ghost { min-height: 34px; background: #fff; color: var(--red); border: 1px solid #ffc9c5; }
.icon-button { width: 36px; height: 36px; padding: 0; border-radius: 6px; background: transparent; }
.icon-button:hover { background: #f2f2ef; }
.icon-button svg { width: 18px; height: 18px; }
.text-button { background: transparent; color: var(--red); gap: 5px; font-weight: 700; }
.text-button svg { width: 15px; }

.shared-banner, .migration-banner { max-width: 1240px; margin: -8px auto 18px; min-height: 48px; padding: 8px 10px 8px 15px; border: 1px solid #ffc9c5; border-radius: var(--radius); background: var(--red-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.shared-banner > div { display: flex; align-items: center; gap: 9px; color: #8f231d; }
.shared-banner svg { width: 18px; }
.migration-banner { border-color: #b8dec3; background: var(--green-soft); }
.migration-banner > div { display: flex; align-items: center; gap: 9px; color: #176333; }
.migration-banner svg { width: 18px; flex: 0 0 18px; }
.toolbar { max-width: 1240px; margin: 0 auto 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toolbar-left { min-width: 0; display: flex; align-items: center; gap: 18px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.cloud-status { height: 34px; padding: 0 10px; border-radius: 6px; display: flex; align-items: center; gap: 7px; color: var(--green); background: var(--green-soft); font-size: 11px; }
.cloud-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cloud-status.connecting { color: var(--amber); background: var(--amber-soft); }
.cloud-status.offline { color: var(--red); background: var(--red-soft); }
.month-control { position: relative; display: flex; align-items: center; gap: 2px; }
.month-label { height: 36px; padding: 0 9px; gap: 7px; background: transparent; border-radius: 6px; }
.month-label:hover { background: #efefec; }
.month-label svg { width: 16px; height: 16px; color: var(--muted); }
#month-picker { position: absolute; left: 38px; top: 38px; width: 140px; opacity: 0; pointer-events: none; }
.range-segmented { flex: 0 0 auto; }
.range-segmented button { min-width: 72px; }
.range-segmented button.active { color: var(--red); }
.store-filter { height: 38px; min-width: 132px; padding: 0 9px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.store-filter:focus-within { border-color: #c9c9c5; box-shadow: 0 0 0 3px rgba(224, 46, 36, .09); }
.store-filter svg { width: 16px; height: 16px; color: var(--muted); }
.store-filter select { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); cursor: pointer; font-weight: 700; }

.view { display: none; max-width: 1240px; margin: 0 auto; }
.view.active { display: block; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(30,30,25,.02); }
.kpi-card { min-width: 0; padding: 18px; border-top-width: 3px; }
.income-card { border-top-color: var(--green); }
.expense-card { border-top-color: var(--red); }
.profit-card { border-top-color: #343432; }
.margin-card { border-top-color: var(--amber); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.kpi-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: #f3f3f0; }
.kpi-icon svg { width: 16px; }
.kpi-card > strong { display: block; overflow-wrap: anywhere; margin: 15px 0 7px; font-size: clamp(21px, 2.2vw, 29px); line-height: 1; }
.kpi-card p { margin: 0; color: var(--muted); font-size: 11px; }
.income-card .kpi-icon { color: var(--green); background: var(--green-soft); }
.expense-card .kpi-icon { color: var(--red); background: var(--red-soft); }
.margin-card .kpi-icon { color: var(--amber); background: var(--amber-soft); }

.dashboard-grid { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr); gap: 12px; }
.panel { min-width: 0; padding: 19px; }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-title h2 { margin: 0; font-size: 15px; }
.panel-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 13px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.income-dot { background: var(--green); }
.expense-dot { background: var(--red); }
.chart { height: 220px; margin-top: 24px; display: grid; grid-template-columns: repeat(var(--bucket-count, 6), minmax(38px, 1fr)); gap: 12px; align-items: end; overflow-x: auto; border-bottom: 1px solid var(--line); }
.chart-month { height: 100%; display: grid; grid-template-rows: 1fr 28px; min-width: 0; }
.bar-area { display: flex; align-items: end; justify-content: center; gap: 5px; }
.bar { width: min(18px, 35%); min-height: 2px; border-radius: 3px 3px 0 0; position: relative; transition: height .25s ease; }
.bar:hover::after { content: attr(data-value); position: absolute; left: 50%; bottom: calc(100% + 7px); z-index: 2; transform: translateX(-50%); padding: 4px 6px; border-radius: 4px; background: #222; color: #fff; font-size: 10px; white-space: nowrap; }
.bar.income { background: var(--green); }
.bar.expense { background: var(--red); opacity: .82; }
.chart-label { display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.breakdown-list { margin-top: 17px; display: grid; gap: 15px; }
.breakdown-item-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.breakdown-item-head span:last-child { font-weight: 700; }
.progress { height: 6px; margin-top: 7px; border-radius: 3px; background: #efefed; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--red); }
.empty-mini { height: 170px; color: var(--muted); display: grid; place-items: center; text-align: center; }
.empty-mini svg { width: 28px; height: 28px; margin-bottom: 8px; color: #b9b9b5; }
.empty-mini p { margin: 0; font-size: 12px; }
.recent-panel { margin-top: 12px; }

.record-list { margin-top: 14px; }
.record-row { min-height: 65px; display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(120px, .7fr) 100px 40px; gap: 12px; align-items: center; border-top: 1px solid var(--line); }
.record-row:first-child { border-top: 0; }
.record-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.category-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 7px; background: var(--red-soft); color: var(--red); }
.category-icon.income { color: var(--green); background: var(--green-soft); }
.category-icon svg { width: 17px; height: 17px; }
.record-main strong, .record-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-main strong { font-size: 13px; }
.record-main small, .record-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.record-amount { justify-self: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.record-amount.income { color: var(--green); }
.row-menu { justify-self: end; position: relative; }
.menu-button { width: 32px; height: 32px; }
.record-actions { position: absolute; top: 32px; right: 0; z-index: 5; width: 92px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: var(--shadow); display: none; }
.record-actions.open { display: grid; }
.record-actions button { height: 32px; border: 0; border-radius: 4px; background: transparent; text-align: left; cursor: pointer; font-size: 12px; }
.record-actions button:hover { background: #f4f4f1; }
.record-actions .delete-action { color: var(--red); }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 50%; background: #f1f1ee; display: grid; place-items: center; }
.empty-state svg { width: 23px; }
.empty-state h3 { margin: 0 0 6px; color: var(--ink); font-size: 15px; }
.empty-state p { margin: 0 0 15px; font-size: 12px; }

.records-panel { padding: 18px; }
.records-controls { display: flex; justify-content: space-between; gap: 16px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 7px; background: #f0f0ed; }
.segmented button { min-width: 62px; height: 32px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.search-box { width: min(300px, 45%); height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.search-box:focus-within { border-color: #c9c9c5; box-shadow: 0 0 0 3px rgba(224, 46, 36, 0.09); }
.search-box svg { width: 16px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }

.report-summary { min-height: 130px; padding: 24px 28px; border-radius: var(--radius); color: #fff; background: #272824; display: flex; align-items: center; justify-content: space-between; }
.report-summary span, .report-summary strong, .report-summary small { display: block; }
.report-summary span { color: #bcbdb7; font-size: 12px; }
.report-summary strong { margin: 8px 0 6px; font-size: 31px; }
.report-summary small { color: #bcbdb7; }
.report-ratio { width: min(430px, 48%); }
.ratio-numbers { margin-bottom: 9px; display: flex; justify-content: space-between; font-size: 11px; }
.ratio-bar { height: 10px; border-radius: 5px; overflow: hidden; display: flex; background: #43443f; }
.ratio-bar i:first-child { background: #35a65a; }
.ratio-bar i:last-child { background: #f05a50; }
.report-grid { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.category-report { margin-top: 16px; }
.category-report-row { min-height: 50px; display: grid; grid-template-columns: 1fr auto; align-items: center; border-top: 1px solid var(--line); }
.category-report-row:first-child { border-top: 0; }
.category-report-row span { color: var(--muted); font-size: 12px; }
.category-report-row strong { font-size: 13px; }
.category-report-row small { margin-left: 7px; color: var(--muted); font-weight: 400; }

.page-footer { max-width: 1240px; margin: 26px auto 0; padding-top: 17px; border-top: 1px solid var(--line); color: #a0a09c; text-align: center; font-size: 10px; }

.modal { width: min(500px, calc(100vw - 28px)); max-height: calc(100vh - 30px); padding: 22px; border: 0; border-radius: 8px; color: var(--ink); box-shadow: 0 24px 70px rgba(20,20,16,.22); }
.modal::backdrop { background: rgba(24,24,21,.48); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.form-field { margin-top: 17px; }
.form-field > label { display: block; margin-bottom: 7px; color: #555; font-size: 12px; font-weight: 700; }
.inline-add { margin-left: 6px; padding: 0; border: 0; color: var(--red); background: transparent; cursor: pointer; font-size: 11px; font-weight: 400; }
.inline-add:hover { text-decoration: underline; }
.form-field label small { color: var(--muted); font-weight: 400; }
.form-field > input, .form-field select { width: 100%; height: 41px; padding: 0 11px; border: 1px solid #dcdcd8; border-radius: 6px; background: #fff; }
.form-field > input:focus, .form-field select:focus { border-color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-segmented { display: flex; }
.type-segmented button { flex: 1; }
.type-segmented button[data-value="income"].active { color: var(--green); }
.type-segmented button[data-value="expense"].active { color: var(--red); }
.amount-field > div { height: 52px; padding: 0 12px; border: 1px solid #dcdcd8; border-radius: 6px; display: flex; align-items: center; gap: 7px; }
.amount-field > div:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224,46,36,.1); }
.amount-field span { font-size: 18px; font-weight: 700; }
.amount-field input { width: 100%; min-width: 0; border: 0; outline: 0; font-size: 24px; font-weight: 800; }
.modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.share-modal { width: min(460px, calc(100vw - 28px)); }
.share-visual { width: 58px; height: 58px; margin: 24px auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.share-visual svg { width: 26px; }
.share-copy { color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.share-link-box { height: 42px; margin-top: 18px; padding-left: 10px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; }
.share-link-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--muted); background: transparent; font-size: 11px; }
.share-tip { margin: 12px 0 17px; padding: 10px; border-radius: 6px; display: flex; gap: 8px; color: #83560d; background: var(--amber-soft); font-size: 11px; line-height: 1.5; }
.share-tip svg { width: 16px; flex: 0 0 16px; }
.full-button { width: 100%; }
.confirm-modal { width: min(380px, calc(100vw - 28px)); text-align: center; }
.confirm-icon { width: 48px; height: 48px; margin: 4px auto 14px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }
.confirm-modal h2 { margin: 0; font-size: 18px; }
.confirm-modal p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.confirm-modal .modal-actions { justify-content: center; }
.access-modal { width: min(420px, calc(100vw - 28px)); }
.access-visual { width: 52px; height: 52px; margin: 24px auto 4px; border-radius: 50%; display: grid; place-items: center; color: var(--green); background: var(--green-soft); }
.access-visual svg { width: 23px; }
.form-error { margin: 8px 0 0; color: var(--red); font-size: 11px; }
.store-modal { width: min(520px, calc(100vw - 28px)); }
.store-editor-list { max-height: 320px; margin-top: 18px; overflow-y: auto; border-top: 1px solid var(--line); }
.store-editor-row { min-height: 58px; display: grid; grid-template-columns: 30px minmax(0, 1fr) 36px; gap: 9px; align-items: center; border-bottom: 1px solid var(--line); }
.store-number { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: #f1f1ee; font-size: 11px; font-weight: 700; }
.store-editor-row input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #dcdcd8; border-radius: 6px; outline: 0; }
.store-editor-row input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224, 46, 36, .09); }
.remove-store { color: var(--red); }
.remove-store:disabled { color: #c8c8c3; cursor: not-allowed; }
.add-store-button { width: 100%; margin-top: 12px; }
.public-store-note { margin-top: 14px; padding: 10px 12px; display: flex; align-items: flex-start; gap: 8px; border-radius: 6px; color: #685328; background: var(--amber-soft); font-size: 11px; line-height: 1.5; }
.public-store-note svg { width: 16px; flex: 0 0 16px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; min-height: 42px; padding: 0 15px; border-radius: 6px; display: flex; align-items: center; gap: 8px; color: #fff; background: #242522; box-shadow: var(--shadow); transform: translate(-50%, 80px); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 17px; color: #66cf82; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { width: 78px; padding-inline: 10px; }
  .brand { padding-inline: 11px; }
  .brand > div:last-child, .nav-item span:last-child, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .main-content { grid-column: 2; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .breakdown-panel { min-height: 230px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: flex-start; }
  .toolbar-left { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (max-width: 680px) {
  .app-shell { display: block; padding-bottom: 68px; }
  .sidebar { position: fixed; inset: auto 0 0 0; z-index: 20; width: auto; height: 62px; padding: 7px 8px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid #343531; }
  .brand, .sidebar-foot { display: none; }
  .nav-list { height: 100%; grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .nav-item { height: 48px; flex-direction: column; gap: 2px; font-size: 10px; }
  .nav-item span:last-child { display: block; }
  .nav-item.active { background: #383936; color: #fff; }
  .nav-icon, .nav-icon svg { width: 17px; height: 17px; }
  .main-content { padding: 18px 14px 12px; }
  .topbar { align-items: flex-start; margin-bottom: 18px; }
  h1 { font-size: 22px; }
  .eyebrow { display: none; }
  .header-actions .button { width: 39px; min-width: 39px; padding: 0; }
  .header-actions .button span:last-child { display: none; }
  .shared-banner { align-items: flex-start; }
  .shared-banner > div { align-items: flex-start; }
  .shared-banner .button { font-size: 11px; white-space: nowrap; }
  .migration-banner { align-items: flex-start; }
  .migration-banner > div { align-items: flex-start; }
  .migration-banner .button { font-size: 11px; white-space: nowrap; }
  .toolbar { flex-wrap: wrap; gap: 9px; }
  .toolbar-left { width: 100%; }
  .month-control { width: 100%; justify-content: space-between; }
  .range-segmented { width: 100%; }
  .range-segmented button { min-width: 0; flex: 1; padding-inline: 4px; }
  .store-filter { width: 100%; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  .cloud-status span { display: none; }
  .cloud-status { width: 34px; padding: 0; justify-content: center; }
  .kpi-grid { gap: 8px; }
  .kpi-card { padding: 14px; }
  .kpi-card > strong { font-size: 21px; }
  .dashboard-grid { gap: 8px; margin-top: 8px; }
  .panel { padding: 15px; }
  .recent-panel { margin-top: 8px; }
  .chart { height: 190px; gap: 5px; }
  .bar-area { gap: 2px; }
  .record-row { grid-template-columns: minmax(0, 1fr) auto 34px; gap: 7px; padding-block: 5px; }
  .record-meta { display: none; }
  .record-main { gap: 8px; }
  .category-icon { width: 31px; height: 31px; flex-basis: 31px; }
  .records-controls { align-items: stretch; flex-direction: column; }
  .segmented { display: flex; }
  .segmented button { flex: 1; }
  .search-box { width: 100%; max-width: none; }
  .report-summary { padding: 20px; display: block; }
  .report-ratio { width: 100%; margin-top: 20px; }
  .report-grid { grid-template-columns: 1fr; gap: 8px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .modal { padding: 18px; }
}

@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .kpi-card > strong { margin: 8px 0 5px; }
  .kpi-card p { grid-column: 1 / -1; }
  .export-action { width: 38px; padding: 0; }
  .export-action span:last-child { display: none; }
}
