:root {
  color-scheme: light;
  --background: #f5f5f0;
  --surface: #ffffff;
  --surface-warm: #fafaf7;
  --ink: #171915;
  --ink-soft: #64675f;
  --line: #e3e4dc;
  --line-strong: #d4d6cc;
  --accent: #254c3d;
  --accent-hover: #1c3d30;
  --accent-soft: #e5eee9;
  --negative: #a33b32;
  --negative-soft: #f8e9e6;
  --positive: #276646;
  --shadow: 0 18px 45px rgb(31 37 28 / 8%);
  --radius: 18px;
  --radius-small: 11px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--background); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgb(227 237 230 / 75%), transparent 28rem),
    var(--background);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgb(37 76 61 / 25%);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 1.55rem; line-height: 1.15; letter-spacing: -.025em; }
h3 { margin-bottom: .35rem; font-size: 1.05rem; letter-spacing: -.01em; }
.muted { color: var(--ink-soft); line-height: 1.55; }
.eyebrow { margin-bottom: .55rem; color: var(--ink-soft); font-size: .72rem; font-weight: 720; letter-spacing: .13em; text-transform: uppercase; }

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 9px 22px rgb(37 76 61 / 20%);
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-style: italic;
}

.brand-mark-small { width: 34px; height: 34px; border-radius: 11px; font-size: 1.1rem; }

.login-view { display: grid; min-height: 100vh; padding: 28px; place-items: center; }

.login-card {
  width: min(100%, 420px);
  padding: clamp(30px, 7vw, 48px);
  border: 1px solid rgb(227 228 220 / 75%);
  border-radius: 26px;
  background: rgb(255 255 255 / 88%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card .brand-mark { margin-bottom: 2.6rem; }
.login-card h1 { font-size: 2.35rem; }
.login-copy { margin: 1rem 0 2rem; }

.stack-form { display: grid; gap: .7rem; }
.stack-form label, .dialog-body > label { font-size: .8rem; font-weight: 680; }

input, select {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
}

input:hover, select:hover { border-color: #b7bbb0; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(37 76 61 / 10%); outline: none; }

.password-row { position: relative; }
.password-row input { padding-right: 65px; }
.show-password { position: absolute; top: 50%; right: 9px; border: 0; color: var(--accent); background: transparent; font-size: .76rem; font-weight: 700; transform: translateY(-50%); cursor: pointer; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .14s, background .14s, border-color .14s, opacity .14s;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { border-color: var(--line); color: var(--ink); background: var(--surface); }
.button-secondary:hover { border-color: var(--line-strong); background: var(--surface-warm); }
.button-quiet { color: var(--negative); background: transparent; }
.button-quiet:hover { background: var(--negative-soft); }
.button-block { width: 100%; margin-top: .45rem; }
.form-error { margin: .15rem 0 0; color: var(--negative); font-size: .8rem; line-height: 1.45; }
.form-message { min-height: 1.2rem; margin: 0; color: var(--positive); font-size: .8rem; }

.site-header {
  position: relative;
  display: flex;
  width: min(100% - 40px, 1180px);
  height: 84px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  border-bottom: 1px solid rgb(212 214 204 / 70%);
}

.wordmark { display: flex; align-items: center; gap: 11px; color: var(--ink); font-size: 1.05rem; font-weight: 760; text-decoration: none; letter-spacing: -.02em; }
.page-nav { position: absolute; left: 50%; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid rgb(212 214 204 / 75%); border-radius: 12px; background: rgb(255 255 255 / 44%); transform: translateX(-50%); }
.page-nav a { padding: 8px 13px; border-radius: 8px; color: var(--ink-soft); font-size: .76rem; font-weight: 700; text-decoration: none; transition: color .14s, background .14s, box-shadow .14s; }
.page-nav a:hover { color: var(--ink); background: rgb(255 255 255 / 65%); }
.page-nav a[aria-current="page"] { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgb(31 37 28 / 8%); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.period-label { color: var(--ink-soft); font-size: .78rem; font-weight: 600; }
.icon-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgb(255 255 255 / 60%); cursor: pointer; }
.icon-button:hover { background: #fff; }
.icon-button svg, .button svg, .empty-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.dashboard { width: min(100% - 40px, 1180px); margin: 0 auto; padding: clamp(42px, 7vw, 84px) 0 80px; }
.overview-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 31px; }
.refresh-button svg { width: 16px; height: 16px; }
.refresh-button.is-loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 16px; margin-bottom: 22px; }
.account-card { min-height: 206px; padding: 25px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 18px rgb(42 48 39 / 3%); }
.account-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.bank-badge { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: .76rem; font-weight: 650; }
.bank-dot { width: 9px; height: 9px; border-radius: 50%; background: #214e9b; box-shadow: 0 0 0 4px #e8eef8; }
.bank-dot.green { background: #156c60; box-shadow: 0 0 0 4px #e1f0ed; }
.bank-dot.purple { background: #7054c7; box-shadow: 0 0 0 4px #eee9fb; }
.bank-dot.lime { background: #173300; box-shadow: 0 0 0 4px #dcffb8; }
.nickname-button { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; cursor: pointer; }
.nickname-button:hover { color: var(--ink); background: var(--background); }
.nickname-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.account-name { margin: 29px 0 4px; font-size: .92rem; font-weight: 700; }
.account-number { margin-bottom: 12px; color: var(--ink-soft); font-size: .76rem; letter-spacing: .03em; }
.account-balance { margin: 0; font-size: clamp(1.8rem, 4vw, 2.35rem); font-weight: 735; letter-spacing: -.045em; }
.balance-currency { margin-left: 4px; color: var(--ink-soft); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.account-conversion { margin: 3px 0 0; color: var(--ink-soft); font-size: .72rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.account-conversion span { margin-left: 4px; font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; }
.account-warning { margin: 10px 0 0; color: var(--negative); font-size: .74rem; }

.debt-panel { margin-bottom: 22px; padding: 24px 26px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 18px rgb(42 48 39 / 3%); }
.debt-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.debt-header .eyebrow { margin-bottom: .4rem; }
.debt-header .button { min-height: 38px; padding: 0 14px; font-size: .76rem; }
.debt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.debt-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-warm); }
.debt-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.klarna-badge { padding: 5px 8px; border-radius: 6px; color: #17120f; background: #ffb3c7; font-size: .66rem; font-weight: 800; letter-spacing: .02em; }
.debt-actions { display: flex; align-items: center; gap: 8px; }
.debt-actions button { padding: 3px; border: 0; color: var(--ink-soft); background: transparent; font-size: .68rem; font-weight: 700; cursor: pointer; }
.debt-actions button:hover { color: var(--ink); text-decoration: underline; }
.debt-actions button.delete:hover { color: var(--negative); }
.debt-card h3 { margin: 17px 0 7px; overflow: hidden; font-size: .92rem; text-overflow: ellipsis; white-space: nowrap; }
.debt-total { margin: 0; font-size: 1.45rem; font-weight: 740; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.debt-total span { margin-left: 2px; color: var(--ink-soft); font-size: .7rem; letter-spacing: .02em; }
.debt-monthly { margin: 4px 0 14px; color: var(--ink); font-size: .78rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.debt-monthly span { color: var(--ink-soft); font-weight: 560; }
.debt-schedule { margin: 0 0 4px; font-size: .74rem; font-weight: 680; }
.debt-meta { margin: 0; color: var(--ink-soft); font-size: .68rem; line-height: 1.45; }
.debt-empty { padding: 18px 4px 2px; color: var(--ink-soft); font-size: .8rem; }
.debt-empty p { margin: 0; }

.transaction-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 18px rgb(42 48 39 / 3%); }
.transaction-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.transaction-header .eyebrow { margin-bottom: .4rem; }
.select-wrap select { min-width: 170px; min-height: 40px; padding-right: 32px; font-size: .78rem; font-weight: 650; }
.transaction-row { display: grid; grid-template-columns: 112px minmax(180px, 1fr) minmax(120px, .45fr) 140px; align-items: center; gap: 16px; min-height: 72px; padding: 12px 26px; border-bottom: 1px solid var(--line); }
.transaction-row:last-child { border-bottom: 0; }
.transaction-date, .transaction-account { color: var(--ink-soft); font-size: .78rem; }
.transaction-description { min-width: 0; }
.transaction-description strong, .transaction-description span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-description strong { font-size: .86rem; }
.transaction-description span { margin-top: 4px; color: var(--ink-soft); font-size: .72rem; }
.transaction-amount { text-align: right; font-size: .88rem; font-weight: 740; font-variant-numeric: tabular-nums; }
.transaction-amount > span, .transaction-conversion { display: block; }
.transaction-conversion { margin-top: 3px; color: var(--ink-soft); font-size: .68rem; font-weight: 620; }
.transaction-amount.positive { color: var(--positive); }
.inline-notice { margin: 16px 20px 0; padding: 12px 14px; border-radius: 10px; color: var(--negative); background: var(--negative-soft); font-size: .78rem; }
.no-transactions { padding: 55px 24px; color: var(--ink-soft); text-align: center; }
.no-transactions p { margin: 0; }

.empty-state { padding: clamp(50px, 10vw, 90px) 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgb(255 255 255 / 48%); text-align: center; }
.empty-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 20px; place-items: center; border-radius: 18px; color: var(--accent); background: var(--accent-soft); }
.empty-icon svg { width: 27px; height: 27px; }
.empty-state h2 { margin-bottom: 9px; }
.empty-state p { max-width: 430px; margin: 0 auto 23px; }

.status-page { max-width: 1020px; }
.net-worth-panel { overflow: hidden; border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); background: var(--surface); box-shadow: 0 7px 26px rgb(42 48 39 / 5%); }
.net-worth-summary { display: flex; min-height: 195px; align-items: flex-end; justify-content: space-between; gap: 32px; padding: clamp(28px, 5vw, 45px); border-bottom: 1px solid var(--line); background: linear-gradient(135deg, var(--surface) 40%, #edf3ef); }
.summary-label { margin-bottom: 12px; color: var(--ink-soft); font-size: .78rem; font-weight: 700; }
.net-worth-value { margin: 0; font-size: clamp(2.9rem, 8vw, 5rem); font-weight: 745; letter-spacing: -.06em; line-height: .95; font-variant-numeric: tabular-nums; }
.net-worth-value span { margin-left: 8px; color: var(--ink-soft); font-size: clamp(.8rem, 2vw, 1.05rem); font-weight: 720; letter-spacing: .03em; }
.net-worth-meta { margin: 15px 0 0; color: var(--ink-soft); font-size: .74rem; line-height: 1.45; }
.net-worth-change { flex: 0 0 auto; margin-bottom: 7px; padding: 10px 13px; border-radius: 11px; color: var(--ink-soft); background: rgb(255 255 255 / 65%); font-size: .76rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.net-worth-change.positive { color: var(--positive); background: var(--accent-soft); }
.net-worth-change.negative { color: var(--negative); background: var(--negative-soft); }
.net-worth-change strong { display: block; margin-bottom: 2px; font-size: .9rem; }
.net-worth-change span { color: inherit; font-size: .68rem; font-weight: 620; opacity: .78; }
.chart-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 29px 34px 0; }
.chart-heading .eyebrow { margin-bottom: .35rem; }
.chart-heading h2 { font-size: 1.15rem; }
.chart-range { margin: 0; color: var(--ink-soft); font-size: .72rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-wrap { height: clamp(235px, 35vw, 330px); padding: 28px 28px 5px; }
.net-worth-chart { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#net-worth-fill); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-hit-area { fill: transparent; stroke: transparent; stroke-width: 18; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; padding: 0 34px 14px; color: var(--ink-soft); font-size: .67rem; font-weight: 650; }
.chart-note { margin: 0; padding: 0 34px 27px; color: var(--ink-soft); font-size: .67rem; line-height: 1.45; }

.investments-page { max-width: 1020px; }
.investment-summary { margin-bottom: 22px; padding: clamp(28px, 5vw, 42px); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); background: linear-gradient(135deg, var(--surface) 40%, #edf3ef); box-shadow: 0 7px 26px rgb(42 48 39 / 5%); }
.investment-summary.skeleton-panel { min-height: 170px; padding: 0; }
.investment-total-value { margin: 0; font-size: clamp(2.7rem, 7vw, 4.5rem); font-weight: 745; letter-spacing: -.055em; line-height: 1; font-variant-numeric: tabular-nums; }
.investment-total-value span { margin-left: 7px; color: var(--ink-soft); font-size: .95rem; font-weight: 720; letter-spacing: .03em; }
.investment-list-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 18px rgb(42 48 39 / 3%); }
.investment-list-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.investment-list-header .eyebrow { margin-bottom: .4rem; }
.hourly-badge { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: .7rem; font-weight: 680; }
.hourly-badge > span { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 4px var(--accent-soft); }
.investments-grid { display: grid; gap: 14px; padding: 18px; }
.investment-card { padding: clamp(20px, 4vw, 28px); border: 1px solid var(--line); border-radius: 15px; background: var(--surface-warm); }
.investment-card-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.investment-kind { padding: 5px 8px; border-radius: 7px; color: var(--accent); background: var(--accent-soft); font-size: .65rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.investment-daily-change { color: var(--ink-soft); font-size: .74rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.investment-daily-change.positive { color: var(--positive); }
.investment-daily-change.negative { color: var(--negative); }
.investment-card h3 { max-width: 680px; margin: 18px 0 6px; font-size: 1.1rem; line-height: 1.3; }
.investment-identity { margin: 0; color: var(--ink-soft); font-size: .7rem; }
.investment-metrics { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 12px; margin: 25px 0 18px; }
.investment-metric { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.investment-metric span, .units-field span { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: .66rem; font-weight: 680; }
.investment-metric strong { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.investment-metric:first-child strong { font-size: 1.25rem; letter-spacing: -.025em; }
.investment-units-form { display: flex; align-items: end; gap: 9px; padding-top: 18px; border-top: 1px solid var(--line); }
.units-field { flex: 1 1 220px; max-width: 280px; }
.units-field input { min-height: 42px; background: var(--surface); font-variant-numeric: tabular-nums; }
.investment-units-form .button { min-height: 42px; }
.investment-refresh-meta { margin: 13px 0 0; color: var(--ink-soft); font-size: .66rem; line-height: 1.45; }
.investment-refresh-meta a { color: var(--accent); font-weight: 700; text-decoration: none; }
.investment-refresh-meta a:hover { text-decoration: underline; }
.investment-price-error { margin: 14px 0 0; color: var(--negative); font-size: .72rem; }

.skeleton-card, .skeleton-panel { position: relative; background: #eeefe9; overflow: hidden; }
.skeleton-panel { min-height: 330px; }
.skeleton-card::after, .skeleton-panel::after { position: absolute; inset: 0; background: linear-gradient(95deg, transparent 20%, rgb(255 255 255 / 55%) 48%, transparent 75%); content: ""; animation: shimmer 1.45s infinite; transform: translateX(-100%); }
@keyframes shimmer { to { transform: translateX(100%); } }

dialog { padding: 0; border: 1px solid var(--line); color: var(--ink); background: var(--surface); box-shadow: 0 30px 80px rgb(16 22 18 / 24%); }
dialog::backdrop { background: rgb(18 23 19 / 42%); backdrop-filter: blur(3px); }
.sheet-dialog { width: min(94vw, 650px); max-height: min(90vh, 850px); margin-right: max(3vw, calc((100vw - 1180px) / 2)); border-radius: 22px; }
.small-dialog { width: min(92vw, 440px); border-radius: 20px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 23px 25px; border-bottom: 1px solid var(--line); }
.dialog-header .eyebrow { margin-bottom: .35rem; }
.dialog-body { padding: 25px; }
.settings-body { display: grid; gap: 12px; background: var(--surface-warm); }
.settings-section { padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.settings-section > .muted { margin-bottom: 20px; font-size: .84rem; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading p { margin-bottom: 0; font-size: .8rem; }
.compact-field { display: grid; flex: 0 0 125px; gap: 5px; color: var(--ink-soft); font-size: .68rem; font-weight: 650; }
.compact-field select { min-height: 38px; font-size: .75rem; }
.bank-list { display: grid; gap: 8px; }
.bank-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.bank-name { display: flex; align-items: center; gap: 11px; }
.bank-name strong { display: block; font-size: .85rem; }
.bank-name span:not(.bank-logo) { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .68rem; }
.bank-logo { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 10px; color: #fff; background: #1f4e99; font-size: .73rem; font-weight: 800; }
.bank-logo.green { background: #176c60; }
.bank-logo.purple { background: #7054c7; }
.bank-logo.lime { color: #dcffb8; background: #173300; }
.bank-row .button { min-height: 36px; padding: 0 12px; font-size: .74rem; }

.setup-section { position: relative; }
.setup-status { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--ink-soft); font-size: .72rem; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c88d2d; box-shadow: 0 0 0 4px #f8eedc; }
.setup-section.is-configured .status-dot { background: var(--positive); box-shadow: 0 0 0 4px var(--accent-soft); }
.setup-steps { display: grid; gap: 20px; margin: 24px 0 0; padding: 0; list-style: none; }
.setup-steps li { display: grid; grid-template-columns: 27px 1fr; gap: 11px; }
.step-number { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: .7rem; font-weight: 800; }
.setup-steps strong { font-size: .8rem; }
.setup-steps p { margin: 4px 0 7px; color: var(--ink-soft); font-size: .76rem; line-height: 1.45; }
.text-button, .external-link { border: 0; color: var(--accent); background: transparent; font-size: .75rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.text-button:hover, .external-link:hover { text-decoration: underline; }
.copy-row { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.copy-row code { display: block; min-width: 0; overflow: hidden; padding: 8px 9px; border-radius: 7px; color: #38423c; background: var(--background); font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { display: grid; gap: 8px; }
.save-row { display: flex; gap: 8px; }
.save-row input { min-width: 0; min-height: 42px; }
.save-row .button { flex: 0 0 auto; min-height: 42px; }
.compact-form { margin-top: 18px; }
.compact-form input { min-height: 42px; }
.api-setup-details { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.api-setup-details summary { color: var(--ink-soft); font-size: .78rem; font-weight: 700; cursor: pointer; }
.api-setup-details > .muted { margin: 10px 0 0; font-size: .76rem; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 5px; }
.field-hint { margin: 7px 0 0; color: var(--ink-soft); font-size: .74rem; }
.amount-input { position: relative; }
.amount-input input { padding-right: 55px; }
.amount-input span { position: absolute; top: 50%; right: 14px; color: var(--ink-soft); font-size: .72rem; font-weight: 700; transform: translateY(-50%); }
.debt-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 5px; }
.debt-form-grid label { display: grid; gap: 6px; color: var(--ink); font-size: .76rem; font-weight: 680; }
.debt-form-grid label:last-child { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.toast-region { position: fixed; z-index: 20; right: 22px; bottom: 22px; display: grid; gap: 9px; width: min(380px, calc(100vw - 44px)); pointer-events: none; }
.toast { padding: 14px 16px; border: 1px solid rgb(255 255 255 / 20%); border-radius: 12px; color: #fff; background: #26342d; box-shadow: 0 12px 34px rgb(20 27 22 / 22%); font-size: .82rem; line-height: 1.4; animation: toast-in .2s ease-out; }
.toast.error { background: #78352f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 720px) {
  .site-header, .dashboard { width: min(100% - 28px, 1180px); }
  .site-header { height: 72px; }
  .wordmark > span:last-child { display: none; }
  .page-nav a { padding-right: 10px; padding-left: 10px; }
  .period-label { display: none; }
  .dashboard { padding-top: 38px; }
  .overview-heading { align-items: center; margin-bottom: 24px; }
  .overview-heading h1 { font-size: 2.35rem; }
  .refresh-button { width: 44px; padding: 0; font-size: 0; }
  .transaction-header { align-items: flex-end; padding: 20px; }
  .debt-panel { padding: 20px; }
  .select-wrap select { min-width: 135px; max-width: 150px; }
  .transaction-row { grid-template-columns: 1fr auto; gap: 7px 14px; min-height: 78px; padding: 13px 20px; }
  .transaction-date { order: 1; }
  .transaction-amount { grid-row: 1 / span 2; grid-column: 2; }
  .transaction-description { order: 3; }
  .transaction-account { display: none; }
  .sheet-dialog { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .section-heading { display: grid; }
  .compact-field { width: 140px; }
  .save-row { display: grid; }
  .net-worth-summary { min-height: 180px; align-items: flex-start; flex-direction: column; gap: 20px; }
  .net-worth-change { margin-bottom: 0; }
  .chart-heading { align-items: flex-start; padding: 24px 22px 0; }
  .chart-range { display: none; }
  .chart-wrap { padding: 24px 16px 3px; }
  .chart-axis { padding: 0 22px 13px; }
  .chart-note { padding: 0 22px 23px; }
  .investment-metrics { grid-template-columns: 1fr 1fr; }
  .investment-metric:first-child { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .login-view { padding: 14px; }
  .login-card { padding: 30px 23px; }
  .transaction-header { align-items: stretch; flex-direction: column; }
  .debt-header { align-items: stretch; flex-direction: column; }
  .debt-header .button { width: 100%; }
  .debt-form-grid { grid-template-columns: 1fr; }
  .debt-form-grid label:last-child { grid-column: auto; }
  .select-wrap select { max-width: none; }
  .page-nav { gap: 2px; padding: 3px; }
  .page-nav a { padding: 7px 7px; font-size: .68rem; }
  .settings-section { padding: 18px; }
  .dialog-header, .dialog-body { padding-right: 19px; padding-left: 19px; }
  .investment-list-header { align-items: flex-start; flex-direction: column; }
  .investment-metrics { grid-template-columns: 1fr; }
  .investment-metric:first-child { grid-column: auto; }
  .investment-units-form { align-items: stretch; flex-direction: column; }
  .units-field { flex: none; max-width: none; }
}

@media (max-width: 350px) {
  .page-nav { gap: 0; padding: 2px; }
  .page-nav a { padding: 6px 4px; font-size: .61rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
