/* =================================================================
   Quiz Platform — shared stylesheet
   Modern, mobile-first, animated design system built around the
   Captain 37 brand palette — deep ink-navy (trust) + a warm amber/gold
   accent thread (the same navy/gold pairing the certificates and
   printable reports already use, now carried through the whole site
   instead of living only on those two document types).
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand — variable names kept as-is (--brand-blue/--brand-orange)
       for compatibility with every rule below that already references
       them; only the values moved to the new ink-navy + amber-gold
       palette. */
    --brand-blue: #14335c;
    --brand-blue-dark: #0d2445;
    --brand-blue-darker: #081729;
    --brand-orange: #bd7b2e;
    --brand-orange-dark: #93601f;
    --brand-gold: #c9a227;
    --brand-gold-soft: rgba(201, 162, 39, .16);

    /* Semantic */
    --primary: var(--brand-blue);
    --primary-dark: var(--brand-blue-dark);
    --accent: var(--brand-orange);
    --accent-dark: var(--brand-orange-dark);
    --success: #15803d;
    --success-bg: #e1f3e6;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --info: #0284c7;
    --info-bg: #dbeafe;

    /* Neutrals — warm ivory/sand instead of the old cool blue-grey wash,
       so the whole canvas reads warm rather than corporate-cold. */
    --bg: #faf7f1;
    --card-bg: #ffffff;
    --border: #e7e1d3;
    --text: #171f2e;
    --muted: #6b7280;
    --tint: #f6f1e4;

    /* System — a more generous, "squircle" radius scale and softer,
       farther-thrown shadows read as premium rather than boxy; the two
       new tokens (--shadow-accent, --ease-spring) are additive, used by
       hero/CTA moments and hover micro-interactions further down. */
    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 28px;
    --shadow-sm: 0 1px 2px rgba(16, 26, 48, .06), 0 1px 1px rgba(16, 26, 48, .05);
    --shadow: 0 20px 44px -18px rgba(16, 26, 48, .20);
    --shadow-lg: 0 32px 74px -24px rgba(16, 26, 48, .28);
    --shadow-accent: 0 18px 40px -14px rgba(189, 123, 46, .38);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --maxw: 1180px;
}

* { box-sizing: border-box; }
/* Belt-and-braces backstop: the admin/superuser overflow causes we
   found (align-items on a column flex container, an un-collapsed grid
   span, form controls without min-width:0) are fixed at the source
   further down, but a page-level horizontal scrollbar is jarring enough
   that it's worth a hard backstop too — nothing on this site is meant
   to scroll sideways at the page level. This goes on <html> only (not
   <body>) — setting overflow-x here without overflow-y makes the UA
   treat overflow-y as auto per spec, and doing that on <body> as well
   would turn it into a SECOND independent scroll container nested
   inside <html>'s, which is exactly the kind of thing that quietly
   breaks `position: sticky` (.topbar, .qp-overall-timer, etc. all rely
   on the viewport being their scrolling ancestor). One scroll container
   (html) is enough to stop horizontal scroll without that risk.
   Elements that DO need their own horizontal scroll (.table-wrap,
   .report-table-wrap, .code-block) declare overflow-x:auto on an inner
   wrapper, which is unaffected by this and keeps working. */
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
    font-family: var(--font-head);
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
    font-weight: 600;
    /* Fraunces is a variable font with an optical-size axis — letting the
       browser interpolate it means a small h4 renders with tighter,
       text-optimised proportions while a big hero h1 leans into the
       fuller display cut, instead of one fixed cut stretched to every
       size. */
    font-optical-sizing: auto;
}
p { margin: 0 0 12px; }
a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand-orange-dark); }
img { max-width: 100%; }
/* Reference/transaction codes are shown all over (payment references,
   certificate codes, application reference numbers) and are exactly the
   kind of long unbroken string that forces horizontal scroll on a phone
   if it can't wrap — this makes every <code> wrap safely by default. */
code { word-break: break-word; overflow-wrap: anywhere; }
.page-title { margin: 6px 0 22px; font-size: 1.7em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.float-right { float: right; }
::selection { background: var(--brand-orange); color: #fff; }

/* ---------- Icon system ----------
   Inline SVGs from includes/icons.php — replaces the emoji-as-icon
   pattern that used to cover the nav, both sidebars, quiz cards, and
   dashboards. One stroke weight and size across every surface instead
   of a different emoji font per OS/browser. */
.icon {
    width: 1em; height: 1em; flex-shrink: 0;
    vertical-align: -0.15em;
    stroke: currentColor;
}
.icon-lg { width: 1.3em; height: 1.3em; }
.icon-sm { width: .85em; height: .85em; }

/* Consistent keyboard-focus ring for every interactive element that
   doesn't already define its own :focus-visible treatment (inputs and
   the live-search box set their own above) — an outline:none with no
   replacement is an accessibility bug, not a style choice. */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--brand-orange);
    outline-offset: 2px;
    border-radius: 4px;
}
.btn:focus-visible { outline-offset: 3px; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.reveal-delay-1.in-view { transition-delay: .08s; }
.reveal-delay-2.in-view { transition-delay: .16s; }
.reveal-delay-3.in-view { transition-delay: .24s; }
.reveal-delay-4.in-view { transition-delay: .32s; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(189,123,46,.45); } 100% { box-shadow: 0 0 0 14px rgba(189,123,46,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
    color: #fff;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: .003em;
    /* A faint inner top highlight + a matching faint bottom shade reads
       as a gently machined, slightly convex pill rather than a flat
       color swatch — subtle enough to disappear on small buttons but
       still register on the larger CTAs. */
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.16), inset 0 -1px 0 rgba(0,0,0,.08);
    transition: transform .3s var(--ease-spring), box-shadow .25s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.2); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); }
.btn-accent, .btn-orange { background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark)); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border); box-shadow: none; }
.btn-outline:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.btn-sm { padding: 6px 14px; font-size: 0.83em; }
.btn-lg { padding: 15px 30px; font-size: 1.05em; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; text-decoration: underline; box-shadow: none; font-weight: 500; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------- Top bar (logged-in portals) ---------- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(255,252,246,.86);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.1em; color: var(--text); }
.topbar-brand img { height: 34px; width: 34px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-role {
    text-transform: uppercase;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f5ecd6;
    color: var(--primary);
}

/* ---------- Notifications bell ---------- */
.notif-bell-wrap { position: relative; }
.notif-bell-btn {
    position: relative; background: none; border: none; cursor: pointer;
    font-size: 1.25em; line-height: 1; padding: 6px; border-radius: 10px;
    transition: background .15s var(--ease);
}
.notif-bell-btn:hover { background: #faf7f1; }
.notif-bell-badge {
    position: absolute; top: -2px; right: -2px; background: var(--danger); color: #fff;
    font-size: 0.62em; font-weight: 800; border-radius: 20px; padding: 2px 5px; line-height: 1;
    min-width: 16px; text-align: center;
}
.notif-bell-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); width: 280px; background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 8px; z-index: 60;
}
.notif-bell-item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 0.9em;
}
.notif-bell-item:hover { background: #faf7f1; text-decoration: none; }
.notif-bell-empty { padding: 16px 12px; text-align: center; color: var(--muted); font-size: 0.88em; }

/* ---------- Activity trend bars ---------- */
.trend-bars { display: flex; align-items: flex-end; gap: 18px; padding: 10px 4px 0; min-height: 160px; }
.trend-bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.trend-bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--brand-blue), var(--brand-blue-dark)); border-radius: 8px 8px 0 0; transition: height .4s var(--ease); }
.trend-bar-num { font-weight: 700; font-size: 0.85em; color: var(--brand-blue-dark); }
.trend-bar-label { font-size: 0.72em; color: var(--muted); text-align: center; }

/* ---------- Revenue share bars ---------- */
.revenue-bar-track { display: inline-block; width: 90px; height: 8px; background: #f4efe0; border-radius: 20px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.revenue-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand-orange), var(--brand-orange-dark)); border-radius: 20px; }
.sidebar-toggle {
    display: none;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    width: 38px; height: 38px;
    cursor: pointer;
    font-size: 1.1em;
}

.impersonation-banner {
    display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
    background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffe69c;
    padding: 10px 16px; font-size: 0.92em; text-align: center;
}
.app-shell { display: flex; min-height: calc(100vh - 62px); }
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #ffffff, #f8f5ec);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    flex-shrink: 0;
    transition: transform .25s var(--ease);
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 22px;
    color: var(--text);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.sidebar nav a .sidebar-icon { display: inline-flex; color: var(--muted); flex-shrink: 0; }
.sidebar nav a:hover .sidebar-icon, .sidebar nav a.active .sidebar-icon { color: currentColor; }
.sidebar nav a:hover { background: #f5ecd6; color: var(--primary); text-decoration: none; }
.sidebar nav a.active {
    background: linear-gradient(90deg, #f5ecd6, transparent);
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    border-left-color: var(--brand-orange);
}
.sidebar-org { padding: 8px 22px 18px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sidebar-org-name { font-weight: 700; font-family: var(--font-head); }
.sidebar-org-status { font-size: 0.8em; color: var(--muted); }
.main-content { flex: 1; padding: 28px 34px; max-width: 1160px; animation: fadeIn .4s var(--ease); }

/* ---------- Public site nav ---------- */
.public-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 5vw;
    /* Warm frosted glass rather than the old neutral-white blur — the
       same material language as the hero's gold glow, just translucent
       enough to still read as "glass over whatever's beneath it". */
    background: rgba(255,252,244,.78);
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 12px 30px -22px rgba(16,26,48,.35);
    position: sticky;
    top: 0;
    z-index: 50;
}
.public-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; font-size: 1.25em; color: var(--text); letter-spacing: -0.01em; }
.public-brand img { height: 40px; width: 40px; transition: transform .3s var(--ease); }
.public-brand:hover img { transform: rotate(-8deg) scale(1.08); }
.public-brand:hover { color: var(--text); }
.public-nav-links { display: flex; gap: 18px; align-items: center; }
.public-nav-links a:not(.btn) { color: var(--text); font-weight: 500; position: relative; }
.public-nav-links a:not(.btn)::after {
    content: ''; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px;
    background: var(--brand-orange); transition: width .2s var(--ease);
}
.public-nav-links a:not(.btn):hover::after { width: 100%; }
.public-nav-links a:not(.btn):hover { text-decoration: none; color: var(--brand-blue-dark); }
.public-nav-links .btn { color: #fff; }

/* Certificates dropdown — hover/focus-within reveal on desktop, tap to
   expand/collapse on mobile (see the 768px block below). The toggle is a
   plain <button>, not a link — its own destination is already the first
   item inside its dropdown, so it never needs to navigate anywhere
   itself, only reveal the menu — reset back to look like its sibling
   nav <a> tags since buttons don't inherit that styling for free. */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-toggle {
    cursor: pointer; background: none; border: none; padding: 0; margin: 0;
    font: inherit; color: var(--text); font-weight: 500; position: relative;
}
.nav-dropdown-toggle::after {
    content: ''; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px;
    background: var(--brand-orange); transition: width .2s var(--ease);
}
.nav-dropdown-toggle:hover::after { width: 100%; }
.nav-dropdown-toggle:hover { color: var(--brand-blue-dark); }
.nav-dropdown-caret { font-size: .7em; margin-left: 3px; display: inline-block; }
.nav-dropdown-menu {
    /* No gap between toggle and menu (top:100%, zero margin) — a gap
       here is what was letting the mouse lose :hover on its way down
       to the menu, closing it before a submenu link could be clicked. */
    display: none; position: absolute; top: 100%; left: 0; margin-top: 6px;
    background: var(--card-bg); border-radius: var(--radius-sm); box-shadow: var(--shadow);
    min-width: 190px; padding: 8px; z-index: 60;
}
.nav-dropdown-menu::before {
    /* Invisible bridge filling the margin-top gap above, so the pointer
       stays "inside" the dropdown while crossing from toggle to menu. */
    content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 12px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: flex; align-items: center; gap: 9px; color: var(--text) !important; padding: 9px 12px; border-radius: 8px; font-size: .92em; white-space: nowrap; }
.nav-dropdown-menu a .icon { color: var(--muted); }
.nav-dropdown-menu a:not(.btn)::after { display: none; }
.nav-dropdown-menu a:hover { background: var(--bg); color: var(--brand-blue-dark) !important; text-decoration: none; }
.nav-toggle {
    display: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    width: 42px; height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.nav-toggle:hover, .nav-toggle:focus-visible { background: var(--bg); border-color: var(--brand-blue); }
/* Classic three-bar icon that morphs into an X when open — real <span>s
   (see includes/header_public.php) rather than a ☰/✕ character swap, so
   it animates smoothly and never depends on font glyph support. */
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s var(--ease), opacity .2s var(--ease); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.public-main { max-width: var(--maxw); margin: 0 auto; padding: 34px 5vw 60px; min-height: 60vh; }

/* ---------- Footer ---------- */
.site-footer {
    background: linear-gradient(180deg, var(--brand-blue-darker), #050e1a);
    color: #cfd8ef;
    margin-top: 40px;
    position: relative;
}
.site-footer::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--brand-orange), var(--brand-blue) 60%, var(--brand-blue-dark));
}
.footer-grid {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 50px 5vw 24px;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 28px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; color: #fff; font-size: 1.2em; margin-bottom: 12px; letter-spacing: -0.01em; }
.footer-brand img { height: 36px; width: 36px; }
.footer-col h4 { color: #fff; font-size: .82em; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 16px; }
.footer-col a { display: block; color: #b7c2df; margin-bottom: 10px; transition: color .15s var(--ease), padding-left .15s var(--ease); }
.footer-col a:hover { color: #fff; padding-left: 3px; }
.footer-blurb { color: #9fabc9; font-size: .92em; max-width: 320px; line-height: 1.65; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 18px 5vw;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
    font-size: .85em; color: #93a0c2;
}
.footer-bottom a { color: #93a0c2; }
.footer-bottom a:hover { color: #fff; }
.footer-legal { display: flex; gap: 18px; flex-wrap: wrap; }
.public-footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.85em; }

/* ---------- Auth ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 30px 0 10px; }
.auth-card {
    max-width: 440px;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp .5s var(--ease);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--brand-orange), var(--brand-blue));
}
.auth-card h1 { text-align: center; }
/* Breathing room between the form's submit button and any helper links
   underneath it (login.php's "Taking a quiz?"/"Running an organisation?"
   lines, register.php, etc.) — otherwise the button's own bottom edge
   and the paragraph's zero top-margin (see the global `p` reset above)
   leave them touching. */
.auth-card form + p { margin-top: 20px; }

/* ---------- Hero ----------
   A deep ink-navy panel (rather than the old pale gradient wash) so
   every public page opens on one confident, branded moment — the glass
   nav floats on top of it, and page content resumes on the ordinary
   warm-ivory background right below. A dotted texture + two soft gold
   glows (one bright, one deeper/moodier) give it depth without needing
   an image asset — the same navy/gold thread the certificates already
   carry, now opening every page instead of only the printable ones. */
.hero {
    position: relative;
    text-align: center;
    padding: 76px 24px 66px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 10% -15%, rgba(201,162,39,.4), transparent 46%),
        radial-gradient(circle at 92% 115%, rgba(189,123,46,.4), transparent 50%),
        linear-gradient(160deg, var(--brand-blue-darker) 0%, var(--brand-blue-dark) 58%, var(--brand-blue) 100%);
    margin-bottom: 10px;
    color: #fff;
    isolation: isolate;
}
.hero::after {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.16) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: .55;
    z-index: -1;
    -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 85%);
    mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 85%);
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); border-radius: 999px;
    padding: 6px 16px; font-size: .82em; font-weight: 700; color: #fff; letter-spacing: .01em;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 0 rgba(255,255,255,.15) inset; margin-bottom: 20px; animation: fadeInUp .5s var(--ease);
}
.hero-logo {
    width: 88px; height: 88px; margin: 0 auto 20px; display: block; animation: floatY 5s ease-in-out infinite;
    filter: drop-shadow(0 16px 26px rgba(6,13,28,.45));
    border-radius: 50%; background: #fff; padding: 3px;
}
.hero h1 { font-size: clamp(2em, 4.6vw, 3em); max-width: 820px; margin: 0 auto 16px; animation: fadeInUp .6s var(--ease); letter-spacing: -0.02em; color: #fff; font-variation-settings: 'opsz' 72; font-weight: 600; }
.hero > p { max-width: 620px; margin: 0 auto; color: rgba(255,255,255,.8); font-size: 1.1em; animation: fadeInUp .7s var(--ease); }
.hero-actions { display: flex; gap: 14px; justify-content: center; margin: 30px 0 14px; flex-wrap: wrap; animation: fadeInUp .8s var(--ease); }
.hero-actions .btn { box-shadow: 0 12px 26px -8px rgba(6,13,28,.5); }
.hero-actions .btn-outline, .hero .btn-outline {
    background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.42);
}
.hero-actions .btn-outline:hover, .hero .btn-outline:hover { background: #fff; color: var(--brand-blue-dark); border-color: #fff; }
.hero-stats { display: flex; gap: 34px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.hero-stat { text-align: center; }
.hero-stat b { display: block; font-family: var(--font-head); font-size: 1.6em; color: #fff; }
.hero-stat span { font-size: .82em; color: rgba(255,255,255,.68); text-transform: uppercase; letter-spacing: .05em; }
.hero-highlights { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; max-width: 900px; margin-left: auto; margin-right: auto; }
.hero-highlight {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.24); border-radius: 999px;
    padding: 8px 16px; font-size: .85em; font-weight: 600; color: #fff;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeInUp .6s var(--ease);
}
.hero-highlight span { font-weight: 500; color: rgba(255,255,255,.7); }

.cta-band {
    text-align: center;
    background: linear-gradient(160deg, var(--brand-blue-darker), var(--brand-blue-dark) 60%, var(--brand-blue));
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 50px 30px;
    margin: 48px 0;
    position: relative;
    overflow: hidden;
}
.cta-band::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle at 80% 0%, rgba(189,123,46,.4), transparent 55%);
}
.cta-band::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%);
    mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%);
}
.cta-band h2 { color: #fff; position: relative; letter-spacing: -0.01em; }
.cta-band p { color: rgba(255,255,255,.82); max-width: 560px; margin: 0 auto 22px; position: relative; }
.cta-band .btn { position: relative; box-shadow: 0 12px 26px -8px rgba(6,13,28,.5); }
.cta-band .btn-outline { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.4); }
.cta-band .btn-outline:hover { background: #fff; color: var(--brand-blue-dark); border-color: #fff; }

.section-head { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.section-head h2 { font-size: clamp(1.5em, 3vw, 1.9em); letter-spacing: -0.01em; }

/* FAQ accordion — only one .faq-item.open at a time (see faq.php's
   toggleFaq()). The answer panel animates via max-height so the
   collapse/expand feels smooth without JS-measured heights. */
.faq-group { margin-bottom: 34px; }
.faq-cat {
    font-size: .8em; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: var(--brand-blue-dark); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}
.faq-cat::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--brand-orange); flex-shrink: 0; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--card-bg); overflow: hidden; transition: box-shadow .2s var(--ease), border-color .2s var(--ease); }
.faq-item.open { box-shadow: var(--shadow); border-color: var(--brand-blue); }
.faq-q {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: none; border: none; text-align: left; font-family: var(--font-body); font-weight: 700;
    font-size: .98em; color: var(--text); padding: 17px 20px; cursor: pointer; transition: color .15s var(--ease);
}
.faq-item.open .faq-q { color: var(--brand-blue-dark); }
.faq-caret {
    color: var(--brand-orange); transition: transform .25s var(--ease); flex-shrink: 0;
    width: 24px; height: 24px; border-radius: 50%; background: var(--warning-bg);
    display: inline-flex; align-items: center; justify-content: center; font-size: .8em;
}
.faq-item.open .faq-caret { transform: rotate(180deg); background: var(--brand-orange); color: #fff; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s var(--ease); }
.faq-item.open .faq-a { max-height: 600px; }
.faq-a-inner { padding: 0 18px 16px; color: var(--muted); line-height: 1.65; font-size: .93em; }
.section-head p { color: var(--muted); }

/* ---------- Cards / tables / forms ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card-header { font-weight: 700; margin-bottom: 16px; font-size: 1.05em; font-family: var(--font-head); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    /* A scroll shadow on the trailing edge is the only reliable
       cross-browser hint that a wide table (dozens of pages use this
       generic .table — quizzes, users, sponsors, payments, etc.) has
       more columns off to the right, which matters most on the mobile
       widths where every one of those tables needs horizontal scroll. */
    background:
        linear-gradient(to right, var(--card-bg, #fff) 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(0,0,0,0), var(--card-bg, #fff) 70%) 100% 0,
        radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.12), rgba(0,0,0,0)),
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), rgba(0,0,0,0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}
.table { width: 100%; border-collapse: collapse; min-width: 480px; }
/* Sticky first column — on a horizontally-scrolled table this keeps the
   row's identifying cell (name/title/email) pinned on screen so it's
   still obvious which row you're looking at once you've scrolled past it.
   Only kicks in on narrow screens; a desktop-width table never scrolls. */
@media (max-width: 900px) {
    .table th:first-child, .table td:first-child {
        position: sticky; left: 0; z-index: 1; background: var(--card-bg, #fff);
        box-shadow: 2px 0 4px rgba(0,0,0,.06);
    }
    .table th.bulk-col:first-child, .table td.bulk-col:first-child { box-shadow: none; }
    .table thead th:first-child { z-index: 2; }
    .table tbody tr:hover td:first-child { background: #f8f5ec; }
}
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 0.92em; }
.table th { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 0.72em; letter-spacing: .04em; }
.table tbody tr { transition: background .15s var(--ease); }
.table tbody tr:hover { background: #f8f5ec; }
.table tbody tr.row-highlight { background: #f2ead4; }
.table tbody tr.row-highlight:hover { background: #f0e6c9; }
.actions a, .actions .btn-link { margin-right: 10px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 0.88em; font-weight: 600; color: var(--text); }
/* :not([type=checkbox]):not([type=radio]) — these two control types get
   their own sizing below (.form-grid .checkbox input). Without the
   exclusion, width:100% forces a checkbox/radio's flex-basis to the
   full width of whatever row it's in (see .form-grid .checkbox below),
   so the tiny native control ends up shrunk-and-stranded at the left
   edge of a much wider invisible box, with its label text and any
   trailing 🔒 lock badge pushed far off to the right of it instead of
   sitting right next to it. */
.form-grid input:not([type="checkbox"]):not([type="radio"]), .form-grid select, .form-grid textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95em;
    font-family: inherit;
    background: #fdfbf5;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
    /* Grid items default to a min-width equal to their own min-content
       size, not 0 — a <select> with a long option (e.g. "🌐 Platform-wide
       (all organisations)") or a wide placeholder can't shrink below
       that no matter how narrow its column track is, so on phones it was
       forcing the whole .form-grid (and everything around it) into
       horizontal scroll instead of just wrapping/clipping its own text.
       width:100% + min-width:0 lets the field actually shrink to fit its
       column like the rest of the layout already does. */
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.form-grid input:focus:not([type="checkbox"]):not([type="radio"]), .form-grid select:focus, .form-grid textarea:focus {
    outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 4px rgba(20,51,92,.14);
}
.form-grid .span-2 { grid-column: span 2; }
/* Checkbox/toggle rows: a fixed-size native box immediately followed by
   its label text (and, on a superuser page, a small trailing 🔒 lock
   toggle/badge) — never stretched or spread apart by the input-sizing
   rule above. */
.form-grid .checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form-grid .checkbox input[type="checkbox"], .form-grid .checkbox input[type="radio"] {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--brand-blue);
    cursor: pointer;
}
.form-sep { grid-column: span 2; border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* Password field with a show/hide toggle — wrap a single input in
   .password-field and pair it with a [data-password-toggle] button
   pointing at the input's id (see assets/js/site.js). */
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 42px; }
.password-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; border-radius: 8px; font-size: 1em; opacity: .6;
    transition: opacity .15s var(--ease), background .15s var(--ease);
}
.password-toggle:hover { opacity: 1; background: rgba(20,51,92,.08); }
.password-toggle.is-visible { opacity: 1; }

/* ---------- Balance-due summary (admin/payment_required.php) ---------- */
.pr-summary { margin: 0; }
.pr-summary-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pr-summary-row:last-child { border-bottom: none; }
.pr-summary-row dt { margin: 0; color: var(--muted); font-size: 0.88em; }
.pr-summary-row dd { margin: 0; text-align: right; }
.pr-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 480px) {
    .pr-summary-row { flex-direction: column; align-items: flex-start; gap: 2px; }
    .pr-summary-row dd { text-align: left; }
    .pr-actions { flex-direction: column; }
    .pr-actions .btn { width: 100%; text-align: center; }
}

/* ---------- Quiz / Seats / Cost breakdown table (corporate_access_request.php) ----------
   A 3-column CSS grid rather than a real <table> — it lives inside a
   compact alert-info box, not a full data table, and this keeps the
   same "stack on mobile"-friendly footprint as .pr-summary-row above.
   Head/row/foot are separate grid containers sharing one
   grid-template-columns so their columns still line up visually. */
.pr-table { margin: 0; }
.pr-table-head, .pr-table-row, .pr-table-foot {
    display: grid; grid-template-columns: 1fr 70px 100px; gap: 10px; align-items: center; padding: 8px 0;
}
.pr-table-head { font-size: 0.72em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border); }
.pr-table-row { border-bottom: 1px solid var(--border); font-size: 0.9em; }
.pr-table-foot { border-top: 2px solid var(--border); margin-top: 2px; font-weight: 700; }
.pr-table-seats, .pr-table-cost { text-align: right; }
@media (max-width: 480px) {
    .pr-table-head, .pr-table-row, .pr-table-foot { grid-template-columns: 1fr 54px 84px; gap: 6px; }
    .pr-table-row, .pr-table-foot { font-size: 0.85em; }
}

/* ---------- Accordion application list (superuser/org_applications.php) ---------- */
/* Each application is two real <tr>s (not a <details>/custom widget) so
   the existing generic bulk-select-all/bulk-toolbar JS — which expects
   real table rows — keeps working untouched. The second row starts
   [hidden] and is revealed by .app-toggle; this is what turns what used
   to be one very wide, cluttered row into a compact summary you expand
   only when you need the payment breakdown and actions. */
.app-toggle {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    width: 30px; height: 30px; cursor: pointer; font-size: .95em; color: var(--muted);
    transition: background .15s var(--ease), color .15s var(--ease);
}
.app-toggle:hover { background: #f5eeda; color: var(--primary); }
.app-row-detail td { background: #f8f5ec; padding: 18px 20px; }
.app-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.app-detail-grid .span-2 { grid-column: span 2; }
.app-detail-section-label { font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
@media (max-width: 768px) {
    .app-detail-grid { grid-template-columns: 1fr; gap: 16px; }
    .app-detail-grid .span-2 { grid-column: span 1; }
    .app-row-detail td { padding: 14px 16px; }
}

/* ---------- Mobile number field (includes/phone_field.php) ---------- */
.phone-input-group { display: flex; gap: 8px; }
.phone-input-group select { flex: 0 0 auto; max-width: 150px; }
.phone-input-group input { flex: 1; min-width: 0; }
@media (max-width: 480px) {
    .phone-input-group { flex-wrap: wrap; }
    .phone-input-group select, .phone-input-group input { flex: 1 1 100%; max-width: 100%; }
}
.filter-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

/* ---------- Live price filter (quizzes.php) ---------- */
.price-filter-wrap {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 16px; margin-bottom: 18px;
}
.price-filter-label { font-size: .88em; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.price-filter { flex: 1 1 200px; min-width: 160px; accent-color: var(--brand-orange); cursor: pointer; }
.price-filter:disabled { opacity: .45; cursor: not-allowed; }
.price-filter-free { display: flex; align-items: center; gap: 6px; font-size: .88em; font-weight: 600; color: var(--text); white-space: nowrap; cursor: pointer; }
.price-filter-empty { text-align: center; padding: 18px 10px; }

/* ---------- Security check (math captcha) ---------- */
.captcha-field input { max-width: 160px; }

/* ---------- Live search ---------- */
.live-search-wrap { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-search { width: 100%; max-width: 340px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 0.92em; }
.live-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20,51,92,.12); }
tr.live-search-empty td { text-align: center; padding: 18px 10px; }
[data-export-csv] { margin-left: auto; }

/* ---------- Inline row actions expander (e.g. Payments "Email" send form) ---------- */
.inline-details { display: inline-block; vertical-align: top; }
.inline-details summary { list-style: none; cursor: pointer; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] summary { margin-bottom: 4px; }
.inline-details form.inline-form { display: flex; gap: 6px; align-items: center; }

/* ---------- Bulk actions ---------- */
.bulk-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 16px; padding: 10px 14px; background: #f8f5ec; border: 1px solid var(--border); border-radius: 10px; }
.bulk-toolbar .bulk-count { font-size: 0.85em; color: var(--muted); font-weight: 600; margin-right: 4px; }
.bulk-toolbar button:disabled { opacity: .45; cursor: not-allowed; }
.bulk-row-check, .bulk-select-all { width: 16px; height: 16px; cursor: pointer; }
th.bulk-col, td.bulk-col { width: 30px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center;
    transition: transform .35s var(--ease-spring), box-shadow .2s var(--ease);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
a.stat-card { text-decoration: none; color: inherit; display: block; cursor: pointer; }
.stat-num { font-size: 1.9em; font-weight: 800; font-family: var(--font-head); color: var(--brand-blue-dark); }
.stat-label { color: var(--muted); font-size: 0.85em; }

/* ---------- Badges / alerts ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.76em; font-weight: 700; letter-spacing: .01em; }
.badge-active, .badge-confirmed, .badge-published, .badge-trial, .badge-approved, .badge-resolved { background: var(--success-bg); color: var(--success); }
.badge-suspended, .badge-rejected, .badge-expired, .badge-declined { background: var(--danger-bg); color: var(--danger); }
.badge-pending, .badge-draft { background: var(--warning-bg); color: var(--warning); }
.badge-archived { background: #e5e7eb; color: var(--muted); }
.badge-info, .badge-in-progress { background: var(--info-bg); color: var(--info); }
.quiz-share-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- Support messaging (admin + superuser) ---------- */
.support-thread { display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow-y: auto; padding: 4px 2px; }
.support-message { border-radius: var(--radius-sm); padding: 10px 14px; background: #f5f1e6; border: 1px solid var(--border); max-width: 85%; }
.support-message-staff { background: var(--info-bg); border-color: var(--info); align-self: flex-end; }
.support-message-meta { margin-bottom: 4px; }
.support-message-body { white-space: pre-wrap; }
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; border-left: 4px solid; animation: fadeInUp .3s var(--ease); }
.alert-success { background: var(--success-bg); color: #166534; border-color: var(--success); }
.alert-danger { background: var(--danger-bg); color: #991b1b; border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: var(--warning); }
.alert-info { background: var(--info-bg); color: #1e40af; border-color: var(--info); }
/* A <form> immediately followed by a result/feedback block (an alert, or
   a card showing what a lookup found) needs breathing room above that
   block — neither .alert nor .card carry their own top margin, only
   bottom, so without this the submit button and the very next status
   message end up touching. Covers every "look up a reference code"
   status-check page (knowledge_cert_status.php, certificate_request_status.php,
   discount_code_status.php, org_application_status.php, etc.) without
   needing an inline style on each one. */
form + .alert, form + .card { margin-top: 16px; }

/* ---------- Floating support launcher (includes/support_widget.php) ---------- */
.support-fab-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 500; }
.support-fab {
    position: relative; width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
    color: #fff; font-size: 1.5em; text-decoration: none;
    box-shadow: 0 6px 18px rgba(8,23,41,.28), 0 2px 6px rgba(8,23,41,.18);
    transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.support-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 10px 24px rgba(8,23,41,.34), 0 3px 8px rgba(8,23,41,.2); text-decoration: none; }
.support-fab-badge {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: var(--danger); color: #fff; font-size: .68em; font-weight: 800;
    display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
    animation: fadeInUp .3s var(--ease);
}
.support-fab-menu {
    display: none; flex-direction: column; gap: 8px;
    position: absolute; right: 0; bottom: 66px; width: 230px;
    background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: 0 10px 28px rgba(8,23,41,.24), 0 3px 10px rgba(8,23,41,.14);
    padding: 14px; border: 1px solid var(--border);
}
.support-fab-menu.open { display: flex; animation: fadeInUp .18s var(--ease); }
.support-fab-menu-title { font-size: .78em; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.support-fab-menu-link {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 7px;
    font-size: .88em; font-weight: 600; text-decoration: none; color: #fff;
}
.support-fab-menu-link:hover { filter: brightness(1.08); text-decoration: none; }
.support-fab-menu-inbox { background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); justify-content: space-between; }
.support-fab-menu-wa { background: #25D366; }
.support-fab-menu-email { background: var(--brand-orange); }
@media (max-width: 768px) {
    .support-fab-wrap { right: 16px; bottom: 16px; }
    .support-fab { width: 48px; height: 48px; font-size: 1.3em; }
    .support-fab-menu { right: 0; bottom: 58px; width: 210px; }
}

/* ---------- Certificate verification result (verify_certificate.php) ---------- */
.cert-verify-card {
    display: flex; gap: 16px; padding: 22px; margin-top: 20px; margin-bottom: 16px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--card-bg); box-shadow: var(--shadow-sm); animation: fadeInUp .3s var(--ease);
}
.cert-verify-icon {
    flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.5em;
}
.cert-verify-body { min-width: 0; flex: 1; }
.cert-verify-status { font-family: var(--font-head); font-weight: 800; font-size: 1.05em; letter-spacing: -.01em; }
.cert-verify-holder { font-size: 1.3em; font-weight: 700; margin-top: 2px; color: var(--text); }
.cert-verify-note { margin: 6px 0 0; color: var(--muted); }
.cert-verify-details {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 20px;
    margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border);
}
.cert-verify-details dt { font-size: .72em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.cert-verify-details dd { margin: 0; font-weight: 600; color: var(--text); }
.cert-verify-details code { font-size: .95em; }

.cert-verify-valid { border-color: var(--success); }
.cert-verify-valid .cert-verify-icon { background: var(--success-bg); }
.cert-verify-valid .cert-verify-status { color: var(--success); }

.cert-verify-warning { border-color: var(--warning); }
.cert-verify-warning .cert-verify-icon { background: var(--warning-bg); }
.cert-verify-warning .cert-verify-status { color: var(--warning); }

.cert-verify-danger { border-color: var(--danger); }
.cert-verify-danger .cert-verify-icon { background: var(--danger-bg); }
.cert-verify-danger .cert-verify-status { color: var(--danger); }

@media (max-width: 560px) {
    .cert-verify-card { flex-direction: column; }
}

/* Sticky, per-user-dismissible notifications (see notification_banner.php)
   — persist across page loads until closed, unlike .alert (one-page flash). */
.notif-banner-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.notif-banner {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
    border-left: 4px solid; animation: fadeInUp .3s var(--ease); overflow: hidden;
}
.notif-banner-warning { background: var(--warning-bg); color: #92400e; border-color: var(--warning); }
.notif-banner-danger { background: var(--danger-bg); color: #991b1b; border-color: var(--danger); }
.notif-banner-icon { font-size: 1.2em; flex-shrink: 0; }
.notif-banner-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: .92em; }
.notif-banner-link { font-weight: 700; white-space: nowrap; color: inherit !important; text-decoration: underline; }
.notif-banner-close {
    background: rgba(0,0,0,.06); border: none; border-radius: 999px; width: 26px; height: 26px; flex-shrink: 0;
    font-size: 1.1em; line-height: 1; cursor: pointer; color: inherit; display: flex; align-items: center; justify-content: center;
}
.notif-banner-close:hover { background: rgba(0,0,0,.14); }
.notif-banner-clear-all { display: flex; justify-content: flex-end; }

/* Desktop-recommended hint — mobile-only nudge shown above the notification
   banners; CSS keeps it hidden past ~820px regardless of the inline JS check,
   so nothing flashes on a laptop even before the script runs. */
.desktop-hint-banner {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px;
    border-radius: var(--radius-sm); border-left: 4px solid var(--primary);
    background: var(--info-bg, #f3ecd8); color: var(--brand-blue, #14335c); font-size: .9em;
}
.desktop-hint-icon { font-size: 1.2em; flex-shrink: 0; }
.desktop-hint-banner span:not(.desktop-hint-icon) { flex: 1; min-width: 0; }
.desktop-hint-close {
    background: rgba(0,0,0,.06); border: none; border-radius: 999px; width: 26px; height: 26px; flex-shrink: 0;
    font-size: 1.1em; line-height: 1; cursor: pointer; color: inherit; display: flex; align-items: center; justify-content: center;
}
.desktop-hint-close:hover { background: rgba(0,0,0,.14); }
@media (min-width: 821px) {
    .desktop-hint-banner { display: none !important; }
}

/* Drag-and-drop public nav order editor (superuser/nav_order.php). */
.nav-order-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.nav-order-list li {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg); cursor: grab; font-weight: 600; font-size: .95em;
    transition: box-shadow .15s var(--ease), opacity .15s var(--ease);
}
.nav-order-list li:active { cursor: grabbing; }
.nav-order-list li.dragging { opacity: .4; box-shadow: var(--shadow); }
.nav-order-handle { color: var(--muted); font-size: 1.1em; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .92em; }
.tab.active { background: var(--primary); color: #fff; text-decoration: none; }

/* ---------- Quiz cards ---------- */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 26px; margin: 24px 0; }
.quiz-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--success);
    transition: transform .4s var(--ease-spring), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.quiz-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: #e6dcc0; }
.quiz-card-org { font-size: 0.75em; color: var(--brand-orange-dark); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
/* A plain "1"/"2"/"3" reusing .quiz-card-org's tiny uppercase-label
   styling (partnerships.php's "How a partnership works" steps) had no
   padded container to sit in and rendered flush in the card's top-left
   corner, clipped by the card's own border-radius/overflow:hidden. A
   proper circular step badge, used instead of .quiz-card-org there. */
.quiz-step-num {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-orange-dark, #93601f); color: #fff;
    font-family: var(--font-head); font-weight: 800; font-size: .95em;
    margin-bottom: 4px;
}
.quiz-card-org-logo { height: 18px; width: 18px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.quiz-card h3 {
    margin: 6px 0; font-size: 1.1em; font-weight: 700; letter-spacing: -0.01em; text-align: center;
    /* Clamped to 2 lines with a matching reserved min-height — a short
       one-line title and a long two-line title otherwise leave every
       card below it starting at a different vertical position, which
       is the main reason a row of cards with mixed content lengths
       looks misaligned even though the cards themselves are the same
       height (grid rows stretch them equally; it's what's INSIDE that
       was drifting). */
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: 2.6em;
}
.quiz-card-price { font-weight: 800; color: var(--brand-blue-dark); margin: 10px 0; font-family: var(--font-head); font-size: 1.1em; }
.quiz-card .btn { margin-top: 0; }

/* ---- Sponsor ribbon + banner ---- */
/* "Sponsored By" strip — plain white, sits right under the card's
   green top border so the border reads as the ribbon's own accent. */
.quiz-card-ribbon {
    text-align: center; padding: 10px 16px 8px; font-size: .74em; font-weight: 800;
    text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
/* Solid brand-blue banner underneath, carrying the sponsor's name. */
.quiz-card-sponsor-banner {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
    color: #fff; text-align: center; padding: 10px 16px; font-weight: 800;
    font-family: var(--font-head); font-size: 1.02em;
}
.quiz-card-sponsor-banner a { color: #fff; }
/* The whole banner is the click target (opens the sponsor info popup),
   not just the sponsor's name — reset it back from <button> defaults so
   it still reads as the plain solid-colour strip it's always been, plus
   a clear hover/focus/active state so it actually reads as clickable
   (a flat gradient strip otherwise looks identical to the non-clickable
   "Sponsored By" ribbon above it). A small "i" hint icon covers touch
   devices, which never see :hover at all. */
button.quiz-card-sponsor-banner {
    display: block; width: 100%; border: none; margin: 0; cursor: pointer;
    font: inherit; letter-spacing: inherit; position: relative;
    transition: background .15s ease, filter .15s ease, box-shadow .15s ease;
}
button.quiz-card-sponsor-banner::after {
    content: 'ℹ'; display: inline-block; margin-left: 6px; font-size: .82em;
    opacity: .85; vertical-align: 2px;
}
button.quiz-card-sponsor-banner:hover {
    background: linear-gradient(135deg, var(--brand-blue-dark), var(--brand-blue));
    filter: brightness(1.18);
}
button.quiz-card-sponsor-banner:active {
    filter: brightness(0.95);
}
button.quiz-card-sponsor-banner:focus-visible {
    outline: 2px solid #fff; outline-offset: -4px;
}

.quiz-card-body { padding: 22px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.quiz-card-emblem {
    width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 14px; padding: 4px;
    background: #fff; border: 2px solid var(--brand-blue); box-shadow: var(--shadow-sm);
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.quiz-card-emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.quiz-card-emblem-fallback { font-family: var(--font-head); font-weight: 800; color: var(--brand-blue); font-size: 1.3em; }
.quiz-card-desc {
    text-align: center; min-height: 2.6em;
    /* Same reasoning as .quiz-card h3 above: clamp to 2 lines instead of
       letting a longer description silently overflow the min-height and
       push everything below it (pills, buttons) down further than on a
       shorter card next to it. */
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.quiz-card-pills {
    display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-content: center;
    margin: 4px 0 16px;
    /* Reserves room for 2 wrapped rows of pills (the worst case — 3
       pills on a narrow card) so a card with only 1 or 2 pills doesn't
       leave a big uneven gap before its buttons where a busier card's
       second pill row would have been. align-content: center keeps a
       single row of pills vertically centered in that reserved space
       rather than stranded at the top of it. */
    min-height: 60px;
}
.quiz-card-pills .pill {
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px;
    font-size: .76em; font-weight: 700; background: var(--warning-bg); color: var(--warning);
    white-space: nowrap;
}
.quiz-card-pills .pill-free { background: #fdece0; color: var(--accent-dark); }
.quiz-card-pills .pill-access { background: #fef9e7; color: #92720b; }
.quiz-card-pills .pill-cert { background: #e8f8ee; color: var(--success); }
.quiz-card-pills .pill-nocert { background: #f1f2f6; color: #6b7280; }
.quiz-card-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.quiz-card-actions-row { display: flex; gap: 8px; }
.quiz-card-actions-row .btn { flex: 1; margin-top: 0; }
.btn-icon-sq {
    flex: 0 0 auto; width: 40px; height: 40px; padding: 0; display: inline-flex;
    align-items: center; justify-content: center; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
    font-size: 1.05em; transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn-icon-sq:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }
.quiz-card-actions .btn-outline-info { color: var(--info); border-color: var(--border); }
.quiz-card-actions .btn-outline-info:hover { background: var(--info); color: #fff; border-color: var(--info); }
.quiz-card-actions .btn-outline-success { color: var(--success); border-color: var(--border); }
.quiz-card-actions .btn-outline-success:hover { background: var(--success); color: #fff; border-color: var(--success); }

/* ---------- Package pricing cards ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; margin: 28px 0; align-items: stretch; }
.pricing-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 26px;
    display: flex; flex-direction: column; text-align: center; position: relative;
    transition: transform .4s var(--ease-spring), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.pricing-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: #e6dcc0; }
.pricing-card.popular {
    border: 2px solid var(--brand-orange); transform: scale(1.03);
    box-shadow: 0 20px 46px -18px rgba(189,123,46,.35);
}
.pricing-card.popular:hover { transform: scale(1.03) translateY(-6px); }
.pricing-badge {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    color: #fff; font-size: .72em; font-weight: 700; padding: 6px 16px; border-radius: 999px;
    letter-spacing: .04em; text-transform: uppercase; box-shadow: var(--shadow-sm);
}
.pricing-name { font-family: var(--font-head); font-weight: 700; font-size: 1.15em; margin-bottom: 6px; }
.pricing-price { font-family: var(--font-head); font-weight: 800; font-size: 2.3em; color: var(--brand-blue-dark); margin: 6px 0; }
.pricing-price span { font-size: .4em; color: var(--muted); font-weight: 600; }
.pricing-desc { color: var(--muted); font-size: .9em; margin-bottom: 18px; min-height: 22px; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; flex: 1; }
.pricing-features li { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: .93em; display: flex; gap: 8px; align-items: flex-start; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 800; }
.pricing-card .btn { margin-top: auto; }
.package-banner {
    display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #fff6ec, #fff);
    border: 1px solid #ffdcb0; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 22px;
    animation: fadeInUp .4s var(--ease);
}
.package-banner .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand-orange); flex-shrink: 0; animation: pulseRing 1.8s infinite; }

/* ---------- Organisation application — step wizard (register.php) ---------- */
.reg-security-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
}
/* A plain emoji sitting flush against the text (the old 🔒 + gap:4px
   layout) read as cramped and accidental rather than intentional — a
   soft circular badge gives the icon room to breathe and signals
   "this is a distinct, considered notice" the way the rest of the
   app's cards do. */
.reg-security-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(2, 132, 199, 0.12);
    font-size: 18px;
    line-height: 1;
}
.reg-security-text { line-height: 1.6; }

/* Steps as tabs — same visual language as .superuser-portal/.admin-portal
   .tabs (pill nav becomes an underlined tab strip), just scoped to the
   public Apply page and extended with a numbered badge + a "done" state
   for steps already passed. Tabs are plain <button>s wired up by
   goToStep() in register.php, not links — the whole wizard stays one
   <form>, so a real page navigation would lose everything typed so far. */
.reg-tabs { border-bottom: 1px solid var(--border); gap: 2px; margin: 22px 0 20px; padding-bottom: 0; }
.reg-tab {
    border: none; background: none; cursor: pointer; font-family: inherit;
    border-radius: 10px 10px 0 0; padding: 10px 18px 10px 14px;
    display: inline-flex; align-items: center; gap: 8px;
}
.reg-tab-num {
    width: 22px; height: 22px; border-radius: 50%; background: var(--border); color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .78em; font-weight: 700; flex-shrink: 0; transition: all .15s var(--ease);
}
.reg-tab.active { background: var(--brand-blue); color: #fff; text-decoration: none; }
.reg-tab.active .reg-tab-num { background: rgba(255,255,255,.25); color: #fff; }
.reg-tab.done:not(.active) { color: var(--success); }
.reg-tab.done:not(.active) .reg-tab-num { background: var(--success); color: #fff; }
.reg-tab.done:not(.active) .reg-tab-num::after { content: '✓'; font-size: 1.1em; }
.reg-tab.done:not(.active) .reg-tab-num span { display: none; }

.reg-panel { padding: 6px 2px 2px; }
.reg-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.reg-package-summary {
    display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
    background: #f2ead4; border: 1px solid #e9dfc4; border-radius: var(--radius-sm); padding: 14px 18px;
}
.reg-pay-options { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 16px; }
.reg-pay-option {
    display: flex; align-items: center; gap: 9px; flex: 1; min-width: 180px; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; background: #fdfbf5;
    font-weight: 600; font-size: .95em; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.reg-pay-option:has(input:checked) { border-color: var(--brand-blue); background: #f2ead4; }
.reg-pay-option input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand-blue); flex-shrink: 0; }
@media (max-width: 640px) {
    .reg-tabs { flex-wrap: wrap; row-gap: 6px; }
    .reg-tab { padding: 8px 12px; font-size: .88em; }
    .reg-tab-num { width: 20px; height: 20px; }
}

/* ---------- Paywall tabs (quiz_play.php) ----------
   Same underlined-tab treatment as .reg-tabs, minus the numbered
   badge/"done" state — these three are independent alternatives
   (unlock now / already paid / corporate code), not sequential steps. */
.paywall-tabs { border-bottom: 1px solid var(--border); gap: 2px; margin: 18px 0 20px; padding-bottom: 0; flex-wrap: wrap; }
.paywall-tab { border: none; background: none; cursor: pointer; font-family: inherit; border-radius: 10px 10px 0 0; padding: 10px 16px; }
.paywall-tab.active { background: var(--brand-blue); color: #fff; text-decoration: none; }
@media (max-width: 640px) {
    .paywall-tab { padding: 8px 12px; font-size: .88em; }
}

/* ---------- Quiz taking ---------- */
.quiz-timer { position: sticky; top: 70px; background: #fff; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 18px; font-weight: 700; text-align: center; box-shadow: var(--shadow-sm); z-index: 5; }
.quiz-question { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; transition: box-shadow .2s var(--ease); }
.quiz-question:hover { box-shadow: var(--shadow-sm); }
.option-choice { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-radius: 8px; transition: background .15s var(--ease); }
.option-choice:hover { background: #faf7f1; }
.options-editor { display: flex; flex-direction: column; gap: 8px; }
.option-row { display: flex; gap: 8px; align-items: center; }
.option-row input[type=text] { flex: 1; }
.code-block { background: #171f2e; color: #e5e7eb; padding: 14px; border-radius: 10px; overflow-x: auto; font-size: 0.85em; }

/* ---------- Results / certificates ---------- */
.result-card {
    text-align: center; padding: 52px 20px; background: #fff; border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: fadeInUp .5s var(--ease);
    position: relative; overflow: hidden;
}
.result-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--primary); }
.result-pass::before { background: linear-gradient(90deg, var(--success), #22c55e); }
.result-fail::before { background: linear-gradient(90deg, var(--danger), #ef4444); }
.result-score { font-size: 3.6em; font-weight: 800; color: var(--primary); margin: 0; font-family: var(--font-head); letter-spacing: -0.02em; }
.result-pass .result-score { color: var(--success); }
.result-fail .result-score { color: var(--danger); }
.certificate { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

/* =========================================================
   CERTIFICATE — navy/gold design, two selectable variants
   (classic / award), matching the reference HR Academy app's
   certificate exactly. Sized to an A4-landscape ratio so
   printing looks right, but scales fluidly on screen.
   ========================================================= */
:root {
    --cert-navy: #0F2A4A;
    --cert-gold: #C9A227;
    --cert-gold-text: #B8860B;
    --cert-award-bg: #fbf9f3;
    --cert-muted: #555;
    --cert-hair: #999;
    --cert-label: #8a8a8a;
}
.cert-frame {
    position: relative;
    width: 100%;
    max-width: 1050px;
    aspect-ratio: 1.4142;
    margin: 0 auto;
    background: #fff;
    font-family: Georgia, 'Times New Roman', serif;
    color: #222;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(15, 42, 74, .18);
    border-radius: 4px;
}
.cert-award { background: var(--cert-award-bg); }
.cert-content {
    position: absolute;
    inset: 0;
    padding: 3.5% 9%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ---- classic: folded ribbon corners + double border ---- */
.cert-corner-tl, .cert-corner-br {
    position: absolute; width: 0; height: 0; border-style: solid;
}
.cert-corner-tl { top: 0; left: 0; border-width: 80px 80px 0 0; border-color: var(--cert-navy) transparent transparent transparent; }
.cert-corner-br { bottom: 0; right: 0; border-width: 0 0 80px 80px; border-color: transparent transparent var(--cert-navy) transparent; }
.cert-ribbon-tl, .cert-ribbon-br {
    position: absolute; width: 130px; height: 15px; background: var(--cert-gold);
}
.cert-ribbon-tl { top: 15px; left: -24px; transform: rotate(-45deg); }
.cert-ribbon-br { bottom: 15px; right: -24px; transform: rotate(-45deg); }
.cert-border-outer, .cert-border-inner { position: absolute; pointer-events: none; }
.cert-border-outer { inset: 5px; border: 1.5px solid var(--cert-gold); }
.cert-border-inner { inset: 10px; border: 1px solid var(--cert-navy); }

/* ---- award: bracketed frame + diamond-flanked subtitle ---- */
.cert-border-award-outer, .cert-border-award-inner { position: absolute; pointer-events: none; }
.cert-border-award-outer { inset: 12px; border: 2px solid var(--cert-gold); }
.cert-border-award-inner { inset: 18px; border: 1px solid var(--cert-navy); }
.cert-bracket { position: absolute; width: 26px; height: 26px; border: 3px solid var(--cert-gold); }
.cert-bracket-tl { top: 26px; left: 26px; border-right: none; border-bottom: none; }
.cert-bracket-tr { top: 26px; right: 26px; border-left: none; border-bottom: none; }
.cert-bracket-bl { bottom: 26px; left: 26px; border-right: none; border-top: none; }
.cert-bracket-br { bottom: 26px; right: 26px; border-left: none; border-top: none; }

/* ---- shared content typography ---- */
.cert-academy { font-size: 15px; color: var(--cert-navy); font-weight: bold; letter-spacing: 1.5px; }
.cert-seal { width: 68px; height: 68px; object-fit: contain; margin: 6px auto; display: block; }
.cert-title { color: var(--cert-navy); font-size: clamp(20px, 3.2vw, 32px); letter-spacing: 4px; margin: 4px 0 0; font-weight: bold; }
.cert-subtitle { letter-spacing: 6px; color: var(--cert-muted); font-size: 13px; margin: 2px 0 10px; }
.cert-intro { font-size: 11.5px; letter-spacing: 1px; margin: 0 0 4px; color: #333; }
.cert-recipient { font-style: italic; color: var(--cert-gold-text); font-size: clamp(18px, 2.8vw, 28px); margin: 2px 0 8px; font-weight: bold; }
.cert-body { font-size: 12.5px; line-height: 1.5; }
.cert-line { margin: 5px 0; }
.cert-badge { display: inline-block; background: var(--cert-navy); color: #fff; padding: 5px 20px; font-weight: bold; letter-spacing: 2px; margin: 6px 0; font-size: 12px; }
.cert-quiz-title { display: block; font-weight: bold; font-size: 15px; color: var(--cert-navy); margin: 6px 0; }
.cert-quiz-list { list-style: none; padding: 0; margin: 6px 0; }
.cert-quiz-list li { font-family: var(--font-head); color: var(--cert-navy); font-size: 1.05em; margin: 3px 0; }
.cert-issued-line { font-size: 10.5px; letter-spacing: .5px; color: var(--cert-label); margin: 8px 0 4px; }

.cert-footer { width: 100%; margin-top: 14px; font-size: 12px; border-collapse: collapse; }
.cert-footer-col { width: 33%; text-align: center; vertical-align: bottom; display: table-cell; }
/* Single-signatory footer (certificateClassicShellHtml's cosign branch,
   when the organisation has no signatory of its own set) — a plain div
   instead of the 3-column table, so the one real signature sits centred
   on the page rather than stranded in the table's right-hand column. */
.cert-footer-single { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cert-footer-label { display: block; font-size: 10px; letter-spacing: 1.5px; color: var(--cert-label); }
.cert-footer-org { display: block; font-size: 10px; color: var(--cert-gold-text); letter-spacing: .5px; margin-top: 2px; }
.cert-footer-value { display: block; font-weight: bold; }
.cert-signature-name { display: block; font-style: italic; font-size: 16px; }
.cert-signature-rule { display: block; color: var(--cert-hair); }
.cert-signature-rule::after { content: "—————"; }
.cert-cosign-logo { width: 68px; height: 68px; object-fit: contain; border-radius: 6px; display: block; margin: 0 auto 4px; }
.cert-cosign-tagline { display: block; font-style: italic; font-size: 10px; color: var(--cert-label); line-height: 1.4; }
.cert-tagline { margin-top: 10px; font-size: 10px; color: var(--cert-navy); font-weight: bold; letter-spacing: 1.5px; }

.cert-sponsor { margin-top: 10px; padding-top: 8px; border-top: 1px solid #eee; }
.cert-sponsor-label { font-size: 10.5px; color: var(--cert-navy); font-weight: bold; letter-spacing: 1.2px; margin: 0 0 3px; }
.cert-sponsor-name { font-size: 12.5px; color: var(--cert-navy); }
.cert-sponsor-signature { margin-top: 6px; }
.cert-sponsor-logo { max-height: 56px; max-width: 170px; object-fit: contain; margin-top: 6px; display: block; margin-left: auto; margin-right: auto; }

/* ---- award-specific overrides ---- */
.cert-title-award { color: var(--cert-navy); font-size: clamp(16px, 2.4vw, 24px); letter-spacing: 6px; font-weight: bold; margin: 4px 0 0; }
.cert-subtitle-award-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.cert-subtitle-line { display: inline-block; width: 90px; height: 1px; background: var(--cert-gold); }
.cert-subtitle-diamond { display: inline-block; width: 7px; height: 7px; background: var(--cert-gold); transform: rotate(45deg); }
.cert-subtitle-award { font-size: 12px; letter-spacing: 4px; color: var(--cert-gold-text); }
.cert-intro-award { margin-top: 10px; font-size: 9.5px; color: var(--cert-muted); letter-spacing: 2px; }
.cert-recipient-award { margin-top: 6px; font-size: clamp(16px, 2.4vw, 24px); color: var(--cert-navy); font-style: italic; }
.cert-recipient-rule { width: 260px; max-width: 60%; height: 1px; background: var(--cert-gold); margin: 3px auto 0; }
.cert-body-award { margin-top: 8px; font-size: 11px; color: #444; line-height: 1.5; max-width: 560px; }
.cert-footer-value-award, .cert-signature-name-award { display: block; font-family: Georgia, serif; color: var(--cert-navy); font-weight: bold; }
.cert-signature-name-award { font-style: italic; font-weight: normal; font-size: 15px; border-bottom: 1px solid var(--cert-gold); padding-bottom: 3px; display: inline-block; margin-bottom: 4px; }

.certificate-actions { text-align: center; padding: 28px 16px 40px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media print {
    .no-print, .public-nav, .public-footer, .site-footer { display: none !important; }
    @page { size: A4 landscape; margin: 0; }
    .cert-frame { box-shadow: none; max-width: none; width: 100%; height: 100vh; aspect-ratio: auto; border-radius: 0; }
}
@media (max-width: 640px) {
    .cert-corner-tl { border-width: 46px 46px 0 0; }
    .cert-corner-br { border-width: 0 0 46px 46px; }
    .cert-ribbon-tl, .cert-ribbon-br { width: 90px; height: 10px; }
    .cert-bracket { width: 16px; height: 16px; }
}

/* =========================================================
   ORG ACCORDION GROUP — a native, keyboard-accessible <details> accordion
   grouping a list (quiz picker rows, table rows, etc.) by organisation.
   Global because it's now shared by corp_batches.php's "New corporate
   batch" quiz picker, its own Batches table, and corp_access_requests.php's
   "Eligible Quizzes" tab, and is a reasonable fit anywhere else a
   superuser needs to browse a long by-organisation list. Only the shell
   (group/summary/body) lives here — each page supplies its own row
   markup inside .cb-org-body. */
.cb-org-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
}
.cb-org-group:last-child { margin-bottom: 0; }
.cb-org-summary {
    cursor: pointer;
    padding: 10px 14px;
    font-weight: 600;
    background: var(--bg);
}
.cb-org-summary:hover { background: var(--info-bg); }
.cb-org-body { padding: 10px; }
.cb-org-group.cb-org-hidden { display: none; }

/* =========================================================
   REPORT SHELL — branded, printable HTML report used by
   reportDownloadPdf() (includes/report_pdf_helper.php) for every
   downloadable tabular report (payments, revenue, discount code
   applications, certificate/knowledge-cert queues, corporate final
   reports, quiz_corp_report.php's own Download button, etc). Same
   "print/save as PDF" approach as the certificate pages above.
   Deliberately styled to read as one family with the PDF payment
   receipt (receiptBuildPdf() in includes/receipt_helper.php) — solid
   navy header band, gold accent rule, small-caps "eyebrow" label,
   bordered table, quiet signature footer — so every document this
   platform hands someone (a receipt, a report) feels like it belongs
   to the same set, not two unrelated designs bolted together.
   ========================================================= */
.report-body { background: #f4efe0; }
.report-shell {
    max-width: 1100px;
    margin: 28px auto 60px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0 0 30px;
    overflow: hidden;
}
.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 36px;
    margin-bottom: 26px;
    background: var(--cert-navy, #0F2A4A);
    border-bottom: 3px solid var(--cert-gold, #C9A227);
}
.report-header-brand { display: flex; align-items: center; gap: 12px; }
.report-logo { width: 40px; height: 40px; object-fit: contain; }
.report-brand-name { font-weight: 800; font-size: 1.05em; color: #fff; font-family: var(--font-head); }
.report-brand-tag { font-size: .78em; color: var(--cert-gold, #C9A227); letter-spacing: .04em; }
.report-header-eyebrow { font-size: .8em; font-weight: 800; letter-spacing: .12em; color: var(--cert-gold, #C9A227); }
.report-header-meta { text-align: right; font-size: .82em; color: #dce3f0; line-height: 1.6; }
.report-meta-org { font-weight: 700; color: #fff; }
.report-title { font-size: 1.5em; font-weight: 800; margin: 0 36px 4px; color: var(--ink, #1c2333); }
.report-subtitle { margin: 0 36px 20px; color: var(--muted); font-size: .95em; }
.report-filters { margin: -12px 36px 20px; font-size: .82em; color: var(--muted); background: #f5f1e6; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; }
.report-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0 36px; width: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: .88em; }
.report-table th, .report-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.report-table th { background: #efe7d2; color: var(--cert-navy, #0F2A4A); font-weight: 700; text-transform: uppercase; font-size: .74em; letter-spacing: .04em; white-space: nowrap; }
.report-table tbody tr:nth-child(even) { background: #f8f5ec; }
.report-table tbody tr:hover { background: #f2ead4; }
.report-empty { text-align: center; color: var(--muted); font-style: italic; padding: 24px !important; }
.report-count { margin: 12px 36px 0; color: var(--muted); font-size: .82em; }
.report-actions { text-align: center; padding: 26px 0 4px; }
.report-footer {
    margin: 18px 36px 0;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: .78em;
    color: #969696;
}
@media print {
    .report-body { background: #fff; }
    .report-shell { box-shadow: none; margin: 0; max-width: none; }
    .report-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-table th { background: #efe7d2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-table tbody tr:nth-child(even) { background: #f8f5ec !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: var(--brand-blue-darker);
    color: #fff;
    padding: 13px 20px;
    border-radius: 12px;
    z-index: 999;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp .35s var(--ease);
    max-width: 340px;
}
.toast-danger { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }
.toast-success { background: var(--success); }

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .nav-toggle, .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    /* backdrop-filter on .public-nav (the frosted-glass header look)
       establishes a new CSS containing block for any position:fixed
       descendant — same effect as `filter` — which was silently
       resolving .public-nav-links' top:0/bottom:0 against the header's
       own ~70px box instead of the viewport, collapsing the drawer into
       a tiny scrollable box near the top instead of a full-height panel.
       Dropping the blur on mobile (the header is covered by the open
       drawer anyway) removes that trap. */
    .public-nav { backdrop-filter: none; -webkit-backdrop-filter: none; }
    /* .public-nav (the header) has its own position:sticky + z-index,
       which makes it a stacking context of its own — so .public-nav-links
       nested inside it, even at z-index:2000, was still only ranked at
       the HEADER's z-index (50) once compared against .nav-overlay (a
       separate element appended straight to <body>, ranked at 1999).
       Visually the drawer still looked like it was on top (its own
       opaque background painted fine within the header's context), but
       every real tap on a link was being hit-tested to the overlay
       sitting "above" the whole header instead — links looked clickable
       but silently did nothing. Raising the header above both the
       overlay (1999) and the drawer's own local z-index (2000) here
       makes its whole stacking context — drawer included — rank above
       the overlay for real, fixing click routing to match what was
       already visible. */
    .public-nav { z-index: 2001; }
    /* Off-canvas drawer sliding in from the left edge, top:0 (not "under
       the header" — it covers the header too), well above every other
       z-index on the site (highest anywhere else is under 1000) so it can
       never end up sitting behind page content again. A separate
       .nav-overlay element (see below + site.js) dims and blocks the rest
       of the page while it's open; the drawer itself only needs its own
       background. */
    .public-nav-links {
        position: fixed; top: 0; bottom: 0; left: 0; right: auto;
        width: 82%; max-width: 320px;
        /* Subtle brand-tinted wash instead of flat white — same trick
           used on the desktop sidebar (see .sidebar's gradient) — plus a
           thin colored top edge so the drawer reads as a designed
           surface, not a plain white sheet. */
        background: linear-gradient(180deg, #ffffff 0%, #f7f3e6 100%);
        flex-direction: column; align-items: flex-start;
        padding: 88px 18px 20px; gap: 3px; transform: translateX(-100%);
        transition: transform .3s var(--ease); box-shadow: var(--shadow-lg);
        z-index: 2000; overflow-y: auto;
    }
    .public-nav-links::before {
        content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
        background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange));
    }
    .public-nav-links.open { transform: translateX(0); }
    /* Each row reads as a soft "pill" rather than a bare line of text —
       icon + label on the left, a colored accent bar that grows in on
       hover/tap on the left edge (the vertical-list equivalent of the
       underline sweep the desktop nav already uses), and a gentle tinted
       background so the tap target itself is visually obvious. */
    .public-nav-links a:not(.btn) {
        display: flex; align-items: center; width: 100%;
        padding: 13px 14px; margin: 0; border-radius: 12px;
        font-weight: 600; color: var(--text); position: relative;
        transition: background .15s var(--ease), color .15s var(--ease), padding-left .15s var(--ease);
    }
    .public-nav-links a:not(.btn)::after { display: none; } /* desktop's underline sweep doesn't apply here */
    .public-nav-links a:not(.btn)::before {
        content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
        width: 3px; height: 0; border-radius: 3px; background: var(--brand-orange);
        transition: height .15s var(--ease);
    }
    .public-nav-links a:not(.btn):hover,
    .public-nav-links a:not(.btn):active {
        background: rgba(20, 51, 92, .08); color: var(--brand-blue-dark);
        padding-left: 18px; text-decoration: none;
    }
    .public-nav-links a:not(.btn):hover::before,
    .public-nav-links a:not(.btn):active::before { height: 20px; }

    .nav-dropdown { width: 100%; }
    .nav-dropdown-toggle {
        display: flex; align-items: center; justify-content: space-between;
        width: 100%; padding: 13px 14px; margin: 0; border-radius: 12px;
        background: none; border: none; font: inherit; font-weight: 600;
        text-align: left; color: var(--text); cursor: pointer;
        transition: background .15s var(--ease), color .15s var(--ease);
    }
    .nav-dropdown-toggle:hover,
    .nav-dropdown.open .nav-dropdown-toggle { background: rgba(20, 51, 92, .08); color: var(--brand-blue-dark); }
    /* Collapsed by default — a tap on the toggle above adds .open (see
       site.js), matching the "tap to reveal" pattern every other
       collapsible list on this platform already uses, instead of dumping
       every submenu open and expanded at once. */
    .nav-dropdown-menu {
        position: static; display: none; box-shadow: none; background: transparent;
        padding: 4px 0 6px 20px; margin: 2px 0 4px; min-width: 0;
        border-left: 2px solid rgba(20, 51, 92, .25);
    }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown.open .nav-dropdown-caret { transform: rotate(180deg); color: var(--brand-orange); }
    .nav-dropdown-caret { transition: transform .2s var(--ease), color .2s var(--ease); }
    .nav-dropdown-menu a { color: var(--muted) !important; padding: 9px 10px; border-radius: 9px; font-weight: 500; }
    .nav-dropdown-menu a:hover { background: rgba(20, 51, 92, .08); color: var(--brand-blue-dark) !important; }

    /* Account actions (Log in, or Admin/Superuser Portal + Log out) sit
       visually apart from the primary nav — a top divider plus
       margin-top:auto pins the group toward the bottom of the drawer
       when there's spare height, which is the pattern most people
       recognise from native app menus, instead of just tacking the CTA
       onto the end of an undifferentiated link list. */
    .nav-account {
        width: 100%; margin-top: auto; padding-top: 14px;
        border-top: 1px solid var(--border);
        display: flex; flex-direction: column; gap: 3px;
    }
    .nav-account a.btn {
        width: 100%; padding: 13px 14px; justify-content: center;
        margin-top: 4px; font-size: 1em;
    }

    /* Dim backdrop behind whichever drawer is open (public nav or admin/
       superuser sidebar — they never appear on the same page, so one
       shared overlay covers the full viewport rather than trying to track
       each drawer's own width; the drawer itself sits above it and has
       its own opaque background, so it still reads as "everything except
       the drawer" is dimmed). Injected by site.js. Faded in via opacity
       rather than an abrupt display swap so opening the menu feels like
       one smooth motion instead of two separate things happening; still
       a real element the whole time (not display:none while "hidden"),
       so it never re-triggers the click-routing issue fixed above. */
    .nav-overlay {
        position: fixed; top: 0; bottom: 0; right: 0; left: 0;
        background: rgba(15, 23, 42, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
        z-index: 1999; opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .25s var(--ease), visibility 0s linear .25s;
    }
    .nav-overlay.open {
        opacity: 1; visibility: visible; pointer-events: auto;
        transition: opacity .25s var(--ease), visibility 0s linear 0s;
    }

    .app-shell { flex-direction: column; }
    /* Same off-canvas treatment as .public-nav-links above: top:0 (covers
       the topbar too, not just "under" it), longhand positioning, and a
       z-index above the shared .nav-overlay so it can't end up sitting
       behind page content again. */
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 2000; transform: translateX(-100%);
        transition: transform .25s var(--ease);
        box-shadow: var(--shadow-lg); width: 260px; overflow-y: auto;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { padding: 20px 16px; max-width: 100%; }

    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    /* .form-sep (the <hr> dividers inside form-grid sections, e.g.
       superuser/organisations.php's create-org form) was still declaring
       `grid-column: span 2` at this width. With .form-grid collapsed to
       a single explicit column just above, that span-2 had nothing to
       span into and forced the grid to fabricate an implicit second
       column sized to content — silently doubling the effective grid
       width and pushing every field in the form off the right edge of
       the screen into horizontal scroll. */
    .form-sep { grid-column: span 1; }
    .footer-grid { grid-template-columns: 1fr; padding: 34px 6vw 18px; }
    .hero { padding: 44px 14px 34px; }
    .hero-stats { gap: 18px; }
    .pricing-card.popular { transform: scale(1); }
}

@media (max-width: 480px) {
    .public-nav, .topbar { padding-left: 4vw; padding-right: 4vw; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { width: 100%; }
}

/* ---------- Quiz engine (one-question-at-a-time, v12-style) ---------- */
.qp-badge { display: inline-block; background: var(--info-bg); color: #1e40af; font-weight: 700; font-size: .85em; padding: 5px 12px; border-radius: 999px; margin-bottom: 10px; }
.qp-progress-label { display: flex; justify-content: space-between; font-size: .85em; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.qp-progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.qp-progress-fill { height: 100%; background: linear-gradient(135deg, var(--brand-blue), var(--brand-orange)); border-radius: 999px; transition: width .3s var(--ease); }

.qp-overall-timer { position: sticky; top: 70px; z-index: 6; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-weight: 700; text-align: center; box-shadow: var(--shadow-sm); }
.qp-overall-timer.qp-timer-danger { border-color: var(--danger); color: var(--danger); }

.qp-timer-wrap { margin-bottom: 14px; }
.qp-timer-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.qp-timer-bar-fill { height: 100%; background: var(--brand-blue); transition: width .1s linear, background .2s var(--ease); }
.qp-timer-wrap.qp-timer-danger .qp-timer-bar-fill { background: var(--danger); }
.qp-timer-row { display: flex; justify-content: space-between; font-size: .8em; color: var(--muted); }
.qp-timer-num { font-weight: 700; }
.qp-timer-note { color: var(--danger); font-weight: 600; font-size: .85em; margin-top: 4px; display: none; }

.qp-question-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow-sm); animation: fadeInUp .3s var(--ease); }
.qp-question-card h2 { font-size: 1.2em; margin: 0 0 18px; color: var(--brand-blue-dark); }
.qp-options { display: flex; flex-direction: column; gap: 10px; list-style: none; padding: 0; margin: 0; }
.qp-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.qp-opt:hover { border-color: var(--brand-blue); background: #faf7f1; }
.qp-opt input { accent-color: var(--brand-blue); }
.qp-opt input:checked ~ .qp-opt-text, .qp-opt.qp-opt-selected { border-color: var(--brand-blue); background: #f2ead4; }
.qp-opt-letter { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-blue-dark); color: #fff; font-weight: 700; font-size: .8em; flex-shrink: 0; }
.qp-opt-review.qp-opt-correct-marker { border-color: var(--success); background: var(--success-bg); }
.qp-opt-review.qp-opt-wrong-marker { border-color: var(--danger); background: var(--danger-bg); }
.qp-nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.qp-flag-row { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); text-align: center; }
.qp-flag-row .btn-link { color: var(--muted); }
.qp-flag-row .btn-link:hover { color: var(--danger); }

.qp-ad-card { text-align: center; background: linear-gradient(160deg, #fff, #faf7f1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 24px; box-shadow: var(--shadow); animation: fadeInUp .3s var(--ease); }
.qp-ad-eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .78em; font-weight: 700; color: var(--brand-orange-dark); margin-bottom: 10px; }
.qp-ad-card h2 { margin: 0 0 10px; color: var(--brand-blue-dark); }
.qp-ad-card img { max-width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; margin: 12px 0; }
.qp-ad-card p { color: var(--muted); }
.qp-ad-cta { display: inline-block; margin: 14px 0; }

.qp-sponsor-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--info-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 14px; font-size: .88em; }
.qp-sponsor-eyebrow { text-transform: uppercase; letter-spacing: .05em; font-size: .78em; font-weight: 700; color: var(--muted); }
.qp-sponsor-logo { height: 22px; width: auto; border-radius: 4px; }
.qp-sponsor-name { font-weight: 700; color: var(--brand-blue-dark); }
a.qp-sponsor-name { text-decoration: underline dotted; cursor: pointer; }
.qp-sponsor-tagline { color: var(--muted); }
.qp-sponsor-link { margin-left: auto; font-weight: 600; }

.qp-breakdown-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.qp-breakdown-item:last-child { border-bottom: none; }
.qp-breakdown-icon { font-size: 1.1em; flex-shrink: 0; }

.qp-review-badge { display: inline-block; background: var(--warning-bg); color: var(--warning); font-weight: 700; font-size: .8em; padding: 4px 10px; border-radius: 999px; margin-bottom: 10px; }

/* =================================================================
   SUPERUSER PORTAL — a command-centre theme scoped to .superuser-portal
   (any page under /superuser/) so the public site and org admin portal
   are untouched. Dark ink-navy nav rail with instant search + grouped
   links; light, airy content canvas; the brand orange stays as the one
   accent thread connecting it back to the rest of the platform.
   ================================================================= */
.superuser-portal {
    --su-ink: #101a30;
    --su-ink-2: #16213c;
    --su-line: rgba(255,255,255,.09);
    --su-text: #c9d2e8;
    --su-text-dim: #7c88a6;
    --su-accent: var(--brand-orange);
    --su-accent-soft: rgba(189,123,46,.16);
}
.superuser-portal .main-content { padding: 30px 36px 54px; max-width: 1280px; }

/* ---- sidebar ---- */
.superuser-portal .sidebar.sidebar-superuser {
    width: 268px;
    background: linear-gradient(180deg, var(--su-ink) 0%, var(--su-ink-2) 100%);
    border-right: none;
    padding: 16px 12px 24px;
    color: var(--su-text);
}
.superuser-portal .sidebar-search-wrap { position: relative; margin: 2px 4px 14px; }
.superuser-portal .sidebar-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .82em; opacity: .55; pointer-events: none; }
.superuser-portal .sidebar-search {
    width: 100%; padding: 9px 32px; border-radius: 10px; border: 1px solid var(--su-line);
    background: rgba(255,255,255,.06); color: #fff; font-size: .87em; font-family: inherit;
}
.superuser-portal .sidebar-search::placeholder { color: var(--su-text-dim); }
.superuser-portal .sidebar-search:focus {
    outline: none; border-color: var(--su-accent); background: rgba(255,255,255,.09);
    box-shadow: 0 0 0 3px var(--su-accent-soft);
}
.superuser-portal .sidebar-search-kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-size: .68em; color: var(--su-text-dim); border: 1px solid var(--su-line);
    border-radius: 5px; padding: 1px 6px; font-family: inherit; pointer-events: none;
}
.superuser-portal .sidebar-search:focus ~ .sidebar-search-kbd { display: none; }

.superuser-portal .sidebar-group { margin-bottom: 2px; }
.superuser-portal .sidebar-group-label {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font-size: .7em; text-transform: uppercase; letter-spacing: .09em; color: var(--su-text-dim);
    padding: 12px 12px; font-weight: 800; background: none; border: none; font-family: inherit; cursor: pointer;
    border-radius: 8px; transition: background .15s var(--ease), color .15s var(--ease);
}
.superuser-portal .sidebar-group-label:hover { background: rgba(255,255,255,.06); color: var(--su-text); }
.superuser-portal .sidebar-group.open .sidebar-group-label { color: var(--su-accent); }
.superuser-portal .sidebar-accordion-caret { font-size: .9em; transition: transform .2s var(--ease); }
.superuser-portal .sidebar-group.open .sidebar-accordion-caret { transform: rotate(180deg); }
/* Collapsed by default — accordion JS toggles .open; while searching,
   #sidebarNav.searching forces every matching group's links visible
   regardless of .open, so results across sections stay reachable. */
.superuser-portal .sidebar-group-links { display: none; flex-direction: column; gap: 1px; padding-bottom: 4px; }
.superuser-portal .sidebar-group.open .sidebar-group-links,
.superuser-portal #sidebarNav.searching .sidebar-group-links { display: flex; }
.superuser-portal .sidebar-group[data-no-filter] .sidebar-group-links { display: flex; }
.superuser-portal .sidebar nav { gap: 1px; }
.superuser-portal .sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 9px; color: var(--su-text); font-weight: 500; font-size: .91em;
    border-left: none; margin: 0;
}
.superuser-portal .sidebar-icon { font-size: 1.02em; width: 18px; text-align: center; flex-shrink: 0; }
.superuser-portal .sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.superuser-portal .sidebar nav a.active {
    background: var(--su-accent-soft); color: #fff; font-weight: 700;
    box-shadow: inset 3px 0 0 var(--su-accent);
}
.superuser-portal .sidebar-group-danger .sidebar-group-label { color: #f87171; }
.superuser-portal .sidebar-group-danger a { color: #fca5a5; }
.superuser-portal .sidebar-group-danger a:hover { background: rgba(248,113,113,.12); color: #fecaca; }
.superuser-portal .sidebar-no-results { padding: 12px 12px; color: var(--su-text-dim); font-size: .85em; font-style: italic; }

/* ---- top bar ---- */
.superuser-portal .topbar { background: rgba(255,255,255,.97); }

/* ---- cards / tables ---- */
.superuser-portal .card { border-radius: 16px; box-shadow: 0 1px 2px rgba(16,26,48,.05); }
.superuser-portal .card-header {
    text-transform: uppercase; font-size: .76em; letter-spacing: .05em; color: var(--muted); font-weight: 800;
    padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.superuser-portal .table th { background: #fdfbf4; }
.superuser-portal .table tbody tr:hover { background: #f6f2e5; box-shadow: inset 3px 0 0 var(--su-accent); }

/* ---- stat cards (dashboard) — a thin accent rotates per card so a
   row of metrics reads as distinct signals, not one grey block ---- */
.superuser-portal .stat-card { border-top: 3px solid var(--su-accent); }
.superuser-portal .stat-card:nth-child(6n+2) { border-top-color: #0284c7; }
.superuser-portal .stat-card:nth-child(6n+3) { border-top-color: #16a34a; }
.superuser-portal .stat-card:nth-child(6n+4) { border-top-color: #7c3aed; }
.superuser-portal .stat-card:nth-child(6n+5) { border-top-color: #d97706; }
.superuser-portal .stat-card:nth-child(6n+6) { border-top-color: #db2777; }

/* ---- tabs (status filters, settings sections) ---- */
.superuser-portal .tabs { border-bottom: 1px solid var(--border); gap: 2px; margin-bottom: 22px; padding-bottom: 0; }
.superuser-portal .tab { border-radius: 10px 10px 0 0; padding: 10px 18px; }
.superuser-portal .tab.active { background: var(--su-ink); color: #fff; }

@media (max-width: 768px) {
    .superuser-portal .sidebar.sidebar-superuser { position: fixed; top: 0; }
    .superuser-portal .main-content { padding: 20px 16px; }
}

/* =================================================================
   ADMIN PORTAL — unified with the superuser portal's dark-navy rail,
   matching how v11 (this platform's single-tenant predecessor) looked:
   one consistent sidebar treatment across every portal, not a
   lighter/different look for org admins. Content area (cards, tables,
   tabs) stays the same light canvas as before — v11 itself only ever
   darkened the sidebar, never the page body — so this is scoped to
   .admin-portal .sidebar and its contents.
   ================================================================= */
.admin-portal {
    --su-ink: #101a30;
    --su-ink-2: #16213c;
    --su-line: rgba(255,255,255,.09);
    --su-text: #c9d2e8;
    --su-text-dim: #7c88a6;
    --su-accent: var(--brand-orange);
    --su-accent-soft: rgba(189,123,46,.16);
}
.admin-portal .main-content { padding: 30px 36px 54px; max-width: 1240px; }

.admin-portal .sidebar.sidebar-admin {
    padding: 18px 12px 24px;
    background: linear-gradient(180deg, var(--su-ink) 0%, var(--su-ink-2) 100%);
    border-right: none;
    color: var(--su-text);
}
.admin-portal .sidebar-org {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px 18px; border-bottom: 1px solid var(--su-line); margin-bottom: 12px;
}
.admin-portal .sidebar-org-logo {
    width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-head); font-weight: 800; font-size: 1.15em;
    box-shadow: 0 3px 8px rgba(20,51,92,.28);
}
.admin-portal .sidebar-org-text { min-width: 0; }
.admin-portal .sidebar-org-name { font-weight: 700; font-family: var(--font-head); font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.admin-portal .sidebar-org-status { margin-top: 5px; padding: 2px 9px; font-size: .68em; }

/* ---- live search — identical look/behaviour to the superuser rail ---- */
.admin-portal .sidebar-search-wrap { position: relative; margin: 2px 4px 14px; }
.admin-portal .sidebar-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .82em; opacity: .55; pointer-events: none; }
.admin-portal .sidebar-search {
    width: 100%; padding: 9px 32px; border-radius: 10px; border: 1px solid var(--su-line);
    background: rgba(255,255,255,.06); color: #fff; font-size: .87em; font-family: inherit;
}
.admin-portal .sidebar-search::placeholder { color: var(--su-text-dim); }
.admin-portal .sidebar-search:focus {
    outline: none; border-color: var(--su-accent); background: rgba(255,255,255,.09);
    box-shadow: 0 0 0 3px var(--su-accent-soft);
}
.admin-portal .sidebar-search-kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-size: .68em; color: var(--su-text-dim); border: 1px solid var(--su-line);
    border-radius: 5px; padding: 1px 6px; font-family: inherit; pointer-events: none;
}
.admin-portal .sidebar-search:focus ~ .sidebar-search-kbd { display: none; }
.admin-portal .sidebar-no-results { padding: 12px 12px; color: var(--su-text-dim); font-size: .85em; font-style: italic; }

.admin-portal .sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    border-radius: 9px; padding: 9px 12px; margin: 0; border-left: none;
    font-size: .91em; color: var(--su-text); font-weight: 500;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.admin-portal .sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.admin-portal .sidebar nav a.active {
    background: var(--su-accent-soft); color: #fff; font-weight: 700;
    box-shadow: inset 3px 0 0 var(--su-accent); border-left: none; border-radius: 9px;
}
.admin-portal .sidebar-icon { font-size: 1.02em; width: 18px; text-align: center; flex-shrink: 0; }

/* Accordion groups — same pattern as the superuser sidebar: one
   section open at a time, toggled by clicking its label. While
   searching, #sidebarNav.searching forces every matching group's
   links visible regardless of .open so results across sections stay
   reachable without extra clicks. */
.admin-portal .sidebar-group { margin-bottom: 2px; }
.admin-portal .sidebar-group-label {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font-size: .7em; text-transform: uppercase; letter-spacing: .09em; color: var(--su-text-dim);
    padding: 12px 12px; font-weight: 800; background: none; border: none; font-family: inherit; cursor: pointer;
    border-radius: 8px; transition: background .15s var(--ease), color .15s var(--ease);
}
.admin-portal .sidebar-group-label:hover { background: rgba(255,255,255,.06); color: var(--su-text); }
.admin-portal .sidebar-group.open .sidebar-group-label { color: var(--su-accent); }
.admin-portal .sidebar-accordion-caret { font-size: .9em; transition: transform .2s var(--ease); }
.admin-portal .sidebar-group.open .sidebar-accordion-caret { transform: rotate(180deg); }
.admin-portal .sidebar-group-links { display: none; flex-direction: column; gap: 1px; padding-bottom: 4px; }
.admin-portal .sidebar-group.open .sidebar-group-links,
.admin-portal #sidebarNav.searching .sidebar-group-links { display: flex; }
.admin-portal .sidebar-group[data-no-filter] .sidebar-group-links { display: flex; }

.admin-portal .card { border-radius: 16px; box-shadow: 0 1px 2px rgba(8,23,41,.05); }
.admin-portal .card-header {
    text-transform: uppercase; font-size: .76em; letter-spacing: .05em; color: var(--brand-blue-dark); font-weight: 800;
    padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.admin-portal .table th { background: #f7f3e8; }
.admin-portal .table tbody tr:hover { background: #f8f5ec; box-shadow: inset 3px 0 0 var(--brand-blue); }
.admin-portal .stat-card { border-top: 3px solid var(--brand-blue); }
.admin-portal .stat-card:nth-child(6n+2) { border-top-color: var(--brand-orange); }
.admin-portal .stat-card:nth-child(6n+3) { border-top-color: #16a34a; }
.admin-portal .stat-card:nth-child(6n+4) { border-top-color: #7c3aed; }
.admin-portal .stat-card:nth-child(6n+5) { border-top-color: #d97706; }
.admin-portal .stat-card:nth-child(6n+6) { border-top-color: #db2777; }
.admin-portal .tabs { border-bottom: 1px solid var(--border); gap: 2px; margin-bottom: 22px; padding-bottom: 0; }
.admin-portal .tab { border-radius: 10px 10px 0 0; padding: 10px 18px; }
.admin-portal .tab.active { background: var(--brand-blue); color: #fff; }

@media (max-width: 768px) {
    .admin-portal .sidebar.sidebar-admin { position: fixed; top: 0; }
    .admin-portal .main-content { padding: 20px 16px; }
}

/* =================================================================
   FLUENT / WINDOWS 11 DESKTOP-APP SHELL
   Scoped entirely to body.app-body (admin + superuser portals only —
   the public marketing site keeps its own look). Reframes the portal
   as a floating "app window" sitting on a mica-style desktop backdrop:
   acrylic (blurred, translucent) sidebar and title bar, rounded window
   controls, a rounded content panel, and Fluent-flavoured controls
   (6px radii, subtle borders, reveal-style focus) layered on top of
   the existing component styles above rather than replacing them.
   ================================================================= */
:root {
    --fluent-radius: 10px;
    --fluent-radius-sm: 8px;
    --fluent-radius-lg: 16px;
    --fluent-mica-1: #f4eeda;
    --fluent-mica-2: #f0e6cf;
    --fluent-mica-3: #f7f0df;
    --fluent-acrylic-light: rgba(255, 255, 255, .72);
    --fluent-acrylic-dark: rgba(8, 23, 41, .8);
    --fluent-stroke: rgba(8, 23, 41, .09);
    --fluent-stroke-dark: rgba(255, 255, 255, .09);
}

body.app-body {
    font-family: 'Segoe UI Variable', 'Segoe UI', var(--font-body), system-ui, sans-serif;
    background:
        radial-gradient(circle at 8% 0%, var(--fluent-mica-3) 0%, transparent 46%),
        radial-gradient(circle at 100% 12%, var(--fluent-mica-2) 0%, transparent 50%),
        linear-gradient(160deg, var(--fluent-mica-1) 0%, #f6f1e6 46%, #f4eede 100%);
    background-attachment: fixed;
}
body.app-body h1, body.app-body h2, body.app-body h3, body.app-body h4 {
    font-family: 'Segoe UI Variable', 'Segoe UI', var(--font-head), system-ui, sans-serif;
    letter-spacing: -0.005em;
}

/* ---- Title bar ---- */
body.app-body .topbar {
    background: var(--fluent-acrylic-light);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--fluent-stroke);
    padding: 9px 16px 9px 20px;
}
body.app-body .topbar-brand { font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif; font-weight: 600; font-size: 1.02em; }
body.app-body .topbar-brand img { height: 26px; width: 26px; }

/* Decorative Windows-style window controls — minimize collapses the
   sidebar, maximize widens the content panel edge-to-edge, close logs
   out (with the same confirmation any other logout link would use). */
.win-controls { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.win-controls button {
    width: 30px; height: 26px; border: none; background: transparent; cursor: pointer;
    color: var(--muted); font-size: .8em; line-height: 1; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s var(--ease), color .12s var(--ease);
}
.win-controls button:hover { background: rgba(8, 23, 41, .08); color: var(--text); }
.win-controls button.win-close:hover { background: #e81123; color: #fff; }

/* ---- Window frame ---- */
body.app-body .app-shell { padding: 10px; gap: 10px; align-items: flex-start; }
body.app-body .sidebar {
    border-radius: var(--fluent-radius-lg);
    border: 1px solid var(--fluent-stroke);
    box-shadow: 0 4px 18px -8px rgba(8, 23, 41, .18);
    overflow: hidden;
}
body.app-body.admin-portal .sidebar.sidebar-admin,
body.app-body.superuser-portal .sidebar.sidebar-superuser {
    /* Same dark acrylic rail for both portals now that they share one
       sidebar theme (see the ADMIN PORTAL block above) — previously
       admin got a light acrylic here while superuser got dark. */
    background: linear-gradient(180deg, rgba(19,27,48,.92) 0%, rgba(10,16,31,.92) 100%);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-color: var(--fluent-stroke-dark);
}
body.app-body .main-content {
    background: var(--fluent-acrylic-light);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--fluent-stroke);
    border-radius: var(--fluent-radius-lg);
    box-shadow: 0 4px 18px -8px rgba(8, 23, 41, .16);
    padding: 26px 32px;
    min-height: calc(100vh - 90px);
    transition: max-width .2s var(--ease);
}
body.app-maximized .main-content { max-width: none !important; }
body.app-body .impersonation-banner { border-radius: var(--fluent-radius); margin: 0 10px 0; }

/* ---- Fluent controls layered over the existing component styles ---- */
body.app-body .card {
    border-radius: var(--fluent-radius-lg);
    border: 1px solid var(--fluent-stroke);
    background: #fff;
    box-shadow: 0 1px 2px rgba(8,23,41,.04);
}
body.app-body .btn {
    border-radius: var(--fluent-radius-sm);
    font-weight: 600;
    box-shadow: none;
}
body.app-body .btn:hover { transform: none; box-shadow: 0 1px 4px rgba(8,23,41,.18); }
body.app-body .btn-outline { border-color: var(--fluent-stroke); }
body.app-body .btn-outline:hover { background: rgba(20,51,92,.08); color: var(--primary); border-color: var(--primary); }
body.app-body .form-grid input:not([type="checkbox"]):not([type="radio"]),
body.app-body .form-grid select,
body.app-body .form-grid textarea {
    border-radius: var(--fluent-radius-sm);
    border: 1px solid var(--fluent-stroke);
    background: #fbfcfe;
}
body.app-body .form-grid input:focus:not([type="checkbox"]):not([type="radio"]),
body.app-body .form-grid select:focus,
body.app-body .form-grid textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), inset 0 -2px 0 var(--primary);
    outline: none;
}
body.app-body .badge { border-radius: 4px; }
body.app-body .stat-card,
body.app-body .alert { border-radius: var(--fluent-radius); }
body.app-body.superuser-portal .card { background: #fff; }

@media (max-width: 768px) {
    /* body.app-body's own .app-shell rule (above) sets align-items:
       flex-start for the desktop "windowed" look, where .app-shell is a
       ROW flex container and that only affects vertical alignment. Below
       768px .app-shell switches to flex-direction:column (see the
       .app-shell rule earlier in this file), which flips which axis
       align-items controls — flex-start on a COLUMN container governs
       the CROSS axis, i.e. width, so .main-content stopped stretching to
       fill the viewport and instead shrank to its content's fit-content
       width. Content that couldn't wrap any narrower than that intrinsic
       width (stat grids, banners, tables) then pushed the box wider than
       the screen, forcing the whole page into horizontal scroll on every
       admin/superuser page. Restoring stretch here fixes it without
       touching the intentional desktop behavior. */
    body.app-body .app-shell { padding: 0; gap: 0; align-items: stretch; }
    body.app-body .sidebar, body.app-body .main-content { border-radius: 0; }
    body.app-body .main-content { width: 100%; }
}
