:root {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #20213a;
  background: #f5f5fc;
  --navy: #171a30;
  --green: #493b97;
  --muted: #62657d;
  --line: #e6e5f1;
  --white: #fff;
  --soft: #eeebfc;
  --lime: #d9f787;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}
aside {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 29px 16px;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; font-weight: 800; text-decoration: none; white-space: nowrap; }
.logo { display: grid; place-items: center; flex: 0 0 auto; width: 43px; height: 43px; border-radius: 15px; background: var(--lime); color: var(--navy); font-size: 25px; }
nav { display: grid; gap: 6px; margin-top: 46px; }
nav a { display: flex; align-items: center; gap: 12px; padding: 9px; color: #c9cbe0; border-radius: 14px; text-decoration: none; font-size: .9rem; font-weight: 650; }
nav b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #ffffff10; font-size: 1.2rem; }
nav a:hover, nav a.active { background: #303354; color: white; }
nav a.active b { background: var(--lime); color: var(--navy); }
.local { margin-top: auto; padding: 9px; color: #b9bdd6; font-size: .82rem; }
main { width: min(100%, 1260px); min-width: 0; padding: 24px clamp(18px, 4vw, 56px) 38px; margin-inline: auto; }
header { display: flex; justify-content: flex-end; align-items: center; min-height: 48px; margin-bottom: 24px; }
.header-month { display: flex; align-items: center; gap: 9px; font-size: .88rem; color: var(--muted); }
.header-month input { background: white; min-height: 44px; }
.mobile-brand { display: none; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 3rem); line-height: 1.06; letter-spacing: -.055em; }
h2 { font-size: 1.13rem; letter-spacing: -.025em; }
.intro, .row, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.intro { margin-bottom: 23px; }
.intro p, .hint, .empty { color: var(--muted); margin-top: 7px; line-height: 1.5; }
.hint, .empty { font-size: .9rem; }
.metrics, .grid, .market { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.market { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.panel, .metric { border: 1px solid var(--line); background: var(--white); border-radius: 22px; padding: 19px; min-width: 0; }
.panel { margin-bottom: 16px; box-shadow: 0 6px 24px #22284a08; }
.panel-head { margin-bottom: 12px; }
.panel-head a { color: var(--green); font-size: .88rem; font-weight: 700; }
.panel > .metrics { margin-bottom: 0; }
.grid > .panel { margin: 0; }
.metric { background: #faf9ff; }
.metric strong { display: block; margin-top: 7px; font-size: clamp(1.05rem, 2.2vw, 1.6rem); overflow-wrap: anywhere; }
.metric span, .label { font-size: .86rem; color: var(--muted); }
.metric.hero { background: var(--navy); color: white; border-color: var(--navy); }
.metric.hero span { color: #d9dbee; }
.balance-card { position: relative; isolation: isolate; overflow: hidden; margin-bottom: 15px; padding: clamp(21px, 4vw, 35px); border-radius: 29px; color: white; background: linear-gradient(120deg, #191c37 10%, #39316f 73%, #51439a); }
.balance-card::after { content: ""; position: absolute; z-index: -1; pointer-events: none; width: 370px; aspect-ratio: 1; right: -82px; top: -149px; border: 1px solid #cfc7ff4d; border-radius: 50%; box-shadow: 0 0 0 28px #cfc7ff16, 0 0 0 57px #cfc7ff13, 0 0 0 87px #cfc7ff10; }
.balance-month { display: table; padding: 6px 12px; border-radius: 100px; background: #ffffff19; color: #f0edff; font-size: .88rem; font-weight: 700; text-transform: capitalize; }
.balance-label { display: block; margin-top: 18px; color: #d9d8ef; font-size: .96rem; }
.balance-value { display: block; margin: 3px 0 20px; color: var(--lime); font-size: clamp(2rem, 6vw, 4.35rem); letter-spacing: -.055em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.balance-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 610px; }
.balance-flow div { border: 1px solid #fff3; background: #171a304d; padding: 12px 14px; border-radius: 15px; }
.balance-flow span { display: block; color: #e2e0f4; font-size: .87rem; }
.balance-flow b { display: block; margin-top: 4px; font-size: clamp(.97rem, 2vw, 1.2rem); overflow-wrap: anywhere; }
.summary-debt { margin-bottom: 16px; }
.summary-debt .metric { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px; background: white; }
.summary-debt .metric strong { margin: 0; }
.row { background: #f8f7fd; border-radius: 15px; padding: 11px 12px; flex-wrap: wrap; overflow-wrap: anywhere; }
.row + .row { margin-top: 7px; }
.row small, .secondary { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.positive { color: #266342; }
.negative { color: #a33149; }
.badge { display: inline-block; background: var(--soft); color: #4d408b; border-radius: 40px; padding: 5px 9px; font-size: .8rem; font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
button, .link-button, input, select { font: inherit; }
button, .link-button {
  display: inline-block;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 13px;
  background: var(--soft);
  color: #403581;
  font-size: .88rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .link-button:hover { filter: brightness(.95); }
button:active { transform: translateY(1px); }
button.primary { background: #5947bb; color: white; box-shadow: 0 4px 10px #4f3faf27; }
button.danger { color: #a33149; background: #fcecf0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #7160d4; outline-offset: 2px; }
input, select {
  min-height: 48px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid #dedbef;
  border-radius: 13px;
  padding: 9px 11px;
  color: #20213a;
  background-color: #f8f7fd;
}
input::placeholder { color: #70728b; }
form { display: grid; gap: 14px; }
form label { display: grid; gap: 6px; min-width: 0; font-size: .89rem; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-actions { justify-content: flex-end; margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-actions .primary { min-height: 46px; padding-inline: 21px; }
dialog {
  width: min(560px, calc(100% - 24px));
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 25px;
  color: inherit;
  padding: 23px;
  box-shadow: 0 22px 86px #181a3a55;
  overscroll-behavior: contain;
}
dialog::backdrop { background: #13152f92; backdrop-filter: blur(4px); }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.sheet-heading h2 { font-size: 1.28rem; }
.icon-button { min-width: 42px; padding: 0; font-size: 1.35rem; }
[hidden], .form-grid[hidden] { display: none; }
.stack { display: grid; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 13px 0; }
.stats > div, .market > div { background: #f7f6fd; border-radius: 14px; padding: 11px; overflow-wrap: anywhere; }
.stats b { display: block; margin-top: 5px; }
.track { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.track div { height: 100%; background: #6956cd; }
.schedule { max-height: 320px; overflow: auto; }
summary { cursor: pointer; color: var(--green); font-weight: 700; padding: 8px 0; }
#notice { position: fixed; bottom: 20px; right: 16px; background: var(--navy); color: white; border-radius: 14px; padding: 10px 14px; z-index: 3; }
#notice:empty { display: none; }
.empty { padding: 7px 0; }
.rate-links { margin-top: 12px; }
.rate-links a { color: var(--green); }
.month-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 29%); gap: 10px; overflow-x: auto; padding: 4px 4px 11px; scroll-snap-type: x proximity; }
button.month-card { display: grid; gap: 5px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: #faf9ff; color: #23233d; text-align: left; scroll-snap-align: start; min-width: 0; }
button.month-card.is-selected { border-color: #a99be9; background: var(--soft); }
.month-name { font-size: 1rem; text-transform: capitalize; }
.month-caption { color: var(--muted); font-size: .78rem; font-weight: 600; }
.month-card strong { font-size: 1.25rem; letter-spacing: -.03em; overflow-wrap: anywhere; }
.month-flow { display: grid; gap: 3px; border-top: 1px solid #ded9f3; margin-top: 4px; padding-top: 6px; font-size: .81rem; }
.month-flow span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); }
.month-flow b { text-align: right; color: #2e2d48; overflow-wrap: anywhere; }
.month-breakdown { margin-bottom: 0; }
@media (max-width: 780px) {
  body { display: block; }
  aside { position: fixed; inset: auto 0 0; height: auto; padding: 6px 7px calc(6px + env(safe-area-inset-bottom)); z-index: 2; border-radius: 20px 20px 0 0; }
  aside .brand, .local { display: none; }
  nav { margin: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  nav a { min-height: 53px; flex-direction: column; justify-content: center; gap: 3px; padding: 3px 1px; font-size: .7rem; text-align: center; }
  nav b { width: 28px; height: 27px; font-size: 1.08rem; }
  main { padding: 12px 14px calc(92px + env(safe-area-inset-bottom)); }
  .mobile-brand { display: flex; font-size: .94rem; gap: 7px; }
  .mobile-brand .logo { width: 35px; height: 35px; border-radius: 11px; font-size: 19px; }
  header { justify-content: space-between; gap: 8px; margin-bottom: 18px; }
  .header-month label { display: none; }
  .header-month input { font-size: .85rem; padding: 6px 7px; }
  .grid, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .panel, .metric { padding: 13px; border-radius: 17px; }
  button, .link-button { min-height: 44px; }
  .intro { align-items: flex-start; gap: 8px; margin-bottom: 15px; }
  .intro p { font-size: .91rem; }
  .intro button { flex-shrink: 0; }
  #notice { bottom: calc(77px + env(safe-area-inset-bottom)); }
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 24px 24px 0 0; padding: 18px 16px calc(17px + env(safe-area-inset-bottom)); }
  dialog input, dialog select { font-size: 1rem; }
  .form-actions .primary { flex-grow: 1; }
  .month-rail { grid-auto-columns: minmax(190px, 76%); }
}
@media (max-width: 540px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro h1 { font-size: 1.81rem; }
}
@media (max-width: 355px) {
  .intro { flex-wrap: wrap; }
  nav a { font-size: .63rem; }
  .form-grid { grid-template-columns: 1fr; }
}

body.welcome { display: block; }
.welcome main { width: min(100%, 990px); padding-bottom: 30px; }
.welcome .brand { margin-bottom: 22px; }
.welcome-card { margin-bottom: 18px; }
.welcome-card h1 { max-width: 680px; }
.welcome-card p { max-width: 610px; color: #efedff; margin-top: 14px; line-height: 1.55; }
.welcome-card .link-button { background: var(--lime); color: var(--navy); margin-top: 18px; }
.welcome-card .welcome-signin { font-size: .9rem; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 15px 0; }

.header-tools { display: flex; align-items: center; gap: 8px; }
.account-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.welcome h1 + h2, .welcome p + h2 { margin-top: 18px; }
@media (max-width: 420px) {
  .header-tools { gap: 4px; }
  #account-button { padding-inline: 7px; font-size: .79rem; }
}

.signin-card { width: min(100%, 460px); margin-inline: auto; }
.signin-card h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin-bottom: 16px; }
.signin-card #google-signin { width: 100%; margin-bottom: 16px; }
.signin-card .actions button { flex: 1; }

.signin-modes { margin-bottom: 16px; padding: 4px; background: var(--soft); border-radius: 15px; }
.signin-modes button { background: transparent; }
.signin-modes button[aria-pressed="true"] { background: white; box-shadow: 0 1px 7px #493b971a; }
.signin-card input { font-size: 1rem; }
