/* Group "spend": Spend root, Budgets (two-week cycle), Your habits. Every rule is scoped to
   .g-spend; tokens come from parts.css (apps/mobile/theme/tokens.ts). */
.g-spend {
  position: absolute;
  inset: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
}
.g-spend svg {
  display: block;
}

/* ---------- shared: DetailScreen nav (components/ui/detail-screen.tsx) ---------- */
.g-spend .g-nav {
  position: absolute;
  z-index: 4;
  top: 50px;
  left: 0;
  right: 0;
  height: 48px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.g-spend .g-nav .slot {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
}
.g-spend .g-nav .ttl {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .g-nav .act {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 600;
  font-size: 13px;
}

/* ---------- shared: the budget meter (features/spend/components/budget-meter.tsx) ---------- */
.g-spend .g-meter {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.g-spend .g-meter .tr {
  background: var(--track);
  overflow: hidden;
}
.g-spend .g-meter .fl {
  display: block;
  height: 100%;
  transform-origin: 0 50%;
}
.g-spend .g-meter .tk {
  position: absolute;
  top: 0;
  width: 4px;
  margin-left: -2px;
  border-radius: 999px;
  border-left: 1px solid var(--canvas);
  border-right: 1px solid var(--canvas);
  background: var(--ink);
}

/* =================== 1. Spend root (spend-screen.tsx) =================== */
.g-spend .sp-body {
  position: absolute;
  inset: 50px 0 0;
  padding: 0 20px;
  overflow: hidden;
}
.g-spend .sp-bar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.g-spend .sp-av {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.g-spend .sp-av > span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--high);
  display: grid;
  place-items: center;
}
.g-spend .sp-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.g-spend .sp-add,
.g-spend .sp-eye {
  min-width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.g-spend .sp-month {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--raised);
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .sp-hero {
  padding-top: 20px;
}
.g-spend .sp-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.g-spend .sp-fig {
  margin-top: 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 46px;
  line-height: 48px;
  font-variant-numeric: tabular-nums;
}
.g-spend .sp-where {
  margin-top: 32px;
}
.g-spend .sp-sh {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.g-spend .sp-sh .l {
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .sp-sh .a {
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink2);
}
.g-spend .sp-donut {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  margin-bottom: 8px;
}
.g-spend .sp-donut .ring {
  position: relative;
  width: 150px;
  height: 150px;
}
.g-spend .sp-donut .c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.g-spend .sp-donut .c b {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  line-height: 26px;
  font-variant-numeric: tabular-nums;
}
.g-spend .sp-donut .c span {
  margin-top: 4px;
  font-weight: 600;
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 1.32px;
  text-transform: uppercase;
  color: var(--ink4);
}
.g-spend .sp-legend {
  margin-top: 16px;
  border-bottom: 1px solid var(--line);
}
.g-spend .sp-lr {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.g-spend .sp-lr i {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex: none;
}
.g-spend .sp-lr .n {
  flex: 1;
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .sp-lr .a {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
}

/* =================== 2. Budgets, one pay window (budget-screen.tsx PeriodBudget) =================== */
.g-spend .bu-body {
  position: absolute;
  top: 98px;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 20px;
  overflow: hidden;
}
.g-spend .bu-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 8px;
}
.g-spend .bu-strip .st {
  display: flex;
  align-items: center;
  gap: 4px;
}
.g-spend .bu-strip .step {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.g-spend .bu-strip .lb {
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .bu-strip .cyc {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--raise2);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink2);
}
.g-spend .bu-hero {
  position: relative;
  overflow: hidden;
  margin: 0 -20px;
  padding: 20px 20px 24px;
  border-bottom: 1px solid var(--line);
}
.g-spend .bu-aur {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.g-spend .bu-aur i {
  position: absolute;
  top: -140px;
  left: 50%;
  width: 480px;
  height: 400px;
  margin-left: -240px;
  background: radial-gradient(ellipse 240px 200px at 240px 160px, rgba(88, 176, 131, 0.192) 0%, rgba(201, 163, 92, 0.096) 44%, rgba(201, 163, 92, 0) 70%);
  opacity: 0.3;
  animation: g-spend-breath 3.5s cubic-bezier(0.32, 0.72, 0, 1) infinite alternate;
}
@keyframes g-spend-breath { from { opacity: 0.3; transform: scale(1); } to { opacity: 0.54; transform: scale(1.07); } }
.g-spend .bu-hc {
  position: relative;
  z-index: 1;
}
.g-spend .bu-read {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}
.g-spend .bu-fig {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 46px;
  line-height: 51px;
  letter-spacing: -0.9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.g-spend .bu-unit {
  flex-shrink: 1;
  font-size: 15px;
  line-height: 20px;
  color: var(--ink3);
}
.g-spend .bu-sub {
  margin-top: 12px;
  font-weight: 500;
  font-size: 15px;
  line-height: 22px;
  color: var(--ink2);
}
.g-spend .bu-sub b {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.g-spend .bu-mw {
  margin-top: 20px;
}
.g-spend .bu-today {
  display: flex;
  margin-bottom: 4px;
}
.g-spend .bu-today em {
  font-style: normal;
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  color: var(--ink2);
}
.g-spend .bu-edges {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  color: var(--ink4);
}
.g-spend .bu-gh {
  padding: 24px 0 16px;
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .bu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.g-spend .bu-tile {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--raise2);
  display: grid;
  place-items: center;
}
.g-spend .bu-main {
  flex: 1;
  min-width: 0;
}
.g-spend .bu-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.g-spend .bu-top .nm {
  flex-shrink: 1;
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-spend .bu-top .ans {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.g-spend .bu-top .ans b {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
.g-spend .bu-top .ans em {
  font-style: normal;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink3);
}
.g-spend .bu-row .g-meter {
  margin-top: 8px;
}
.g-spend .bu-foot {
  margin-top: 4px;
  font-weight: 500;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink3);
}
.g-spend .bu-foot b {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
}

/* =================== 3. Your habits (habits-screen.tsx) =================== */
.g-spend .ha-body {
  position: absolute;
  top: 98px;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 20px;
  overflow: hidden;
}
.g-spend .ha-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
}
.g-spend .ha-lede {
  font-weight: 600;
  font-size: 28px;
  line-height: 35px;
}
.g-spend .ha-sec2 {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink3);
}
.g-spend .ha-go {
  margin-bottom: 16px;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--line);
}
.g-spend .ha-gh {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
}
.g-spend .ha-gh .t {
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .ha-gh .w {
  font-weight: 500;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink3);
}
.g-spend .ha-read {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}
.g-spend .ha-read .f {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 30px;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}
.g-spend .ha-read .u {
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
  color: var(--ink3);
}
.g-spend .ha-sen {
  margin-top: 4px;
  font-weight: 500;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink2);
}
.g-spend .ha-go .g-meter {
  margin-top: 12px;
}
.g-spend .ha-basis {
  margin-top: 12px;
  font-weight: 500;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink3);
}
.g-spend .ha-sec {
  padding-top: 16px;
}
.g-spend .ha-st {
  padding-bottom: 8px;
  font-weight: 600;
  font-size: 18px;
  line-height: 20px;
}
.g-spend .ha-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.g-spend .ha-tile {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--raise2);
  display: grid;
  place-items: center;
}
.g-spend .ha-tx {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.g-spend .ha-tr {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.g-spend .ha-tr .nm {
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .ha-tr .k {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink3);
}
.g-spend .ha-c {
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
}
.g-spend .ha-r {
  font-weight: 500;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink2);
}
.g-spend .ha-l {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink3);
}

@media (prefers-reduced-motion: reduce) {
  .g-spend .bu-aur i {
    animation: none;
    opacity: 0.45;
  }
}
