/* =========================================================================
 * app.css — shared design layer for the auth and app shells. Consumes CSS
 * custom properties injected by includes/authLayout.php + includes/layout.php
 * from PHP constants (BRAND_PRIMARY, BRAND_ACCENT, ...), so each deployment
 * themes itself without touching this file.
 * ========================================================================= */

:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;

  /* Surfaces */
  --surface-page: #f6f7fb;
  --surface-card: #ffffff;
  --surface-muted: #f3f4f6;
  --border-subtle: #e5e7eb;

  /* Text */
  --text-strong: #111827;
  --text-body:   #374151;
  --text-muted:  #6b7280;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06), 0 1px 3px rgba(17, 24, 39, .04);
  --shadow-md: 0 4px 6px -1px rgba(17, 24, 39, .07), 0 2px 4px -2px rgba(17, 24, 39, .05);
  --shadow-lg: 0 20px 40px -12px rgba(17, 24, 39, .18), 0 8px 16px -8px rgba(17, 24, 39, .12);

  /* Radius */
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;

  /* Bootstrap overrides — brand variables come in via inline <style> in the
     layout <head>, so --brand-primary etc. are always defined. */
  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: var(--brand-primary-rgb);
  --bs-link-color: var(--brand-primary);
  --bs-link-hover-color: var(--brand-primary-dark);
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text-body);
  --bs-body-bg: var(--surface-page);
  --bs-border-color: var(--border-subtle);
}

/* -------------------------------------------------------------------------
 * Global type + surface
 * ------------------------------------------------------------------------- */
/* Root scaling: drop from the browser default of 16px to 15px. All rem
 * units (buttons, cards, table padding, headings) scale proportionally,
 * so the whole UI tightens by ~6% without per-component overrides. The
 * knock-on effect is denser list/table pages — the dashboard still feels
 * generous because its KPIs are rem-sized too. */
html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, .fw-bold { color: var(--text-strong); letter-spacing: -.01em; }
.text-muted { color: var(--text-muted) !important; }
code { background: var(--surface-muted); padding: .1rem .35rem; border-radius: .35rem; color: var(--text-body); }

/* -------------------------------------------------------------------------
 * Buttons — brand-tinted primary, softer outline, uniform height
 * ------------------------------------------------------------------------- */
.btn {
  --bs-btn-padding-y: .55rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-weight: 500;
  --bs-btn-border-radius: var(--radius-sm);
  transition: box-shadow .15s ease, transform .05s ease;
}
.btn-primary {
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: var(--brand-primary-dark);
  --bs-btn-hover-border-color: var(--brand-primary-dark);
  --bs-btn-active-bg: var(--brand-primary-dark);
  --bs-btn-active-border-color: var(--brand-primary-dark);
  --bs-btn-focus-shadow-rgb: var(--brand-primary-rgb);
}
.btn-primary:hover { box-shadow: 0 6px 14px -6px rgba(var(--brand-primary-rgb), .55); }
.btn-outline-primary {
  --bs-btn-color: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: var(--brand-primary);
  --bs-btn-hover-border-color: var(--brand-primary);
}
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-padding-x: 1.25rem; }
.btn-sm { --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .7rem; }

/* -------------------------------------------------------------------------
 * Cards — soft shadow, hairline border, no default header stripe
 * ------------------------------------------------------------------------- */
.card {
  --bs-card-border-color: var(--border-subtle);
  --bs-card-border-radius: var(--radius-md);
  --bs-card-inner-border-radius: calc(var(--radius-md) - 1px);
  --bs-card-cap-bg: transparent;
  box-shadow: var(--shadow-sm);
}
.card.card-elevated { border: 0; box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); }
.card-header {
  border-bottom-color: var(--border-subtle);
  background: transparent;
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--text-strong);
}
.card-header.bg-light { background: var(--surface-muted) !important; }

/* -------------------------------------------------------------------------
 * Forms — floating labels + input groups, brand focus ring
 * ------------------------------------------------------------------------- */
.form-control, .form-select {
  border-color: var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: .625rem .85rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(var(--brand-primary-rgb), .15);
}
.form-label {
  font-weight: 500;
  color: var(--text-strong);
  margin-bottom: .375rem;
  font-size: .875rem;
}
.form-text { color: var(--text-muted); }
.input-group-text {
  background: var(--surface-muted);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}
.form-control-lg.otp-input {
  letter-spacing: .6rem;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  padding-left: 1.6rem; /* balance letter-spacing so the caret centers */
}

/* -------------------------------------------------------------------------
 * Alerts — softer, brand-friendly
 * ------------------------------------------------------------------------- */
.alert {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  font-size: .9rem;
}
.alert-info    { background: #eef4ff; border-color: #dbeafe; color: #1e3a8a; }
.alert-success { background: #ecfdf5; border-color: #bbf7d0; color: #065f46; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* -------------------------------------------------------------------------
 * Badges — tuned for readability at small sizes
 * ------------------------------------------------------------------------- */
.badge {
  font-weight: 500;
  padding: .35em .6em;
  border-radius: .5rem;
  letter-spacing: .01em;
}

/* =========================================================================
 * AUTH SHELL — split-screen layout used by authLayout.php
 * ========================================================================= */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 992px) {
  .auth-shell { grid-template-columns: 1.05fr 1fr; }
}

/* Left brand panel — hidden below lg to keep the form breathing on mobile.
 * Deliberately solid brand-primary (no gradient / blurred-blob stack) so
 * the sign-in surface reads as a plain school site rather than a generic
 * SaaS landing. White text on brand-primary gives enough contrast on its
 * own; see .auth-brand__hero p for the readable off-white body color. */
.auth-brand {
  display: none;
  position: relative;
  padding: 3rem;
  color: #fff;
  background: var(--brand-primary);
}
@media (min-width: 992px) { .auth-brand { display: flex; flex-direction: column; } }

/* Admin-uploaded background. The brand-primary gradient overlay keeps the
 * white hero text readable on any photo without the admin having to pick
 * a careful image. --auth-bg-image is injected inline by authLayout.php. */
.auth-brand--with-bg {
  background:
    linear-gradient(135deg, rgba(var(--brand-primary-rgb), .78), rgba(var(--brand-primary-rgb), .92)),
    var(--auth-bg-image) center / cover no-repeat;
}

.auth-brand__logo {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.auth-brand__logo img { height: 48px; width: auto; max-width: 100%; }
.auth-brand__logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(6px);
  font-weight: 700;
  font-size: 1.1rem;
}
.auth-brand__hero {
  margin-top: auto;
  max-width: 460px;
}
.auth-brand__hero h1 {
  color: #fff;
  font-size: clamp(1.6rem, 2.2vw, 2.3rem);
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: .75rem;
  letter-spacing: -.02em;
}
.auth-brand__hero p {
  color: rgba(255,255,255,.85);
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 2rem;
}
.auth-brand__features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.auth-brand__features li {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: rgba(255,255,255,.92);
  font-size: .95rem;
}
.auth-brand__features li i {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem;
}
.auth-brand__footer {
  margin-top: 2.5rem;
  font-size: .8rem;
  color: rgba(255,255,255,.7);
}

/* Right form panel */
.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  background: var(--surface-page);
}
.auth-form__inner {
  width: 100%;
  max-width: 440px;
}
.auth-form__brand-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  justify-content: center;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 1.75rem;
}
@media (min-width: 992px) { .auth-form__brand-mobile { display: none; } }
/* Mobile logo is the ONLY brand presence on <lg screens (the left brand
 * panel is hidden). Treat it as a hero element — up to 72px tall, centered.
 * Both axes capped so a horizontal banner-style logo doesn't overflow a
 * narrow phone and a tall square logo doesn't push the form off-screen. */
.auth-form__brand-mobile img {
  max-height: 72px;
  max-width: min(60%, 240px);
  width: auto;
  height: auto;
}

.auth-form h1.auth-form__title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: .35rem;
  letter-spacing: -.015em;
}
.auth-form__subtitle {
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: 1.75rem;
}
.auth-form .card {
  border: 0;
  box-shadow: none;
  background: transparent;
}
.auth-form .card-body { padding: 0; }

.auth-alt {
  margin-top: 1.75rem;
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
}
.auth-alt__divider {
  display: flex; align-items: center; gap: .75rem;
  color: var(--text-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 1.5rem 0 1.25rem;
}
.auth-alt__divider::before,
.auth-alt__divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border-subtle);
}
.auth-alt__row {
  display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center;
}
.auth-alt__row a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  text-decoration: none;
  font-weight: 500;
  font-size: .875rem;
  transition: border-color .15s, background .15s, color .15s;
}
.auth-alt__row a:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), .04);
}

/* =========================================================================
 * APP SHELL — used by layout.php
 *   Left sidebar (drawer on <lg, static column at lg+) + top bar + content.
 *   See docs/architecture-app-shell-sidebar.md for the design overview.
 * ========================================================================= */
:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
}

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

.app-shell {
  display: block;
  min-height: 100vh;
}
@media (min-width: 992px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    align-items: stretch;
  }
}

/* -------- Sidebar --------
 *   Bootstrap defaults the offcanvas background to --bs-body-bg (grey) and
 *   forces `background-color: transparent !important` at lg+. Pin the
 *   offcanvas CSS variables + repeat the rule with matching specificity so
 *   our sidebar renders as a white panel on every viewport.
 * ------------------------------------------------------------------ */
.app-sidebar.offcanvas-lg {
  --bs-offcanvas-bg: #fff;
  --bs-offcanvas-color: var(--text-body);
  --bs-offcanvas-width: 300px;
  --bs-offcanvas-border-width: 0;
  --bs-offcanvas-box-shadow: var(--shadow-lg);
  background: #fff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}
@media (max-width: 991.98px) {
  .app-sidebar.offcanvas-lg.show { box-shadow: var(--shadow-lg); }
}
@media (min-width: 992px) {
  .app-sidebar.offcanvas-lg {
    background-color: #fff !important; /* beat Bootstrap's transparent !important */
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    max-height: 100vh;
    overflow-y: auto;
  }
}

.app-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  min-height: var(--topbar-height);
}
.app-sidebar__brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-weight: 700;
  color: var(--brand-primary);
  text-decoration: none;
  letter-spacing: -.01em;
  font-size: 1.05rem;
}
.app-sidebar__brand:hover { color: var(--brand-primary-dark); }
.app-sidebar__brand img { height: 28px; width: auto; }
.app-sidebar__brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
}
.app-sidebar__brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__nav {
  flex: 1 1 auto;
  padding: .75rem .55rem;
  overflow-y: auto;
}

.app-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.app-nav__link {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-family: var(--font-sans);  /* buttons don't inherit font by default */
  font-weight: 500;
  font-size: .925rem;
  line-height: 1.4;
  text-decoration: none;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.app-nav__link:hover,
.app-nav__link:focus {
  background: rgba(var(--brand-primary-rgb), .07);
  color: var(--brand-primary);
}
.app-nav__link.is-active {
  background: rgba(var(--brand-primary-rgb), .12);
  color: var(--brand-primary);
  font-weight: 600;
}
.app-nav__icon {
  width: 20px;
  text-align: center;
  font-size: .95rem;
  color: currentColor;
  opacity: .85;
}
.app-nav__link.is-active .app-nav__icon { opacity: 1; }

.app-nav__group-toggle .app-nav__caret {
  margin-left: auto;
  font-size: .7rem;
  transition: transform .2s ease;
  opacity: .6;
}
.app-nav__group-toggle[aria-expanded="true"] .app-nav__caret {
  transform: rotate(180deg);
}

.app-nav--sub {
  padding: .1rem 0 .35rem 2.15rem;
  gap: 0;
}
.app-nav__sublink {
  display: block;
  padding: .45rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.app-nav__sublink:hover,
.app-nav__sublink:focus {
  background: rgba(var(--brand-primary-rgb), .06);
  color: var(--brand-primary);
}
.app-nav__sublink.is-active {
  background: rgba(var(--brand-primary-rgb), .12);
  color: var(--brand-primary);
  font-weight: 600;
}

/* -------- Body (topbar + main + footer) -------- */
.app-body {
  display: flex;
  flex-direction: column;
  min-width: 0; /* let grid child shrink to fit narrow viewports */
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--topbar-height);
  padding: .55rem 1rem;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: saturate(180%) blur(8px);
}
.app-topbar__toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.app-topbar__toggle:hover {
  background: rgba(var(--brand-primary-rgb), .08);
  color: var(--brand-primary);
  border-color: rgba(var(--brand-primary-rgb), .3);
}
.app-topbar__brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 700;
  color: var(--brand-primary);
  text-decoration: none;
  font-size: 1rem;
}
.app-topbar__brand img { height: 26px; }

.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.app-topbar__chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-body);
  font-weight: 500;
  font-size: .875rem;
}
.app-topbar__chip:hover,
.app-topbar__chip:focus {
  border-color: rgba(var(--brand-primary-rgb), .35);
  color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), .04);
}
.app-topbar__chip.dropdown-toggle::after {
  margin-left: .1rem;
  opacity: .55;
}

/* Dropdown menus in the topbar match the previous navbar styling */
.app-topbar .dropdown-menu {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: .35rem;
  margin-top: .35rem;
}
.app-topbar .dropdown-item {
  border-radius: var(--radius-sm);
  padding: .5rem .7rem;
  font-size: .9rem;
}
.app-topbar .dropdown-item:hover {
  background: rgba(var(--brand-primary-rgb), .08);
  color: var(--brand-primary);
}

.app-main {
  flex: 1 1 auto;
  padding: 1.75rem 0 3rem;
}
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* =========================================================================
 * PUBLIC SHELL — used by includes/publicLayout.php for anonymous visitors.
 *   Simple top header + centered content + footer. Downstream projects that
 *   need a richer shopfront should fork this + publicRouter.php into their
 *   own shop* equivalents.
 * ========================================================================= */
.public-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.public-header {
  background: #fff;
  border-bottom: 1px solid var(--border-subtle);
  padding: .9rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.public-header .public-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.public-header__brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  color: var(--brand-primary);
  text-decoration: none;
  font-size: 1.1rem;
  letter-spacing: -.01em;
}
.public-header__brand img { height: 28px; width: auto; }
.public-header__brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
}
.public-header__nav { display: flex; align-items: center; gap: .5rem; }

.public-main { padding: 0 0 4rem; min-height: calc(100vh - 60px - 60px); }

/* =========================================================================
 * FULL-PAGE BACKGROUND (admin-uploaded)
 *   Fixed to the viewport so the hero + content scroll over the backdrop;
 *   dark gradient overlay guarantees readable white text on the hero
 *   regardless of the photograph the admin picks.
 * ========================================================================= */
.public-body--with-bg {
  background:
    linear-gradient(180deg, rgba(17, 24, 39, .55) 0%, rgba(17, 24, 39, .35) 45%, rgba(249, 250, 251, .98) 85%),
    var(--public-bg-image, none) center / cover no-repeat fixed;
}
.public-body--with-bg .public-header {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}
.public-body--with-bg .public-footer {
  background: rgba(255, 255, 255, .95);
}

/* =========================================================================
 * HERO
 *   Two variants: --panel (default, no admin bg) is a soft gradient card
 *   centred in the container; --full-bleed (admin bg set) is transparent so
 *   the body backdrop shows through, with white text + subtle text-shadow.
 * ========================================================================= */
.public-hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  margin: 2rem 0 3rem;
}
.public-hero__inner { max-width: 760px; margin: 0 auto; }
.public-hero__title {
  font-size: clamp(2rem, 1.4rem + 2.5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: .75rem;
  line-height: 1.1;
}
.public-hero__tagline {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-muted);
}
.public-hero__blurb {
  font-size: 1.05rem;
  margin-bottom: 2rem;
  color: var(--text-muted);
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}
.public-hero__ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
}

/* Default panel-style hero (used when no admin backdrop is set). */
.public-hero--panel {
  background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), .06), rgba(var(--brand-primary-rgb), .02));
  border: 1px solid rgba(var(--brand-primary-rgb), .08);
  border-radius: 24px;
}

/* Full-bleed hero (used when admin backdrop is set). Transparent — the
 * body backdrop + overlay shine through. White text + subtle text-shadow
 * for readability over any photograph. */
.public-hero--full-bleed {
  background: transparent;
  padding: 7rem 1.5rem 5rem;
  color: #fff;
}
.public-hero--full-bleed .public-hero__title,
.public-hero--full-bleed .public-hero__tagline,
.public-hero--full-bleed .public-hero__blurb {
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .35);
}
.public-hero--full-bleed .public-hero__tagline { color: rgba(255, 255, 255, .9); }
.public-hero--full-bleed .public-hero__blurb   { color: rgba(255, 255, 255, .88); }

/* Outlined button that stays readable on both light and dark heroes. */
.btn-outline-light-contrast {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .55);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color .2s ease, border-color .2s ease;
}
.btn-outline-light-contrast:hover,
.btn-outline-light-contrast:focus {
  background: rgba(255, 255, 255, .22);
  border-color: #fff;
  color: #fff;
}
/* On the plain (no-bg) hero the same button needs the brand colour. */
.public-hero--panel .btn-outline-light-contrast {
  background: transparent;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  backdrop-filter: none;
}
.public-hero--panel .btn-outline-light-contrast:hover,
.public-hero--panel .btn-outline-light-contrast:focus {
  background: var(--brand-primary);
  color: #fff;
}

/* =========================================================================
 * SECTIONS — "What we offer" header + CTA strip + contact strip
 * ========================================================================= */
.public-section { padding: 3rem 0 1rem; }
.public-section__header { margin-bottom: 2.5rem; }
.public-section__title {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-bottom: .5rem;
}
.public-section__subtitle { font-size: 1.05rem; margin-bottom: 0; }
.public-body--with-bg .public-section__title { color: #111827; }

/* =========================================================================
 * LANDING CARDS — image-first, polished
 *   Admin manages rows in landing_cards. Image is the primary visual with
 *   a 16:9 aspect ratio for consistent sizing; icon is a fallback. The
 *   gradient overlay at the bottom of the image gives any title a soft
 *   contrast lift when images have busy details near the fold.
 * ========================================================================= */
.public-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, .06);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 10px -4px rgba(17, 24, 39, .08);
  transition: transform .28s ease, box-shadow .28s ease;
}
.public-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 15px -3px rgba(17, 24, 39, .1), 0 25px 40px -20px rgba(17, 24, 39, .18);
}
.public-card__media {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: #f3f4f6;
  position: relative;
}
.public-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .08));
  pointer-events: none;
}
.public-card__media--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), .1), rgba(var(--brand-primary-rgb), .18));
  color: var(--brand-primary);
  font-size: 3.5rem;
}
.public-card__media--icon::after { content: none; }
.public-card__media--placeholder {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}
.public-card__body {
  flex: 1 1 auto;
  padding: 1.5rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
}
.public-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: .6rem;
  color: #111827;
  letter-spacing: -0.01em;
}
.public-card__text {
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
  font-size: .97rem;
}

/* =========================================================================
 * CTA strip — brand-coloured, calls admin's eye at the bottom of the page
 * ========================================================================= */
.public-cta {
  margin: 3rem 0 1rem;
  padding: 2.5rem 2rem;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
  box-shadow: 0 20px 40px -20px rgba(var(--brand-primary-rgb), .55);
}
.public-cta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.public-cta__title {
  font-size: clamp(1.3rem, 1rem + 1vw, 1.75rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: .35rem;
  letter-spacing: -0.01em;
}
.public-cta__text {
  color: rgba(255, 255, 255, .9);
  margin: 0;
  font-size: 1rem;
}
.public-cta .btn-primary {
  background: #fff;
  border-color: #fff;
  color: var(--brand-primary);
  font-weight: 600;
}
.public-cta .btn-primary:hover,
.public-cta .btn-primary:focus {
  background: rgba(255, 255, 255, .9);
  border-color: rgba(255, 255, 255, .9);
  color: var(--brand-primary-dark);
}

/* =========================================================================
 * Contact strip (below the CTA)
 * ========================================================================= */
.public-contact {
  margin-top: 2rem;
  padding: 1.5rem 0 .5rem;
  color: var(--text-muted);
  font-size: .9rem;
  border-top: 1px solid var(--border-subtle);
}
.public-body--with-bg .public-contact {
  color: #4b5563;
  border-top-color: rgba(17, 24, 39, .08);
}

/* =========================================================================
 * Footer
 * ========================================================================= */
.public-footer {
  background: #fff;
  border-top: 1px solid var(--border-subtle);
  padding: 1.25rem 0;
  color: var(--text-muted);
  text-align: center;
  font-size: .8rem;
}

/* =========================================================================
 * /register form container — mirrors the home page's polished look
 * ========================================================================= */
.public-register { padding: 2.5rem 0 3rem; }

.public-register__crumbs {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.public-register__crumbs a {
  color: var(--text-muted);
  text-decoration: none;
}
.public-register__crumbs a:hover { color: var(--brand-primary); text-decoration: underline; }
.public-register__crumbs span { margin: 0 .2rem; opacity: .6; }

.public-register__header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(17, 24, 39, .08);
}
.public-register__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), .1);
  border-radius: 999px;
  margin-bottom: 1rem;
}
.public-register__title {
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: .5rem;
  color: #111827;
  line-height: 1.2;
}
.public-register__lead {
  color: #4b5563;
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
  max-width: 640px;
}

.public-register__fee-note {
  display: flex;
  gap: .85rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), .08), rgba(var(--brand-primary-rgb), .03));
  border: 1px solid rgba(var(--brand-primary-rgb), .18);
  border-radius: 12px;
  color: #1f2937;
}
.public-register__fee-note > i {
  color: var(--brand-primary);
  font-size: 1.3rem;
  margin-top: .15rem;
}

.public-register .card {
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 14px -8px rgba(17, 24, 39, .1);
  margin-bottom: 1.25rem;
}
.public-register .card-header {
  background: #fff;
  border-bottom: 1px solid rgba(17, 24, 39, .06);
  font-weight: 600;
  color: #111827;
  padding: 1rem 1.25rem;
}
.public-register .card-body { padding: 1.25rem; }

.public-register .learner-row {
  background: #fafafa;
  border: 1px solid rgba(17, 24, 39, .08) !important;
  border-radius: 12px;
  padding: 1.25rem !important;
  margin-bottom: 1rem !important;
}
.public-register .learner-row .learner-row__title {
  color: var(--brand-primary);
  font-size: .95rem;
}

.public-register__submit {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}
.public-register__privacy {
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  margin: 1rem 0 0;
}

/* Payment-mode picker (STK vs manual). Each option is a card-styled radio;
 * the whole label is clickable so parents don't have to hit the small
 * circle, and the checked state tints to the brand colour. */
.public-register__pay-choice {
  display: grid;
  gap: .75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 576px) {
  .public-register__pay-choice { grid-template-columns: 1fr 1fr; }
}
.public-register__pay-option {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem;
  margin: 0;
  cursor: pointer;
  border: 1.5px solid rgba(17, 24, 39, .12);
  border-radius: 12px;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.public-register__pay-option input[type="radio"] {
  margin-top: .25rem;
  accent-color: var(--brand-primary);
}
.public-register__pay-option:hover {
  border-color: rgba(var(--brand-primary-rgb), .45);
}
.public-register__pay-option:has(input:checked) {
  border-color: var(--brand-primary);
  background: rgba(var(--brand-primary-rgb), .05);
  box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), .12);
}
.public-register__pay-option strong { font-size: .95rem; color: #111827; }
.public-register__pay-option small { line-height: 1.45; }

/* Paybill instructions card — numbered steps with monospace values so
 * the parent can read + type them without second-guessing. */
.public-register__paybill-card {
  padding: 1.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), .06), rgba(var(--brand-primary-rgb), .02));
  border: 1px solid rgba(var(--brand-primary-rgb), .18);
}
.public-register__paybill-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 .75rem;
}
.public-register__paybill-steps {
  margin: 0;
  padding-left: 1.25rem;
  color: #1f2937;
  line-height: 1.75;
}
.public-register__paybill-steps li { margin-bottom: .15rem; }
.public-register__paybill-value {
  display: inline-block;
  padding: .15rem .55rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .95rem;
  font-weight: 600;
  color: var(--brand-primary);
  background: #fff;
  border: 1px solid rgba(var(--brand-primary-rgb), .25);
  border-radius: 6px;
}

/* On a full-page backdrop the register page sits on top of the dark hero
 * overlay. Add a white panel behind the form so the inputs stay legible. */
.public-body--with-bg .public-register {
  background: #fff;
  border-radius: 24px;
  padding: 2.5rem clamp(1rem, 3vw, 2.5rem);
  margin-top: 2rem;
  box-shadow: 0 25px 50px -12px rgba(17, 24, 39, .25);
}

/* =========================================================================
 * Auth pages — a "back to main site" button above the form.
 *   Matches the Sign-in input-group aesthetic (brand-primary outlined,
 *   rounded corners, icon on the left) so it reads as a real action — not
 *   a tag/pill — while staying visually secondary to the primary CTA.
 * ========================================================================= */
.auth-form__back {
  margin-bottom: 1.75rem;
}
.auth-form__back a {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem 1rem;
  font-size: .92rem;
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
  background: #fff;
  border: 1.5px solid rgba(var(--brand-primary-rgb), .25);
  border-radius: .5rem;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .04);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.auth-form__back a i {
  font-size: .85rem;
  transition: transform .18s ease;
}
.auth-form__back a:hover,
.auth-form__back a:focus {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(var(--brand-primary-rgb), .5);
}
.auth-form__back a:hover i,
.auth-form__back a:focus i {
  transform: translateX(-3px);
}

/* Page header — used at the top of every content page */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header__title {
  display: flex; align-items: center; gap: .75rem;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-strong);
  letter-spacing: -.015em;
}
.page-header__title .page-header__icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(var(--brand-primary-rgb), .1);
  color: var(--brand-primary);
  font-size: 1rem;
}
.page-header__subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin: .25rem 0 0;
  font-weight: 400;
}
.page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Tables — replace default Bootstrap borders with hairlines and roomier rows */
.table {
  --bs-table-hover-bg: rgba(var(--brand-primary-rgb), .04);
  --bs-table-border-color: var(--border-subtle);
  margin-bottom: 0;
}
.table > thead {
  background: var(--surface-muted);
}
.table > thead th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--border-subtle);
}
.table > tbody > tr > td {
  padding: .7rem .85rem;
  vertical-align: middle;
  border-color: var(--border-subtle);
  font-size: .9rem;
}
.table > tbody > tr:last-child > td { border-bottom: 0; }

/* KPI cards for the dashboard */
.stat-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
  height: 100%;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-card__icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(var(--brand-primary-rgb), .1);
  color: var(--brand-primary);
  margin-bottom: .85rem;
  font-size: 1.05rem;
}
.stat-card__label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .25rem;
}
.stat-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.1;
  margin-bottom: .1rem;
}
.stat-card__delta { font-size: .8rem; color: var(--text-muted); }

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
  padding: 1.25rem 0;
}
