/*=============================================================================
  SAPPO Academy theme — the 2026 portal redesign.

  Loaded after site.css. Everything here is scoped to classes that start with
  "sa-", so pages that have not been migrated keep their old look untouched.

  Rules that site.css imposes globally and that must not leak into the new
  shell are countered below, inside .sa-shell only:
    - site.css:314   a { color: #DA1C5C !important; text-decoration: none !important }
    - site.css:1354  *:focus { outline: none }  (removes every focus ring)
  The page background is painted on .sa-shell / .sa-page, never on <body>,
  because switch-background.js writes an inline body background on every
  navigation.

  Stacking: the rail, top bar and tab bar stay at z-index 1030 or below, so
  Bootstrap modals (1050+) always open above them. Do NOT put transform,
  filter or contain on .sa-shell or .sa-main - any of those turns them into
  the containing block for position:fixed descendants and breaks the modals.
=============================================================================*/

:root {
    --sa-primary: #C8174F;
    --sa-primary-hover: #A3103F;
    --sa-primary-text: #A3103F;
    --sa-primary-deep: #7E0C31;
    --sa-primary-soft: #FCE8EF;
    --sa-ground: #F7F4F2;
    --sa-surface: #FFFFFF;
    --sa-surface-muted: #FAF8F7;
    --sa-rail: #232326;
    --sa-rail-hover: #2F2E33;
    --sa-rail-line: #3A383D;
    --sa-rail-text: #F4F1EF;
    --sa-rail-label: #A59EA3;
    --sa-ink: #1D1B1E;
    --sa-ink-2: #3A363B;
    --sa-muted: #5E5A60;
    --sa-muted-2: #6B6570;
    --sa-border: #E8E2DF;
    --sa-border-strong: #D9D2CF;
    --sa-divider: #F0EBE8;

    --sa-amber-bg: #FFF1D6;
    --sa-amber-fg: #7A4B00;
    --sa-amber-line: #F3DDB0;
    --sa-green-bg: #E2F3E8;
    --sa-green-fg: #1B6536;
    --sa-blue-bg: #E3EEFB;
    --sa-blue-fg: #1F4E8C;
    --sa-blue-line: #B9D0EE;
    --sa-grey-bg: #EEEBEA;
    --sa-grey-fg: #57525A;
    --sa-red-bg: #FDE7E7;
    --sa-red-fg: #9B1C1C;
    --sa-badge-due: #FFD98A;
    --sa-badge-due-fg: #4A2E00;

    --sa-font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --sa-font-heading: 'Zilla Slab', Georgia, serif;
    --sa-font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --sa-radius: 10px;
    --sa-radius-lg: 16px;
    --sa-focus: 0 0 0 3px rgba(200, 23, 79, 0.35);

    --sa-rail-w: 260px;
    --sa-rail-w-collapsed: 84px;
    --sa-topbar-h: 60px;
    --sa-tabbar-h: 64px;
}

/*=== Shell =================================================================*/

.sa-shell {
    display: grid;
    grid-template-columns: var(--sa-rail-w) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--sa-ground);
    color: var(--sa-ink);
    font-family: var(--sa-font);
    font-size: 15px;
    line-height: 1.5;
    transition: grid-template-columns 0.18s ease;
}

html[data-rail="collapsed"] .sa-shell {
    grid-template-columns: var(--sa-rail-w-collapsed) minmax(0, 1fr);
}

@media (prefers-reduced-motion: reduce) {
    .sa-shell {
        transition: none;
    }
}

.sa-shell *,
.sa-page * {
    box-sizing: border-box;
}

/* Undo site.css's global pink, no-underline links inside the new shell only. */
.sa-shell a,
.sa-page a {
    color: var(--sa-primary-text) !important;
}

.sa-shell a:hover,
.sa-page a:hover {
    color: var(--sa-primary-deep) !important;
}

/* site.css removes every focus ring; put a visible one back for keyboard users. */
.sa-shell :focus-visible,
.sa-page :focus-visible {
    outline: 2px solid var(--sa-primary) !important;
    outline-offset: 2px !important;
}

.sa-skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 1031;
    background: var(--sa-surface);
    color: var(--sa-ink) !important;
    padding: 10px 16px;
    border-radius: var(--sa-radius);
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.sa-skip-link:focus {
    top: 12px;
}

.sa-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sa-main-body {
    flex-grow: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px 20px;
}

.sa-main-body.sa-wide {
    max-width: 1600px;
}

/*--- Fit to the screen (desktop) -------------------------------------------
  On a desktop-sized window the browser page never scrolls: the shell is
  exactly one screen high and only the content area (main#sa-main) scrolls,
  so the rail, the footer and - on grid pages - the grid's header and pager
  stay in view. Smaller or heavily zoomed windows (below 992px wide or 600px
  tall) keep the normal page scroll, so nothing can become unreachable.

  Anything that used to scroll the window must also reset #sa-main: see
  sappoUi.scrollMainTop (navigation, PortalMainLayout) and scrollToTop
  (ModTrainingModuleAssessmentResultModal.js).
---------------------------------------------------------------------------*/
/* position: relative (not transform, filter or contain - see the header) makes the content area the
   containing block for its position:absolute descendants. Without it the module tiles' hidden
   screen-reader text was placed against the page itself, made the page taller than the window and
   gave the course page a second, outer scrollbar (seen on dev 2026/11/19). Same cause as
   .sa-table-wrap on Payments. position:fixed modals and toasts are unaffected. */
.sa-main-scroll {
    position: relative;
}

@media (min-width: 992px) and (min-height: 600px) {
    .sa-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .sa-main {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .sa-main-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }

    /* A grid page fills the content area: its header keeps its natural height,
       the grid card takes the rest, the rows scroll inside the card and the
       pager stays visible below them. */
    .sa-main-scroll:has(.sa-fill) {
        overflow-y: hidden;
    }

    .sa-main-scroll:has(.sa-fill) .sa-main-body {
        max-width: none;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .sa-fill {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .sa-fill > .sa-fill-grid {
        flex: 1 1 auto;
        min-height: 240px;
    }

    .sa-shell .sa-fill .sa-fill-grid .grid-scroll {
        max-height: none;
    }
}

/* The grid card: a scrolling table area with the pager underneath. Outside the
   fill layout (phones, short windows, the profile tab) the table area keeps a
   bounded height so the header and pager still stay close at hand. */
.sa-fill-grid {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.sa-fill-grid > .sa-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    max-height: 70vh;
    /* Keyboard focus must not land under the sticky header rows or the pinned
       Actions column. */
    scroll-padding-top: 84px;
    scroll-padding-right: 180px;
}

.sa-fill .sa-fill-grid > .sa-table-wrap {
    max-height: none;
}

.sa-grid-pager {
    flex-shrink: 0;
    padding: 6px 14px;
    border-top: 1px solid var(--sa-divider);
    background: var(--sa-surface);
}

/*=== Rail (desktop sidebar) ================================================*/

.sa-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    z-index: 1020;
    background: var(--sa-rail);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--sa-font);
}

.sa-rail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0 14px;
}

html[data-rail="collapsed"] .sa-rail-top {
    justify-content: center;
}

.sa-rail-logo {
    height: 48px;
    width: auto;
    display: block;
}

html[data-rail="collapsed"] .sa-rail-brand {
    display: none;
}

.sa-rail-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--sa-radius);
    border: 1px solid #45424A;
    background: transparent;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sa-rail-toggle:hover {
    background: var(--sa-rail-hover);
}

.sa-rail-group {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sa-rail-label);
    padding: 20px 14px 8px;
    white-space: nowrap;
}

.sa-rail-group.sa-first {
    padding-top: 6px;
}

html[data-rail="collapsed"] .sa-rail-group {
    height: 1px;
    padding: 0;
    margin: 14px 10px;
    background: var(--sa-rail-line);
    font-size: 0;
    overflow: hidden;
}

html[data-rail="collapsed"] .sa-rail-group.sa-first {
    margin-top: 4px;
}

.sa-shell .sa-rail-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--sa-rail-text) !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.sa-shell .sa-rail-link:hover {
    background: var(--sa-rail-hover);
    color: #FFFFFF !important;
}

.sa-shell .sa-rail-link.sa-active {
    background: var(--sa-primary);
    color: #FFFFFF !important;
}

.sa-rail-link .sa-rail-label {
    flex-grow: 1;
    color: inherit;
}

html[data-rail="collapsed"] .sa-shell .sa-rail-link {
    justify-content: center;
    padding: 0;
}

html[data-rail="collapsed"] .sa-rail-link .sa-rail-label,
html[data-rail="collapsed"] .sa-rail-me-text {
    display: none;
}

.sa-rail-badge {
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 8px;
    background: var(--sa-badge-due);
    color: var(--sa-badge-due-fg);
}

.sa-rail-badge.sa-pink {
    background: var(--sa-primary);
    color: #FFFFFF;
}

html[data-rail="collapsed"] .sa-rail-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 0 5px;
    font-size: 10px;
}

.sa-rail-spacer {
    flex-grow: 1;
    min-height: 32px;
}

.sa-rail-foot {
    border-top: 1px solid var(--sa-rail-line);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sa-rail-me {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 10px;
}

html[data-rail="collapsed"] .sa-rail-me {
    justify-content: center;
    padding: 0;
}

.sa-rail-me-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.sa-rail-me-name {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
}

.sa-rail-me-email {
    font-size: 12px;
    color: var(--sa-rail-label);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sa-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sa-primary);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sa-font-heading);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.sa-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*=== Mobile top bar and bottom tabs ========================================*/

.sa-topbar,
.sa-tabbar {
    display: none;
}

@media (max-width: 991.98px) {
    .sa-shell,
    html[data-rail="collapsed"] .sa-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sa-rail {
        display: none;
    }

    .sa-topbar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 1020;
        height: var(--sa-topbar-h);
        background: var(--sa-rail);
        align-items: center;
        justify-content: space-between;
        padding: 0 12px 0 16px;
    }

    .sa-topbar-logo {
        height: 42px;
        width: auto;
        display: block;
    }

    .sa-tabbar {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        background: var(--sa-surface);
        border-top: 1px solid var(--sa-border);
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    }

    .sa-shell .sa-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: var(--sa-tabbar-h);
        color: var(--sa-muted-2) !important;
        text-decoration: none !important;
        font-size: 11px;
        font-weight: 700;
        background: transparent;
        border: 0;
        font-family: inherit;
        cursor: pointer;
        position: relative;
    }

    .sa-shell .sa-tab.sa-active {
        color: var(--sa-primary) !important;
    }

    .sa-tab .sa-rail-badge {
        position: absolute;
        top: 6px;
        left: 55%;
        padding: 0 5px;
        font-size: 10px;
    }

    .sa-main-body {
        padding: 22px 16px calc(var(--sa-tabbar-h) + 28px + env(safe-area-inset-bottom));
    }

    .sa-sticky-bar {
        bottom: calc(var(--sa-tabbar-h) + env(safe-area-inset-bottom)) !important;
    }
}

/* Account sheet (mobile "Account" tab). */
.sa-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1029;
    background: rgba(29, 27, 30, 0.45);
}

.sa-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: var(--sa-surface);
    border-radius: 20px 20px 0 0;
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.2);
}

.sa-sheet-grip {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--sa-border-strong);
    margin: 0 auto 10px;
}

.sa-sheet-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sa-muted-2);
    padding: 12px 12px 6px;
}

.sa-shell .sa-sheet-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--sa-ink) !important;
    text-decoration: none !important;
    font-size: 16px;
    font-weight: 600;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.sa-shell .sa-sheet-link:hover {
    background: var(--sa-ground);
}

/*=== Typography ============================================================*/

.sa-h,
.sa-shell h1.sa-h,
.sa-shell h2.sa-h,
.sa-shell h3.sa-h,
.sa-page .sa-h {
    font-family: var(--sa-font-heading);
    font-weight: 700;
    color: var(--sa-ink);
    margin: 0;
}

.sa-title {
    font-size: 28px;
    line-height: 1.15;
}

.sa-title-sm {
    font-size: 22px;
    line-height: 1.2;
}

.sa-eyebrow {
    font-size: 14px;
    font-weight: 700;
    color: var(--sa-primary-text);
    letter-spacing: 0.02em;
}

.sa-help {
    font-size: 13px;
    color: var(--sa-muted);
    line-height: 1.45;
}

.sa-mono {
    font-family: var(--sa-font-mono);
}

.sa-strong {
    font-weight: 700;
}

/* Words that must stand out inside a sentence, in bold SAPPO pink (the full-course assessment's
   "7 module videos of the 12 modules", SAPPO 2026/11/19). */
.sa-emph {
    color: var(--sa-primary-text);
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .sa-title {
        font-size: 26px;
    }
}

/*=== Page header ===========================================================*/

.sa-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sa-page-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sa-page-header-text .sa-help {
    font-size: 14px;
}

.sa-page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/*=== Cards, layout helpers =================================================*/

.sa-card {
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius-lg);
}

.sa-card-pad {
    padding: 18px;
}

.sa-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
}

.sa-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sa-stack-sm {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sa-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.sa-split {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-start;
}

.sa-split > .sa-split-main {
    flex: 999 1 560px;
    min-width: 0;
}

.sa-split > .sa-split-side {
    flex: 1 1 320px;
    min-width: 0;
}

.sa-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.sa-grid-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.sa-full {
    grid-column: 1 / -1;
}

/*=== Buttons ===============================================================*/

.sa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: var(--sa-radius);
    font-family: var(--sa-font);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    background: transparent;
    color: var(--sa-ink);
    line-height: 1.2;
}

.sa-shell a.sa-btn,
.sa-page a.sa-btn {
    text-decoration: none !important;
}

.sa-btn:disabled,
.sa-btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

.sa-btn-primary,
.sa-shell a.sa-btn-primary,
.sa-page a.sa-btn-primary {
    background: var(--sa-primary);
    color: #FFFFFF !important;
}

.sa-btn-primary:hover:not(:disabled),
.sa-shell a.sa-btn-primary:hover,
.sa-page a.sa-btn-primary:hover {
    background: var(--sa-primary-hover);
    color: #FFFFFF !important;
}

.sa-btn-secondary,
.sa-shell a.sa-btn-secondary,
.sa-page a.sa-btn-secondary {
    background: var(--sa-surface);
    color: var(--sa-ink) !important;
    border-color: var(--sa-border-strong);
}

.sa-btn-secondary:hover:not(:disabled),
.sa-shell a.sa-btn-secondary:hover,
.sa-page a.sa-btn-secondary:hover {
    background: var(--sa-ground);
    color: var(--sa-ink) !important;
}

.sa-btn-ghost,
.sa-shell a.sa-btn-ghost,
.sa-page a.sa-btn-ghost {
    color: var(--sa-primary-text) !important;
}

.sa-btn-ghost:hover:not(:disabled),
.sa-shell a.sa-btn-ghost:hover,
.sa-page a.sa-btn-ghost:hover {
    background: var(--sa-primary-soft);
    color: var(--sa-primary-deep) !important;
}

.sa-btn-success {
    background: var(--sa-green-fg);
    color: #FFFFFF !important;
}

.sa-btn-success:hover:not(:disabled) {
    background: #14502A;
}

.sa-btn-outline-light,
.sa-shell a.sa-btn-outline-light,
.sa-page a.sa-btn-outline-light {
    color: #FFFFFF !important;
    border-color: #6B676D;
}

.sa-btn-outline-light:hover,
.sa-shell a.sa-btn-outline-light:hover,
.sa-page a.sa-btn-outline-light:hover {
    background: #3A383D;
    color: #FFFFFF !important;
}

.sa-btn-sm {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
}

.sa-btn-block {
    width: 100%;
}

.sa-icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sa-radius);
    border: 1px solid var(--sa-border-strong);
    background: var(--sa-surface);
    color: var(--sa-ink-2);
    cursor: pointer;
    flex-shrink: 0;
}

.sa-icon-btn:hover {
    background: var(--sa-ground);
}

.sa-i {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/*=== Chips =================================================================*/

.sa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.sa-chip-amber { background: var(--sa-amber-bg); color: var(--sa-amber-fg); }
.sa-chip-green { background: var(--sa-green-bg); color: var(--sa-green-fg); }
.sa-chip-blue { background: var(--sa-blue-bg); color: var(--sa-blue-fg); }
.sa-chip-grey { background: var(--sa-grey-bg); color: var(--sa-grey-fg); }
.sa-chip-pink { background: var(--sa-primary-soft); color: var(--sa-primary-text); }
.sa-chip-red { background: var(--sa-red-bg); color: var(--sa-red-fg); }

/*=== Notices ===============================================================*/

.sa-notice {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    border-radius: 14px;
    padding: 16px 18px;
    border: 1px solid var(--sa-border);
    background: var(--sa-surface-muted);
    font-size: 14px;
}

.sa-notice-amber {
    background: #FFF7E8;
    border-color: var(--sa-amber-line);
}

.sa-notice-blue {
    background: #F3F8FE;
    border-color: var(--sa-blue-line);
    color: var(--sa-blue-fg);
}

.sa-notice-red {
    background: var(--sa-red-bg);
    border-color: #F5C2C2;
    color: var(--sa-red-fg);
}

/*=== Forms =================================================================*/

.sa-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sa-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--sa-ink-2);
}

.sa-input,
.sa-select {
    height: 44px;
    width: 100%;
    border: 1px solid var(--sa-border-strong);
    border-radius: var(--sa-radius);
    padding: 0 14px;
    font-family: var(--sa-font);
    font-size: 15px;
    color: var(--sa-ink);
    background: var(--sa-surface);
}

.sa-input:focus,
.sa-select:focus {
    outline: 2px solid var(--sa-primary) !important;
    outline-offset: 1px;
    border-color: var(--sa-primary);
}

.sa-input[readonly],
.sa-input.sa-readonly {
    background: #F3EFED;
    color: #4A454C;
}

/* A password box with the portal's own Show/Hide button beside it. Edge draws a second "reveal"
   eye inside type=password inputs (and a clear cross), which vanishes and shifts the text when
   Show swaps the type to text; hiding them leaves the one control. */
/* The same box whether the password is hidden or shown. site.css styles every input[type=text]
   from the old register form - !important borders (a bottom line only), 15px 32px padding, 85%
   width, a margin and a half-second "transition: all" - and that selector outranks .sa-input, so
   Show (which makes the field type=text) made it jump, shrink and lose its border. Two classes
   outrank it; the border needs !important to beat that rule's own !important. */
.sa-input.sa-password-input,
.sa-input.sa-password-input[type=text] {
    display: block;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    width: auto;
    font-size: 15px;
    text-align: left;
    color: var(--sa-ink);
    background: var(--sa-surface);
    border: 1px solid var(--sa-border-strong) !important;
    border-radius: var(--sa-radius) !important;
    transition: none;
}

.sa-input.sa-password-input:focus,
.sa-input.sa-password-input[type=text]:focus {
    border-color: var(--sa-primary) !important;
    background: var(--sa-surface);
}

/* site.css also indents every placeholder by 25px (::placeholder), so the hint sat further in than
   the text typed over it. */
.sa-input.sa-password-input::placeholder {
    padding-left: 0;
}

.sa-password-input::-ms-reveal,
.sa-password-input::-ms-clear {
    display: none;
}

.sa-input.invalid,
.sa-select.invalid {
    border-color: var(--sa-red-fg);
}

.sa-check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    font-size: 15px;
    cursor: pointer;
}

/* flex: none, so a long label beside it can never squeeze it: as a flex item it used to shrink
   below 20px next to answers that wrap (assessment, seen on dev 2026/11/19). */
.sa-check input {
    flex: none;
    width: 20px;
    height: 20px;
    accent-color: var(--sa-primary);
    margin: 0;
}

.sa-shell .validation-message,
.sa-page .validation-message {
    color: var(--sa-red-fg);
    font-size: 13px;
    margin: 0;
}

/*=== Copy field (reference numbers) ========================================*/

.sa-copy {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px dashed var(--sa-border-strong);
    background: var(--sa-surface-muted);
    font-family: var(--sa-font);
    cursor: pointer;
    text-align: left;
    color: var(--sa-ink);
    width: 100%;
}

.sa-copy-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sa-copy-value {
    font-family: var(--sa-font-mono);
    font-size: 18px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sa-copy-action {
    font-size: 13px;
    font-weight: 700;
    color: var(--sa-primary-text);
}

/*=== Key/value lists =======================================================*/

.sa-kv {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    border-top: 1px solid var(--sa-divider);
}

.sa-kv:first-child {
    border-top: 0;
}

.sa-kv-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/*=== Tables ================================================================*/

/* position: relative so the table's .sa-visually-hidden labels (position: absolute) belong to this
   scroll box. Without it they were placed against the page instead, at their spot in the table's
   far columns, and on a phone the whole page scrolled sideways (Payments, seen 2026/11/11). */
.sa-table-wrap {
    overflow-x: auto;
    position: relative;
}

.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sa-table th {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sa-muted-2);
    background: var(--sa-surface-muted);
    text-align: left;
    padding: 12px 14px;
    white-space: nowrap;
    border: 0;
}

.sa-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--sa-divider);
    vertical-align: middle;
}

.sa-table tr.sa-selected td {
    background: #F3F8FE;
}

.sa-table .sa-filter-row th {
    padding: 8px 10px;
    background: var(--sa-surface-muted);
    text-transform: none;
    letter-spacing: 0;
}

.sa-filter-input {
    height: 36px;
    width: 100%;
    min-width: 80px;
    border: 1px solid var(--sa-border-strong);
    border-radius: 8px;
    padding: 0 10px;
    font-family: var(--sa-font);
    font-size: 13px;
    background: var(--sa-surface);
}

/*--- Data grids (admin Bookings, Users, the profile Bookings tab) ----------
  Opt-in with .sa-table-grid, so the small learner tables keep wrapping.
  One line per row; long text is clipped (full text in the title tooltip and
  in the row's details popup); the header and filter rows stick to the top
  of the scroll area; the first column marked .sa-pin sticks to the left and
  the Actions column (.sa-col-actions) to the right.
---------------------------------------------------------------------------*/
.sa-table td {
    padding: 9px 14px;
}

.sa-table-grid {
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    border-collapse: separate;
    border-spacing: 0;
    --sa-grid-head-h: 38px;
}

.sa-table-grid th {
    font-size: 11.5px;
    padding: 0 12px;
    height: var(--sa-grid-head-h);
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--sa-surface-muted);
    border-bottom: 1px solid var(--sa-divider);
}

/* GridPager's global inline style makes thead itself sticky at z-index 2,
   which puts the whole header below the pinned body cells (also z-index 2,
   later in the page), and paints the first header row lightgrey. Lift the
   header above the body and keep the theme's header colour. */
.sa-table-wrap.grid-scroll > .sa-table-grid > thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.sa-table-wrap.grid-scroll > .sa-table-grid > thead > tr > th {
    background: var(--sa-surface-muted);
}

/* The admin Bookings grid's status chips and its toolbar (date range, Clear
   filters, Export). One chip is pressed at a time. */
.sa-quick-row {
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.sa-quick {
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--sa-border-strong);
    border-radius: 999px;
    background: var(--sa-surface);
    font-family: var(--sa-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--sa-ink-2);
    cursor: pointer;
    white-space: nowrap;
}

.sa-quick:hover:not(:disabled):not([aria-pressed="true"]) {
    background: var(--sa-primary-soft);
}

.sa-quick[aria-pressed="true"] {
    background: var(--sa-primary);
    border-color: var(--sa-primary);
    color: #FFFFFF;
}

.sa-quick.sa-quick-blue[aria-pressed="true"] {
    background: var(--sa-blue-fg);
    border-color: var(--sa-blue-fg);
}

.sa-quick:focus-visible {
    outline: 2px solid var(--sa-primary);
    outline-offset: 2px;
}

.sa-quick:disabled {
    cursor: default;
}

.sa-grid-toolbar {
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.sa-grid-toolbar .sa-help {
    margin: 0;
}

.sa-grid-toolbar-end {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}

/* A sortable header (SaSortHeader): the label is a button that looks like the
   header text, with a faint up/down icon that turns pink on the sorted column. */
.sa-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.sa-sort-btn .sa-sort-i {
    width: 14px;
    height: 14px;
    opacity: 0.45;
}

.sa-sort-btn:hover .sa-sort-i,
.sa-sort-btn.sa-sort-on .sa-sort-i {
    opacity: 1;
}

.sa-sort-btn.sa-sort-on {
    color: var(--sa-ink);
}

.sa-sort-btn.sa-sort-on .sa-sort-i {
    color: var(--sa-primary);
}

.sa-sort-btn:focus-visible {
    outline: 2px solid var(--sa-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.sa-sort-btn:disabled {
    cursor: default;
}

.sa-table-grid .sa-filter-row th {
    top: var(--sa-grid-head-h);
    height: auto;
    padding: 6px 8px;
    z-index: 3;
}

.sa-table-grid .sa-filter-input {
    height: 32px;
}

.sa-table-grid td {
    padding: 6px 12px;
    white-space: nowrap;
    border-top: 0;
    border-bottom: 1px solid var(--sa-divider);
    background: var(--sa-surface);
}

.sa-table-grid .sa-chip {
    height: 22px;
    padding: 0 8px;
    font-size: 11.5px;
}

.sa-table-grid .sa-icon-btn {
    width: 30px;
    height: 30px;
}

.sa-table-grid .sa-icon-btn .sa-i {
    width: 18px;
    height: 18px;
}

.sa-table-grid .sa-btn-sm {
    min-height: 30px;
}

.sa-cell-clip {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sa-table-grid .sa-pin {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 1px 0 0 var(--sa-divider);
}

.sa-table-grid .sa-pin-2 {
    position: sticky;
    left: var(--sa-pin-1-w, 150px);
    z-index: 2;
    box-shadow: 1px 0 0 var(--sa-divider);
}

.sa-table-grid th.sa-pin,
.sa-table-grid th.sa-pin-2,
.sa-table-grid th.sa-col-actions {
    z-index: 4;
}

.sa-table-grid .sa-col-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.18);
}

/* Phone: the two pinned columns on the left (150px and more) plus the pinned actions leave almost
   no room to scroll the rest, so the left columns scroll with the grid. Actions stay in reach. */
@media (max-width: 575.98px) {
    .sa-table-grid .sa-pin,
    .sa-table-grid .sa-pin-2 {
        position: static;
        box-shadow: none;
    }
}

.sa-table-grid tr.sa-row-click {
    cursor: pointer;
}

.sa-table-grid tr.sa-row-click:hover td {
    background: #FBF6F7;
}

.sa-table-grid tr.sa-row-click:focus-visible {
    outline: none !important;
}

.sa-table-grid tr.sa-row-click:focus-visible td {
    background: #FBF0F4;
    box-shadow: inset 0 2px 0 var(--sa-primary), inset 0 -2px 0 var(--sa-primary);
}

.sa-table-grid tr.sa-selected td {
    background: #F3F8FE;
}

/*--- Booking groups ----------------------------------------------------------
  A full-course booking is one grid row (2026/11); its modules fold out below
  it in a nested table, collapsed until the expander is pressed. */
.sa-expander {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 0;
    background: none;
    padding: 2px 6px 2px 2px;
    margin-left: -2px;
    font: inherit;
    font-weight: 600;
    color: var(--sa-primary);
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
}

.sa-expander:hover {
    background: #FBEFF3;
}

.sa-expander:focus-visible {
    outline: 2px solid var(--sa-primary) !important;
    outline-offset: 1px;
}

.sa-expander .sa-expander-chevron {
    display: inline-flex;
    transition: transform 0.15s ease;
}

.sa-expander[aria-expanded="true"] .sa-expander-chevron {
    transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
    .sa-expander .sa-expander-chevron {
        transition: none;
    }
}

/* "Modules (n)" under a booking on Global Admin and its "View as" view: a
   native disclosure, closed until opened, a full row below the booking. */
.sa-booking-modules {
    flex: 1 1 100%;
    min-width: 0;
}

.sa-booking-modules > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--sa-primary);
    border-radius: 6px;
    padding: 2px 4px;
}

.sa-booking-modules > summary:focus-visible {
    outline: 2px solid var(--sa-primary) !important;
    outline-offset: 1px;
}

.sa-booking-modules[open] > summary {
    margin-bottom: 6px;
}

/* A course's modules as rows of the same grid, under the same columns: a soft
   tint, the module indented under the course, and the booking's own details
   (learner, course, reference, booked) muted, since they repeat the course row. */
.sa-table-grid tr.sa-child-row > td {
    background: #FBF8F9;
    font-size: 13.5px;
}

.sa-table-grid tr.sa-child-row:hover > td,
.sa-table-grid tr.sa-child-row:focus-visible > td {
    background: #F7EEF2;
}

.sa-table-grid tr.sa-child-row.sa-selected > td {
    background: #F3F8FE;
}

.sa-table-grid tr.sa-child-row > td.sa-child-module {
    position: relative;
    padding-left: 34px;
    font-weight: 600;
}

/* A short elbow before the module name, joining it to its course row. */
.sa-table-grid tr.sa-child-row > td.sa-child-module::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 0;
    height: 50%;
    width: 10px;
    border-left: 1px solid var(--sa-border-strong);
    border-bottom: 1px solid var(--sa-border-strong);
}

.sa-table-grid tr.sa-child-row > td.sa-child-muted {
    color: var(--sa-muted-2);
}

.sa-subtable {
    width: auto;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.sa-subtable th,
.sa-subtable td {
    padding: 6px 10px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--sa-border);
    white-space: nowrap;
}

.sa-subtable th {
    font-size: 12px;
    font-weight: 700;
    color: var(--sa-muted-2);
}

.sa-subtable tr.sa-row-click {
    cursor: pointer;
}

.sa-subtable tr.sa-row-click:hover td,
.sa-subtable tr.sa-row-click:focus-visible td {
    background: #FBF0F4;
}

.sa-subtable tr.sa-row-click:focus-visible {
    outline: 2px solid var(--sa-primary) !important;
    outline-offset: -2px;
}

/*--- Details popup sections ------------------------------------------------*/
.sa-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    align-items: start;
}

/* The status chips (first) and the proof of payment (last) take the full
   width; the sections between sit side by side where the dialog allows. */
.sa-details > :first-child,
.sa-details > :last-child {
    grid-column: 1 / -1;
}

/* Booking details: a column of short sections beside one tall one, so neither
   side leaves a gap. The last child here is a normal column, not full width. */
.sa-details-split > :last-child {
    grid-column: auto;
}

/* An e-mail address wraps before its "@" (SaEmailLink); only a part longer than
   the whole column breaks inside a word. */
.sa-email-link {
    overflow-wrap: break-word;
}

.sa-details-col {
    display: grid;
    gap: 12px;
}

.sa-details-section {
    border: 1px solid var(--sa-divider);
    border-radius: 12px;
    padding: 12px 14px;
}

.sa-details-section h3 {
    margin: 0 0 8px;
    font-family: var(--sa-font);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sa-muted-2);
}

.sa-details .sa-dl {
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 6px 12px;
}

/*--- Certificate viewer ----------------------------------------------------*/
/* The certificate PDF inside its popup (SaCertificateViewer): as tall as the
   screen allows while the title and the Download / Close buttons stay in view. */
.sa-cert-frame {
    display: block;
    width: 100%;
    height: clamp(260px, calc(100dvh - 260px), 720px);
    border: 1px solid var(--sa-border);
    border-radius: 12px;
    background: var(--sa-surface);
}

/*--- Proof preview ---------------------------------------------------------*/
.sa-proof-frame {
    width: 100%;
    /* Leaves room for the rest of the dialog (details, file row, buttons),
       so Activate is visible without scrolling on a laptop screen. */
    height: clamp(220px, calc(100dvh - 460px), 560px);
    border: 1px solid var(--sa-border);
    border-radius: 12px;
    background: var(--sa-surface-muted);
    display: block;
}

.sa-proof-img {
    display: block;
    max-width: 100%;
    max-height: clamp(220px, calc(100dvh - 460px), 560px);
    margin: 0 auto;
    border: 1px solid var(--sa-border);
    border-radius: 12px;
    object-fit: contain;
}

/*--- Card that is one big link (My bookings) -------------------------------*/
.sa-card-link {
    position: relative;
}

.sa-card-link:hover {
    border-color: var(--sa-border-strong);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.sa-shell .sa-card-link .sa-stretched {
    color: inherit !important;
    text-decoration: none !important;
}

.sa-card-link .sa-stretched::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.sa-card-link .sa-above {
    position: relative;
    z-index: 2;
}

/*=== Progress, tabs ========================================================*/

.sa-bar {
    height: 8px;
    border-radius: 999px;
    background: #EEE8E5;
    overflow: hidden;
}

.sa-bar > span {
    display: block;
    height: 100%;
    background: var(--sa-primary);
}

.sa-tabs {
    display: flex;
    gap: 28px;
    overflow-x: auto;
    border-bottom: 1px solid var(--sa-border);
}

.sa-tabs.sa-on-dark {
    border-bottom: 0;
}

/* A phone: the profile's three tabs fit without the last one being cut off at the edge. */
@media (max-width: 575.98px) {
    .sa-tabs {
        gap: 18px;
    }
}

.sa-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 4px;
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    font-family: var(--sa-font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    color: var(--sa-muted);
}

.sa-tab-btn[aria-selected="true"] {
    color: var(--sa-ink);
    border-bottom-color: var(--sa-primary);
}

/* Tabs inside a dialog (booking details): shorter, and tight to the content. */
.sa-tabs-compact {
    gap: 22px;
    margin: -6px 0 14px;
}

.sa-tabs-compact .sa-tab-btn {
    height: 40px;
    font-size: 14px;
}

.sa-tabs-compact .sa-chip {
    font-size: 11px;
    padding: 1px 8px;
}

/* A tab panel that is a grid or flex box would otherwise ignore [hidden]. */
[role="tabpanel"][hidden] {
    display: none !important;
}

.sa-on-dark .sa-tab-btn {
    color: #D8D0D4;
}

.sa-on-dark .sa-tab-btn[aria-selected="true"] {
    color: #FFFFFF;
    border-bottom-color: #E0306A;
}

.sa-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sa-badge-due);
    display: inline-block;
}

/*=== Banner (profile) ======================================================*/

.sa-banner {
    background: var(--sa-rail);
    color: #FFFFFF;
    position: relative;
    overflow: hidden;
    border-radius: var(--sa-radius-lg);
    margin-bottom: 18px;
}

.sa-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 16px, transparent 16px 32px);
    pointer-events: none;
}

.sa-banner-inner {
    position: relative;
    padding: 22px 24px 0;
}

/* .sa-shell too: ".sa-shell h1.sa-h" (dark ink) outranks a plain ".sa-banner .sa-h". */
.sa-banner .sa-h,
.sa-shell .sa-banner .sa-h {
    color: #FFFFFF;
}

/*=== Sticky action bar =====================================================*/

.sa-sticky-bar {
    position: sticky;
    bottom: 0;
    z-index: 1010;
    background: var(--sa-surface);
    border-top: 1px solid var(--sa-border);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
    margin: 16px -24px -20px;
    padding: 10px 24px;
}

.sa-sticky-bar-inner {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* Buttons only: no bar behind them, so nothing shows but the buttons at the bottom right. */
.sa-sticky-bar.sa-sticky-bar-plain {
    background: transparent;
    border-top: 0;
    box-shadow: none;
    margin: 16px 0 0;
    padding: 0 0 12px;
    pointer-events: none;
}

.sa-sticky-bar-plain .sa-sticky-bar-inner {
    justify-content: flex-end;
}

.sa-sticky-bar-plain .sa-sticky-bar-inner > * {
    pointer-events: auto;
}

@media (max-width: 991.98px) {
    .sa-sticky-bar {
        margin: 20px -16px 0;
        padding: 12px 16px;
    }
}

/*=== Dialog ================================================================*/

.sa-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(29, 27, 30, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sa-dialog {
    background: var(--sa-surface);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: var(--sa-font);
    color: var(--sa-ink);
}

.sa-dialog.sa-dialog-wide {
    max-width: 760px;
}

.sa-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/*=== Pop-ups inside the shell: centred on the content, one scrollbar ======
  Megan, 2026/11/20. Pop-ups were centred on the whole window, so beside the
  dark rail they looked off to the left. And when one was taller than the
  window it scrolled itself, next to the page's own scrollbar in #sa-scroll
  (body overflow: hidden does not reach that one), giving two scrollbars.
  Covers the older Bootstrap modals (.modal) and SaDialog alike. The
  backdrop still covers the whole screen; only the box moves. Public pages
  (.sa-page) have no rail and are left alone.
---------------------------------------------------------------------------*/

/* Bootstrap 5.2's own .modal-dialog-scrollable rules, for every modal in the
   shell: the modal never scrolls as a whole, only its body does. */
.sa-shell .modal {
    overflow-y: hidden;
    overscroll-behavior: contain;
}

.sa-shell .modal .modal-dialog {
    height: calc(100% - var(--bs-modal-margin) * 2);
}

.sa-shell .modal .modal-content {
    max-height: 100%;
    overflow: hidden;
}

.sa-shell .modal .modal-body {
    overflow-y: auto;
}

/* The module video fits a short screen without scrolling at all. 230px is
   everything else: header, title and padding (160px measured) plus the
   modal's top and bottom margins (56px), with a little to spare. */
#trainingModuleVideoModal video {
    width: 100%;
    max-height: calc(100dvh - 230px);
}

@media (min-width: 992px) {
    /* !important: Bootstrap can write an inline padding-left on .modal for
       scrollbar compensation, which would undo the rail offset. */
    .sa-shell .modal {
        padding-left: var(--sa-rail-w) !important;
    }

    html[data-rail="collapsed"] .sa-shell .modal {
        padding-left: var(--sa-rail-w-collapsed) !important;
    }

    .sa-shell .sa-dialog-backdrop {
        padding-left: calc(var(--sa-rail-w) + 16px);
    }

    html[data-rail="collapsed"] .sa-shell .sa-dialog-backdrop {
        padding-left: calc(var(--sa-rail-w-collapsed) + 16px);
    }
}

/* The page behind an open pop-up does not scroll or show its scrollbar. The
   gutter is kept so the content does not shift sideways under the backdrop.
   Desktop only: below this the window scrolls, and Bootstrap handles that. */
@media (min-width: 992px) and (min-height: 600px) {
    body.modal-open .sa-main-scroll,
    body:has(.sa-dialog-backdrop) .sa-main-scroll {
        overflow-y: hidden;
        scrollbar-gutter: stable;
    }
}

/*=== Booking pop-up (SaBookingChoiceDialog) ===============================*/

.sa-booking-points {
    list-style: none;
    margin: 0;
    padding: 4px 18px;
}

.sa-booking-points li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-top: 1px solid var(--sa-divider);
    font-size: 14px;
}

.sa-booking-points li:first-child {
    border-top: 0;
}

.sa-booking-points li > .sa-i {
    color: var(--sa-primary-text);
    margin-top: 1px;
}

.sa-booking-points li.sa-booking-point-no > .sa-i {
    color: var(--sa-muted);
}

/* A little wider than the house dialog, so the three buttons fit on one line on a desktop. */
.sa-dialog:has(.sa-booking-choice-actions) {
    max-width: 640px;
}

.sa-booking-choice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.sa-booking-choice-actions .sa-booking-choice-cancel {
    margin-right: auto;
}

/* On a phone the buttons stack at full width, "Yes, book ..." on top. */
@media (max-width: 575.98px) {
    .sa-booking-choice-actions {
        flex-direction: column-reverse;
    }

    .sa-booking-choice-actions .sa-btn {
        width: 100%;
        white-space: normal;
    }

    .sa-booking-choice-actions .sa-booking-choice-cancel {
        margin-right: 0;
    }
}

/*=== Loading placeholder (SaGhostLoader) ==================================*/

.sa-ghost {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sa-ghost-header,
.sa-ghost-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sa-ghost-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.sa-ghost-line {
    display: block;
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--sa-divider) 0%, var(--sa-surface-muted) 50%, var(--sa-divider) 100%);
    background-size: 200% 100%;
    animation: sa-ghost-shimmer 1.4s ease-in-out infinite;
}

.sa-ghost-chip {
    width: 96px;
    height: 32px;
    border-radius: 999px;
}

.sa-ghost-field {
    height: 44px;
    border-radius: var(--sa-radius);
}

.sa-ghost-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sa-ghost-table {
    overflow: hidden;
}

.sa-ghost-tr {
    display: grid;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    border-top: 1px solid var(--sa-divider);
}

.sa-ghost-tr:first-child {
    border-top: 0;
}

.sa-ghost-th {
    background: var(--sa-surface-muted);
}

.sa-ghost-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.sa-ghost-columns > .sa-ghost-list {
    flex: 1 1 300px;
}

.sa-ghost-columns > div:last-child {
    flex: 999 1 480px;
    min-width: 0;
}

.sa-ghost-list,
.sa-ghost-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.sa-ghost-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

@keyframes sa-ghost-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .sa-ghost-line {
        animation: none;
    }
}

/*=== Empty state ===========================================================*/

.sa-empty {
    padding: 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--sa-muted);
}

/*=== Side panel (admin review) =============================================*/

.sa-panel {
    border-color: var(--sa-blue-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sa-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--sa-divider);
}

.sa-panel-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sa-panel-foot {
    margin-top: auto;
    padding: 16px 18px;
    border-top: 1px solid var(--sa-divider);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sa-dl {
    margin: 0;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px 12px;
    font-size: 14px;
}

.sa-dl dt {
    color: var(--sa-muted);
    font-weight: 400;
}

.sa-dl dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/*=== KPI tiles =============================================================*/

.sa-kpi {
    flex: 1 1 220px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    font-family: var(--sa-font);
    cursor: pointer;
}

.sa-kpi.sa-kpi-blue {
    border-color: var(--sa-blue-line);
}

.sa-kpi.sa-kpi-on {
    background: #F3F8FE;
}

.sa-kpi-value {
    font-family: var(--sa-font-heading);
    font-size: 30px;
    font-weight: 700;
}

/*=== Standalone pages (signed out, session cards) ==========================*/

.sa-page {
    font-family: var(--sa-font);
    color: var(--sa-ink);
    background: var(--sa-ground);
    min-height: 100vh;
}

.sa-center-card {
    max-width: 520px;
    margin: 12vh auto 0;
    padding: 28px;
}

.sa-hero {
    background: var(--sa-rail);
    color: #FFFFFF;
}

.sa-hero .sa-h {
    color: #FFFFFF;
}

/* site.css indents every breadcrumb by 20%, which on a phone or tablet only throws away width. */
@media (max-width: 991.98px) {
    .breadcrumb {
        margin-left: 0;
    }
}

/* site.css sizes the signed-in loader 30em wide (about 480px), wider than a phone. */
@media (max-width: 575.98px) {
    .cssload-wrap.logged-in {
        left: 16px;
        width: calc(100vw - 32px);
        min-width: 0;
    }
}

/* The public home page's hero (UnAuthorizedLanding.razor). Text and picture side by side; the
   picture drops below the text when there is no room. */
.sa-hero-landing {
    border-radius: 20px;
    overflow: hidden;
    margin: 24px 0 32px;
}

.sa-hero-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: center;
    padding: 40px;
}

.sa-hero-text {
    flex: 1 1 420px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sa-hero-kicker {
    font-size: 14px;
    font-weight: 700;
    color: #F59BB9;
    letter-spacing: 0.04em;
    font-family: var(--sa-font);
}

.sa-hero-title {
    font-size: clamp(30px, 4.6vw, 46px);
    line-height: 1.08;
    margin: 0;
    overflow-wrap: anywhere;
}

.sa-hero-lead {
    margin: 0;
    font-size: clamp(16px, 1.6vw, 18px);
    line-height: 1.5;
    color: #D8D2CF;
    max-width: 560px;
    font-family: var(--sa-font);
}

/* The whole photo, cropped around the piglet's face (it sits a little left of centre). */
.sa-hero-img {
    flex: 1 1 360px;
    min-width: 0;
    max-width: 520px;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: 42% 55%;
    border-radius: 16px;
    display: block;
}

/* Stacked (the text takes the full width): the picture spans it too, a little wider than tall. */
@media (max-width: 991.98px) {
    .sa-hero-img {
        flex-basis: 100%;
        max-width: none;
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 575.98px) {
    .sa-hero-landing {
        border-radius: 16px;
        margin: 16px 0 24px;
    }

    .sa-hero-inner {
        gap: 20px;
        padding: 20px;
    }

    .sa-hero-text {
        flex-basis: 100%;
    }
}

/* Register: the breadcrumb and footer stay, but tighter, so the page fits one screen. The page's
   height is worked out from these (--sa-register-offset in Register.razor.css). */
body:has(.sa-register) .breadcrumb {
    margin-top: 12px !important;
    margin-bottom: 8px;
}

/* site.css indents every breadcrumb by 20%; here it lines up with the page instead, so it sits
   above the title. Same widths as Bootstrap's .container at each breakpoint. */
body:has(.sa-register) .breadcrumb {
    margin-left: auto;
    margin-right: auto;
    padding: 0 12px;
}

@media (min-width: 576px) {
    body:has(.sa-register) .breadcrumb { max-width: 540px; }
}

@media (min-width: 768px) {
    body:has(.sa-register) .breadcrumb { max-width: 720px; }
}

@media (min-width: 992px) {
    body:has(.sa-register) .breadcrumb { max-width: 960px; }
}

@media (min-width: 1200px) {
    body:has(.sa-register) .breadcrumb { max-width: 1140px; }
}

@media (min-width: 1400px) {
    body:has(.sa-register) .breadcrumb { max-width: 1320px; }
}

/* The signed-out top bar's menu button (narrow screens): Bootstrap's default icon is dark, which
   all but disappears on the dark bar, so it is drawn white with a light border. */
.sa-nav-toggler {
    border-color: rgba(255, 255, 255, 0.45);
}

.sa-nav-toggler:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.sa-nav-toggler .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body:has(.sa-register) .footerBorder {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
}

/*=== Footer inside the shell ===============================================*/

.sa-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--sa-border);
    background: var(--sa-surface);
}

.sa-footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px 16px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--sa-muted);
}

@media (max-width: 991.98px) {
    .sa-footer {
        margin-bottom: calc(var(--sa-tabbar-h) + env(safe-area-inset-bottom));
    }

    .sa-footer-inner {
        padding: 12px 16px;
    }
}

/*=== Utility ===============================================================*/

.sa-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 991.98px) {
    .sa-hide-mobile {
        display: none !important;
    }
}

/*=== Bootstrap-driven tabs in the new look =================================*/
/* The module page keeps Bootstrap's tab JavaScript (data-bs-toggle), which
   moves .active between buttons; these rules give them the redesign's look. */

.sa-shell .sa-tabs .nav-link.sa-tab-btn {
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--sa-muted);
    margin-bottom: 0;
}

.sa-shell .sa-tabs .nav-link.sa-tab-btn:hover {
    color: var(--sa-ink);
}

.sa-shell .sa-tabs .nav-link.sa-tab-btn.active {
    color: var(--sa-ink);
    border-bottom-color: var(--sa-primary);
    background: transparent;
}

/* Older pages still rendered inside the shell keep Bootstrap's look, but on
   the redesign's ground and fonts. */
.sa-shell .card {
    border-radius: var(--sa-radius-lg);
    border-color: var(--sa-border);
}

.sa-shell .modal-content {
    font-family: var(--sa-font);
}
