/* GymFlow — design system
 *
 * Charcoal, warm white and one lime accent. Surfaces stay quiet; the accent is
 * spent on the brand mark, the scoreboard units and the main action in the dark.
 *
 * Contrast rule: bright lime (--gold) only ever sits on charcoal. On light
 * backgrounds use --gold-ink (olive). Lime on white is 1.3:1 and must never be used.
 * The variable names (--emerald-*, --gold*) are kept from the first palette so
 * every view keeps working; read them as "club colour" and "accent".
 * Archivo's width axis does the expressive work: body text at normal width,
 * headings semi-condensed, and the big figures condensed and tabular, like a
 * gym scoreboard. Everything else stays quiet.
 */

:root {
  /* Palette: deep emerald and satin gold.
     Rich surfaces (sidebar, scoreboard, portal, membership card) are emerald;
     working areas stay light. Bright gold is only ever placed on emerald;
     gold text on a light background uses --gold-ink. */
  --ink: #141619;
  --slate: #5b6168;          /* secondary text: 6.4:1 on white */
  --mute: #878c93;           /* icons and rules only, never small text */
  --paper: #f6f6f3;
  --card: #ffffff;
  --line: #e8e8e4;
  --line-strong: #d5d5d0;

  --emerald-deep: #121418;   /* the club colour */
  --emerald-panel: #1a1d22;
  --emerald-raise: #24282e;
  --emerald: #16181d;        /* actions: 6.2:1 with white */
  --emerald-dark: #2c3037;
  --emerald-tint: #efefeb;
  --gold: #c8f25a;           /* on emerald only: 7.3:1 */
  --gold-ink: #4f6a00;       /* gold text on light: 5.4:1 */
  --gold-line: rgba(200, 242, 90, .38);
  --gold-tint: #f1f8dc;

  --forest: var(--emerald);
  --forest-dark: var(--emerald-dark);
  --forest-tint: var(--emerald-tint);
  --brass: var(--gold-ink);
  --brass-dark: #3d5200;
  --brass-tint: var(--gold-tint);

  /* Status, from weight-plate colours */
  --green: #1b7f4e;  --green-tint: #e5f3eb;  --green-ink: #125c38;
  --yellow: #b7791f; --yellow-tint: #fbf0dc; --yellow-ink: #7a4d0e;
  --red: #b42318;    --red-tint: #fbe8e6;    --red-ink: #8c1c13;
  --blue: #1d5b96;   --blue-tint: #e6eef7;   --blue-ink: #174a7a;
  --grey-tint: #efefec;

  /* Legacy aliases, so older markup keeps working */
  --brand: var(--forest);
  --brand-dark: var(--forest-dark);
  --brand-tint: var(--forest-tint);
  --amber: var(--brass);
  --amber-tint: var(--brass-tint);
  --ink-2: var(--slate);
  --ink-3: var(--slate);

  /* Type */
  --font: "Archivo", "Noto Sans Ethiopic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fs-body: .9375rem;       /* 15px */
  --fs-small: .8125rem;      /* 13px — the smallest size used for text */

  /* Shape: small controls, larger containers, pills for status */
  --r-control: 8px;
  --r-panel: 12px;
  --shadow-float: 0 12px 32px rgba(17, 20, 24, .14), 0 2px 6px rgba(17, 20, 24, .06);

  --sidebar-w: 240px;
}

/* ------------------------------------------------------------------ base */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-stretch: 88%;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--ink);
  line-height: 1.2;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1875rem; }
h3 { font-size: 1rem; }
a { color: var(--forest); text-decoration: none; }
a:hover { color: var(--forest-dark); text-decoration: underline; text-underline-offset: 2px; }
/* Links sitting inside running text must not rely on colour alone (WCAG 1.4.1). */
p a, .form-text a, .alert a, label a, .small a:not(.btn), .text-muted a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
.skip-link {
  position: absolute; left: .5rem; top: -4rem; z-index: 2000;
  padding: .55rem .9rem; border-radius: 8px; background: var(--forest); color: #fff; font-weight: 600;
}
.skip-link:focus { top: .5rem; color: #fff; outline: 2px solid var(--gold); }
.text-muted, .text-dim { color: var(--slate) !important; }
.tnum, .table td, .stat-value, .kv dd { font-variant-numeric: tabular-nums; }
.fw-650 { font-weight: 650; }
.fw-700 { font-weight: 700; }
/* Bootstrap 5.3 ships min-vw-100 and min-vh-100 but no min-w-0, and 27 views use
   it to let a truncating label shrink inside a flex row. Without it those rows
   cannot go below their text width and narrow screens scroll sideways. */
.min-w-0 { min-width: 0; }
small, .small { font-size: var(--fs-small); }

/* Member IDs and receipt numbers: tabular, lightly spaced, same family.
   Kept as a class name for compatibility; no monospace. */
.mono {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  font-size: .95em;
}

:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ shell */
.layout { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1045;
  background: var(--emerald-deep); color: #e2e4e7;
  display: flex; flex-direction: column;
  transition: transform .2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.15rem 1.15rem 1rem; margin-bottom: .25rem;
  color: #fff; font-weight: 700; font-stretch: 85%; font-size: 1.0625rem; letter-spacing: -.005em;
  border-bottom: 1px solid var(--gold-line);
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.sidebar-brand .mark {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  background: var(--gold); color: var(--emerald-deep);
  display: grid; place-items: center; font-size: 1rem;
}
.sidebar-scroll { overflow-y: auto; flex: 1; padding: .35rem .65rem 1rem; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }

.nav-section {
  padding: 1rem .6rem .3rem; font-size: var(--fs-small); font-weight: 500;
  color: #8f959d; letter-spacing: 0; text-transform: none;
}
.sidebar .nav-link {
  position: relative; display: flex; align-items: center; gap: .7rem;
  padding: .45rem .65rem; margin: 1px 0;
  color: #e2e4e7; font-size: .9375rem; border-radius: var(--r-control); border-left: 0;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 1.15rem; text-align: center; color: #8f959d; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar .nav-link:hover i { color: #e2e4e7; }
.sidebar .nav-link.active { background: var(--emerald-raise); color: #fff; font-weight: 600; }
.sidebar .nav-link.active i { color: var(--gold); }
.sidebar .nav-link.active::before {
  content: ""; position: absolute; left: -.65rem; top: .45rem; bottom: .45rem;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}

.sidebar-foot {
  padding: .85rem 1.15rem; border-top: 1px solid rgba(255,255,255,.08);
  font-size: var(--fs-small); color: #a8adb4;
}
.sidebar-foot .text-white { color: #fff !important; }
.sidebar-foot .btn-link { color: #a8adb4 !important; font-size: var(--fs-small); }
.sidebar-foot .btn-link:hover { color: var(--gold) !important; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030;
  background: var(--paper);
  padding: 1rem 1.75rem .75rem; display: flex; align-items: center; gap: .75rem; min-height: 64px;
}
.topbar .btn-outline-secondary { background: var(--card); }
.topbar h1 { font-size: 1.55rem; margin: 0; font-stretch: 85%; font-weight: 650; letter-spacing: -.012em; }
.content { padding: .5rem 1.75rem 3rem; flex: 1; }
.content-narrow { max-width: 760px; }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 11, 13, .55); z-index: 1040; display: none; }
body.sidebar-open .sidebar-backdrop { display: block; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-float); }
  body.sidebar-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .topbar { padding: .75rem 1rem .5rem; background: var(--paper); border-bottom: 1px solid var(--line); }
  .topbar h1 { font-size: 1.25rem; }
  .content { padding: 1rem 1rem 4rem; }
}

/* ------------------------------------------------------------------ panels
   One level: hairline border, no shadow. Shadows are kept for things that float. */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: none;
}
.card-header {
  background: transparent; border-bottom: 1px solid var(--line);
  padding: .85rem 1.1rem; font-weight: 600; font-stretch: 92%; font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.card-header a { font-weight: 500; font-stretch: 100%; font-size: var(--fs-small); }
.card-body { padding: 1.1rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); padding: .75rem 1.1rem; }

/* A panel of stats reads as one scoreboard rather than four boxes */
.scoreboard {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--emerald-deep); border-radius: var(--r-panel);
  margin-bottom: 1.25rem; overflow: hidden;
  border-top: 2px solid var(--gold);
}
.scoreboard .stat {
  display: block; padding: 1.2rem 1.35rem 1.1rem; background: none; border: 0; border-radius: 0;
  border-left: 1px solid rgba(255,255,255,.08); color: #fff;
}
.scoreboard .stat:first-child { border-left: 0; }
.scoreboard a.stat:hover { background: rgba(255,255,255,.04); text-decoration: none; color: #fff; }
.scoreboard .stat-value {
  font-stretch: 70%; font-weight: 600; font-size: 2.7rem; line-height: 1; letter-spacing: -.005em;
  font-variant-numeric: tabular-nums; margin: 0; color: #fff;
}
.scoreboard .stat-unit { font-stretch: 85%; font-size: .95rem; font-weight: 500; color: var(--gold); margin-left: .25rem; }
.scoreboard .stat-label {
  margin-top: .5rem; font-size: var(--fs-small); color: #a8adb4;
  text-transform: none; letter-spacing: 0; font-weight: 500;
}
.scoreboard .stat.attention .stat-value { color: var(--gold); }

/* A lighter scoreboard for inside a page (the member's current plan) */
.scoreboard.scoreboard-light { background: var(--card); border: 1px solid var(--line); border-top: 2px solid var(--gold); }
.scoreboard.scoreboard-light .stat { color: var(--ink); border-left-color: var(--line); }
.scoreboard.scoreboard-light .stat-value { color: var(--ink); }
.scoreboard.scoreboard-light .stat-label { color: var(--slate); }
.scoreboard.scoreboard-light .stat.attention .stat-value { color: var(--gold-ink); }

@media (max-width: 767.98px) {
  .scoreboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scoreboard .stat:nth-child(3) { border-left: 0; }
  .scoreboard .stat:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.08); }
  .scoreboard.scoreboard-light .stat:nth-child(n+3) { border-top-color: var(--line); }
  .scoreboard .stat-value { font-size: 2.15rem; }
}

/* Standalone stat blocks elsewhere (reports, admin) */
.stat {
  display: block; padding: 1rem 1.1rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-panel); height: 100%; color: var(--ink);
}
a.stat:hover { border-color: var(--line-strong); text-decoration: none; color: var(--ink); }
.stat-label { font-size: var(--fs-small); color: var(--slate); font-weight: 500; text-transform: none; letter-spacing: 0; }
.stat-value {
  font-stretch: 75%; font-weight: 650; font-size: 1.9rem; line-height: 1.1; margin-top: .15rem;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: var(--fs-small); color: var(--slate); }
.stat-icon { display: none; }   /* decorative icon squares removed */

/* Tints kept for the few places that use them meaningfully */
.bg-brand-tint { background: var(--forest-tint); color: var(--forest); }
.bg-amber-tint { background: var(--brass-tint); color: var(--brass); }
.bg-green-tint { background: var(--green-tint); color: var(--green); }
.bg-red-tint { background: var(--red-tint); color: var(--red); }
.bg-blue-tint { background: var(--blue-tint); color: var(--blue); }
.bg-grey-tint { background: var(--grey-tint); color: var(--slate); }

/* ------------------------------------------------------------------ status */
.badge-plate {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .55rem .2rem; border-radius: 999px;
  font-size: var(--fs-small); font-weight: 550; line-height: 1.35; white-space: nowrap;
}
.badge-plate::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.plate-green { background: #e2f2e9; color: var(--green-ink); }
.plate-yellow { background: var(--yellow-tint); color: var(--yellow-ink); }
.plate-red { background: var(--red-tint); color: var(--red-ink); }
.plate-blue { background: var(--blue-tint); color: var(--blue-ink); }
.plate-grey { background: var(--grey-tint); color: var(--slate); }

/* ------------------------------------------------------------------ tables */
.table-card { overflow: hidden; }
.table-card .table { margin: 0; }
.table { color: var(--ink); --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .75rem 1rem; border-bottom-color: var(--line); }
.table thead th {
  background: transparent; border-bottom: 1px solid var(--line);
  font-size: var(--fs-small); color: var(--slate); font-weight: 550;
  text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover tbody tr:hover > * { background: #fafaf8; }
.table td { vertical-align: middle; }

/* ------------------------------------------------------------------ people */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
  background: var(--emerald-deep); color: var(--gold);
  display: inline-grid; place-items: center;
  font-weight: 650; font-stretch: 85%; font-size: .875rem; text-transform: uppercase;
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.35rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 2rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------ forms */
.form-label { font-weight: 550; font-size: var(--fs-small); margin-bottom: .35rem; color: var(--ink); }
.form-control, .form-select {
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  padding: .55rem .75rem; font-size: var(--fs-body); background-color: #fff; color: var(--ink);
  font-family: var(--font);
}
.form-control:hover, .form-select:hover { border-color: #bdbdb7; }
/* :focus-within too: when Tab lands on a date field's built-in calendar button the input stops matching :focus in Chromium. */
.form-control:focus, .form-control:focus-within, .form-select:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(17, 20, 24, .14); }
.form-control::placeholder { color: #8e939a; }
.form-text { font-size: var(--fs-small); color: var(--slate); }
.input-group-text { background: var(--paper); border-color: var(--line-strong); color: var(--slate); font-size: var(--fs-small); }
.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--forest); border-color: var(--forest); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(17, 20, 24, .14); border-color: var(--forest); }
.form-switch .form-check-input { width: 2.1em; height: 1.15em; }
.invalid-feedback { font-size: var(--fs-small); color: var(--red); }
.is-invalid { border-color: var(--red) !important; }
.required::after { content: " *"; color: var(--red); }
fieldset { border: 0; }
.fieldset-title {
  font-size: 1rem; font-weight: 600; font-stretch: 92%; color: var(--ink);
  text-transform: none; letter-spacing: 0;
  margin: 1.6rem 0 .75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); border-bottom: 0;
}
.fieldset-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* ------------------------------------------------------------------ buttons */
.btn {
  border-radius: var(--r-control); font-weight: 550; font-size: .9375rem;
  padding: .5rem 1rem; font-family: var(--font); letter-spacing: 0;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(17, 20, 24, .25); }
.btn-primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--forest-dark) !important; border-color: var(--forest-dark) !important; }
.btn-outline-secondary { border-color: var(--line-strong); color: var(--ink); background: #fff; }
.btn-outline-secondary:hover { background: var(--paper); border-color: #bdbdb7; color: var(--ink); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-outline-danger { --bs-btn-color: var(--red); --bs-btn-border-color: var(--red); --bs-btn-hover-bg: var(--red); --bs-btn-hover-border-color: var(--red); --bs-btn-active-bg: var(--red-ink); --bs-btn-active-border-color: var(--red-ink); }
[data-theme="dark"] .btn-outline-danger { --bs-btn-color: var(--red-ink); --bs-btn-border-color: var(--red-ink); --bs-btn-hover-bg: var(--red-ink); --bs-btn-hover-border-color: var(--red-ink); --bs-btn-hover-color: #1a0f0e; }
/* The member app's outline buttons. Bootstrap's own blue is off-palette here and
   only 3.3:1 on the dark card; the brand emerald is 6.2:1 on white and 7.4:1 on it. */
.btn-outline-primary { --bs-btn-color: var(--emerald); --bs-btn-border-color: var(--emerald); --bs-btn-hover-bg: var(--emerald); --bs-btn-hover-border-color: var(--emerald); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--forest-dark); --bs-btn-active-border-color: var(--forest-dark); }
[data-theme="dark"] .btn-outline-primary { --bs-btn-hover-color: #0d0f12; --bs-btn-active-bg: var(--emerald); --bs-btn-active-border-color: var(--emerald); --bs-btn-active-color: #0d0f12; }
/* The one accent in the app: scanning people in */
.btn-scan, .btn-amber { background: var(--gold); border-color: var(--gold); color: var(--emerald-deep); font-weight: 650; }
.btn-scan:hover, .btn-amber:hover, .btn-scan:focus { background: #b6e03f; border-color: #b6e03f; color: var(--emerald-deep); }
.btn-sm { padding: .32rem .7rem; font-size: var(--fs-small); }
.btn-lg { padding: .72rem 1.3rem; font-size: 1rem; }
.btn-icon { display: inline-flex; align-items: center; gap: .45rem; }
.btn-quiet { background: none; border: 0; color: var(--slate); padding: .3rem .4rem; }
.btn-quiet:hover { color: var(--ink); background: var(--paper); }

/* Touch devices need a bigger hit area than a mouse does. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { padding: .45rem .75rem; min-height: 38px; }
  .topbar .btn { min-height: 40px; min-width: 40px; }
  .sidebar .nav-link { padding: .6rem .6rem; }
  .sidebar-foot .btn-link { padding: .5rem 0; min-height: 38px; }
  .table td .btn-sm, .table th .btn-sm { min-height: 36px; }
  .card-footer .btn-sm { min-height: 40px; }
  .filters .btn { min-height: 44px; }
  .portal-tabs a { min-height: 54px; }
  .page-link { padding: .5rem .75rem; min-width: 36px; text-align: center; }
  /* Icon-only controls are tall enough already but far too narrow to tap. */
  .btn-tap { min-width: 36px; }
  /* 16px stops iOS Safari zooming the page when a field is focused. */
  .form-control, .form-select, .input-group-text { font-size: 1rem; }
  /* Switches and checkboxes: the whole row is the tap target. */
  .form-check { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; padding-left: 0; }
  .form-check .form-check-input { float: none; margin: 0; width: 1.35em; height: 1.35em; flex: 0 0 auto; }
  .form-switch .form-check-input { width: 2.4em; height: 1.35em; }
  .form-check .form-check-label { padding: .5rem 0; }
}

/* A switch sitting alone in a table cell: the whole cell-sized label is the tap target. */
.switch-cell { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; padding: 0; cursor: pointer; }
.switch-cell .form-check-input { float: none; margin: 0; }

/* ------------------------------------------------------------------ lists */
.list-plain { list-style: none; margin: 0; padding: 0; }
.divide-y > * + * { border-top: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.1rem; }
.row-item .meta { font-size: var(--fs-small); color: var(--slate); }
.row-item .figure { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------------ empty */
.empty { text-align: center; padding: 2.75rem 1.25rem; color: var(--slate); }
.empty i { font-size: 2rem; color: var(--mute); opacity: .7; display: block; margin-bottom: .75rem; }
.empty h2, .empty h3 { font-size: 1rem; color: var(--ink); margin-bottom: .3rem; font-stretch: 92%; }
.empty p { max-width: 42ch; margin-left: auto; margin-right: auto; }

/* ------------------------------------------------------------------ misc */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .form-control, .filters .form-select { min-width: 140px; }
.impersonation-bar {
  background: var(--gold); color: var(--emerald-deep); padding: .5rem 1.5rem; font-size: var(--fs-small); font-weight: 550;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.impersonation-bar .btn { background: var(--emerald-deep); color: #fff; border: 0; }

.toast-host { position: fixed; top: 1rem; right: 1rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, 92vw); }
.toast-item {
  background: var(--emerald-deep); color: #fff; border-radius: var(--r-control); box-shadow: var(--shadow-float);
  border-left: 3px solid var(--gold);
  padding: .75rem .9rem; font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start;
  animation: toastIn .2s ease;
}
.toast-item i { margin-top: .1rem; }
.toast-item.success i { color: #6fd3a0; }
.toast-item.danger i { color: #ff8f86; }
.toast-item.warning i { color: #f3c26b; }
.toast-item.info i { color: #9cc3ec; }
.toast-item .btn-close { filter: invert(1); opacity: .7; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.notif-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--paper); }
.dropdown-menu { border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow-float); font-size: .9rem; padding: .35rem; }
.dropdown-item { border-radius: var(--r-control); padding: .45rem .6rem; }
.dropdown-item:active { background: var(--forest); }
.notif-item { display: block; padding: .6rem .65rem; border-radius: var(--r-control); color: var(--ink); }
.notif-item:hover { background: var(--paper); text-decoration: none; color: var(--ink); }
.notif-item.unread { background: var(--forest-tint); }

.progress { height: 6px; background: var(--grey-tint); border-radius: 999px; }
.progress-bar { background: var(--forest); }
.progress-bar.warn { background: var(--yellow); }
.progress-bar.over { background: var(--red); }

.modal-content { border: 0; border-radius: var(--r-panel); box-shadow: var(--shadow-float); }
.modal-header, .modal-footer { border-color: var(--line); }

.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: #fff;
  font-size: var(--fs-small); color: var(--ink);
}
.chip.on { background: var(--forest-tint); border-color: var(--forest); color: var(--forest-dark); font-weight: 600; }

.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: .55rem .9rem; font-size: .9375rem; margin: 0; }
.kv dt { color: var(--slate); font-weight: 400; }
.kv dd { margin: 0; font-weight: 500; }

.copyable { cursor: pointer; }
.pw-reveal {
  font-variant-numeric: tabular-nums; letter-spacing: .06em; font-weight: 600; font-size: 1.05rem;
  background: var(--gold-tint); border: 1px dashed var(--gold-ink); border-radius: var(--r-control);
  padding: .45rem .75rem; display: inline-block; color: var(--ink);
}

.nav-pills .nav-link { color: var(--slate); border-radius: var(--r-control); font-weight: 500; padding: .45rem .85rem; }
.nav-pills .nav-link:hover { color: var(--ink); background: #ededea; }
.nav-pills .nav-link.active { background: var(--emerald-deep); color: #fff; }
.pagination .page-link { color: var(--ink); border-color: var(--line); }
.pagination .page-item.active .page-link { background: var(--emerald-deep); border-color: var(--emerald-deep); }

.alert { border-radius: var(--r-control); border: 1px solid transparent; font-size: .9rem; }
.alert-info { background: var(--blue-tint); color: var(--blue-ink); border-color: #cfdcec; }
.alert-warning { background: var(--yellow-tint); color: var(--yellow-ink); border-color: #f1dcb4; }
.alert-danger { background: var(--red-tint); color: var(--red-ink); border-color: #f2cdc9; }
.alert-success { background: var(--green-tint); color: var(--green-ink); border-color: #c7e5d4; }

/* A quiet section heading used above lists that are not in a card */
.section-title { font-size: 1.0625rem; font-weight: 650; font-stretch: 88%; margin: 0 0 .6rem; }

/* ------------------------------------------------------------------ auth
   Split screen: a plain charcoal panel says what GymFlow is, the form sits on the
   page colour beside it. On a phone the panel becomes a short band on top. */
.auth-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--paper);
}
.auth-hero {
  display: flex; flex-direction: column; gap: 2rem;
  padding: 2.5rem 3.25rem; color: #fff; background: var(--emerald-deep);
}
.auth-hero-brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; font-stretch: 85%; font-size: 1.25rem; letter-spacing: -.01em; }
.auth-hero-brand .mark, .auth-brand .mark {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--gold); color: var(--emerald-deep);
}
.auth-hero-copy { max-width: 28rem; margin: auto 0; }
.auth-hero-title {
  font-size: clamp(2.25rem, 3.4vw, 3.25rem); line-height: 1.02; font-weight: 700; font-stretch: 75%;
  letter-spacing: -.02em; margin: 0 0 1rem; color: #fff; text-wrap: balance;
}
.auth-hero-lede { font-size: 1.0625rem; color: #a8adb4; margin: 0 0 2rem; }
.auth-hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.75rem; }
.auth-hero-points li { display: flex; align-items: center; gap: .65rem; color: #e2e4e7; }
.auth-hero-points .bi { color: var(--gold); flex: 0 0 auto; }

.auth-panel { position: relative; display: grid; place-items: center; padding: 2rem 1.5rem; }
.auth-theme {
  position: absolute; top: 1.25rem; right: 1.25rem; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; font-size: 1.05rem;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-strong);
}
.auth-theme:hover { border-color: var(--ink); }
[data-theme="dark"] .auth-theme .when-light, [data-theme="light"] .auth-theme .when-dark { display: none; }
.auth-inner { width: 100%; max-width: 400px; }
.auth-card { width: 100%; background: transparent; border: 0; border-radius: 16px; padding: 0; }
.auth-brand { display: block; font-weight: 700; font-stretch: 80%; font-size: 1.85rem; letter-spacing: -.015em; line-height: 1.1; margin-bottom: .4rem; }
.auth-brand .mark { display: none; }
.auth-lede { color: var(--slate); margin: 0 0 1.75rem; }
.auth-card .form-control { padding: .7rem .85rem; background-color: var(--card); }
.auth-card .btn-lg { padding: .75rem 1rem; font-weight: 650; }
.demo-accounts { margin-top: 1.75rem; padding: 1rem 1.1rem; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.demo-accounts .table { --bs-table-bg: transparent; }
.demo-accounts th, .demo-accounts td { padding: .2rem .4rem .2rem 0; white-space: nowrap; }
.demo-accounts code { font-size: .8rem; }
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-hero { padding: 1.25rem 1.25rem 1.75rem; gap: 1.25rem; }
  .auth-hero-copy { margin: 0; }
  .auth-hero-title { font-size: 1.85rem; margin-bottom: .35rem; }
  .auth-hero-lede { font-size: .9375rem; margin: 0; }
  .auth-hero-points { display: none; }
  .auth-panel { place-items: start center; padding: 2rem 1.25rem 2.5rem; }
  .auth-wrap { position: relative; } .auth-panel { position: static; }
  .auth-theme { top: 1rem; right: 1rem; background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.16); }
}

/* ------------------------------------------------------------------ portal */
.portal { background: var(--paper); min-height: 100vh; padding-bottom: 80px; }
.portal-head { background: var(--emerald-deep); color: #fff; padding: 1.2rem 1.15rem 2.5rem; }
.portal-head .small { color: #a8adb4; opacity: 1 !important; }
.portal-head .mono { color: var(--gold); opacity: 1 !important; }
.portal-head h1 { color: #fff; font-stretch: 85%; }
.portal-head .text-muted { color: rgba(255,255,255,.78) !important; }
.portal-body { padding: 0 1rem 1.25rem; margin-top: -1.5rem; }
.portal-bell {
  position: relative; width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; background: rgba(255,255,255,.08); color: #fff; font-size: 1.15rem;
  border: 1px solid var(--gold-line);
}
.portal-bell:hover { background: rgba(255,255,255,.14); color: var(--gold); text-decoration: none; }
.portal-bell .notif-dot { border-color: var(--emerald-deep); background: var(--gold); }
.portal-countdown { text-align: center; }
.portal-countdown .figure {
  font-stretch: 66%; font-weight: 600; font-size: 4rem; line-height: .95; font-variant-numeric: tabular-nums;
}
.card.card-club { background: var(--emerald-panel); border: 0; border-top: 2px solid var(--gold); color: #fff; }
.card-club .figure { color: #fff; }
.card-club .figure-label, .card-club .text-muted { color: #a8adb4 !important; }
.card-club .badge-plate { background: rgba(200, 242, 90,.16); color: var(--gold); }
.portal-countdown .figure-label { color: var(--slate); font-size: .9375rem; }
.portal-tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1040;
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.portal-tabs a { padding: .55rem .25rem .6rem; text-align: center; color: var(--slate); font-size: .75rem; font-weight: 550; }
.portal-tabs a i { display: block; font-size: 1.3rem; margin-bottom: .1rem; }
.portal-tabs a.active { color: var(--emerald); }
.portal-tabs a.active i { color: var(--gold-ink); }
.portal-tabs a:hover { text-decoration: none; }
.qr-frame { background: #fff; border-radius: var(--r-panel); padding: .9rem; display: inline-block; border: 1px solid var(--line); }
.qr-frame svg { display: block; width: 100%; height: auto; }

/* ------------------------------------------------------------------ fitness (member app) */
.fit-ring { --p: 0; --ring: var(--gold); width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--ring) calc(var(--p) * 1%), rgba(255,255,255,.12) 0); }
.fit-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--emerald-panel); }
.fit-ring > div { position: relative; text-align: center; }
.fit-ring .figure { font-size: 2.6rem; font-stretch: 66%; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; color: #fff; }
.fit-ring .figure-label { font-size: .75rem; color: #a8adb4; }
.fit-ring.over { --ring: var(--red); }
.macro-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.macro-bar > span { display: block; height: 100%; background: var(--emerald); border-radius: 3px; transition: width .3s; }
.macro-bar.protein > span { background: var(--gold-ink); }
.card-club .macro-bar { background: rgba(255,255,255,.14); }
.card-club .macro-bar > span { background: var(--gold); }
.water-cups { display: flex; flex-wrap: wrap; gap: .35rem; }
.water-cups span { width: 22px; height: 28px; border-radius: 4px 4px 7px 7px; border: 1.5px solid var(--blue); background: transparent; }
.water-cups span.full { background: var(--blue); }
.fit-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.fit-tile { display: flex; flex-direction: column; gap: .25rem; padding: .9rem; border-radius: var(--r-panel); background: var(--card); border: 1px solid var(--line); color: var(--ink); min-height: 92px; }
.fit-tile:hover { text-decoration: none; border-color: var(--emerald); color: var(--ink); }
.fit-tile i { font-size: 1.35rem; color: var(--gold-ink); }
.fit-tile .figure { font-size: 1.5rem; font-weight: 600; font-stretch: 75%; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fit-tile small { color: var(--slate); }
.streak-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; background: rgba(200, 242, 90,.16); color: var(--gold); font-weight: 600; font-size: .85rem; }
.set-row { display: grid; grid-template-columns: 2rem 1fr 4.5rem 4.5rem 2.75rem; gap: .4rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row input { text-align: center; padding: .3rem .25rem; font-variant-numeric: tabular-nums; }
.set-row .set-no { color: var(--slate); font-weight: 600; text-align: center; }
.set-row.done { opacity: .62; }
.set-row.done input { text-decoration: line-through; }
.set-check { width: 2.5rem; height: 2.5rem; border-radius: 10px; border: 2px solid var(--line); background: var(--card); display: grid; place-items: center; color: transparent; font-size: 1.1rem; }
.set-check[aria-pressed="true"] { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.rest-timer { position: fixed; left: 1rem; right: 1rem; bottom: 70px; z-index: 1035; background: var(--emerald-deep); color: #fff; border-radius: 14px; padding: .75rem 1rem; display: none; align-items: center; justify-content: space-between; gap: 1rem; box-shadow: 0 12px 30px rgba(17, 20, 24,.35); border-top: 2px solid var(--gold); }
.rest-timer.show { display: flex; }
.rest-timer .figure { font-size: 1.9rem; font-stretch: 66%; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold); line-height: 1; }
.session-progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; }
.session-progress > span { display: block; height: 100%; background: var(--gold); transition: width .3s; }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.day-strip a, .day-strip span { display: block; text-align: center; padding: .45rem .1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: .72rem; color: var(--ink); line-height: 1.2; }
.day-strip .today { border-color: var(--gold-ink); }
.day-strip .rest { color: var(--slate); background: transparent; }
.day-strip .active { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.day-strip b { display: block; font-size: .85rem; }
.food-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.food-row:first-child { border-top: 0; }
.food-row .kcal { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.food-row .macros { font-size: .72rem; color: var(--slate); }
.meal-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .9rem; background: var(--paper-2, var(--paper)); border-bottom: 1px solid var(--line); font-weight: 600; }
.food-results { max-height: 50vh; overflow: auto; }
.food-results button { width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: .55rem .25rem; color: var(--ink); }
.food-results button:first-child { border-top: 0; }
.food-results button:hover, .food-results button:focus { background: var(--brand-tint); outline: none; }
.chip-row { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row .btn { white-space: nowrap; border-radius: 999px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.spark span { flex: 1; background: var(--emerald); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.spark span.over { background: var(--red); }
.spark span.today { background: var(--gold-ink); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.photo-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
@media (min-width: 768px) { .fit-tiles { grid-template-columns: repeat(4, 1fr); } .photo-grid { grid-template-columns: repeat(5, 1fr); } }
.fit-ring.sm { width: 112px; height: 112px; margin: 0; flex: 0 0 auto; }
.fit-ring.sm::before { inset: 8px; }
.fit-ring.sm .figure { font-size: 1.8rem; }
.fit-ring.sm .figure-label { font-size: .73rem; }   /* .68rem was 10.88px: under the 11.5px floor */
.rest-timer .figure { font-size: 1.9rem; }
.fit-sheet { position: fixed; inset: 0; z-index: 1050; background: rgba(17, 20, 24,.55); display: flex; align-items: flex-end; justify-content: center; }
.fit-sheet[hidden] { display: none; }
.fit-sheet-panel { background: var(--card); color: var(--ink); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(17, 20, 24,.3); }
@media (min-width: 768px) { .fit-sheet { align-items: center; } .fit-sheet-panel { border-radius: 18px; } }
.food-results button .kcal { float: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.food-results button small { display: block; color: var(--slate); font-size: .72rem; }
.btn-dark { background: var(--emerald-deep); border-color: var(--emerald-deep); color: #fff; }
.set-row.done .set-no { color: var(--emerald); }
body.sheet-open { overflow: hidden; }

/* ------------------------------------------------------------------ membership card
   Styled like a private club card: emerald, gold hairlines, the QR on a white inset
   so it always scans. Prints as it looks, with background graphics enabled. */
.mcard {
  width: 340px; border-radius: 18px; overflow: hidden; color: #fff;
  background: var(--emerald-panel);
  box-shadow: 0 24px 60px rgba(17, 20, 24, .35);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.mcard-top {
  display: flex; align-items: center; gap: .65rem; padding: 1rem 1.2rem .9rem;
  border-bottom: 1px solid var(--gold-line); color: #fff;
}
.mcard-top img { max-height: 32px; max-width: 96px; object-fit: contain; }
.mcard-top .bi { color: var(--gold); }
.mcard-top .fw-bold { font-stretch: 85%; letter-spacing: .01em; }
.mcard-top .small { color: var(--gold); opacity: 1 !important; letter-spacing: .02em; }
.mcard-body { padding: 1.05rem 1.2rem .6rem; display: flex; gap: .9rem; align-items: center; }
.mcard-body .avatar { border: 2px solid var(--gold); background: var(--emerald-deep); color: var(--gold); }
.mcard-body .fw-bold { color: #fff; font-stretch: 88%; }
.mcard-body .mono { color: var(--gold) !important; }
.mcard-body .small { color: #e2e4e7; }
.mcard-body .text-muted { color: #a8adb4 !important; }
.mcard-qr { margin: .4rem 1.2rem 1.1rem; padding: .9rem; background: #fff; border-radius: 12px; text-align: center; }
.mcard-qr svg { width: 100%; max-width: 230px; height: auto; display: block; margin: 0 auto; }
.mcard-foot {
  padding: .6rem 1rem .7rem; font-size: .75rem; text-align: center;
  color: #a8adb4; border-top: 1px solid var(--gold-line); background: rgba(0,0,0,.12);
}

/* ------------------------------------------------------------------ receipt */
.receipt { max-width: 440px; margin: 0 auto; background: #fff; }
.receipt-head { text-align: center; border-bottom: 1px dashed var(--line-strong); padding-bottom: .9rem; margin-bottom: .9rem; }
.receipt-total {
  border-top: 1px dashed var(--line-strong); border-bottom: 1px dashed var(--line-strong);
  padding: .7rem 0; margin: .8rem 0; display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 650;
}
.receipt-total .tnum { font-size: 1.5rem; font-stretch: 75%; }

/* ------------------------------------------------------------------ print */
@media print {
  .no-print, .sidebar, .topbar, .portal-tabs { display: none !important; }
  body { background: #fff; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card, .mcard { border: 1px solid #bbb; break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
}

/* ======================================================================
   Dark theme — the default. Emerald all the way through.
   Layers get lighter as they come forward: sidebar, page, panel, raised row.
   Every text pairing below was measured at 6:1 or better.
   The light theme above stays available for bright rooms.
   ====================================================================== */
:root { --link: var(--emerald); --chart-bar: rgba(17, 20, 24,.85); --chart-line: #6d8f12; --chart-grid: #efefec; --chart-text: #5b6168; --input-bg: #fff; }

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eceef0;
  --slate: #a3a9b0;
  --mute: #737980;
  --paper: #0e1013;
  --card: #16181c;
  --raised: #1e2126;
  --line: #272a30;
  --line-strong: #353940;
  --input-bg: #0b0d10;

  --emerald: #c8f25a;          /* primary: bright enough to read on emerald */
  --emerald-dark: #d6f77e;     /* hover goes lighter in the dark */
  --emerald-tint: #1e2126;
  --link: #eceef0;            /* links read as text; the lime accent is kept for actions */
  --gold-ink: #c8f25a;         /* on dark, the bright gold is the readable one */
  --gold-tint: #252d12;

  --green-tint: #123a2c; --green-ink: #7fdcaa;
  --yellow-tint: #3a2f14; --yellow-ink: #f0c66e;
  --red-tint: #44201d; --red-ink: #ff9d93;
  --blue-tint: #17304a; --blue-ink: #9cc6f0;
  --grey-tint: #23262b;

  --chart-bar: #c8f25a; --chart-line: #c8f25a; --chart-grid: #272a30; --chart-text: #a3a9b0;
  --shadow-float: 0 16px 40px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);

  /* Bootstrap's own variables, so its components follow along */
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--slate);
  --bs-border-color: var(--line-strong);
  --bs-tertiary-bg: var(--raised);
  --bs-link-color-rgb: 236, 238, 240;
  --bs-link-hover-color-rgb: 212, 245, 122;
}

a { color: var(--link); }
[data-theme="dark"] a:hover { color: #d4f57a; }
.card-header a:not(.btn) { color: var(--gold-ink); }

[data-theme="dark"] .sidebar { background: #0b0c0f; border-right: 1px solid #1c1f24; }
[data-theme="dark"] .sidebar .nav-link.active { background: #16181c; }

[data-theme="dark"] .card-header, [data-theme="dark"] .card-footer { border-color: var(--line); }
[data-theme="dark"] .scoreboard { background: var(--card); }
[data-theme="dark"] .scoreboard .stat { border-left-color: var(--line); }
[data-theme="dark"] .scoreboard.scoreboard-light { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .scoreboard a.stat:hover { background: var(--raised); }
[data-theme="dark"] .stat { background: var(--card); border-color: var(--line); }
[data-theme="dark"] a.stat:hover { border-color: var(--line-strong); }

[data-theme="dark"] .btn-primary { color: #0d0f12; font-weight: 650; }
[data-theme="dark"] .btn-primary:hover, [data-theme="dark"] .btn-primary:focus, [data-theme="dark"] .btn-primary:active { color: #0d0f12; }
/* --forest is bright in dark mode, so the skip link needs dark ink (white was 2.2:1) */
[data-theme="dark"] .skip-link, [data-theme="dark"] .skip-link:focus { color: #0d0f12; outline-color: #fff; }
[data-theme="dark"] .btn-outline-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
[data-theme="dark"] .btn-outline-secondary:hover { background: var(--raised); color: #fff; border-color: #4a4f57; }
[data-theme="dark"] .topbar .btn-outline-secondary { background: var(--card); }
[data-theme="dark"] .btn-quiet:hover { background: var(--raised); color: #fff; }

[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
  background-color: var(--input-bg); color: var(--ink); border-color: var(--line-strong);
}
[data-theme="dark"] .form-control:hover, [data-theme="dark"] .form-select:hover { border-color: #4a4f57; }
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-control:focus-within, [data-theme="dark"] .form-select:focus {
  background-color: var(--input-bg); color: var(--ink); border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(200, 242, 90, .2);
}
[data-theme="dark"] .form-control::placeholder { color: #7c828a; }
[data-theme="dark"] .form-control:disabled { background-color: #121418; color: var(--slate); }
[data-theme="dark"] .input-group-text { background: var(--raised); color: var(--slate); border-color: var(--line-strong); }
[data-theme="dark"] .form-check-input { background-color: var(--input-bg); border-color: #4a4f57; }
[data-theme="dark"] .form-check-input:checked { background-color: var(--emerald); border-color: var(--emerald); }
/* date pickers and selects draw their own icons: keep them visible */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.85); }

[data-theme="dark"] .table { --bs-table-color: var(--ink); --bs-table-border-color: var(--line); }
[data-theme="dark"] .table-hover tbody tr:hover > * { background: var(--raised); color: var(--ink); }

[data-theme="dark"] .chip { background: transparent; color: var(--ink); border-color: var(--line-strong); }
[data-theme="dark"] .chip.on { background: var(--raised); border-color: var(--emerald); color: #fff; }
[data-theme="dark"] .pw-reveal { color: #fff; border-color: var(--gold); }
[data-theme="dark"] .nav-pills .nav-link:hover { background: var(--raised); color: #fff; }
[data-theme="dark"] .nav-pills .nav-link.active { background: var(--gold); color: #0d0f12; font-weight: 600; }
[data-theme="dark"] .pagination .page-link { background: var(--card); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .pagination .page-item.active .page-link { background: var(--emerald); border-color: var(--emerald); color: #0d0f12; }
[data-theme="dark"] .pagination .page-item.disabled .page-link { background: var(--paper); color: var(--slate); }
[data-theme="dark"] .progress { background: var(--raised); }

[data-theme="dark"] .alert-info { background: var(--blue-tint); color: var(--blue-ink); border-color: #24466a; }
[data-theme="dark"] .alert-warning { background: var(--yellow-tint); color: var(--yellow-ink); border-color: #5a4a20; }
[data-theme="dark"] .alert-danger { background: var(--red-tint); color: var(--red-ink); border-color: #6a322d; }
[data-theme="dark"] .alert-success { background: var(--green-tint); color: var(--green-ink); border-color: #1f5a43; }

[data-theme="dark"] .notif-item.unread { background: var(--raised); }
[data-theme="dark"] .notif-dot { border-color: var(--paper); }
[data-theme="dark"] .dropdown-menu { background: var(--card); border-color: var(--line-strong); }
[data-theme="dark"] .list-group-item { background: var(--card); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .list-group-item-action:hover { background: var(--raised); color: #fff; }
[data-theme="dark"] .bg-brand-tint { background: var(--raised); color: var(--link); }
[data-theme="dark"] .border-top, [data-theme="dark"] .border-bottom, [data-theme="dark"] .border { border-color: var(--line) !important; }
[data-theme="dark"] .text-danger { color: var(--red-ink) !important; }
[data-theme="dark"] .text-success { color: var(--green-ink) !important; }
.text-success { color: var(--green-ink) !important; }

/* Login: a dark panel on the club colour */
[data-theme="dark"] .auth-wrap { background: #0b0c0f; }
[data-theme="dark"] .auth-card { background: transparent; box-shadow: none; }
[data-theme="dark"] .auth-brand .mark { background: var(--gold); color: #0d0f12; }

/* Portal */
[data-theme="dark"] .portal-head { background: #0b0c0f; }
/* On dark, --emerald is the bright mint, so white on it is only 2.2:1. */
[data-theme="dark"] .day-strip .active { color: #0d0f12; }
[data-theme="dark"] .card.card-club { background: var(--raised); }
[data-theme="dark"] .portal-tabs { background: #0b0c0f; border-top-color: var(--line); }
[data-theme="dark"] .portal-tabs a { color: var(--slate); }
[data-theme="dark"] .portal-tabs a.active { color: #fff; }
[data-theme="dark"] .portal-tabs a.active i { color: var(--gold); }

/* QR codes always sit on white: scanners need the contrast */
.qr-frame, [data-theme="dark"] .qr-frame { background: #fff; border-color: transparent; }

/* The theme switch */
.theme-toggle {
  display: inline-flex; align-items: center; gap: .4rem; background: none; border: 0; padding: .35rem 0;
  color: inherit; font-size: var(--fs-small); cursor: pointer;
}
.theme-toggle:hover { color: var(--gold); }
[data-theme="dark"] .avatar { background: var(--raised); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-line); }
[data-theme="dark"] { --chart-bar: rgba(200, 242, 90, .82); }
[data-theme="dark"] .plate-green { background: var(--green-tint); color: var(--green-ink); }
@media (pointer: coarse) { .theme-toggle { min-height: 40px; padding: .5rem 0; } }
[data-theme="dark"] .card-club .badge-plate { background: rgba(200, 242, 90, .16); color: var(--gold); }

/* ---- Coaching: message thread, weight chart, unread counts ---------------- */
/* Newest last on screen, but rendered newest-first with column-reverse so the box opens scrolled to the latest message without JavaScript. */
.coach-thread { display: flex; flex-direction: column-reverse; gap: .5rem; max-height: 420px; overflow-y: auto; }
.coach-thread .bubble { max-width: 88%; padding: .55rem .8rem; border-radius: 14px; font-size: var(--fs-body); overflow-wrap: anywhere; }
.coach-thread .bubble.theirs { align-self: flex-start; background: var(--grey-tint); color: var(--ink); border-bottom-left-radius: 4px; }
.coach-thread .bubble.mine { align-self: flex-end; background: var(--emerald-tint); color: var(--ink); border-bottom-right-radius: 4px; }
.coach-thread .bubble-meta { font-size: var(--fs-small); color: var(--slate); margin-top: .2rem; }
.coach-chart .line { stroke: var(--emerald); }
.coach-chart .target { stroke: var(--gold-ink); }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .4rem; border-radius: 999px; background: var(--red); color: #fff; font-size: var(--fs-small); font-weight: 650; }
