:root {
  color-scheme: light dark;
  --font-sans: "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "SF Pro Display", "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #f4f4f2;
  --panel: #ffffff;
  --panel-alt: #f1f2f4;
  --border: #d7d9de;
  --text: #1f2328;
  --muted: #5f6773;
  --accent: #2d5baf;
  --accent-strong: #23488a;
  --danger: #a13a2d;
  --shadow: 0 4px 16px rgba(31, 35, 40, 0.06);
  --grid-line: #e7e9ee;
  --button-text: #ffffff;
  --focus: #1d5fb8;
  --surface-hover: #fafbfc;
  --surface-soft: #f6f8fb;
  --surface-strong: #f3f6fb;
  --status-error-bg: #f7dfdb;
  --status-error-border: #e0a59c;
  --overlay-bg: rgba(47, 36, 23, 0.45);
  --bg-tint-a: rgba(255, 255, 255, 0.38);
  --bg-tint-b: rgba(230, 236, 244, 0.26);
  --hero-glow: rgba(57, 92, 170, 0.12);
  --hero-border: rgba(45, 91, 175, 0.12);
  --panel-outline: rgba(255, 255, 255, 0.68);
  --eyebrow-bg: rgba(45, 91, 175, 0.08);
}

:root[data-theme="dark"] {
  --bg: #11151b;
  --panel: #171d25;
  --panel-alt: #1f2731;
  --border: #2f3945;
  --text: #e7edf5;
  --muted: #9ba8b8;
  --accent: #5d8cff;
  --accent-strong: #79a0ff;
  --danger: #d16a61;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  --grid-line: #1f2731;
  --button-text: #f7faff;
  --focus: #79a0ff;
  --surface-hover: #212a35;
  --surface-soft: #1c2430;
  --surface-strong: #222d3a;
  --status-error-bg: #3b2220;
  --status-error-border: #7d4640;
  --overlay-bg: rgba(4, 7, 12, 0.7);
  --bg-tint-a: rgba(98, 125, 179, 0.08);
  --bg-tint-b: rgba(18, 26, 40, 0.22);
  --hero-glow: rgba(121, 160, 255, 0.12);
  --hero-border: rgba(121, 160, 255, 0.18);
  --panel-outline: rgba(255, 255, 255, 0.04);
  --eyebrow-bg: rgba(121, 160, 255, 0.12);
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  border-radius: 0 !important;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at top left, var(--bg-tint-a), transparent 42%),
    radial-gradient(circle at bottom right, var(--bg-tint-b), transparent 48%),
    linear-gradient(color-mix(in srgb, var(--grid-line) 68%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--grid-line) 68%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 22px 22px, 22px 22px, auto;
  color: var(--text);
  min-height: 100vh;
  scrollbar-gutter: stable;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body::-webkit-scrollbar {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  border: 1px solid color-mix(in srgb, var(--accent) 88%, #ffffff 12%);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  min-height: 2.9rem;
  cursor: pointer;
  background: color-mix(in srgb, var(--accent) 92%, #ffffff 8%);
  color: var(--button-text);
  box-shadow:
    0 2px 10px rgba(25, 40, 74, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

button:hover,
.button-link:hover {
  background: color-mix(in srgb, var(--accent-strong) 94%, #ffffff 6%);
  box-shadow:
    0 2px 10px rgba(25, 40, 74, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button.secondary,
.button-link.secondary {
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--panel-outline);
}

button.secondary:hover,
.button-link.secondary:hover {
  background: color-mix(in srgb, var(--surface-soft) 92%, transparent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--panel-outline);
}

button.text-button {
  background: transparent;
  border: none;
  color: var(--accent);
  min-height: auto;
  padding: 0.2rem 0;
  border-radius: 0;
  box-shadow: none;
  font-weight: 600;
}

button.text-button:hover {
  background: transparent;
  color: var(--accent-strong);
  text-decoration: underline;
  transform: none;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.shell {
  width: min(1320px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0.9rem 0 2.5rem;
}

.page-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.theme-toggle {
  min-width: 2.6rem;
  width: 2.6rem;
  padding-inline: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.theme-toggle-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.theme-toggle-button {
  color: color-mix(in srgb, var(--accent-strong) 70%, var(--text) 30%);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  background: color-mix(in srgb, var(--surface-soft) 86%, transparent);
}

.theme-toggle-button:hover {
  color: var(--accent-strong);
}

.settings-toggle-icon {
  font-size: 1rem;
}

.hero {
  position: relative;
  display: block;
  padding: 1rem 1.15rem 0.95rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--hero-border);
  background:
    radial-gradient(circle at top left, var(--hero-glow), transparent 40%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 99%, transparent), color-mix(in srgb, var(--surface-soft) 97%, transparent));
  box-shadow:
    var(--shadow),
    inset 0 1px 0 var(--panel-outline);
  overflow: hidden;
}

.hero-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.2rem;
}

.hero-copy {
  max-width: 52rem;
  padding-top: 0;
}

.hero-kicker,
.panel-eyebrow,
.feature-index {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding: 0.3rem 0.58rem;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border));
  background: var(--eyebrow-bg);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-kicker,
.panel-eyebrow {
  margin-bottom: 0.8rem;
}

.hero h1 {
  font-family: var(--font-display);
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.045em;
  max-width: 11ch;
  font-weight: 700;
}

.hero p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  max-width: 38rem;
  font-size: clamp(0.96rem, 1.2vw, 1.08rem);
  line-height: 1.3;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.topbar-brand {
  min-width: 0;
}

.topbar-brand h1 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1;
}

.topbar-meta {
  margin: 0.35rem 0 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
}

.budget-picker-wrap {
  position: relative;
}

.budget-inline-picker {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-weight: 600;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: auto;
  box-shadow: none;
}

.budget-inline-picker:hover {
  background: transparent;
  color: var(--muted);
  transform: none;
  box-shadow: none;
}

.budget-inline-caret {
  font-size: 0.85rem;
  line-height: 1;
}

.budget-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 14rem;
  max-width: 28rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 10;
}

.budget-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  border-radius: 0;
  text-align: left;
  box-shadow: none;
  min-height: auto;
}

.budget-menu-item:hover,
.budget-menu-item.selected {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
}

.topbar-badge-button {
  background: transparent;
  cursor: pointer;
  min-height: auto;
  padding: 0.15rem 0.45rem;
  box-shadow: none;
}

.topbar-badge-button:hover {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: none;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-menu-wrap {
  position: relative;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 16rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 98%, transparent);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 var(--panel-outline);
  overflow: hidden;
  z-index: 30;
}

.settings-menu-info {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-soft) 78%, transparent);
}

.settings-menu-info strong {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-menu-info span {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-menu-actions {
  display: grid;
}

.settings-menu-item {
  width: 100%;
  min-height: auto;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  justify-content: flex-start;
  text-align: left;
}

.settings-menu-item:hover {
  background: color-mix(in srgb, var(--surface-soft) 92%, transparent);
  color: var(--text);
  box-shadow: none;
}

.settings-menu-item-danger {
  color: var(--danger);
}

.settings-menu-item-danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--status-error-bg) 64%, transparent);
}

.topbar-account {
  display: grid;
  justify-items: end;
  gap: 0.45rem;
}

.topbar-account span {
  font-weight: 600;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1rem;
}

.auth-layout,
.overview-layout {
  display: grid;
  gap: 1rem;
}

.auth-layout {
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
  gap: 1.1rem;
}

.overview-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.full-width-grid {
  width: 100%;
}

.panel {
  background: color-mix(in srgb, var(--panel) 98%, transparent);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 var(--panel-outline);
  padding: 1.15rem;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel-heading {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.panel-heading h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: clamp(1.4rem, 1.5vw, 1.75rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.panel-heading p {
  margin: 0;
  max-width: 34rem;
  line-height: 1.5;
}

.auth-panel {
  padding: 1.2rem 1.2rem 1.15rem;
}

.feature-panel {
  padding: 1.2rem 1.15rem 1.15rem;
}

.feature-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.1rem;
}

.feature-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.78rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 82%, transparent), color-mix(in srgb, var(--panel) 92%, transparent));
}

.feature-card h3,
.feature-card p {
  margin: 0;
}

.feature-card-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 0.96rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.feature-card p {
  font-size: 0.96rem;
  line-height: 1.38;
}

.feature-index {
  flex: 0 0 auto;
  font-size: 0.72rem;
  padding: 0.28rem 0.5rem;
  margin-bottom: 0;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.95rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0.7rem 0.85rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--panel-outline);
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field textarea:-webkit-autofill,
.field textarea:-webkit-autofill:hover,
.field textarea:-webkit-autofill:focus,
.field select:-webkit-autofill,
.field select:-webkit-autofill:hover,
.field select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out 0s;
  box-shadow:
    inset 0 0 0 1000px var(--panel),
    inset 0 1px 0 var(--panel-outline);
  border: 1px solid var(--border);
}

.field input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

select {
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  background: var(--panel);
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  padding-top: 0.4rem;
}

.modal-actions {
  justify-content: flex-end;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
}

.muted {
  color: var(--muted);
}

.status {
  margin-bottom: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.status.error {
  background: var(--status-error-bg);
  border-color: var(--status-error-border);
}

.month-picker {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.month-nav-button {
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.month-nav-icon {
  display: block;
}

.month-nav-icon-prev {
  transform: translateX(1px);
}

.month-nav-icon-next {
  transform: translateX(1px);
}

.inline-month-picker {
  margin-left: auto;
  flex-wrap: nowrap;
}

.inline-month-picker #month-picker {
  min-width: 9.5rem;
  height: 2.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  background: var(--panel);
  color: var(--text);
}

.sheet-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.sheet-action-buttons {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.mobile-only {
  display: none;
}

.desktop-only {
  display: flex;
}

.compact-only {
  display: none;
}

.add-menu-wrap {
  position: relative;
}

.add-menu-trigger {
  min-width: 0;
}

.add-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  min-width: 12rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 20;
  display: grid;
  gap: 0.2rem;
}

.add-menu-item {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 0.5rem 0.6rem;
  background: transparent;
  color: var(--text);
  justify-content: flex-start;
  text-align: left;
  box-shadow: none;
  min-height: auto;
}

.add-menu-item:hover {
  background: var(--surface-hover);
}

.invite-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.invite-actions .tag {
  padding: 0.16rem 0.5rem;
  font-size: 0.82rem;
  line-height: 1.1;
}

.invite-actions .icon-button {
  width: 1.55rem;
  min-width: 1.55rem;
  min-height: 1.55rem;
  height: 1.55rem;
  padding: 0;
  font-size: 0.9rem;
  box-shadow: none;
}

.icon-button {
  width: 1.9rem;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--danger);
}

@media (max-width: 1040px) {
  .desktop-only {
    display: none;
  }

  .compact-only {
    display: block;
  }
}

@media (max-width: 735px) {
  .compact-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }
}

.collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.collapse-toggle:hover {
  background: transparent;
  color: color-mix(in srgb, var(--text) 82%, var(--accent) 18%);
}

.collapse-toggle::-webkit-details-marker {
  display: none;
}

.year-months-details[open] .collapse-icon,
.year-months-details:not([open]) .collapse-icon {
  pointer-events: none;
}

.year-months-details > .list-row,
.year-months-details > .muted {
  margin-top: 0.55rem;
}

.month-jump-row {
  width: 100%;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 0.7rem 0.9rem;
}

.month-jump-row:hover {
  background: var(--surface-hover);
}

.collapse-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.year-months-details[open] .collapse-icon {
  content: "";
}

.year-months-details[open] .collapse-icon::before {
  content: "▾";
}

.year-months-details:not([open]) .collapse-icon::before {
  content: "▸";
}

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

.summary-card {
  border-radius: 8px;
  padding: 0.8rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
}

.summary-card strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 0.3rem;
}

.section-card {
  margin-top: 1rem;
}

.section-card header {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.entry-item {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 18px;
  padding: 0.9rem;
  display: grid;
  gap: 0.6rem;
}

.entry-main {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.overlay.open {
  display: flex;
}

.overlay-card {
  width: min(640px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.savings-overlay-card {
  width: min(480px, 100%);
}

.share-overlay-card {
  width: min(640px, 100%);
}

.share-panel-content {
  display: grid;
  gap: 1rem;
}

.inline-form {
  display: grid;
  gap: 0.8rem;
}

.loading {
  opacity: 0.75;
}

.sheet-panel {
  padding: 0.85rem 1rem;
}

.year-summary-panel {
  padding: 0.85rem 1rem;
}

.sheet-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--panel);
}

.mobile-budget-sheet {
  display: none;
}

.budget-sheet,
.year-table {
  width: 100%;
  border-collapse: collapse;
}

.budget-sheet th,
.budget-sheet td,
.year-table th,
.year-table td {
  border: 1px solid var(--border);
  padding: 0.28rem 0.45rem;
  text-align: left;
  vertical-align: middle;
}

.budget-sheet thead th {
  background: var(--surface-soft);
  text-align: center;
  font-weight: 700;
}

.budget-sheet td {
  min-width: 70px;
  height: 32px;
}

.budget-sheet .sheet-empty {
  background: var(--panel);
}

.sheet-entry-group-cell {
  padding: 0 0.45rem;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.sheet-entry-group-cell:hover {
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.sheet-entry-group {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  min-height: 31px;
  width: 100%;
}

.sheet-entry-title,
.sheet-entry-amount {
  min-width: 0;
}

.sheet-entry-amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.amount-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.action-cell {
  width: 58px;
  text-align: center;
}

.sheet-link {
  min-height: 2rem;
  min-width: auto;
  padding: 0.24rem 0.45rem;
  font-size: 0.76rem;
  line-height: 1;
  border-radius: 8px;
  box-shadow:
    0 1px 4px rgba(25, 40, 74, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sheet-total-row td {
  background: var(--surface-soft);
  font-weight: 600;
}

.year-table th {
  background: var(--surface-soft);
}

.year-table td {
  background: transparent;
}

.mobile-budget-section {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.mobile-budget-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mobile-budget-section-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.mobile-budget-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.section-add-button {
  min-width: auto;
  min-height: 0;
  height: auto;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
}

.section-add-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.mobile-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.mobile-budget-table {
  width: 100%;
  border-collapse: collapse;
}

.mobile-budget-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.mobile-budget-table tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

.mobile-budget-table tbody tr:hover {
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.mobile-budget-table tr:last-child td {
  border-bottom: none;
}

.mobile-budget-table td:first-child {
  width: 100%;
}

.mobile-budget-table .action-cell {
  width: 1%;
  white-space: nowrap;
}

.mobile-summary-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.mobile-summary-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-hover);
}

.mobile-summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mobile-summary-card-header .sheet-link {
  transform: translateY(10px);
}

.mobile-summary-card strong {
  font-size: 1.05rem;
}

.mobile-summary-card-accent {
  background: var(--surface-strong);
}

.year-table th {
  width: 60%;
  background: var(--surface-soft);
  font-weight: 600;
}

.compact-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.list-row,
.invite-card {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.invite-card {
  flex-wrap: wrap;
}

.list-row:has(.invite-actions) {
  padding: 0.65rem 0.8rem;
}

@media (max-width: 900px) {
  .auth-layout,
  .overview-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 735px) {
  .shell {
    width: min(100vw - 1rem, 100%);
    padding: 0.6rem 0 1rem;
  }

  .hero {
    padding: 1rem 1rem 1.05rem;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .hero h1 {
    font-size: clamp(1.95rem, 11vw, 2.7rem);
  }

  .hero p {
    font-size: 1rem;
    line-height: 1.3;
  }

  .page-tools {
    margin-bottom: 0.55rem;
  }

  .hero-heading-row {
    align-items: center;
  }

  .topbar {
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.85rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: start;
  }

  .topbar-brand {
    min-width: 0;
  }

  .topbar-brand h1 {
    font-size: 1.55rem;
  }

  .topbar-meta {
    margin-top: 0.45rem;
    gap: 0.45rem 0.7rem;
    align-items: center;
  }

  .budget-picker-wrap {
    min-width: 0;
  }

  .budget-inline-picker {
    max-width: 100%;
    text-align: left;
  }

  .topbar-controls {
    width: auto;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-content: flex-end;
  }

  .settings-menu {
    min-width: 14rem;
    max-width: min(18rem, calc(100vw - 2rem));
  }

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

  .panel {
    padding: 1rem;
    border-radius: 20px;
  }

  .panel-heading {
    margin-bottom: 1rem;
  }

  .panel-heading h2 {
    font-size: 1.45rem;
  }

  .feature-card {
    padding: 0.85rem 0.9rem;
  }

  .sheet-panel {
    padding: 0.55rem;
  }

  .sheet-actions {
    gap: 0.5rem;
    margin-bottom: 0.55rem;
    justify-content: flex-end;
  }

  .inline-month-picker {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    justify-content: stretch;
  }

  .inline-month-picker .month-nav-button:first-child {
    justify-self: start;
  }

  .inline-month-picker #month-picker {
    width: 100%;
  }

  .inline-month-picker .month-nav-button:last-child {
    justify-self: end;
  }

  .mobile-budget-section {
    gap: 0.35rem;
    margin-top: 1rem;
  }

  .mobile-budget-section-header h3 {
    font-size: 1rem;
  }

  .mobile-budget-title-row {
    gap: 0.35rem;
  }

  .section-add-button {
    width: 1.5rem;
    min-width: 1.5rem;
    min-height: 1.5rem;
    height: 1.5rem;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 500;
  }

  .sheet-wrap {
    display: none;
  }

  .mobile-budget-sheet {
    display: block;
  }

  .mobile-budget-table td {
    padding: 0.55rem 0.65rem;
  }

  .mobile-budget-table td:first-child strong {
    font-size: 0.98rem;
  }

  .mobile-budget-table td .muted {
    font-size: 0.92rem;
    line-height: 1.1;
  }

  .mobile-budget-table .sheet-link {
    padding: 0.22rem 0.4rem;
    font-size: 0.8rem;
  }

  .mobile-summary-grid {
    gap: 0.55rem;
    margin-top: 0.75rem;
  }

  .mobile-summary-card {
    padding: 0.65rem 0.75rem;
    gap: 0.1rem;
  }

  .mobile-summary-card strong {
    font-size: 1rem;
  }

  .mobile-summary-card-header .sheet-link {
    padding: 0.22rem 0.4rem;
    font-size: 0.8rem;
  }
}
