:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-raised: rgba(255, 255, 255, 0.9);
  --surface-muted: #e6ebf2;
  --text: #0d1117;
  --muted: #6b7280;
  --line: #e6ebf2;
  --line-strong: #cfd6e0;
  --accent: #2563ff;
  --accent-strong: #1649d8;
  --accent-soft: #eef4ff;
  --control-active: #0d1117;
  --control-active-text: #ffffff;
  --teal-ink: #0d1117;
  --ocean: #2563ff;
  --coral: #10d5c2;
  --amber: #a16207;
  --rose-soft: #fff1f2;
  --shadow: 0 24px 52px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.055);
  --radius: 8px;
  --tap: 46px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #101720;
  --surface-raised: rgba(16, 23, 32, 0.92);
  --surface-muted: #141d28;
  --text: #f8fafc;
  --muted: #9aa4b2;
  --line: #263240;
  --line-strong: #3a4655;
  --accent: #2563ff;
  --accent-strong: #a7baff;
  --accent-soft: #16264d;
  --control-active: #f8fafc;
  --control-active-text: #0d1117;
  --teal-ink: #f8fafc;
  --ocean: #2563ff;
  --coral: #10d5c2;
  --amber: #facc15;
  --rose-soft: #35151c;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8f9fc 50%, #f1f4f9 100%),
    var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.splash-active {
  overflow: hidden;
}

.launch-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100svh;
  min-height: 100dvh;
  display: block;
  padding: max(48px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(78px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  color: #ffffff;
  background:
    radial-gradient(ellipse at 4% 50%, rgba(37, 99, 255, 0.48), transparent 34%),
    radial-gradient(ellipse at 96% 54%, rgba(16, 213, 194, 0.42), transparent 32%),
    linear-gradient(180deg, #06101f 0%, #030a16 48%, #020814 100%);
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 460ms ease,
    transform 460ms ease,
    visibility 460ms ease;
}

.launch-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.launch-brand {
  position: absolute;
  top: clamp(350px, 47svh, 430px);
  left: 50%;
  width: min(560px, calc(100% - 56px));
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
}

.launch-brand img {
  display: block;
  width: min(440px, calc(100vw - 72px));
  max-width: 440px;
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 22px 40px rgba(16, 213, 194, 0.18))
    drop-shadow(0 18px 42px rgba(37, 99, 255, 0.18));
}

.launch-credit {
  position: absolute;
  left: 50%;
  bottom: max(42px, calc(6svh + env(safe-area-inset-bottom)));
  width: min(430px, calc(100% - 48px));
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
}

.launch-progress {
  position: absolute;
  left: 50%;
  bottom: max(92px, calc(13.9svh + env(safe-area-inset-bottom)));
  width: min(600px, 70vw);
  height: 11px;
  overflow: hidden;
  transform: translateX(-50%);
  background: rgba(137, 158, 195, 0.26);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 28px rgba(16, 213, 194, 0.12);
}

.launch-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #2563ff 0%, #1b88ff 48%, #10d5c2 100%);
  border-radius: inherit;
  box-shadow: 0 0 22px rgba(16, 213, 194, 0.62);
  transform: translateX(-100%);
  animation: launch-progress 1650ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes launch-progress {
  0% {
    transform: translateX(-100%);
  }

  72% {
    transform: translateX(-18%);
  }

  100% {
    transform: translateX(0);
  }
}

body,
button,
input,
select {
  font: inherit;
  touch-action: manipulation;
}

button {
  border: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

button:focus {
  outline: 0;
}

button:focus-visible {
  outline: 2px solid rgba(37, 99, 255, 0.38);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

@media (prefers-reduced-motion: reduce) {
  .launch-screen,
  .launch-progress span {
    transition: none;
    animation: none;
  }

  .launch-progress span {
    transform: translateX(0);
  }
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(104px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0 14px;
  background: linear-gradient(180deg, rgba(246, 247, 251, 0.98), rgba(246, 247, 251, 0.78));
  backdrop-filter: blur(22px);
}

.topbar-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.brand-lockup {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  display: block;
  width: min(224px, calc(100vw - 132px));
  height: auto;
  object-fit: contain;
}

.brand-logo-dark {
  display: none;
  width: min(188px, calc(100vw - 132px));
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: var(--radius);
  box-shadow: 0 14px 26px rgba(11, 92, 255, 0.18);
}

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

h1 {
  overflow-wrap: anywhere;
  font-size: 1.82rem;
  font-weight: 950;
  line-height: 1.02;
  letter-spacing: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.brand-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.app-badge {
  min-width: 64px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 950;
}

.theme-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.theme-toggle:active {
  transform: translateY(1px);
}

.theme-toggle .icon {
  width: 16px;
  height: 16px;
}

.app-main {
  display: grid;
  gap: 14px;
}

.app-screen {
  scroll-margin-top: 92px;
}

.app-card {
  background: var(--surface-raised);
  border: 1px solid rgba(232, 236, 243, 0.96);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.dashboard,
.expense-form-panel,
.expense-list-panel,
.data-panel,
.recurring-panel {
  padding: 14px;
}

.section-header {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  font-size: 1.16rem;
  font-weight: 920;
  line-height: 1.15;
  letter-spacing: 0;
}

.month-controls {
  display: grid;
  grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
  align-items: center;
  gap: 8px;
}

.profile-switcher {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.profile-switcher > p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  background: var(--surface-muted);
  border: 1px solid rgba(232, 236, 243, 0.86);
  border-radius: var(--radius);
}

.profile-button {
  min-width: 0;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  text-align: left;
  font-weight: 920;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.profile-button:active {
  transform: translateY(1px);
}

.profile-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  background: #fff;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 950;
}

.profile-button[data-viewer="Wendee"] .profile-avatar {
  color: #0fbfac;
}

.profile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  line-height: 1.05;
}

.profile-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: currentColor;
  font-size: 0.94rem;
  font-weight: 950;
}

.profile-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: currentColor;
  font-size: 0.66rem;
  font-weight: 850;
  opacity: 0.66;
}

.profile-button.active {
  color: var(--control-active-text);
  background: var(--control-active);
  box-shadow: 0 10px 20px rgba(5, 7, 17, 0.12);
}

.profile-button.active .profile-avatar {
  color: var(--control-active);
}

.profile-button.active .profile-copy small {
  opacity: 0.78;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.fab,
.tabbar-button {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  font-weight: 880;
  letter-spacing: 0;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.icon-button:active,
.primary-button:active,
.secondary-button:active,
.danger-button:active,
.fab:active,
.tabbar-button:active {
  transform: translateY(1px);
}

.icon-button {
  width: var(--tap);
  color: var(--text);
  background: var(--surface-muted);
}

select,
input {
  width: 100%;
  min-height: var(--tap);
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

@supports (-webkit-touch-callout: none) {
  select,
  input {
    font-size: 16px;
  }
}

select {
  padding: 0 36px 0 12px;
  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) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input {
  padding: 0 12px;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(11, 92, 255, 0.13);
}

.balance-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.98)),
    #ffffff;
  border: 1px solid rgba(232, 236, 243, 0.98);
  border-radius: var(--radius);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
}

.balance-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--ocean), var(--coral));
}

.balance-card::after {
  content: none;
}

.balance-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.balance-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.balance-amount {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  max-width: 780px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 3.7rem;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: 0;
}

.balance-result {
  max-width: 780px;
  margin-top: 9px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 890;
  line-height: 1.28;
  letter-spacing: 0;
}

.balance-meta {
  position: relative;
  z-index: 1;
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 760;
}

.balance-note {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid rgba(232, 236, 243, 0.82);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 850;
}

.danger-button.compact {
  min-height: var(--tap);
  padding-inline: 13px;
}

.avatar-stack {
  display: flex;
  flex: 0 0 auto;
}

.avatar-stack span {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--text);
  border: 2px solid #ffffff;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 950;
}

.avatar-stack span + span {
  margin-left: -11px;
  color: #06101f;
  background: #dff8ff;
}

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

.stat-cell {
  min-width: 0;
  padding: 13px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(232, 236, 243, 0.96);
  border-radius: var(--radius);
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

dd {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 1.14rem;
  font-weight: 950;
}

.split-meter {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(232, 236, 243, 0.96);
  border-radius: var(--radius);
}

.meter-track {
  display: flex;
  height: 10px;
  overflow: hidden;
  background: #e9eef7;
  border-radius: 999px;
}

.meter-fill.alex {
  width: 50%;
  background: var(--accent);
}

.meter-fill.wendee {
  width: 50%;
  background: var(--coral);
}

.meter-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.meter-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 999px;
}

.dot.alex {
  background: var(--accent);
}

.dot.wendee {
  background: var(--coral);
}

.settle-button {
  width: 100%;
  margin-top: 12px;
  min-height: 52px;
}

.primary-button {
  min-width: 0;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 14px 26px rgba(11, 92, 255, 0.22);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.danger-button {
  min-width: 0;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
}

.secondary-button {
  color: var(--text);
}

.secondary-button:hover {
  background: var(--accent-soft);
  border-color: rgba(11, 92, 255, 0.22);
}

.danger-button {
  color: #9f392b;
}

.danger-button:hover {
  background: var(--rose-soft);
  border-color: #f0c7be;
}

.workspace-grid {
  display: grid;
  gap: 14px;
}

.expense-form {
  display: grid;
  gap: 12px;
}

.expense-form label,
.segmented-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.amount-field {
  position: relative;
}

.amount-field input {
  padding-right: 44px;
}

.amount-field span {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--muted);
  font-weight: 950;
  transform: translateY(-50%);
}

.split-hint {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 255, 0.14);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.25;
}

.segmented-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented-field legend {
  padding: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid rgba(232, 236, 243, 0.86);
  border-radius: var(--radius);
}

.segmented-control label {
  display: block;
  min-width: 0;
  color: var(--text);
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 900;
}

.segmented-control input:checked + span {
  color: var(--control-active-text);
  background: var(--control-active);
  box-shadow: 0 8px 16px rgba(5, 7, 17, 0.12);
}

.form-actions,
.data-action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.custom-category-panel {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding: 12px;
  background: rgba(247, 250, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.96);
  border-radius: var(--radius);
}

.custom-category-panel label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 880;
}

.custom-category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.custom-category-row input {
  min-height: var(--tap);
  width: 100%;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 760;
  outline: 0;
}

.secondary-button.compact {
  min-height: var(--tap);
  padding-inline: 13px;
}

.primary-button.compact {
  min-height: var(--tap);
  padding-inline: 13px;
}

.custom-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 26px;
}

.custom-category-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 10px;
  color: #1c57d8;
  background: rgba(37, 99, 255, 0.09);
  border: 1px solid rgba(37, 99, 255, 0.18);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
}

.custom-category-chip i {
  color: inherit;
  font-style: normal;
  opacity: 0.74;
}

.custom-category-empty {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
  font-size: 0.74rem;
  font-weight: 720;
}

.cloud-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: rgba(247, 250, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.96);
  border-radius: var(--radius);
}

.cloud-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cloud-heading span {
  display: block;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cloud-heading strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 950;
}

.cloud-heading i {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  color: #08796f;
  background: rgba(16, 213, 194, 0.12);
  border: 1px solid rgba(16, 213, 194, 0.22);
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.cloud-helper {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 740;
  line-height: 1.35;
}

.cloud-config-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 11px;
  color: #08796f;
  background: linear-gradient(135deg, rgba(16, 213, 194, 0.13), rgba(37, 99, 255, 0.08));
  border: 1px solid rgba(16, 213, 194, 0.24);
  border-radius: 10px;
}

.cloud-config-note span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.cloud-config-note strong {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 950;
}

.cloud-auto-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 10px;
}

.cloud-auto-row span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 920;
}

.cloud-auto-row select {
  min-height: 30px;
  padding: 0 28px 0 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 999px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  outline: 0;
}

.cloud-auto-status {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
}

.cloud-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 880;
}

.cloud-remember {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  color: var(--text);
}

.cloud-remember input {
  min-height: 18px;
  height: 18px;
  accent-color: var(--accent);
}

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

.offline-sync-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 255, 0.08), rgba(16, 213, 194, 0.11));
  border: 1px solid rgba(37, 99, 255, 0.16);
  border-radius: var(--radius);
}

.offline-sync-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.offline-sync-heading span {
  display: block;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.offline-sync-heading strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 950;
}

.offline-sync-heading i {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  color: #1c57d8;
  background: rgba(37, 99, 255, 0.1);
  border: 1px solid rgba(37, 99, 255, 0.18);
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.offline-sync-helper {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 740;
  line-height: 1.35;
}

.offline-sync-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.recurring-panel {
  display: grid;
  gap: 14px;
}

.recurring-helper {
  margin: -6px 0 0;
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  font-size: 0.74rem;
  font-weight: 720;
  line-height: 1.35;
}

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

.recurring-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(232, 236, 243, 0.95);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.035);
}

.recurring-card.paused {
  opacity: 0.68;
}

.recurring-card strong,
.desktop-recurring-card strong {
  display: block;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 930;
}

.recurring-card span,
.desktop-recurring-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.recurring-card small,
.desktop-recurring-card small {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
}

.recurring-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.recurring-actions button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--accent);
  background: #eef4ff;
  border: 1px solid #dbe8ff;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 900;
}

.recurring-actions button.danger {
  color: var(--danger);
  background: #fff1f4;
  border-color: #ffd8df;
}

.recurring-inline-toggle,
.desktop-recurring-toggle {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(37, 99, 255, 0.08), rgba(16, 213, 194, 0.1));
  border: 1px solid rgba(37, 99, 255, 0.16);
  border-radius: var(--radius);
}

.recurring-inline-toggle input,
.desktop-recurring-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.recurring-inline-toggle strong,
.desktop-recurring-toggle strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 930;
}

.recurring-inline-toggle small,
.desktop-recurring-toggle small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 780;
  line-height: 1.3;
}

.recurring-inline-toggle.is-disabled,
.desktop-recurring-toggle.is-disabled {
  opacity: 0.54;
}

.hidden {
  display: none !important;
}

.count-pill {
  min-width: 36px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 950;
}

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

.empty-state {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-weight: 800;
}

.expense-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(232, 236, 243, 0.98);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.035);
}

.expense-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.expense-status-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.expense-status-line .status-badge {
  align-self: center;
  transform: translateY(1px);
}

.expense-title {
  min-width: 0;
}

.expense-title h3 {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 920;
  line-height: 1.23;
  letter-spacing: 0;
}

.expense-date {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.expense-amount {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 950;
  white-space: nowrap;
}

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

.meta-item {
  min-width: 0;
  padding: 10px;
  background: #f7f9fc;
  border: 1px solid #edf1f7;
  border-radius: var(--radius);
}

.meta-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.meta-value {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 880;
}

.meta-item.total {
  color: var(--accent-strong);
  background: #eaf2ff;
  border-color: #cfe0ff;
}

.meta-item.total .meta-label {
  color: var(--accent);
}

.meta-item.total .meta-value {
  font-weight: 950;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 74px;
  min-height: 29px;
  padding: 0 10px;
  color: var(--amber);
  background: #fff6dc;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 920;
  white-space: nowrap;
}

.status-badge.settled {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

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

.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 18;
  width: 58px;
  height: 58px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 18px 34px rgba(11, 92, 255, 0.28);
}

.fab .icon {
  width: 24px;
  height: 24px;
}

.tabbar {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 17;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(520px, calc(100% - 20px));
  margin: 0 auto;
  padding: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(232, 236, 243, 0.92);
  border-radius: var(--radius);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
}

.tabbar-button {
  min-width: 0;
  min-height: 50px;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 880;
}

.tabbar-button .icon {
  width: 19px;
  height: 19px;
}

.tabbar-button.active {
  color: var(--control-active-text);
  background: var(--control-active);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  color: #fff;
  background: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 18px 36px rgba(29, 39, 43, 0.24);
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

:root[data-theme="dark"] .toast {
  color: #0d1117;
  background: #ffffff;
  border: 1px solid rgba(232, 236, 243, 0.92);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.42);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.sync-bubble {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 34;
  min-height: 46px;
  max-width: min(360px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px 9px 10px;
  color: #ffffff;
  background: rgba(13, 17, 23, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.26);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.sync-bubble.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.sync-bubble span:last-child {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.sync-bubble strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-bubble small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-bubble-dot {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--aqua));
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(37, 99, 255, 0.14);
}

.sync-bubble-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-top-color: transparent;
  border-radius: 999px;
}

.sync-bubble.syncing .sync-bubble-dot::before {
  animation: sync-spin 780ms linear infinite;
}

.sync-bubble.success .sync-bubble-dot::before {
  width: 11px;
  height: 7px;
  border: 0;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  border-radius: 0;
  transform: rotate(-45deg) translateY(-1px);
}

.sync-bubble.error .sync-bubble-dot {
  background: linear-gradient(135deg, #ff5c7a, #ff9f6e);
  box-shadow: 0 0 0 5px rgba(255, 92, 122, 0.15);
}

.sync-bubble.error .sync-bubble-dot::before {
  width: 12px;
  height: 2px;
  border: 0;
  background: #ffffff;
  border-radius: 999px;
}

:root[data-theme="dark"] .sync-bubble {
  color: #07111f;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .sync-bubble small {
  color: rgba(7, 17, 31, 0.64);
}

@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}

.secondary-button.active-reminder {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: rgba(16, 213, 194, 0.24);
}

@media (display-mode: standalone) {
  .app-shell {
    min-height: 100dvh;
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .app-topbar {
    top: env(safe-area-inset-top);
  }

  .tabbar {
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .fab {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

html.is-standalone .app-shell {
  min-height: 100dvh;
  padding-top: max(18px, env(safe-area-inset-top));
}

html.is-standalone .app-topbar {
  top: env(safe-area-inset-top);
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 10px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .theme-toggle {
    width: 36px;
    padding: 0;
  }

  #themeToggleText {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .app-badge {
    min-width: 56px;
    padding-inline: 10px;
  }

  .dashboard,
  .expense-form-panel,
  .expense-list-panel,
  .data-panel,
  .recurring-panel {
    padding: 12px;
  }

  .balance-card {
    padding: 14px;
  }

  .balance-amount {
    font-size: 2.85rem;
  }

  .expense-topline {
    display: grid;
  }

  .expense-amount {
    white-space: normal;
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px 22px 36px;
  }

  .app-topbar {
    position: static;
    min-height: 76px;
    padding-bottom: 18px;
    background: transparent;
    backdrop-filter: none;
  }

  .app-main {
    gap: 16px;
  }

  .dashboard,
  .expense-form-panel,
  .expense-list-panel,
  .data-panel,
  .recurring-panel {
    padding: 18px;
  }

  .section-header {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    align-items: start;
  }

  .section-header.compact {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .balance-card {
    padding: 22px;
  }

  .balance-amount {
    font-size: 4.45rem;
  }

  .workspace-grid {
    grid-template-columns: minmax(308px, 0.75fr) minmax(0, 1.25fr);
    align-items: start;
  }

  .expense-list-panel {
    grid-row: span 2;
  }

  .data-panel {
    grid-column: 1;
  }

  .expense-meta-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .expense-actions {
    grid-template-columns: repeat(2, 132px);
    justify-content: end;
  }

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

  .data-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fab,
  .tabbar {
    display: none;
  }

  .toast {
    bottom: 22px;
  }
}

@media (min-width: 1040px) {
  .app-main {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
    align-items: start;
  }

  .dashboard {
    position: sticky;
    top: 22px;
  }

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

  .expense-list-panel {
    grid-row: auto;
  }

  .data-panel {
    grid-column: auto;
  }
}

html[data-theme="dark"] {
  background: var(--bg);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, #0d1117 0%, #101720 48%, #0d1117 100%),
    var(--bg);
}

:root[data-theme="dark"] .app-topbar {
  background: linear-gradient(180deg, rgba(13, 17, 23, 0.98), rgba(13, 17, 23, 0.76));
}

:root[data-theme="dark"] .app-card {
  background: var(--surface-raised);
  border-color: rgba(35, 48, 71, 0.96);
}

:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .danger-button {
  background: #111827;
  border-color: var(--line);
  color: var(--text);
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .secondary-button:hover {
  background: #151e31;
  border-color: rgba(109, 141, 255, 0.36);
}

:root[data-theme="dark"] .custom-category-panel {
  background: rgba(17, 24, 39, 0.82);
  border-color: rgba(35, 48, 71, 0.96);
}

:root[data-theme="dark"] .custom-category-row input {
  color: var(--text);
  background: #0f172a;
  border-color: var(--line);
}

:root[data-theme="dark"] .custom-category-chip {
  color: #dbe7ff;
  background: rgba(37, 99, 255, 0.16);
  border-color: rgba(87, 140, 255, 0.3);
}

:root[data-theme="dark"] .cloud-panel {
  background: rgba(17, 24, 39, 0.82);
  border-color: rgba(35, 48, 71, 0.96);
}

:root[data-theme="dark"] .cloud-heading strong {
  color: var(--text);
}

:root[data-theme="dark"] .cloud-panel input {
  color: var(--text);
  background: #0f172a;
  border-color: var(--line);
}

:root[data-theme="dark"] .cloud-config-note {
  color: #dffcf8;
  background: linear-gradient(135deg, rgba(16, 213, 194, 0.12), rgba(37, 99, 255, 0.13));
  border-color: rgba(16, 213, 194, 0.24);
}

:root[data-theme="dark"] .cloud-config-note span {
  color: var(--muted);
}

:root[data-theme="dark"] .cloud-config-note strong {
  color: var(--text);
}

:root[data-theme="dark"] .cloud-auto-row {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--line);
}

:root[data-theme="dark"] .cloud-auto-row select {
  color: var(--text);
  background: #0f172a;
  border-color: var(--line);
}

:root[data-theme="dark"] .cloud-heading i {
  color: #dffcf8;
  background: rgba(16, 213, 194, 0.12);
  border-color: rgba(16, 213, 194, 0.28);
}

:root[data-theme="dark"] .offline-sync-panel {
  background: linear-gradient(135deg, rgba(37, 99, 255, 0.14), rgba(16, 213, 194, 0.1));
  border-color: rgba(87, 140, 255, 0.22);
}

:root[data-theme="dark"] .offline-sync-heading strong {
  color: var(--text);
}

:root[data-theme="dark"] .offline-sync-heading i {
  color: #dbe7ff;
  background: rgba(37, 99, 255, 0.16);
  border-color: rgba(87, 140, 255, 0.3);
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

:root[data-theme="dark"] .app-badge,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .count-pill,
:root[data-theme="dark"] .status-badge.settled {
  color: var(--text);
  background: #111827;
  border-color: var(--line);
}

:root[data-theme="dark"] select,
:root[data-theme="dark"] input {
  color: var(--text);
  background: rgba(15, 23, 42, 0.96);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] input::placeholder {
  color: #64748b;
}

:root[data-theme="dark"] .profile-toggle,
:root[data-theme="dark"] .segmented-control {
  background: #090d16;
  border-color: var(--line);
}

:root[data-theme="dark"] .profile-button,
:root[data-theme="dark"] .segmented-control label {
  color: var(--muted);
}

:root[data-theme="dark"] .profile-avatar {
  color: var(--text);
  background: #151e31;
}

:root[data-theme="dark"] .profile-button.active,
:root[data-theme="dark"] .segmented-control input:checked + span {
  color: var(--control-active-text);
  background: var(--control-active);
  box-shadow: 0 10px 22px rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .profile-button.active .profile-avatar {
  color: #0d1117;
  background: #ffffff;
}

:root[data-theme="dark"] .split-hint {
  color: #a7baff;
  background: rgba(37, 99, 255, 0.16);
  border-color: rgba(109, 141, 255, 0.28);
}

:root[data-theme="dark"] .balance-card {
  background:
    linear-gradient(180deg, rgba(13, 17, 27, 0.98), rgba(7, 10, 17, 0.98)),
    #070a11;
  border-color: rgba(35, 43, 58, 0.98);
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.38);
}

:root[data-theme="dark"] .avatar-stack span {
  color: #0d1117;
  background: rgba(255, 255, 255, 0.94);
  border-color: #070a11;
}

:root[data-theme="dark"] .avatar-stack span + span {
  background: #b9f5ff;
}

:root[data-theme="dark"] .stat-cell,
:root[data-theme="dark"] .split-meter,
:root[data-theme="dark"] .expense-card,
:root[data-theme="dark"] .recurring-card {
  background: rgba(13, 18, 28, 0.82);
  border-color: rgba(35, 48, 71, 0.94);
}

:root[data-theme="dark"] .meter-track {
  background: #1e293b;
}

:root[data-theme="dark"] .meta-item {
  background: #090d16;
  border-color: #1b2434;
}

:root[data-theme="dark"] .status-badge {
  color: #fde68a;
  background: rgba(120, 83, 18, 0.34);
}

:root[data-theme="dark"] .empty-state {
  color: var(--muted);
  background: rgba(15, 23, 42, 0.54);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .danger-button {
  color: #fda4af;
}

:root[data-theme="dark"] .danger-button:hover {
  background: var(--rose-soft);
  border-color: #7f1d1d;
}

:root[data-theme="dark"] .fab,
:root[data-theme="dark"] .primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 34px rgba(109, 141, 255, 0.28);
}

:root[data-theme="dark"] .primary-button:hover {
  background: #5578ff;
}

:root[data-theme="dark"] .tabbar {
  background: rgba(8, 13, 26, 0.9);
  border-color: rgba(35, 48, 71, 0.9);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36);
}

/* Native-app dashboard, inspired by the Duolio mobile mockup. */
body {
  background:
    radial-gradient(circle at 50% -8%, rgba(37, 99, 255, 0.06), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbfcff 48%, #f7f9fc 100%),
    var(--bg);
}

.app-shell {
  width: min(900px, 100%);
  padding: max(22px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(118px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.app-topbar {
  position: static;
  min-height: 92px;
  padding: 0 0 18px;
  background: transparent;
  backdrop-filter: none;
}

.brand-lockup {
  gap: 14px;
}

.brand-logo {
  width: min(244px, calc(100vw - 132px));
}

.brand-logo-dark {
  width: min(202px, calc(100vw - 132px));
}

.brand-mark {
  width: 70px;
  height: 88px;
  flex-basis: 70px;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
}

h1 {
  font-size: 2.32rem;
  line-height: 0.95;
}

.brand-copy p {
  margin-top: 7px;
  color: #5f6785;
  font-size: 1.02rem;
  font-weight: 820;
}

.app-badge {
  display: none;
}

.theme-toggle {
  width: 58px;
  height: 58px;
  min-height: 58px;
  display: inline-grid;
  place-items: center;
  gap: 0;
  padding: 0;
  position: relative;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border-color: #dce3ee;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(13, 17, 23, 0.08);
}

.theme-toggle .icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.theme-toggle .theme-icon {
  color: #2563ff;
}

:root[data-theme="dark"] .theme-toggle .theme-icon {
  color: #10d5c2;
}

#themeToggleText {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.dashboard {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.dashboard > .section-header {
  display: block;
  margin-bottom: 16px;
}

.dashboard > .section-header > div:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.month-controls {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 8px;
  min-height: 68px;
  padding: 0;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid #dce3ee;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(13, 17, 23, 0.055);
}

.month-controls .icon-button {
  width: 52px;
  min-height: 66px;
  color: var(--text);
  background: transparent;
}

.month-controls select {
  min-height: 66px;
  padding: 0 34px;
  text-align: center;
  color: var(--text);
  background-color: transparent;
  border: 0;
  box-shadow: none;
  font-size: 1.28rem;
  font-weight: 950;
}

.profile-switcher {
  margin: 0 0 18px;
}

.profile-switcher > p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.profile-toggle {
  min-height: 74px;
  gap: 10px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-color: #dce3ee;
  box-shadow: 0 16px 36px rgba(13, 17, 23, 0.055);
}

.profile-button {
  min-height: 64px;
  padding-inline: 12px;
  border-radius: 8px;
  font-weight: 920;
}

.profile-avatar {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(37, 99, 255, 0.12);
}

.profile-copy strong {
  font-size: 1.04rem;
}

.profile-copy small {
  font-size: 0.72rem;
}

.profile-button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #2563ff, #1475ff);
  box-shadow: 0 18px 34px rgba(37, 99, 255, 0.28);
}

.balance-card {
  padding: 22px;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 50%, rgba(37, 99, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.86)),
    #ffffff;
  border: 1px solid #dce3ee;
  box-shadow: 0 18px 44px rgba(13, 17, 23, 0.07);
}

.balance-card::before {
  content: none;
}

.balance-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(108px, 34%);
  align-items: center;
  gap: 12px;
}

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

.balance-label {
  min-height: 34px;
  padding: 0 14px;
  color: var(--accent);
  background: rgba(37, 99, 255, 0.08);
  border: 1px solid rgba(37, 99, 255, 0.12);
  font-size: 0.82rem;
  letter-spacing: 0;
}

.balance-amount {
  margin-top: 26px;
  color: var(--text);
  font-size: 4.25rem;
  line-height: 0.92;
}

.balance-result {
  max-width: 300px;
  color: #5f6785;
  font-size: 1.38rem;
  font-weight: 920;
  line-height: 1.28;
}

.balance-visual {
  position: relative;
  min-height: 172px;
  display: grid;
  place-items: center;
}

.balance-visual img {
  width: min(128px, 100%);
  height: auto;
  filter: drop-shadow(0 22px 24px rgba(16, 213, 194, 0.16));
}

.balance-visual::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: 15px;
  width: 128px;
  height: 22px;
  background: radial-gradient(ellipse, rgba(13, 17, 23, 0.14), transparent 68%);
}

.balance-visual .avatar-stack {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

.avatar-stack span {
  color: #ffffff;
  background: var(--accent);
  border-color: #ffffff;
}

.avatar-stack span + span {
  color: #0d1117;
  background: #bdf7ef;
}

.balance-card .split-meter {
  margin-top: 18px;
  padding: 0;
  background: transparent;
  border: 0;
}

.balance-card .meter-track {
  height: 10px;
  gap: 6px;
  background: transparent;
  border-radius: 999px;
}

.balance-card .meter-fill {
  border-radius: 999px;
}

.balance-card .meter-legend {
  margin-top: 10px;
  color: #5f6785;
  font-size: 1rem;
  font-weight: 860;
}

.meter-legend strong {
  color: var(--text);
  font-weight: 950;
}

.balance-note,
.balance-meta {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.stats-grid {
  gap: 12px;
  margin-top: 20px;
}

.stat-cell {
  min-height: 88px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  border-color: #dce3ee;
  box-shadow: 0 14px 30px rgba(13, 17, 23, 0.055);
}

.stat-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: #eaf1ff;
  border-radius: 999px;
  font-size: 1.35rem;
  font-weight: 950;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.wendee,
.stat-icon.split {
  color: #0fbfac;
  background: #dffbf7;
}

dt {
  font-size: 0.98rem;
  line-height: 1.15;
}

dd {
  margin-top: 6px;
  font-size: 1.35rem;
}

.share-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 0.98rem;
  line-height: 1.2;
}

.share-breakdown span {
  white-space: nowrap;
}

.recent-panel {
  margin-top: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  border-color: #dce3ee;
  box-shadow: 0 18px 44px rgba(13, 17, 23, 0.07);
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.recent-header h2 {
  font-size: 1.25rem;
  font-weight: 950;
}

.expense-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: rgba(235, 241, 249, 0.8);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.recent-panel .expense-filter {
  margin-bottom: 8px;
}

.history-filter {
  margin: -4px 0 12px;
}

.expense-filter button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 900;
}

.expense-filter button.active {
  color: var(--control-active-text);
  background: var(--control-active);
  box-shadow: 0 8px 18px rgba(37, 99, 255, 0.16);
}

:root[data-theme="dark"] .expense-filter {
  background: rgba(8, 17, 29, 0.74);
  border-color: rgba(118, 145, 188, 0.22);
}

.text-button {
  min-height: 34px;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-weight: 900;
}

.recent-expense-list {
  display: grid;
}

.recent-expense {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 30px 24px;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.recent-expense:last-child {
  border-bottom: 0;
}

.recent-icon,
.recent-person {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 950;
}

.recent-icon {
  width: 52px;
  height: 52px;
  color: var(--accent);
  background: #eaf1ff;
}

.recent-icon.wendee {
  color: #0fbfac;
  background: #dffbf7;
}

.recent-icon svg {
  width: 27px;
  height: 27px;
}

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

.recent-title-stack {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding-bottom: 25px;
}

.recent-copy h3 {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 950;
}

.recent-copy p {
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5f6785;
  font-size: 0.88rem;
  font-weight: 780;
}

.recent-copy .dot {
  margin-inline: 6px;
  vertical-align: middle;
}

.recurring-mini-badge,
.desktop-recurring-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  color: #e11d48;
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.18);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 930;
  vertical-align: middle;
  white-space: nowrap;
}

.recent-copy .recurring-mini-badge.centered {
  position: absolute;
  top: 22px;
  left: 50%;
  width: max-content;
  margin: 0;
  transform: translateX(-50%);
}

.recent-amount {
  color: var(--text);
  font-size: 1rem;
  font-weight: 950;
  white-space: nowrap;
}

.recent-person {
  width: 30px;
  height: 30px;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.86rem;
}

.recent-person.wendee {
  color: #0d1117;
  background: #bdf7ef;
}

.recent-open {
  width: 24px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  color: #74809d;
  background: transparent;
}

.recent-open .icon {
  width: 22px;
  height: 22px;
}

.empty-state.compact {
  min-height: 88px;
  background: transparent;
  border: 0;
}

.settle-button {
  margin-top: 16px;
}

.fab {
  right: max(22px, env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #2563ff, #10d5c2);
  box-shadow: 0 22px 34px rgba(37, 99, 255, 0.28);
}

.fab .icon {
  width: 31px;
  height: 31px;
}

.tabbar {
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(760px, calc(100% - 28px));
  min-height: 86px;
  gap: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  border-color: #dce3ee;
  box-shadow: 0 22px 50px rgba(13, 17, 23, 0.14);
}

.tabbar-button {
  min-height: 70px;
  color: #74809d;
  font-size: 0.82rem;
  font-weight: 860;
}

.tabbar-button .icon {
  width: 26px;
  height: 26px;
}

.tabbar-button.active {
  color: var(--accent);
  background: transparent;
}

.workspace-grid {
  margin-top: 18px;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 255, 0.16), transparent 34%),
    linear-gradient(180deg, #0d1117 0%, #101720 54%, #0d1117 100%),
    var(--bg);
}

:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .month-controls,
:root[data-theme="dark"] .profile-toggle,
:root[data-theme="dark"] .balance-card,
:root[data-theme="dark"] .stat-cell,
:root[data-theme="dark"] .recent-panel {
  background: rgba(16, 23, 32, 0.86);
  border-color: #263240;
}

:root[data-theme="dark"] .month-controls select,
:root[data-theme="dark"] .month-controls .icon-button {
  color: var(--text);
  background-color: transparent;
}

:root[data-theme="dark"] .balance-card {
  background:
    radial-gradient(circle at 78% 50%, rgba(16, 213, 194, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(16, 23, 32, 0.94), rgba(13, 17, 23, 0.94)),
    #0d1117;
}

:root[data-theme="dark"] .balance-result,
:root[data-theme="dark"] .brand-copy p,
:root[data-theme="dark"] .recent-copy p,
:root[data-theme="dark"] .balance-card .meter-legend {
  color: #9aa4b2;
}

:root[data-theme="dark"] .stat-icon,
:root[data-theme="dark"] .recent-icon {
  background: #16264d;
}

:root[data-theme="dark"] .stat-icon.wendee,
:root[data-theme="dark"] .stat-icon.split,
:root[data-theme="dark"] .recent-icon.wendee {
  background: rgba(16, 213, 194, 0.16);
}

:root[data-theme="dark"] .tabbar {
  background: rgba(16, 23, 32, 0.9);
  border-color: #263240;
}

@media (max-width: 520px) {
  .app-shell {
    padding: max(22px, env(safe-area-inset-top)) 26px calc(118px + env(safe-area-inset-bottom));
  }

  .app-topbar {
    min-height: 82px;
    padding-bottom: 12px;
  }

  .brand-logo {
    width: min(206px, calc(100vw - 128px));
  }

  .brand-logo-dark {
    width: min(178px, calc(100vw - 128px));
  }

  .brand-mark {
    width: 58px;
    height: 72px;
    flex-basis: 58px;
  }

  h1 {
    font-size: 1.96rem;
  }

  .brand-copy p {
    margin-top: 4px;
    font-size: 0.88rem;
  }

  .theme-toggle {
    width: 52px;
    height: 52px;
    min-height: 52px;
  }

  .dashboard > .section-header {
    margin-bottom: 14px;
  }

  .month-controls {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    min-height: 60px;
  }

  .month-controls select,
  .month-controls .icon-button {
    min-height: 58px;
  }

  .month-controls .icon-button {
    width: 48px;
  }

  .month-controls select {
    padding-inline: 24px;
    font-size: 1.16rem;
  }

  .profile-switcher {
    margin-bottom: 14px;
  }

  .profile-toggle {
    min-height: 64px;
    padding: 4px;
  }

  .profile-button {
    min-height: 54px;
    gap: 7px;
    padding-inline: 9px;
  }

  .profile-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .profile-copy strong {
    font-size: 0.92rem;
  }

  .profile-copy small {
    font-size: 0.64rem;
  }

  .balance-card {
    padding: 16px;
  }

  .balance-card-top {
    grid-template-columns: minmax(0, 1fr) 102px;
  }

  .balance-label {
    min-height: 30px;
    padding-inline: 12px;
    font-size: 0.74rem;
  }

  .balance-amount {
    margin-top: 13px;
    font-size: 3rem;
  }

  .balance-result {
    font-size: 1rem;
  }

  .balance-visual {
    min-height: 106px;
  }

  .balance-visual img {
    width: 82px;
  }

  .balance-visual::after {
    width: 86px;
    bottom: 8px;
  }

  .balance-card .split-meter {
    margin-top: 12px;
  }

  .balance-card .meter-track {
    height: 8px;
  }

  .balance-card .meter-legend {
    margin-top: 7px;
    font-size: 0.82rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
  }

  .stat-cell {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 66px;
    gap: 9px;
    padding: 9px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1.12rem;
  }

  .stat-icon svg {
    width: 21px;
    height: 21px;
  }

  dt {
    font-size: 0.74rem;
  }

  dd {
    margin-top: 4px;
    font-size: 1.06rem;
  }

  .recent-panel {
    margin-top: 14px;
    padding: 12px;
  }

  .recent-header {
    margin-bottom: 4px;
  }

  .recent-header h2 {
    font-size: 1.12rem;
  }

  .recent-expense {
    grid-template-columns: 38px minmax(0, 1fr) auto 24px 16px;
    gap: 5px;
    padding: 9px 0;
  }

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

  .recent-icon svg {
    width: 23px;
    height: 23px;
  }

  .recent-copy h3,
  .recent-amount {
    font-size: 0.84rem;
  }

  .recent-copy p {
    margin-top: 4px;
    font-size: 0.68rem;
  }

  .recent-person {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  .fab {
    right: max(32px, env(safe-area-inset-right));
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: 66px;
    height: 66px;
  }

  .tabbar {
    left: max(26px, env(safe-area-inset-left));
    right: max(26px, env(safe-area-inset-right));
    width: min(760px, calc(100% - 52px));
    min-height: 78px;
    padding: 7px;
  }

  .tabbar-button {
    min-height: 62px;
    font-size: 0.76rem;
  }

  .tabbar-button .icon {
    width: 24px;
    height: 24px;
  }

  .settle-button {
    margin-top: 76px;
  }
}

@media (max-width: 365px) {
  .app-shell {
    padding-inline: 16px;
  }

  .balance-card-top {
    grid-template-columns: 1fr;
  }

  .balance-visual {
    display: none;
  }

  .recent-expense {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .recent-person,
  .recent-open {
    display: none;
  }

  .tabbar {
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    width: min(760px, calc(100% - 28px));
  }
}

/* Keep the app background continuous through the bottom mobile safe area. */
html {
  background: #f7f9fc;
}

body {
  background-color: #f7f9fc;
  background-attachment: fixed;
}

:root[data-theme="dark"] html {
  background: #0d1117;
}

:root[data-theme="dark"] body {
  background-color: #0d1117;
  background:
    linear-gradient(180deg, #0d1117 0, #0d1117 132px, #101720 54%, #0d1117 100%);
  background-attachment: fixed;
}

.tabbar {
  bottom: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

@media (max-width: 760px) {
  .app-shell {
    padding-bottom: calc(116px + env(safe-area-inset-bottom));
  }

  .tabbar {
    left: 0;
    right: 0;
    width: 100%;
    min-height: calc(78px + env(safe-area-inset-bottom));
  }

  .fab {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

.month-controls select {
  text-align-last: center;
}

.secondary-button:disabled {
  opacity: 0.62;
}

@media (max-width: 760px) {
  .dashboard > .section-header {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .dashboard > .section-header .month-controls {
    width: 100%;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
  }

  .month-controls select {
    min-width: 0;
    width: 100%;
    justify-self: stretch;
    text-align: center;
    text-align-last: center;
  }

  .balance-card-top {
    grid-template-columns: minmax(0, 1fr) minmax(92px, 31%);
  }

  .balance-result {
    max-width: min(100%, 360px);
    overflow-wrap: normal;
    text-wrap: balance;
  }
}

@media (max-width: 385px) {
  .dashboard > .section-header .month-controls {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
  }

  .month-controls select {
    padding-inline: 12px;
    font-size: 1.04rem;
  }

  .balance-card-top {
    grid-template-columns: 1fr;
  }

  .balance-result {
    max-width: 100%;
  }
}

@media (min-width: 900px) {
  body {
    background:
      radial-gradient(circle at 16% 4%, rgba(37, 99, 255, 0.08), transparent 28%),
      radial-gradient(circle at 88% 12%, rgba(16, 213, 194, 0.08), transparent 24%),
      linear-gradient(180deg, #ffffff 0%, #f8fafc 48%, #f4f7fb 100%),
      var(--bg);
  }

  .app-shell {
    width: min(1240px, 100%);
    padding: 28px 32px 46px;
  }

  .app-topbar {
    min-height: 88px;
    padding-bottom: 22px;
  }

  .brand-logo {
    width: 252px;
  }

  .brand-logo-dark {
    width: 216px;
  }

  .app-main {
    grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.28fr);
    align-items: start;
    gap: 24px;
  }

  .dashboard {
    position: sticky;
    top: 24px;
    align-self: start;
  }

  .dashboard > .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 18px;
  }

  .dashboard > .section-header > div:first-child {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .dashboard > .section-header .month-controls {
    width: 100%;
  }

  .profile-switcher {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .profile-switcher > p {
    margin-right: 4px;
  }

  .balance-card {
    min-height: 420px;
    padding: 24px;
  }

  .balance-card-top {
    grid-template-columns: minmax(0, 1fr) minmax(124px, 30%);
  }

  .balance-amount {
    font-size: clamp(3.35rem, 5vw, 4.65rem);
  }

  .balance-result {
    max-width: 420px;
  }

  .recent-panel {
    margin-top: 18px;
  }

  .settle-button {
    margin-top: 18px;
  }

  .workspace-grid {
    grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
    align-items: start;
    gap: 18px;
    margin-top: 0;
  }

  .expense-form-panel,
  .expense-list-panel,
  .data-panel,
  .recurring-panel {
    padding: 18px;
  }

  .expense-form-panel {
    grid-column: 1;
  }

  .expense-list-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .data-panel {
    grid-column: 1;
  }

  .recurring-panel {
    grid-column: 1;
  }

  .expense-list {
    max-height: min(760px, calc(100dvh - 164px));
    overflow: auto;
    padding-right: 4px;
  }

  .expense-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .expense-actions {
    grid-template-columns: repeat(2, minmax(118px, 1fr));
  }

  .data-action-grid {
    grid-template-columns: 1fr;
  }

  .fab,
  .tabbar {
    display: none;
  }
}

@media (min-width: 1180px) {
  .app-main {
    grid-template-columns: minmax(420px, 0.88fr) minmax(0, 1.42fr);
  }

  .workspace-grid {
    grid-template-columns: minmax(340px, 0.76fr) minmax(0, 1.24fr);
  }

  .expense-meta-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

:root[data-theme="dark"] body {
  background-color: #0d1117;
}

@media (min-width: 900px) {
  :root[data-theme="dark"] body {
    background:
      radial-gradient(circle at 15% 4%, rgba(37, 99, 255, 0.16), transparent 30%),
      radial-gradient(circle at 86% 12%, rgba(16, 213, 194, 0.12), transparent 24%),
      linear-gradient(180deg, #0d1117 0%, #101720 54%, #0d1117 100%);
  }
}

/* Premium two-person selector. */
.profile-toggle {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  gap: 0;
  padding: 5px;
  border-radius: 12px;
}

.profile-toggle::before {
  content: "";
  position: absolute;
  inset: 5px auto 5px 5px;
  z-index: 0;
  width: calc((100% - 10px) / 2);
  border-radius: 9px;
  background: linear-gradient(135deg, #2563ff, #1475ff);
  box-shadow: 0 16px 32px rgba(37, 99, 255, 0.26);
  transition:
    transform 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}

.profile-toggle[data-active-viewer="Wendee"]::before {
  transform: translateX(100%);
  background: linear-gradient(135deg, #10d5c2, #19b8e6);
  box-shadow: 0 16px 32px rgba(16, 213, 194, 0.2);
}

.profile-button {
  position: relative;
  z-index: 1;
  min-height: 64px;
  justify-content: center;
  padding-inline: 12px;
  background: transparent;
  box-shadow: none;
}

.profile-button.active {
  background: transparent;
  box-shadow: none;
}

.profile-toggle[data-active-viewer="Alex"] .profile-button[data-viewer="Alex"] {
  color: #ffffff;
}

.profile-toggle[data-active-viewer="Wendee"] .profile-button[data-viewer="Wendee"] {
  color: #0d1117;
}

.profile-button:not(.active) {
  color: #64708b;
}

.profile-button:not(.active):hover {
  background: rgba(255, 255, 255, 0.48);
}

.profile-avatar {
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 20px rgba(13, 17, 23, 0.08);
}

.profile-button.active .profile-avatar {
  background: rgba(255, 255, 255, 0.96);
}

.profile-button[data-viewer="Alex"].active .profile-avatar {
  color: #2563ff;
}

.profile-button[data-viewer="Wendee"].active .profile-avatar {
  color: #0fbfac;
}

.profile-copy small {
  max-width: 82px;
}

.recent-expense-list {
  align-content: start;
}

@media (min-width: 900px) {
  .recent-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 392px;
  }

  .recent-expense {
    padding-block: 12px;
  }
}

:root[data-theme="dark"] .profile-toggle {
  background: rgba(16, 23, 32, 0.92);
  border-color: #263240;
}

:root[data-theme="dark"] .profile-toggle::before {
  background: #f8fafc;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .profile-toggle[data-active-viewer="Wendee"]::before {
  background: linear-gradient(135deg, #10d5c2, #f8fafc);
}

:root[data-theme="dark"] .profile-button:not(.active) {
  color: #9aa4b2;
}

:root[data-theme="dark"] .profile-button:not(.active):hover {
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .profile-button.active {
  color: #0d1117;
}

@media (max-width: 390px) {
  .profile-button {
    gap: 6px;
    padding-inline: 7px;
  }

  .profile-copy small {
    max-width: 72px;
  }
}

/* Stronger alignment for the month/profile controls and expense actions. */
.profile-switcher,
.profile-toggle {
  width: 100%;
}

.profile-toggle {
  min-height: 78px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-button {
  width: 100%;
  min-height: 68px;
}

.profile-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  font-size: 0.9rem;
}

.profile-copy strong {
  font-size: 1.08rem;
}

.profile-copy small {
  max-width: none;
  font-size: 0.74rem;
}

.expense-status-line {
  display: grid;
  grid-template-columns: minmax(88px, 0.55fr) minmax(0, 1.45fr);
  align-items: stretch;
  gap: 10px;
}

.expense-status-line .status-badge {
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  align-self: stretch;
  transform: none;
}

.expense-status-line .expense-actions {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-content: stretch;
}

.expense-status-line .secondary-button,
.expense-status-line .danger-button {
  width: 100%;
  min-height: var(--tap);
  padding-inline: 8px;
}

@media (max-width: 390px) {
  .profile-toggle {
    min-height: 72px;
  }

  .profile-button {
    min-height: 62px;
  }

  .profile-avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .profile-copy strong {
    font-size: 0.96rem;
  }

  .profile-copy small {
    font-size: 0.66rem;
  }

  .expense-status-line {
    grid-template-columns: minmax(78px, 0.48fr) minmax(0, 1.52fr);
    gap: 8px;
  }
}

/* Desktop management dashboard. Hidden on the mobile app layout. */
.desktop-management-panel {
  display: none;
}

@media (min-width: 900px) {
  .desktop-management-panel {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #dce3ee;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(13, 17, 23, 0.07);
  }

  .management-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
  }

  .management-header h2 {
    font-size: 1.16rem;
    font-weight: 950;
  }

  .management-chip {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: var(--accent);
    background: rgba(37, 99, 255, 0.08);
    border: 1px solid rgba(37, 99, 255, 0.14);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 920;
    white-space: nowrap;
  }

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

  .management-card {
    min-width: 0;
    min-height: 102px;
    display: grid;
    align-content: space-between;
    gap: 10px;
    padding: 14px;
    color: var(--text);
    background: #f7f9fc;
    border: 1px solid #edf1f7;
    border-radius: 10px;
  }

  .management-card span {
    color: #66708a;
    font-size: 0.76rem;
    font-weight: 900;
  }

  .management-card strong {
    overflow-wrap: anywhere;
    font-size: 1.28rem;
    font-weight: 950;
    line-height: 1.05;
  }

  .management-card small {
    color: #74809d;
    font-size: 0.72rem;
    font-weight: 850;
  }

  .management-card.main {
    color: #ffffff;
    background:
      radial-gradient(circle at 86% 18%, rgba(16, 213, 194, 0.28), transparent 34%),
      linear-gradient(135deg, #0d1117, #172033);
    border-color: #182338;
  }

  .management-card.main span,
  .management-card.main small {
    color: rgba(255, 255, 255, 0.72);
  }

  .management-card.alex {
    border-color: rgba(37, 99, 255, 0.22);
    background: rgba(37, 99, 255, 0.07);
  }

  .management-card.wendee {
    border-color: rgba(16, 213, 194, 0.22);
    background: rgba(16, 213, 194, 0.08);
  }

  .management-balance-strip {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #edf1f7;
    border-radius: 10px;
  }

  .management-balance-strip span {
    color: #66708a;
    font-size: 0.78rem;
    font-weight: 900;
  }

  .management-balance-strip strong {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 950;
    text-align: right;
  }

  :root[data-theme="dark"] .desktop-management-panel {
    background: rgba(16, 23, 32, 0.86);
    border-color: #263240;
  }

  :root[data-theme="dark"] .management-chip {
    color: #f8fafc;
    background: rgba(37, 99, 255, 0.16);
    border-color: rgba(37, 99, 255, 0.24);
  }

  :root[data-theme="dark"] .management-card {
    background: #090d16;
    border-color: #1b2434;
  }

  :root[data-theme="dark"] .management-card span,
  :root[data-theme="dark"] .management-card small,
  :root[data-theme="dark"] .management-balance-strip span {
    color: #9aa4b2;
  }

  :root[data-theme="dark"] .management-card.main {
    background:
      radial-gradient(circle at 86% 18%, rgba(16, 213, 194, 0.18), transparent 34%),
      linear-gradient(135deg, #f8fafc, #dfe8f6);
    color: #0d1117;
    border-color: #e6ebf2;
  }

  :root[data-theme="dark"] .management-card.main span,
  :root[data-theme="dark"] .management-card.main small {
    color: rgba(13, 17, 23, 0.7);
  }

  :root[data-theme="dark"] .management-balance-strip {
    background: #090d16;
    border-color: #1b2434;
  }
}

/* True desktop dashboard layout. Mobile keeps the native app view above. */
@media (min-width: 980px) {
  .app-shell {
    width: min(1360px, 100%);
    padding-inline: 34px;
  }

  .app-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .dashboard {
    position: static;
    display: grid;
    grid-template-columns: minmax(390px, 0.82fr) minmax(0, 1.18fr);
    align-items: stretch;
    gap: 18px;
  }

  .dashboard > .section-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(380px, 440px);
    align-items: end;
    gap: 22px;
    margin-bottom: 0;
  }

  .dashboard > .section-header .month-controls {
    min-height: 62px;
  }

  .dashboard > .section-header .month-controls .icon-button,
  .dashboard > .section-header .month-controls select {
    min-height: 60px;
  }

  .dashboard > .section-header .month-controls .icon-button {
    width: 52px;
  }

  .profile-switcher {
    grid-column: 1;
    margin: 0;
  }

  .profile-toggle {
    min-height: 86px;
  }

  .profile-button {
    min-height: 76px;
    padding-inline: 18px;
  }

  .balance-card {
    grid-column: 1;
    min-height: 392px;
    display: grid;
    align-content: space-between;
  }

  .balance-card-top {
    align-items: center;
  }

  .balance-result {
    max-width: 460px;
    font-size: 1.2rem;
  }

  .desktop-management-panel {
    grid-column: 2;
    grid-row: 2 / span 3;
    min-height: 100%;
    margin-top: 0;
    padding: 22px;
    align-content: start;
  }

  .management-header h2 {
    font-size: 1.45rem;
  }

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

  .management-card {
    min-height: 128px;
    padding: 16px;
  }

  .management-card strong {
    font-size: 1.46rem;
  }

  .management-balance-strip {
    min-height: 74px;
    padding-inline: 18px;
  }

  .management-balance-strip strong {
    max-width: 70%;
    font-size: 1.04rem;
  }

  .dashboard .recent-panel {
    display: none;
  }

  .settle-button {
    grid-column: 1;
    width: 100%;
    margin-top: 0;
  }

  .workspace-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.44fr) minmax(0, 1fr);
    align-items: start;
    gap: 22px;
    margin-top: 0;
  }

  .expense-form-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .data-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .recurring-panel {
    grid-column: 1;
    grid-row: 3;
  }

  .expense-list-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 100%;
  }

  .expense-form-panel,
  .expense-list-panel,
  .data-panel,
  .recurring-panel {
    padding: 22px;
  }

  .expense-list {
    max-height: min(860px, calc(100dvh - 178px));
    gap: 12px;
  }

  .expense-card {
    padding: 16px;
  }

  .expense-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .meta-value {
    word-break: normal;
    overflow-wrap: normal;
  }

  .expense-status-line {
    grid-template-columns: minmax(108px, 0.32fr) minmax(260px, 0.68fr);
  }
}

@media (min-width: 1220px) {
  .workspace-grid {
    grid-template-columns: minmax(380px, 0.42fr) minmax(0, 1fr);
  }

  .expense-meta-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .expense-status-line {
    grid-template-columns: minmax(112px, 0.22fr) minmax(300px, 0.78fr);
  }
}

@media (min-width: 1380px) {
  .app-shell {
    width: min(1440px, 100%);
  }

  .dashboard {
    grid-template-columns: minmax(420px, 0.72fr) minmax(0, 1.28fr);
  }
}

/* Dedicated desktop product dashboard. */
.desktop-shell {
  display: none;
}

.modal-open {
  overflow: hidden;
}

.premium-modal[hidden] {
  display: none;
}

.premium-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(18px);
}

.premium-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 40px));
  overflow: auto;
  padding: 24px;
  color: #f8fafc;
  background:
    radial-gradient(circle at 16% 0%, rgba(37, 99, 255, 0.28), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(16, 213, 194, 0.2), transparent 28%),
    linear-gradient(180deg, rgba(13, 26, 45, 0.98), rgba(7, 14, 26, 0.98));
  border: 1px solid rgba(118, 145, 188, 0.28);
  border-radius: 14px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.45);
}

.premium-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(118, 145, 188, 0.24);
  border-radius: 9px;
}

.premium-close .icon {
  width: 18px;
  height: 18px;
}

.premium-close svg,
.premium-feature-grid svg,
.premium-actions svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.premium-hero {
  max-width: 560px;
  padding-right: 54px;
}

.premium-hero span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: #8fb3ff;
  background: rgba(37, 99, 255, 0.16);
  border: 1px solid rgba(37, 99, 255, 0.28);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.premium-hero h2 {
  margin-top: 14px;
  color: #ffffff;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  font-weight: 950;
  line-height: 1.02;
}

.premium-hero p {
  margin-top: 12px;
  color: #b7c3d7;
  font-size: 1rem;
  line-height: 1.45;
}

.premium-hero.compact h2 {
  font-size: clamp(1.55rem, 3vw, 2.1rem);
}

.premium-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(118, 145, 188, 0.2);
  border-radius: 10px;
}

.premium-price strong {
  color: #ffffff;
  font-size: 2.2rem;
  font-weight: 950;
}

.premium-price span {
  color: #cbd5e1;
  font-weight: 850;
}

.premium-price small {
  flex-basis: 100%;
  color: #8fa0b8;
  font-size: 0.84rem;
}

.premium-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.premium-feature-grid article {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(118, 145, 188, 0.2);
  border-radius: 10px;
}

.premium-feature-grid .icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 8px;
  color: #10d5c2;
  background: rgba(16, 213, 194, 0.13);
  border-radius: 999px;
}

.premium-feature-grid strong {
  color: #ffffff;
  font-weight: 950;
}

.premium-feature-grid p {
  color: #aebbd0;
  font-size: 0.84rem;
  line-height: 1.4;
}

.premium-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.premium-primary,
.premium-secondary {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 9px;
  font-weight: 920;
}

.premium-primary {
  flex: 1 1 auto;
  color: #ffffff;
  background: linear-gradient(135deg, #2563ff, #0ea5e9);
  box-shadow: 0 16px 32px rgba(37, 99, 255, 0.26);
}

.premium-secondary {
  color: #dce8f8;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(118, 145, 188, 0.22);
}

.report-dialog {
  width: min(760px, 100%);
}

.premium-report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.premium-report-grid article {
  min-height: 116px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(118, 145, 188, 0.2);
  border-radius: 10px;
}

.premium-report-grid span,
.premium-report-grid small {
  color: #9fb0c9;
  font-size: 0.74rem;
  font-weight: 850;
}

.premium-report-grid strong {
  color: #ffffff;
  font-size: 1.22rem;
  font-weight: 950;
}

.premium-insights {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 16px;
  background: rgba(37, 99, 255, 0.08);
  border: 1px solid rgba(37, 99, 255, 0.18);
  border-radius: 10px;
}

.premium-insights h3 {
  color: #ffffff;
  font-size: 1rem;
}

.premium-insights p {
  color: #c7d4e8;
  font-size: 0.92rem;
  line-height: 1.45;
}

.scan-dialog {
  width: min(860px, 100%);
}

.settlement-dialog {
  width: min(560px, 100%);
}

.settlement-summary-card {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at 92% 18%, rgba(16, 213, 194, 0.2), transparent 32%),
    rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(118, 145, 188, 0.22);
  border-radius: 12px;
}

.settlement-summary-card span,
.settlement-summary-card small,
.settlement-form label,
.settlement-hint {
  color: #aebbd0;
}

.settlement-summary-card strong {
  color: #ffffff;
  font-size: clamp(2rem, 8vw, 3.3rem);
  font-weight: 950;
  letter-spacing: 0;
}

.settlement-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.settlement-form label {
  display: grid;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 900;
}

.settlement-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: #ffffff;
  background: rgba(17, 30, 50, 0.86);
  border: 1px solid rgba(118, 145, 188, 0.3);
  border-radius: 9px;
  outline: 0;
  font: inherit;
  font-weight: 850;
}

.settlement-amount-field {
  position: relative;
  display: block;
}

.settlement-amount-field input {
  padding-right: 38px;
}

.settlement-amount-field i {
  position: absolute;
  top: 50%;
  right: 13px;
  color: #8fa0b8;
  font-style: normal;
  font-weight: 950;
  transform: translateY(-50%);
}

.settlement-hint {
  font-size: 0.82rem;
  line-height: 1.4;
}

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

.settlement-history {
  margin-top: 16px;
}

.settlement-history h3 {
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 0.95rem;
}

.settlement-empty,
.settlement-history-list article {
  padding: 11px 12px;
  color: #aebbd0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(118, 145, 188, 0.18);
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 820;
}

.settlement-history-list {
  display: grid;
  gap: 8px;
}

.settlement-history-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
}

.settlement-history-list strong {
  color: #ffffff;
}

.settlement-history-list small {
  color: #8fa0b8;
}

.scan-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  margin-top: 18px;
}

.scan-photo-panel,
.scan-text-panel,
.scan-results {
  min-width: 0;
}

.scan-dropzone {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 18px;
  color: #dce8f8;
  background:
    radial-gradient(circle at 50% 0%, rgba(16, 213, 194, 0.14), transparent 34%),
    rgba(255, 255, 255, 0.045);
  border: 1px dashed rgba(143, 179, 255, 0.44);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
}

.scan-dropzone .icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 10px;
  color: #10d5c2;
  background: rgba(16, 213, 194, 0.12);
  border-radius: 999px;
}

.scan-dropzone svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scan-dropzone strong {
  font-weight: 950;
}

.scan-dropzone small {
  color: #94a3b8;
  font-size: 0.8rem;
}

.scan-preview {
  width: 100%;
  max-height: 220px;
  margin-top: 10px;
  object-fit: cover;
  border: 1px solid rgba(118, 145, 188, 0.22);
  border-radius: 10px;
}

.scan-text-panel {
  display: grid;
  gap: 9px;
}

.scan-text-panel label {
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 900;
}

.scan-text-panel textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 12px;
  color: #ffffff;
  background: rgba(17, 30, 50, 0.86);
  border: 1px solid rgba(118, 145, 188, 0.3);
  border-radius: 10px;
  outline: 0;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
}

.scan-text-panel textarea::placeholder {
  color: #73839d;
}

.scan-results {
  margin-top: 14px;
}

.scan-empty,
.scan-summary {
  padding: 12px 14px;
  color: #aebbd0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(118, 145, 188, 0.18);
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 820;
}

.scan-summary {
  color: #dffcf8;
  background: rgba(16, 213, 194, 0.1);
  border-color: rgba(16, 213, 194, 0.22);
}

.scan-draft-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}

.scan-draft-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(118, 145, 188, 0.18);
  border-radius: 10px;
}

.scan-draft-card.is-ignored {
  opacity: 0.58;
}

.scan-draft-check {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dffcf8;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.scan-draft-check input {
  width: 18px;
  height: 18px;
  accent-color: #10d5c2;
}

.scan-draft-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(100px, 0.65fr);
  gap: 8px;
}

.scan-draft-fields label {
  display: grid;
  gap: 5px;
  color: #8fa0b8;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scan-draft-fields input,
.scan-draft-fields select {
  min-height: 34px;
  padding: 0 9px;
  color: #ffffff;
  background: rgba(17, 30, 50, 0.86);
  border: 1px solid rgba(118, 145, 188, 0.28);
  border-radius: 7px;
  outline: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 820;
}

.scan-amount-field {
  position: relative;
  display: block;
}

.scan-amount-field input {
  padding-right: 28px;
}

.scan-amount-field i {
  position: absolute;
  top: 50%;
  right: 10px;
  color: #8fa0b8;
  font-style: normal;
  font-weight: 900;
  transform: translateY(-50%);
}

.scan-draft-total {
  color: #ffffff;
  font-weight: 950;
  white-space: nowrap;
}

.secondary-button.premium-locked {
  position: relative;
  border-color: rgba(245, 182, 66, 0.32);
}

.secondary-button.premium-locked::after {
  content: "PRO";
  position: absolute;
  top: 5px;
  right: 6px;
  padding: 2px 5px;
  color: #08111d;
  background: #f5b642;
  border-radius: 999px;
  font-size: 0.56rem;
  font-weight: 950;
}

.danger-button.premium-locked,
.secondary-button.premium-locked {
  box-shadow: 0 12px 24px rgba(245, 182, 66, 0.08);
}

@media (max-width: 760px) {
  .premium-dialog {
    padding: 20px;
  }

  .premium-feature-grid,
  .premium-report-grid,
  .scan-layout {
    grid-template-columns: 1fr;
  }

  .premium-actions {
    display: grid;
  }

  .settlement-actions,
  .scan-draft-card,
  .scan-draft-fields {
    grid-template-columns: 1fr;
  }

  .scan-draft-total {
    justify-self: start;
  }
}

@media (min-width: 1120px) {
  body {
    overflow-x: hidden;
    color: #f8fafc;
    background:
      radial-gradient(circle at 18% -8%, rgba(37, 99, 255, 0.24), transparent 28%),
      radial-gradient(circle at 82% 2%, rgba(16, 213, 194, 0.16), transparent 26%),
      linear-gradient(145deg, #07111f 0%, #08111d 45%, #040913 100%);
  }

  .app-shell {
    display: none;
  }

  .desktop-shell {
    --desk-bg: #07111f;
    --desk-panel: rgba(10, 20, 34, 0.88);
    --desk-panel-strong: rgba(12, 24, 42, 0.96);
    --desk-panel-soft: rgba(16, 31, 52, 0.72);
    --desk-line: rgba(118, 145, 188, 0.2);
    --desk-line-strong: rgba(118, 145, 188, 0.32);
    --desk-text: #f8fafc;
    --desk-muted: #a9b4c7;
    --desk-subtle: #71809a;
    --desk-blue: #2563ff;
    --desk-aqua: #10d5c2;
    --desk-amber: #f5b642;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr) 304px;
    gap: 18px;
    padding: 20px;
    color: var(--desk-text);
  }

  .desktop-shell svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .desktop-sidebar,
  .desktop-right-rail,
  .desktop-main {
    min-width: 0;
  }

  .desktop-sidebar {
    position: sticky;
    top: 20px;
    height: calc(100dvh - 40px);
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: 18px;
    padding: 18px 16px;
    background:
      linear-gradient(180deg, rgba(13, 25, 45, 0.92), rgba(7, 16, 29, 0.94)),
      var(--desk-panel);
    border: 1px solid var(--desk-line);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.22);
  }

  .desktop-sidebar-brand {
    height: 58px;
    display: flex;
    align-items: center;
  }

  .desktop-sidebar-brand img {
    width: 150px;
    height: auto;
    display: block;
  }

  .desktop-nav {
    display: grid;
    align-content: start;
    gap: 10px;
    padding-top: 20px;
  }

  .desktop-nav-item {
    min-height: 48px;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 8px;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    color: var(--desk-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 780;
    text-align: left;
    white-space: nowrap;
  }

  .desktop-nav-item:hover,
  .desktop-nav-item.active {
    color: #5f8cff;
    background: rgba(37, 99, 255, 0.14);
    border-color: rgba(37, 99, 255, 0.28);
  }

  .desktop-nav-item i {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
  }

  .desktop-nav-item.premium-locked {
    position: relative;
    border-color: rgba(245, 182, 66, 0.26);
  }

  .desktop-nav-item.premium-locked::after {
    content: "PRO";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    padding: 2px 5px;
    color: #08111d;
    background: #f5b642;
    border-radius: 999px;
    font-size: 0.54rem;
    font-weight: 950;
  }

  .desktop-couple-card {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(12, 26, 46, 0.82);
    border: 1px solid var(--desk-line);
    border-radius: 8px;
  }

  .desktop-couple-avatars {
    display: flex;
  }

  .desktop-couple-avatars span {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #06101f;
    background: #ffffff;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 950;
    box-shadow: 0 0 0 3px rgba(37, 99, 255, 0.12);
  }

  .desktop-couple-avatars span + span {
    margin-left: -10px;
    background: #b9fff6;
  }

  .desktop-couple-card strong,
  .desktop-premium-card strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 900;
  }

  .desktop-couple-card small {
    color: var(--desk-muted);
    font-size: 0.74rem;
  }

  .desktop-premium-card {
    min-height: 156px;
    display: grid;
    align-content: end;
    gap: 8px;
    padding: 16px;
    background:
      radial-gradient(circle at 24% 16%, rgba(37, 99, 255, 0.7), transparent 18%),
      radial-gradient(circle at 84% 24%, rgba(16, 213, 194, 0.42), transparent 32%),
      linear-gradient(135deg, rgba(45, 31, 130, 0.92), rgba(8, 76, 104, 0.86));
    border: 1px solid rgba(37, 99, 255, 0.22);
    border-radius: 8px;
  }

  .desktop-premium-card span {
    width: max-content;
    color: #93c5fd;
    font-size: 0.72rem;
    font-weight: 950;
    text-transform: uppercase;
  }

  .desktop-premium-card p {
    color: #d9e4f6;
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .desktop-premium-card.active {
    background:
      radial-gradient(circle at 24% 16%, rgba(16, 213, 194, 0.52), transparent 18%),
      radial-gradient(circle at 84% 24%, rgba(37, 99, 255, 0.42), transparent 32%),
      linear-gradient(135deg, rgba(7, 89, 82, 0.9), rgba(24, 45, 122, 0.86));
  }

  .desktop-premium-card button,
  .desktop-primary-button {
    min-height: 38px;
    color: #ffffff;
    background: linear-gradient(135deg, #2563ff, #0ea5e9);
    border: 0;
    border-radius: 7px;
    font-weight: 900;
    box-shadow: 0 14px 30px rgba(37, 99, 255, 0.26);
  }

  .desktop-main {
    display: grid;
    align-content: start;
    gap: 14px;
  }

  .desktop-header {
    min-height: 52px;
    display: grid;
    grid-template-columns: 250px minmax(280px, 1fr) 54px 132px;
    align-items: center;
    gap: 14px;
  }

  .desktop-month-control,
  .desktop-search,
  .desktop-theme-button,
  .desktop-user-button,
  .desktop-panel,
  .desktop-kpi-card {
    background: linear-gradient(180deg, rgba(13, 26, 45, 0.92), rgba(8, 18, 32, 0.94));
    border: 1px solid var(--desk-line);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  }

  .desktop-month-control {
    height: 52px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px 42px;
    align-items: center;
  }

  .desktop-icon-button {
    width: 44px;
    height: 50px;
    color: #d7e0f1;
    background: transparent;
  }

  .desktop-month-control select {
    min-height: 50px;
    padding: 0 10px;
    color: #ffffff;
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 1.02rem;
    font-weight: 900;
    text-align: center;
    text-align-last: center;
  }

  .desktop-calendar-icon {
    width: 18px;
    height: 18px;
    color: #c8d3e6;
    justify-self: center;
  }

  .desktop-search {
    height: 52px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
  }

  .desktop-search input {
    min-height: 48px;
    color: #f8fafc;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .desktop-search input::placeholder {
    color: #95a3ba;
  }

  .desktop-search kbd {
    padding: 4px 7px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--desk-line);
    border-radius: 5px;
    font-size: 0.76rem;
  }

  .desktop-theme-button {
    width: 54px;
    height: 52px;
    display: grid;
    place-items: center;
    color: var(--desk-aqua);
  }

  .desktop-theme-button .icon {
    width: 22px;
    height: 22px;
  }

  #desktopThemeToggleText {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .desktop-user-button {
    height: 52px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    color: #ffffff;
  }

  .desktop-user-button > span {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #07111f;
    background: #ffffff;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 950;
  }

  .desktop-user-button i {
    width: 14px;
    height: 14px;
    color: var(--desk-muted);
  }

  .desktop-kpi-grid {
    display: grid;
    grid-template-columns: 1.45fr 1.25fr 1.1fr 1.1fr;
    gap: 14px;
  }

  .desktop-kpi-card {
    position: relative;
    min-height: 178px;
    overflow: hidden;
    padding: 22px;
  }

  .desktop-kpi-card p,
  .desktop-panel-title,
  .desktop-panel-header span {
    color: #4080ff;
    font-size: 0.76rem;
    font-weight: 950;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }

  .desktop-kpi-card strong {
    display: block;
    margin-top: 28px;
    overflow-wrap: anywhere;
    color: #ffffff;
    font-size: clamp(1.9rem, 2.5vw, 2.7rem);
    font-weight: 950;
    line-height: 1;
  }

  .desktop-kpi-card small {
    display: block;
    margin-top: 10px;
    color: var(--desk-muted);
    font-size: 0.92rem;
    font-weight: 720;
  }

  .desktop-kpi-card.balance {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 116px;
    align-items: center;
    background:
      radial-gradient(circle at 82% 58%, rgba(16, 213, 194, 0.26), transparent 34%),
      linear-gradient(180deg, rgba(13, 26, 45, 0.92), rgba(8, 18, 32, 0.94));
  }

  .desktop-kpi-card.balance h2 {
    max-width: 210px;
    margin-top: 14px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.28;
  }

  .desktop-kpi-card.balance strong {
    margin-top: 10px;
    overflow-wrap: normal;
    white-space: nowrap;
    font-size: clamp(2.05rem, 2.2vw, 2.45rem);
  }

  .desktop-kpi-card.balance img {
    width: 104px;
    height: auto;
    filter: drop-shadow(0 22px 34px rgba(16, 213, 194, 0.24));
  }

  .desktop-card-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #6ea0ff;
    background: rgba(37, 99, 255, 0.14);
    border-radius: 999px;
  }

  .desktop-card-icon svg {
    width: 20px;
    height: 20px;
  }

  .desktop-card-icon.aqua {
    color: var(--desk-aqua);
    background: rgba(16, 213, 194, 0.13);
  }

  .desktop-mini-meter {
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 22px;
    height: 6px;
    overflow: hidden;
    background: rgba(123, 148, 184, 0.24);
    border-radius: 999px;
  }

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

  .desktop-mini-meter.aqua i {
    background: var(--desk-aqua);
  }

  .desktop-analytics-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1fr);
    gap: 14px;
  }

  .desktop-panel {
    padding: 22px;
  }

  .desktop-panel h2,
  .desktop-panel-title h2 {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 920;
  }

  .desktop-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .desktop-expense-tools {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: auto;
    min-width: 0;
  }

  .desktop-expense-filter {
    width: min(320px, 42vw);
    background: rgba(255, 255, 255, 0.035);
    border-color: var(--desk-line);
  }

  .desktop-expense-filter button {
    min-height: 30px;
    color: var(--desk-muted);
    font-size: 0.72rem;
  }

  .desktop-expense-filter button.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2563ff, #1689ff);
    box-shadow: 0 10px 22px rgba(37, 99, 255, 0.22);
  }

  .desktop-panel-header span {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: #dbe7fb;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--desk-line);
    border-radius: 7px;
    letter-spacing: 0;
    text-transform: none;
  }

  .desktop-balance-content {
    min-height: 296px;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding-top: 18px;
  }

  .desktop-donut {
    width: 160px;
    height: 160px;
    display: grid;
    place-items: center;
    justify-self: center;
    border-radius: 999px;
    box-shadow: 0 0 48px rgba(37, 99, 255, 0.2);
  }

  .desktop-donut > span {
    width: 120px;
    height: 120px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    padding: 18px;
    background: #09111f;
    border-radius: 999px;
    text-align: center;
  }

  .desktop-donut strong {
    font-size: 1.42rem;
    font-weight: 950;
  }

  .desktop-donut small,
  .desktop-donut em {
    color: var(--desk-muted);
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 820;
  }

  .desktop-donut-legend {
    display: grid;
    gap: 18px;
  }

  .desktop-donut-legend p {
    display: grid;
    grid-template-columns: 10px minmax(82px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    color: #c7d2e6;
    font-size: 0.8rem;
  }

  .desktop-donut-legend strong {
    color: #ffffff;
    font-size: 1rem;
  }

  .desktop-donut-legend span {
    color: var(--desk-muted);
  }

  .desktop-balance-note {
    min-height: 58px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--desk-line);
    border-radius: 8px;
  }

  .desktop-balance-note .icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: var(--desk-blue);
    background: rgba(37, 99, 255, 0.14);
    border-radius: 999px;
  }

  .desktop-balance-note svg {
    width: 18px;
    height: 18px;
  }

  .desktop-bars {
    height: 222px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    gap: 18px;
    margin-top: 24px;
    padding: 0 12px 8px;
    border-bottom: 1px solid var(--desk-line);
    background:
      linear-gradient(to bottom, transparent 0 24%, rgba(118, 145, 188, 0.1) 24% calc(24% + 1px), transparent calc(24% + 1px)),
      linear-gradient(to bottom, transparent 0 49%, rgba(118, 145, 188, 0.1) 49% calc(49% + 1px), transparent calc(49% + 1px)),
      linear-gradient(to bottom, transparent 0 74%, rgba(118, 145, 188, 0.1) 74% calc(74% + 1px), transparent calc(74% + 1px));
  }

  .desktop-bar-item {
    min-width: 0;
    height: 196px;
    display: grid;
    grid-template-rows: 22px 1fr 22px;
    justify-items: center;
    align-items: end;
    gap: 6px;
  }

  .desktop-bar-value {
    color: var(--desk-muted);
    font-size: 0.68rem;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 160ms ease, transform 160ms ease;
  }

  .desktop-bar-item:hover .desktop-bar-value {
    opacity: 1;
    transform: none;
  }

  .desktop-bar-item i {
    width: 18px;
    display: block;
    background: linear-gradient(180deg, #2f7cff, #2563ff);
    border-radius: 7px 7px 2px 2px;
    box-shadow: 0 10px 22px rgba(37, 99, 255, 0.32);
  }

  .desktop-bar-item i.active {
    background: linear-gradient(180deg, #22f2df, #10d5c2);
    box-shadow: 0 10px 22px rgba(16, 213, 194, 0.3);
  }

  .desktop-bar-item small {
    color: var(--desk-muted);
    font-size: 0.74rem;
    font-weight: 760;
  }

  .desktop-chart-summary {
    min-height: 66px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--desk-line);
    border-radius: 8px;
  }

  .desktop-chart-summary p {
    display: grid;
    gap: 8px;
    color: var(--desk-muted);
    font-size: 0.78rem;
    border-right: 1px solid var(--desk-line);
  }

  .desktop-chart-summary p:last-child {
    border-right: 0;
  }

  .desktop-chart-summary strong {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 920;
  }

  .desktop-chart-summary em {
    font-style: normal;
  }

  .desktop-expenses-panel {
    min-height: 300px;
  }

  .desktop-table-wrap {
    overflow: auto;
    margin-top: 14px;
    border: 1px solid var(--desk-line);
    border-radius: 8px;
  }

  .desktop-expense-table {
    width: 100%;
    min-width: 940px;
    border-collapse: collapse;
  }

  .desktop-expense-table th,
  .desktop-expense-table td {
    padding: 13px 12px;
    border-bottom: 1px solid rgba(118, 145, 188, 0.14);
    text-align: left;
    vertical-align: middle;
  }

  .desktop-expense-table th:first-child,
  .desktop-expense-table td:first-child {
    width: 112px;
    white-space: nowrap;
  }

  .desktop-expense-table th {
    color: var(--desk-muted);
    background: rgba(37, 99, 255, 0.05);
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .desktop-expense-table td {
    color: #dbe5f5;
    font-size: 0.82rem;
    font-weight: 740;
  }

  .desktop-expense-table td strong {
    color: #ffffff;
    font-weight: 900;
  }

  .desktop-title-stack {
    position: relative;
    display: inline-block;
    max-width: 100%;
    padding-bottom: 26px;
  }

  .desktop-title-stack strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-category-chip,
  .desktop-status-pill,
  .desktop-person-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }

  .desktop-category-chip {
    min-height: 28px;
    padding: 0 12px;
    color: #6ea0ff;
    background: rgba(37, 99, 255, 0.14);
    border: 1px solid rgba(37, 99, 255, 0.22);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 860;
  }

  .desktop-person-pill {
    width: 24px;
    height: 24px;
    margin-right: 7px;
    color: #ffffff;
    background: var(--desk-blue);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 950;
  }

  .desktop-person-pill.wendee {
    color: #06201d;
    background: var(--desk-aqua);
  }

  .desktop-status-pill {
    min-height: 28px;
    padding: 0 12px;
    color: #ffd76e;
    background: rgba(245, 166, 35, 0.16);
    border: 1px solid rgba(245, 166, 35, 0.28);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 900;
  }

  .desktop-status-pill.settled {
    color: #92ffe9;
    background: rgba(16, 213, 194, 0.12);
    border-color: rgba(16, 213, 194, 0.24);
  }

  .desktop-recurring-badge.centered {
    position: absolute;
    top: 22px;
    left: 50%;
    width: max-content;
    margin: 0;
    color: #ff8da3;
    background: rgba(255, 92, 138, 0.12);
    border-color: rgba(255, 92, 138, 0.24);
    transform: translateX(-50%);
  }

  .desktop-row-actions {
    display: inline-flex;
    gap: 6px;
  }

  .desktop-row-actions button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: #c8d3e6;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--desk-line);
    border-radius: 7px;
  }

  .desktop-row-actions button:hover {
    color: #ffffff;
    border-color: rgba(37, 99, 255, 0.34);
  }

  .desktop-row-actions svg {
    width: 16px;
    height: 16px;
  }

  .desktop-empty-row {
    height: 110px;
    color: var(--desk-muted) !important;
    text-align: center !important;
  }

  .desktop-right-rail {
    position: sticky;
    top: 20px;
    height: calc(100dvh - 40px);
    display: grid;
    align-content: start;
    gap: 12px;
    overflow: auto;
    padding-right: 2px;
  }

  .desktop-right-rail::-webkit-scrollbar,
  .desktop-table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  .desktop-right-rail::-webkit-scrollbar-thumb,
  .desktop-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.36);
    border-radius: 999px;
  }

  .desktop-form-panel {
    padding: 16px;
  }

  .desktop-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: #d8e5f8;
    letter-spacing: 0;
    text-transform: none;
  }

  .desktop-panel-title .icon {
    width: 22px;
    height: 22px;
    color: #a8b7ce;
  }

  .desktop-form {
    display: grid;
    gap: 12px;
  }

  .desktop-form label,
  .desktop-form fieldset {
    display: grid;
    gap: 7px;
    color: var(--desk-muted);
    font-size: 0.74rem;
    font-weight: 850;
  }

  .desktop-form fieldset {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .desktop-form legend {
    padding: 0;
  }

  .desktop-form input,
  .desktop-form select {
    min-height: 34px;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(17, 30, 50, 0.86);
    border: 1px solid var(--desk-line-strong);
    border-radius: 6px;
    box-shadow: none;
    font-size: 0.82rem;
    font-weight: 760;
  }

  .desktop-form input::placeholder {
    color: #687895;
  }

  .desktop-recurring-toggle {
    grid-template-columns: 30px minmax(0, 1fr);
    color: #ffffff;
    background: rgba(37, 99, 255, 0.12);
    border-color: rgba(87, 140, 255, 0.22);
    border-radius: 8px;
  }

  .desktop-recurring-toggle input {
    width: 18px;
    height: 18px;
  }

  .desktop-recurring-toggle small {
    color: var(--desk-muted);
  }

  .desktop-amount-field {
    position: relative;
    display: block;
  }

  .desktop-amount-field input {
    padding-right: 34px;
  }

  .desktop-amount-field i {
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--desk-muted);
    font-style: normal;
    font-weight: 900;
    transform: translateY(-50%);
  }

  .desktop-segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
    background: rgba(5, 11, 21, 0.8);
    border: 1px solid var(--desk-line);
    border-radius: 7px;
  }

  .desktop-segmented label {
    display: block;
  }

  .desktop-segmented input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
  }

  .desktop-segmented span {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--desk-muted);
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 900;
  }

  .desktop-segmented input:checked + span {
    color: #ffffff;
    background: linear-gradient(135deg, #2563ff, #0b7cff);
    box-shadow: 0 10px 18px rgba(37, 99, 255, 0.24);
  }

  .desktop-split-hint {
    min-height: 30px;
    display: flex;
    align-items: center;
    padding: 7px 10px;
    color: #a7c2ff;
    background: rgba(37, 99, 255, 0.12);
    border: 1px solid rgba(37, 99, 255, 0.18);
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 780;
  }

  .desktop-primary-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .desktop-primary-button .icon {
    width: 18px;
    height: 18px;
  }

  .desktop-secondary-button {
    min-height: 38px;
    color: #dbe7fb;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--desk-line);
    border-radius: 7px;
    font-weight: 850;
  }

  .desktop-category-panel,
  .desktop-notification-panel,
  .desktop-recurring-panel,
  .desktop-quick-panel,
  .desktop-backup-panel {
    padding: 16px;
  }

  .desktop-category-panel h2,
  .desktop-notification-panel h2,
  .desktop-recurring-panel h2,
  .desktop-quick-panel h2,
  .desktop-backup-panel h2 {
    margin-bottom: 12px;
  }

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

  .desktop-recurring-helper {
    margin: -4px 0 0;
    color: color-mix(in srgb, var(--desk-muted) 70%, transparent);
    font-size: 0.7rem;
    font-weight: 680;
    line-height: 1.35;
  }

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

  .desktop-recurring-card {
    display: grid;
    gap: 10px;
    padding: 11px;
    background: rgba(14, 35, 62, 0.58);
    border: 1px solid var(--desk-line);
    border-radius: 8px;
  }

  .desktop-recurring-card.paused {
    opacity: 0.62;
  }

  .desktop-recurring-card strong {
    color: #ffffff;
  }

  .desktop-recurring-card span {
    color: var(--desk-muted);
  }

  .desktop-recurring-card small {
    color: #7ea4ff;
  }

  .desktop-recurring-card .recurring-actions button {
    min-height: 30px;
    color: #dbe7fb;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--desk-line);
  }

  .desktop-recurring-card .recurring-actions button.danger {
    color: #ff9dad;
    background: rgba(255, 92, 138, 0.1);
    border-color: rgba(255, 92, 138, 0.22);
  }

  .desktop-notification-panel {
    display: grid;
    gap: 10px;
  }

  .desktop-notification-panel p {
    color: var(--desk-muted);
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .desktop-notification-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(37, 99, 255, 0.95), rgba(16, 213, 194, 0.9));
    border: 1px solid rgba(87, 140, 255, 0.4);
    border-radius: 8px;
    box-shadow: 0 16px 28px rgba(37, 99, 255, 0.2);
    font-weight: 900;
  }

  .desktop-notification-button.active-reminder {
    background: rgba(16, 213, 194, 0.14);
    border-color: rgba(16, 213, 194, 0.35);
    box-shadow: none;
  }

  .desktop-notification-button .icon {
    width: 18px;
    height: 18px;
  }

  .desktop-category-layout {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .desktop-category-chart {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 18px rgba(5, 12, 24, 0.82);
  }

  .desktop-category-legend {
    display: grid;
    gap: 7px;
  }

  .desktop-category-legend p {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    color: var(--desk-muted);
    font-size: 0.72rem;
  }

  .desktop-category-legend i {
    width: 9px;
    height: 9px;
    border-radius: 3px;
  }

  .desktop-category-legend strong,
  .desktop-category-legend em {
    color: #ffffff;
    font-style: normal;
    font-weight: 800;
  }

  .desktop-custom-category-panel {
    display: grid;
    gap: 9px;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid var(--desk-line);
  }

  .desktop-custom-category-panel label {
    color: var(--desk-muted);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .desktop-custom-category-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .desktop-custom-category-row input {
    min-height: 34px;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(17, 30, 50, 0.86);
    border: 1px solid var(--desk-line-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 780;
    outline: 0;
  }

  .desktop-custom-category-row button {
    min-height: 34px;
    padding: 0 12px;
    color: #ffffff;
    background: rgba(37, 99, 255, 0.18);
    border: 1px solid rgba(87, 140, 255, 0.32);
    border-radius: 6px;
    font-weight: 900;
  }

  .desktop-custom-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 24px;
  }

  .desktop-custom-category-chip {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px 0 10px;
    color: #a7c2ff;
    background: rgba(37, 99, 255, 0.12);
    border: 1px solid rgba(87, 140, 255, 0.24);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 900;
  }

  .desktop-custom-category-chip i {
    color: inherit;
    font-style: normal;
    opacity: 0.74;
  }

  .desktop-custom-category-empty {
    color: color-mix(in srgb, var(--desk-muted) 72%, transparent);
    font-size: 0.72rem;
    font-weight: 720;
  }

  .desktop-empty-copy {
    color: var(--desk-muted);
    font-size: 0.8rem;
  }

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

  .desktop-quick-grid button {
    min-height: 66px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 7px;
    padding: 8px 4px;
    color: #dbe7fb;
    background: rgba(14, 35, 62, 0.76);
    border: 1px solid var(--desk-line);
    border-radius: 7px;
    font-size: 0.64rem;
    font-weight: 780;
    line-height: 1.15;
    text-align: center;
  }

  .desktop-quick-grid .icon {
    width: 18px;
    height: 18px;
    color: var(--desk-aqua);
  }

  .desktop-quick-panel.premium-locked {
    position: relative;
    border-color: rgba(245, 182, 66, 0.25);
  }

  .desktop-quick-panel.premium-locked::after {
    content: "PRO";
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 7px;
    color: #08111d;
    background: #f5b642;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 950;
  }

  .desktop-backup-panel p {
    color: var(--desk-muted);
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .desktop-cloud-panel {
    display: grid;
    gap: 9px;
    margin-top: 12px;
    padding-top: 13px;
    border-top: 1px solid var(--desk-line);
  }

  .desktop-cloud-panel .cloud-heading strong {
    color: #ffffff;
  }

  .desktop-cloud-panel .cloud-heading span {
    color: #70a2ff;
  }

  .desktop-cloud-panel .cloud-heading i {
    color: #dffcf8;
    background: rgba(16, 213, 194, 0.1);
    border-color: rgba(16, 213, 194, 0.22);
  }

  .desktop-cloud-panel label {
    display: grid;
    gap: 6px;
    color: var(--desk-muted);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .desktop-cloud-panel input {
    min-height: 34px;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(17, 30, 50, 0.86);
    border: 1px solid var(--desk-line-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 760;
    outline: 0;
  }

  .desktop-cloud-panel .cloud-auto-row {
    min-height: 36px;
    background: rgba(17, 30, 50, 0.58);
    border-color: var(--desk-line-strong);
    border-radius: 8px;
  }

  .desktop-cloud-panel .cloud-auto-row span {
    color: #ffffff;
    font-size: 0.72rem;
  }

  .desktop-cloud-panel .cloud-auto-row select {
    min-height: 28px;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.94);
    border-color: var(--desk-line-strong);
    font-size: 0.72rem;
  }

  .desktop-cloud-panel .cloud-auto-status {
    color: var(--desk-muted);
    font-size: 0.7rem;
  }

  .desktop-cloud-panel .cloud-remember {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .desktop-cloud-panel .cloud-remember input {
    min-height: 16px;
    height: 16px;
  }

  .desktop-cloud-panel .cloud-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-cloud-panel .cloud-actions button {
    min-height: 34px;
    padding: 0 8px;
    color: #ffffff;
    background: rgba(37, 99, 255, 0.15);
    border: 1px solid rgba(87, 140, 255, 0.26);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 900;
  }

  .desktop-offline-sync-panel {
    display: grid;
    gap: 9px;
    margin-top: 12px;
    padding-top: 13px;
    border-top: 1px solid var(--desk-line);
  }

  .desktop-offline-sync-panel .offline-sync-heading strong {
    color: #ffffff;
  }

  .desktop-offline-sync-panel .offline-sync-heading span {
    color: #70a2ff;
  }

  .desktop-offline-sync-panel .offline-sync-heading i {
    color: #dbe7ff;
    background: rgba(37, 99, 255, 0.14);
    border-color: rgba(87, 140, 255, 0.24);
  }

  .desktop-offline-sync-panel p {
    color: var(--desk-muted);
    font-size: 0.76rem;
    line-height: 1.4;
  }

  .desktop-offline-sync-panel .offline-sync-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-offline-sync-panel .offline-sync-actions button {
    min-height: 34px;
    padding: 0 8px;
    color: #ffffff;
    background: rgba(37, 99, 255, 0.15);
    border: 1px solid rgba(87, 140, 255, 0.26);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 900;
  }

  .desktop-backup-panel.premium-locked {
    position: relative;
    border-color: rgba(245, 182, 66, 0.25);
  }

  .desktop-backup-panel.premium-locked::after {
    content: "PRO";
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 7px;
    color: #08111d;
    background: #f5b642;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 950;
  }

  .desktop-backup-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  .desktop-backup-actions button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--desk-line);
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 900;
  }

  .desktop-backup-actions .icon {
    width: 16px;
    height: 16px;
  }
}

@media (min-width: 1120px) and (max-width: 1340px) {
  .desktop-shell {
    grid-template-columns: 216px minmax(0, 1fr) 286px;
    gap: 14px;
    padding: 16px;
  }

  .desktop-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-analytics-grid {
    grid-template-columns: 1fr;
  }

  .desktop-header {
    grid-template-columns: 230px minmax(240px, 1fr) 52px 122px;
  }
}
