/* Chile's de Las Cruces — Bowling Club Styles v3
   Colors: Chile green + Chile red (as a green chile grows and turns red)
   NM Zia symbol, Organ Mountains, Binational identity
*/

:root {
  --chile-green:  #1B5E20;   /* deep chile green — primary */
  --chile-green2: #2E7D32;   /* medium green — hover states */
  --chile-red:    #C62828;   /* chile red — accent + badges */
  --chile-red2:   #B71C1C;   /* dark red — hover */
  --sand:         #F3F5F3;   /* modern neutral, faint sage bias — background */
  --sand-dark:    #E4E9E4;   /* card borders / alt rows */
  --charcoal:     #1A1A1A;   /* body text */
  --white:        #FFFFFF;
  --gold:         #F9A825;   /* award accent */
  --slate:        #546E7A;   /* secondary text */
  --green-light:  #E8F5E9;   /* success bg */
  --red-light:    #FFEBEE;   /* error / unpaid bg */
  --red-text:     #B71C1C;
  --green-text:   #1B5E20;
  --radius:       6px;
  --shadow:       0 1px 3px rgba(0,0,0,0.15);
  --shadow-md:    0 4px 14px rgba(0,0,0,0.18);
}

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

@font-face {
  font-family: 'Public Sans';
  src: url('/static/fonts/PublicSans-Variable.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: 'Public Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--sand);
  color: var(--charcoal);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--chile-green); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--chile-green2); }

/* Cascade-layer fix: Tailwind v4 emits utilities inside @layer utilities, which
   lose to the un-layered `a { color }` rule above regardless of specificity — so
   `text-white` link-buttons (the active nav item on every page, and the officer
   "+ Add Member" button) rendered green-on-green and their labels vanished.
   Re-assert the intended white link text, un-layered, so it wins. */
a.text-white, a.text-white:hover { color: var(--white); }
code { font-family: monospace; font-size: .9em; background: var(--sand-dark); padding: .1rem .3rem; border-radius: 3px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--chile-green);
  color: var(--white);
  padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between;
  height: 58px; gap: 1rem;
}
.site-logo { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.logo-img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3)); }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { font-size: .95rem; font-weight: bold; color: var(--white); letter-spacing: .02em; }
.logo-sub  { font-size: .62rem; color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .1em; }
.logo-red-stripe { color: var(--chile-red); font-weight: bold; }

.header-nav { display: flex; align-items: center; gap: .85rem; font-size: .82rem; font-family: sans-serif; }
.header-nav a { color: rgba(255,255,255,.85); transition: color .15s; }
.header-nav a:hover { color: var(--white); text-decoration: none; }
.nav-logout { color: rgba(255,255,255,.5) !important; font-size: .78rem; }
.nav-playbook { background: rgba(255,255,255,.15); padding: .2rem .6rem; border-radius: var(--radius); font-weight: 600; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page-wrapper { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

.page-heading {
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 3px solid var(--chile-red);
}
.page-heading h1 { font-size: 1.5rem; color: var(--chile-green); font-weight: normal; }
.page-heading .sub { font-size: .82rem; color: var(--slate); margin-top: .2rem; font-family: sans-serif; }

/* ── Stats bar ───────────────────────────────────────────────────────────── */
.stats-bar { display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stat-card {
  background: var(--white); border: 1px solid #D5CBBA;
  border-radius: var(--radius); padding: .75rem 1rem;
  flex: 1; min-width: 100px; box-shadow: var(--shadow);
  border-top: 3px solid var(--chile-green);
}
.stat-card.red-top { border-top-color: var(--chile-red); }
.stat-number { font-size: 1.75rem; font-weight: bold; color: var(--chile-green); line-height: 1; }
.stat-number.red { color: var(--chile-red); }
.stat-number.slate { color: var(--slate); }
.stat-label  { font-size: .7rem; color: var(--slate); font-family: sans-serif; text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 160px; padding: .45rem .7rem;
  border: 1px solid #C5B9A5; border-radius: var(--radius);
  font-size: .88rem; background: var(--white); font-family: sans-serif;
}
.search-input:focus { outline: 2px solid var(--chile-green); border-color: var(--chile-green); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .42rem .85rem; border-radius: var(--radius);
  font-size: .83rem; font-family: sans-serif; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: filter .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(.88); text-decoration: none; }
.btn-primary   { background: var(--chile-green); color: var(--white); }
.btn-red       { background: var(--chile-red);   color: var(--white); }
.btn-secondary { background: var(--sand-dark);   color: var(--charcoal); border: 1px solid #C5B9A5; }
.btn-export    { background: var(--charcoal);    color: var(--white); }
.btn-danger    { background: #C62828; color: var(--white); }
.btn-gold      { background: var(--gold); color: var(--charcoal); }
.btn-sm        { padding: .22rem .5rem; font-size: .76rem; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: var(--chile-green); color: var(--white);
  padding: .55rem .8rem; text-align: left;
  font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--sand-dark); transition: background .1s; }
tbody tr:hover { background: #F0F4EE; }
tbody tr.row-bad    { background: #FFF3E0; }
tbody tr.row-inactive { opacity: .6; }
tbody tr.row-fuzzy  { background: #FFFDE7; }
tbody tr.row-nomatch{ background: var(--red-light); }
td { padding: .55rem .8rem; vertical-align: middle; }
.member-name    { font-weight: 600; font-family: Georgia, serif; }
.member-contact { font-size: .78rem; color: var(--slate); }
.member-number  { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; font-family: sans-serif;
}
.badge-active    { background: var(--green-light); color: var(--green-text); }
.badge-inactive  { background: #ECEFF1; color: #546E7A; }
.badge-loa       { background: #E3F2FD; color: #1565C0; }
.badge-bad       { background: #FFF3E0; color: #E65100; }
.badge-dropped   { background: #FFEBEE; color: var(--red-text); }
.badge-paid      { background: var(--green-light); color: var(--green-text); }
.badge-unpaid    { background: var(--red-light); color: var(--red-text); }
.badge-hof       { background: #FFF8E1; color: #F57F17; }
.badge-warn      { background: #FFF9C4; color: #827717; }
.badge-test      { background: #F3E5F5; color: #6A1B9A; }
.role-admin      { background: #FFF3E0; color: #E65100; }
.role-officer    { background: var(--green-light); color: var(--green-text); }

/* ── Flash messages ──────────────────────────────────────────────────────── */
.flash { white-space: pre-line;
  padding: .6rem 1rem; border-radius: var(--radius);
  font-family: sans-serif; font-size: .85rem; margin-bottom: .5rem;
}
.flash-success { background: var(--green-light); color: var(--green-text); border-left: 4px solid var(--chile-green); }
.flash-error   { background: var(--red-light);   color: var(--red-text);   border-left: 4px solid var(--chile-red); }
.flash-info    { background: #E3F2FD; color: #1565C0; border-left: 4px solid #1976D2; }
.flash-warn    { background: #FFF8E1; color: #F57F17; border-left: 4px solid #FFA000; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--white); border: 1px solid #D5CBBA;
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.form-group { display: flex; flex-direction: column; gap: .25rem; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--slate); font-family: sans-serif;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], textarea, select {
  padding: .45rem .7rem; border: 1px solid #C5B9A5;
  border-radius: var(--radius); font-size: .88rem;
  font-family: sans-serif; background: var(--white); width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--chile-green); border-color: var(--chile-green);
}
.form-actions {
  display: flex; gap: .6rem; margin-top: 1.25rem;
  padding-top: 1rem; border-top: 1px solid var(--sand-dark);
}
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 58px); display: flex;
  align-items: center; justify-content: center; padding: 2rem 1.25rem;
  background: linear-gradient(135deg, var(--chile-green) 0%, #2E7D32 50%, var(--chile-red) 100%);
}
.login-card {
  background: var(--white); border-radius: var(--radius);
  padding: 2rem 2.25rem; box-shadow: var(--shadow-md);
  width: 100%; max-width: 360px; text-align: center;
}
.login-logo  { font-size: 3rem; margin-bottom: .5rem; }
.login-card h2 { color: var(--chile-green); font-size: 1.2rem; margin-bottom: .15rem; }
.login-card .sub { font-size: .78rem; color: var(--slate); font-family: sans-serif; margin-bottom: 1.5rem; }
.login-card .form-group { text-align: left; }
.login-hint { font-size: .75rem; color: var(--slate); font-family: sans-serif; margin-top: 1rem; line-height: 1.4; }

/* ── Member hero card ────────────────────────────────────────────────────── */
.member-hero {
  background: linear-gradient(135deg, var(--chile-green) 0%, #2E7D32 100%);
  color: var(--white); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.member-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--chile-red); color: var(--white);
  font-size: 1.5rem; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.member-hero-left { display: flex; align-items: center; gap: 1rem; }
.member-hero-name { font-size: 1.3rem; font-weight: normal; margin-bottom: .1rem; }
.member-hero-sub  { font-size: .78rem; color: rgba(255,255,255,.7); font-family: sans-serif; }
.member-hero-stats { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat-val   { font-size: 1.4rem; font-weight: bold; line-height: 1; }
.hero-stat-label { font-size: .68rem; color: rgba(255,255,255,.65); font-family: sans-serif; text-transform: uppercase; letter-spacing: .06em; margin-top: .2rem; }
.stat-paid   { color: #A5D6A7; }
.stat-unpaid { color: #EF9A9A; }

/* ── Dashboard grid ──────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.dash-card {
  background: var(--white); border: 1px solid #D5CBBA;
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow);
}
.dash-card-wide { grid-column: 1 / -1; }
.dash-card-title {
  font-size: .95rem; color: var(--chile-green);
  margin-bottom: .85rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--chile-red);
}

/* ── Standings ───────────────────────────────────────────────────────────── */
.standings-list { display: flex; flex-direction: column; gap: .25rem; }
.standings-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .4rem .6rem; border-radius: 4px;
  font-family: sans-serif; font-size: .85rem;
}
.standings-row:hover { background: var(--sand); }
.standings-me { background: #E8F5E9 !important; font-weight: 600; border-left: 3px solid var(--chile-green); }
.standings-rank { width: 1.5rem; color: var(--slate); text-align: right; font-size: .78rem; flex-shrink: 0; }
.standings-name { flex: 1; }
.standings-name em { color: var(--slate); font-style: normal; font-size: .8rem; }
.standings-avg  { color: var(--chile-green); font-weight: 600; }
.standings-hof  { color: var(--gold); font-size: .75rem; }

/* ── Awards ──────────────────────────────────────────────────────────────── */
.award-row { padding: .6rem 0; border-bottom: 1px solid var(--sand-dark); }
.award-row:last-child { border-bottom: none; }
.award-type   { font-weight: 600; font-size: .85rem; font-family: sans-serif; color: var(--chile-green); }
.award-detail { font-size: .78rem; color: var(--slate); font-family: sans-serif; }
.award-value  { font-size: .85rem; font-family: sans-serif; margin-top: .1rem; }

/* ── Ntfy QR / notification setup ───────────────────────────────────────── */
.notif-setup {
  background: var(--sand); border: 1px solid #D5CBBA;
  border-radius: var(--radius); padding: 1rem;
  margin-top: .75rem;
}
.notif-qr {
  display: flex; gap: 1.5rem; align-items: flex-start;
  flex-wrap: wrap;
}
.notif-qr img { border: 3px solid var(--white); border-radius: 4px; box-shadow: var(--shadow); }
.notif-qr-info { font-family: sans-serif; font-size: .83rem; }
.notif-qr-info strong { display: block; margin-bottom: .3rem; color: var(--chile-green); }

/* ── Status warning banner ───────────────────────────────────────────────── */
.status-warning {
  background: #FFF3E0; border: 1px solid #FFB74D;
  border-left: 4px solid #E65100;
  border-radius: var(--radius); padding: .75rem 1rem;
  font-family: sans-serif; font-size: .85rem;
  margin-bottom: 1rem; color: #BF360C;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 2rem 1rem;
  color: var(--slate); font-family: sans-serif; font-size: .9rem;
}

/* ── Upcoming tournament card ────────────────────────────────────────────── */
.tournament-card {
  background: var(--white); border: 1px solid #D5CBBA;
  border-radius: var(--radius); padding: 1rem 1.25rem;
  border-left: 4px solid var(--chile-red);
  box-shadow: var(--shadow);
}
.tournament-card-name { font-weight: 600; color: var(--chile-green); font-size: .95rem; }
.tournament-card-date { font-family: sans-serif; font-size: .82rem; color: var(--slate); }
.tournament-card-venue { font-family: sans-serif; font-size: .82rem; }

/* ── Association directory ───────────────────────────────────────────────── */
.club-card {
  background: var(--white); border: 1px solid #D5CBBA;
  border-radius: var(--radius); padding: 1rem 1.25rem;
  box-shadow: var(--shadow); border-top: 3px solid var(--chile-green);
}
.club-card-name { font-weight: 600; color: var(--chile-green); font-size: .95rem; margin-bottom: .5rem; }
.club-contact-row { font-family: sans-serif; font-size: .82rem; padding: .2rem 0; border-bottom: 1px solid var(--sand-dark); }
.club-contact-row:last-child { border-bottom: none; }
.club-role { color: var(--slate); font-size: .75rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .member-hero { flex-direction: column; align-items: flex-start; }
  .member-hero-stats { gap: .85rem; }
  .stats-bar { gap: .5rem; }
  .stat-card { min-width: 80px; padding: .6rem .75rem; }
  .stat-number { font-size: 1.4rem; }
  .logo-sub { display: none; }
}

@media (min-width: 900px) {
  .dashboard-grid { grid-template-columns: 2fr 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════
   VISUAL OVERHAUL v3.1 — Organ Mountains, mobile cards, polish
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Organ Mountains silhouette ──────────────────────────────────────────── */
.mountains-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  color: var(--chile-green);
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.mountains-bg img { width: 100%; height: 100%; display: block; }

.login-wrap { position: relative; overflow: hidden; }
.login-wrap .mountains-bg { height: 180px; opacity: 0.12; color: var(--white); }

.page-wrapper { position: relative; }
.page-wrapper > .mountains-bg { height: 90px; }

/* ── Login page refinement ──────────────────────────────────────────────── */
.login-wrap {
  background: linear-gradient(160deg, var(--chile-green) 0%, #1B5E20 45%, var(--chile-red) 100%);
}
.login-card {
  position: relative;
  z-index: 1;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

/* ── Animated stat numbers ──────────────────────────────────────────────── */
.stat-number, .hero-stat-val {
  transition: opacity 0.3s ease;
}
.stat-number.counting, .hero-stat-val.counting {
  opacity: 0.4;
}

/* ── Member hero polish ─────────────────────────────────────────────────── */
.member-hero {
  position: relative;
  overflow: hidden;
}
.member-hero::after {
  content: '';
  position: absolute;
  top: -20%;
  right: -5%;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Mobile card-based roster (replaces table on small screens) ─────────── */
.roster-cards { display: none; }

@media (max-width: 720px) {
  .table-wrap { display: none; }
  .roster-cards { display: flex; flex-direction: column; gap: .6rem; }

  .roster-card {
    background: var(--white);
    border: 1px solid #D5CBBA;
    border-radius: 10px;
    padding: .85rem 1rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--chile-green);
  }
  .roster-card.is-bad     { border-left-color: var(--chile-red); background: #FFF8F0; }
  .roster-card.is-inactive{ opacity: .6; border-left-color: var(--slate); }

  .roster-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: .5rem;
  }
  .roster-card-name {
    font-family: Georgia, serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--chile-dark, var(--chile-green));
  }
  .roster-card-username {
    font-family: monospace;
    font-size: .72rem;
    color: var(--slate);
    background: var(--sand-dark);
    padding: .1rem .4rem;
    border-radius: 4px;
  }
  .roster-card-stats {
    display: flex;
    gap: 1rem;
    font-family: sans-serif;
    font-size: .82rem;
    margin-bottom: .6rem;
    flex-wrap: wrap;
  }
  .roster-card-stats span strong { color: var(--chile-green); }
  .roster-card-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    padding-top: .5rem;
    border-top: 1px solid var(--sand-dark);
  }
  .roster-card-actions select {
    font-size: .75rem;
    padding: .25rem .4rem;
  }
}

/* ── Dark hero gradient enhancement ──────────────────────────────────────── */
.member-hero {
  background: linear-gradient(135deg, var(--chile-green) 0%, #2E7D32 55%, #1B5E20 100%);
}

/* ── Card hover lift ──────────────────────────────────────────────────────── */
.dash-card, .form-card, .club-card, .tournament-card, .stat-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.dash-card:hover, .club-card:hover, .tournament-card:hover {
  box-shadow: var(--shadow-md);
}

/* ── Logo subtle glow on login ──────────────────────────────────────────── */
.login-card img {
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

/* ── Smooth page transitions ─────────────────────────────────────────────── */
.page-wrapper, .login-wrap {
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Refined empty states ────────────────────────────────────────────────── */
.empty-state {
  background: var(--white);
  border: 1px dashed #D5CBBA;
  border-radius: var(--radius);
}

/* ── Avatar polish with chile accent ──────────────────────────────────────── */
.member-avatar {
  position: relative;
  background: linear-gradient(135deg, var(--chile-red) 0%, #B71C1C 100%);
}
.member-avatar::after {
  content: '🌶️';
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: .85rem;
  background: var(--white);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE NAV — hamburger menu
   ═══════════════════════════════════════════════════════════════════════ */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.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); }

@media (max-width: 760px) {
  .header-inner { flex-wrap: nowrap; }
  .logo-text { display: none; }
  .logo-img { width: 38px; height: 38px; }

  .nav-toggle { display: flex; }

  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--chile-green);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem 0;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 200;
  }
  .header-nav.nav-open { display: flex; }
  .header-nav a {
    padding: .7rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    width: 100%;
  }
  .header-nav a:last-child { border-bottom: none; }
  .nav-playbook { display: inline-block; }
  .nav-logout { color: rgba(255,255,255,.7) !important; }
}

.site-header { position: sticky; top: 0; z-index: 150; }

/* ── Top nav (2026-09-25) ────────────────────────────────────────────────────
   Markup in templates/base.html. Plain CSS on purpose: tailwind.css is a purged
   build, so new utility classes would not exist. Tiers:
     ≥1200px  full pills + "(username)" on Log out
     900-1199 compact pills, logo only (brand text hidden) so the row still fits
     <900px   ☰ button; the nav becomes a stacked panel under the header       */
.topbar { position: relative; }
.topnav { display: flex; align-items: center; gap: .375rem; flex: 1 1 auto; min-width: 0; }
.topnav ul { list-style: none; margin: 0; padding: 0; }
.topnav-main { display: flex; align-items: center; gap: .375rem; flex-wrap: nowrap; min-width: 0; }
.topnav-side { display: flex; align-items: center; gap: .375rem; margin-left: auto; flex-shrink: 0; }
.topnav li { position: relative; }
.navpill {
  display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap;
  padding: .375rem .75rem; border-radius: 9999px; border: 1px solid var(--sand-dark);
  background: var(--white); color: var(--charcoal); font: inherit; font-size: .875rem; font-weight: 500;
  line-height: 1.25rem; cursor: pointer; text-decoration: none; transition: color .15s, border-color .15s, background-color .15s;
}
.navpill:hover { border-color: var(--chile-green); color: var(--chile-green); text-decoration: none; }
.navpill:focus-visible { outline: 2px solid var(--chile-green); outline-offset: 2px; }
.navpill.is-active { background: var(--nav-active-bg, var(--chile-green)); color: var(--nav-active-fg, var(--white)); border-color: var(--nav-active-bg, var(--chile-green)); }
.navpill-playbook { background: color-mix(in srgb, var(--gold) 15%, var(--white)); border-color: transparent; color: #8a6100; }
.navpill-playbook:hover { background: color-mix(in srgb, var(--gold) 25%, var(--white)); border-color: transparent; color: #8a6100; }
.navpill-logout { border-color: transparent; color: var(--charcoal); font-weight: 400; }
.navpill-logout:hover { border-color: transparent; color: var(--chile-red); }
.navpill-login { background: var(--chile-red); border-color: var(--chile-red); color: var(--white); font-weight: 600; padding: .5rem 1rem; }
.navpill-login:hover { background: var(--chile-red2, var(--chile-red)); border-color: var(--chile-red2, var(--chile-red)); color: var(--white); }
.navcaret { font-size: .7em; margin-left: .1rem; }
.navmenu {
  display: none; position: absolute; top: calc(100% + .375rem); left: 0; z-index: 60; min-width: 12rem;
  margin: 0; padding: .375rem; background: var(--white); border: 1px solid var(--sand-dark);
  border-radius: .75rem; box-shadow: var(--shadow-md);
}
.navdrop.is-open > .navmenu { display: block; }
.navmenu a { display: block; white-space: nowrap; padding: .5rem .75rem; border-radius: .5rem; font-size: .875rem; color: var(--charcoal); text-decoration: none; }
.navmenu a:hover, .navmenu a:focus-visible { background: var(--sand); color: var(--chile-green); outline: none; text-decoration: none; }
.navmenu a.is-active { font-weight: 600; color: var(--chile-green); }
.navburger { display: none; }
@media (max-width: 1199.98px) {
  .navpill { padding: .3rem .55rem; font-size: .8125rem; }
  .navuser { display: none; }
}
@media (min-width: 900px) and (max-width: 1199.98px) {
  .topbrand > span { display: none !important; }   /* logo only; the row must fit */
}
@media (max-width: 899.98px) {
  .navburger {
    display: inline-flex; align-items: center; gap: .5rem; margin-left: auto; padding: .4rem .7rem;
    border: 1px solid var(--sand-dark); border-radius: .5rem; background: var(--white); color: var(--charcoal);
    font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
  }
  .navburger:focus-visible { outline: 2px solid var(--chile-green); outline-offset: 2px; }
  .navburger-bars { display: flex; flex-direction: column; gap: 4px; }
  .navburger-bars span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
  .topnav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 60;
    flex-direction: column; align-items: stretch; gap: 0; padding: .5rem 1rem 1rem;
    background: var(--white); border-bottom: 1px solid var(--sand-dark); box-shadow: var(--shadow-md);
    max-height: calc(100vh - 4rem); overflow-y: auto;
  }
  .topnav.is-open { display: flex; }
  .topnav-main, .topnav-side { flex-direction: column; align-items: stretch; gap: .25rem; margin: 0; }
  .topnav-side { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--sand-dark); }
  .navpill { width: 100%; justify-content: flex-start; border-radius: .5rem; padding: .55rem .75rem; font-size: .9375rem; }
  .navpill-login { justify-content: center; }
  .navuser { display: inline; }
  .navmenu { position: static; min-width: 0; margin: .125rem 0 .25rem .75rem; padding: 0 0 0 .5rem; border: 0; border-left: 2px solid var(--sand-dark); border-radius: 0; box-shadow: none; }
}

/* ── Officer KPI strip (2026-09-25, shared rule for both clubs) ─────────────── */
.kpi-grid { display: flex; gap: .75rem; margin: 0 -1rem 1.75rem; padding: 0 1rem .25rem; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.kpi-grid > * { flex: 0 0 150px; min-width: 0; scroll-snap-align: start; }
@media (min-width: 640px) {
  .kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 1.75rem; padding: 0; overflow: visible; }
  .kpi-grid > * { flex: none; }
}
@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(var(--tiles, 6), minmax(0, 1fr)); }
}

  /* "Add" form behind a button (2026-10-06): one component on every officer page that uses it. */
  .addbox > summary { list-style: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
    padding: .55rem 1.15rem; border-radius: 9999px; font-weight: 600; font-size: .9rem; cursor: pointer;
    user-select: none; }
  .addbox > summary::-webkit-details-marker { display: none; }
  .addbox > summary:focus-visible { outline: 3px solid var(--sand-dark, #ccc); outline-offset: 2px; }
  .addbox[open] > summary { background: #fff !important; color: inherit !important; border: 1px solid var(--sand-dark, #ccc); }
  .addbox .when-open { display: none; } .addbox[open] .when-open { display: inline; } .addbox[open] .when-closed { display: none; }

/* Temporary password shown big on its own line (2026-10-10) */
.tempbox { display:block; margin:.5rem 0; padding:.35rem .6rem; font:700 2rem/1.2 ui-monospace,Menlo,Consolas,monospace; letter-spacing:.04em; background:rgba(255,255,255,.7); border-radius:6px; word-break:break-all; user-select:all; }

/* ── Shared-code additions (Chiles stage 5, 10/20/2026): rules the shared pages use that Chiles' own sheet never had ──
.badge-male { background: #E3F2FD; color: #1565C0; }
.badge-female { background: #FCE4EC; color: #880E4F; }
.chat-msg { padding: .5rem .75rem; border-radius: var(--radius); margin-bottom: .5rem; line-height: 1.5; max-width: 90%; }
.chat-user { background: var(--chile-green); color: white; margin-left: auto; text-align: right; }
.chat-assistant { background: white; border: 1px solid #D0D0D0; }
.chat-thinking { background: white; border: 1px solid #D0D0D0; color: var(--slate); font-style: italic; }
