:root {
  color-scheme: dark;
  --bg: #1f2026;
  --surface: #26272f;
  --surface-2: #2d2e36;
  --surface-3: #1b1c21;
  --text: #f5f6fa;
  --muted: #8f929b;
  --line: #353742;
  --blue: #3da1ff;
  --red: #ff5b57;
  --green: #35d07f;
  --purple: #c084fc;
  --amber: #f4b84a;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  background: #1a1b20;
  color: #ffffff;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--red);
  font-weight: 800;
  font-size: 15px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-heading h3,
.section-heading p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p {
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}

.nav a.active,
.nav a:hover {
  background: var(--surface-2);
  color: #ffffff;
}

.mobile-bottom-nav {
  display: none;
}

.mobile-ledger-header {
  display: none;
}

.mobile-fab {
  display: none;
}

.mobile-section-actions,
.mobile-popover-menu,
.mobile-more-panel,
.mobile-stats-screen,
.mobile-transaction-type-tabs {
  display: none;
}

.share-slip-panel {
  display: grid;
  gap: 16px;
  max-width: 720px;
}

.share-slip-status {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
}

.share-slip-results {
  display: grid;
  gap: 10px;
}

.share-slip-result {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.share-slip-result span {
  color: var(--muted);
  font-weight: 900;
}

.share-slip-result strong,
.share-slip-result p {
  margin: 0;
}

.share-slip-result p {
  margin-top: 4px;
  color: var(--muted);
}

.share-slip-result.share-status-saved span {
  color: var(--green);
}

.share-slip-result.share-status-pending span {
  color: var(--amber);
}

.share-slip-result.share-status-review span {
  color: var(--blue);
}

.share-slip-result.share-status-skipped span {
  color: var(--muted);
}

.share-slip-result.share-status-error span {
  color: var(--red);
}

.main {
  padding: 28px;
  display: grid;
  gap: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow {
  color: var(--blue);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

.topbar h2 {
  font-size: 28px;
  line-height: 1.2;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

@media (min-width: 821px) {
  .main > .section {
    display: none;
  }

  .main > .section.active-section {
    display: block;
  }
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
}

.section-heading h3 {
  font-size: 20px;
}

.section-heading p,
.muted {
  color: var(--muted);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 16px;
  min-height: 100px;
  display: grid;
  align-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  font-size: 26px;
}

.metric.accent {
  background: #1c3047;
}

.dashboard-balance-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
}

.dashboard-balance-strip .metric,
.dashboard-balance-strip > div {
  min-height: 76px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.dashboard-balance-strip .metric:last-child,
.dashboard-balance-strip > div:last-child {
  border-right: 0;
}

.dashboard-balance-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-balance-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  margin-top: 14px;
}

.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel-heading h4,
.panel-heading p {
  margin: 0;
}

.panel-heading p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.panel-heading a {
  color: var(--blue);
  font-weight: 800;
  font-size: 13px;
}

.dashboard-account-groups {
  display: grid;
  gap: 12px;
}

.dashboard-account-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}

.dashboard-account-group h5 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.025);
  font-size: 14px;
}

.dashboard-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.dashboard-account-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.dashboard-account-row strong {
  white-space: nowrap;
}

.dashboard-pie-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-pie-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-weight: 800;
}

.dashboard-pie,
.dashboard-empty-pie {
  width: min(210px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 8px auto 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.dashboard-empty-pie {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-3);
  font-weight: 800;
}

.dashboard-breakdown-list {
  display: grid;
  gap: 8px;
}

.dashboard-breakdown-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.dashboard-breakdown-row span {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border-radius: 6px;
  background: var(--swatch);
  color: #15161b;
  font-weight: 900;
}

.dashboard-breakdown-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-breakdown-row b {
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .dashboard-balance-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .dashboard-balance-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 0;
    border-right: 0;
    border-left: 0;
  }

  .dashboard-balance-strip .metric,
  .dashboard-balance-strip > div {
    min-height: 60px;
    padding: 8px 10px;
  }

  .dashboard-balance-strip strong {
    font-size: 15px;
  }

  .dashboard-overview-grid {
    margin-top: 8px;
    gap: 8px;
  }

  .dashboard-panel {
    border-radius: 0;
    border-right: 0;
    border-left: 0;
    padding: 10px 12px;
  }

  .dashboard-pie-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-action-queue {
  margin-top: 12px;
}

.action-queue {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.action-queue h4,
.action-queue p {
  margin: 0;
}

.action-queue.empty p {
  color: var(--muted);
  margin-top: 4px;
}

.action-queue-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.action-queue-heading a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
}

.action-queue-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.action-queue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

.action-queue-item > span {
  border-radius: 6px;
  padding: 3px 6px;
  background: rgba(148, 163, 184, 0.18);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.action-queue-item.critical > span {
  background: rgba(255, 91, 87, 0.16);
  color: var(--red);
}

.action-queue-item.warning > span {
  background: rgba(244, 184, 74, 0.16);
  color: var(--amber);
}

.action-queue-item.info > span {
  background: rgba(63, 169, 255, 0.16);
  color: var(--blue);
}

.action-queue-item strong,
.action-queue-item p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-queue-item p,
.action-queue-item small {
  color: var(--muted);
  font-size: 12px;
}

.action-queue-item small {
  grid-column: 2;
}

.account-groups,
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.credit-card-forecast {
  margin-bottom: 14px;
}

.credit-card-forecast-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.2fr);
  gap: 14px;
}

.credit-card-forecast-panel .panel-heading {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.credit-card-due-list {
  display: grid;
  gap: 8px;
}

.credit-card-due-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-3);
}

.credit-card-due-list strong,
.credit-card-due-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card-due-list span {
  color: var(--muted);
  font-size: 12px;
}

.credit-card-due-list b {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
}

.group,
.card,
.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-2);
}

.group h4,
.card h4 {
  margin: 0 0 12px;
}

.account-row,
.card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.account-row {
  width: 100%;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.account-row span,
.account-row small {
  display: block;
}

.account-row small {
  color: var(--muted);
  margin-top: 2px;
}

.account-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.account-mobile-summary {
  display: none;
}

.account-mobile-form-row,
.account-currency-chips,
.account-card-preview,
.transaction-account-summary {
  display: none;
}

.group h4 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.group h4 strong {
  color: var(--blue);
  font-size: 15px;
}

.account-detail-summary,
.account-detail-transactions {
  display: grid;
  gap: 10px;
}

.account-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.account-detail-metrics div,
.account-detail-transaction {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.account-detail-metrics span,
.account-detail-transaction small {
  color: var(--muted);
  font-size: 12px;
}

.account-detail-metrics strong {
  display: block;
  margin-top: 4px;
}

.account-detail-transaction {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.account-row:first-of-type,
.card-row:first-of-type {
  border-top: 0;
}

.number {
  text-align: right;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.compact-field {
  min-width: 160px;
  margin: 0;
}

.search-field {
  min-width: min(260px, 100%);
  flex: 1 1 220px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 22px 12px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

tbody tr {
  background: var(--surface);
}

tbody tr:hover {
  background: var(--surface-2);
}

.date-divider td {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}

.date-divider-content {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.daily-flow {
  display: inline-flex;
  gap: 18px;
  font-size: 15px;
  white-space: nowrap;
}

.date-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.date-label strong {
  font-size: 19px;
  line-height: 1;
}

.date-label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.weekday-badge {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.weekday-badge.weekday {
  background: #7b7d84;
}

.weekday-badge.sat {
  background: var(--blue);
}

.weekday-badge.sun {
  background: var(--red);
}

.transaction-merchant {
  display: grid;
  gap: 2px;
}

.transaction-merchant strong {
  font-size: 15px;
}

.transaction-merchant span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-category-meta {
  display: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.pill.expense {
  color: var(--red);
  background: rgba(255, 91, 87, 0.12);
}

.pill.income {
  color: var(--blue);
  background: rgba(61, 161, 255, 0.12);
}

.pill.transfer {
  color: var(--text);
  background: var(--surface-3);
}

.pill.investment {
  color: var(--green);
  background: rgba(53, 208, 127, 0.12);
}

.pill.reimbursement {
  color: var(--purple);
  background: rgba(192, 132, 252, 0.12);
}

.review-list {
  display: grid;
  gap: 12px;
}

.analytics-grid,
.workflow-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.4fr;
  gap: 14px;
}

.workflow-grid {
  grid-template-columns: 0.9fr 1.6fr;
}

.analysis-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-2);
}

.analysis-panel h4 {
  margin: 0 0 12px;
}

.analysis-panel-wide {
  grid-column: 1 / -1;
}

.mini-metrics,
.breakdown-list,
.trend-chart,
.cash-flow-mix,
.drilldown-panel,
.duplicate-list {
  display: grid;
  gap: 10px;
}

.cash-flow-mix {
  justify-items: center;
}

.donut-chart {
  width: 148px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line);
}

.donut-chart span {
  position: relative;
  z-index: 1;
  font-weight: 900;
  font-size: 0.95rem;
}

.mix-legend {
  width: 100%;
  display: grid;
  gap: 8px;
}

.mix-legend div {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.mix-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.mini-metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.mini-metric:last-child {
  border-bottom: 0;
}

.income-text {
  color: var(--blue);
}

.expense-text {
  color: var(--red);
}

.investment-text {
  color: var(--green);
}

.transfer-text {
  color: var(--text);
}

.reimbursement-text {
  color: var(--purple);
}

.breakdown-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.breakdown-row span,
.breakdown-row strong {
  position: relative;
  z-index: 1;
}

.breakdown-row small {
  color: var(--muted);
  margin-left: 6px;
}

.breakdown-row i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 91, 87, 0.14);
}

.income-breakdown i {
  background: rgba(63, 169, 255, 0.14);
}

.drilldown-header,
.drilldown-transaction,
.subcategory-chip {
  display: grid;
  align-items: center;
  gap: 10px;
}

.drilldown-header {
  grid-template-columns: 1fr auto;
}

.drilldown-header strong {
  display: block;
  margin-top: 2px;
}

.drilldown-subcategories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.subcategory-chip {
  grid-template-columns: auto auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: fit-content;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
}

.subcategory-chip.active {
  border-color: var(--blue);
  background: rgba(63, 169, 255, 0.12);
}

.drilldown-transactions {
  display: grid;
  gap: 8px;
}

.drilldown-transaction {
  grid-template-columns: 90px 1fr auto;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.drilldown-transaction small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.trend-row {
  display: grid;
  grid-template-columns: 70px minmax(90px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.budget-form,
.budget-list {
  display: grid;
  gap: 10px;
}

.budget-form {
  margin-top: 14px;
}

.budget-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-3);
}

.budget-row h4,
.budget-row p {
  margin: 0;
}

.budget-row p {
  color: var(--muted);
  margin-top: 4px;
}

.budget-row.warning {
  border-color: rgba(245, 158, 11, 0.55);
}

.budget-row.over {
  border-color: rgba(255, 91, 87, 0.65);
}

.budget-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.budget-meter {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.budget-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.budget-row.warning .budget-meter i {
  background: var(--amber);
}

.budget-row.over .budget-meter i {
  background: var(--red);
}

.trend-bars {
  display: grid;
  gap: 4px;
}

.trend-bars i {
  display: block;
  height: 8px;
  border-radius: 8px;
}

.income-bar {
  background: var(--blue);
}

.expense-bar {
  background: var(--red);
}

.review-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.review-item h4,
.review-item p {
  margin: 0;
}

.review-item p {
  color: var(--muted);
  margin-top: 4px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  background: var(--blue);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 700;
}

.danger-button {
  background: rgba(255, 91, 87, 0.16);
  color: var(--red);
  padding: 10px 14px;
  font-weight: 700;
}

.compact-button {
  padding: 6px 10px;
  font-size: 13px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.holding-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h4 {
  margin: 0;
}

.statement-queue {
  display: grid;
  gap: 10px;
}

.statement-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.statement-card h4,
.statement-card p {
  margin: 0;
}

.statement-card p {
  color: var(--muted);
  margin-top: 4px;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 10px 14px;
  font-weight: 700;
}

.icon-button {
  width: 36px;
  height: 36px;
  background: var(--surface-2);
  font-size: 22px;
  line-height: 1;
}

.dialog {
  width: min(480px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--text);
}

.wide-dialog {
  width: min(760px, calc(100vw - 28px));
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.field {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.field span {
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-3);
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.warning {
  color: var(--amber);
  background: rgba(244, 184, 74, 0.12);
  border: 1px solid rgba(244, 184, 74, 0.35);
  border-radius: 8px;
  padding: 10px;
  margin: 10px 0;
}

.form-error {
  color: var(--red);
  background: rgba(255, 91, 91, 0.12);
  border: 1px solid rgba(255, 91, 91, 0.4);
  border-radius: 8px;
  padding: 10px;
  margin-top: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.transaction-detail-header {
  justify-content: flex-start;
}

.transaction-back-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.transaction-back-button span {
  font-size: 20px;
  line-height: 1;
}

.danger-outline-button {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.38);
}

.danger-outline-button::before {
  content: "⌫";
  color: var(--text);
}

.ledger-details {
  margin-top: 14px;
}

.transaction-action-details {
  display: grid;
  gap: 14px;
}

.transaction-detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.transaction-detail-tabs button {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.transaction-detail-tabs button.active {
  color: var(--text);
  border-color: currentColor;
}

.transaction-detail-tabs .income-tab.active {
  color: var(--blue);
}

.transaction-detail-tabs .reimbursement-tab.active {
  color: var(--purple);
}

.transaction-detail-tabs .expense-tab.active {
  color: var(--red);
}

.transaction-detail-tabs .investment-tab.active {
  color: var(--green);
}

.transaction-detail-tabs .transfer-tab.active {
  color: var(--text);
}

.transaction-detail-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.transaction-detail-grid span,
.transaction-detail-description span {
  color: var(--muted);
  font-weight: 800;
}

.editable-transaction-grid input,
.editable-transaction-grid select {
  min-height: 38px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.danger-icon-button {
  color: var(--red);
}

.transaction-detail-grid span,
.transaction-detail-grid strong {
  min-height: 38px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.transaction-detail-grid strong {
  justify-content: flex-start;
  min-width: 0;
  overflow-wrap: anywhere;
}

.transaction-detail-rows {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
}

.transaction-detail-row {
  min-height: 39px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.transaction-detail-row[hidden] {
  display: none;
}

.transaction-detail-row span {
  border-bottom: 0;
}

.transaction-detail-row input,
.transaction-detail-row select,
.transaction-detail-row strong {
  min-height: 38px;
  border-bottom: 0;
}

.transaction-category-summary {
  min-height: 38px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 900;
}

.transaction-recurring-button {
  justify-self: end;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.mobile-category-picker-dialog {
  width: min(520px, 100vw);
  max-width: 100vw;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
}

.transaction-category-picker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 340px;
}

.category-picker-roots,
.category-picker-leaves {
  display: grid;
  align-content: start;
}

.category-picker-roots {
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.category-picker-roots button,
.category-picker-leaves button {
  min-height: 52px;
  padding: 10px 18px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 900;
}

.category-picker-roots button.active {
  background: rgba(255, 91, 87, 0.32);
  color: var(--red);
}

.transaction-detail-description {
  display: grid;
  gap: 10px;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.transaction-detail-description p {
  margin: 0;
  color: var(--text);
}

.duplicate-details {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.duplicate-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.duplicate-card h4,
.duplicate-card p {
  margin: 0;
}

.duplicate-card p + p {
  margin-top: 4px;
}

.claim-row,
.holding-row,
.recurring-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.holding-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.claim-row strong,
.claim-row p,
.holding-row strong,
.holding-row p,
.recurring-card h4,
.recurring-card p {
  margin: 0;
}

.claim-row p,
.holding-row p,
.recurring-card p {
  color: var(--muted);
  margin-top: 4px;
}

.claim-row .claim-meta {
  font-size: 0.82rem;
  line-height: 1.35;
}

.recurring-list {
  display: grid;
  gap: 12px;
}

.recurring-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.recurring-edit-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.recurring-edit-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: var(--surface-3);
  color: var(--text);
}

.forecast-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-3);
}

.forecast-row p,
.forecast-row strong {
  margin: 0;
}

.forecast-row p {
  color: var(--muted);
  margin-top: 4px;
}

.assistant-box {
  display: grid;
  gap: 14px;
}

.assistant-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.assistant-form input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
}

.assistant-answer {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
  min-height: 56px;
}

.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 0.8fr;
  gap: 14px;
  align-items: start;
}

.download-link {
  display: inline-flex;
  margin-top: 12px;
  color: var(--blue);
  font-weight: 700;
}

.slip-preview {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.slip-ocr-status {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.slip-ocr-status.is-loading {
  border-color: rgba(74, 163, 255, 0.45);
  color: var(--text);
}

.slip-ocr-status.is-success {
  border-color: rgba(48, 209, 88, 0.45);
  color: var(--text);
}

.slip-ocr-status.is-error {
  border-color: rgba(255, 91, 87, 0.45);
  color: var(--red);
}

.check-list {
  display: grid;
  gap: 10px;
}

.provider-status-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.provider-status-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-3);
}

.provider-status-row span {
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.provider-status-row strong,
.provider-status-row p {
  margin: 0;
}

.provider-status-row p {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

.provider-check-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.provider-check-list small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.25;
}

.provider-check-list .check-ok {
  color: var(--green);
}

.provider-check-list .check-missing {
  color: var(--amber);
}

.readiness-ready span,
.readiness-local span {
  color: var(--green);
}

.readiness-mock span {
  color: var(--amber);
}

.readiness-gap span {
  color: var(--red);
}

.check-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  color: var(--text);
}

.check-row span {
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.check-row strong,
.check-row p {
  margin: 0;
}

.check-row p {
  color: var(--muted);
  margin-top: 4px;
}

.check-pass span {
  color: var(--green);
  background: rgba(53, 208, 127, 0.14);
}

.check-fail span {
  color: var(--red);
  background: rgba(255, 91, 87, 0.14);
}

.check-pass,
.readiness-ready,
.readiness-local {
  border-left-color: var(--green);
}

.check-fail,
.readiness-gap {
  border-left-color: var(--red);
}

.readiness-mock {
  border-left-color: var(--amber);
}

.audit-panel {
  margin-top: 14px;
}

.audit-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
}

.backup-list {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}

.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.backup-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.status-pill {
  align-self: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.audit-row {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.audit-row span {
  color: var(--muted);
  font-size: 12px;
}

.audit-row strong,
.audit-row p {
  margin: 0;
}

.audit-row p {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.lock-dialog {
  max-width: 420px;
}

.notification-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  color: var(--text);
}

.notification-card > span {
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.notification-card h4,
.notification-card p {
  margin: 0;
}

.notification-card p {
  color: var(--muted);
  margin-top: 4px;
}

.notification-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.notification-actions strong {
  color: var(--muted);
}

.notification-card.critical {
  border-left-color: var(--red);
}

.notification-card.critical > span {
  color: var(--red);
  background: rgba(255, 91, 87, 0.14);
}

.notification-card.warning {
  border-left-color: var(--amber);
}

.notification-card.warning > span {
  color: var(--amber);
  background: rgba(255, 184, 77, 0.14);
}

.notification-card.info {
  border-left-color: var(--blue);
}

.notification-card.info > span {
  color: var(--blue);
  background: rgba(63, 169, 255, 0.14);
}

.memory-list {
  display: grid;
  gap: 12px;
}

.memory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.memory-card h4,
.memory-card p {
  margin: 0;
}

.memory-card p {
  color: var(--muted);
  margin-top: 4px;
}

.memory-card > span {
  color: var(--muted);
  font-size: 13px;
}

.ledger-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 12px;
}

.ok-text {
  color: var(--green);
  font-weight: 800;
}

.bad-text {
  color: var(--red);
  font-weight: 800;
}

.paid-text {
  color: var(--green);
}

.unpaid-text {
  color: var(--amber);
}

.overdue-text {
  color: var(--red);
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px 18px 10px;
    border-bottom: 1px solid var(--line);
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow: hidden;
  }

  .brand {
    margin-bottom: 14px;
    min-width: 0;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: none;
    width: 100%;
    max-width: calc(100vw - 36px);
    min-width: 0;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 13px;
    min-height: 42px;
  }

  .main {
    padding: 16px 18px 88px;
    gap: 16px;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow: hidden;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 10px;
    min-width: 0;
  }

  .topbar-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
  }

  .section {
    padding: 16px;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .section-heading h3 {
    font-size: 22px;
  }

  .section-heading p {
    line-height: 1.45;
  }

  .metrics-grid,
  .action-queue-list,
  .account-groups,
  .cards-grid,
  .credit-card-forecast-panel,
  .form-grid,
  .analytics-grid,
  .workflow-grid,
  .claim-row,
  .recurring-card,
  .forecast-row,
  .assistant-form,
  .import-grid,
  .notification-card,
  .memory-card {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .metric {
    min-height: 88px;
    padding: 14px;
  }

  .metric strong {
    font-size: 25px;
  }

  .account-row,
  .card-row,
  .transaction-row,
  .claim-row,
  .notification-card,
  .memory-card,
  .backup-row {
    gap: 10px;
  }

  .account-row,
  .card-row {
    align-items: flex-start;
  }

  .account-row > div:last-child,
  .card-row > div:last-child {
    flex-shrink: 0;
  }
}

@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 0 0 86px;
    max-width: 100vw;
    overflow: hidden;
    gap: 0;
    background: var(--surface);
  }

  .topbar,
  #dashboard {
    display: none;
  }

  .mobile-ledger-header {
    position: fixed;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    top: 0;
    z-index: 10;
    display: none;
    order: 0;
    overflow: hidden;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  body[data-mobile-section="transactions"] .mobile-ledger-header {
    display: block;
  }

  .mobile-ledger-toolbar {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 6px 10px 2px;
  }

  .mobile-icon-link,
  .mobile-month-button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    font-size: 24px;
    line-height: 1;
  }

  .mobile-month-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 16px;
    font-weight: 800;
  }

  .mobile-month-title .mobile-month-button:first-child {
    display: none;
  }

  .mobile-month-title strong {
    min-width: 0;
    white-space: nowrap;
  }

  .mobile-toolbar-icons {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    color: var(--text);
    font-size: 21px;
  }

  .mobile-ledger-tabs {
    display: grid;
    width: 100vw;
    grid-template-columns: repeat(5, 20vw);
    padding: 0 0 0 0;
    border-bottom: 1px solid var(--line);
  }

  .mobile-ledger-tabs a,
  .mobile-ledger-tabs button {
    min-height: 36px;
    display: grid;
    place-items: center;
    border-bottom: 2px solid transparent;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-weight: 800;
    font: inherit;
    cursor: pointer;
  }

  .mobile-ledger-tabs a.active,
  .mobile-ledger-tabs button.active {
    color: var(--text);
    border-color: var(--red);
  }

  .mobile-ledger-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4px 10px 7px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    background: var(--surface-3);
  }

  .mobile-ledger-summary div {
    display: grid;
    gap: 2px;
  }

  .mobile-ledger-summary span {
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-ledger-summary strong {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .section {
    display: none;
  }

  body[data-mobile-section="transactions"] #transactions,
  body[data-mobile-section="analytics"] #analytics,
  body[data-mobile-section="accounts"] #accounts,
  body[data-mobile-section="account-detail"] #account-detail,
  body[data-mobile-section="account-visibility"] #account-visibility,
  body[data-mobile-section="data"] #data,
  body[data-mobile-section="dashboard"] #dashboard,
  body[data-mobile-section="cards"] #cards,
  body[data-mobile-section="budgets"] #budgets,
  body[data-mobile-section="reimbursements"] #reimbursements,
  body[data-mobile-section="investments"] #investments,
  body[data-mobile-section="recurring"] #recurring,
  body[data-mobile-section="forecast"] #forecast,
  body[data-mobile-section="notifications"] #notifications,
  body[data-mobile-section="merchant-memory"] #merchant-memory,
  body[data-mobile-section="assistant"] #assistant,
  body[data-mobile-section="import"] #import,
  body[data-mobile-section="slip-ocr"] #slip-ocr,
  body[data-mobile-section="share-slip"] #share-slip,
  body[data-mobile-section="system-checks"] #system-checks,
  body[data-mobile-section="ai-review"] #ai-review {
    display: block;
  }

  #transactions {
    order: 1;
    padding: 136px 0 0;
    border: 0;
    border-radius: 0;
    background: var(--surface);
  }

  #transactions .section-heading,
  #transactions .filters {
    display: none;
  }

  .section:not(#transactions) {
    order: 1;
    margin: 0;
    min-height: calc(100vh - 86px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .ghost-button {
    min-height: 42px;
    font-size: 14px;
    white-space: normal;
    line-height: 1.15;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 64px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(27, 28, 33, 0.96);
    backdrop-filter: blur(10px);
  }

  .mobile-bottom-nav a {
    display: grid;
    gap: 2px;
    place-items: center;
    min-width: 0;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-bottom-nav a::before {
    display: block;
    font-size: 20px;
    line-height: 1;
  }

  .mobile-bottom-nav a:nth-child(1)::before {
    content: "▤";
  }

  .mobile-bottom-nav a:nth-child(2)::before {
    content: "▥";
  }

  .mobile-bottom-nav a:nth-child(3)::before {
    content: "◎";
  }

  .mobile-bottom-nav a:nth-child(4)::before {
    content: "⋯";
  }

  .mobile-bottom-nav a:nth-child(1)::before {
    content: "\25A4";
  }

  .mobile-bottom-nav a:nth-child(2)::before {
    content: "\25A5";
  }

  .mobile-bottom-nav a:nth-child(3)::before {
    content: "\25CE";
  }

  .mobile-bottom-nav a:nth-child(4)::before {
    content: "\22EF";
  }

  .mobile-bottom-nav a:hover,
  .mobile-bottom-nav a:focus,
  .mobile-bottom-nav a.active {
    color: var(--red);
    background: transparent;
  }

  .mobile-fab {
    position: fixed;
    right: 18px;
    bottom: 84px;
    z-index: 21;
    display: none;
    place-items: center;
    width: 54px;
    height: 54px;
    min-height: 54px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.28);
    color: #ffffff;
    font-size: 32px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
  }

  body[data-mobile-section="transactions"] .mobile-fab {
    display: grid;
  }

  body:has(dialog[open]) .mobile-bottom-nav,
  body:has(dialog[open]) .mobile-fab {
    display: none;
  }

  #transactions .table-wrap {
    overflow: visible;
  }

  #transactions table,
  #transactions tbody {
    display: block;
    width: 100%;
  }

  #transactions thead {
    display: none;
  }

  #transactions tbody {
    display: grid;
    gap: 0;
    padding: 0;
  }

  #transactions .mobile-ledger-view-row td {
    display: block;
    padding: 0;
    border: 0;
  }

  .mobile-calendar-view {
    display: grid;
    min-height: calc(100vh - 136px - 72px);
    background: var(--surface);
  }

  .mobile-calendar-weekdays,
  .mobile-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .mobile-calendar-weekdays {
    min-height: 26px;
    align-items: center;
    padding: 0 2px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-align: center;
  }

  .mobile-calendar-weekdays span:nth-child(7) {
    color: var(--red);
  }

  .mobile-calendar-grid {
    grid-auto-rows: minmax(66px, 1fr);
  }

  .mobile-calendar-cell {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
    min-height: 66px;
    padding: 8px 4px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.055);
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    background: transparent;
    color: var(--text);
    text-align: center;
  }

  .mobile-calendar-cell:nth-child(7n) {
    color: var(--red);
  }

  .mobile-calendar-cell.outside {
    color: var(--muted);
    opacity: 0.62;
  }

  .mobile-calendar-cell.selected {
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-calendar-cell strong {
    font-size: 12px;
  }

  .mobile-calendar-cell span {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
  }

  .mobile-monthly-view,
  .mobile-total-view {
    display: grid;
    background: var(--surface);
  }

  .mobile-month-row {
    display: grid;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .mobile-month-row > button,
  .mobile-week-row {
    display: grid;
    grid-template-columns: minmax(92px, 1fr) minmax(78px, auto) minmax(86px, auto);
    gap: 8px;
    align-items: center;
    min-height: 54px;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .mobile-month-row.active > button {
    background: rgba(255, 91, 87, 0.26);
  }

  .mobile-month-row span {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .mobile-month-row span strong {
    font-size: 17px;
  }

  .mobile-month-row span small,
  .mobile-week-row small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
  }

  .mobile-month-row > button > small,
  .mobile-week-row > small {
    grid-column: 3;
    justify-self: end;
  }

  .mobile-month-row b,
  .mobile-week-row b {
    justify-self: end;
    font-size: 15px;
    white-space: nowrap;
  }

  .mobile-week-list {
    display: grid;
  }

  .mobile-week-row {
    min-height: 46px;
    padding-left: 30px;
    background: var(--surface-3);
  }

  .mobile-week-row strong {
    font-size: 14px;
  }

  .mobile-total-budget {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-total-budget strong {
    font-size: 19px;
  }

  .mobile-total-budget button,
  .mobile-total-export {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 900;
  }

  .mobile-total-card {
    display: grid;
    gap: 14px;
    margin: 16px 14px 12px;
    padding: 18px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }

  .mobile-total-card h4 {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    font-size: 19px;
  }

  .mobile-total-card h4 span {
    color: var(--muted);
    font-size: 14px;
  }

  .mobile-total-lines {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 13px 14px;
    align-items: center;
  }

  .mobile-total-lines span {
    color: var(--muted);
    font-weight: 900;
  }

  .mobile-total-lines strong {
    justify-self: end;
    color: var(--text);
    font-size: 16px;
  }

  .mobile-total-export {
    justify-self: stretch;
    min-height: 42px;
    margin: 0 14px;
  }

  #transactions tr {
    display: grid;
    width: 100%;
  }

  #transactions .date-divider {
    margin-top: 0;
  }

  #transactions .date-divider td {
    display: block;
    padding: 6px 10px 5px 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
    font-size: 17px;
  }

  #transactions .transaction-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    min-height: 52px;
    padding: 0;
    border-bottom: 0;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
  }

  #transactions .transaction-row td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(92px, auto);
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 0;
    border: 0;
    border-bottom: 0;
    min-width: 0;
  }

  #transactions .transaction-row.day-end td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  }

  #transactions .desktop-date {
    display: none;
  }

  #transactions .mobile-category-meta {
    display: grid;
    gap: 0;
    min-width: 0;
  }

  #transactions .mobile-category-meta strong {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #transactions .mobile-category-meta span {
    color: #6f727b;
    font-size: 11px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #transactions .mobile-transaction-main {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  #transactions .mobile-transaction-main strong {
    color: var(--text);
    font-size: 17px;
    font-weight: 900;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #transactions .mobile-transaction-main small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #transactions .mobile-transaction-amount {
    justify-self: end;
    font-size: 17px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #transactions .row-actions {
    display: none;
  }

  #transactions .compact-button {
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
  }

  #transactions .transaction-merchant {
    gap: 1px;
    min-width: 0;
  }

  #transactions .transaction-merchant strong {
    font-size: 15px;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #transactions .transaction-merchant span {
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .action-sheet {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .action-sheet-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 20px;
  }

  .action-sheet-actions button {
    justify-content: center;
  }

  #transactions .date-divider-content {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(92px, auto);
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  #transactions .daily-flow {
    display: grid;
    grid-column: 2 / 4;
    grid-template-columns: 84px 84px;
    justify-content: end;
    gap: 8px;
    font-size: 17px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
  }

  #transactions .date-label strong {
    font-size: 18px;
  }

  #transactions .weekday-badge {
    min-width: 24px;
    height: 17px;
    font-size: 10px;
  }

  #transactions .date-label small {
    font-size: 11px;
  }

  #accounts {
    background: var(--surface);
    padding: 0 0 12px;
  }

  #accounts .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 74px;
    align-items: end;
    position: relative;
    padding: 16px 12px 9px;
    margin: 0;
    border-bottom: 1px solid var(--line);
  }

  #accounts .section-heading h3 {
    grid-column: 1;
    font-size: 24px;
    text-align: left;
  }

  #accounts .section-heading p {
    display: none;
  }

  #accounts .section-heading > .mobile-section-actions {
    grid-column: 2;
    justify-self: end;
  }

  .mobile-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
  }

  .mobile-icon-button,
  .mobile-back-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
  }

  .mobile-popover-menu {
    position: absolute;
    top: 70px;
    right: 0;
    z-index: 18;
    width: min(190px, 52vw);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #30313a;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.34);
  }

  .mobile-popover-menu:not([hidden]) {
    display: grid;
  }

  .mobile-popover-menu button {
    min-height: 45px;
    padding: 9px 14px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: transparent;
    color: var(--text);
    text-align: left;
    font-weight: 800;
  }

  #accounts .account-groups {
    display: block;
  }

  #accounts .account-mobile-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 7px 8px 9px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-3);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
  }

  #accounts .account-mobile-summary span {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
  }

  #accounts .account-mobile-summary strong {
    display: block;
    margin-top: 3px;
    font-size: 18px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #accounts .group {
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
  }

  #accounts .group h4 {
    min-height: 48px;
    margin: 0;
    padding: 16px 14px 7px;
    color: var(--muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 18px;
  }

  #accounts .account-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 48px;
    padding: 10px 14px;
    border-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    max-width: 100%;
    overflow: hidden;
  }

  #accounts .account-row span {
    font-size: 18px;
    font-weight: 800;
  }

  #accounts .account-row small,
  #accounts .account-row-actions button {
    display: none;
  }

  #accounts .account-row-actions strong {
    color: var(--blue);
    font-size: 18px;
    white-space: nowrap;
  }

  #accounts .card-group-heading {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: end;
  }

  #accounts .card-group-heading span {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  #accounts .card-group-heading small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
  }

  #accounts .card-account-row {
    grid-template-columns: minmax(0, 1fr) 86px 86px;
    gap: 8px;
    align-items: center;
  }

  #accounts .card-account-row .card-account-payable,
  #accounts .card-account-row .card-account-outstanding {
    display: grid;
    justify-items: end;
    min-width: 0;
  }

  #accounts .card-account-row small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  #accounts .card-account-row .card-account-payable small {
    font-size: 13px;
  }

  .account-detail-dialog {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .account-detail-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-detail-metrics {
    grid-template-columns: 1fr;
  }

  #account-detail,
  #account-visibility {
    background: var(--surface);
    padding: 0 0 12px;
  }

  #account-detail .mobile-subpage-heading,
  #account-visibility .mobile-subpage-heading {
    min-height: 72px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: end;
    gap: 0;
    padding: 16px 10px 10px;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, #323348, #5f668f);
  }

  #account-detail .mobile-subpage-heading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12;
    width: 100vw;
    max-width: 100vw;
    background: var(--surface);
    min-height: 52px;
    align-items: center;
    grid-template-columns: 34px minmax(62px, auto) minmax(0, 1fr) auto;
    gap: 4px;
    padding: 6px 8px;
  }

  #account-detail .mobile-subpage-heading h3,
  #account-visibility .mobile-subpage-heading h3 {
    font-size: 22px;
    font-weight: 900;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-account-monthbar {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    align-items: center;
    min-height: 40px;
    padding: 0;
    border-bottom: 0;
  }

  .mobile-account-monthbar button {
    min-height: 36px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
  }

  .mobile-account-monthbar strong {
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    white-space: nowrap;
  }

  .mobile-account-period-tabs {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 44px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-account-period-tabs button {
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    font-weight: 900;
  }

  .mobile-account-period-tabs button.active {
    color: var(--text);
    border-color: var(--red);
  }

  .mobile-account-detail-actions {
    display: flex;
    justify-content: end;
    gap: 16px;
    min-height: 32px;
    padding: 0;
  }

  .mobile-account-detail-actions .mobile-icon-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    color: var(--text);
    font-size: 21px;
  }

  #mobileAccountDetailSummary {
    position: fixed;
    top: 96px;
    left: 0;
    right: 0;
    z-index: 12;
    padding: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-account-statement-label {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-account-statement-label > div:first-child {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .mobile-account-statement-label span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-account-statement-label strong {
    color: var(--text);
    font-size: 20px;
    font-weight: 900;
  }

  .mobile-account-flow-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 58px;
    align-items: center;
    text-align: center;
  }

  .mobile-account-flow-summary div {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .mobile-account-flow-summary span {
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-account-flow-summary strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 900;
  }

  .mobile-account-flow-summary div:nth-child(3) strong {
    color: var(--text);
  }

  #mobileAccountDetailTransactions {
    gap: 0;
    padding-top: 206px;
    padding-bottom: 84px;
  }

  .account-date-divider {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(104px, auto);
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 10px 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .account-date-divider .daily-flow {
    display: grid;
    grid-column: 2 / 4;
    grid-template-columns: 84px 84px;
    justify-content: end;
    gap: 8px;
    font-size: 17px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
  }

  #mobileAccountDetailTransactions .account-detail-transaction {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(104px, auto);
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 7px 10px 7px 0;
    border: 0;
    border-radius: 0;
    border-bottom: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  #mobileAccountDetailTransactions .account-detail-transaction > * {
    min-width: 0;
  }

  #mobileAccountDetailTransactions .account-detail-transaction.day-end {
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  }

  #mobileAccountDetailTransactions .mobile-category-meta {
    display: grid;
    gap: 0;
    min-width: 0;
  }

  #mobileAccountDetailTransactions .mobile-category-meta strong {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #mobileAccountDetailTransactions .mobile-category-meta span {
    color: #6f727b;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #mobileAccountDetailTransactions .mobile-transaction-main {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  #mobileAccountDetailTransactions .mobile-transaction-main strong,
  #mobileAccountDetailTransactions .mobile-transaction-amount {
    font-size: 17px;
    font-weight: 900;
  }

  #mobileAccountDetailTransactions .mobile-transaction-main strong {
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #mobileAccountDetailTransactions .account-detail-transaction small,
  #mobileAccountDetailTransactions .mobile-transaction-main small {
    display: block;
    min-width: 0;
    margin-top: 2px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
  }

  #mobileAccountDetailTransactions .mobile-transaction-amount {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-account-empty {
    padding: 18px 12px;
  }

  #mobileAccountDetailTransactions .account-period-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 58px;
    padding: 7px 12px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  #mobileAccountDetailTransactions .account-period-row div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  #mobileAccountDetailTransactions .account-period-row strong {
    font-size: 18px;
    font-weight: 900;
  }

  #mobileAccountDetailTransactions .account-period-row small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }

  .mobile-account-add-button {
    display: grid;
    position: fixed;
    right: 18px;
    bottom: 78px;
    z-index: 75;
    width: 58px;
    height: 58px;
    min-height: 58px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 34px;
    line-height: 1;
  }

  .account-visibility-list,
  .account-visibility-group {
    display: grid;
  }

  .account-visibility-group h4 {
    min-height: 42px;
    margin: 0;
    padding: 12px 16px 6px;
    color: var(--muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .account-visibility-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 24px;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 14px 8px 16px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .account-visibility-row span,
  .account-visibility-row strong {
    font-size: 16px;
    font-weight: 800;
  }

  .account-visibility-row b {
    color: var(--muted);
    font-size: 16px;
  }

  .account-visibility-row.is-hidden {
    background: rgba(255, 255, 255, 0.09);
    color: #a8abb2;
  }

  .account-visibility-row.is-hidden strong,
  .account-visibility-row.is-hidden span {
    color: #a8abb2;
  }

  #data {
    background: var(--surface);
    padding: 0;
  }

  #data .section-heading,
  #data .import-grid,
  #data .audit-panel {
    display: none;
  }

  .mobile-more-panel {
    display: block;
    min-height: calc(100vh - 86px);
    padding: 40px 12px 0;
  }

  .mobile-more-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
  }

  .mobile-more-title h3 {
    margin: 0;
    font-size: 18px;
  }

  .mobile-more-title span {
    color: var(--muted);
    font-weight: 800;
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px 16px;
  }

  .mobile-more-grid a {
    display: grid;
    gap: 8px;
    place-items: center;
    min-height: 70px;
    color: var(--text);
    text-decoration: none;
    text-align: center;
    font-weight: 800;
  }

  .mobile-more-grid span {
    font-size: 28px;
    line-height: 1;
  }

  #analytics {
    background: var(--surface);
    padding: 0 0 12px;
  }

  #analytics .section-heading {
    display: none;
  }

  .mobile-stats-screen {
    display: block;
  }

  .mobile-stats-toolbar {
    min-height: 74px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 18px 10px 10px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-stats-toolbar a {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--text);
    text-decoration: none;
    font-size: 24px;
  }

  .mobile-stats-toolbar strong {
    font-size: 18px;
  }

  .mobile-stats-toolbar select {
    min-height: 34px;
    border: 1px solid var(--muted);
    border-radius: 6px;
    padding: 0 8px;
    background: var(--surface-3);
    color: var(--text);
    font-weight: 800;
  }

  .mobile-stats-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
    text-align: center;
  }

  .mobile-stats-tabs button,
  .mobile-stats-tabs strong {
    min-height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    font: inherit;
    font-weight: 900;
  }

  .mobile-stats-tabs strong.active {
    color: var(--text);
    border-color: var(--red);
  }

  .mobile-stats-tabs button.active {
    color: var(--blue);
    border-color: var(--blue);
  }

  .mobile-stats-chart {
    display: grid;
    place-items: center;
    min-height: 260px;
    padding: 22px 12px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-pie {
    width: min(58vw, 220px);
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  .mobile-stats-list {
    display: grid;
  }

  .mobile-stats-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 54px;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .mobile-stats-row span {
    display: grid;
    place-items: center;
    min-height: 26px;
    border-radius: 4px;
    color: #1b1c21;
    font-weight: 900;
  }

  .mobile-stats-row strong,
  .mobile-stats-row b {
    font-size: 16px;
  }

  .mobile-stats-row b {
    color: var(--text);
  }

  #analytics .analytics-grid {
    display: none;
  }

  #analytics .analysis-panel {
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    box-shadow: none;
  }

  #accountDialog,
  #transactionDialog,
  .mobile-choice-dialog {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  #transactionDialog {
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
    background: var(--surface);
  }

  #transactionDialog .dialog-header {
    min-height: 50px;
    margin: 0 0 12px;
    align-items: center;
  }

  #transactionDialog .dialog-header h3 {
    font-size: 24px;
    font-weight: 900;
  }

  #transactionDialog .dialog-header .icon-button {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    background: var(--surface-3);
    font-size: 22px;
  }

  #transactionDialog .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #transactionDialog .field {
    display: grid;
    grid-template-columns: 106px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin: 0;
    border-bottom: 1px solid var(--line);
  }

  #transactionDialog .field[hidden] {
    display: none !important;
  }

  #transactionDialog .field span {
    color: var(--muted);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.05;
  }

  #transactionDialog .field input,
  #transactionDialog .field select {
    min-height: 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 8px 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    text-align: left;
    color-scheme: dark;
    accent-color: #0fa996;
  }

  #transactionDialog .field input::placeholder {
    color: rgba(156, 160, 172, 0.62);
    font-weight: 900;
  }

  #transactionDialog .transaction-type-field {
    display: none !important;
  }

  #transactionDialog .transaction-merchant-field {
    grid-template-columns: 106px minmax(0, 1fr);
  }

  #transactionDialog .transaction-merchant-field span {
    max-width: 96px;
  }

  #transactionDialog .transaction-account-field select {
    display: none;
  }

  #transactionDialog .transaction-account-summary {
    display: block;
    min-width: 0;
    min-height: 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    padding: 8px 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
    font-weight: 900;
  }

  #transactionDialog .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  #transactionDialog .dialog-actions .secondary-button {
    display: none;
  }

  #transactionDialog .dialog-actions .primary-button {
    min-height: 54px;
    border-radius: 7px;
    font-size: 18px;
  }

  .mobile-account-picker-dialog {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 0 0 max(10px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    background: var(--surface);
  }

  .transaction-account-picker-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    align-items: center;
    min-height: 52px;
    padding: 0 14px;
    background: #8b8e95;
    color: #17191f;
  }

  .transaction-account-picker-bar strong {
    font-size: 22px;
    font-weight: 900;
  }

  .transaction-account-picker-bar .icon-button {
    border: 0;
    color: #17191f;
    background: transparent;
    font-size: 28px;
  }

  .transaction-account-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .transaction-account-choice {
    display: grid;
    align-content: center;
    gap: 4px;
    min-height: 86px;
    padding: 8px 6px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: center;
  }

  .transaction-account-choice strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.12;
  }

  .transaction-account-choice span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .transaction-account-choice.active {
    background: rgba(79, 166, 255, 0.13);
    box-shadow: inset 0 0 0 1px var(--blue);
  }

  #accountDialog {
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
    background: var(--surface);
  }

  #accountDialog .dialog-header {
    min-height: 50px;
    margin: 0 0 14px;
    align-items: center;
  }

  #accountDialog .dialog-header h3 {
    font-size: 24px;
  }

  #accountDialog .dialog-header .icon-button {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    background: var(--surface-3);
    font-size: 22px;
  }

  #accountDialog .dialog-header h3 {
    margin-right: auto;
  }

  #accountDialog .danger-icon-button {
    color: var(--text);
    background: transparent;
  }

  #accountDialog .account-mobile-form-row,
  #accountDialog .field {
    display: grid;
    grid-template-columns: 106px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin: 0;
    border-bottom: 1px solid var(--line);
  }

  #accountDialog .account-mobile-form-row > span,
  #accountDialog .field > span {
    color: var(--muted);
    font-weight: 900;
  }

  #accountDialog .field input,
  #accountDialog .field select,
  #accountDialog .field textarea,
  #accountDialog .account-group-summary {
    min-height: 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    padding: 8px 0;
    font-size: 18px;
    font-weight: 900;
    text-align: left;
  }

  #accountDialog .field textarea {
    min-height: 56px;
    resize: vertical;
    line-height: 1.35;
  }

  #accountDialog .field input::placeholder {
    color: rgba(156, 160, 172, 0.7);
  }

  #accountDialog .account-shape-field {
    display: none;
  }

  #accountDialog .account-currency-field {
    grid-template-columns: 106px minmax(0, 1fr);
    border-bottom: 0;
  }

  #accountDialog #accountCurrency {
    display: none;
  }

  #accountDialog .account-currency-chips {
    display: flex;
    gap: 10px;
    min-height: 52px;
    margin-left: 116px;
    align-items: center;
    border-bottom: 1px solid var(--line);
  }

  #accountDialog .account-currency-chips button {
    min-width: 54px;
    min-height: 39px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
  }

  #accountDialog .account-currency-chips button.active {
    border-color: var(--red);
    color: var(--red);
    background: rgba(255, 91, 86, 0.12);
  }

  #accountDialog .account-card-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 12px;
    border-top: 1px solid var(--line);
  }

  #accountDialog .account-description-field {
    margin-top: 0;
  }

  #accountDialog .account-toggle-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 56px;
    margin: 14px -12px 0;
    padding: 0 14px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-weight: 900;
  }

  #accountDialog .account-toggle-row input {
    appearance: none;
    width: 46px;
    height: 28px;
    border-radius: 99px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    position: relative;
  }

  #accountDialog .account-toggle-row input::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    top: 2px;
    left: 2px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 0.15s ease, background 0.15s ease;
  }

  #accountDialog .account-toggle-row input:checked {
    background: var(--red);
    border-color: var(--red);
  }

  #accountDialog .account-toggle-row input:checked::after {
    transform: translateX(18px);
    background: #fff;
  }

  #accountDialog .account-card-fields[hidden] {
    display: none;
  }

  #accountDialog .account-card-preview {
    display: grid;
    gap: 0;
    margin: 16px 2px 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  #accountDialog .account-card-preview div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 34px;
    align-items: center;
  }

  #accountDialog .account-card-preview span {
    color: var(--muted);
    font-weight: 900;
  }

  #accountDialog .account-card-preview strong {
    color: var(--text);
    font-weight: 900;
  }

  #accountDialog .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  #accountDialog .dialog-actions .secondary-button {
    display: none;
  }

  #accountDialog .dialog-actions .primary-button {
    min-height: 54px;
    border-radius: 7px;
    font-size: 18px;
  }

  .mobile-transaction-type-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    margin: 8px 0 14px;
  }

  .mobile-transaction-type-tabs button {
    min-height: 34px;
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--muted);
    font-weight: 900;
    font-size: 12px;
  }

  .mobile-transaction-type-tabs button.active {
    border-color: currentColor;
    color: var(--red);
  }

  .mobile-transaction-type-tabs [data-transaction-type-tab="income"].active {
    color: var(--blue);
  }

  .mobile-transaction-type-tabs [data-transaction-type-tab="reimbursement"].active {
    color: var(--purple);
  }

  .mobile-transaction-type-tabs [data-transaction-type-tab="investment"].active {
    color: var(--green);
  }

  .mobile-transaction-type-tabs [data-transaction-type-tab="transfer"].active {
    color: var(--text);
  }

  .mobile-choice-dialog {
    padding: 0;
    background: rgba(0, 0, 0, 0.62);
  }

  .mobile-choice-panel {
    display: grid;
    width: calc(100vw - 22px);
    margin: 180px auto 0;
    border-radius: 7px;
    overflow: hidden;
    background: #2b2c34;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38);
  }

  .mobile-choice-panel h3,
  .mobile-choice-panel button {
    min-height: 41px;
    margin: 0;
    padding: 10px 20px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    background: transparent;
    color: var(--text);
    text-align: left;
    font-weight: 800;
  }

  .share-slip-panel {
    max-width: none;
  }

  .share-slip-result {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 14px;
  }

  .transaction-action-details {
    gap: 16px;
  }

  .transaction-detail-grid {
    font-size: 16px;
  }

  .transaction-detail-grid span,
  .transaction-detail-grid strong {
    min-height: 39px;
  }

  .transaction-detail-rows {
    display: grid;
    grid-template-columns: 1fr;
    border-top: 1px solid var(--line);
  }

  .transaction-detail-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
  }

  .transaction-detail-row[hidden] {
    display: none !important;
  }

  .transaction-detail-row select,
  .transaction-detail-row input {
    font-size: 16px;
    font-weight: 900;
  }

  #actionTransactionCategory,
  #transactionCategory {
    display: none;
  }

  .transaction-category-summary {
    display: block;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-category-picker-dialog {
    width: 100vw;
    max-width: 100vw;
    height: min(64vh, 540px);
    margin: auto 0 0;
  }

  .transaction-category-picker-grid {
    min-height: calc(min(64vh, 540px) - 48px);
  }
}

@media (min-width: 881px) and (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
