:root {
  --ink: #24324a;
  --muted: #6e7a8f;
  --paper: #ffffff;
  --background: #f7f5ff;
  --purple: #7667e9;
  --purple-dark: #5b4bd5;
  --purple-soft: #ebe8ff;
  --teal: #20b9a6;
  --teal-soft: #dcf8f3;
  --yellow: #ffcb57;
  --yellow-soft: #fff4ce;
  --coral: #ff826f;
  --coral-soft: #ffe7e2;
  --border: #e9e6f2;
  --shadow: 0 18px 45px rgba(63, 49, 113, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 3%, rgba(255, 203, 87, 0.18), transparent 24rem),
    radial-gradient(circle at 93% 22%, rgba(118, 103, 233, 0.13), transparent 30rem),
    var(--background);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 17px;
}

body.app-loading .page-shell {
  opacity: 0.35;
  pointer-events: none;
}

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

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

button,
label[for="csv-file"] {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: var(--purple);
  box-shadow: 0 9px 20px rgba(118, 103, 233, 0.28);
  font: 700 29px/1 "Baloo 2", sans-serif;
  transform: rotate(-4deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font: 700 24px/1.1 "Baloo 2", sans-serif;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-picker {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 13px;
  background: var(--paper);
  box-shadow: 0 5px 15px rgba(63, 49, 113, 0.06);
}

.language-picker select {
  width: auto;
  min-width: 78px;
  padding: 2px 22px 2px 3px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 16px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: white;
  background: var(--purple);
  box-shadow: 0 8px 18px rgba(118, 103, 233, 0.25);
}

.button-primary:hover {
  background: var(--purple-dark);
}

.button-secondary {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 5px 15px rgba(63, 49, 113, 0.06);
}

.welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px 0 27px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--purple);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

h1,
h2 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  line-height: 1.1;
}

h1 {
  font-size: clamp(38px, 5vw, 58px);
  letter-spacing: -0.025em;
}

h2 {
  font-size: 28px;
}

.welcome > div > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
}

.welcome-side {
  display: flex;
  min-width: 320px;
  align-items: flex-end;
  flex-direction: column;
  gap: 10px;
}

.mascot-card {
  position: relative;
  display: flex;
  min-width: 310px;
  align-items: center;
  gap: 13px;
  overflow: hidden;
  padding: 14px 48px 14px 16px;
  border: 1px solid rgba(118, 103, 233, 0.16);
  border-radius: 22px;
  background: linear-gradient(135deg, #fff9dc, #f1edff);
  box-shadow: 0 13px 30px rgba(63, 49, 113, 0.1);
  transform: rotate(1.2deg);
}

.mascot {
  display: grid;
  width: 55px;
  height: 55px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  background: white;
  font-size: 34px;
  box-shadow: 0 8px 18px rgba(63, 49, 113, 0.1);
  transition: transform 180ms ease;
}

.mascot-card:hover .mascot {
  transform: translateY(-4px) rotate(-6deg);
}

.mascot-card strong,
.mascot-card small {
  display: block;
}

.mascot-card strong {
  font: 700 17px/1.15 "Baloo 2", sans-serif;
}

.mascot-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.mascot-coin {
  position: absolute;
  font-size: 19px;
}

.coin-one {
  top: 10px;
  right: 13px;
  transform: rotate(14deg);
}

.coin-two {
  right: 35px;
  bottom: 7px;
  font-size: 14px;
}

.date-pill,
.status-badge,
.transaction-count {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.date-pill {
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.quick-action {
  display: grid;
  min-height: 132px;
  gap: 2px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 20px rgba(63, 49, 113, 0.05);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.quick-action:nth-child(1) {
  background: linear-gradient(145deg, #ffffff, #e3fbf6);
}

.quick-action:nth-child(2) {
  background: linear-gradient(145deg, #ffffff, #fff4ce);
}

.quick-action:nth-child(3) {
  background: linear-gradient(145deg, #ffffff, #eeeaff);
}

.quick-action:nth-child(4) {
  background: linear-gradient(145deg, #ffffff, #e5f9ff);
}

.quick-action:nth-child(5) {
  background: linear-gradient(145deg, #ffffff, #ffe9e4);
}

.quick-action:hover {
  border-color: #cfc8ed;
  box-shadow: 0 11px 24px rgba(63, 49, 113, 0.09);
  transform: translateY(-2px);
}

.quick-action > span {
  font-size: 31px;
}

.quick-action strong {
  margin-top: 3px;
  font-size: 14px;
}

.quick-action small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.secondary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -5px 0 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.secondary-actions button {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.secondary-actions button:hover {
  border-color: #cfc8ed;
  background: white;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.summary-card {
  position: relative;
  display: flex;
  min-height: 184px;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.summary-card::after {
  position: absolute;
  top: -30px;
  right: -28px;
  width: 110px;
  height: 110px;
  border: 18px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  content: "";
}

.wallet-card {
  background: linear-gradient(145deg, #ffffff, var(--teal-soft));
}

.loan-card {
  background: linear-gradient(145deg, #ffffff, var(--yellow-soft));
}

.total-card {
  color: white;
  background: linear-gradient(145deg, #897bf0, #6553d8);
}

.card-icon {
  display: grid;
  width: 66px;
  height: 66px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 32px;
}

.summary-card p,
.summary-card small {
  display: block;
  margin: 0;
}

.summary-card p {
  font-size: 16px;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin: 3px 0;
  font: 700 clamp(27px, 3vw, 35px)/1 "Baloo 2", sans-serif;
}

.money-list {
  display: grid;
  gap: 1px;
  margin: 5px 0 6px;
}

.money-list strong {
  margin: 0;
  font: 700 clamp(21px, 2.4vw, 30px)/1.05 "Baloo 2", sans-serif;
  white-space: nowrap;
}

.money-list .empty-money {
  color: var(--muted);
  font-size: 17px;
}

.total-card .money-list .empty-money {
  color: rgba(255, 255, 255, 0.75);
}

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

.total-card small {
  color: rgba(255, 255, 255, 0.75);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

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

.panel {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

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

.month-income {
  text-align: right;
}

.month-income span,
.month-income strong {
  display: block;
}

.salary-breakdown {
  display: grid;
  gap: 11px;
  margin: 24px 0 19px;
}

.salary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.salary-row span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.salary-row strong {
  font: 700 20px/1 "Baloo 2", sans-serif;
}

.salary-total-row {
  padding-top: 2px;
  border-bottom: 0;
}

.salary-total-row span,
.salary-total-row strong {
  color: var(--ink);
}

.salary-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.base-dot {
  background: var(--purple);
}

.creative-dot {
  background: var(--teal);
}

.creative-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.creative-progress-copy strong {
  color: var(--teal);
}

.creative-progress {
  background: linear-gradient(90deg, var(--teal), #6addcf);
}

.value-question {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 13px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-size: 12px;
  font-weight: 800;
}

.month-income span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.month-income strong {
  color: var(--teal);
  font: 700 22px/1.3 "Baloo 2", sans-serif;
}

.bar-chart {
  display: flex;
  height: 205px;
  align-items: flex-end;
  gap: 14px;
  margin-top: 25px;
  padding-top: 18px;
  border-bottom: 2px solid var(--border);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 47px,
    #f0edf6 48px
  );
}

.bar-column {
  display: flex;
  height: 100%;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  flex-direction: column;
  gap: 7px;
}

.bar {
  position: relative;
  width: min(44px, 75%);
  min-height: 5px;
  border-radius: 12px 12px 4px 4px;
  background: linear-gradient(to top, var(--purple), #a79df5);
  transition: height 400ms ease;
}

.bar.current {
  background: linear-gradient(to top, var(--teal), #6addcf);
}

.bar:hover::before {
  position: absolute;
  top: -29px;
  left: 50%;
  z-index: 2;
  padding: 4px 7px;
  border-radius: 7px;
  color: white;
  background: var(--ink);
  content: attr(data-value);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  transform: translateX(-50%);
}

.bar-label {
  margin-bottom: -25px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.status-badge {
  color: #8c6900;
  background: var(--yellow-soft);
}

.chart-note {
  max-width: 180px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}

.loan-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0 18px;
  font-size: 33px;
}

.dotted-path {
  width: 80px;
  margin: 0 10px;
  border-top: 3px dotted #d1c8a4;
}

.loan-numbers {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.loan-numbers div:last-child {
  text-align: right;
}

.loan-numbers span,
.loan-numbers strong {
  display: block;
}

.debt-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0 18px;
}

.debt-overview > div {
  min-height: 116px;
  padding: 16px;
  border-radius: 16px;
  background: #faf8f1;
}

.debt-overview > div:last-child {
  background: #f2fbf9;
}

.debt-overview span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-money-list strong {
  font-size: 17px;
}

.loan-numbers span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.loan-numbers strong {
  font: 700 21px/1.3 "Baloo 2", sans-serif;
}

.progress-track {
  height: 11px;
  overflow: hidden;
  margin: 11px 0 16px;
  border-radius: 999px;
  background: #eeeaf5;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--coral));
  transition: width 400ms ease;
}

.loan-explainer {
  margin: 0;
  padding: 12px;
  border-radius: 13px;
  color: #796127;
  background: #fff9e9;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

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

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

.data-panel summary {
  cursor: pointer;
  font: 700 17px/1.2 "Baloo 2", sans-serif;
}

.data-panel p {
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.data-actions {
  display: flex;
  gap: 9px;
}

.transaction-count {
  color: var(--muted);
  background: #f2f0f7;
}

.transaction-list {
  margin-top: 11px;
}

.transaction {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.transaction-actions {
  display: flex;
  gap: 5px;
}

.transaction-action {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: #f3f1f7;
  cursor: pointer;
  font-size: 14px;
}

.transaction-action:hover {
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.transaction-action.delete:hover {
  color: #b54032;
  background: var(--coral-soft);
}

.transaction:last-child {
  border-bottom: 0;
}

.transaction-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  font-size: 19px;
}

.transaction-copy strong,
.transaction-copy small {
  display: block;
}

.transaction-copy strong {
  font-size: 14px;
}

.transaction-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.transaction-amount {
  text-align: right;
  font: 700 17px/1 "Baloo 2", sans-serif;
}

.positive {
  color: var(--teal);
}

.negative {
  color: var(--coral);
}

.neutral {
  color: var(--purple);
}

.empty-state {
  padding: 36px 0 20px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(36, 31, 66, 0.25);
}

dialog::backdrop {
  background: rgba(36, 50, 74, 0.45);
  backdrop-filter: blur(4px);
}

dialog form {
  display: grid;
  gap: 17px;
  padding: 27px;
}

.dialog-heading,
.dialog-actions,
.form-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: #f1eff6;
  cursor: pointer;
  font-size: 22px;
}

dialog label {
  display: grid;
  flex: 1;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

dialog label span {
  color: var(--muted);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ded9e9;
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 3px;
}

.danger-button {
  color: white;
  background: #d75344;
}

.confirm-dialog p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-dialog {
  width: min(410px, calc(100% - 28px));
  text-align: center;
}

.login-dialog form {
  gap: 12px;
  padding: 34px;
}

.login-dialog .login-mark {
  font-size: 52px;
}

.login-dialog h2 {
  font-size: 31px;
}

.login-dialog p:not(.eyebrow) {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-dialog label {
  text-align: left;
}

.login-dialog .form-error {
  min-height: 19px;
  margin: -2px 0 0;
  color: #b54032;
  font-weight: 800;
}

.login-dialog .button {
  width: 100%;
  margin-top: 2px;
}

.button[disabled] {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  padding: 12px 17px;
  border-radius: 13px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@media (max-width: 850px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

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

  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .secondary-actions {
    align-items: flex-start;
  }

  .summary-card {
    min-height: 130px;
  }

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

  .welcome-side {
    min-width: 280px;
  }

  .mascot-card {
    min-width: 270px;
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: min(100% - 22px, 1320px);
  }

  .topbar {
    display: block;
  }

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

  .topbar-actions .button-primary {
    grid-column: 1 / -1;
  }

  .language-picker {
    justify-content: center;
  }

  .welcome {
    display: block;
    padding-top: 19px;
  }

  .welcome-side {
    min-width: 0;
    align-items: stretch;
    margin-top: 18px;
  }

  .mascot-card {
    min-width: 0;
  }

  .quick-actions {
    display: flex;
    overflow-x: auto;
    padding-bottom: 7px;
    scroll-snap-type: x mandatory;
  }

  .quick-action {
    min-width: 160px;
    scroll-snap-align: start;
  }

  .date-pill {
    display: inline-block;
    margin-top: 14px;
  }

  .summary-card,
  .panel {
    padding: 20px;
    border-radius: 20px;
  }

  .bar-chart {
    gap: 7px;
  }

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

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

  .transaction-actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
