:root {
  color-scheme: light;
  --app-bg: var(--tg-theme-bg-color, #f5f4ef);
  --app-surface: var(--tg-theme-secondary-bg-color, #fffefa);
  --app-surface-muted: #eeece5;
  --app-text: var(--tg-theme-text-color, #1c2821);
  --app-muted: var(--tg-theme-hint-color, #65736b);
  --app-accent: #d66c52;
  --app-accent-strong: #b44b3b;
  --app-accent-action: #b44b3b;
  --app-accent-action-hover: #963d30;
  --app-accent-soft: #f5e1da;
  --app-positive: #28755c;
  --app-positive-soft: #dfeee7;
  --app-negative: #b84f3e;
  --app-negative-soft: #f5e2dd;
  --app-warning: #956022;
  --app-line: rgba(42, 55, 47, .14);
  --app-line-strong: rgba(42, 55, 47, .24);
  --app-shadow: 0 12px 34px rgba(28, 40, 33, .08);
  --app-shadow-soft: 0 4px 16px rgba(28, 40, 33, .05);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --content-width: 1160px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: var(--tg-theme-bg-color, #151a17);
    --app-surface: var(--tg-theme-secondary-bg-color, #202721);
    --app-surface-muted: #29312c;
    --app-text: var(--tg-theme-text-color, #edf2ed);
    --app-muted: var(--tg-theme-hint-color, #a5afa8);
    --app-accent: #ef9078;
    --app-accent-strong: #f2b09c;
    --app-accent-action: #b44b3b;
    --app-accent-action-hover: #963d30;
    --app-positive: #72c9a0;
    --app-negative: #f08b78;
    --app-warning: #d6a05e;
    --app-accent-soft: #422a24;
    --app-positive-soft: #203a30;
    --app-negative-soft: #422925;
    --app-line: rgba(228, 238, 230, .14);
    --app-line-strong: rgba(228, 238, 230, .24);
    --app-shadow: 0 14px 34px rgba(0, 0, 0, .24);
    --app-shadow-soft: 0 5px 16px rgba(0, 0, 0, .18);
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--app-bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, dialog:focus-visible {
  outline: 3px solid rgba(214, 108, 82, .42);
  outline-offset: 2px;
}
svg { display: block; }
.hidden { display: none !important; }

.app-shell { width: min(100%, var(--content-width)); margin: 0 auto; padding: 0 22px 52px; }
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  padding: max(18px, env(safe-area-inset-top)) 0 16px;
}
.brand-lockup, .header-actions, .user-chip, .primary-nav, .nav-item, .period-toolbar, .period-presets, .period-inputs, .section-heading, .card-heading, .legend, .hero-metrics, .list-heading, .transaction-main, .transaction-meta, .transaction-actions, .review-row-main, .review-row-controls, .dialog-header, .data-note { display: flex; align-items: center; }
.brand-lockup { gap: 11px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--app-line-strong);
  border-radius: 12px;
  background: var(--app-surface);
  color: var(--app-accent);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-kicker, .eyebrow, .hero-label, .field-label {
  margin: 0;
  color: var(--app-muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 3px 0 0; font-size: 21px; letter-spacing: -.03em; line-height: 1.1; }
h2 { margin: 3px 0 0; font-size: clamp(22px, 3vw, 29px); letter-spacing: -.04em; line-height: 1.08; }
h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; line-height: 1.2; }
.header-actions { gap: 10px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: transparent;
  color: var(--app-muted);
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.icon-button:hover { border-color: var(--app-line-strong); background: var(--app-surface); color: var(--app-text); }
.icon-button svg { width: 20px; height: 20px; }
.user-chip { gap: 8px; padding: 3px 10px 3px 4px; border: 1px solid var(--app-line); border-radius: 999px; background: var(--app-surface); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--app-accent-soft); color: var(--app-accent-strong); font-weight: 760; }
.user-name { max-width: 110px; overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.primary-nav {
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  background: var(--app-surface-muted);
}
.nav-item {
  position: relative;
  min-height: 44px;
  gap: 8px;
  padding: 8px 15px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--app-muted);
  font-size: 13px;
  font-weight: 650;
  transition: background .16s ease, color .16s ease;
}
.nav-item:hover { color: var(--app-text); }
.nav-item.active { background: var(--app-surface); color: var(--app-text); box-shadow: var(--app-shadow-soft); }
.nav-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--app-accent-soft); color: var(--app-accent-strong); font-size: 11px; font-variant-numeric: tabular-nums; }

.period-toolbar {
  flex-wrap: wrap;
  gap: 13px 20px;
  justify-content: space-between;
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px solid var(--app-line);
  border-radius: var(--radius-md);
  background: var(--app-surface);
}
.period-title { display: grid; gap: 4px; min-width: 140px; }
.period-title strong { font-size: 14px; letter-spacing: -.01em; }
.period-presets { gap: 3px; padding: 3px; border-radius: 9px; background: var(--app-surface-muted); }
.preset-button { min-height: 44px; padding: 6px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--app-muted); font-size: 12px; font-weight: 650; }
.preset-button:hover { color: var(--app-text); }
.preset-button.active { background: var(--app-surface); color: var(--app-text); box-shadow: 0 1px 4px rgba(28, 40, 33, .08); }
.period-inputs { gap: 8px; }
.period-inputs label { display: flex; align-items: center; gap: 6px; color: var(--app-muted); font-size: 11px; font-weight: 650; }
.date-dash { color: var(--app-muted); }
input, select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--app-line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--app-bg);
  color: var(--app-text);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background: var(--app-surface);
}
.select-shell { position: relative; display: block; min-width: 0; }
.select-shell::after {
  position: absolute;
  top: 50%;
  right: 15px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--app-muted);
  border-bottom: 2px solid var(--app-muted);
  content: "";
  pointer-events: none;
  transform: translateY(-68%) rotate(45deg);
  transition: border-color .16s ease, transform .16s ease;
}
.select-shell:focus-within::after {
  border-color: var(--app-accent-strong);
}
.select-shell select:disabled { opacity: .58; }
.period-inputs input { width: 140px; min-height: 44px; padding: 7px 8px; font-size: 12px; }

.main-content { padding-top: 30px; }
.panel-section { min-width: 0; }
.section-heading { justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-description { max-width: 570px; margin: 9px 0 0; color: var(--app-muted); font-size: 13px; line-height: 1.5; }
.data-status, .read-only-label, .card-total { color: var(--app-muted); font-size: 11px; font-weight: 650; }
.data-status { padding: 6px 9px; border: 1px solid var(--app-line); border-radius: 999px; white-space: nowrap; }
.data-status.ready { border-color: rgba(40, 117, 92, .24); background: var(--app-positive-soft); color: var(--app-positive); }
.data-status.loading { color: var(--app-warning); }

.hero-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 23px 24px 20px;
  border-radius: var(--radius-lg);
  background: #22332a;
  color: #f5f4ef;
  box-shadow: var(--app-shadow);
}
.hero-card::after { position: absolute; right: -38px; bottom: -70px; width: 220px; height: 220px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 50%; content: ""; }
.hero-copy { position: relative; z-index: 1; display: grid; gap: 7px; }
.hero-label { color: rgba(245, 244, 239, .62); }
.hero-value { font-size: clamp(34px, 6vw, 54px); font-variant-numeric: tabular-nums; letter-spacing: -.055em; line-height: .98; }
.hero-caption { color: rgba(245, 244, 239, .68); font-size: 12px; }
.hero-status { position: absolute; top: 22px; right: 23px; z-index: 1; padding: 7px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: rgba(245,244,239,.84); font-size: 11px; }
.hero-status.positive { background: rgba(106, 188, 148, .14); color: #a9e0c6; }
.hero-status.negative { background: rgba(238, 137, 111, .14); color: #f4b09d; }
.hero-metrics { position: relative; z-index: 1; gap: 0; margin-top: 25px; border-top: 1px solid rgba(255,255,255,.13); }
.hero-metric { display: grid; flex: 1; gap: 6px; min-width: 0; padding: 14px 16px 0 0; }
.hero-metric + .hero-metric { padding-left: 16px; border-left: 1px solid rgba(255,255,255,.13); }
.hero-metric span { color: rgba(245,244,239,.62); font-size: 11px; }
.hero-metric strong { overflow: hidden; color: #fff; font-size: 16px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-grid { display: grid; gap: 14px; }
.dashboard-grid-main { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); }
.dashboard-grid-secondary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 14px; }
.surface { min-width: 0; padding: 18px; border: 1px solid var(--app-line); border-radius: var(--radius-md); background: var(--app-surface); }
.card-heading { justify-content: space-between; gap: 12px; margin-bottom: 19px; }
.card-heading > div:first-child { min-width: 0; }
.muted { margin: 5px 0 0; color: var(--app-muted); font-size: 12px; line-height: 1.4; }
.legend { flex-wrap: wrap; gap: 8px 12px; color: var(--app-muted); font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.income-dot { background: #61a987; }
.expense-dot { background: var(--app-accent); }

.daily-chart { display: flex; align-items: end; gap: 4px; height: 196px; padding: 7px 0 0; border-bottom: 1px solid var(--app-line); }
.chart-bar { display: flex; align-items: end; justify-content: center; flex: 1; min-width: 3px; height: 100%; border-radius: 5px 5px 0 0; }
.chart-bar:hover { background: var(--app-surface-muted); }
.bar-pair { display: flex; align-items: end; justify-content: center; gap: 2px; width: 100%; height: 100%; padding: 0 1px; }
.bar { display: block; width: min(12px, 40%); min-height: 0; border-radius: 3px 3px 0 0; transition: height .2s ease; }
.bar.income { background: #61a987; }
.bar.expense { background: var(--app-accent); }
.chart-labels { display: flex; gap: 4px; margin-top: 7px; color: var(--app-muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.chart-labels span { flex: 1; min-width: 0; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.chart-labels span:nth-child(2n) { visibility: hidden; }
.chart-hint { min-height: 18px; margin: 10px 0 0; color: var(--app-muted); font-size: 11px; }

.category-list { display: grid; gap: 17px; }
.category-row { display: grid; gap: 7px; }
.category-row-head, .category-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.category-row-head { font-size: 12px; font-weight: 650; }
.category-name { display: flex; align-items: center; min-width: 0; gap: 8px; overflow: hidden; }
.category-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--app-accent); }
.category-share { color: var(--app-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.progress-track { overflow: hidden; height: 6px; border-radius: 999px; background: var(--app-surface-muted); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--app-accent); }
.category-row-foot { color: var(--app-muted); font-size: 11px; }
.category-row-foot strong { color: var(--app-text); font-variant-numeric: tabular-nums; }

.account-list, .recent-list { display: grid; gap: 0; }
.account-row, .recent-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 12px 0; border-top: 1px solid var(--app-line); }
.account-row:first-child, .recent-row:first-child { padding-top: 0; border-top: 0; }
.account-info, .recent-info { display: grid; min-width: 0; gap: 4px; }
.account-name, .recent-merchant { overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.account-sub, .recent-sub { overflow: hidden; color: var(--app-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-values, .recent-values { display: grid; flex: 0 0 auto; justify-items: end; gap: 4px; text-align: right; }
.account-net, .recent-amount { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 720; white-space: nowrap; }
.account-net.positive, .recent-amount.income { color: var(--app-positive); }
.account-net.negative, .recent-amount.expense { color: var(--app-negative); }
.account-net.neutral, .recent-amount.transfer { color: var(--app-muted); }
.account-count, .recent-date { color: var(--app-muted); font-size: 10px; }
.recent-row { width: 100%; border-right: 0; border-bottom: 0; border-left: 0; background: transparent; color: inherit; text-align: left; }
button.recent-row:hover .recent-merchant { color: var(--app-accent-strong); }
.text-button { min-height: 44px; padding: 5px 0 5px 8px; border: 0; background: transparent; color: var(--app-accent-strong); font-size: 11px; font-weight: 700; white-space: nowrap; }
.text-button:hover { color: var(--app-accent); text-decoration: underline; }
.data-note { align-items: flex-start; gap: 7px; margin: 18px 2px 0; color: var(--app-muted); font-size: 11px; line-height: 1.45; }
.note-icon { flex: 0 0 15px; color: var(--app-muted); }
.note-icon svg { width: 15px; height: 15px; }

.button { min-height: 44px; padding: 9px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 12px; font-weight: 720; transition: background .16s ease, border-color .16s ease, color .16s ease, transform .08s ease; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--app-accent-action); color: #fff; }
.button-primary:hover { background: var(--app-accent-action-hover); }
.button-primary:disabled { opacity: .45; }
.button-secondary { border-color: var(--app-line); background: transparent; color: var(--app-text); }
.button-secondary:hover { border-color: var(--app-line-strong); background: var(--app-surface-muted); }

.filter-surface, .review-toolbar { display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(130px, 1fr)) auto; align-items: end; gap: 10px; margin-bottom: 16px; }
.review-toolbar { grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto; }
.filter-surface label, .review-toolbar label { display: grid; gap: 6px; min-width: 0; }
.field-label { letter-spacing: .06em; }
.search-field input { background: var(--app-surface); }
.list-heading { justify-content: space-between; gap: 12px; margin: 13px 2px 10px; color: var(--app-text); font-size: 12px; font-weight: 650; }
.transaction-list, .review-list { display: grid; gap: 8px; }
.transaction-row, .review-row { min-width: 0; border: 1px solid var(--app-line); border-radius: var(--radius-md); background: var(--app-surface); }
.transaction-row { padding: 0 15px; }
.transaction-main { width: 100%; min-height: 72px; justify-content: space-between; gap: 18px; padding: 12px 0; border: 0; background: transparent; text-align: left; }
.transaction-main:hover .transaction-title { color: var(--app-accent-strong); }
.transaction-copy { display: grid; min-width: 0; gap: 5px; }
.transaction-title { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.transaction-description { overflow: hidden; color: var(--app-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-meta { flex-wrap: wrap; gap: 5px 8px; color: var(--app-muted); font-size: 10px; }
.meta-divider::before { content: "·"; margin-right: 8px; color: var(--app-line-strong); }
.transaction-values { display: grid; flex: 0 0 auto; justify-items: end; gap: 5px; }
.transaction-amount { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
.transaction-amount.expense { color: var(--app-negative); }
.transaction-amount.income { color: var(--app-positive); }
.transaction-amount.transfer { color: var(--app-muted); }
.transaction-type { display: inline-flex; align-items: center; gap: 4px; color: var(--app-muted); font-size: 10px; }
.type-marker { width: 6px; height: 6px; border-radius: 50%; background: var(--app-muted); }
.type-marker.expense { background: var(--app-negative); }
.type-marker.income { background: var(--app-positive); }
.type-marker.transfer { background: var(--app-muted); }
.notice { margin: 10px 0; padding: 11px 13px; border: 1px solid var(--app-line); border-radius: var(--radius-sm); font-size: 12px; line-height: 1.4; }
.notice-error { border-color: rgba(196, 87, 70, .3); background: var(--app-negative-soft); color: var(--app-negative); }
.notice-success { border-color: rgba(40, 117, 92, .3); background: var(--app-positive-soft); color: var(--app-positive); }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 48px 16px; color: var(--app-muted); text-align: center; }
.empty-state strong { color: var(--app-text); font-size: 14px; }
.empty-state span:not(.empty-icon) { font-size: 12px; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px; border: 1px solid var(--app-line); border-radius: 14px; color: var(--app-muted); }
.empty-icon svg { width: 23px; height: 23px; }
.empty-state .button { margin-top: 8px; }
.more-button { display: block; width: 100%; margin-top: 12px; }

.review-heading { align-items: flex-start; }
.review-row { padding: 15px; }
.review-row-main { align-items: flex-start; justify-content: space-between; gap: 15px; }
.review-copy { display: grid; min-width: 0; gap: 6px; }
.review-title { overflow-wrap: anywhere; font-size: 14px; font-weight: 720; }
.review-description { color: var(--app-muted); font-size: 11px; line-height: 1.4; }
.review-details { display: flex; flex-wrap: wrap; gap: 5px 10px; color: var(--app-muted); font-size: 10px; }
.review-amount { flex: 0 0 auto; font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 760; white-space: nowrap; }
.review-amount.expense { color: var(--app-negative); }
.review-amount.income { color: var(--app-positive); }
.review-amount.transfer { color: var(--app-muted); }
.review-row-controls { align-items: stretch; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--app-line); }
.review-select { flex: 1 1 150px; min-width: 0; }
.review-select:disabled { opacity: .58; }
.select-label { display: grid; flex: 1 1 180px; gap: 5px; color: var(--app-muted); font-size: 10px; font-weight: 650; }
.review-confirm { flex: 0 0 auto; }

.list-loading { display: grid; gap: 8px; }
.list-loading span, .skeleton { display: block; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--app-surface-muted), var(--app-surface), var(--app-surface-muted)); background-size: 200% 100%; animation: skeleton-shift 1.4s ease-in-out infinite; }
.list-loading span { height: 72px; border: 1px solid var(--app-line); }
.loading-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 14px; }
.skeleton { min-height: 170px; border: 1px solid var(--app-line); }
.skeleton-hero { grid-column: span 3; min-height: 208px; background-color: #22332a; }
.skeleton-card { min-height: 280px; }
@keyframes skeleton-shift { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.inline-empty { padding: 13px 0; color: var(--app-muted); font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 10; max-width: min(360px, calc(100vw - 40px)); padding: 12px 14px; border: 1px solid var(--app-line-strong); border-radius: 12px; background: var(--app-text); color: var(--app-bg); font-size: 12px; line-height: 1.4; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--app-negative); color: #fff; }

.detail-dialog { width: min(580px, calc(100% - 28px)); max-height: min(84vh, 720px); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--app-line-strong); border-radius: var(--radius-lg); background: var(--app-surface); color: var(--app-text); box-shadow: var(--app-shadow); }
.detail-dialog::backdrop { background: rgba(15, 24, 19, .48); }
.dialog-inner { max-height: min(84vh, 720px); overflow: auto; padding: 20px; }
.dialog-header { justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.dialog-header .icon-button { flex: 0 0 44px; }
.detail-hero { display: grid; gap: 6px; margin-bottom: 19px; padding-bottom: 17px; border-bottom: 1px solid var(--app-line); }
.detail-amount { font-size: 30px; font-variant-numeric: tabular-nums; font-weight: 760; letter-spacing: -.045em; }
.detail-amount.expense { color: var(--app-negative); }
.detail-amount.income { color: var(--app-positive); }
.detail-amount.transfer { color: var(--app-muted); }
.detail-grid { display: grid; grid-template-columns: minmax(100px, .36fr) minmax(0, 1fr); gap: 11px 16px; margin: 0; font-size: 12px; }
.detail-grid dt { color: var(--app-muted); }
.detail-grid dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.correction-history { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--app-line); }
.correction-history h3 { margin-bottom: 10px; }
.correction-event { padding: 9px 0; border-top: 1px solid var(--app-line); color: var(--app-muted); font-size: 11px; line-height: 1.45; }
.correction-event strong { color: var(--app-text); font-weight: 650; }

@media (max-width: 860px) {
  .app-shell { padding-right: 16px; padding-left: 16px; }
  .dashboard-grid-main, .dashboard-grid-secondary { grid-template-columns: 1fr; }
  .filter-surface { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-surface .search-field, .filter-surface .button { grid-column: span 2; }
  .review-toolbar { grid-template-columns: minmax(0, 1fr) minmax(140px, .6fr); }
  .review-toolbar .button { grid-column: span 2; }
}

@media (max-width: 600px) {
  .app-shell { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .app-header { min-height: 76px; padding-top: max(13px, env(safe-area-inset-top)); }
  .user-name { display: none; }
  .primary-nav { position: sticky; top: 8px; z-index: 4; justify-content: space-between; margin: 0 -2px; box-shadow: var(--app-shadow-soft); }
  .nav-item { flex: 1; justify-content: center; padding-right: 7px; padding-left: 7px; font-size: 11px; }
  .nav-item .nav-icon { width: 16px; height: 16px; }
  .nav-item .nav-icon svg { width: 16px; height: 16px; }
  .period-toolbar { align-items: stretch; padding: 12px; }
  .period-title { flex: 1 1 100%; }
  .period-presets { flex: 1; }
  .preset-button { flex: 1; padding-right: 6px; padding-left: 6px; }
  .period-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    gap: 8px 10px;
  }
  .period-inputs label {
    display: grid;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
  }
  .period-inputs .date-dash { display: none; }
  .period-inputs input { width: 100%; min-width: 0; }
  .period-inputs .button {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    padding-right: 11px;
    padding-left: 11px;
  }
  .main-content { padding-top: 24px; }
  .section-heading { align-items: flex-start; }
  .section-heading .data-status { margin-top: 3px; }
  .hero-card { padding: 20px 17px 17px; }
  .hero-value { font-size: 38px; }
  .hero-status { top: 19px; right: 17px; }
  .hero-metrics { flex-wrap: wrap; margin-top: 22px; }
  .hero-metric { flex: 1 1 50%; padding-top: 12px; }
  .hero-metric:nth-child(3) { padding-left: 0; border-left: 0; }
  .hero-metric:nth-child(n+3) { margin-top: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.13); }
  .hero-metric:nth-child(4) { padding-left: 16px; border-left: 1px solid rgba(255,255,255,.13); }
  .surface { padding: 15px; }
  .card-heading { align-items: flex-start; }
  .legend { display: grid; gap: 5px; }
  .daily-chart { height: 165px; gap: 2px; }
  .chart-labels { gap: 2px; }
  .chart-labels span:nth-child(2n) { visibility: hidden; }
  .filter-surface, .review-toolbar { grid-template-columns: 1fr; }
  .filter-surface .search-field, .filter-surface .button, .review-toolbar .button { grid-column: auto; }
  .review-heading { display: grid; }
  .review-row-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .review-select, .select-label { width: 100%; }
  .review-confirm { grid-column: span 2; width: 100%; }
  .transaction-main { gap: 11px; }
  .transaction-title, .transaction-description { max-width: 58vw; }
  .transaction-meta { gap: 3px 6px; }
  .meta-divider::before { margin-right: 6px; }
  .account-row, .recent-row { gap: 8px; }
  .account-name, .recent-merchant { max-width: 55vw; }
  .loading-grid { grid-template-columns: 1fr; }
  .skeleton-hero { grid-column: auto; }
  .skeleton-card { min-height: 220px; }
  .detail-grid { grid-template-columns: 92px minmax(0, 1fr); gap: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
