/* ---------- Surfaces ---------- */

.card {
  padding: var(--s-4);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.card-title {
  font-size: var(--fs-base);
  font-weight: 700;
}

.card-link {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
}

/* The small rounded icon square that leads every stat card. */
.tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-tile);
  background: var(--surface);
  box-shadow: var(--shadow-tile);
  color: var(--ink);
}

/* ---------- Stat: icon tile + label, a number, and a delta underneath ---------- */

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.stat-value {
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-value--hero {
  font-size: var(--fs-2xl);
}

.stat-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* The arrow shows direction; data-tone shows whether that direction is good. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chip .icon {
  width: 12px;
  height: 12px;
}

.chip[data-tone="pos"] {
  background: var(--pos-wash);
  color: var(--pos-ink);
}

.chip[data-tone="neg"] {
  background: var(--neg-wash);
  color: var(--neg-ink);
}

.chip[data-tone="flat"] {
  background: var(--surface-2);
  color: var(--ink-2);
}

/* ---------- Progress track: the unfilled part is hatched ---------- */

.track {
  height: 12px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--track) 0 2px, transparent 2px 6px);
}

.track-fill {
  width: var(--value, 0%);
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.track-fill[data-tone="pos"] {
  background: var(--pos);
}

.track-fill[data-tone="neg"] {
  background: var(--neg);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 44px;
  padding: 0 var(--s-5);
  border: 0;
  border-radius: var(--r-pill);
  font-size: var(--fs-base);
  font-weight: 700;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: var(--on-ink);
}

.btn-soft {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-tile);
  background: var(--surface);
  box-shadow: var(--shadow-tile);
  color: var(--ink);
}

/* ---------- Connection status ---------- */

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-tile);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.conn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.conn[data-state="online"]::before {
  background: var(--pos);
}

.conn[data-state="offline"]::before {
  background: var(--neg);
}

.conn[data-state="unconfigured"]::before {
  background: var(--warn);
}

.conn[data-state="mock"]::before {
  background: var(--accent);
}

/* ---------- Notices (empty states, warnings, errors) ---------- */

.notice {
  padding: var(--s-5);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.notice-title {
  margin-bottom: var(--s-1);
  font-size: var(--fs-base);
}

.notice[data-tone="warn"] {
  background: var(--warn-wash);
  color: var(--warn-ink);
}

.notice[data-tone="error"] {
  background: var(--neg-wash);
  color: var(--neg-ink);
}

/* ---------- Home screen pieces ---------- */

.eyebrow {
  color: var(--ink-3);
  font-size: var(--fs-sm);
  font-weight: 600;
}

/* A swipeable row of cards on phones, with the next card peeking in as a hint. */
.strip {
  display: flex;
  gap: var(--s-3);
  margin-inline: calc(var(--s-4) * -1);
  padding: 0 var(--s-4) var(--s-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--s-4);
  scrollbar-width: none;
}

.strip::-webkit-scrollbar {
  display: none;
}

.strip > * {
  flex: 0 0 min(15rem, 68%);
  scroll-snap-align: start;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
}

.action .tile {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

.action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rows {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.row-title,
.row-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title {
  font-weight: 700;
}

.row-meta {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount[data-tone="pos"] {
  color: var(--pos-ink);
}

.amount[data-tone="neg"] {
  color: var(--neg-ink);
}

.skeleton {
  border-radius: var(--r-card);
  background: var(--surface);
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton--hero {
  height: 7.5rem;
}

.skeleton--strip {
  height: 8rem;
}

.skeleton--card {
  height: 14rem;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

@media (min-width: 900px) {
  /* Enough room for all three cards at once, so the swipe row becomes a grid. */
  .strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }

  .strip > * {
    flex: initial;
  }
}

/* ---------- Signed-out state: Welcome, Sign In & Sign Up ---------- */

body[data-auth="loading"] .shell {
  visibility: hidden; /* until the app knows who is signed in, show nothing rather than the wrong screen */
}

body[data-auth="out"] .sidebar,
body[data-auth="out"] .topbar {
  display: none;
}

body[data-auth="out"] .shell {
  display: block;
}

body[data-auth="out"] .workspace {
  padding-bottom: 0;
}

body[data-auth="out"] .content {
  max-width: none;
  padding: 0;
  min-height: 100dvh;
}

/* Each screen lives in its own container (see js/router.js). */
.view-root {
  width: 100%;
}

/* The welcome screen is full-bleed: a mint wash that fades into the page background. */
.welcome-screen {
  --mint: #d6f0e8;
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  padding: 0;
  overflow-x: clip; /* tilted cards must never cause a sideways scrollbar */
  background: linear-gradient(180deg, var(--mint) 0%, var(--bg, #edf4ef) 62%);
}

:root[data-theme="dark"] .welcome-screen {
  --mint: #12332c;
}

.welcome-card {
  width: 100%;
  max-width: 26rem;
  min-height: 100dvh;
  padding:
    calc(var(--s-5) + env(safe-area-inset-top, 0px)) var(--s-5)
    calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  color: var(--ink, #102018);
}

.welcome-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--ink, #102018);
}

.welcome-brand img {
  display: block;
  border-radius: 6px;
}

.welcome-tag {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: #e3f2e8;
  color: #166534;
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* Cascading card fan: navy at the back left, orange at the right, green in front. */
.cascade-stage {
  position: relative;
  height: clamp(17rem, 40dvh, 20rem);
  margin: var(--s-2) 0 var(--s-3);
}

.cascade-card {
  position: absolute;
  width: 72%;
  height: 10.5rem;
  padding: 18px 20px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgb(255 255 255 / 0.28);
  box-shadow: 0 14px 28px rgb(16 32 24 / 0.14);
  opacity: 0;
  transition:
    transform 560ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 380ms ease;
}

.cascade-card-top,
.cascade-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.cascade-card-top > span:first-child {
  font-size: var(--fs-sm);
  font-weight: 800;
}

.cascade-badge {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.22);
  font-size: 0.6875rem;
  font-weight: 700;
}

.cascade-card--1 {
  top: 0;
  left: 0;
  z-index: 1;
  background: linear-gradient(145deg, #223254, #152038);
  color: #ffffff;
  transform: translate3d(-18px, 24px, 0) rotate(-16deg) scale(0.95);
  transition-delay: 40ms;
}

.cascade-card--2 {
  top: 3.5rem;
  right: 0;
  z-index: 2;
  background: linear-gradient(145deg, #f3a43b, #e0821d);
  color: #ffffff;
  transform: translate3d(0, 28px, 0) rotate(8deg) scale(0.95);
  transition-delay: 120ms;
}

.cascade-card--3 {
  top: 7rem;
  left: 6%;
  z-index: 3;
  background: linear-gradient(145deg, #1cc88a, #0e9f6e);
  color: #ffffff;
  transform: translate3d(18px, 32px, 0) rotate(-4deg) scale(0.95);
  transition-delay: 200ms;
}

.cascade-stage.is-entered .cascade-card--1 {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(-14deg) scale(1);
}

.cascade-stage.is-entered .cascade-card--2 {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(8deg) scale(1);
}

.cascade-stage.is-entered .cascade-card--3 {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(-4deg) scale(1);
}

/* Headline and buttons. The copy grows, which pushes the buttons to the bottom edge. */
.welcome-copy {
  flex: 1;
}

.welcome-title {
  margin: 0;
  font-size: clamp(1.9rem, 8.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--ink, #102018);
}

.welcome-subtitle {
  margin: var(--s-2) 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.oauth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

.oauth-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgb(16 32 24 / 0.14);
  background: #ffffff;
  color: #102018;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
}

.oauth-pill:active {
  transform: scale(0.98);
}

.oauth-pill--dark {
  background: #102018;
  color: #ffffff;
  border-color: #102018;
}

/* On the dark theme the near-black pill disappears into the page, so it becomes an outline. */
:root[data-theme="dark"] .oauth-pill--dark {
  background: transparent;
  border-color: rgb(255 255 255 / 0.35);
  color: var(--ink);
}

.oauth-mark {
  font-weight: 800;
  line-height: 1;
}

/* The Apple logo is a private-use character that only renders on Apple devices; elsewhere it
   shows as an empty box. Hidden until it is replaced with an SVG. */
.oauth-pill--dark .oauth-mark {
  display: none;
}

/* "Use email" is the main action, so it gets the solid pill. */
.email-pill {
  width: 100%;
  height: 52px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
}

.email-pill:active {
  transform: scale(0.98);
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.auth-switch-btn {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 800;
  color: var(--accent);
}

/* ---- narrow phones ---- */
@media (max-width: 380px) {
  .cascade-card {
    width: 78%;
  }

  .oauth-pill {
    padding: 0 var(--s-2);
  }
}

/* ---- short phones: shrink the fan so the buttons stay on screen ---- */
@media (max-width: 819px) and (max-height: 720px) {
  .cascade-stage {
    height: 14rem;
  }

  .cascade-card {
    height: 8.5rem;
    padding: 14px 16px;
  }

  .cascade-card--2 {
    top: 2.75rem;
  }

  .cascade-card--3 {
    top: 5.5rem;
  }

  .welcome-title {
    font-size: 1.75rem;
  }

  .welcome-subtitle {
    font-size: 0.875rem;
  }

  .oauth-pill,
  .email-pill {
    height: 46px;
  }
}

/* ---- tablets: one centred column with bigger cards ---- */
@media (min-width: 600px) and (max-width: 819px) {
  .welcome-card {
    max-width: 36rem;
    justify-content: center; /* the stack sits in the middle instead of hugging the top */
  }

  .welcome-copy {
    flex: 0 0 auto; /* the buttons follow the text, not the bottom edge */
  }

  .cascade-stage {
    height: 22rem;
  }

  .cascade-card {
    height: 12rem;
  }

  .cascade-card--2 {
    top: 4.5rem;
  }

  .cascade-card--3 {
    top: 9rem;
  }

  .cascade-card-top > span:first-child {
    font-size: var(--fs-base);
  }
}

/* ---- desktop: text and buttons on the left, a large card fan on the right ---- */
@media (min-width: 820px) {
  .welcome-card {
    display: grid;
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    grid-template-areas:
      "top   stage"
      "copy  stage"
      "oauth stage"
      "email stage";
    align-content: center;
    align-items: start;
    column-gap: clamp(var(--s-6), 6vw, 6rem);
    row-gap: var(--s-4);
    max-width: 72rem;
    padding: var(--s-8);
  }

  .welcome-top {
    grid-area: top;
  }

  .welcome-copy {
    grid-area: copy;
    margin-top: var(--s-6);
  }

  .oauth-row {
    grid-area: oauth;
    margin-top: var(--s-4);
  }

  .email-pill {
    grid-area: email;
  }

  .cascade-stage {
    grid-area: stage;
    align-self: center;
    height: 28rem;
    margin: 0;
  }

  .cascade-card {
    width: 66%;
    height: 12.5rem;
    padding: 22px 24px;
    border-radius: 26px;
  }

  .cascade-card--1 {
    top: 0;
    left: 0;
  }

  .cascade-card--2 {
    top: 6rem;
    right: 0;
  }

  .cascade-card--3 {
    top: 12.5rem;
    left: 10%;
  }

  .cascade-card-top > span:first-child {
    font-size: var(--fs-base);
  }

  .cascade-badge {
    font-size: var(--fs-xs);
  }

  .welcome-title {
    font-size: clamp(2.4rem, 3.6vw, 3.4rem);
  }

  .welcome-subtitle {
    font-size: 1.05rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cascade-card,
  .oauth-pill,
  .email-pill {
    transition: none !important;
  }

  .cascade-stage .cascade-card--1 {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(-14deg);
  }

  .cascade-stage .cascade-card--2 {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(8deg);
  }

  .cascade-stage .cascade-card--3 {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(-4deg);
  }
}

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: var(--s-4);
  width: 1.125rem;
  height: 1.125rem;
  color: var(--ink-3);
  pointer-events: none;
}

.input {
  width: 100%;
  height: 50px;
  padding: 0 var(--s-4);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 1rem; /* 16px or more: below that, iPhone Safari zooms the page when a field is focused */
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.input-wrap .input {
  padding-left: 2.75rem;
}

.input-wrap--password .input {
  padding-right: 3rem;
}

.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--surface);
}

.input-eye {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-3);
}

.input-eye:hover {
  color: var(--ink);
}

.field-hint {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.form-error {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-tile);
  background: var(--neg-wash);
  color: var(--neg-ink);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- Month picker (in the top bar) ---------- */

.month-nav {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.month-label {
  min-width: 9rem;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 700;
}

/* ---------- Ledger ---------- */

.filters {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.chip-btn {
  height: 36px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.chip-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-ink);
}

.day-title {
  margin: var(--s-4) 0 var(--s-1);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.day:first-child .day-title {
  margin-top: 0;
}

#ledger-more {
  margin-top: var(--s-4);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--s-8) + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  max-width: min(28rem, calc(100% - 2rem));
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow-nav);
  font-size: var(--fs-sm);
  font-weight: 700;
  transform: translateX(-50%);
}

@media (min-width: 900px) {
  .toast {
    bottom: var(--s-8);
  }
}

/* ---------- Interactive rows, bottom/modal sheet & onboarding ---------- */

.row--interactive {
  cursor: pointer;
  border-radius: var(--r-tile);
  padding-inline: var(--s-2);
  margin-inline: calc(var(--s-2) * -1);
  transition: background-color 0.15s ease;
}

.row--interactive:hover {
  background: var(--surface-2);
}

.sheet {
  width: min(30rem, 100%);
  max-width: none;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-nav);
}

.sheet::backdrop {
  background: rgb(10 12 24 / 0.55);
  backdrop-filter: blur(4px);
}

@media (min-width: 900px) {
  .sheet {
    margin: auto;
    border-radius: 28px;
  }
}

.sheet-body {
  padding: var(--s-6);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
}

.sheet-title {
  font-size: var(--fs-lg);
  font-weight: 800;
}

/* The email sign-in sheet (see views/login.js) reuses .sheet. */
#email-drawer {
  max-height: 92dvh;
  overflow-y: auto; /* a tall form stays reachable when the phone keyboard is open */
}

.auth-sheet-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
}

.sheet-close {
  min-height: 44px;
  padding: 0 var(--s-2);
  border: 0;
  background: none;
  color: var(--ink-3);
  font-weight: 700;
}

body[data-view="onboarding"] .sidebar,
body[data-view="onboarding"] .topbar {
  display: none;
}

body[data-view="onboarding"] .shell {
  display: block;
}

body[data-view="onboarding"] .workspace {
  padding-bottom: 0;
}

.onboard-shell {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: var(--s-4);
}

.onboard-card {
  width: min(36rem, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-6);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.onboard-step {
  display: inline-block;
  margin-bottom: var(--s-2);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.onboard-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.onboard-sub {
  margin-top: var(--s-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.onboard-options {
  display: grid;
  gap: var(--s-4);
}

.onboard-option,
.onboard-wallets {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
}

.onboard-option-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}

.onboard-option-title {
  font-size: var(--fs-base);
  font-weight: 800;
}

.onboard-option-desc,
.onboard-wallets-head span {
  display: block;
  color: var(--ink-2);
  font-size: var(--fs-xs);
}

.token-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.token-code {
  flex: 1;
  padding: var(--s-3);
  border-radius: var(--r-tile);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  overflow-x: auto;
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 5.5rem;
  padding: var(--s-4);
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.receipt-preview {
  max-height: 16rem;
  width: 100%;
  object-fit: contain;
  border-radius: 16px;
  background: var(--surface-2);
}

/* ---------- Insights & Scores bars ---------- */

.insight-bars {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  list-style: none;
  padding: 0;
  margin: 0;
}

.insight-bar-item {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.insight-bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}

.insight-track {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.insight-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.score-denom {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink-2);
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--hero-ink);
  font-size: var(--fs-sm);
  font-weight: 800;
}

.profile-avatar--lg {
  width: 52px;
  height: 52px;
  font-size: var(--fs-lg);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.profile-greeting {
  font-size: 0.6875rem;
  color: var(--ink-3);
  font-weight: 600;
}

.profile-name {
  font-size: var(--fs-sm);
  font-weight: 800;
}

.account-hero {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.account-meta {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.btn-danger {
  background: var(--neg-wash);
  color: var(--neg-ink);
}

.hero-card {
  border-radius: var(--r-card);
  background: var(--hero-bg);
  color: var(--hero-ink);
  box-shadow: var(--shadow-hero);
  overflow: hidden;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
}

.hero-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--hero-sub);
}

.hero-value {
  margin-top: var(--s-1);
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.hero-pill {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.18);
  color: var(--hero-ink);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
  padding: 0 var(--s-4) var(--s-4);
}

.hero-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) 0;
  border: 0;
  background: none;
  color: var(--hero-ink);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
}

.hero-tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-pill);
  background: var(--hero-tile);
  color: var(--hero-tile-ink);
  box-shadow: var(--shadow-tile);
  transition: transform 0.12s ease;
}

.hero-action:active .hero-tile {
  transform: scale(0.95);
}

.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  background: var(--hero-foot);
  color: var(--hero-ink);
  font-size: var(--fs-sm);
}

@media (min-width: 640px) {
  .grid-cards > section:first-child .rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-2);
  }
}