:root {
  --navy: #0b2545;
  --navy-light: #13315c;
  --gold: #c9a227;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #dfe4ea;
  --text: #1f2937;
  --muted: #6b7280;
  --good: #1a7f37;
  --good-bg: #e6f6ea;
  --arrears: #b42318;
  --arrears-bg: #fdeceb;
  --pending: #9a6700;
  --pending-bg: #fff6e0;
  --danger: #b42318;

  /* Crest-derived accents (Brothers Across Nigeria Int'l anchor logo) -
     used sparingly on the landing/sign-in page so it reads as one brand
     with the app's navy shell rather than a bolted-on color scheme. */
  --gold-bright: #ffc72a;
  --anchor-red: #d92b30;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--navy-light); }

.topbar {
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
}
.topbar .brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; color: white; text-decoration: none; }
.topbar .brand-mark { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; display: block; }
.topbar .brand .sub { color: var(--gold); font-weight: 400; font-size: 0.8rem; display: block; }
.topbar .user-info { font-size: 0.85rem; display: flex; align-items: center; gap: 1rem; }
.topbar form { display: inline; }
.topbar button.link-btn {
  background: none; border: 1px solid rgba(255,255,255,0.4); color: white;
  padding: 0.3rem 0.7rem; border-radius: 4px; cursor: pointer; font-size: 0.8rem;
}

.nav {
  background: var(--navy-light);
  padding: 0 1.5rem;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav a {
  color: #e5e9f0;
  text-decoration: none;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  border-bottom: 3px solid transparent;
}
.nav a:hover, .nav a.active { border-bottom-color: var(--gold); color: white; }

/* Nav groups (Finance Config, Admin - src/views/layout.js NAV_GROUPS): a
   <details>/<summary> pair, not JS - collapsed by default with no script
   needed, natively clickable and keyboard-operable. Desktop turns it into
   a popover anchored under the trigger; the >860px media query further
   down turns the identical markup into an inline expand/collapse inside
   the hamburger drawer instead, so there is one structure for both rather
   than a second nav to keep in sync. */
.nav-group { position: relative; }
.nav-group summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.3rem;
  color: #e5e9f0; padding: 0.6rem 0.9rem; font-size: 0.85rem;
  border-bottom: 3px solid transparent;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '\25BE'; font-size: 0.7em; }
.nav-group summary:hover, .nav-group summary.active { border-bottom-color: var(--gold); color: white; }
.nav-group[open] summary { background: rgba(0,0,0,0.12); }
.nav-group-menu {
  position: absolute; top: 100%; left: 0; z-index: 40;
  display: flex; flex-direction: column;
  min-width: 190px; background: var(--navy-light);
  border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 6px 18px rgba(0,0,0,0.28);
}
.nav-group-menu a {
  color: #e5e9f0; text-decoration: none; white-space: nowrap;
  padding: 0.6rem 0.9rem; font-size: 0.85rem; border-bottom: none;
}
.nav-group-menu a:hover, .nav-group-menu a.active { background: var(--navy); color: white; }

/* Hamburger - hidden on wide screens, shown by the responsive block below. */
.nav-toggle {
  display: none;
  width: 40px; height: 40px; flex: 0 0 auto;
  background: none; border: 1px solid rgba(255,255,255,0.4); border-radius: 5px;
  cursor: pointer; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: white; transition: transform .15s, opacity .15s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.container { max-width: 1150px; margin: 0 auto; padding: 1.5rem; }

/* Breadcrumb trail - same look and placement on every non-root page. */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.crumbs a { color: var(--navy-light); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--text); font-weight: 600; }
.crumbs .crumbs-sep { color: var(--border); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card h2, .card h3 { margin-top: 0; }

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } }
/* Phone only (tablet ~768px stays the single-column collapse above).
   Remittance's batch-total tiles (a .grid-4 of .stat cards) read better in
   pairs than as one long stack. .grid-2 is deliberately excluded: the
   reconciliation two-list workbench relies on its 800px single-column
   collapse for a sequential "pick a line, then pick a record" flow, and
   forcing it back to 2 columns here would break that. (The Dashboard's own
   .stat tiles moved off the generic grid classes entirely - see .stat-row
   below - because they need a fixed grouping the grid collapse can't
   express.) */
@media (max-width: 600px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.stat .num { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat .label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
a.stat-link { display: block; text-decoration: none; transition: box-shadow 0.15s, border-color 0.15s; }
a.stat-link:hover { border-color: var(--navy-light); box-shadow: 0 2px 8px rgba(11, 37, 69, 0.12); }

/* Dashboard tiles: three fixed, grouped rows - membership (3), compliance
   (2), approval queues (up to 3) - the same grouping at every screen width
   (src/views/dashboard.js). A generic N-column grid can't express "always
   these groups, in this order," so this is a flex row instead of .grid.
   Every tile is the SAME fixed size in every row, at a given breakpoint -
   row 1 having 3 tiles and row 2 having 2 must not make row 1's tiles
   bigger or row 2's smaller. Two things make that true everywhere:
     1. flex-grow is 0 (no tile ever stretches to fill leftover row space)
        and flex-shrink is ALSO 0 (a 3-item row and a 2-item row never
        shrink their tiles by different amounts just because one of them
        has less slack - that was the actual bug in the first version of
        this rule). A row with fewer tiles is centered via justify-content
        (spacing) instead, never by its tiles being wider.
     2. Since nothing can shrink to avoid overflow anymore, the fixed
        200px basis is only safe above a width where 3 tiles + 2 gaps
        + the page's own side padding still fit: 3*200 + 2*9.6(gap) +
        2*13.6(container's 0.85rem padding below 820px) = 646.4px. The
        700px breakpoint below (with a fixed 108px basis under it) sits
        comfortably above that, so disabling shrink never reintroduces
        the horizontal overflow it used to prevent.
   A fixed min-height (see below) handles the other half of "same size" -
   width alone isn't enough when a 1-line label (Census) and a 3-line one
   (Expenses Awaiting Approval) sit in different flex containers (each row
   is its own), which don't equalise height with each other on their own. */
.stat-row { display: flex; gap: 0.6rem; justify-content: center; }
.stat-row > .stat {
  flex: 0 0 200px; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; min-height: 118px;
}
@media (max-width: 700px) {
  .stat-row { gap: 0.4rem; }
  .stat-row > .stat { flex-basis: 108px; min-height: 90px; }
  .stat-row .stat { padding: 0.6rem 0.4rem; }
  .stat-row .stat .num { font-size: 1.3rem; }
  .stat-row .stat .label { font-size: 0.62rem; letter-spacing: 0.01em; }
}

/* The membership row (Census/Sailing/Spotted/SWGP) has 4 tiles, one more
   than the 200px/108px basis above was sized for (see 988b0fa: that basis
   was solved specifically for a 3-tile row fitting down to the 700px
   breakpoint without flex-shrink). 4 tiles at 200px need >= ~877px of
   viewport to avoid overflow, which would break well above the 700px
   breakpoint. .stat-row-4 gives just that row a smaller basis (160px /
   78px) solved the same way for N=4, so it keeps the same non-grow,
   non-shrink, centered mechanics and the same two breakpoints - it's still
   one .stat-row, just sized for its own tile count. */
.stat-row-4 > .stat { flex-basis: 160px; }
@media (max-width: 700px) {
  .stat-row-4 > .stat { flex-basis: 78px; }
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #fafbfc; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-arrears { background: var(--arrears-bg); color: var(--arrears); }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-neutral { background: #eef1f5; color: var(--muted); }
.badge-gold { background: #fbf1d6; color: #8a6d00; }

.btn {
  display: inline-block;
  background: var(--navy);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--navy-light); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-outline { background: white; color: var(--navy); border: 1px solid var(--navy); }
.btn-danger { background: var(--danger); }
.btn-secondary { background: #6b7280; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

form.inline { display: inline; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 5px; font-size: 0.9rem;
}
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }

.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash-success { background: var(--good-bg); color: var(--good); }
.flash-error { background: var(--arrears-bg); color: var(--arrears); }

.filters { display: flex; gap: 0.75rem; align-items: end; margin-bottom: 1rem; flex-wrap: wrap; }
.filters .field { margin-bottom: 0; min-width: 160px; }

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.65rem;
  width: 100%; padding: 0.7rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: #f3f4f6; color: var(--muted); font-size: 0.9rem; font-weight: 600;
  margin-bottom: 0.65rem; cursor: not-allowed;
}
.login-card { max-width: 440px; margin: 3rem auto; }
.login-users { display: flex; flex-direction: column; gap: 0.5rem; }

/* ===========================================================================
   Landing / sign-in page. Rendered instead of the app shell for anonymous
   visitors (renderPage() only emits the topbar/nav when a user is signed
   in), so this doubles as both the marketing landing page and the sign-in
   screen. Nautical motif ties back to the Galleon/Frigate org structure and
   the anchor crest; palette pulls its gold/red from the crest itself
   (--gold-bright / --anchor-red) balanced against the app's own navy so it
   still reads as one product with the signed-in shell.
   =========================================================================== */

.landing { margin: 0 -1.5rem; }

.landing-hero {
  position: relative;
  overflow: hidden;
  padding: 3.5rem 1.5rem 6rem;
  text-align: center;
  color: white;
  background:
    radial-gradient(ellipse at top left, rgba(255, 199, 42, 0.16), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(217, 43, 48, 0.18), transparent 50%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 55%, var(--navy) 100%);
  background-size: 100% 100%, 100% 100%, 220% 220%;
  animation: hero-drift 22s ease-in-out infinite alternate;
}

@keyframes hero-drift {
  0% { background-position: 0% 0%, 100% 100%, 0% 50%; }
  100% { background-position: 10% 10%, 90% 90%, 100% 50%; }
}

/* Faint rope-ring watermark behind the hero content - decorative only. */
.landing-hero::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 640px; height: 640px;
  transform: translate(-50%, -55%);
  border: 2px dashed rgba(255, 199, 42, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; }

.hero-logo {
  width: 108px; height: 108px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9), 0 8px 28px rgba(0, 0, 0, 0.35);
  background: var(--gold-bright);
  margin-bottom: 1.1rem;
}

.hero-title { margin: 0; font-size: 2rem; font-weight: 800; letter-spacing: 0.01em; }
.hero-title .accent { color: var(--gold-bright); }
.hero-sub {
  margin: 0.15rem 0 0; font-size: 0.95rem; font-weight: 600;
  color: rgba(255, 255, 255, 0.75); text-transform: uppercase; letter-spacing: 0.08em;
}
.hero-tagline {
  margin: 1.1rem auto 0; max-width: 440px;
  font-size: 1.05rem; line-height: 1.5; color: rgba(255, 255, 255, 0.92);
}

/* Sparing rope/wave accents - thin, not competing with the sign-in controls. */
.hero-rope {
  width: 120px; height: 3px; margin: 1.4rem auto 0; border-radius: 999px;
  background: repeating-linear-gradient(
    -45deg, var(--gold-bright) 0 4px, rgba(255,255,255,0.55) 4px 8px
  );
  opacity: 0.85;
}

.hero-waves {
  position: absolute; left: 0; right: 0; bottom: -1px; line-height: 0;
}
.hero-waves svg { display: block; width: 100%; height: 90px; }
.hero-waves .wave-back { fill: rgba(255, 255, 255, 0.06); }
.hero-waves .wave-front { fill: var(--bg); }
.wave-anim { animation: wave-drift 10s ease-in-out infinite alternate; transform-box: fill-box; }

@keyframes wave-drift {
  0% { transform: translateX(-2%); }
  100% { transform: translateX(2%); }
}

.landing .login-card {
  position: relative; z-index: 2;
  max-width: 420px; margin: -3.25rem auto 2.5rem;
  box-shadow: 0 12px 32px rgba(11, 37, 69, 0.14);
}

.landing .login-card h2 { text-align: center; }
.landing .login-card > p.muted { text-align: center; }

.oauth-btn.oauth-live {
  background: white; color: var(--text); cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.oauth-btn.oauth-live:hover, .oauth-btn.oauth-live:focus-visible {
  border-color: var(--navy-light);
  box-shadow: 0 4px 14px rgba(11, 37, 69, 0.15);
  transform: translateY(-1px);
}
.oauth-btn.oauth-live:focus-visible { outline: 2px solid var(--navy-light); outline-offset: 2px; }
.oauth-icon { width: 20px; height: 20px; flex: 0 0 auto; }

.landing-trust {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  margin-top: 1.1rem; font-size: 0.78rem; color: var(--muted); text-align: center;
}
.landing-trust svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--navy-light); }

/* New-here CTA on the sign-in card - findable before anyone has signed in,
   since that's exactly when someone needs it (see README "Getting Started"). */
.landing-getting-started {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  margin-top: 0.6rem; font-size: 0.82rem; color: var(--muted); text-align: center;
}
.landing-getting-started svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--gold); }
.landing-getting-started a { color: var(--navy-light); font-weight: 600; }
.landing-getting-started a:hover { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .landing-hero, .wave-anim { animation: none; }
}

@media (max-width: 600px) {
  .landing-hero { padding: 2.5rem 1rem 5rem; }
  .hero-logo { width: 84px; height: 84px; }
  .hero-title { font-size: 1.6rem; }
  .landing .login-card { margin-top: -2.75rem; }
}

/* ===========================================================================
   Post-login Hub (/hub) - the module picker. Same navy/gold brand language
   as the sign-in landing hero above (radial gold/red accents over a navy
   gradient, a wave divider), scaled to sit inside the signed-in app shell
   (topbar + nav already rendered above it) rather than replace it. The
   crest appears twice, deliberately different roles: small in the topbar
   (identity mark, already there via renderPage), huge and faint here
   (mood/brand watermark) - never competing with the welcome text or the
   module cards for attention.
   =========================================================================== */
.hub-hero {
  position: relative;
  overflow: hidden;
  margin: -1.5rem -1.5rem 2.25rem;
  padding: 3.25rem 1.5rem 5rem;
  text-align: center;
  color: white;
  background:
    radial-gradient(ellipse at top left, rgba(255, 199, 42, 0.16), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(217, 43, 48, 0.18), transparent 50%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 55%, var(--navy) 100%);
  background-size: 100% 100%, 100% 100%, 220% 220%;
  animation: hero-drift 22s ease-in-out infinite alternate;
}

/* The large background logo. Oversized and bled off the right edge so it
   reads as a mood watermark, not a second focal point; low opacity keeps
   the welcome text and module cards the actual thing your eye lands on at
   every width. */
.hub-hero-logo {
  position: absolute;
  top: 50%; right: -9%;
  width: 640px; height: 640px;
  transform: translateY(-50%);
  opacity: 0.13;
  pointer-events: none;
  user-select: none;
}

.hub-hero-inner { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }
.hub-eyebrow {
  margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold-bright);
}
.hub-title { margin: 0.5rem 0 0; font-size: 2.15rem; font-weight: 800; letter-spacing: 0.01em; }
.hub-title .accent { color: var(--gold-bright); }
.hub-subtitle {
  margin: 0.75rem auto 0; max-width: 480px;
  font-size: 1.02rem; line-height: 1.55; color: rgba(255, 255, 255, 0.88);
}
.hub-hero .hero-rope { margin: 1.5rem auto 0; }
.hub-hero .hero-waves { bottom: -1px; }
.hub-hero .hero-waves .wave-front { fill: var(--bg); }

.hub-modules {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  max-width: 860px; margin: 0 auto 1.5rem;
}

.hub-module {
  position: relative;
  display: block; text-decoration: none; color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.hub-module::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-bright) 100%);
  opacity: 0; transition: opacity 0.15s ease;
}
.hub-module:hover, .hub-module:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(11, 37, 69, 0.16);
  border-color: var(--navy-light);
}
.hub-module:hover::before, .hub-module:focus-visible::before { opacity: 1; }
.hub-module:focus-visible { outline: 2px solid var(--navy-light); outline-offset: 2px; }

.hub-module-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: var(--gold-bright);
  margin-bottom: 1.1rem;
}
.hub-module-icon svg { width: 26px; height: 26px; }

.hub-module h3 { margin: 0 0 0.4rem; font-size: 1.15rem; color: var(--navy); }
.hub-module p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.hub-module-cta {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 1.1rem; font-size: 0.85rem; font-weight: 700; color: var(--navy-light);
}
.hub-module:hover .hub-module-cta, .hub-module:focus-visible .hub-module-cta { color: var(--gold); }
.hub-module-cta svg { width: 14px; height: 14px; transition: transform 0.15s ease; }
.hub-module:hover .hub-module-cta svg, .hub-module:focus-visible .hub-module-cta svg { transform: translateX(3px); }

.hub-note {
  max-width: 860px; margin: 0 auto; text-align: center;
  color: var(--muted); font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  .hub-hero { animation: none; }
}

@media (max-width: 820px) {
  .hub-hero { margin: -1rem -0.85rem 1.75rem; padding: 2.25rem 1rem 3.75rem; }
  .hub-hero-logo { width: 320px; height: 320px; right: -20%; opacity: 0.12; }
  .hub-title { font-size: 1.55rem; }
  .hub-subtitle { font-size: 0.92rem; }
  .hub-modules { grid-template-columns: 1fr; }
}

.info-note {
  background: #fbf1d6; border: 1px solid #eddba0; color: #6b5400;
  padding: 0.75rem 1rem; border-radius: 6px; font-size: 0.85rem; margin-bottom: 1rem;
}
.info-note a { color: inherit; }
code { background: #eef1f5; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }

/* Small "i" that reveals a short explanation on hover / keyboard focus.
   Pure CSS, no JS. Replaces standing explanatory paragraphs. */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1rem; height: 1rem; margin-left: 0.35rem;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted);
  font-size: 0.68rem; font-style: normal; font-weight: 700; line-height: 1;
  cursor: help; vertical-align: middle; position: relative; user-select: none;
}
h1 .info-icon, h2 .info-icon, h3 .info-icon { width: 1.05rem; height: 1.05rem; }
.info-icon:hover, .info-icon:focus { border-color: var(--navy-light); color: var(--navy-light); outline: none; }
.info-pop {
  display: none; position: absolute; z-index: 30;
  top: calc(100% + 6px); left: 0;
  width: max-content; max-width: 280px;
  background: var(--navy); color: #eef2f8;
  padding: 0.5rem 0.7rem; border-radius: 6px;
  font-size: 0.78rem; font-weight: 400; font-style: normal; line-height: 1.45;
  text-align: left; white-space: normal;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.info-icon:hover .info-pop, .info-icon:focus .info-pop { display: block; }
.info-pop a { color: #cdd9ea; }

/* First-login walkthrough (public/js/walkthrough.js drives it; content from
   src/lib/walkthroughContent.js). The dim backdrop is the classic
   giant-box-shadow spotlight trick on .wt-spotlight itself, so there is no
   separate full-page scrim element to keep in sync with scroll position. */
.wt-overlay { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.wt-spotlight {
  position: fixed; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(11, 37, 69, 0.6);
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
  pointer-events: none;
}
.wt-tooltip {
  position: fixed; z-index: 1001; pointer-events: auto;
  width: min(320px, calc(100vw - 24px));
  background: white; border-radius: 8px; padding: 1rem 1.1rem;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}
.wt-step-count { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.3rem; }
.wt-tooltip h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.wt-tooltip p { font-size: 0.85rem; line-height: 1.45; margin-bottom: 0.9rem; }
.wt-actions { display: flex; align-items: center; justify-content: space-between; }
.wt-actions #wt-skip {
  background: none; border: none; color: var(--muted); font-size: 0.8rem;
  cursor: pointer; padding: 0.3rem 0;
}
.wt-actions #wt-skip:hover { color: var(--navy-light); text-decoration: underline; }
.wt-nav-btns { display: flex; gap: 0.5rem; }

/* ===========================================================================
   Responsive - phone and small-tablet layouts.
   Strategy:
   - Nav collapses to a hamburger / slide-down menu below 860px.
   - Multi-column form rows and filter bars stack to a single column below 820px.
   - Tables become their own horizontal-scroll region below 820px (the page
     itself never scrolls sideways) with the first column pinned. Consistent
     everywhere - list views, detail key/value tables, the roles matrix.
   - The reconciliation two-list workbench already stacks via .grid-2 (<=800px),
     so on mobile it is a sequential "pick a line, then pick a record" flow.
   =========================================================================== */

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 0.6rem 1rem; gap: 0.5rem; }
  .nav-toggle { display: flex; order: 2; margin-left: auto; }
  .topbar .user-info { order: 3; width: 100%; justify-content: space-between; font-size: 0.8rem; }

  .nav {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }
  .nav.open { display: flex; }
  .nav a {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--navy);
    border-left: 3px solid transparent;
  }
  .nav a:hover, .nav a.active { border-bottom-color: var(--navy); border-left-color: var(--gold); }

  /* Same two-group structure as desktop, just an inline expand/collapse
     in the drawer instead of a popover - the <details> markup is
     identical, only its presentation changes here. Collapsed by default
     (native <details> behaviour, no JS). */
  .nav-group summary {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--navy);
    border-left: 3px solid transparent;
  }
  .nav-group summary:hover, .nav-group summary.active { border-bottom-color: var(--navy); border-left-color: var(--gold); }
  .nav-group[open] summary { border-left-color: var(--gold); }
  .nav-group-menu {
    position: static; min-width: 0;
    background: rgba(0, 0, 0, 0.15); border: none; box-shadow: none;
  }
  .nav-group-menu a {
    padding: 0.75rem 1rem 0.75rem 2.1rem; /* extra indent - shows it's nested under the group */
    font-size: 0.9rem;
    border-bottom: 1px solid var(--navy);
  }
}

@media (max-width: 820px) {
  .container { padding: 1rem 0.85rem; }
  .landing { margin: 0 -0.85rem; }
  .card { padding: 1rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.05rem; }

  /* Forms: one column, comfortable touch targets. */
  .field-row { flex-direction: column; gap: 0; }
  .field input, .field select, .field textarea { padding: 0.65rem 0.6rem; font-size: 1rem; min-height: 44px; }
  .field textarea { min-height: 4rem; }
  .filters { gap: 0.6rem; }
  .filters .field { min-width: 0; width: 100%; }
  .filters .btn, .filters button { width: 100%; }

  /* Buttons: keep taps at least ~40px tall; stack action forms that sit
     directly on a card (member Spot / Remove, remittance actions, etc.). */
  .btn { padding: 0.6rem 1rem; }
  .btn-sm { padding: 0.45rem 0.7rem; }
  .card > div > form.inline, .card > form.inline { display: block; margin-bottom: 0.45rem; }
  .card > div > form.inline .btn, .card > form.inline .btn { width: 100%; }
  /* ...but forms inside a table cell stay inline so the row keeps its shape. */
  td form.inline { display: inline-block; margin-bottom: 0; }
  td form.inline .btn { width: auto; }

  /* Tables: own horizontal-scroll region, first column pinned, so the page
     itself never scrolls sideways. Same treatment for every table. */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table th, table td { white-space: nowrap; }
  table th:first-child, table td:first-child {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 1;
  }
  table td[colspan] { position: static; white-space: normal; }
  tr:hover td:first-child { background: #fafbfc; }

  /* Reconciliation: the stacked lists can wrap freely (vertical space is cheap
     on a phone) and the checkbox column gets a bigger tap target. */
  .recon-list table th, .recon-list table td { white-space: normal; }
  .recon-list input[type="checkbox"] { width: 22px; height: 22px; }

  .grid { gap: 0.75rem; }
  .stat .num { font-size: 1.6rem; }

  .info-pop { max-width: calc(100vw - 3rem); }
}
