:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #111827;
  --muted: #4b5563;
  --line: rgba(148, 163, 184, 0.42);
  --panel: rgba(255, 255, 255, 0.5);
  --panel-strong: rgba(255, 255, 255, 0.68);
  --sidebar: rgba(248, 250, 252, 0.78);
  --sidebar-soft: rgba(226, 232, 240, 0.72);
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --income: #0369a1;
  --expense: #b91c1c;
  --soft: rgba(224, 231, 255, 0.66);
  --gold: #b45309;
  --blue: #1d4ed8;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: var(--bg);
  background: var(--bg);
}

body {
  margin: 0;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  isolation: isolate;
  background-color: var(--bg);
  background: var(--bg);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

body.sidebar-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  overflow: visible;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.mobile-filter-button,
.sidebar-backdrop,
.sidebar-close {
  display: none;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  height: max-content;
  overflow: visible;
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.76)),
    var(--sidebar);
  backdrop-filter: blur(34px) saturate(170%);
  -webkit-backdrop-filter: blur(34px) saturate(170%);
  color: var(--ink);
  box-shadow:
    inset -1px 0 0 rgba(148, 163, 184, 0.28),
    inset 1px 0 0 rgba(255, 255, 255, 0.82);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, #fde68a, #f59e0b);
  color: #111827;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 10px 24px rgba(245, 158, 11, 0.24);
  font-size: 28px;
  font-weight: 800;
}

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

.brand h1 {
  font-size: 22px;
  line-height: 1.15;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.month-picker,
.month-picker label,
.month-shortcuts,
.user-filter {
  display: grid;
  gap: 8px;
}

.month-picker label,
.month-shortcuts span,
.user-filter span,
form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.month-picker label,
.month-shortcuts span,
.user-filter span {
  color: #334155;
}

.month-shortcut-grid {
  display: grid;
  gap: 10px;
}

.month-group {
  border: 1px solid rgba(148, 163, 184, 0.56);
  border-radius: var(--radius-md);
  background: rgba(241, 245, 249, 0.84);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 4px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.month-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.month-group-title::-webkit-details-marker {
  display: none;
}

.month-group-title::after {
  content: "展開";
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.month-group[open] .month-group-title::after {
  content: "收起";
  color: var(--muted);
}

.year-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
  padding: 0 10px 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.year-controls strong {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-top: 1px solid rgba(203, 213, 225, 0.82);
  border-bottom: 1px solid rgba(203, 213, 225, 0.82);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.year-nav {
  min-height: 40px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 3px 8px rgba(15, 23, 42, 0.06);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.year-nav:hover,
.year-nav:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(15, 23, 42, 0.08);
}

.year-nav:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.year-nav:first-child::before {
  content: "‹ ";
  font-size: 16px;
}

.year-nav:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.year-nav:last-child::after {
  content: " ›";
  font-size: 16px;
}

.current-month-action {
  display: grid;
  place-items: center;
  width: calc(100% - 20px);
  min-height: 36px;
  margin: 0 10px 10px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #111827;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 3px 8px rgba(15, 23, 42, 0.06);
  font-size: 13px;
  font-weight: 950;
  text-align: center;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.current-month-action:hover,
.current-month-action:focus-visible {
  background: rgba(255, 255, 255, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 4px 10px rgba(15, 23, 42, 0.08);
}

.current-month-action:active {
  transform: scale(0.98);
}

.month-group-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.month-shortcut {
  position: relative;
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #172033;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 2px 6px rgba(15, 23, 42, 0.05);
  font-size: 13px;
  font-weight: 900;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.month-shortcut.active {
  border-color: rgba(30, 41, 59, 0.82);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(30, 41, 59, 0.18),
    0 3px 8px rgba(15, 23, 42, 0.08);
  transform: none;
}

.month-shortcut.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: #111827;
  transform: translateX(-50%);
}

.user-tabs {
  --user-tab-left: 4px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(226, 232, 240, 0.72), rgba(255, 255, 255, 0.48)),
    rgba(226, 232, 240, 0.54);
  backdrop-filter: blur(20px) saturate(155%);
  -webkit-backdrop-filter: blur(20px) saturate(155%);
  overflow: hidden;
}

.user-tabs::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: var(--user-tab-left);
  width: calc((100% - 8px) / 3);
  border-radius: var(--radius-sm);
  background: rgba(248, 250, 252, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 18px rgba(15, 23, 42, 0.1);
  transition: left 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-tabs.user-ricky {
  --user-tab-left: calc((100% - 8px) / 3 + 4px);
}

.user-tabs.user-yixuan {
  --user-tab-left: calc(((100% - 8px) / 3) * 2 + 4px);
}

input,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
}

input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.2em;
  text-align: left;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-repeat: no-repeat;
  background-size:
    5px 5px,
    5px 5px;
  padding-right: 34px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 95, 0.14);
}

.sidebar input {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.76);
  color: #111827;
}

.balance-panel {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.76), rgba(226, 232, 240, 0.46)),
    rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(24px) saturate(165%);
  -webkit-backdrop-filter: blur(24px) saturate(165%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 12px 26px rgba(15, 23, 42, 0.08);
}

.balance-panel span,
.quick-stats span {
  color: #475569;
  font-size: 13px;
}

.balance-panel strong {
  font-size: 34px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.balance-panel small {
  color: var(--muted);
}

.quick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-stats div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(226, 232, 240, 0.42)),
    rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(24px) saturate(165%);
  -webkit-backdrop-filter: blur(24px) saturate(165%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 10px 22px rgba(15, 23, 42, 0.07);
}

.quick-stats strong {
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.secondary-action,
.primary-action,
.type-toggle,
.user-filter-toggle,
.text-action {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.user-filter-toggle {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 0 8px;
  background: transparent;
  color: #475569;
  transition:
    color 220ms ease,
    opacity 220ms ease;
  opacity: 0.78;
}

.user-filter-toggle.active {
  color: #111827;
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.secondary-action {
  margin-top: 0;
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
  color: #111827;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 10px 24px rgba(245, 158, 11, 0.24);
}

.main-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 30px;
}

.toolbar {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(238, 243, 241, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  overflow: hidden;
}

.toolbar::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 22px rgba(49, 46, 129, 0.12);
  transform: scale(0.98);
  transition:
    left 360ms cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 260ms ease,
    box-shadow 260ms ease,
    background 260ms ease;
}

.toolbar:active::before {
  transform: scale(0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 4px 14px rgba(49, 46, 129, 0.1);
}

.toolbar.income-mode::before {
  left: calc(50% + 0px);
  background: rgba(255, 255, 255, 0.84);
}

.type-toggle {
  position: relative;
  z-index: 1;
  min-width: 76px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  transition:
    color 240ms ease,
    opacity 240ms ease,
    transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0.74;
}

.type-toggle.active {
  color: var(--ink);
  opacity: 1;
  transform: translateY(-1px) scale(1.02);
}

.entry-panel,
.insights,
.people-summary,
.ledger {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(30px) saturate(175%);
  -webkit-backdrop-filter: blur(30px) saturate(175%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 18px 42px rgba(49, 46, 129, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

form label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

input[type="date"] {
  min-width: 188px;
}

.amount-field {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.amount-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 95, 0.14);
}

.amount-field span {
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
}

.amount-field input {
  height: 42px;
  font-size: 16px;
  padding-left: 0;
  border: 0;
  box-shadow: none;
}

.primary-action {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(145deg, #fbbf24, #f97316);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 12px 28px rgba(249, 115, 22, 0.28);
}

.primary-action:hover,
.primary-action:focus-visible {
  background: linear-gradient(145deg, #fb923c, #ea580c);
}

@media (max-width: 1150px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  input[type="date"] {
    min-width: 0;
  }
}

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

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

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.category-bars {
  display: grid;
  gap: 10px;
}

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

.user-summary-grid.single {
  grid-template-columns: minmax(0, 1fr);
}

.user-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(248, 250, 252, 0.52);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.user-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-card h4 {
  margin: 0;
  font-size: 16px;
}

.user-card strong {
  font-size: 20px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.user-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.user-card div {
  display: grid;
  gap: 3px;
}

.user-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-card dd {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.person-pill {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.category-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) minmax(104px, auto);
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.category-row span {
  font-weight: 900;
  line-height: 1.32;
  text-align: right;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

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

.transaction-currency-group {
  display: grid;
  gap: 10px;
}

.transaction-currency-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.transaction-currency-heading div {
  display: grid;
  gap: 2px;
}

.transaction-currency-heading span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.transaction-currency-heading strong {
  color: var(--muted);
  font-size: 12px;
}

.transaction-currency-heading b {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  text-align: right;
}

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

.transaction-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 34px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(248, 250, 252, 0.56);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.transaction-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 900;
}

.transaction-copy {
  min-width: 0;
}

.transaction-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.transaction-copy em {
  display: inline-block;
  margin-top: 5px;
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.transaction-amount {
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.transaction-amount.income {
  color: var(--income);
}

.transaction-amount.expense {
  color: var(--expense);
}

.delete-action,
.text-action {
  background: transparent;
  color: var(--muted);
}

.delete-action {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 20px;
}

.delete-action:hover,
.text-action:hover {
  background: #f0f3f1;
  color: var(--expense);
}

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

.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  z-index: 1400;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 20px;
  border: 1px solid rgba(199, 210, 254, 0.7);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(224, 231, 255, 0.58)),
    rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 18px 42px rgba(99, 102, 241, 0.22);
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -14px) scale(0.96);
  transition:
    opacity 220ms ease,
    transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

@media (max-width: 900px) {
  .toast {
    top: calc(78px + env(safe-area-inset-top));
  }

  @supports (top: constant(safe-area-inset-top)) {
    .toast {
      top: calc(78px + constant(safe-area-inset-top));
    }
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    display: block;
    overflow: visible;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }

  @supports (min-height: 100dvh) {
    .workspace {
      min-height: 100dvh;
    }
  }

  .mobile-filter-button {
    appearance: none;
    -webkit-appearance: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: end;
    gap: 8px;
    width: 100vw;
    min-height: calc(64px + env(safe-area-inset-top));
    border: 0;
    border-bottom: 0;
    border-radius: 0;
    margin: 0;
    padding: calc(env(safe-area-inset-top) + 8px) calc(12px + env(safe-area-inset-right)) 10px calc(12px + env(safe-area-inset-left));
    background: #ff8a1f;
    background-image: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: #ffffff;
    text-align: center;
    box-shadow: none;
    filter: none;
    outline: 0;
    overflow: hidden;
    pointer-events: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-filter-button::after {
    content: none;
  }

  @supports (padding-top: constant(safe-area-inset-top)) {
    .mobile-filter-button {
      min-height: calc(64px + constant(safe-area-inset-top));
      padding-top: calc(constant(safe-area-inset-top) + 8px);
      padding-right: calc(12px + constant(safe-area-inset-right));
      padding-left: calc(12px + constant(safe-area-inset-left));
      background: #ff8a1f;
    }
  }

  .mobile-filter-copy {
    display: grid;
    gap: 2px;
    justify-items: center;
    min-width: 0;
  }

  .mobile-filter-copy strong {
    font-size: 16px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .mobile-filter-copy small {
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
    font-weight: 800;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-filter-cta {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    grid-template-columns: auto auto;
    place-items: center;
    gap: 4px;
    width: 72px;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: #ea580c;
    background-image: none;
    color: #ffffff;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: none;
    filter: none;
    outline: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-filter-spacer {
    display: block;
    width: 72px;
    height: 1px;
  }

  .mobile-filter-cta::after {
    content: "›";
    font-size: 20px;
    line-height: 1;
  }

  .mobile-filter-cta span {
    font-size: 16px;
    line-height: 1;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    gap: 16px;
    width: min(88vw, 360px);
    height: 100vh;
    max-width: 100%;
    max-height: 100vh;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: calc(22px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 42px rgba(8, 18, 15, 0.24);
  }

  @supports (height: 100dvh) {
    .sidebar {
      height: 100dvh;
      max-height: 100dvh;
    }
  }

  @supports (padding-top: constant(safe-area-inset-top)) {
    .sidebar {
      padding-top: calc(22px + constant(safe-area-inset-top));
      padding-bottom: calc(22px + constant(safe-area-inset-bottom));
    }
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-left: auto;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
  }

  .secondary-action {
    margin-top: 0;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  input[type="date"] {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .main-panel {
    padding: 16px;
  }

  .sidebar {
    gap: 14px;
    width: min(88vw, 340px);
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  }

  .main-panel {
    padding-top: calc(82px + env(safe-area-inset-top));
    scroll-margin-top: calc(76px + env(safe-area-inset-top));
  }

  @supports (scroll-margin-top: constant(safe-area-inset-top)) {
    .sidebar {
      padding-top: calc(16px + constant(safe-area-inset-top));
      padding-bottom: calc(16px + constant(safe-area-inset-bottom));
    }

    .main-panel {
      padding-top: calc(82px + constant(safe-area-inset-top));
      scroll-margin-top: calc(76px + constant(safe-area-inset-top));
    }
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

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

  .month-shortcut-grid {
    display: grid;
    gap: 6px;
    margin: 0 -16px;
    overflow-x: auto;
    padding: 0 16px 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .month-shortcut-grid::-webkit-scrollbar {
    display: none;
  }

  .month-shortcut {
    scroll-snap-align: start;
  }

  .balance-panel {
    padding: 14px;
  }

  .balance-panel strong {
    font-size: 30px;
  }

  .quick-stats {
    gap: 8px;
  }

  .quick-stats div {
    padding: 12px;
  }

  .quick-stats strong {
    font-size: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

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

  .toolbar {
    width: 100%;
  }

  .entry-panel,
  .insights,
  .people-summary,
  .ledger {
    padding: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  input,
  select,
  .amount-field {
    height: 46px;
  }

  .amount-field input {
    height: 44px;
  }

  .primary-action,
  .secondary-action,
  .type-toggle,
  .user-filter-toggle {
    min-height: 46px;
  }

  .user-summary-grid {
    grid-template-columns: 1fr;
  }

  .category-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .transaction-item {
    grid-template-columns: 38px minmax(0, 1fr) 34px;
    gap: 10px;
    padding: 10px;
  }

  .transaction-currency-heading {
    align-items: start;
    padding: 0 2px;
  }

  .transaction-currency-heading b {
    max-width: 46%;
    overflow-wrap: anywhere;
  }

  .transaction-icon {
    width: 38px;
    height: 38px;
  }

  .transaction-amount {
    grid-column: 2 / 3;
    text-align: left;
  }

  .transaction-copy strong {
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .sidebar,
  .main-panel {
    padding: 14px;
  }

  .month-shortcut-grid {
    margin: 0 -14px;
    padding: 0 14px 4px;
  }

  .user-tabs {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }

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

  .section-heading span {
    text-align: left;
  }
}
