:root {
  --bg0: #fff8fc;
  --bg1: #fff0f7;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --line: rgba(236, 168, 205, 0.55);
  --shadow: 0 18px 50px rgba(80, 20, 60, 0.08);
  --shadow-sm: 0 8px 24px rgba(80, 20, 60, 0.06);
  --text: #4b2a44;
  --muted: #8f5f82;
  --pink: #f08cbc;
  --pink-2: #e874ae;
  --pink-soft: #ffe8f3;
  --mint: #2e9f67;
  --coral: #c64768;
  --ink: #1b0f18;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .btn,
  .stat-card,
  .tx-row {
    transition: none !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(255, 182, 220, 0.45), transparent 55%),
    radial-gradient(700px 420px at 90% 0%, rgba(186, 230, 253, 0.35), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  line-height: 1.45;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(420px 320px at 18% 88%, rgba(255, 210, 232, 0.55), transparent 60%),
    radial-gradient(380px 300px at 82% 92%, rgba(214, 236, 255, 0.45), transparent 55%);
  filter: saturate(1.05);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
}

.skip-link:focus {
  left: 8px;
}

.app {
  position: relative;
  z-index: 1;
  width: min(1040px, 94vw);
  margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 1.6rem) 0 clamp(2rem, 5vw, 3rem);
  display: grid;
  gap: clamp(1rem, 2.4vw, 1.35rem);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
  gap: clamp(0.9rem, 2vw, 1.25rem);
  align-items: stretch;
}

.hero-copy {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.6vw, 1.45rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(143, 95, 130, 0.9);
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.55rem, 4vw, 2.05rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.lede {
  margin: 0 0 0.9rem;
  color: var(--muted);
  max-width: 52ch;
  font-size: 0.98rem;
}

.hero-user {
  margin: 0 0 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.hero-user-label {
  font-weight: 650;
  color: rgba(143, 95, 130, 0.95);
}

.hero-user-name {
  color: var(--ink);
  letter-spacing: -0.02em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-panel {
  background: linear-gradient(145deg, rgba(255, 232, 243, 0.95), rgba(255, 255, 255, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.6vw, 1.35rem);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.hero-panel-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-panel-month {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--ink);
}

.hero-panel-balance {
  margin: 0.35rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(236, 168, 205, 0.45);
  background: rgba(255, 255, 255, 0.65);
  display: grid;
  gap: 0.2rem;
}

.hero-panel-balance span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.hero-panel-balance strong {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.layout {
  display: grid;
  gap: clamp(0.9rem, 2vw, 1.1rem);
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas:
      "form stats"
      "list list";
    align-items: start;
  }
  .panel-form {
    grid-area: form;
  }
  .panel-stats {
    grid-area: stats;
  }
  .panel-list {
    grid-area: list;
  }
}

.panel {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.4vw, 1.2rem);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  margin-bottom: 0.75rem;
}

.panel-head--row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.85rem;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.panel-sub {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: rgba(75, 42, 68, 0.88);
}

.field-span-2 {
  grid-column: 1 / -1;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(236, 168, 205, 0.75);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: rgba(143, 95, 130, 0.55);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(240, 140, 188, 0.95);
  box-shadow: 0 0 0 4px rgba(255, 182, 220, 0.35);
}

.btn {
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  padding: 0.72rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  grid-column: 1 / -1;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-2));
  box-shadow: 0 14px 30px rgba(232, 116, 174, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.02);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(236, 168, 205, 0.65);
  color: #6b2f55;
}

.btn-ghost:hover {
  background: rgba(255, 232, 243, 0.85);
}

.btn-file {
  position: relative;
  overflow: hidden;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  border-radius: 10px;
}

.btn-tiny {
  padding: 0.38rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 9px;
  font-weight: 650;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat-card {
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem 1rem;
  border: 1px solid rgba(236, 168, 205, 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 248, 0.65));
  display: grid;
  gap: 0.55rem;
  min-height: 96px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(80, 20, 60, 0.07);
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.stat-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b2f55;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(236, 168, 205, 0.45);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(143, 95, 130, 0.92);
  line-height: 1.2;
}

.stat-value {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.15;
  padding-left: 0.1rem;
  word-break: break-word;
}

.stat-card--income strong {
  color: var(--mint);
}
.stat-card--income .stat-icon {
  color: #1f6b47;
  background: rgba(46, 159, 103, 0.12);
  border-color: rgba(46, 159, 103, 0.28);
}
.stat-card--expense strong {
  color: var(--coral);
}
.stat-card--expense .stat-icon {
  color: #8f2f48;
  background: rgba(198, 71, 104, 0.1);
  border-color: rgba(198, 71, 104, 0.28);
}
.stat-card--invest strong {
  color: #b84a7a;
}
.stat-card--invest .stat-icon {
  color: #7c2f55;
  background: rgba(184, 74, 122, 0.12);
  border-color: rgba(184, 74, 122, 0.28);
}
.stat-card--balance strong {
  color: #5b3db8;
}
.stat-card--balance .stat-icon {
  color: #4b2f9a;
  background: rgba(91, 61, 184, 0.1);
  border-color: rgba(91, 61, 184, 0.26);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.field-compact {
  min-width: min(100%, 11.5rem);
}

.field-compact input,
.field-compact select {
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
}

.tx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.tx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(236, 168, 205, 0.45);
  background: rgba(255, 255, 255, 0.78);
  align-items: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tx-row:hover {
  border-color: rgba(240, 140, 188, 0.65);
  box-shadow: 0 10px 26px rgba(80, 20, 60, 0.06);
}

.tx-main {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.tx-title {
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--ink);
  word-break: break-word;
}

.tx-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(236, 168, 205, 0.55);
  background: rgba(255, 232, 243, 0.75);
  color: #6b2f55;
}

.badge--income {
  border-color: rgba(46, 159, 103, 0.35);
  background: rgba(46, 159, 103, 0.1);
  color: #1f6b47;
}
.badge--expense {
  border-color: rgba(198, 71, 104, 0.35);
  background: rgba(198, 71, 104, 0.1);
  color: #8f2f48;
}
.badge--investment {
  border-color: rgba(184, 74, 122, 0.35);
  background: rgba(184, 74, 122, 0.12);
  color: #7c2f55;
}
.badge--other {
  border-color: rgba(91, 61, 184, 0.3);
  background: rgba(91, 61, 184, 0.08);
  color: #4b2f9a;
}

.tx-amount {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 0.98rem;
  text-align: right;
  white-space: nowrap;
}

.tx-amount--in,
.tx-amount--other {
  color: var(--mint);
}

.tx-amount--out {
  color: var(--coral);
}

.tx-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.btn-danger {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  border-radius: 10px;
  border: 1px solid rgba(198, 71, 104, 0.35);
  background: rgba(255, 240, 245, 0.85);
  color: #8f2f48;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-danger:hover {
  background: rgba(255, 228, 236, 0.95);
  border-color: rgba(198, 71, 104, 0.55);
}

.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(236, 168, 205, 0.75);
  background: rgba(255, 248, 252, 0.85);
  color: var(--muted);
}

.empty-title {
  margin: 0 0 0.35rem;
  font-weight: 750;
  color: var(--text);
}

.empty-sub {
  margin: 0;
  font-size: 0.9rem;
}

.foot {
  text-align: center;
  font-size: 0.82rem;
  color: rgba(143, 95, 130, 0.85);
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(236, 168, 205, 0.65);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
  box-shadow: 0 16px 40px rgba(80, 20, 60, 0.12);
  max-width: min(92vw, 420px);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 3vw, 1.5rem) 2.5rem;
}

.auth-shell {
  width: min(440px, 100%);
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 3vw, 1.55rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.auth-eyebrow {
  margin-bottom: 0.4rem;
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.auth-lede {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-code {
  font-size: 0.85em;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(255, 232, 243, 0.9);
  border: 1px solid rgba(236, 168, 205, 0.45);
  color: var(--ink);
}

.auth-api-hint {
  margin: -0.35rem 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.35em;
}

.auth-api-hint.is-ok {
  color: rgba(46, 159, 103, 0.95);
}

.auth-api-hint.is-bad {
  color: var(--coral);
  font-weight: 650;
}

.legacy-inline {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(236, 168, 205, 0.75);
  background: rgba(255, 255, 255, 0.55);
  display: grid;
  gap: 0.5rem;
}

.legacy-inline-text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.legacy-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(46, 159, 103, 0.35);
  background: linear-gradient(135deg, rgba(232, 245, 238, 0.9), rgba(255, 255, 255, 0.75));
}

.legacy-banner-title {
  margin: 0 0 0.25rem;
  font-weight: 750;
  font-size: 0.92rem;
  color: var(--ink);
}

.legacy-banner-text {
  margin: 0 0 0.55rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  padding: 0.2rem;
  border-radius: 14px;
  background: rgba(255, 232, 243, 0.55);
  border: 1px solid rgba(236, 168, 205, 0.4);
}

.auth-tab {
  border: 0;
  border-radius: 11px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-weight: 650;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.auth-tab.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(80, 20, 60, 0.06);
}

.auth-form {
  display: grid;
  gap: 0.65rem;
}

.auth-form .field {
  margin: 0;
}

.auth-form .btn-primary {
  grid-column: auto;
  margin-top: 0.15rem;
}

.auth-msg {
  margin: 0.15rem 0 0;
  min-height: 1.25em;
  font-size: 0.86rem;
  color: var(--coral);
  font-weight: 650;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field-span-2 {
    grid-column: 1 / -1;
  }
  .tx-row {
    grid-template-columns: 1fr;
  }
  .tx-amount {
    text-align: left;
  }
}
