:root {
  color-scheme: light;
  --ink: #0d0d0f;
  --muted: #6f7177;
  --surface: #fff;
  --background: #f2f3f5;
  --line: #e6e7e9;
  --soft: #f0f1f3;
  --primary: #111214;
  --lime: #c7f64e;
  --blue: #5b6cff;
  --blue-soft: #eef0ff;
  --green: #16845b;
  --green-soft: #e7f6ef;
  --red: #d0444d;
  --red-soft: #fcebed;
  --shadow: 0 16px 48px rgba(16, 20, 28, .07);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--background); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; margin: 0; min-width: 320px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.site-header { align-items: center; backdrop-filter: blur(18px); background: rgba(244, 245, 247, .88); border-bottom: 1px solid rgba(230, 231, 233, .9); display: flex; height: 72px; justify-content: space-between; padding: 0 max(1rem, calc((100vw - 1180px) / 2)); position: sticky; top: 0; z-index: 20; }
.brand { align-items: center; display: flex; font-weight: 800; gap: .65rem; letter-spacing: -.03em; text-decoration: none; }
.brand-mark { align-items: center; background: var(--ink); border-radius: 11px; color: #fff; display: inline-flex; font-size: 1rem; height: 34px; justify-content: center; width: 34px; }
.brand-name { font-size: 1.05rem; }
.desktop-nav { display: flex; gap: .35rem; }
.desktop-nav a { border-radius: 999px; color: #484a50; font-size: .9rem; font-weight: 650; padding: .6rem .9rem; text-decoration: none; }
.desktop-nav a:hover { background: var(--surface); color: var(--ink); }
.account-menu { align-items: center; display: flex; gap: .6rem; }
.account-name { font-size: .88rem; font-weight: 650; }
.avatar, .mini-avatar { align-items: center; background: var(--blue-soft); border-radius: 50%; color: var(--blue); display: inline-flex; font-size: .8rem; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.icon-button { align-items: center; background: transparent; border: 0; border-radius: 50%; color: var(--muted); cursor: pointer; display: flex; height: 38px; justify-content: center; width: 38px; }
.icon-button:hover { background: var(--surface); color: var(--ink); }
.icon-button svg { height: 20px; width: 20px; }
.header-login { background: var(--ink); border-radius: 999px; color: #fff; font-size: .9rem; font-weight: 750; padding: .65rem 1.1rem; text-decoration: none; }

.container { margin: 0 auto; max-width: 1180px; padding: 2.5rem 1.25rem 5rem; }
.page-intro { align-items: flex-end; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1.5rem; }
.page-intro h1 { font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.055em; margin: .1rem 0 0; }
.eyebrow { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .09em; margin: 0; text-transform: uppercase; }
.status-chip { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); display: flex; font-size: .8rem; font-weight: 650; gap: .45rem; padding: .5rem .75rem; }
.status-chip i { background: #27b978; border-radius: 50%; height: 7px; width: 7px; }

.card { background: var(--surface); border: 1px solid rgba(230, 231, 233, .8); border-radius: 24px; box-shadow: var(--shadow); padding: 1.65rem; }
.card-title { align-items: flex-start; display: flex; gap: 1rem; justify-content: space-between; }
.card-title h2 { font-size: 1.25rem; letter-spacing: -.025em; margin: .22rem 0 0; }
.card-title > strong { color: var(--muted); font-size: 1.6rem; }
.card-title > a { color: var(--blue); font-size: .84rem; font-weight: 750; text-decoration: none; }

.account-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr); }
.balance-panel { background: radial-gradient(circle at 90% 10%, rgba(199, 246, 78, .35), transparent 28%), linear-gradient(135deg, #17191c, #08090a); border-radius: 28px; color: #fff; min-height: 315px; overflow: hidden; padding: 2rem; position: relative; }
.balance-panel::after { border: 1px solid rgba(255,255,255,.09); border-radius: 50%; content: ""; height: 290px; position: absolute; right: -120px; top: 20px; width: 290px; }
.balance-panel > p { color: #aeb0b5; font-size: .88rem; margin: 0; }
.balance-panel h2 { font-size: clamp(3.1rem, 7vw, 5.4rem); letter-spacing: -.07em; line-height: 1; margin: 1rem 0 0; position: relative; z-index: 1; }
.balance-panel h2 small { color: #aeb0b5; display: block; font-size: .8rem; font-weight: 600; letter-spacing: 0; margin-top: .8rem; }
.quick-actions { bottom: 1.9rem; display: flex; gap: 1.6rem; left: 2rem; position: absolute; z-index: 2; }
.quick-actions a { align-items: center; color: #fff; display: flex; flex-direction: column; font-size: .74rem; gap: .45rem; text-decoration: none; }
.quick-actions span { align-items: center; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.1); border-radius: 50%; display: flex; font-size: 1.35rem; height: 48px; justify-content: center; width: 48px; }
.quick-actions a:first-child span { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.quick-actions b { font-weight: 650; }
.insight-card { min-height: 315px; }
.chart-layout { align-items: center; display: grid; gap: 1.3rem; grid-template-columns: 132px 1fr; margin-top: 2rem; }
.donut { align-items: center; aspect-ratio: 1; background: conic-gradient(var(--green) 0 var(--positive), var(--red) var(--positive) 100%); border-radius: 50%; display: flex; justify-content: center; position: relative; width: 132px; }
.donut::before { background: var(--surface); border-radius: 50%; content: ""; inset: 19px; position: absolute; }
.donut.empty { background: var(--line); }
.donut > span { font-size: 1.5rem; font-weight: 850; letter-spacing: -.05em; position: relative; }
.donut small { color: var(--muted); font-size: .7rem; }
.chart-legend { display: grid; gap: .9rem; }
.chart-legend > span { align-items: center; color: var(--muted); display: grid; font-size: .82rem; gap: .5rem; grid-template-columns: 9px 1fr auto; }
.chart-legend strong { color: var(--ink); }
.legend-dot { border-radius: 50%; height: 8px; width: 8px; }
.positive-dot { background: var(--green); }
.negative-dot { background: var(--red); }
.category-chart-layout { align-items: center; display: grid; gap: 1.2rem; grid-template-columns: 122px 1fr; margin-top: 1.35rem; }
.category-donut { aspect-ratio: 1; position: relative; width: 122px; }
.category-donut svg { height: 100%; transform: rotate(-90deg); width: 100%; }
.donut-track, .donut-segment { fill: none; stroke-width: 5; }
.donut-track { stroke: var(--line); }
.donut-segment { stroke-linecap: butt; }
.category-donut > span { display: grid; font-size: 1.4rem; font-weight: 850; inset: 0; letter-spacing: -.04em; place-content: center; position: absolute; text-align: center; }
.category-donut > span small { color: var(--muted); font-size: .6rem; font-weight: 650; letter-spacing: 0; text-transform: uppercase; }
.category-legend { display: grid; gap: .48rem; }
.category-legend > span { align-items: center; display: grid; font-size: .72rem; gap: .35rem; grid-template-columns: 8px 15px minmax(0, 1fr) auto; }
.category-legend i { border-radius: 50%; height: 7px; width: 7px; }
.category-legend b { color: var(--ink); }
.category-legend em { color: var(--muted); font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-legend strong { color: var(--ink); }

.activity-card { margin-top: 1rem; }
.transaction-list, .history-list { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.transaction-list li { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; min-height: 70px; padding: .85rem 0; }
.transaction-list li div, .history-main { display: grid; gap: .15rem; min-width: 0; }
.transaction-list li div::before { align-items: center; background: var(--soft); border-radius: 12px; content: "↗"; display: flex; grid-row: 1 / 3; height: 42px; justify-content: center; margin-right: .75rem; width: 42px; }
.transaction-list li div { grid-template-columns: auto 1fr; }
.transaction-list li div strong, .transaction-list li div span { grid-column: 2; }
.transaction-list li div span, .history-main span { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.amount { font-size: .95rem; font-weight: 800; white-space: nowrap; }
.amount.positive { color: var(--green); }
.amount.negative { color: var(--red); }

.metrics { display: grid; gap: .8rem; grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; display: grid; min-height: 145px; padding: 1.25rem; }
.metric-card span { color: var(--muted); font-size: .8rem; font-weight: 650; }
.metric-card strong { align-self: end; font-size: 2.2rem; letter-spacing: -.05em; }
.metric-card small { color: var(--muted); }
.positive-metric { background: var(--green-soft); border-color: transparent; }
.negative-metric { background: var(--red-soft); border-color: transparent; }
.admin-grid { display: grid; gap: 1rem; grid-template-columns: minmax(310px, .65fr) minmax(0, 1.35fr); }
.couple-list { margin-top: 1rem; }
.couple-row { align-items: center; border-top: 1px solid var(--line); display: grid; gap: .8rem; grid-template-columns: 40px 1fr auto; padding: .9rem 0; }
.couple-row div { display: grid; }
.couple-row small { color: var(--muted); }
.couple-row > b { font-size: 1rem; }
.manage-link { color: var(--blue); font-size: .82rem; font-weight: 750; text-decoration: none; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1rem; }
.form-section { border: 1px solid var(--line); border-radius: 18px; margin-top: 1rem; padding: 1.25rem; }
.form-section h2 { font-size: 1.1rem; margin: 0; }
.form-section .field:first-of-type { margin-top: .8rem; }

.button { align-items: center; background: var(--ink); border: 0; border-radius: 14px; color: #fff; cursor: pointer; display: inline-flex; font-weight: 750; gap: .75rem; justify-content: center; margin-top: 1.2rem; min-height: 50px; padding: .8rem 1.3rem; text-decoration: none; }
.button:hover { background: #2b2c30; }
.compact-button { margin: 0; min-height: 44px; }
.secondary-link { color: var(--muted); display: inline-block; font-weight: 700; margin: 1rem; }
.link-button { background: none; border: 0; color: var(--ink); cursor: pointer; font-weight: 700; }

.field { margin-top: 1.15rem; }
.field label, fieldset legend { display: block; font-size: .82rem; font-weight: 750; margin-bottom: .45rem; }
.field input, .field select, .field textarea { background: var(--soft); border: 1px solid transparent; border-radius: 14px; color: var(--ink); font: inherit; padding: .85rem 1rem; transition: .15s ease; width: 100%; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { background: #fff; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17,18,20,.08); outline: none; }
.field-help, .muted { color: var(--muted); }
.field-help { display: block; font-size: .75rem; margin-top: .35rem; }
.field ul { list-style: none; margin: .5rem 0; padding: 0; }
.field input[type="radio"] { accent-color: var(--ink); margin-right: .5rem; width: auto; }
.auth-card { margin: 5vh auto; max-width: 430px; padding: 2rem; }
.auth-card h1, .card > h1 { font-size: 2rem; letter-spacing: -.045em; margin: .35rem 0 1.2rem; }
.error, .errorlist { color: var(--red); font-weight: 650; }
.messages { margin-bottom: 1rem; }
.message { background: var(--green-soft); border-radius: 14px; color: #0b6644; padding: .85rem 1rem; }

.summary { display: grid; gap: .75rem 1rem; grid-template-columns: minmax(90px, auto) 1fr; }
.summary dt { color: var(--muted); font-weight: 650; }
.summary dd { margin: 0; overflow-wrap: anywhere; }
.history-list li { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; padding: 1rem 0; }
.history-main time { color: var(--muted); font-size: .72rem; }
.history-values { display: grid; text-align: right; }
.history-values small { color: var(--muted); white-space: nowrap; }
.balance { font-size: clamp(2.5rem, 8vw, 4rem); letter-spacing: -.06em; }
.balance small { color: var(--muted); font-size: .8rem; letter-spacing: 0; }
.balance.compact { font-size: 2.3rem; }
.section-card { margin-top: 1rem; }
.section-heading { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
.section-heading h2 { margin: 0; }
.section-heading a { color: var(--blue); font-weight: 700; }
.pagination { align-items: center; display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
.pagination a { color: var(--blue); font-weight: 700; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; margin-top: 1rem; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .85rem; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
td a { color: var(--blue); font-weight: 700; }
.empty-state { color: var(--muted); padding: 1rem 0; }

.public-body { background: #f2f3f5; }
.landing { align-items: center; display: grid; gap: clamp(2rem, 7vw, 7rem); grid-template-columns: minmax(0, 1fr) minmax(300px, 430px); min-height: calc(100vh - 150px); }
.landing-copy .pill { background: var(--lime); border-radius: 999px; display: inline-block; font-size: .74rem; font-weight: 850; letter-spacing: .05em; padding: .5rem .8rem; text-transform: uppercase; }
.landing-copy h1 { font-size: clamp(3rem, 7vw, 6rem); letter-spacing: -.075em; line-height: .95; margin: 1.5rem 0; max-width: 850px; }
.landing-copy p { color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); max-width: 600px; }
.phone-preview { background: #111214; border: 9px solid #09090a; border-radius: 42px; box-shadow: 0 36px 90px rgba(0,0,0,.2); color: #fff; justify-self: center; min-height: 600px; padding: 1.5rem; transform: rotate(2deg); width: min(100%, 340px); }
.phone-top { align-items: center; display: flex; justify-content: space-between; }
.mini-avatar { background: var(--lime); color: var(--ink); }
.preview-label { color: #989ba1; font-size: .78rem; margin: 3rem 0 .2rem; }
.preview-balance { display: block; font-size: 3.6rem; letter-spacing: -.07em; }
.preview-unit { color: #989ba1; font-size: .78rem; }
.preview-actions { display: flex; gap: .8rem; margin: 2.2rem 0; }
.preview-actions i { align-items: center; background: #292b2f; border-radius: 50%; display: flex; font-style: normal; height: 48px; justify-content: center; width: 48px; }
.preview-actions i:first-child { background: var(--lime); color: var(--ink); }
.preview-card { align-items: center; border-top: 1px solid #2c2e32; display: grid; gap: .75rem; grid-template-columns: 42px 1fr auto; padding: 1rem 0; }
.preview-card > span { align-items: center; background: #292b2f; border-radius: 12px; display: flex; height: 42px; justify-content: center; width: 42px; }
.preview-card div { display: grid; }
.preview-card small { color: #989ba1; }
.preview-card > strong { color: var(--lime); }

.mobile-nav { display: none; }

@media (max-width: 820px) {
  .site-header { height: 64px; padding-inline: 1rem; }
  .desktop-nav, .account-name { display: none; }
  .container { padding: 1.5rem 1rem 7rem; }
  .account-grid, .admin-grid, .form-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .landing { grid-template-columns: 1fr; padding-top: 2rem; text-align: center; }
  .landing-copy p { margin-inline: auto; }
  .phone-preview { margin-top: 1rem; }
  .mobile-nav { align-items: center; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 22px; bottom: max(.75rem, env(safe-area-inset-bottom)); box-shadow: 0 14px 40px rgba(16,20,28,.15); display: flex; justify-content: space-around; left: .75rem; padding: .55rem; position: fixed; right: .75rem; z-index: 30; }
  .mobile-nav a { align-items: center; border-radius: 15px; color: var(--muted); display: flex; flex: 1; flex-direction: column; font-size: .63rem; font-weight: 700; gap: .18rem; padding: .3rem; text-decoration: none; }
  .mobile-nav svg { height: 21px; width: 21px; }
  .mobile-nav .mobile-primary { color: var(--ink); }
  .mobile-nav .mobile-primary svg { background: var(--lime); border-radius: 50%; height: 34px; margin-top: -16px; padding: 7px; width: 34px; }
}

@media (max-width: 520px) {
  .brand-name { display: none; }
  .page-intro { align-items: flex-start; }
  .page-intro h1 { font-size: 2.15rem; }
  .status-chip { display: none; }
  .card, .balance-panel { border-radius: 22px; padding: 1.25rem; }
  .balance-panel { min-height: 290px; }
  .quick-actions { bottom: 1.35rem; left: 1.25rem; }
  .insight-card { min-height: auto; }
  .chart-layout { grid-template-columns: 112px 1fr; }
  .donut { width: 112px; }
  .donut::before { inset: 16px; }
  .category-chart-layout { grid-template-columns: 104px 1fr; }
  .category-donut { width: 104px; }
  .metric-card { min-height: 125px; }
  .compact-button { font-size: .8rem; padding-inline: .9rem; }
  .landing-copy h1 { font-size: 3.25rem; }
  .phone-preview { min-height: 560px; }
  .transaction-list li div::before { display: none; }
  .transaction-list li div { display: grid; grid-template-columns: 1fr; }
  .transaction-list li div strong, .transaction-list li div span { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
