/* Design tokens from AGENTS.md §10, palette aligned to the sibling wayfare-site's actual
   brand colours (assets/css/site.css: --forest/--forest-dk/--berry/--berry-dk/--brass/--paper)
   so the two properties read as one entity per AGENTS.md §1/§4a. Structure (radius, shadow,
   type scale) is unchanged — only colour was asked to match. */
:root {
  --ink-900: #0f1e1a;
  --ink-600: #5a6a61;
  --surface: #ffffff;
  --bg: #f2f4f0;
  --border: #d3dace;
  --brand: #1b4d3e;
  --brand-dark: #0e2b22;
  /* CTA accent — wayfare-site reserves this for buttons and hover states specifically
     (.btn--give, link:hover), not for large surfaces. Mirror that restraint here. */
  --accent: #d9481f;
  --accent-dark: #b23a17;
  --focus-ring: #b98d33;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 20px;
  --shadow-card: 0 12px 32px -12px rgb(15 30 26 / 0.25);
  --signal-positive: #15803d;
  --signal-negative: #b91c1c;
  --signal-warning: #b45309;
  --signal-info: #1d4ed8;
}

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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
}

/* App shell — persistent sidebar + top utility bar, replacing the old horizontal nav bar. The
   content area behind the cards was a flat, dull fill — this adds two soft, viewport-anchored
   brand-colour blooms (safe to peek through any gap — a gradient reads as a soft tint, never a
   glitch) on the body, plus a faint line-art ATM watermark (self-drawn SVG, no external asset)
   scoped to `.app-content`'s own box further down. All backgrounds paint behind child elements
   per the CSS spec, so the sidebar/topbar's own opaque surfaces sit on top with no extra
   z-index bookkeeping needed. */
.app-body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 100% -8%, rgba(27, 77, 62, 0.08), transparent 42%),
    radial-gradient(circle at -6% 106%, rgba(185, 141, 51, 0.07), transparent 38%);
  background-repeat: no-repeat, no-repeat;
  background-position: top right, bottom left;
  background-size: 55% 55%, 50% 50%;
  background-attachment: fixed, fixed;
}

@media (max-width: 900px) {
  .app-body {
    /* Fixed attachment fights mobile browser chrome/scroll performance — scroll with the page
       instead below the breakpoint where the sidebar collapses anyway. */
    background-attachment: scroll, scroll;
    background-size: 70% 70%, 65% 65%;
  }
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.35rem;
  margin-bottom: 2rem;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink-900);
}

/* The logo asset is a white mark on transparent — needs a dark chip to stay visible on the
   light nav background. On dark surfaces (the login hero) it's used directly, unwrapped. */
.nav-logo-badge {
  display: flex;
  align-items: center;
  background: var(--brand);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  height: 28px;
}

.nav-logo-badge img {
  height: 16px;
  width: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
}

.sidebar-nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-600);
  margin: 1.5rem 0 0.6rem;
  padding: 0 0.5rem;
}

.sidebar-nav-label:first-child {
  margin-top: 0;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--ink-600);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 150ms ease-out, color 150ms ease-out;
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--ink-900);
}

.sidebar-nav a.is-active {
  background: var(--brand);
  color: #ffffff;
}

.sidebar-nav-group {
  position: relative;
}

.sidebar-nav-chevron-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.3rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink-600);
  border-radius: var(--radius-sm);
}

.sidebar-nav-chevron-btn:hover {
  background: var(--bg);
}

.sidebar-nav-chevron-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 180ms ease-out;
}

.sidebar-nav-group.is-expanded .sidebar-nav-chevron-btn svg,
.sidebar-nav-group:hover .sidebar-nav-chevron-btn svg {
  transform: rotate(180deg);
}

.sidebar-subnav {
  list-style: none;
  margin: 0 !important;
  padding-left: 2.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 220ms ease-out, opacity 150ms ease-out, margin 220ms ease-out;
}

.sidebar-nav-group.is-expanded .sidebar-subnav,
.sidebar-nav-group:hover .sidebar-subnav {
  max-height: 100px;
  opacity: 1;
  margin: 0.15rem 0 0.3rem !important;
}

.sidebar-subnav a {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  color: var(--ink-600);
}

.sidebar-subnav a.is-active {
  background: var(--bg);
  color: var(--brand);
  font-weight: 600;
}

.sidebar-logout {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-logout button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  background: none;
  color: var(--ink-600);
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: var(--radius);
}

.sidebar-logout button svg {
  width: 18px;
  height: 18px;
}

.sidebar-logout button:hover {
  background: var(--bg);
  color: var(--signal-negative);
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* Scoped to this box (not the viewport) so the watermark sits in the true empty space below
     the page's real content — flex-stretched to at least 100vh by .app-shell, so on a short
     page (Accounts) there's room below the cards, and on a long page (Dashboard) real content
     simply grows over it instead of the icon poking through gaps between cards. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%231b4d3e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' opacity='0.14'%3E%3Crect x='36' y='8' width='168' height='224' rx='20'/%3E%3Crect x='62' y='32' width='116' height='64' rx='6'/%3E%3Crect x='62' y='150' width='116' height='16' rx='5'/%3E%3Crect x='80' y='178' width='80' height='20' rx='5'/%3E%3Ccircle cx='84' cy='118' r='6'/%3E%3Ccircle cx='120' cy='118' r='6'/%3E%3Ccircle cx='156' cy='118' r='6'/%3E%3Ccircle cx='84' cy='134' r='6'/%3E%3Ccircle cx='120' cy='134' r='6'/%3E%3Ccircle cx='156' cy='134' r='6'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom 32px right 32px;
  background-size: 220px;
}

@media (max-width: 900px) {
  .app-content {
    background-size: 150px;
    background-position: bottom 16px right 16px;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-icons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-600);
  text-decoration: none;
}

.topbar-icon-btn svg {
  width: 18px;
  height: 18px;
}

.topbar-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-icon-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.topbar-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.portal-main {
  padding: 2rem;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.portal-footer {
  /* Darkened from --brand rather than a fixed colour, so a future brand-colour change
     (Bank Settings) keeps the footer in proportion instead of clashing with it. */
  background: color-mix(in srgb, var(--brand) 55%, black);
  margin-top: auto;
}

.portal-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
}

.portal-footer-inner a {
  color: #ffffff;
  text-decoration: none;
}

.portal-footer-inner a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 1rem;
    gap: 1.5rem;
  }

  .sidebar-brand {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .sidebar-nav {
    flex-shrink: 0;
  }

  .sidebar-nav ul {
    flex-direction: row;
  }

  .sidebar-nav-label {
    display: none;
  }

  .sidebar-nav a span {
    display: none;
  }

  .sidebar-subnav {
    display: none;
  }

  .sidebar-logout {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
  }

  .sidebar-logout button span {
    display: none;
  }

  .portal-main {
    padding: 1.25rem;
  }

  .topbar {
    padding: 0.85rem 1.25rem;
  }
}

h1 {
  color: var(--ink-900);
}

.text-muted {
  color: var(--ink-600);
}

.font-mono {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.auth-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.auth-shell {
  width: 100%;
  max-width: 720px;
  padding: 1.5rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-form label {
  font-size: 0.85rem;
  color: var(--ink-600);
}

.auth-form input,
.auth-form select {
  /* Flexbox stretch doesn't reliably fill date/select inputs across browsers (they carry an
     intrinsic content-based width) — set width explicitly rather than relying on it. */
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink-900);
}

.auth-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1.1em;
  padding-right: 2rem;
}

.auth-form button {
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.auth-error {
  color: var(--signal-negative);
  font-size: 0.9rem;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.inline-link {
  font-size: 0.8rem;
  color: var(--brand);
  text-decoration: none;
}

.inline-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.login-card-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--ink-600);
  text-align: center;
}

.login-card-footer a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.login-card-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Consumer login: full-bleed hero split — brand panel + form. Flat brand fill, not a
   gradient — AGENTS.md §10 reserves the one gradient in the system for the balance card. */
.login-body {
  margin: 0;
  min-height: 100vh;
}

.login-hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

.login-hero-brand {
  background: var(--brand);
  color: #ffffff;
  padding: 4rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand-mark {
  height: 100px;
  width: auto;
  display: block;
  margin-bottom: 2rem;
}

.login-brand-mark[src="/branding/logo-white.png"] { height: 96px; padding: 8px 14px; box-sizing: border-box; background: #ffffff; border-radius: 10px; }

.login-hero-brand h1 {
  color: #ffffff;
  font-size: 2.25rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  max-width: 460px;
}

.login-hero-brand .tagline {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.82);
  max-width: 420px;
  margin: 0;
}

.trust-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.trust-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.trust-icon {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

/* Login hero card illustration — an original graphic, not a stock photo of a real person
   (no such asset exists to use appropriately). An abstract silhouette stands in for "a
   customer holding it" without depicting a specific likeness. */
.card-showcase {
  position: relative;
  margin: 2.5rem 0 0.5rem;
  height: 190px;
  width: 300px;
}

.hand-fingers {
  position: absolute;
  left: 34px;
  bottom: -16px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  z-index: 1;
}

.hand-fingers span {
  width: 17px;
  border-radius: 9px;
  background: rgba(242, 244, 240, 0.92);
  box-shadow: 0 6px 10px -4px rgb(14 43 34 / 0.4);
}

.hand-fingers span:nth-child(1) {
  height: 40px;
}

.hand-fingers span:nth-child(2) {
  height: 52px;
}

.hand-fingers span:nth-child(3) {
  height: 48px;
}

.hand-fingers span:nth-child(4) {
  height: 36px;
}

.bank-card {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 300px;
  aspect-ratio: 1.586;
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: 0 20px 40px -14px rgb(14 43 34 / 0.55);
  transform: rotate(-6deg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #ffffff;
}

.bank-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.bank-card-logo {
  height: 14px;
  width: auto;
  opacity: 0.95;
}

.bank-card-chip {
  width: 30px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--focus-ring) 0%, #8a6a26 100%);
}

.bank-card-number {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 1rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.bank-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.bank-card-bottom > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bank-card-bottom > div:last-child {
  align-items: flex-end;
}

.bank-card-eyebrow {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.65);
}

.bank-card-holder {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

@media (max-width: 860px) {
  .card-showcase {
    display: none;
  }
}

.login-hero-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2.5rem 2rem;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
}

.login-card h2 {
  margin: 0 0 0.25rem;
  color: var(--ink-900);
  font-size: 1.5rem;
}

.login-card-subtitle {
  margin: 0 0 1.5rem;
  color: var(--ink-600);
  font-size: 0.92rem;
}

.login-card .auth-form {
  gap: 0.4rem;
}

.login-card #accountNumber {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.staff-login-link {
  font-size: 0.85rem;
  color: var(--ink-600);
  text-decoration: none;
}

.staff-login-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 860px) {
  .login-hero {
    grid-template-columns: 1fr;
  }

  .login-hero-brand {
    padding: 2.5rem 1.75rem;
  }

  .login-hero-brand h1 {
    font-size: 1.75rem;
  }
}

/* Staff/admin login: deliberately plainer and more utilitarian than the consumer page — no
   brand hero, no marketing copy, reuses the shared centered auth-shell layout. */
.staff-login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem;
  max-width: 380px;
  margin: 0 auto;
}

.brand-badge {
  display: inline-flex;
  background: var(--brand);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
}

.brand-badge img {
  height: 18px;
  width: auto;
  display: block;
}

.staff-login-card h1 {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}

.staff-login-card .text-muted {
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
}

/* Registration form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row > div {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-hint {
  margin: -0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-600);
}

.button-primary {
  display: inline-block;
  text-align: center;
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.button-primary:hover {
  background: var(--accent-dark);
}

/* Registration confirmation screen */
.confirmation-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirmation-shell {
  width: 100%;
  max-width: 460px;
  padding: 2.5rem 1.5rem;
}

.confirmation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
  text-align: center;
}

.confirmation-success-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: var(--signal-positive);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirmation-success-icon svg {
  width: 26px;
  height: 26px;
}

.confirmation-card h1 {
  font-size: 1.5rem;
  margin: 0 0 0.4rem;
}

.confirmation-card-visual {
  display: flex;
  justify-content: center;
  margin: 1.75rem 0;
}

.bank-card--static {
  /* relative, not static — behaves identically for layout/flow, but keeps this the positioning
     context for .bank-card-overlay-badge (Cards page) instead of the badge escaping to the
     nearest ancestor that has one. */
  position: relative;
  transform: none;
  width: 260px;
}

.confirmation-summary {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.confirmation-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.confirmation-label {
  font-size: 0.85rem;
  color: var(--ink-600);
}

.confirmation-value {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-900);
}

.status-checklist {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-checklist li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
}

.status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-icon svg {
  width: 13px;
  height: 13px;
}

.status-done .status-icon {
  background: #eaf3ec;
  color: var(--signal-positive);
}

.status-done span:last-child {
  color: var(--ink-900);
}

.status-pending .status-icon {
  background: #fdf6ec;
  color: var(--signal-warning);
}

.status-locked .status-icon {
  background: var(--bg);
  color: var(--ink-600);
  border: 1px solid var(--border);
}

.status-locked {
  color: var(--ink-600);
}

/* Dashboard — see AGENTS.md §11 for the full target spec; this covers the account-opening
   follow-through (KYC-pending state, first account card) only. */
.kyc-banner {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: #fdf6ec;
  border-left: 3px solid var(--signal-warning);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0 1.5rem;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.account-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--ink-600);
  text-transform: capitalize;
  margin-bottom: 0.75rem;
}

.account-card-number {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  text-transform: none;
}

.account-card-balance {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink-900);
}

.account-card-sort {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-600);
}

.account-grid--secondary {
  margin-top: 1.5rem;
}

/* Accounts page — full account browser, distinct from the compact secondary-account tiles
   on the dashboard (AGENTS.md §8, Accounts). */
.account-grid--full {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin-top: 1.5rem;
}

.account-full-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.account-full-card .account-card-top {
  margin-bottom: 0.25rem;
}

.account-full-card .account-card-type {
  font-weight: 600;
  color: var(--ink-900);
  text-transform: capitalize;
}

.account-full-card .account-card-balance {
  font-size: 1.9rem;
  margin-bottom: 0.15rem;
}

.account-status-badge {
  text-transform: capitalize;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  align-self: flex-start;
}

.account-status-badge.is-active {
  background: #eaf3ec;
  color: var(--signal-positive);
}

.account-status-badge.is-blocked {
  background: #fdf6ec;
  color: var(--signal-warning);
}

.account-status-badge.is-closed {
  background: var(--bg);
  color: var(--ink-600);
  border: 1px solid var(--border);
}

.account-number-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.account-number-value {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.88rem;
  color: var(--ink-600);
}

.account-number-toggle {
  border: none;
  background: none;
  padding: 0.15rem;
  cursor: pointer;
  color: var(--ink-600);
  display: flex;
}

.account-number-toggle:hover {
  color: var(--brand);
}

.account-number-toggle svg {
  width: 16px;
  height: 16px;
}

.account-card-note {
  font-size: 0.82rem;
  margin: 0;
}

.account-card-link {
  margin-top: 0.5rem;
}

.account-card-subtype {
  font-size: 0.78rem;
  text-transform: capitalize;
  margin-top: -0.2rem;
}

.account-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.account-tag {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.account-tag.is-default {
  background: #eaf3ec;
  color: var(--brand);
}

.account-tag.is-dormant {
  background: var(--bg);
  color: var(--ink-600);
  border: 1px solid var(--border);
}

.account-nickname-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.account-nickname-form input {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-900);
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.link-button:hover {
  text-decoration: underline;
}

.account-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

/* Card Overview section */
.overview-heading {
  margin: 1.5rem 0 1rem;
}

.overview-heading h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

.card-overview-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

.card-overview-row > * {
  min-width: 0;
}

.mini-balance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mini-balance-card .stat-card-icon {
  align-self: flex-end;
  margin-bottom: 0.5rem;
}

.stat-card-date {
  font-size: 0.72rem;
  color: var(--ink-600);
}

.mini-balance-card .stat-card-amount {
  font-size: 1.15rem;
  margin-top: 0.4rem;
}

/* Stat cards — Total Balance, This Month, Total Income, Total Expenses */
.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.summary-row > * {
  min-width: 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.stat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--brand);
}

.stat-card-icon svg {
  width: 16px;
  height: 16px;
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--ink-600);
}

.stat-card-amount {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink-900);
}

.stat-card-amount-unit {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-600);
}

.stat-card-hint {
  font-size: 0.78rem;
}

.stat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.stat-badge.is-positive {
  background: #eaf3ec;
  color: var(--signal-positive);
}

.stat-badge.is-negative {
  background: #fbeaea;
  color: var(--signal-negative);
}

.stat-card--wide {
  width: 100%;
}

/* Recent Transfer Activity — a real table, not a card list, matching a denser transaction feed. */
.transfer-table-wrap {
  overflow-x: auto;
}

.transfer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.transfer-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-600);
  padding: 0 1.25rem 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

.transfer-table td {
  padding: 0.85rem 1.25rem 0.85rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.transfer-table th:last-child,
.transfer-table td:last-child {
  padding-right: 0;
}

.transfer-table tr:last-child td {
  border-bottom: none;
}

.transfer-table .align-right {
  text-align: right;
}

.transfer-table-desc {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: normal;
}

.transfer-table-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bg);
}

.transfer-table-avatar svg {
  width: 15px;
  height: 15px;
}

.transfer-table-avatar.rail-positive {
  background: #eaf3ec;
  color: var(--signal-positive);
}

.transfer-table-avatar.rail-negative {
  background: #fbeaea;
  color: var(--signal-negative);
}

.transfer-table-avatar.rail-warning {
  background: #fdf6ec;
  color: var(--signal-warning);
}

.transfer-table-avatar.rail-info {
  background: #e8eefc;
  color: var(--signal-info);
}

.transfer-table-desc-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.transfer-table-desc-text span:first-child {
  color: var(--ink-900);
}

/* Quick Transfer panel */
.quick-transfer-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.quick-transfer-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.chart-wrap--bar {
  height: 200px;
}

/* Dashboard header */
.dashboard-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.dashboard-last-login {
  font-size: 0.82rem;
  color: var(--ink-600);
}

/* Balance hero — the one place in the system that earns a gradient (AGENTS.md §10). */
.balance-hero {
  margin-top: 1.25rem;
  max-width: 420px;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: 0 20px 40px -16px rgb(14 43 34 / 0.5);
  color: #ffffff;
}

.balance-hero-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  text-transform: capitalize;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 1rem;
}

.balance-hero-number {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  text-transform: none;
}

.balance-figure {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.balance-amount {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: filter 200ms ease-out;
}

.balance-figure[data-masked='true'] .balance-amount {
  filter: blur(10px);
  user-select: none;
}

.balance-toggle {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.balance-toggle svg {
  width: 16px;
  height: 16px;
}

.balance-toggle .icon-eye-closed {
  display: none;
}

.balance-figure[data-masked='true'] .balance-toggle .icon-eye-open {
  display: none;
}

.balance-figure[data-masked='true'] .balance-toggle .icon-eye-closed {
  display: block;
}

.balance-hero-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
}

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.85rem;
  max-width: 800px;
  margin-top: 1.25rem;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink-900);
  text-decoration: none;
  font-size: 0.78rem;
  text-align: center;
  transition: border-color 150ms ease-out, transform 150ms ease-out;
}

.quick-action:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.quick-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--brand);
}

.quick-action-icon svg {
  width: 18px;
  height: 18px;
}

.quick-action--muted {
  color: var(--ink-600);
}

.quick-action--muted .quick-action-icon {
  color: var(--ink-600);
}

.quick-action--muted:hover {
  border-color: var(--signal-negative);
}

/* Two-column layout for the lower dashboard */
.dashboard-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
  align-items: start;
}

.dashboard-main,
.dashboard-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.panel h2 {
  font-size: 1rem;
  margin: 0 0 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
}

.panel-link {
  font-size: 0.82rem;
  color: var(--brand);
  text-decoration: none;
}

.panel-link:hover {
  color: var(--accent);
}

.empty-state {
  font-size: 0.88rem;
  padding: 1rem 0;
}

/* Transaction list — the status rail is the signature element (AGENTS.md §10). A debit isn't
   automatically "negative"; only failed/reversed states get the negative colour. */
.transaction-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.transaction-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0 0.75rem 0.9rem;
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--border);
}

.transaction-row:last-child {
  border-bottom: none;
}

.transaction-row.rail-positive {
  border-left-color: var(--signal-positive);
}

.transaction-row.rail-negative {
  border-left-color: var(--signal-negative);
}

.transaction-row.rail-warning {
  border-left-color: var(--signal-warning);
}

.transaction-row.rail-info {
  border-left-color: var(--signal-info);
}

.transaction-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.transaction-description {
  font-size: 0.9rem;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-date {
  font-size: 0.78rem;
  color: var(--ink-600);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.transaction-status-tag {
  text-transform: capitalize;
  background: #fdf6ec;
  color: var(--signal-warning);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
}

.transaction-amount {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-900);
  white-space: nowrap;
}

.transaction-amount.is-credit {
  color: var(--signal-positive);
}

.chart-wrap {
  position: relative;
  max-width: 320px;
  height: 240px;
  margin: 0 auto;
}

/* Dashboard "Overview" chart legend — credit/debit, matching the chart's own dataset colours
   (public/client/js/dashboard.js), which in turn match the transaction rail's credit/debit
   colours elsewhere on the site. */
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin: -0.25rem 0 0.75rem;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-600);
}

.chart-legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.chart-legend-swatch--credit {
  background: var(--signal-positive);
}

.chart-legend-swatch--debit {
  background: var(--signal-info);
}

/* Notifications */
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notification-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--border);
}

.notification-row.is-unread {
  border-left-color: var(--signal-info);
}

.notification-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-900);
}

.notification-body {
  font-size: 0.82rem;
}

@media (max-width: 860px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .balance-hero {
    max-width: none;
  }

  .card-overview-row {
    grid-template-columns: 1fr;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }
}

/* Registration page — standalone document. A persistent branded sidebar (same flat navy fill
   as the login hero, AGENTS.md §10) fills what would otherwise be empty gutter beside the long
   form, and doubles as a trust/reassurance panel instead of pure decoration. */
.register-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

.register-shell {
  display: flex;
  min-height: 100vh;
}

.register-sidebar {
  flex: 0 0 320px;
  background: var(--brand);
  color: #ffffff;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.register-sidebar .login-brand-mark {
  margin-bottom: 2.5rem;
}

.register-sidebar h2 {
  color: #ffffff;
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0 0 1.5rem;
}

.register-sidebar-link {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.register-sidebar-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.register-container {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2.5rem 1.5rem 4rem;
  min-width: 0;
}

.register-card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
}

.register-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
}

.register-section {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.register-section:first-of-type {
  margin-top: 1.75rem;
}

.register-section-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.register-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.register-section-title {
  font-weight: 600;
  color: var(--ink-900);
  font-size: 0.95rem;
}

.register-card .auth-form {
  gap: 0.6rem;
}

.register-card button[type='submit'] {
  margin-top: 2rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
}

/* Styled file upload — a real, visible file input hidden and swapped for a themed label
   (classic accessible pattern: the label's `for` still triggers the native file picker). */
.file-upload {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 150ms ease-out;
}

.file-upload:hover {
  border-color: var(--accent);
}

.file-upload-icon {
  font-size: 1.5rem;
}

.file-upload-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.file-upload-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-900);
}

.file-upload-hint {
  font-size: 0.78rem;
  color: var(--ink-600);
}

.file-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.confirmation-email-note {
  font-size: 0.85rem;
  color: var(--ink-600);
  margin: 0 0 1.5rem;
}

@media (max-width: 900px) {
  .register-shell {
    flex-direction: column;
  }

  .register-sidebar {
    flex: none;
    position: static;
    height: auto;
    padding: 2rem 1.75rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .register-sidebar .login-brand-mark {
    margin-bottom: 0;
  }

  .register-sidebar h2,
  .register-sidebar .trust-list {
    display: none;
  }
}

@media (max-width: 640px) {
  .register-card {
    padding: 1.75rem;
  }

  .register-sidebar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Account detail page — details panel, low-balance threshold form, linked cards, filters,
   pagination (AGENTS.md §8, Accounts). */
.text-capitalize {
  text-transform: capitalize;
}

.account-detail-list {
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.account-detail-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
}

.account-detail-list dt {
  color: var(--ink-600);
}

.account-detail-list dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-align: right;
}

.inline-threshold-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  max-width: 360px;
}

.threshold-prefix {
  color: var(--ink-600);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.85rem;
}

.inline-threshold-form input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

.inline-threshold-form .button-primary {
  margin: 0;
  width: auto;
  white-space: nowrap;
}

.linked-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.linked-card-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.linked-card-row:last-child {
  border-bottom: none;
}

.statement-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.statement-filter-form > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.statement-filter-form label {
  font-size: 0.72rem;
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.statement-filter-form input,
.statement-filter-form select {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.85rem;
}

.statement-filter-form .button-primary {
  margin: 0;
  width: auto;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
}

.button-secondary-sm {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-900);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

.button-secondary-sm:hover {
  border-color: var(--brand);
  color: var(--brand);
}

@media (max-width: 640px) {
  .account-detail-list > div {
    flex-direction: column;
    gap: 0.15rem;
  }

  .account-detail-list dd {
    text-align: left;
  }
}

/* Account-level request flows — new account, closure (AGENTS.md §8, "Account-level actions"). */
.request-form {
  max-width: 520px;
}

.request-form form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1rem;
}

.request-form label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.6rem;
}

.request-form select,
.request-form textarea,
.request-form input[type='text'],
.request-form input[type='number'],
.request-form input[type='password'] {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

.request-form .button-primary {
  margin-top: 1rem;
}

.request-form .form-hint {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-600);
}

/* Transfer forms — wider than the single-field account requests, sectioned like a real transfer
   review flow rather than one long stack of fields, PIN styled distinctly since it's the
   security-critical field every transfer requires (AGENTS.md §8, Transfer). */
.transfer-form {
  max-width: 640px;
  padding: 2rem;
}

.transfer-form form {
  margin-top: 0;
}

.transfer-section {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.transfer-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.transfer-section-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-600);
  margin-bottom: 0.75rem;
}

.transfer-section label {
  margin-top: 0;
}

.transfer-field-icon-wrap {
  position: relative;
}

.transfer-field-icon-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-600);
  pointer-events: none;
}

.transfer-field-icon-wrap select,
.transfer-field-icon-wrap input {
  padding-left: 2.6rem !important;
}

.transfer-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 560px) {
  .transfer-form-row {
    grid-template-columns: 1fr;
  }
}

.transfer-form select,
.transfer-form input[type='text'],
.transfer-form input[type='number'],
.transfer-form input[type='password'] {
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}

.transfer-form select:focus,
.transfer-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(27 77 62 / 0.12);
  outline: none;
}

.amount-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}

.amount-input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(27 77 62 / 0.12);
}

.amount-currency-chip {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background: var(--bg);
  color: var(--ink-600);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-weight: 600;
  font-size: 0.9rem;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.amount-input-wrap input {
  border: none !important;
  box-shadow: none !important;
  flex: 1;
  min-width: 0;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 600;
  padding: 0.6rem 0.9rem !important;
}

.pin-field {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pin-field label {
  margin: 0;
  flex-shrink: 0;
}

.pin-field-icon-wrap {
  position: relative;
  width: 180px;
}

.pin-field-icon-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-600);
  pointer-events: none;
}

.pin-field input {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  letter-spacing: 0.35em;
  font-size: 1.05rem;
  width: 100%;
  padding-left: 2.5rem !important;
}

.transfer-otp-note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  color: var(--ink-600);
  margin: 1rem 0 0;
}

.transfer-otp-note svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.transfer-form .button-primary {
  margin-top: 2rem;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.beneficiary-empty-state {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--ink-600);
  margin-top: 0.5rem;
}

.form-banner {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  background: #fdf6ec;
  border-left: 3px solid var(--signal-warning);
}

.form-banner.error {
  background: #fbeaea;
  border-left-color: var(--signal-negative);
  color: #7f1d1d;
}

.form-banner.success {
  background: #eaf3ec;
  border-left-color: var(--signal-positive);
  color: #14532d;
}

/* Profile — notification-preference switch (AGENTS.md §8, Profile). Ported from the admin
   console's identical .toggle-row so both portals share the same interaction for an on/off
   preference row, rather than inventing a second visual language for the same control. */
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.toggle-row input {
  width: auto;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.toggle-row-text strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-900);
}

.toggle-row-text span {
  font-size: 0.8rem;
  color: var(--ink-600);
}

/* Security page — sessions list and recent-login history reuse the notif-feed-row visual
   pattern (icon + content + trailing action) rather than a bespoke table. */
.security-row-action {
  flex-shrink: 0;
  align-self: center;
}

.security-current-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--bg);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
}

.request-confirmation {
  max-width: 480px;
  text-align: center;
  padding: 2.5rem 2rem;
}

.request-success-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #eaf3ec;
  color: var(--signal-positive);
  display: flex;
  align-items: center;
  justify-content: center;
}

.request-success-icon svg {
  width: 24px;
  height: 24px;
}

.request-confirmation h2 {
  margin: 0 0 0.5rem;
}

.request-confirmation .button-primary {
  margin-top: 1.5rem;
  width: auto;
  display: inline-block;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.request-confirmation-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.request-confirmation-actions .button-primary,
.request-confirmation-actions .button-secondary {
  margin-top: 0;
}

.button-secondary {
  display: inline-block;
  text-align: center;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-900);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

.button-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.closure-account-summary {
  margin-bottom: 1.25rem;
  box-shadow: none;
  background: var(--bg);
}

.closure-warning {
  font-size: 0.85rem;
  color: var(--ink-600);
  background: #fdf6ec;
  border-left: 3px solid var(--signal-warning);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
}

.button-danger {
  display: inline-block;
  text-align: center;
  margin-top: 1rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  background: var(--signal-negative);
  color: white;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  font-weight: 600;
}

.button-danger:hover {
  background: #7f1d1d;
}

/* Transfer processing overlay — shown for a fixed window after "Send transfer" while the real
   submission runs, so the client always sees a deliberate "we're on it" moment rather than the
   page just sitting there (AGENTS.md §10, "the balance is the emotional centre" — the same
   care applies to the moment money is in flight). Built with plain CSS animation/transition,
   no JS animation loop needed. */
.transfer-processing-overlay {
  position: fixed;
  inset: 0;
  background: rgb(15 30 26 / 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: transfer-overlay-in 180ms ease-out;
}

@keyframes transfer-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.transfer-processing-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.75rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  max-width: 320px;
  width: calc(100% - 2rem);
}

.transfer-processing-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  border: 4px solid var(--bg);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: transfer-spin 850ms linear infinite;
}

@keyframes transfer-spin {
  to { transform: rotate(360deg); }
}

.transfer-processing-title {
  font-weight: 700;
  color: var(--ink-900);
  margin: 0 0 0.35rem;
}

.transfer-processing-sub {
  font-size: 0.85rem;
  color: var(--ink-600);
  margin: 0;
}

.transfer-processing-progress-track {
  margin-top: 1.5rem;
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.transfer-processing-progress-fill {
  height: 100%;
  background: var(--brand);
  width: 0%;
  transition: width 10s linear;
}

/* Beneficiaries — list cards + shared add/edit form (AGENTS.md §8, Beneficiaries). */
.empty-state-panel {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-state-panel .button-primary {
  width: auto;
  display: inline-block;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  margin-top: 1rem;
}

.beneficiary-card {
  gap: 0.5rem;
}

.beneficiary-type-tag {
  font-size: 0.78rem;
  text-transform: none;
  margin-top: -0.2rem;
}

.beneficiary-detail-list {
  margin: 0.4rem 0 0.2rem;
}

.beneficiary-card-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.beneficiary-inline-form {
  display: contents;
}

.link-button--danger {
  color: var(--signal-negative);
}

.beneficiary-type-toggle {
  display: flex;
  gap: 0.75rem;
}

.beneficiary-type-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 120ms ease-out, background 120ms ease-out;
}

.beneficiary-type-option:has(input:checked) {
  border-color: var(--brand);
  background: #eaf3ec;
  color: var(--brand);
}

.beneficiary-type-option input {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  margin: 0;
}

.beneficiary-type-readout {
  font-weight: 600;
  color: var(--ink-900);
  margin: 0 0 0.35rem;
}

.beneficiary-swift-field {
  margin-top: 1rem;
}

/* Cards (AGENTS.md §8, Cards) — reuses the .bank-card illustration already built for the login
   hero and register confirmation, so a card looks like the same physical object everywhere it
   appears rather than a different mockup per page. */
.card-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.card-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-tile .bank-card--static {
  margin-bottom: 1.25rem;
}

.bank-card--inactive {
  filter: grayscale(0.85);
  opacity: 0.75;
}

.bank-card-overlay-badge {
  position: absolute;
  top: 1.1rem;
  right: 1.25rem;
  background: rgba(15, 30, 26, 0.55);
  color: #ffffff;
  text-transform: uppercase;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.card-tile-info {
  width: 100%;
  text-align: center;
}

.card-tile-info-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.card-type-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-600);
}

.card-tile-account {
  font-size: 0.82rem;
  margin: 0 0 1rem;
}

.card-tile-action-form {
  display: flex;
  justify-content: center;
}

.card-tile-action-form .button-primary,
.card-tile-action-form .button-secondary {
  width: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.card-tile-note {
  font-size: 0.82rem;
  margin: 0;
}

/* Notifications feed (AGENTS.md §8, Notifications). */
.notif-filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}

.notif-filter-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-600);
  text-decoration: none;
  border: 1px solid var(--border);
}

.notif-filter-tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.notif-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.notif-feed-row {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.notif-feed-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.notif-feed-row.is-unread {
  background: #f7faf8;
  margin: 0 -1.5rem;
  padding: 1rem 1.5rem;
}

.notif-feed-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-feed-icon svg {
  width: 16px;
  height: 16px;
}

.notif-category-money-in {
  background: #eaf3ec;
  color: var(--signal-positive);
}

.notif-category-money-out {
  background: #eaf1fb;
  color: var(--signal-info);
}

.notif-category-warning {
  background: #fdf6ec;
  color: var(--signal-warning);
}

.notif-category-security {
  background: #fdf6ec;
  color: var(--signal-warning);
}

.notif-category-account {
  background: var(--bg);
  color: var(--brand);
}

.notif-category-general {
  background: var(--bg);
  color: var(--ink-600);
}

.notif-feed-content {
  flex: 1;
  min-width: 0;
}

.notif-feed-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.notif-feed-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-900);
}

.notif-feed-date {
  font-size: 0.75rem;
  white-space: nowrap;
}

.notif-feed-body {
  font-size: 0.85rem;
  margin: 0.2rem 0 0;
}

.notif-feed-mark-read {
  margin-top: 0.4rem;
}

/* Statements (AGENTS.md §8, Statements) — account switcher above the same filterable table
   used on the per-account statement page. */
.statement-account-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
}

.statement-account-pill {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-900);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.statement-account-pill.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.statement-export-links {
  display: flex;
  gap: 0.5rem;
}

/* Bill Payments (AGENTS.md §8, Bill Payments — UI shell + data model, execution deferred). */
.bill-section-header {
  margin-top: 2rem;
}

.bill-section-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.biller-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.biller-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
}

.biller-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.biller-card-name {
  font-weight: 600;
  color: var(--ink-900);
}

.biller-card-category {
  font-size: 0.75rem;
  color: var(--ink-600);
  background: var(--bg);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.biller-card-ref {
  font-size: 0.8rem;
  margin: 0.5rem 0 0.75rem;
}

.bill-payment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ---- Uploaded bank logo (Admin -> Bank Settings) ------------------------------------------
   The bundled logo is a white mark made for dark surfaces. An uploaded logo can be any shape or
   colour, so it is kept inside a size box (never stretched, never overflowing) and, on the dark
   green surfaces, sits on a white chip so a full-colour logo stays readable. The sidebar is a
   light surface, so there it is shown as-is. */
img[src^="/branding/uploads/"] {
  object-fit: contain;
}

.nav-logo-badge:has(img[src^="/branding/uploads/"]) {
  background: transparent;
  padding: 0;
  height: 40px;
}

.nav-logo-badge img[src^="/branding/uploads/"] {
  height: 40px;
  width: auto;
  max-width: 100px;
}

.login-brand-mark[src^="/branding/uploads/"] {
  height: 72px;
  max-width: 280px;
  padding: 6px 10px;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 10px;
}

.bank-card-logo[src^="/branding/uploads/"] {
  height: 30px;
  max-width: 120px;
  padding: 2px 5px;
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 4px;
  opacity: 1;
}

.brand-badge:has(img[src^="/branding/uploads/"]) {
  background: transparent;
  padding: 0;
}

.brand-badge img[src^="/branding/uploads/"] {
  height: 56px;
  max-width: 220px;
}

/* The uploaded logo carries the name, so it gets the room the name text used to take. */
.sidebar-brand--logo-only .nav-logo-badge img[src^="/branding/uploads/"] {
  height: 52px;
  max-width: 180px;
}
.sidebar-brand--logo-only .nav-logo-badge:has(img[src^="/branding/uploads/"]) {
  height: 52px;
}

/* Chat */
.nav-badge {
  margin-left: auto;
  min-width: 1.3rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--accent, var(--brand));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  height: min(55vh, 520px);
  overflow-y: auto;
  padding: 0.25rem;
}

.chat-empty {
  margin: auto;
  color: var(--ink-600);
  text-align: center;
}

.chat-msg {
  max-width: min(78%, 36rem);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.chat-msg--mine {
  align-self: flex-end;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chat-msg--theirs {
  align-self: flex-start;
}

.chat-msg-meta {
  font-size: 0.72rem;
  opacity: 0.75;
  margin-bottom: 0.2rem;
}

.chat-msg-author {
  font-weight: 600;
}

.chat-msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.45;
}

.chat-form {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  min-height: 2.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
}

.chat-preview {
  max-width: 28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .chat-msg {
    animation: chat-in 200ms ease-out;
  }
}

@keyframes chat-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

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

.chat-form textarea {
  min-width: 0;
  width: auto;
}

.chat-form .button-primary {
  width: auto;
  flex: none;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.chat-msg--system {
  align-self: center;
  max-width: 90%;
  background: transparent;
  border-style: dashed;
  color: var(--ink-600);
  text-align: center;
  font-size: 0.85rem;
}

.chat-status {
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-600);
  font-size: 0.85rem;
}

.chat-status[data-online='true'] {
  color: var(--signal-positive);
}

/* Chat: typing indicator (animated dots; static text when motion is reduced) */
.chat-typing {
  margin: 0;
  padding: 0 0.25rem;
  color: var(--ink-600);
  font-size: 0.8rem;
  font-style: italic;
}

.chat-typing::after {
  content: '...';
}

@media (prefers-reduced-motion: no-preference) {
  .chat-typing::after {
    content: '';
    display: inline-block;
    width: 1.2em;
    text-align: left;
    animation: chat-dots 1.2s steps(4, end) infinite;
  }
}

@keyframes chat-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Chat: floating widget (bottom-right on every client page) */
.chat-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.chat-widget-toggle {
  position: relative;
  width: 3.5rem;
  height: 3.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  display: grid;
  place-items: center;
  transition: transform 200ms ease-out;
}

.chat-widget-toggle:hover {
  transform: scale(1.06);
}

.chat-widget-toggle svg {
  width: 1.6rem;
  height: 1.6rem;
}

.chat-widget-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  border: 2px solid var(--surface);
}

.chat-widget-badge[hidden],
.chat-widget-panel[hidden] {
  display: none;
}

.chat-widget-panel {
  width: min(380px, calc(100vw - 2.5rem));
  height: min(540px, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}

.chat-widget-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.chat-widget-status {
  font-size: 0.76rem;
  opacity: 0.85;
}

.chat-widget-status::before {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: #9aa5a0;
}

.chat-widget-status[data-online='true']::before {
  background: #4ade80;
}

.chat-widget-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.chat-widget-panel .chat-thread {
  flex: 1;
  height: auto;
  min-height: 0;
  padding: 0.25rem 0.9rem;
}

.chat-widget-panel .chat-typing,
.chat-widget-panel .form-banner,
.chat-widget-panel .chat-form {
  margin: 0 0.9rem;
}

.chat-widget-panel .chat-form textarea {
  min-height: 2.4rem;
}

@media (max-width: 480px) {
  .chat-widget {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .chat-widget-panel {
    width: calc(100vw - 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-widget-toggle {
    transition: none;
  }
}
