:root {
  color-scheme: light;
  --ink: #14252a;
  --muted: #607277;
  --deep: #102a2e;
  --teal: #1c5b5d;
  --teal-soft: #dcebea;
  --paper: #ffffff;
  --canvas: #f2f5f2;
  --line: #dce4df;
  --amber: #f0b949;
  --amber-soft: #fff3d6;
  --danger: #a34343;
  --danger-soft: #f8e6e3;
  --shopping-title: #edf7ec;
  --shopping-list: #e8f3f8;
  --shopping-suggestions: #f1f0f5;
  --shopping-card-shadow: 0 7px 18px rgba(25, 56, 62, 0.11);
  --shadow: 0 18px 48px rgba(20, 46, 48, 0.08);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[dir="rtl"] body,
body.arabic-interface { direction: rtl; }
html[dir="rtl"] .sidebar { border-left: 0; border-right: 1px solid var(--line); }
html[dir="rtl"] .page-heading,
html[dir="rtl"] .panel-heading,
html[dir="rtl"] .dialog-heading { text-align: right; }
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea,
html[dir="rtl"] button { font-family: inherit; }
html[dir="rtl"] .chart,
html[dir="rtl"] .chart svg,
html[dir="rtl"] .insight-chart { direction: ltr; }
html[dir="rtl"] .transaction-amount { text-align: left; }
html[dir="rtl"] .shopping-item-copy { text-align: center; }

* { box-sizing: border-box; }
[hidden], .permission-hidden { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="file"] { cursor: pointer; }
button { min-height: 44px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(28, 91, 93, 0.28);
  outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(2.25rem, 6vw, 4.8rem); line-height: 0.98; letter-spacing: -0.055em; }
h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1; letter-spacing: -0.045em; }
h3 { margin-bottom: 0; font-size: 1.12rem; letter-spacing: -0.02em; }

.eyebrow, .panel-kicker {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 12px 24px rgba(16, 42, 46, 0.18);
}
.brand-mark img { width: 112%; height: 112%; max-width: none; object-fit: cover; }
.brand-mark.compact { width: 44px; height: 44px; border-radius: 13px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 520px);
  gap: clamp(36px, 8vw, 120px);
  align-items: center;
  padding: clamp(28px, 7vw, 110px);
  background:
    radial-gradient(circle at 16% 18%, rgba(92, 157, 148, 0.28), transparent 32%),
    linear-gradient(135deg, #eaf1ed 0%, #f8faf8 55%, #eef3ef 100%);
}
.brand-block { max-width: 670px; }
.brand-block .brand-mark { margin-bottom: clamp(32px, 8vh, 84px); }
.login-copy { max-width: 460px; color: var(--muted); font-size: 1.2rem; line-height: 1.6; }
.login-card {
  display: grid;
  gap: 20px;
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid rgba(220, 228, 223, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

label { display: grid; gap: 8px; color: #385056; font-size: 0.82rem; font-weight: 750; }
input, select {
  min-width: 0;
  min-height: 46px;
  width: 100%;
  border: 1px solid #cdd9d3;
  border-radius: 12px;
  padding: 10px 13px;
  color: var(--ink);
  background: #fff;
}
input::placeholder { color: #91a09d; }

.primary-button, .secondary-button, .danger-button, .icon-button, .nav-button {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}
.primary-button { padding: 11px 18px; color: #f7fffc; background: var(--deep); }
.primary-button:hover { background: #174248; }
.secondary-button { padding: 10px 16px; color: var(--teal); background: var(--teal-soft); }
.secondary-button:hover { background: #cde1df; }
.danger-button { padding: 10px 16px; color: var(--danger); background: var(--danger-soft); }
.icon-button { width: 44px; padding: 0; color: var(--ink); background: #edf2ef; font-size: 1.15rem; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
.form-error { min-height: 1.15em; margin-bottom: 0; color: var(--danger); font-size: 0.86rem; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  color: #e8f4ef;
  background: var(--deep);
}
.sidebar-brand { display: flex; gap: 13px; align-items: center; padding: 0 7px 36px; }
.sidebar-brand .brand-mark { box-shadow: none; }
.sidebar-brand div:last-child { display: grid; line-height: 1.05; }
.sidebar-brand span { color: #98b5af; font-size: 0.88rem; }
.primary-nav { display: grid; gap: 6px; }
.nav-button {
  display: flex;
  gap: 13px;
  align-items: center;
  justify-content: flex-start;
  padding: 0 14px;
  color: #bcd0cb;
  background: transparent;
  text-align: left;
}
.nav-button span { width: 21px; font-size: 1.2rem; text-align: center; }
.nav-button .notification-nav-count { min-width: 22px; margin-left: auto; border-radius: 999px; padding: 2px 6px; color: #173d42; background: #f2cc72; font-size: 0.68rem; text-align: center; }
.nav-button:hover, .nav-button.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.sidebar-user { display: grid; gap: 3px; margin-top: auto; padding: 18px 12px 0; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-user span { color: #91aca6; font-size: 0.78rem; text-transform: capitalize; }
.mobile-header, .bottom-nav, .bottom-nav-menu { display: none; }

.main-content { min-height: 100vh; margin-left: 248px; padding: clamp(30px, 5vw, 72px); }
.view { max-width: 1280px; margin: 0 auto; }
.module-switcher {
  position: sticky;
  z-index: 16;
  top: 0;
  max-width: 760px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  margin: 0 auto 24px;
  border: 1px solid #cddbd9;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 5px 14px rgba(25, 56, 62, 0.08);
  backdrop-filter: blur(14px);
}
.module-switcher.single-module { grid-template-columns: 1fr; }
.module-tab {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  padding: 6px 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 800;
}
.module-tab + .module-tab { border-left: 1px solid #d9e3e1; }
.module-tab:hover { background: #f5f8f7; }
.module-tab.active { color: var(--teal); background: var(--teal-soft); }
.page-heading { display: flex; gap: 24px; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.heading-actions { display: flex; gap: 10px; align-items: center; }
.panel-heading-actions { display: flex; gap: 8px; align-items: end; justify-content: flex-end; flex-wrap: wrap; }
.danger-outline { border-color: #d9a6a0; color: var(--danger); background: #fff7f6; }
.compact-field { width: min(180px, 40vw); }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(30, 59, 57, 0.045);
}
.panel-heading { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.spending-progress-panel { margin-bottom: 16px; }
.spending-progress-heading { display: flex; gap: 18px; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.spending-progress-settings { display: flex; gap: 10px; align-items: end; justify-content: flex-end; flex-wrap: wrap; }
.spending-progress-settings label { width: min(190px, 100%); }
.spending-progress-settings button { min-height: 43px; }
.spending-progress-list { display: grid; gap: 18px; }
.spending-progress-item { display: grid; gap: 8px; }
.spending-progress-summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 12px; align-items: baseline; }
.spending-progress-summary span { color: var(--muted); text-align: center; }
.spending-progress-summary b { color: var(--teal); font-variant-numeric: tabular-nums; }
.spending-progress-track { height: 18px; overflow: hidden; border-radius: 999px; background: #e3ece9; box-shadow: inset 0 1px 2px rgba(25,56,62,.09); }
.spending-progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#3b8b82,var(--teal)); transition: width 350ms ease-out; }
.spending-progress-detail { color: var(--muted); font-weight: 700; }
.spending-progress-item.over-target .spending-progress-fill { background: linear-gradient(90deg,#d56b61,var(--danger)); }
.spending-progress-item.over-target .spending-progress-summary b, .spending-progress-item.over-target .spending-progress-detail { color: var(--danger); }
.metric-card { min-height: 146px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card .metric-label { color: var(--muted); font-size: 0.82rem; font-weight: 750; }
.metric-card strong { font-size: clamp(1.7rem, 3vw, 2.75rem); letter-spacing: -0.05em; }
.metric-card small { color: var(--muted); }
.empty-metric { grid-column: 1 / -1; color: var(--muted); }

.attention-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-color: #f1d184;
  background: var(--amber-soft);
}
.attention-panel > div { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; }
.attention-panel .panel-kicker { width: 100%; margin-bottom: 0; color: #82611e; }
.attention-panel strong { font-size: 1.7rem; }
.attention-panel span { color: #705b2f; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr); gap: 16px; }
.budget-scope { margin: -12px 0 22px; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.budget-dashboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.budget-list { display: grid; gap: 15px; }
.budget-row { display: grid; gap: 8px; padding: 13px 0; border-top: 1px solid #edf1ee; }
.budget-row:first-child { border-top: 0; padding-top: 0; }
.budget-row-heading { display: flex; gap: 16px; align-items: start; justify-content: space-between; }
.budget-row-copy { min-width: 0; display: grid; gap: 3px; }
.budget-row-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-row-copy span, .budget-row-values span, .budget-rollover-note { color: var(--muted); font-size: 0.72rem; }
.budget-row-values { flex: 0 0 auto; display: grid; gap: 3px; text-align: right; font-variant-numeric: tabular-nums; }
.budget-row-values strong { font-size: 0.8rem; }
.budget-row.over-budget .budget-row-values span { color: var(--danger); font-weight: 800; }
.budget-progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #edf1ee; }
.budget-progress-fill { height: 100%; min-width: 0; border-radius: inherit; background: var(--teal); }
.budget-progress-fill.over { background: var(--danger); }
.budget-rollover-note { display: block; }
.budget-over-card { border-color: #e4b5ae; background: #fffafa; }
.budget-admin-panel { margin-top: 16px; }
.budget-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; margin-bottom: 14px; }
.budget-rollover-field { grid-column: span 3; }
.budget-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.budget-limit-list { margin-top: 20px; }
.danger-small { color: var(--danger); background: var(--danger-soft); }

.chart-stack, .category-stack { display: grid; gap: 22px; }
.chart-group, .category-group { display: grid; gap: 12px; }
.chart-group-title { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.month-row { display: grid; grid-template-columns: 38px minmax(70px, 1fr) 94px; gap: 10px; align-items: center; font-size: 0.78rem; }
.month-track { height: 9px; overflow: hidden; border-radius: 999px; background: #edf1ee; }
.month-bar { height: 100%; min-width: 2px; border-radius: inherit; background: var(--teal); }
.month-bar.negative { background: #75a4a2; }
.month-value { color: #425a5e; text-align: right; font-variant-numeric: tabular-nums; }
.category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
button.category-row { width: 100%; border: 0; border-radius: 10px; padding: 7px 8px; color: inherit; background: transparent; text-align: left; }
button.category-row:hover, button.category-row:focus-visible { background: var(--teal-soft); outline: none; }
.category-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-row strong { font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.muted-copy, .empty-copy { color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.empty-copy { padding: 22px 0; text-align: center; }

.count-badge, .status-badge, .category-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #385052;
  background: #e8efeb;
  font-size: 0.73rem;
  font-weight: 800;
}
.count-badge { min-width: 42px; color: var(--teal); background: var(--teal-soft); font-size: 0.9rem; }
button.category-chip { border: 0; }
button.category-chip:hover, button.category-chip:focus-visible { color: #fff; background: var(--teal); outline: none; }
.status-badge.warning { color: #75570e; background: var(--amber-soft); }
.status-badge.success { color: #286246; background: #dff0e4; }
.status-badge.muted { color: #667571; background: #edf0ee; }

.toolbar { display: flex; gap: 20px; align-items: end; margin-bottom: 14px; padding-block: 18px; }
.search-field { flex: 1; }
.check-field { display: flex; flex-direction: row; gap: 9px; align-items: center; min-height: 46px; }
.check-field input { width: 18px; min-height: 18px; accent-color: var(--teal); }
.transaction-list, .statement-list, .receipt-library { display: grid; gap: 10px; }
.receipt-library-note { margin: -2px 2px 14px; }
.receipt-store-group { display: grid; gap: 9px; }
.receipt-store-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 2px 0; }
.receipt-store-heading h3 { margin: 0; font-size: 1rem; }
.receipt-library-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 15px 18px; background: var(--paper); }
.receipt-library-copy { min-width: 0; }
.receipt-library-copy strong { display: block; }
.receipt-library-meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 0.75rem; }
.receipt-library-items { margin: 8px 0 0; color: #385052; font-size: 0.78rem; line-height: 1.45; overflow-wrap: anywhere; }
.receipt-library-actions { display: flex; gap: 8px; align-items: center; }

@media (max-width: 720px) {
  .receipt-library-item { grid-template-columns: 1fr; }
  .receipt-library-actions a { width: 100%; text-align: center; }
}
.transaction-item, .statement-item {
  display: grid;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--paper);
}
.transaction-item { grid-template-columns: 90px minmax(0, 1fr) auto auto; }
.transaction-item.needs-review { border-color: #efcf80; box-shadow: inset 4px 0 0 var(--amber); }
.transaction-date { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.transaction-copy, .statement-copy { min-width: 0; }
.transaction-copy strong, .statement-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-title-inspector { position: relative; display: block; min-width: 0; }
.transaction-title-trigger {
  display: block; width: 100%; overflow: hidden; border: 0; padding: 0; color: inherit; background: transparent;
  font: inherit; font-weight: 850; text-align: left; text-decoration: underline dotted #8aa29f;
  text-decoration-thickness: 1px; text-underline-offset: 3px; text-overflow: ellipsis; white-space: nowrap; cursor: help;
}
.transaction-title-trigger:focus-visible { border-radius: 3px; outline: 2px solid var(--teal); outline-offset: 3px; }
.transaction-description-tooltip {
  position: absolute; z-index: 30; top: calc(100% + 7px); left: 0; width: max-content;
  max-width: min(34rem, calc(100vw - 40px)); border: 1px solid #385b57; border-radius: 9px; padding: 9px 11px;
  color: #fff; background: #193d39; box-shadow: 0 8px 24px rgb(16 44 41 / 22%);
  font-size: 0.8rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; white-space: normal;
}
.transaction-meta, .statement-meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 0.75rem; }
.transaction-amount { min-width: 105px; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.transaction-item.cash-inflow { background: #f1faf4; border-color: #cce6d5; }
.transaction-item.needs-review.cash-inflow { border-color: #efcf80; }
.transaction-amount.inflow { color: #287052; }
.small-action { min-height: 38px; padding: 7px 11px; border: 0; border-radius: 10px; color: var(--teal); background: var(--teal-soft); font-size: 0.75rem; font-weight: 850; }
.transaction-actions { display: flex; gap: 7px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.transaction-action-menu { position: relative; }
.transaction-action-menu summary { width: 38px; min-height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); cursor: pointer; font-size: 1.35rem; font-weight: 900; list-style: none; }
.transaction-action-menu summary::-webkit-details-marker { display: none; }
.transaction-action-menu summary:hover, .transaction-action-menu[open] summary { color: var(--teal); background: var(--teal-soft); }
.transaction-action-popover { position: absolute; z-index: 18; top: calc(100% + 4px); right: 0; width: 180px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 13px; padding: 6px; background: #fff; box-shadow: 0 14px 34px rgba(15, 44, 49, 0.2); }
.transaction-action-popover .small-action { width: 100%; justify-content: flex-start; text-align: left; }
.transaction-action-popover .transaction-delete-action { color: var(--danger); background: #fff2ef; border: 1px solid #efd0ca; }
.merchant-button { border: 0; padding: 0; color: var(--teal); background: transparent; font-weight: 850; text-align: left; text-decoration: underline; text-decoration-color: #a9cac6; text-underline-offset: 3px; }

.upload-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: stretch; margin-bottom: 18px; }
.upload-panel p { margin: 7px 0 0; color: var(--muted); font-size: 0.85rem; }
.statement-picker-actions, .upload-queue-footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.file-picker { position: relative; display: inline-flex; min-height: 44px; align-items: center; justify-content: center; overflow: hidden; border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; color: var(--teal); background: var(--teal-soft); font-weight: 850; transition: transform 90ms ease, border-color 90ms ease, background 90ms ease; }
.file-picker:hover { border-color: #9fc6c1; }
.file-picker:active { transform: translateY(1px) scale(0.985); background: #d5e8e5; }
.file-picker.has-selection { border-color: var(--teal); background: #dcefed; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.statement-upload-queue { display: grid; gap: 8px; }
.statement-upload-queue .empty-copy { padding: 12px 0; }
.statement-upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfcfb; }
.statement-upload-copy { min-width: 0; display: grid; gap: 3px; }
.statement-upload-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; }
.statement-upload-copy span { color: var(--muted); font-size: 0.72rem; }
.statement-upload-status { min-width: 88px; text-align: right; font-size: 0.73rem; font-weight: 850; }
.statement-upload-status.ready { color: var(--teal); }
.statement-upload-status.warning { color: #8b6413; }
.statement-upload-status.error { color: var(--danger); }
.statement-upload-remove { width: 34px; min-height: 34px; border: 0; border-radius: 9px; color: var(--danger); background: var(--danger-soft); font-weight: 900; }
.statement-upload-remove.cancel-upload { width: auto; min-width: 64px; padding: 0 10px; }
.upload-queue-footer { padding-top: 2px; }
.upload-queue-footer > span { color: var(--muted); font-size: 0.8rem; font-weight: 750; }
.statement-item { grid-template-columns: minmax(0, 1fr) auto; }
.statement-period { font-variant-numeric: tabular-nums; }
.statement-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.statement-actions a { display: inline-grid; min-height: 40px; place-items: center; border-radius: 10px; padding: 8px 12px; color: var(--teal); background: var(--teal-soft); font-size: 0.78rem; font-weight: 850; text-decoration: none; }

.shopping-layout { display: grid; grid-template-columns: 1fr; gap: 4px; align-items: start; }
.shopping-list-browser { min-width: 0; }
.shopping-list-tabs {
  min-width: 0; display: flex; gap: 7px; align-items: stretch; overflow-x: auto; overflow-y: hidden;
  padding: 1px 2px 3px; overscroll-behavior-inline: contain; scroll-snap-type: inline proximity;
  scrollbar-width: none; touch-action: pan-x;
}
.shopping-list-tabs::-webkit-scrollbar { display: none; }
.shopping-list-tab {
  flex: 0 0 auto; min-width: 92px; max-width: min(280px, 70vw); min-height: 44px; display: flex; align-items: center;
  justify-content: center; border: 1px solid var(--line); border-radius: 13px; padding: 8px 14px; color: var(--ink);
  background: #fff; font-size: 0.86rem; font-weight: 850; text-align: center; white-space: nowrap; scroll-snap-align: start;
}
.shopping-list-tab:hover { border-color: #9fc6c1; background: var(--teal-soft); }
.shopping-list-tab.active {
  min-width: 0; justify-content: stretch; gap: 1px; padding: 0 3px 0 0; border-color: var(--teal); color: #fff;
  background: var(--teal); box-shadow: var(--shopping-card-shadow);
}
.shopping-list-tab-label {
  min-width: 0; min-height: 42px; max-width: min(235px, 60vw); overflow: hidden; border: 0; padding: 8px 10px 8px 14px;
  color: inherit; background: transparent; font: inherit; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.shopping-list-add-tab { min-width: 48px; width: 48px; padding-inline: 0; font-size: 1.35rem; font-weight: 650; }
.shopping-recovery-area { margin-top: 8px; padding: 11px 13px; }
.shopping-list-cards { display: grid; gap: 8px; }
.shopping-list-card-copy { min-width: 0; display: grid; gap: 3px; }
.shopping-list-card-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shopping-list-card-copy small, .shopping-item-copy span { color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
.shopping-recovery-heading { margin-bottom: 7px; }
.shopping-recovery-card { display: flex; gap: 10px; align-items: center; justify-content: space-between; border-top: 1px solid #edf1ee; padding: 11px 0; }
.shopping-recovery-card:first-child { border-top: 0; }
.shopping-workspace { min-width: 0; display: grid; gap: 4px; }
.shopping-empty-workspace { min-height: 220px; display: grid; align-content: center; justify-items: center; text-align: center; }
.shopping-empty-workspace p { max-width: 540px; margin-top: 10px; }
.shopping-clear-button {
  min-height: 38px; border: 1px solid #97cdb2; border-radius: 11px; padding: 6px 11px;
  color: #258554; background: #f8fffb; font-size: 0.8rem; font-weight: 850; white-space: nowrap;
}
.shopping-clear-button:hover { border-color: #6fb590; background: #edf9f1; }
.shopping-clear-button:disabled { opacity: 0.5; }
.shopping-list-menu { position: relative; flex: 0 0 auto; color: var(--ink); }
.shopping-list-menu summary {
  width: 35px; min-height: 42px; display: grid; place-items: center; border-radius: 10px;
  color: #fff; cursor: pointer; font-size: 1.35rem; font-weight: 900; list-style: none;
}
.shopping-list-menu summary::-webkit-details-marker { display: none; }
.shopping-list-menu summary:hover, .shopping-list-menu[open] summary { background: rgba(255, 255, 255, 0.15); }
.shopping-list-menu-popover {
  position: fixed; z-index: 40; width: 210px; display: grid; gap: 6px;
  border: 1px solid var(--line); border-radius: 13px; padding: 8px; color: var(--ink); background: #fff;
  box-shadow: 0 14px 34px rgba(15, 44, 49, 0.2);
}
.shopping-list-menu-popover .small-action { width: 100%; justify-content: flex-start; text-align: left; }
.shopping-sort-field { gap: 4px; }
.shopping-sort-field select { min-height: 40px; padding-block: 7px; }
.shopping-add-form {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(125px, 0.42fr) auto;
  gap: 6px; align-items: center; padding: 5px 8px;
}
.shopping-add-form label { display: block; }
.shopping-add-form input { min-height: 38px; padding: 5px 10px; }
.shopping-add-form .primary-button { min-height: 38px; padding: 5px 14px; white-space: nowrap; }
.shopping-item-list {
  display: grid; overflow: visible; border: 1px solid #cadfe8; border-radius: 16px;
  background: var(--shopping-list); box-shadow: var(--shopping-card-shadow);
}
.shopping-empty-items { margin: 0; padding: 18px 16px; color: var(--muted); text-align: center; }
.shopping-item {
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) minmax(0, 1fr); gap: 10px; align-items: center;
  min-height: 48px; border: 0; border-bottom: 1px solid rgba(151, 181, 193, 0.35); border-radius: 0;
  padding: 3px 11px; background: transparent;
}
.shopping-item:last-child { border-bottom: 0; }
.shopping-item.purchased { background: transparent; }
.shopping-item.purchased .shopping-item-copy strong { color: #73817d; }
.shopping-item-check { width: 21px; min-height: 21px; accent-color: var(--teal); }
.shopping-item-leading { display: inline-flex; gap: 2px; align-items: center; justify-self: start; }
.shopping-item-icon { width: 34px; min-height: 34px; border: 1px solid transparent; border-radius: 10px; padding: 0; background: transparent; font-size: 1.25rem; cursor: pointer; }
.shopping-item-icon:hover, .shopping-item-icon:focus-visible { border-color: #9fc8bd; background: transparent; outline: 2px solid var(--teal-soft); }
.shopping-item-copy { min-width: 0; text-align: center; }
.shopping-item-copy { position: relative; width: 100%; box-sizing: border-box; border: 1px solid rgba(151, 181, 193, 0.58); border-radius: 11px; padding: 6px 10px; background: var(--shopping-list); box-shadow: 0 2px 0 rgba(111, 146, 157, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.86); }
.shopping-item-name-text { position: relative; display: inline-block; max-width: 100%; }
.shopping-item.purchased .shopping-item-name-text { text-decoration: none; }
.shopping-item.purchased .shopping-item-name-text::after { content: ""; position: absolute; z-index: 1; left: -4px; right: -4px; top: 50%; height: 2px; border-radius: 2px; background: #73817d; pointer-events: none; }
.shopping-item-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; unicode-bidi: plaintext; cursor: pointer; }
.shopping-item-note { display: block; overflow: hidden; max-width: 100%; color: var(--muted); font-size: 0.78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.shopping-item-note:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.shopping-note-dialog { width: min(92vw, 420px); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 24px 70px rgba(6,27,29,.34); }
.shopping-note-dialog::backdrop { background: rgba(10,30,32,.45); }
.shopping-note-card { display: grid; gap: 14px; padding: 18px; background: var(--paper); font-family: inherit; }
.shopping-note-full { margin: 0; overflow-wrap: anywhere; color: var(--ink); line-height: 1.5; }
.shopping-item-trailing { display: inline-flex; min-width: 0; gap: 9px; align-items: center; justify-self: end; }
.shopping-item-quantity { width: 100px; min-height: 32px; box-sizing: border-box; display: inline-grid; grid-template-columns: max-content minmax(0, 48px) 22px; gap: 2px; align-items: center; justify-content: end; border: 1px solid rgba(151, 181, 193, 0.58); border-radius: 11px; padding: 4px 4px; color: var(--muted); background: var(--shopping-list); box-shadow: 0 2px 0 rgba(111, 146, 157, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.86); font-size: 0.8rem; font-weight: 800; white-space: nowrap; unicode-bidi: plaintext; cursor: pointer; }
.shopping-item-copy strong:focus-visible, .shopping-item-quantity:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.shopping-quantity-number { text-align: right; }
.shopping-quantity-unit { overflow: hidden; text-overflow: ellipsis; text-align: left; }
.shopping-quantity-symbol-slot { width: 22px; height: 22px; display: inline-grid; place-items: center; }
.shopping-weight-symbol, .shopping-package-symbol {
  width: 22px; height: 22px; display: inline-grid; place-items: center; flex: 0 0 22px; line-height: 1;
}
.shopping-weight-symbol {
  place-items: end center; padding: 0 2px 3px; background: #52646a; color: #fff;
  clip-path: polygon(35% 0,65% 0,72% 20%,84% 20%,100% 100%,0 100%,16% 20%,28% 20%);
  font-size: 0.48rem; font-weight: 950;
}
.shopping-package-symbol { font-size: 1.18rem; }
.shopping-item-menu { position: relative; }
.shopping-item-menu summary {
  width: 38px; min-height: 38px; display: grid; place-items: center; border-radius: 10px;
  color: var(--muted); cursor: pointer; font-size: 1.35rem; font-weight: 900; list-style: none;
}
.shopping-item-menu summary::-webkit-details-marker { display: none; }
.shopping-item-menu summary:hover, .shopping-item-menu[open] summary { color: var(--teal); background: rgba(255, 255, 255, 0.68); }
.shopping-item-menu-popover {
  position: absolute; z-index: 12; top: calc(100% + 4px); right: 0; width: 170px; display: grid; gap: 3px;
  border: 1px solid var(--line); border-radius: 13px; padding: 6px; background: #fff; box-shadow: 0 14px 34px rgba(15, 44, 49, 0.2);
}
.shopping-item-menu-popover .small-action { width: 100%; justify-content: flex-start; text-align: left; }
.shopping-access-list { display: grid; gap: 12px; }
.shopping-access-member { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--paper); }
.shopping-access-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 5px 10px; }
.shopping-access-member > .small-action { justify-self: start; }
.shopping-icon-dialog { width: min(92vw,420px); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 24px 70px rgba(6,27,29,.34); }
.shopping-icon-dialog::backdrop { background: rgba(10,30,32,.45); }
.shopping-quantity-dialog { width: min(92vw, 420px); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 24px 70px rgba(6,27,29,.34); }
.shopping-quantity-dialog::backdrop { background: rgba(10,30,32,.45); }
.shopping-quantity-card { display: grid; gap: 12px; padding: 18px; background: var(--paper); font-family: inherit; font-size: 0.95rem; }
.shopping-quantity-card input::placeholder { font: inherit; color: var(--muted); opacity: 0.82; }
.shopping-quantity-no-quantity { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 750; cursor: pointer; }
.shopping-quantity-no-quantity input { width: 18px; height: 18px; margin: 0; accent-color: var(--teal); }
.shopping-quantity-editor-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; align-items: center; }
.shopping-quantity-editor-row > label { font-weight: 700; color: var(--ink); }
.shopping-quantity-editor-row select,
.shopping-quantity-editor-row input { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; background: var(--surface); color: var(--ink); font: inherit; box-sizing: border-box; }
.shopping-quantity-empty-select { color: transparent !important; }
.shopping-quantity-empty-select:focus { color: var(--ink) !important; }
.shopping-quantity-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.shopping-icon-card { display: grid; gap: 14px; padding: 18px; background: var(--paper); }
.shopping-icon-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shopping-icon-groups { display: grid; gap: 14px; max-height: 52vh; overflow-y: auto; padding: 2px 5px 2px 2px; }
.shopping-icon-group { display: grid; gap: 7px; }
.shopping-icon-group h4 { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.shopping-icon-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; }
.shopping-icon-choice { min-height: 46px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 1.45rem; cursor: pointer; }
.shopping-icon-choice:hover, .shopping-icon-choice:focus-visible, .shopping-icon-choice.active { border-color: var(--teal); background: var(--teal-soft); outline: 2px solid rgba(28,91,93,.14); }
.shopping-purchased-panel { min-width: 0; padding: 12px 14px 8px; }
.shopping-purchased-panel[hidden] { display: none; }
.shopping-purchased-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.shopping-purchased-heading h3 { color: var(--teal); font-size: 0.8rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; }
.shopping-purchased-list { display: grid; }
.shopping-purchased-list .shopping-item { padding-inline: 0; border-bottom-color: #e7ece9; }
.shopping-suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.shopping-suggestion-panel { min-width: 0; padding: 14px 16px; border-color: #dfdce8; background: var(--shopping-suggestions); box-shadow: var(--shopping-card-shadow); }
.shopping-suggestion-panel .panel-heading { margin-bottom: 9px; }
.shopping-suggestion-panel .panel-heading h3 { color: var(--teal); font-size: 0.78rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.shopping-suggestions {
  min-width: 0; display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden; padding: 1px 18px 4px 0;
  overscroll-behavior-inline: contain; scroll-snap-type: inline proximity; scrollbar-width: none; touch-action: pan-x;
}
.shopping-suggestions::-webkit-scrollbar { display: none; }
.shopping-suggestion { flex: 0 0 auto; display: flex; gap: 4px; align-items: stretch; scroll-snap-align: start; }
.shopping-suggestion-add { min-width: 0; max-width: 180px; display: grid; align-items: center; border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; color: var(--ink); background: #fff; text-align: left; }
.shopping-suggestion-add:hover { border-color: #9fc6c1; background: var(--teal-soft); }
.shopping-suggestion-add strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shopping-pin { width: 38px; min-height: 40px; border: 0; border-radius: 11px; color: #788580; background: #e6e6eb; font-size: 1rem; }
.shopping-pin.pinned { color: #8a6414; background: var(--amber-soft); }
.shopping-suggestion-dismiss { width: 38px; min-height: 40px; border: 0; border-radius: 11px; padding: 0; color: var(--danger); background: var(--danger-soft); font-size: 1rem; font-weight: 850; }

.notification-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.notification-list, .approval-list { display: grid; gap: 10px; }
.notification-item, .approval-item { display: grid; gap: 9px; border-top: 1px solid #edf1ee; padding: 14px 0 4px; }
.notification-item:first-child, .approval-item:first-child { border-top: 0; padding-top: 0; }
.notification-item.unread { border-left: 4px solid var(--amber); padding-left: 13px; }
.notification-heading, .approval-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; }
.notification-copy, .approval-copy { min-width: 0; display: grid; gap: 4px; }
.notification-copy span, .approval-copy span, .notification-time, .approval-reason { color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.notification-actions, .approval-actions { display: flex; gap: 7px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.approval-item.pending { border-left: 4px solid var(--amber); padding-left: 13px; }
.approval-target { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; }
.approval-reason { margin: 0; }

.manage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.manage-panel { align-self: start; }
.wide-panel { grid-column: 1 / -1; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-bottom: 18px; }
.stacked-form { display: grid; gap: 14px; margin-bottom: 20px; }
.manage-list { display: grid; gap: 8px; }
.manage-item { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid #edf1ee; }
.manage-item-copy { min-width: 0; display: grid; gap: 3px; }
.manage-item-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-item-copy span { color: var(--muted); font-size: 0.76rem; }
.manage-actions { display: flex; gap: 7px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.manage-actions select { min-height: 38px; width: auto; padding-block: 6px; font-size: 0.76rem; }
.member-access-toggle { display: inline-flex; gap: 5px; align-items: center; min-height: 38px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.invitation-share { display: grid; gap: 9px; margin: 0 0 18px; border: 1px solid #b9d6d2; border-radius: 13px; padding: 13px; background: var(--teal-soft); }
.invitation-share .muted-copy { margin: 0; }
.invitation-share input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.76rem; }
.optional-label { color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.change-set-item { align-items: flex-start; }
.change-item-list { display: grid; gap: 10px; max-height: min(58vh, 620px); overflow-y: auto; padding-right: 4px; }
.change-review-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.change-review-item.conflict { border-color: #d9a64a; background: #fff8e9; }
.change-review-copy { min-width: 0; display: grid; gap: 4px; }
.change-review-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-review-copy span { color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.change-review-copy .conflict-copy { color: #875817; font-weight: 750; }
.change-review-copy .decision-copy { color: var(--teal); font-weight: 750; }
.change-review-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.account-panel { max-width: 620px; display: grid; gap: 26px; }
.identity-card { display: flex; gap: 14px; align-items: center; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.identity-card > div:last-child { display: grid; gap: 3px; }
.identity-card span { color: var(--muted); font-size: 0.82rem; }
.avatar { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; color: #fff; background: var(--teal); font-weight: 900; }
.account-panel .danger-button { justify-self: start; }

.category-dialog { width: min(92vw, 530px); border: 0; border-radius: 24px; padding: 0; color: var(--ink); box-shadow: 0 28px 90px rgba(6, 27, 29, 0.35); }
.category-dialog::backdrop { background: rgba(8, 27, 29, 0.57); backdrop-filter: blur(3px); }
.dialog-card { display: grid; min-width: 0; width: 100%; max-width: 100%; gap: 20px; overflow-x: hidden; padding: 26px; }
.dialog-card > *, .dialog-card label { min-width: 0; max-width: 100%; }
.dialog-heading { display: flex; gap: 18px; align-items: start; justify-content: space-between; }
.dialog-heading h3 { max-width: 390px; overflow-wrap: anywhere; }
.dialog-amount { margin: -8px 0 0; color: var(--teal); font-size: 1.45rem; font-weight: 900; }
.dialog-actions { display: flex; gap: 9px; justify-content: end; }
.receipt-photo-picker { display: grid; min-width: 0; max-width: 100%; gap: 8px; }
.field-label { color: var(--ink); font-size: 0.82rem; font-weight: 800; }
.field-help { color: var(--muted); font-size: 0.72rem; font-weight: 600; line-height: 1.35; }
.receipt-photo-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.receipt-photo-actions button { flex: 1 1 180px; }
#receiptPhotoSelection { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.receipt-progress { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: center; border-radius: 10px; padding: 10px 12px; color: var(--teal); background: var(--teal-soft); font-size: 0.78rem; font-weight: 750; }
.receipt-progress progress { grid-column: 1 / -1; width: 100%; height: 8px; accent-color: var(--teal); }
.receipt-progress-spinner { width: 18px; height: 18px; border: 2px solid rgba(20, 83, 84, 0.22); border-top-color: var(--teal); border-radius: 50%; animation: receipt-spin 0.8s linear infinite; }
@keyframes receipt-spin { to { transform: rotate(360deg); } }
.receipt-camera-card { gap: 14px; }
.receipt-camera-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: #071719;
  line-height: 0;
}
.receipt-camera-stage video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  margin: auto;
  background: #071719;
}
.receipt-camera-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 8px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.receipt-camera-guide-left { left: 12.5%; }
.receipt-camera-guide-right { left: 87.5%; }
#receiptCameraStatus { margin: 0; }

.receipt-review-photo { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #f4f7f6; }
.receipt-review-photo summary { display: flex; min-height: 46px; gap: 12px; align-items: center; justify-content: space-between; padding: 11px 14px; cursor: pointer; color: var(--ink); font-size: 0.84rem; font-weight: 850; }
.receipt-review-photo-hint { color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.receipt-review-photo-button { display: flex; width: 100%; height: min(48vh, 480px); min-height: 240px; align-items: center; justify-content: center; overflow: auto; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 10px; background: #dfe8e5; cursor: zoom-in; }
.receipt-review-photo-button img { display: block; width: 100%; height: min(48vh, 480px); object-fit: contain; margin: auto; border-radius: 8px; background: #fff; }
.receipt-review-photo-button.expanded { cursor: zoom-out; }
.receipt-review-photo-button.expanded { align-items: flex-start; justify-content: flex-start; }
.receipt-review-photo-button.expanded img { width: calc(100% * var(--receipt-photo-zoom, 2)); max-width: none; height: auto; max-height: none; object-fit: initial; margin: 0; }
.receipt-photo-zoom { display: grid; grid-template-columns: 44px minmax(100px, 1fr) 44px auto; gap: 8px; align-items: center; padding: 9px 12px; background: #fff; }
.receipt-photo-zoom .secondary-button { min-height: 38px; padding: 5px; }
.receipt-photo-zoom input { width: 100%; }
.receipt-review-photo .field-help { display: block; margin: 0; padding: 8px 12px 10px; background: #fff; }
.receipt-review-warning { border: 1px solid #e5c36c; border-radius: 12px; padding: 11px 13px; color: #704b10; background: var(--amber-soft); font-size: 0.82rem; font-weight: 750; line-height: 1.45; }
.receipt-review-warning.clear { border-color: #a9d4c8; color: var(--teal); background: var(--teal-soft); }
.receipt-review-items { display: grid; min-width: 0; gap: 10px; }
.receipt-review-items-heading { display: flex; min-width: 0; gap: 12px; align-items: end; justify-content: space-between; }
.receipt-review-items-heading .muted-copy { margin: 3px 0 0; }
.receipt-review-item-list { display: grid; min-width: 0; gap: 8px; }
.receipt-review-item-row { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) 120px 40px; gap: 8px; align-items: center; }
.receipt-review-item-row input { min-width: 0; width: 100%; }
.receipt-review-item-row .icon-button { width: 40px; min-height: 40px; color: var(--danger); background: var(--danger-soft); }
.wide-dialog { width: min(94vw, 760px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full-field { grid-column: 1 / -1; }
.split-editor { display: grid; gap: 9px; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 40px; gap: 8px; align-items: end; }
.split-row .icon-button { width: 40px; min-height: 40px; height: 40px; color: var(--danger); background: var(--danger-soft); }
.text-button { justify-self: start; min-height: 36px; border: 0; padding: 5px 2px; color: var(--teal); background: transparent; font-weight: 850; }
.text-button.danger-text { color: var(--danger); }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr); gap: 24px; }
.compact-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.compact-metrics .metric-card { min-height: 108px; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 32px)); border-radius: 14px; padding: 13px 17px; color: #fff; background: var(--deep); box-shadow: var(--shadow); font-size: 0.86rem; font-weight: 750; }
.toast.error { background: var(--danger); }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .budget-dashboard { grid-template-columns: 1fr; }
  .budget-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .budget-rollover-field { grid-column: span 1; }
  .upload-panel { grid-template-columns: 1fr; }
  .shopping-layout { grid-template-columns: 1fr; }
  .shopping-list-browser { position: static; }
}

@media (max-width: 760px) {
  html { min-height: 100%; background: var(--canvas); -webkit-text-size-adjust: 100%; }
  body { min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
  .login-shell { grid-template-columns: 1fr; align-content: center; padding: 26px 20px; }
  .brand-block .brand-mark { margin-bottom: 26px; }
  .brand-block h1 { font-size: clamp(2.5rem, 13vw, 4rem); }
  .login-copy { font-size: 1rem; }
  .login-card { padding: 24px; }
  .sidebar { display: none; }
  .mobile-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: calc(5px + env(safe-area-inset-top)) 12px 5px;
    border-bottom: 1px solid var(--line);
    background: rgba(250, 252, 250, 0.94);
    backdrop-filter: blur(14px);
  }
  .mobile-header .brand-mark.compact { width: 36px; height: 36px; border-radius: 10px; }
  .mobile-header .icon-button { width: 38px; min-height: 38px; }
  .mobile-header > div:nth-child(2) { min-width: 0; display: grid; line-height: 1.1; }
  .mobile-header strong { overflow: hidden; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-header span { display: none; }
  .main-content { margin-left: 0; padding: 6px 15px 27px; }
  .module-switcher {
    top: calc(48px + env(safe-area-inset-top));
    margin-bottom: 6px;
    border-radius: 10px;
  }
  .module-tab { min-height: 38px; padding: 5px 8px; font-size: 0.78rem; }
  .page-heading { align-items: end; margin-bottom: 22px; }
  h2 { font-size: 2.2rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 120px; }
  .attention-panel { align-items: start; }
  .attention-panel > div { display: block; }
  .attention-panel strong { margin-right: 5px; }
  .bottom-nav {
    position: fixed;
    z-index: 25;
    inset: auto 0 0;
    display: flex;
    justify-content: stretch;
    overflow: visible;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
  }
  .bottom-nav .nav-button { position: relative; min-width: 0; flex: 1 1 25%; flex-direction: column; gap: 1px; justify-content: center; padding: 7px 3px; color: var(--muted); font-size: 0.68rem; }
  .bottom-nav .nav-button span { width: auto; font-size: 1.15rem; }
  .bottom-nav .nav-button .notification-nav-count { position: absolute; margin: -24px 0 0 28px; padding: 1px 5px; font-size: 0.58rem; }
  .bottom-nav .nav-button.active { color: var(--teal); background: var(--teal-soft); }
  .bottom-nav .scan-nav-button { align-self: end; min-height: 62px; margin-top: -18px; border: 4px solid #fff; border-radius: 22px; color: #fff; background: var(--teal); box-shadow: 0 8px 22px rgba(16,42,46,0.24); }
  .bottom-nav .scan-nav-button span { font-size: 1.35rem; }
  .bottom-nav .scan-nav-button:hover, .bottom-nav .scan-nav-button:focus-visible { color: #fff; background: var(--deep); }
  .bottom-nav-menu { position: fixed; z-index: 30; right: 10px; bottom: calc(72px + env(safe-area-inset-bottom)); left: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: rgba(255,255,255,0.98); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
  .bottom-nav-menu[hidden] { display: none; }
  .bottom-nav-menu button { display: flex; gap: 8px; align-items: center; min-height: 46px; border: 0; border-radius: 11px; padding: 9px 12px; color: var(--deep); background: var(--teal-soft); font: inherit; font-size: 0.8rem; font-weight: 800; cursor: pointer; }
  .bottom-nav-menu button:hover, .bottom-nav-menu button:focus-visible, .bottom-nav-menu button.active { color: #fff; background: var(--teal); }
  .bottom-nav-menu button span { width: 22px; font-size: 1.1rem; text-align: center; }
  .bottom-nav-menu .notification-nav-count { width: auto; margin-left: auto; border-radius: 999px; padding: 1px 6px; color: #173d42; background: #f2cc72; font-size: 0.62rem; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
  .transaction-item { grid-template-columns: 68px minmax(0, 1fr) auto 38px; grid-template-rows: auto auto; gap: 3px 7px; padding: 10px; }
  .transaction-date { grid-column: 1; grid-row: 2; align-self: center; }
  .transaction-copy { display: contents; }
  .transaction-copy > :first-child { grid-column: 1 / 4; grid-row: 1; min-width: 0; }
  .transaction-meta { grid-column: 2; grid-row: 2; min-width: 0; margin-top: 0; align-self: center; flex-wrap: nowrap; overflow: hidden; }
  .transaction-meta > span:not(.status-badge) { display: none; }
  .transaction-amount { grid-column: 3; grid-row: 2; min-width: 76px; align-self: center; }
  .transaction-actions { grid-column: 4; grid-row: 1; display: flex; align-self: start; }
  .transaction-copy > .review-reason { grid-column: 1 / -1; grid-row: 3; }
  .transaction-actions .small-action { grid-column: auto; }
  .transaction-action-popover { position: fixed; top: auto; right: 15px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 15px; width: auto; }
  .upload-panel { grid-template-columns: 1fr; }
  .statement-picker-actions, .upload-queue-footer { align-items: stretch; }
  .statement-picker-actions > *, .upload-queue-footer .primary-button { flex: 1; }
  .statement-upload-row { grid-template-columns: minmax(0, 1fr) auto; }
  .statement-upload-status { grid-column: 1; text-align: left; }
  .statement-upload-remove { grid-column: 2; grid-row: 1 / span 2; }
  .statement-item { grid-template-columns: 1fr; }
  .statement-actions { justify-content: space-between; }
  .shopping-list-tab { min-height: 42px; padding-block: 7px; font-size: 0.8rem; }
  .shopping-list-tab.active { padding-block: 0; }
  .shopping-list-tab-label { min-height: 40px; max-width: 58vw; padding: 7px 8px 7px 12px; }
  .shopping-list-menu summary { width: 34px; min-height: 40px; }
  .shopping-clear-button { min-height: 36px; padding: 5px 9px; font-size: 0.74rem; }
  .shopping-purchased-panel { padding: 10px 12px 7px; }
  .shopping-add-form { grid-template-columns: minmax(0, 1fr) 92px auto; gap: 4px; padding: 4px 7px; }
  input, select, textarea { font-size: 16px; }
  .shopping-add-form input { min-height: 36px; padding: 5px 8px; }
  .shopping-add-form .primary-button { min-height: 36px; padding: 5px 8px; font-size: 0.74rem; }
  .shopping-item { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; padding: 3px 9px; }
  .shopping-item-quantity { width: 90px; grid-template-columns: max-content minmax(0, 38px) 22px; gap: 1px; padding: 4px 3px; font-size: 0.74rem; }
  .shopping-item-menu summary { width: 34px; min-height: 34px; font-size: 1.2rem; }
  .shopping-item-menu-popover { position: fixed; top: auto; right: 15px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 15px; width: auto; }
  .shopping-suggestion-grid { grid-template-columns: 1fr; }
  .shopping-suggestion-panel { padding: 12px 14px; }
  .notification-grid .panel-heading { align-items: stretch; flex-direction: column; }
  .notification-grid .panel-heading-actions { justify-content: flex-start; }
  .manage-grid { grid-template-columns: 1fr; }
  .wide-panel { grid-column: auto; }
  .manage-item { align-items: flex-start; }
  .manage-actions { flex-wrap: wrap; justify-content: flex-end; }
  .change-review-item { grid-template-columns: 1fr; }
  .change-review-actions { justify-content: stretch; }
  .change-review-actions .small-action { flex: 1; }
  .form-grid, .report-grid { grid-template-columns: 1fr; }
  .budget-form { grid-template-columns: 1fr; }
  .budget-row-heading { align-items: stretch; flex-direction: column; gap: 7px; }
  .budget-row-values { text-align: left; }
  .budget-form-actions { justify-content: stretch; }
  .budget-form-actions button { flex: 1; }
  .full-field { grid-column: auto; }
  .split-row { grid-template-columns: minmax(0, 1fr) 112px 40px; }
  .compact-metrics { grid-template-columns: 1fr; }
  .month-row { grid-template-columns: 32px minmax(54px, 1fr) 88px; gap: 7px; }
  .toast { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  dialog { max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px); overflow-y: auto; overflow-x: hidden; }
  .category-dialog, .shopping-icon-dialog, .shopping-quantity-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); margin: auto; }
  .dialog-card { gap: 15px; padding: 18px 14px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions button { flex: 1 1 130px; }
  .receipt-photo-actions { display: grid; grid-template-columns: 1fr; }

  /* Keep the receipt camera capture controls inside the visible
     mobile viewport, including iPhone safe-area space. */
  #receiptCameraDialog {
    overflow-y: auto;
  }
  #receiptCameraDialog .receipt-camera-card {
    gap: 10px;
    padding-top: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  #receiptCameraDialog .receipt-camera-stage video {
    max-height: min(
      52dvh,
      calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 245px)
    );
  }
  #receiptCameraDialog .dialog-actions {
    flex-wrap: nowrap;
  }
  #receiptCameraDialog .dialog-actions button {
    flex: 1 1 0;
  }
  .receipt-review-photo-button img { height: min(42vh, 420px); }
  .receipt-review-items-heading { align-items: stretch; flex-direction: column; }
  .receipt-review-items-heading button { width: 100%; }
  .receipt-review-item-row { grid-template-columns: minmax(0, 1fr) 92px 40px; gap: 5px; }
  button, input, select, textarea, summary { touch-action: manipulation; }
}

@media (max-width: 420px) {
  .shopping-list-tab { min-width: 84px; max-width: 72vw; }
  .shopping-list-tab-label { max-width: 56vw; }
  .shopping-list-menu summary { width: 32px; }
  .shopping-clear-button { padding-inline: 7px; font-size: 0.7rem; }
  .shopping-add-form { grid-template-columns: minmax(0, 1fr) 78px auto; gap: 3px; padding-inline: 6px; }
  .shopping-add-form .primary-button { padding-inline: 6px; font-size: 0.7rem; }
  .shopping-item { gap: 2px; padding-inline: 6px; }
  .shopping-item-trailing { gap: 5px; }
  .shopping-item-quantity { width: 84px; grid-template-columns: max-content minmax(0, 32px) 22px; gap: 1px; padding: 3px 2px; font-size: 0.7rem; }
  .shopping-item-menu summary { width: 32px; min-height: 32px; }
}

@media (prefers-reduced-motion: no-preference) {
  .view.active { animation: enter 180ms ease-out; }
  .month-bar { transition: width 250ms ease-out; }
  @keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}

.statement-review-context { display: grid; gap: 12px; margin-bottom: 14px; border-color: #efcf80; box-shadow: inset 4px 0 0 var(--amber); }
.statement-review-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; }
.statement-review-heading h3 { margin: 3px 0 0; overflow-wrap: anywhere; }
.statement-review-metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 8px; }
.statement-review-metric { display: grid; gap: 3px; border-radius: 11px; padding: 10px 12px; background: #f1f5f3; }
.statement-review-metric.warning { background: var(--amber-soft); }
.statement-review-metric span { color: var(--muted); font-size: 0.72rem; font-weight: 750; }
.statement-review-metric strong { font-size: 0.9rem; }
.statement-review-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.statement-review-actions > span { color: var(--muted); font-size: 0.8rem; font-weight: 750; }
.statement-review-reason { color: #75570e; font-weight: 750; }
.review-status-button { border: 0; cursor: pointer; }
.review-status-button:hover, .review-status-button:focus-visible { outline: 2px solid #d9ae49; outline-offset: 2px; }
.transaction-review-control { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.transaction-review-control select { min-height: 38px; max-width: 160px; border-radius: 10px; padding: 6px 26px 6px 8px; font-size: 0.75rem; }
@media (max-width: 760px) {
  .statement-review-heading { align-items: stretch; flex-direction: column; }
  .statement-review-heading .secondary-button { align-self: flex-start; }
  .transaction-review-control { width: 100%; }
  .transaction-review-control select { flex: 1 1 120px; max-width: none; font-size: 16px; }
  .transaction-review-control .small-action { flex: 0 0 auto; }
  .transaction-description-tooltip { position: fixed; top: auto; right: 15px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 15px; width: auto; max-width: none; }
}

/* 0.31.4 cash-flow overview and report drill-down */
.income-metric strong { color: #287052; }
.expense-metric strong { color: var(--deep); }
.net-metric strong { color: var(--teal); }
.net-metric.negative strong { color: var(--danger); }
.overview-month-stack { display: grid; gap: 10px; }
.overview-month-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; }
.overview-month-card.expanded { border-color: #a8cbc6; box-shadow: inset 3px 0 0 var(--teal); }
.overview-month-summary { width: 100%; display: grid; grid-template-columns: 150px minmax(0,1fr) 28px; gap: 12px; align-items: center; border: 0; padding: 13px 14px; color: inherit; background: transparent; text-align: left; }
.overview-month-summary:hover, .overview-month-summary:focus-visible { background: var(--teal-soft); outline: none; }
.overview-month-name { font-size: 0.86rem; }
.overview-month-totals { display: grid; gap: 4px; }
.overview-month-currency { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.overview-month-currency .income { color: #287052; }
.overview-month-currency .expense { color: #425a5e; }
.overview-month-currency .net { color: var(--teal); text-align: right; }
.overview-month-currency .net.negative { color: var(--danger); }
.overview-month-empty { color: var(--muted); font-size: 0.78rem; }
.overview-month-chevron { color: var(--teal); font-size: 1.2rem; font-weight: 900; text-align: right; }
.overview-month-detail { display: grid; gap: 16px; padding: 0 14px 14px; border-top: 1px solid var(--line); }
.overview-month-detail-section { display: grid; gap: 8px; padding-top: 14px; }
.overview-month-detail-heading { display: flex; gap: 14px; justify-content: space-between; align-items: baseline; }
.overview-month-detail-heading span { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.report-transaction-list { display: grid; gap: 7px; }
.report-transaction-row { display: grid; grid-template-columns: 100px minmax(0,1fr) auto; gap: 12px; align-items: center; border: 1px solid #e7ece9; border-radius: 12px; padding: 10px 12px; background: var(--paper); }
.report-transaction-row.income { background: #f1faf4; border-color: #cce6d5; box-shadow: inset 3px 0 0 #7eb694; }
.report-transaction-row.expense { box-shadow: inset 3px 0 0 #b7c9c4; }
.report-transaction-date { color: var(--muted); font-size: 0.74rem; }
.report-transaction-copy { min-width: 0; }
.report-transaction-copy > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; }
.report-transaction-amount { min-width: 96px; text-align: right; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.report-transaction-row.income .report-transaction-amount, .report-transaction-amount.inflow { color: #287052; }
.category-report-filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.category-transaction-section { margin-top: 22px; }

@media (max-width: 760px) {
  .overview-month-summary { grid-template-columns: minmax(0,1fr) 24px; gap: 8px; padding: 12px; }
  .overview-month-name { grid-column: 1; }
  .overview-month-totals { grid-column: 1; }
  .overview-month-chevron { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .overview-month-currency { grid-template-columns: 1fr; gap: 2px; }
  .overview-month-currency .net { text-align: left; }
  .report-transaction-row { grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; }
  .report-transaction-date { grid-column: 1; grid-row: 2; }
  .report-transaction-copy { grid-column: 1 / -1; grid-row: 1; }
  .report-transaction-amount { grid-column: 2; grid-row: 2; }
  .category-report-filters { align-items: stretch; }
  .category-report-filters .compact-field { width: 100%; }
}

/* 0.33.0 review learning, store reporting, and household reset */
.review-reason { margin: 7px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--amber-soft); color: #6f5613; font-size: 0.76rem; line-height: 1.4; }
.review-reason strong { color: #5f4810; }
.store-chart-stack, .store-chart-group { display: grid; gap: 8px; }
.store-chart-group + .store-chart-group { margin-top: 14px; }
.store-chart-row { display: grid; grid-template-columns: minmax(110px,0.7fr) minmax(90px,1fr) auto; gap: 10px; align-items: center; width: 100%; border: 0; border-radius: 10px; padding: 7px 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.store-chart-row:hover, .store-chart-row:focus-visible { background: var(--teal-soft); outline: none; }
.store-chart-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.79rem; font-weight: 800; }
.store-chart-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e5eeeb; }
.store-chart-bar { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.store-chart-value { min-width: 82px; text-align: right; font-size: 0.77rem; font-variant-numeric: tabular-nums; }
.danger-panel { border-color: #e3b5b5; box-shadow: inset 4px 0 0 var(--danger); }
.danger-button { min-height: 40px; border: 1px solid #b74242; border-radius: 10px; padding: 8px 12px; background: #fff5f5; color: #8e2e2e; font-weight: 850; cursor: pointer; }
.danger-button:hover, .danger-button:focus-visible { background: #ffe5e5; outline: 2px solid #dc8d8d; outline-offset: 2px; }
.danger-button:disabled { opacity: 0.55; cursor: wait; }

/* 0.35.3 smooth interactive Insights comparison */
.insight-chart { display: grid; gap: 12px; margin: 14px 0 18px; border-radius: 15px; padding: 14px; background: linear-gradient(145deg,#f3f8f6,#fbfcfb); border: 1px solid #dfebe7; }
.chart-empty { margin: 0; color: var(--muted); font-size: 0.78rem; text-align: center; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 0.72rem; font-weight: 750; }
.chart-key { display: inline-flex; gap: 6px; align-items: center; }
.chart-key::before { width: 9px; height: 9px; border-radius: 3px; background: var(--teal); content: ""; }
.chart-key-secondary::before { background: #a7c2bd; }
.comparison-group, .progress-chart-row, .net-worth-chart-group { display: grid; gap: 7px; }
.comparison-orbit, .progress-orbit { display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 14px; align-items: center; }
.comparison-ring, .progress-ring { position: relative; display: grid; width: 78px; aspect-ratio: 1; place-items: center; border-radius: 50%; }
.comparison-ring::after, .progress-ring::after { position: absolute; width: 56px; aspect-ratio: 1; border-radius: 50%; background: #f8fbfa; content: ""; }
.comparison-ring strong, .progress-ring strong { z-index: 1; font-size: 0.72rem; }
.progress-ring { --ring-color: var(--teal); background: conic-gradient(var(--ring-color) 0 var(--progress),#dfe9e6 var(--progress) 100%); }
.progress-ring.warning { --ring-color: var(--amber); }
.progress-ring.positive { --ring-color: #4c9871; }
.progress-ring.danger { --ring-color: var(--danger); }
.orbit-values { display: grid; gap: 5px; font-size: 0.75rem; }
.orbit-values span { color: var(--muted); }
.insight-period-controls, .month-chip-picker, .inline-create-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.period-chip, .month-chip { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; background: var(--paper); color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.period-chip.active { border-color: var(--teal); background: var(--teal); color: white; }
.month-chip.active { border-color: var(--month-color); box-shadow: inset 0 0 0 2px var(--month-color); color: var(--ink); }
.month-chip.active::before { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--month-color); content: ""; }
.diagram-chart { padding: 18px; background: #f7f8f8; }
.period-diagram-group { display: grid; gap: 10px; }
.period-diagram-group + .period-diagram-group { padding-top: 14px; border-top: 1px solid var(--line); }
.period-diagram-group svg { width: 100%; min-height: 190px; }
.period-line { fill: none; stroke: #a9bbb6; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.period-stem { stroke-width: 2; stroke-dasharray: 4 5; opacity: .34; }
.period-dot { stroke: white; stroke-width: 3; }
.diagram-grid { stroke: #dce7e3; stroke-width: 1; stroke-dasharray: 3 5; }
.diagram-grid.vertical { opacity: .55; }
.diagram-y-axis { stroke: #8fa9a3; stroke-width: 1; }
.diagram-y-axis-label { fill: var(--muted); font-size: 9px; text-anchor: end; font-variant-numeric: tabular-nums; }
.diagram-y-axis-label.max-income, .diagram-y-axis-label.max-expense { font-size: 11px; font-weight: 900; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.diagram-y-axis-label.max-income { fill: #167044; }
.diagram-y-axis-label.max-expense { fill: #b13f3f; }
.cash-flow-total-card { filter: drop-shadow(0 3px 3px rgba(16,42,46,.22)); }
.cash-flow-total-frame { fill: #fff; stroke: #c9d8d3; stroke-width: 1; }
.cash-flow-maximum-total { font-size: 12px; font-weight: 900; text-anchor: middle; font-variant-numeric: tabular-nums; }
.cash-flow-total-label { fill: var(--ink); }
.cash-flow-total-value.positive { fill: #167044; }
.cash-flow-total-value.negative { fill: #b13f3f; }
.cash-flow-total-value.neutral { fill: var(--ink); }
.diagram-zero-line { stroke: #8fa9a3; stroke-width: 1.25; }
.diagram-axis-label { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.insight-range-field { width: min(280px,100%); }
.interactive-diagram { position: relative; }
.spending-area { opacity: .72; }
.comparison-cash-flow-area { opacity: .18; }
.spending-smooth-line { fill: none; stroke: var(--teal); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.comparison-smooth-line { fill: none; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.spending-point { fill: var(--paper); stroke: var(--teal); stroke-width: .5; cursor: crosshair; transition: r 120ms ease,fill 120ms ease; }
.spending-point:hover { r: 2.25px; fill: var(--amber); }
.diagram-tooltip { position: absolute; z-index: 4; display: grid; width: min(220px,calc(100% - 16px)); gap: 4px; border: 1px solid #bcd2cc; border-radius: 12px; padding: 10px 12px; background: rgba(255,255,255,.97); box-shadow: 0 10px 30px rgba(16,42,46,.18); pointer-events: none; font-size: .72rem; }
.diagram-tooltip span { color: var(--muted); }
.timeline-caption { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; font-weight: 750; }
.insight-selector-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.compare-month-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; max-height: 50vh; overflow: auto; }
.compare-month-option { display: flex; grid-template-columns: auto minmax(0,1fr); align-items: center; border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; background: #fafcfb; }
.compare-month-option input { margin: 0; }
.form-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: .78rem; font-weight: 750; }
@media (max-width: 560px) { .compare-month-grid { grid-template-columns: 1fr; } }
.month-diagram-legend { display: flex; gap: 8px 14px; flex-wrap: wrap; color: var(--muted); font-size: .7rem; }
.month-diagram-legend span::before { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--month-color); content: ""; }
.chart-row-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 0.76rem; }
.chart-row-heading span { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.comparison-bars { display: grid; gap: 4px; }
.chart-track { display: block; height: 8px; overflow: hidden; border-radius: 999px; background: #e3ece9; }
.chart-track-large { height: 13px; }
.chart-bar { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width 300ms ease-out; }
.chart-bar.secondary { background: #a7c2bd; }
.chart-bar.warning { background: var(--amber); }
.chart-bar.positive { background: #4c9871; }
.chart-bar.danger { background: var(--danger); }
.net-worth-chart-group svg { width: 100%; min-height: 130px; overflow: visible; }
.net-worth-zero { stroke: #cad8d3; stroke-width: 1; stroke-dasharray: 5 5; }
.net-worth-line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.net-worth-dot { fill: var(--paper); stroke: var(--teal); stroke-width: .5; }
@media (max-width: 760px) {
  .store-chart-row { grid-template-columns: minmax(0,1fr) auto; }
  .store-chart-track { grid-column: 1 / -1; grid-row: 2; }
  .transaction-review-control .small-action { flex: 1 1 135px; }
  .insight-chart { padding: 12px; }
  .chart-row-heading { align-items: start; }
  .spending-progress-heading { display: grid; align-items: stretch; }
  .spending-progress-settings { display: grid; grid-template-columns: 1fr; justify-content: stretch; }
  .spending-progress-settings label { width: 100%; }
  .spending-progress-summary { grid-template-columns: 1fr auto; }
  .spending-progress-summary span { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}

/* Shopping-list tab reordering */
.shopping-list-tab[data-list-id] {
  touch-action: pan-y;
}
.shopping-list-tab-dragging {
  position: relative;
  z-index: 6;
  opacity: 0.78;
  cursor: grabbing;
  user-select: none;
}

/* Expense progress compact settings + 3D donut */
.spending-progress-controls {
  width: min(560px, 100%);
  margin-left: auto;
}

.spending-progress-config-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 18px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  border: 1px solid #dce8e4;
  border-radius: 14px;
  padding: 10px 14px;
  background: linear-gradient(145deg, #f5f9f7, #ffffff);
  box-shadow: 0 5px 14px rgba(25, 56, 62, .06);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.spending-progress-config-summary::after {
  grid-column: 2;
  grid-row: 1 / span 2;
  content: "›";
  align-self: center;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}

.spending-progress-config-summary span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.spending-progress-config-summary strong {
  font-size: .98rem;
  font-variant-numeric: tabular-nums;
}

.spending-progress-edit-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.spending-progress-donut-item {
  border: 1px solid #e1ebe8;
  border-radius: 18px;
  padding: clamp(14px, 2vw, 20px);
  background: linear-gradient(145deg, #fbfdfc, #f3f8f6);
  box-shadow: 0 9px 22px rgba(28, 62, 58, .055);
}

.spending-progress-comparison {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.spending-progress-benchmark-label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
  text-align: center;
}

.spending-progress-visual {
  display: grid;
  grid-template-columns: minmax(138px, 180px) minmax(105px, 1fr);
  gap: clamp(18px, 4vw, 38px);
  align-items: center;
  justify-content: center;
  max-width: 440px;
  margin-inline: auto;
  padding: 8px 0 4px;
}

.spending-progress-ring {
  --progress: 0%;
  --ring-color: #4c9871;
  position: relative;
  width: min(100%, 178px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    conic-gradient(
      from -90deg,
      var(--ring-color) 0 var(--progress),
      #dfe7e4 var(--progress) 100%
    );
  box-shadow:
    0 10px 0 rgba(43, 105, 78, .16),
    0 15px 24px rgba(25, 56, 62, .15),
    inset 0 2px 3px rgba(255, 255, 255, .8);
  transform: perspective(520px) rotateX(7deg);
}

.spending-progress-ring::before {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #eef5f2);
  box-shadow:
    inset 0 4px 9px rgba(25, 56, 62, .08),
    0 2px 2px rgba(255, 255, 255, .9);
  content: "";
}

.spending-progress-ring.danger {
  --ring-color: var(--danger);
  background: var(--danger);
  box-shadow:
    0 10px 0 rgba(154, 57, 54, .18),
    0 15px 24px rgba(111, 43, 40, .15),
    inset 0 2px 3px rgba(255, 255, 255, .55);
}

.spending-progress-ring.unavailable {
  --ring-color: #aebdba;
}

.spending-progress-ring-center {
  position: absolute;
  inset: 25%;
  z-index: 1;
  display: grid;
  place-content: center;
  gap: 1px;
  text-align: center;
  transform: perspective(520px) rotateX(-7deg);
}

.spending-progress-used-value {
  color: #4c9871;
  font-size: clamp(1rem, 3vw, 1.38rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}

.spending-progress-ring.danger .spending-progress-used-value {
  color: var(--danger);
}

.spending-progress-ring-center span,
.spending-progress-ring-center small {
  color: var(--muted);
  font-weight: 750;
}

.spending-progress-side-value {
  display: grid;
  align-content: center;
  gap: 1px;
  min-width: 0;
  padding-left: clamp(12px, 2vw, 22px);
  border-left: 1px solid #dce6e3;
}

.spending-progress-side-value strong {
  color: #4c9871;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}

.spending-progress-side-value span,
.spending-progress-side-value small {
  color: var(--muted);
  font-weight: 750;
}

.spending-progress-side-value.over strong,
.spending-progress-side-value.over span {
  color: var(--danger);
}

.spending-progress-detail {
  display: block;
  margin-top: 8px;
  text-align: center;
}

.spending-progress-item.over-target .spending-progress-detail {
  color: var(--danger);
}

@media (max-width: 760px) {
  .spending-progress-controls {
    width: 100%;
    margin-left: 0;
  }

  .spending-progress-edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .spending-progress-visual {
    grid-template-columns: minmax(130px, 165px) minmax(92px, 1fr);
    gap: 16px;
  }
}

@media (max-width: 410px) {
  .spending-progress-visual {
    grid-template-columns: minmax(122px, 148px) minmax(88px, 1fr);
    gap: 12px;
  }

  .spending-progress-side-value {
    padding-left: 10px;
  }
}


/* Expense Progress — one connected extruded annulus */
.spending-progress-solid-ring {
  position: relative;
  display: grid;
  width: min(100%, 178px);
  aspect-ratio: 1 / 1;
  place-items: center;
  overflow: visible;

  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.spending-progress-solid-ring::before,
.spending-progress-solid-ring::after {
  display: none !important;
  content: none !important;
}

.spending-progress-solid-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;

  shape-rendering: geometricPrecision;

  filter:
    drop-shadow(0 10px 7px rgba(20, 56, 46, .19))
    drop-shadow(0 2px 2px rgba(20, 56, 46, .07));
}

/*
 * Do not stroke these surfaces.
 * Their shared path boundaries are the one and only edges.
 */
.solid-ring-top,
.solid-ring-outer-wall,
.solid-ring-inner-wall {
  stroke: none;
}

/*
 * The top annulus and both walls are mathematically connected.
 * No rounded segment caps, no duplicated border rings.
 */
.solid-ring-top {
  shape-rendering: geometricPrecision;
}

.solid-ring-outer-wall,
.solid-ring-inner-wall {
  shape-rendering: geometricPrecision;
}

.spending-progress-solid-ring .spending-progress-ring-center {
  position: absolute;
  z-index: 5;

  left: 50%;
  top: 44%;
  width: 54%;

  inset: auto;

  display: grid;
  place-content: center;
  gap: 1px;

  transform: translate(-50%, -50%) !important;
  text-align: center;
  pointer-events: none;
}

.spending-progress-solid-ring
.spending-progress-ring-center::before {
  display: none !important;
  content: none !important;
}

.spending-progress-solid-ring
.spending-progress-used-value {
  color: #11964d;
  font-size: clamp(1rem, 3vw, 1.38rem);
}

.spending-progress-solid-ring.danger
.spending-progress-used-value {
  color: #d82b30;
}

.spending-progress-solid-ring
.spending-progress-ring-center span,
.spending-progress-solid-ring
.spending-progress-ring-center small {
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 760px) {
  .spending-progress-solid-ring {
    width: min(100%, 165px);
  }
}

@media (max-width: 410px) {
  .spending-progress-solid-ring {
    width: min(100%, 148px);
  }
}


/*
 * Expense Progress center text positioning only.
 * DO NOT alter ring geometry.
 *
 * Ring geometry remains:
 * outer radius 72
 * inner radius 49
 * depth 12
 */
.spending-progress-solid-ring .spending-progress-ring-center {
  position: absolute;

  left: 50%;
  top: 44%;

  width: 41%;
  height: 41%;

  inset: auto;

  display: grid;
  place-content: center;
  justify-items: center;
  align-content: center;
  gap: 0;

  transform: translate(-50%, -50%) !important;

  border-radius: 50%;
  text-align: center;
  pointer-events: none;
}

.spending-progress-solid-ring .spending-progress-used-value {
  display: block;
  max-width: 100%;

  margin: 0;

  font-size: clamp(.86rem, 2.3vw, 1.08rem);
  line-height: 1.05;
  letter-spacing: -.035em;

  white-space: nowrap;
  text-align: center;
}

.spending-progress-solid-ring .spending-progress-ring-center span {
  margin-top: 2px;

  font-size: .67rem;
  line-height: 1;
}

.spending-progress-solid-ring .spending-progress-ring-center small {
  margin-top: 3px;

  font-size: .64rem;
  line-height: 1;
}


/*
 * Expense Progress center copy.
 * Text is part of the SVG and anchored to the inner-circle centre.
 * No ring geometry is changed here.
 */
.solid-ring-center-copy {
  font-family: inherit;
  text-rendering: geometricPrecision;
}

.solid-ring-center-amount {
  fill: #11964d;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -.45px;
}

.solid-ring-center-label {
  fill: var(--muted);
  font-size: 7.5px;
  font-weight: 750;
}

.solid-ring-center-percent {
  fill: var(--muted);
  font-size: 7.5px;
  font-weight: 750;
}

.solid-ring-center-copy.danger .solid-ring-center-amount {
  fill: #d82b30;
}

.solid-ring-center-copy.unavailable .solid-ring-center-amount {
  fill: var(--muted);
}


/*
 * Expense Progress size increase only.
 * Geometry, colors, progress logic and SVG coordinates remain unchanged.
 *
 * 178 × 1.3 = 231.4
 * 165 × 1.3 = 214.5
 * 148 × 1.3 = 192.4
 */
.spending-progress-solid-ring {
  width: min(100%, 231.4px);
}

/* Give the larger ring its required layout space without changing its proportions. */
.spending-progress-visual {
  grid-template-columns: minmax(180px, 234px) minmax(105px, 1fr);
  max-width: 510px;
}

@media (max-width: 760px) {
  .spending-progress-solid-ring {
    width: min(100%, 214.5px);
  }

  .spending-progress-visual {
    grid-template-columns: minmax(178px, 217px) minmax(92px, 1fr);
  }
}

@media (max-width: 410px) {
  .spending-progress-solid-ring {
    width: min(100%, 192.4px);
  }

  .spending-progress-visual {
    grid-template-columns: minmax(158px, 195px) minmax(88px, 1fr);
  }
}


/* Expense Progress inner text enlargement only */
.solid-ring-center-amount {
  font-size: 18px;
}

.solid-ring-center-label {
  font-size: 9.5px;
}

.solid-ring-center-percent {
  font-size: 9.5px;
}

/* Statement sort selector */
.statement-sort-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  grid-column: 1 / -1;
  margin: 0 0 0.75rem;
}

.statement-sort-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.9rem;
}

.statement-sort-select {
  width: auto;
  min-width: 155px;
}

/* 2026-09-15 mobile transaction heading + iPhone shopping tab scrolling */
@media (max-width: 760px) {
  /* Keep all Spending > Transactions heading controls inside the phone viewport. */
  #transactionsSection {
    min-width: 0;
    max-width: 100%;
  }

  #transactionsSection .page-heading {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  #transactionsSection .heading-actions {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    align-items: stretch;
  }

  #transactionsSection .heading-actions .count-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #openReceiptImportButton,
  #openManualButton {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-inline: 8px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  /* Native horizontal scrolling for Shopping Lists on iPhone/PWA. */
  .shopping-list-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  /*
   * An older reorder rule used touch-action: pan-y on each tab.
   * Override it so a finger swipe can reach later tabs and the + button.
   */
  .shopping-list-tab[data-list-id],
  .shopping-list-add-tab {
    touch-action: manipulation;
  }
}

@media (max-width: 420px) {
  #transactionsSection .heading-actions {
    gap: 5px;
  }

  #openReceiptImportButton,
  #openManualButton {
    padding-inline: 6px;
    font-size: 0.76rem;
  }
}

/* 2026-09-15 shopping list long-press reorder */
.shopping-list-tab[data-list-id],
.shopping-list-tab-label {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.shopping-list-tab-longpress {
  transform: scale(1.025);
  transition: transform 80ms ease-out, opacity 80ms ease-out;
}


/* BEGIN statement-coverage-timeline */

.statement-view-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  background: #f3f7f5;
}

.statement-view-tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 8px 14px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;
}

.statement-view-tab:hover,
.statement-view-tab:focus-visible {
  color: var(--deep);
  background: #fff;
  outline: none;
}

.statement-view-tab.active {
  color: #fff;
  background: var(--teal);
}

#statementDocumentsPanel[hidden],
#statementCoveragePanel[hidden] {
  display: none !important;
}

.statement-coverage-panel {
  display: grid;
  gap: 12px;
}

.statement-coverage-intro {
  margin: 0;
}

.statement-coverage-caption {
  display: flex;
  gap: 8px 18px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 4px 0 9px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 750;
}

.statement-coverage-missing {
  flex: 1 1 100%;
  color: #8b6413;
}

.statement-coverage-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overscroll-behavior-inline: contain;
}

.statement-coverage-grid {
  --statement-label-width: 210px;
  width: max-content;
  min-width: 100%;
}

.statement-coverage-axis,
.statement-coverage-row {
  display: grid;
  grid-template-columns:
    var(--statement-label-width)
    var(--statement-timeline-width);
  min-width: calc(
    var(--statement-label-width)
    + var(--statement-timeline-width)
  );
}

.statement-coverage-axis {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  background: #f7faf8;
}

.statement-coverage-row {
  min-height: 44px;
  border-bottom: 1px solid #edf2f0;
}

.statement-coverage-row:last-child {
  border-bottom: 0;
}

.statement-coverage-label {
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 9px 11px;
  background: #fff;
}

.statement-coverage-axis-label {
  z-index: 7;
  background: #f7faf8;
  color: var(--deep);
  font-size: 0.76rem;
  font-weight: 900;
}

.statement-coverage-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.77rem;
  font-weight: 820;
}

.statement-coverage-color-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
}

.statement-coverage-axis-track,
.statement-coverage-track {
  position: relative;
  width: var(--statement-timeline-width);
}

.statement-coverage-axis-track {
  min-height: 48px;
}

.statement-coverage-track {
  min-height: 44px;
  background: #fbfcfb;
}

.statement-coverage-month-tick,
.statement-coverage-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid #e5ece9;
  pointer-events: none;
}

.statement-coverage-month-tick span {
  position: absolute;
  top: 8px;
  left: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
  white-space: nowrap;
}

.statement-coverage-gridline {
  border-left-color: #edf2f0;
}

.statement-coverage-segment {
  position: absolute;
  top: 20px;
  height: 5px;
  min-width: 3px;
  border: 0;
  border-radius: 2px;
  padding: 0;
  background: var(--statement-coverage-color);
  box-shadow: 0 1px 2px rgba(16,42,46,0.14);
  cursor: pointer;
  transition:
    top 120ms ease,
    height 120ms ease,
    filter 120ms ease;
}

.statement-coverage-segment:hover,
.statement-coverage-segment:focus-visible {
  top: 18px;
  height: 9px;
  filter: brightness(0.92);
  outline: 2px solid #fff;
  outline-offset: -3px;
}

.statement-coverage-details {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
}

@media (max-width: 700px) {
  .statement-view-tabs {
    display: flex;
    width: 100%;
  }

  .statement-view-tab {
    flex: 1 1 50%;
  }

  .statement-coverage-grid {
    --statement-label-width: 150px;
  }

  .statement-coverage-label {
    padding-inline: 8px;
  }

  .statement-coverage-label-text {
    font-size: 0.71rem;
  }
}

/* END statement-coverage-timeline */


/* BEGIN statement-matches */

.statement-matches-panel {
  margin-top: 1rem;
}

.statement-matches-heading {
  gap: 1rem;
}

.statement-matches-intro {
  margin-top: .35rem;
}

.statement-matches-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1rem 0;
}

.statement-match-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: .3rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 650;
}

.statement-matches-list {
  display: grid;
  gap: 1rem;
}

.statement-match-group {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.statement-match-group-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.statement-match-group-heading h4,
.statement-match-period {
  margin: 0;
}

.statement-match-period {
  margin-top: .2rem;
}

.statement-match-group-total {
  flex: 0 0 auto;
  text-align: right;
  font-size: .9rem;
  font-weight: 700;
}

.statement-match-row {
  display: grid;
  grid-template-columns:
    minmax(0, 1.2fr)
    minmax(0, 1.2fr)
    minmax(170px, .65fr);
  gap: 1rem;
  align-items: center;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.statement-match-row:last-child {
  border-bottom: 0;
}

.statement-match-source,
.statement-match-statement,
.statement-match-amount {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.statement-match-source-badge {
  align-self: flex-start;
  display: inline-flex;
  padding: .2rem .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 750;
}

.statement-match-source-badge.receipt {
  background:
    color-mix(
      in srgb,
      var(--accent) 10%,
      transparent
    );
}

.statement-match-source-badge.manual {
  background:
    color-mix(
      in srgb,
      currentColor 6%,
      transparent
    );
}

.statement-match-description {
  overflow-wrap: anywhere;
}

.statement-match-meta,
.statement-match-arrow {
  font-size: .8rem;
  opacity: .72;
}

.statement-match-amount {
  align-items: flex-end;
  text-align: right;
}

@media (max-width: 760px) {
  .statement-match-group-heading {
    display: grid;
  }

  .statement-match-group-total {
    text-align: left;
  }

  .statement-match-row {
    grid-template-columns: 1fr;
  }

  .statement-match-amount {
    align-items: flex-start;
    text-align: left;
  }
}

/* END statement-matches */


/* Transaction month/year navigation */
.transaction-toolbar {
  flex-wrap: wrap;
}
.transaction-period-nav {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}
.transaction-period-nav .compact-field {
  width: min(150px, 36vw);
}
.transaction-period-step {
  min-width: 44px;
  padding-inline: 12px;
}
.transaction-toolbar .search-field {
  min-width: min(260px, 100%);
}

@media (max-width: 700px) {
  .transaction-toolbar {
    align-items: stretch;
  }

  .transaction-period-nav {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
  }

  .transaction-period-nav .compact-field {
    width: auto;
    min-width: 0;
  }

  .transaction-period-step {
    min-width: 42px;
  }

  .transaction-toolbar .search-field {
    width: 100%;
    min-width: 100%;
  }
}


/* Mobile compact transaction layout + vertical bottom menus */
@media (max-width: 760px) {

  /*
   * Spending / More fly-out menus.
   * One destination per row instead of two columns.
   */
  .bottom-nav-menu {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 8px;
  }

  .bottom-nav-menu button {
    width: 100%;
    min-height: 42px;
    padding: 7px 11px;
  }

  /*
   * Transactions heading.
   * Count sits immediately beside the title.
   */
  #transactionsSection .page-heading {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 9px;
  }

  #transactionsSection .transaction-heading-copy {
    min-width: 0;
  }

  #transactionsSection .transaction-heading-copy .eyebrow {
    margin-bottom: 2px;
  }

  #transactionsSection .transaction-title-line {
    display: flex;
    gap: 9px;
    align-items: center;
    min-width: 0;
  }

  #transactionsSection .transaction-title-line h2 {
    margin: 0;
    line-height: 1.05;
  }

  #transactionsSection .transaction-title-line .count-badge {
    flex: 0 0 auto;
    min-width: 36px;
    min-height: 25px;
    padding: 2px 9px;
    font-size: 0.78rem;
  }

  /*
   * Compact actions.
   * Undo the older two-large-column mobile treatment.
   */
  #transactionsSection .heading-actions {
    width: auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
  }

  #openReceiptImportButton,
  #openManualButton {
    width: auto;
    min-width: 0;
    min-height: 34px;
    padding: 6px 11px;
    border-radius: 11px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  /*
   * Compact period strip.
   * Remove the large panel/card surrounding it.
   */
  #transactionsSection .transaction-toolbar {
    display: grid;
    gap: 3px;
    margin: 0 0 9px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #transactionsSection .transaction-period-nav {
    width: 100%;
    display: grid;
    grid-template-columns:
      36px
      minmax(0, 0.9fr)
      minmax(0, 1.1fr)
      36px;
    gap: 5px;
    align-items: end;
  }

  #transactionsSection .transaction-period-nav .compact-field {
    width: auto;
    min-width: 0;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 800;
  }

  #transactionsSection .transaction-period-nav select {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 5px 25px 5px 8px;
    font-size: 0.82rem;
  }

  #transactionsSection .transaction-period-step {
    width: 36px;
    min-width: 36px;
    min-height: 38px;
    padding: 4px;
    border-radius: 11px;
  }

  /*
   * Search was the largest unnecessary mobile row.
   * Desktop search remains untouched.
   */
  #transactionsSection .transaction-toolbar .search-field {
    display: none;
  }

  /*
   * Preserve Needs review, but make it a small control.
   */
  #transactionsSection .transaction-toolbar .check-field {
    width: max-content;
    min-height: 27px;
    margin: 0;
    gap: 5px;
    font-size: 0.72rem;
  }

  #transactionsSection .transaction-toolbar .check-field input {
    width: 15px;
    min-height: 15px;
  }
}

@media (max-width: 420px) {
  #transactionsSection .transaction-title-line h2 {
    font-size: 1.9rem;
  }

  #openReceiptImportButton,
  #openManualButton {
    padding-inline: 8px;
    font-size: 0.7rem;
  }

  #transactionsSection .transaction-period-nav {
    grid-template-columns:
      33px
      minmax(0, 0.88fr)
      minmax(0, 1.12fr)
      33px;
    gap: 4px;
  }

  #transactionsSection .transaction-period-step {
    width: 33px;
    min-width: 33px;
  }
}

/* Responsive Transactions actions */
@media (max-width: 760px) {
  #transactionsSection .heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }
  #transactionsSection .heading-actions > button {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.75rem;
    white-space: nowrap;
  }
}
@media (max-width: 420px) {
  #transactionsSection .heading-actions > button {
    padding: 7px 8px;
    font-size: 0.71rem;
  }
}


/* Recurring expenses in Transactions */
#transactionsRecurringPanel {
  width: 100%;
  margin-bottom: 18px;
}
#transactionsRecurringPanel[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  #transactionsSection .heading-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 4px;
  }
  #transactionsSection .heading-actions > button {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 37px;
    padding: 7px 2px;
    font-size: 0;
    line-height: 1.2;
    overflow: hidden;
  }
  #transactionsSection .heading-actions > button::after {
    content: attr(data-mobile-label);
    font-size: clamp(0.66rem, 2.6vw, 0.77rem);
    font-weight: 700;
    white-space: nowrap;
  }
}

@media (min-width: 900px) {
  #manageSection .manage-grid {
    display: block;
    columns: 2;
    column-gap: 16px;
  }
  #manageSection .manage-grid > .manage-panel {
    display: inline-block;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 16px;
    vertical-align: top;
    break-inside: avoid;
  }
  #manageSection .manage-grid > .wide-panel {
    display: block;
    column-span: all;
    width: 100%;
  }
}


/* Recurring expenses insight — launch-ready, responsive, no tank changes */
.recurring-insights-panel { margin-bottom: 16px; }
.recurring-insights-heading { margin-bottom: 16px; }
.recurring-insights-active-note {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}
.recurring-insights-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.recurring-insights-total-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px 16px;
  background: linear-gradient(180deg, #fbfdfc 0%, var(--teal-soft) 100%);
}
.recurring-insights-total-card > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}
.recurring-insights-total-card > strong {
  color: var(--deep);
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.recurring-insights-total-card > small { color: var(--muted); font-weight: 700; }
.recurring-insights-list { display: grid; }
.recurring-insights-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border-top: 1px solid #edf1ee;
  padding: 14px 2px;
}
.recurring-insights-row-main { min-width: 0; display: grid; gap: 4px; }
.recurring-insights-row-main > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.98rem; }
.recurring-insights-row-main > span { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.recurring-insights-row-amount { display: grid; gap: 3px; text-align: right; }
.recurring-insights-row-amount > strong { color: var(--deep); font-size: 1rem; font-variant-numeric: tabular-nums; }
.recurring-insights-row-amount > span { color: var(--teal); font-size: 0.73rem; font-weight: 800; white-space: nowrap; }
.recurring-insights-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.recurring-insights-inactive { margin-top: 6px; }
.recurring-insights-inactive-details { border-top: 1px solid #edf1ee; padding-top: 10px; }
.recurring-insights-inactive-details > summary { color: var(--muted); font-size: 0.78rem; font-weight: 800; cursor: pointer; }
.recurring-insights-inactive-list { margin-top: 7px; }
.recurring-insights-row.is-inactive { opacity: 0.58; }

@media (max-width: 720px) {
  .recurring-insights-panel { padding: 18px 16px; }
  .recurring-insights-heading { align-items: flex-start; gap: 10px; margin-bottom: 13px; }
  .recurring-insights-active-note { padding: 6px 9px; font-size: 0.67rem; }
  .recurring-insights-totals { grid-template-columns: 1fr; gap: 8px; }
  .recurring-insights-total-card { padding: 13px 14px; }
  .recurring-insights-row { grid-template-columns: 1fr; gap: 7px; padding: 13px 1px; }
  .recurring-insights-row-amount { grid-template-columns: auto 1fr; align-items: baseline; gap: 9px; text-align: left; }
  .recurring-insights-row-amount > span { white-space: normal; }
}
