:root {
  --brand-dark: #0f2748;
  --brand-primary: #0b6b78;
  --brand-primary-hover: #075663;
  --brand-highlight: #f5c447;
  --canvas: #f6f8fb;
  --surface: #fff;
  --surface-subtle: #eaf0f4;
  --border: #cbd5e1;
  --text: #172033;
  --text-secondary: #5c6b7a;
  --positive: #15803d;
  --positive-subtle: #dcfce7;
  --negative: #b42318;
  --negative-subtle: #fee4e2;
  --warning: #92400e;
  --warning-subtle: #fef3c7;
  --focus: #f5c447;
  --shadow: 0 18px 50px rgba(15, 39, 72, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--text); }
a { color: var(--brand-primary); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--brand-primary-hover); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .55rem; font-size: clamp(1.75rem, 6vw, 2.7rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: .55rem; font-size: 1.15rem; line-height: 1.25; }
p { color: var(--text-secondary); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--brand-dark); font-size: 1.2rem; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand:hover { color: var(--brand-dark); }
.brand-light, .brand-light:hover { color: #fff; }
.brand-mark { display: inline-grid; width: 2.1rem; height: 2.1rem; place-items: center; border-radius: .7rem; background: var(--brand-primary); color: #fff; font-weight: 900; box-shadow: inset -.28rem -.28rem 0 rgba(0,0,0,.08); }
.brand-mark::after { content: ""; position: absolute; width: .45rem; height: .45rem; margin: -1.6rem 0 0 1.55rem; border-radius: 50%; background: var(--brand-highlight); }

.button { min-height: 2.85rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .65rem 1rem; border: 1px solid transparent; border-radius: .8rem; font-weight: 750; line-height: 1.1; text-decoration: none; cursor: pointer; transition: background .16s ease, border .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--brand-primary); color: #fff; }
.button-primary:hover { background: var(--brand-primary-hover); color: #fff; }
.button-secondary { background: var(--surface); color: var(--brand-dark); border-color: var(--border); }
.button-secondary:hover, .button-ghost:hover { background: var(--surface-subtle); color: var(--brand-dark); }
.button-ghost { background: transparent; color: var(--brand-dark); }
.button-danger { background: var(--negative); color: #fff; }
.button-danger:hover { color: #fff; background: #8f1d13; }

.public-header { min-height: 4.8rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem max(1rem, env(safe-area-inset-left)); background: rgba(255,255,255,.92); border-bottom: 1px solid rgba(203,213,225,.8); backdrop-filter: blur(14px); }
.public-header nav { display: flex; align-items: center; gap: .25rem; }
.public-header .button { min-height: 2.6rem; padding-inline: .72rem; font-size: .9rem; }
.public-content { width: min(100%, 1180px); min-height: calc(100vh - 9rem); margin: 0 auto; padding: 2rem 1rem 4rem; }
.public-footer { display: flex; justify-content: center; gap: 1.5rem; padding: 1.5rem; color: var(--text-secondary); border-top: 1px solid var(--border); }
.public-footer a { color: inherit; }
.landing-hero { display: grid; gap: 2rem; align-items: center; padding: 2.5rem 0 4rem; }
.landing-copy { max-width: 42rem; }
.landing-copy h1 { font-size: clamp(2.45rem, 10vw, 5.2rem); }
.landing-copy .lead { max-width: 37rem; font-size: 1.15rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.product-preview { position: relative; padding: 1rem; border-radius: 1.6rem; color: #fff; background: linear-gradient(145deg, var(--brand-dark), #163b66); box-shadow: 0 32px 80px rgba(15,39,72,.25); }
.product-preview::before { content: ""; position: absolute; inset: -1.2rem auto auto -1.2rem; width: 5rem; height: 5rem; border-radius: 50%; background: var(--brand-highlight); opacity: .8; z-index: -1; }
.preview-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2.5rem; font-weight: 700; }
.preview-balance small, .preview-row small { display: block; color: #cbd8e6; }
.preview-balance strong { display: block; margin: .35rem 0 1.7rem; font-size: 2.4rem; }
.preview-card { padding: 1rem; border-radius: 1rem; background: rgba(255,255,255,.11); }
.preview-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.14); }
.preview-row:last-child { border-bottom: 0; }
.feature-strip { display: grid; gap: 1rem; }
.feature-strip article { padding: 1.25rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); }

.auth-card { width: min(100%, 31rem); margin: 1rem auto; padding: 1.4rem; border: 1px solid var(--border); border-radius: 1.25rem; background: var(--surface); box-shadow: var(--shadow); }
.auth-card .lead { font-size: 1.05rem; }
.auth-alternative { margin: 1.4rem 0 0; text-align: center; }
.auth-links { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.3rem; }

.mobile-app-header { position: sticky; top: 0; z-index: 30; min-height: 4.35rem; display: flex; align-items: center; justify-content: space-between; padding: .65rem max(1rem, env(safe-area-inset-left)); background: rgba(255,255,255,.95); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
.mobile-profile { display: grid; width: 2.7rem; height: 2.7rem; place-items: center; border-radius: 50%; background: var(--surface-subtle); color: var(--brand-dark); font-weight: 750; text-decoration: none; }
.desktop-sidebar { display: none; }
.app-content { width: 100%; min-height: 100vh; padding: 1.4rem 1rem calc(6.7rem + env(safe-area-inset-bottom)); }
.mobile-bottom-nav { position: fixed; z-index: 40; inset: auto 0 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: .45rem max(.35rem, env(safe-area-inset-right)) calc(.4rem + env(safe-area-inset-bottom)) max(.35rem, env(safe-area-inset-left)); background: rgba(255,255,255,.97); border-top: 1px solid var(--border); box-shadow: 0 -12px 32px rgba(15,39,72,.09); backdrop-filter: blur(14px); }
.mobile-bottom-nav a { min-height: 3.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; color: var(--text-secondary); text-decoration: none; }
.mobile-bottom-nav a > span { font-size: 1.4rem; line-height: 1; }
.mobile-bottom-nav small { font-size: .67rem; font-weight: 700; }
.mobile-bottom-nav .mobile-create > span { display: grid; width: 2.65rem; height: 2.65rem; place-items: center; margin-top: -1.45rem; border: 4px solid var(--surface); border-radius: 50%; background: var(--brand-primary); color: #fff; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 0 auto 1.4rem; }
.page-heading .button { flex-shrink: 0; }
.eyebrow { margin-bottom: .35rem; color: var(--brand-primary); font-size: .73rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.hero-amount { margin: .3rem 0 0; color: var(--text); font-size: 1.7rem; font-weight: 820; }
.balance-hero { position: relative; overflow: hidden; margin-bottom: 1.25rem; padding: 1.5rem; border-radius: 1.25rem; background: linear-gradient(135deg, var(--brand-dark), #164a68); color: #fff; box-shadow: var(--shadow); }
.balance-hero::after { content: ""; position: absolute; width: 10rem; height: 10rem; right: -4rem; top: -5rem; border: 2.2rem solid rgba(245,196,71,.18); border-radius: 50%; }
.balance-hero p, .balance-hero span { position: relative; z-index: 1; margin: 0; color: #d9e4ef; }
.balance-hero strong { position: relative; z-index: 1; display: block; margin: .3rem 0; font-size: clamp(2rem, 10vw, 3.4rem); letter-spacing: -.04em; }
.dashboard-grid, .settings-grid { display: grid; gap: 1rem; }
.panel { padding: 1.15rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); box-shadow: 0 6px 20px rgba(15,39,72,.04); }
.subtle-panel { margin-top: 1rem; background: transparent; box-shadow: none; }
.danger-accent { border-left: .35rem solid var(--warning); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.section-heading h2 { margin: 0; }
.compact-list { margin-inline: -1.15rem; }
.list-row { min-height: 4.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.15rem; color: var(--text); text-decoration: none; border-top: 1px solid var(--surface-subtle); }
.list-row:hover { background: var(--canvas); color: var(--text); }
.list-row span { min-width: 0; }
.list-row strong { display: block; }
.list-row small { display: block; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.amount-negative { color: var(--negative) !important; }
.amount-positive { color: var(--positive) !important; }
.empty-state { padding-block: 2rem; text-align: center; }

.account-grid { display: grid; gap: 1rem; }
.account-card { min-height: 10rem; display: flex; flex-direction: column; padding: 1.25rem; border: 1px solid var(--border); border-radius: 1.1rem; background: var(--surface); color: var(--text); text-decoration: none; box-shadow: 0 8px 28px rgba(15,39,72,.06); }
.account-card:hover { color: var(--text); border-color: var(--brand-primary); }
.account-card h2 { margin-top: .7rem; }
.account-card > strong { margin-top: auto; font-size: 1.65rem; }
.account-card small, .account-type { color: var(--text-secondary); }
.account-type { font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.is-muted { opacity: .66; }

.form-panel { max-width: 42rem; }
.form-stack { display: grid; gap: .55rem; }
.form-stack label, legend { color: var(--text); font-weight: 740; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-height: 3.1rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: .72rem; background: var(--surface); color: var(--text); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(11,107,120,.15); outline: none; }
.field-hint { display: block; color: var(--text-secondary); font-size: .83rem; }
.field-validation-error { color: var(--negative); font-size: .87rem; font-weight: 650; }
.validation-summary { color: var(--negative); }
.validation-summary:empty { display: none; }
.validation-summary ul { margin: 0; padding-left: 1.2rem; }
.checkbox-row { min-height: 2.85rem; display: flex; align-items: center; gap: .7rem; cursor: pointer; }
.checkbox-row input { width: 1.3rem; height: 1.3rem; accent-color: var(--brand-primary); }
.input-suffix { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: .72rem; background: var(--surface-subtle); }
.input-suffix:focus-within { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(11,107,120,.15); }
.input-suffix input { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.input-suffix span { padding: .75rem; color: var(--text-secondary); font-weight: 750; }
.amount-input input { font-size: 1.5rem; font-weight: 780; }
.form-columns { display: grid; gap: .75rem; }
.form-columns label { display: block; margin-bottom: .55rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: .8rem; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: 0 0 .5rem; padding: .3rem; border: 0; border-radius: .85rem; background: var(--surface-subtle); }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control span { min-height: 2.7rem; display: grid; place-items: center; border-radius: .65rem; }
.segmented-control input:checked + span { background: var(--surface); color: var(--brand-primary); box-shadow: 0 2px 8px rgba(15,39,72,.1); }
.segmented-control input:focus-visible + span { outline: 3px solid var(--focus); }

.notice, .callout { margin-bottom: 1rem; padding: .85rem 1rem; border-radius: .8rem; background: #dbeafe; color: #1e3a8a; }
.notice p, .callout p { margin: .25rem 0 0; color: inherit; }
.notice-success { background: var(--positive-subtle); color: #14532d; }
.notice-warning { background: var(--warning-subtle); color: var(--warning); }
.warning-confirmation { padding: .75rem; border: 1px solid #f5c447; border-radius: .8rem; background: #fffbeb; }
.warning-text { color: var(--warning) !important; }
.details-list dl { margin: 0; }
.details-list dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--surface-subtle); }
.details-list dl div:last-child { border-bottom: 0; }
.details-list dt { color: var(--text-secondary); }
.details-list dd { margin: 0; text-align: right; font-weight: 700; }
.history-panel { margin-top: 1rem; }
.history-panel p:last-child { margin-bottom: 0; }
.document-list, .card-list { display: grid; gap: .75rem; }
.document-row, .session-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.document-row h2, .session-row h2 { margin-bottom: .2rem; overflow-wrap: anywhere; }
.document-row p, .session-row p { margin-bottom: .2rem; }
.status-text { font-weight: 700; }
.setup-grid { display: grid; gap: 1.5rem; }
.qr-code { width: min(100%, 15rem); height: auto; image-rendering: pixelated; }
.recovery-codes { overflow-x: auto; padding: 1rem; border-radius: .7rem; background: var(--brand-dark); color: #fff; font: 700 1rem/1.8 ui-monospace, Consolas, monospace; }
.offline-page { display: grid; place-items: center; padding: 1rem; }

@media (min-width: 540px) {
  .public-header, .public-content { padding-inline: 1.5rem; }
  .auth-card { padding: 2rem; }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-columns { grid-template-columns: 1fr 1fr; }
  .feature-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .landing-hero { min-height: 34rem; grid-template-columns: 1.05fr .95fr; gap: 4rem; }
  .product-preview { padding: 1.5rem; transform: rotate(1deg); }
}

@media (min-width: 960px) {
  .mobile-app-header, .mobile-bottom-nav { display: none; }
  .desktop-sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 15.5rem; display: flex; flex-direction: column; padding: 1.5rem 1rem; background: var(--brand-dark); color: #fff; }
  .desktop-nav { display: grid; gap: .3rem; margin-top: 2.5rem; }
  .desktop-nav a, .desktop-nav button { min-height: 3rem; display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem; border: 0; border-radius: .7rem; background: transparent; color: #d9e4ef; font-weight: 680; text-align: left; text-decoration: none; cursor: pointer; }
  .desktop-nav a:hover, .desktop-nav button:hover { background: rgba(255,255,255,.1); color: #fff; }
  .desktop-nav a > span, .desktop-nav button > span { width: 1.35rem; color: var(--brand-highlight); font-size: 1.25rem; text-align: center; }
  .desktop-nav-secondary { margin-top: auto; }
  .desktop-nav-secondary form { margin: 0; }
  .desktop-nav-secondary button { width: 100%; }
  .app-content { width: auto; max-width: 96rem; margin-left: 15.5rem; padding: 2.5rem clamp(2rem, 4vw, 4.5rem) 4rem; }
  .dashboard-grid { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 1.25rem; }
  .settings-grid, .setup-grid { grid-template-columns: 1fr 1fr; }
  .account-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panel { padding: 1.35rem; }
  .compact-list { margin-inline: -1.35rem; }
  .list-row { padding-inline: 1.35rem; }
  .form-panel { padding: 1.75rem; }
}

@media (min-width: 1320px) {
  .account-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
