/* Blackfish Bank web app: layout only. Colors, fonts and radii come from the design tokens (tokens.css, generated from brand/). */

/* The brand fonts, served by this app (SIL Open Font License; the license of each is in assets/fonts). Latin subset only: it covers
   Portuguese and English, and any other character falls back to the system font named in the token. */
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/sora-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--bfb-font-body);
  background: var(--bfb-bg);
  color: var(--bfb-text);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
html[data-mode="light"] { color-scheme: light; }
html[data-mode="dark"] { color-scheme: dark; }
html[data-mode="auto"] { color-scheme: light dark; }

body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }

a { color: var(--bfb-link); text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid var(--bfb-focus); outline-offset: 2px; }

h1, h2, h3, h4 { font-family: var(--bfb-font-heading); line-height: 1.2; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
h4 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--bfb-text-muted); }
p { margin: 0 0 0.75rem; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 30; padding: 0.75rem 1rem; background: var(--bfb-surface); border-radius: var(--bfb-radius-sm); }

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

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bfb-surface);
  border-bottom: 1px solid var(--bfb-border);
}
.top-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.75rem;
  max-width: 72rem; margin: 0 auto; padding: 0.5rem clamp(1rem, 4vw, 3rem);
}
.brand { display: inline-flex; }
.brand img { display: block; height: 44px; width: auto; }
.top nav { display: flex; gap: 0.25rem; }
.top nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.75rem;
  color: var(--bfb-text-muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent;
}
.top nav a:hover { color: var(--bfb-text); }
.top nav a[aria-current="page"] { color: var(--bfb-text); border-bottom-color: var(--bfb-accent); }

/* ---------- the small controls: language, palette, sun/moon, account ---------- */
.tools { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0;
  background: transparent; color: var(--bfb-text); border: 0; border-radius: var(--bfb-radius-pill);
  font: inherit; cursor: pointer; list-style: none;
}
.icon-button:hover { background: var(--bfb-surface-alt); }
.icon-button .icon { width: 22px; height: 22px; }
summary.icon-button::-webkit-details-marker { display: none; }
.flag { width: 24px; height: 24px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px color-mix(in srgb, var(--bfb-text) 28%, transparent); }
.bfb-swatch { display: inline-block; width: 20px; height: 20px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px color-mix(in srgb, var(--bfb-text) 28%, transparent); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bfb-primary); color: var(--bfb-on-primary); font-family: var(--bfb-font-heading); font-size: 0.75rem; font-weight: 700;
}

.mode-toggle { display: inline-flex; margin: 0; }
html[data-mode="dark"] .to-dark, html[data-mode="light"] .to-light { display: none; }
@media (prefers-color-scheme: dark) { html[data-mode="auto"] .to-dark { display: none; } }
@media not all and (prefers-color-scheme: dark) { html[data-mode="auto"] .to-light { display: none; } }

.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 25; min-width: 13rem; padding: 0.375rem;
  background: var(--bfb-surface); border: 1px solid var(--bfb-border); border-radius: var(--bfb-radius-md);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--bfb-text) 16%, transparent);
}
.menu-form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 44px; padding: 0.5rem 0.75rem;
  background: transparent; color: var(--bfb-text); border: 0; border-radius: var(--bfb-radius-sm);
  font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--bfb-surface-alt); }
.menu-item[aria-current="true"] { font-weight: 700; }
.menu-item[aria-current="true"]::after { content: "\2713"; margin-left: auto; color: var(--bfb-accent-text); }
.menu-who { display: grid; gap: 0.125rem; margin: 0; padding: 0.5rem 0.75rem 0.75rem; border-bottom: 1px solid var(--bfb-border); overflow-wrap: anywhere; }
.menu-who .muted { font-size: 0.875rem; }
.menu-sep { height: 1px; margin: 0.375rem 0; border: 0; background: var(--bfb-border); }
/* The account menu shows an e-mail address: wide enough not to break it in the middle (never wider than the screen). */
.account-menu .menu-panel { min-width: 18rem; max-width: calc(100vw - 2rem); }

/* ---------- page ---------- */
main { flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem); }
main:focus { outline: none; }

.card {
  background: var(--bfb-surface); border: 1px solid var(--bfb-border); border-radius: var(--bfb-radius-lg); padding: 1.5rem;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--bfb-text) 8%, transparent);
}

/* The sign-in page: the promise on the left, the mark on a deep navy panel on the right (the same panel in every theme). */
.hero { display: grid; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; padding-block: clamp(0.5rem, 3vw, 2rem); }
@media (min-width: 52rem) { .hero { grid-template-columns: 1.1fr 0.9fr; } }
.eyebrow { margin: 0 0 0.75rem; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bfb-accent-text); }
.hero h1 { margin-bottom: 1rem; }
.lead { max-width: 34rem; margin-bottom: 1.75rem; font-size: 1.125rem; color: var(--bfb-text-muted); }
.fineprint { margin: 1rem 0 0; font-size: 0.875rem; color: var(--bfb-text-muted); }
.hero-art {
  display: flex; align-items: center; justify-content: center; padding: clamp(1.5rem, 5vw, 3rem);
  background: linear-gradient(155deg, var(--bfb-brand-navy-deep), var(--bfb-brand-navy));
  border: 1px solid color-mix(in srgb, var(--bfb-brand-gold) 40%, transparent); border-radius: var(--bfb-radius-xl);
}
.hero-art img { display: block; width: 100%; max-width: 24rem; height: auto; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }

.muted { color: var(--bfb-text-muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.balance { display: block; margin: 0.25rem 0 0.5rem; font-family: var(--bfb-font-heading); font-size: 2.25rem; letter-spacing: -0.02em; }
.credit { color: var(--bfb-success); }

.badge { display: inline-block; padding: 0.125rem 0.75rem; border: 1px solid var(--bfb-border-strong); border-radius: var(--bfb-radius-pill); font-size: 0.8125rem; font-weight: 600; }

dl.limits { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; margin: 0.75rem 0 1.25rem; }
dl.limits dt { color: var(--bfb-text-muted); }
dl.limits dd { margin: 0; text-align: right; }

.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.5rem 1.5rem;
  border: 2px solid transparent; border-radius: var(--bfb-radius-md);
  background: var(--bfb-primary); color: var(--bfb-on-primary);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button.secondary { background: transparent; color: var(--bfb-text); border-color: var(--bfb-border-strong); }
@media (prefers-reduced-motion: no-preference) {
  .button, .icon-button, .menu-item { transition: filter 0.15s, background-color 0.15s; }
  .button:hover { filter: brightness(1.1); }
}

.table-wrap { overflow-x: auto; border: 1px solid var(--bfb-border); border-radius: var(--bfb-radius-lg); background: var(--bfb-surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.875rem 1.25rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--bfb-border); }
th { background: var(--bfb-surface-alt); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bfb-text-muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--bfb-surface-alt) 55%, transparent); }
.num { text-align: right; }

footer { padding: 1.5rem clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--bfb-border); color: var(--bfb-text-muted); font-size: 0.875rem; text-align: center; }
