/* Moved from templates/education/authorization.tpl (was an inline <style> block). */
.auth-dropdown-wrapper {
    position: relative;
}

.auth-dropdown-toggle {
    cursor: pointer;
    outline: none;
}

.auth-dropdown-toggle:focus {
    box-shadow: none;
    outline: none;
}

.auth-dropdown-toggle::after {
    display: none !important;
}

.auth-dropdown-menu {
    display: none !important;
    position: fixed !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 22.5rem !important;
    min-width: 22.5rem;
    max-width: 26.25rem;
    background: var(--bs-body-bg, #fff);
    z-index: 10000002 !important;
    border-radius: 16px !important;
}

.auth-dropdown-menu.auth-menu-open {
    display: block !important;
}

.auth-dropdown-menu.authenticated .login-card {
    padding: 1rem !important;
}

.login-card {
    background: var(--bs-body-bg, #fff);
}

.auth-fullscreen-bar {
    display: none;
}

.auth-fullscreen-close {
    display: inline-flex;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--bs-body-color, #212529);
    background: var(--bs-tertiary-bg, #f1f3f5);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.auth-fullscreen-close:is(:hover, :focus-visible, :active) {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), .12);
}

.auth-fullscreen-close:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}




.auth-tab-pane {
    display: none;
}

.auth-tab-pane.show.active {
    display: block;
}

.auth-action-list .dropdown-item {
    transition: 0.2s ease;
}

.auth-action-list .dropdown-item:hover {
    background: var(--bs-tertiary-bg, #f1f3f5);
}

.auth-action-list .dropdown-item:is(:hover, :focus-visible) {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), .08);
}

.auth-action-list .dropdown-item.active {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), .12);
}

/* "+" next to Tickets (blocks/support.tpl): same look as the menu items. */
.auth-action-list #openTicketModal {
    color: var(--bs-dropdown-link-color, var(--bs-body-color));
    transition: 0.2s ease;
}

/* Same hover as the theme gives .dropdown-menu .dropdown-item (style.css). */
@media (hover: hover) {
    .auth-action-list #openTicketModal:hover {
        background-color: #2696db !important;
        color: #fff !important;
    }
}

#familyAccountPicker h5 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bs-body-color, #243247);
}

#familyAccountPicker {
    --family-text: #29435c;
    --family-muted: #718497;
    --family-border: #e3edf5;
    --family-bg: #fff;
    --family-hover: #edf6fd;
    --family-selected: #e7f3fd;
    --family-accent: #2678b8;
}

#familyAccountsList {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    max-height: min(380px, 55dvh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#familyAccountsList > .dropdown-item {
    min-height: 62px;
    margin: 0 !important;
    padding: 10px !important;
    gap: 10px !important;
    border: 1px solid var(--family-border);
    border-radius: 12px !important;
    background: var(--family-bg);
    color: var(--family-text);
    white-space: normal;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

#familyAccountsList > .dropdown-item img {
    width: 36px;
    height: 36px;
    border: 2px solid var(--family-bg);
    box-shadow: 0 0 0 1px var(--family-border);
}

#familyAccountsList > .dropdown-item > div {
    min-width: 0;
    flex: 1;
    gap: 4px;
}

#familyAccountsList .fw-medium {
    font-size: 13px;
    font-weight: 600 !important;
    color: inherit;
}

#familyAccountsList .text-muted {
    color: var(--family-muted) !important;
    font-size: 11px !important;
}

#familyAccountsList > .dropdown-item::after {
    --family-indicator: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 3 5 5-5 5'/%3E%3C/svg%3E");
    content: "";
    display: block;
    align-self: center;
    background-color: currentColor;
    mask: var(--family-indicator) center / 12px 12px no-repeat;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    color: var(--family-muted);
    font-size: 23px;
    line-height: 1;
}

#familyAccountsList > .dropdown-item:not(:disabled):is(:hover, :focus-visible) {
    background-color: var(--family-hover) !important;
    color: var(--family-accent) !important;
    border-color: #a8cfea;
}

#familyAccountsList > .dropdown-item:not(:disabled):is(:hover, :focus-visible) .text-muted {
    color: var(--family-accent) !important;
}

#familyAccountsList > .dropdown-item:not(:disabled):hover::after {
    color: var(--family-accent);
}

#familyAccountsList > .dropdown-item:focus-visible {
    outline: 2px solid var(--family-accent);
    outline-offset: -3px;
}

#familyAccountsList > .dropdown-item:not(:disabled):active {
    background-color: var(--family-selected) !important;
    border-color: var(--family-accent);
}

#familyAccountsList > .dropdown-item.family-account-current {
    color: var(--family-accent);
    background: var(--family-selected) !important;
    border-color: #b6d8ef;
    opacity: 1;
}

#familyAccountsList > .family-account-current::after {
    --family-indicator: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 8 3 3 7-7'/%3E%3C/svg%3E");
    color: var(--family-accent);
    font-size: 14px;
    font-weight: 700;
}

[data-bs-theme="dark"] #familyAccountPicker {
    --family-text: #e0eaf3; --family-muted: #a2b6c8; --family-border: #35495c;
    --family-bg: #203040; --family-hover: #293e51; --family-selected: #284760;
    --family-accent: #b5dcff;
}

@media (prefers-reduced-motion: reduce) {
    #familyAccountsList > .dropdown-item { transition: none; }
}

.family-back-button {
    border: 1px solid transparent;
    border-radius: 0.75rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.family-back-button {
    padding: 0.5rem 0.8rem;
    color: #249fdd;
    background: rgba(36, 159, 221, 0.1);
    border-color: rgba(36, 159, 221, 0.25);
}

.family-back-button:hover {
    background: rgba(36, 159, 221, 0.18);
}

.family-back-button:focus-visible {
    outline: 2px solid #249fdd;
    outline-offset: 3px;
}

.user-auth-card {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 14px !important;
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), .07), var(--bs-body-bg, #fff)) !important;
    overflow-wrap: anywhere;
}

.user-auth-card h4 {
    font-size: 18px;
    line-height: 1.4;
}

.auth-policy-links .btn {
    white-space: nowrap;
    border-color: var(--bs-border-color, #dee2e6);
    color: var(--bs-secondary-color, #6c757d);
    font-size: 12px;
    transition: background-color .15s ease, color .15s ease;
}

.auth-policy-links .btn:is(:hover, :focus-visible) {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), .08);
}

.auth-dropdown-toggle:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 4px;
    border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .auth-tabs .nav-link,
    .auth-action-list .dropdown-item,
    .auth-policy-links .btn { transition: none; }
}

.registration-open {
    width: 26.25rem !important;
    min-width: 26.25rem;
}

@media (max-width: 575.98px) {
    .auth-dropdown-menu {
        width: calc(100vw - 24px) !important;
        min-width: auto;
        max-width: none;
    }

    .registration-open {
        width: calc(100vw - 24px) !important;
        min-width: auto;
    }
}

/* Larger screens: Sign up fields scroll inside the dropdown, the step button stays visible. */
/* ------------------------------------------------------------------
   Phones (< 576px): bottom sheet.
   authorization.js sizes #authDropdown to the visual viewport (it shrinks
   when the keyboard opens). Here that box is only the dimmed backdrop;
   the visible window is .auth-sheet, pinned to its bottom edge:
     header  .auth-fullscreen-bar + #authTabs        (fixed)
     body    #pills-tabContent                       (the only scroll area)
     footer  .auth-sheet-actions (sticky) + policy   (always visible)
   ------------------------------------------------------------------ */
.auth-sheet-backdrop,
.auth-intro,
.auth-input__icon {
    display: none;
}

@media (max-width: 575.98px) {
    #authDropdown.auth-menu-fullscreen {
        --auth-sheet-bg: var(--bs-body-bg, #fff);
        --auth-sheet-radius: 20px;
        --auth-sheet-pad: 1.25rem;   /* one horizontal inset for every zone */
        --auth-sheet-gap: 1rem;      /* one vertical step between blocks */
        /* Sticky action bar height: focused fields keep this much room below them. */
        --auth-sheet-actions-h: 5.5rem;
        background: transparent;
        /* The theme centers the menu with translateY(-50%); authorization.js already places it at 0,0. */
        transform: none !important;
        /* Overrides the desktop card look (!important in the base rule / .shadow-lg). */
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    #authDropdown.auth-menu-fullscreen.auth-menu-open {
        display: flex !important;
        flex-direction: column;
        justify-content: flex-end;
    }

    #authDropdown.auth-menu-fullscreen .auth-sheet-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, .5);
        touch-action: none;
        animation: auth-backdrop-in .2s ease-out;
    }

    #authDropdown.auth-menu-fullscreen .auth-sheet {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        /* Full screen: fills the visual-viewport box that authorization.js sizes (shrinks with the keyboard). */
        flex: 1 1 auto;
        min-height: 0;
        height: 100vh;
        height: 100dvh;
        max-height: 100%;
        overflow: hidden;
        background: var(--auth-sheet-bg);
        padding-top: env(safe-area-inset-top, 0px);
        animation: auth-sheet-in .28s cubic-bezier(.2, .8, .2, 1);
    }

    /* Header */
    #authDropdown.auth-menu-fullscreen .auth-fullscreen-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        flex-shrink: 0;
        padding: var(--auth-sheet-gap) var(--auth-sheet-pad) 0;
        background: transparent;
    }

    #authDropdown.auth-menu-fullscreen .auth-fullscreen-logo {
        display: block;
        width: auto;
        max-width: 190px;
        height: 34px;
    }

    #authDropdown.auth-menu-fullscreen .auth-fullscreen-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1.125rem;
        font-weight: 700;
        color: var(--bs-body-color, #212529);
    }

    #authDropdown.auth-menu-fullscreen .login-card {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        /* .p-4 / .authenticated padding are !important utilities. */
        padding: var(--auth-sheet-gap) var(--auth-sheet-pad) 0 !important;
    }

    #authDropdown.auth-menu-fullscreen #authTabs {
        flex-shrink: 0;
        margin-bottom: var(--auth-sheet-gap) !important;
    }

    #authDropdown.auth-menu-fullscreen #authTabs .nav-link {
        min-height: 44px;
    }

    /* Body: the only scrolling zone. Height follows content (short Login stays compact). */
    #authDropdown.auth-menu-fullscreen #pills-tabContent {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Full-bleed so focus rings are not clipped and the action bar spans the sheet. */
        margin-inline: calc(var(--auth-sheet-pad) * -1);
        padding: .25rem var(--auth-sheet-pad) 0;
    }

    /* Short Login form sits in the vertical middle of the free space. Auto margins
       fall back to 0 when the content is taller, so it never gets cut off at the top. */
    #authDropdown.auth-menu-fullscreen #pills-signin.show.active {
        margin-block: auto;
    }

    #authDropdown.auth-menu-fullscreen .login-card :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
        /* 16px or more: iOS Safari does not zoom the page on focus. */
        font-size: max(16px, 1rem);
        scroll-margin-top: 1rem;
        scroll-margin-bottom: var(--auth-sheet-actions-h);
    }

    #authDropdown.auth-menu-fullscreen .login-card :is(input.form-control:not([type="file"]), select.form-select, select.form-control) {
        min-height: 48px;
    }

    #authDropdown.auth-menu-fullscreen .auth-password-toggle {
        width: 48px;
        height: 48px;
        color: #6f7c8b;
        font-size: 1.0625rem;
        -webkit-tap-highlight-color: transparent;
        transition: color .15s ease;
    }

    #authDropdown.auth-menu-fullscreen .auth-password-toggle:is(:hover, :focus-visible) {
        color: var(--bs-primary);
    }

    
    /* Same rhythm in both forms: label 6px above its field, fields 1rem apart,
       same field shape. Signup fields come from the shared wizard (.mb-2/.mt-0 utilities). */
    #authDropdown.auth-menu-fullscreen .auth-field,
    #authDropdown.auth-menu-fullscreen #pills-signup .mb-3,
    #authDropdown.auth-menu-fullscreen .user-step legend {
        margin-bottom: var(--auth-sheet-gap) !important;
    }

    #authDropdown.auth-menu-fullscreen .user-step > .row {
        --bs-gutter-y: 0;
        row-gap: var(--auth-sheet-gap);
    }

    #authDropdown.auth-menu-fullscreen .user-step > .row > * {
        margin: 0 !important;
    }

    
    #authDropdown.auth-menu-fullscreen .login-card :is(.form-control, .form-select) {
        border-color: #dfe5ec;
        border-radius: 12px;
    }

    #authDropdown.auth-menu-fullscreen .auth-login-row {
        margin: 0;
    }

    
    
    /* Footer, part 1: primary action stays pinned to the bottom of the body. */
    #authDropdown.auth-menu-fullscreen .auth-sheet-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        gap: .5rem;
        margin-inline: calc(var(--auth-sheet-pad) * -1);
        margin-top: 0 !important; /* replaces .mt-3; spacing comes from the padding below */
        padding: var(--auth-sheet-gap) var(--auth-sheet-pad);
        background: var(--auth-sheet-bg);
        transition: box-shadow .2s ease;
    }

    /* Shadow over the footer while there is more content below (class set by the script below). */
    #authDropdown.auth-sheet-more .auth-sheet-actions {
        box-shadow: 0 -10px 16px -12px rgba(16, 24, 40, .35);
    }

    #authDropdown.auth-menu-fullscreen .auth-sheet-actions > .btn {
        display: inline-flex;
        flex: 1 1 0;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 48px;
    }

    /* Footer, part 2: policy links, clear of the home indicator. */
    #authDropdown.auth-menu-fullscreen .auth-policy-links {
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        gap: .25rem;
        margin-top: 0 !important;
        margin-inline: calc(var(--auth-sheet-pad) * -1);
        width: auto !important;
        padding: .5rem var(--auth-sheet-pad) max(.5rem, env(safe-area-inset-bottom));
        border-radius: 0 !important; /* drops .rounded-2 so the divider runs edge to edge */
        border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, .08));
        background: var(--auth-sheet-bg);
    }

    /* Quiet pill links separated by dots instead of a framed button group. */
    #authDropdown.auth-menu-fullscreen .auth-policy-links .btn {
        position: relative;
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        min-height: 36px;
        margin: 0;
        padding: .375rem .75rem;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: var(--bs-secondary-color, #6b7a89);
        font-size: .8125rem;
        font-weight: 500;
        letter-spacing: .01em;
    }

    #authDropdown.auth-menu-fullscreen .auth-policy-links .btn + .btn::before {
        content: "";
        position: absolute;
        left: -.25rem;
        top: 50%;
        width: 3px;
        height: 3px;
        margin-top: -1.5px;
        border-radius: 50%;
        background: currentColor;
        opacity: .45;
        pointer-events: none;
    }

    #authDropdown.auth-menu-fullscreen .auth-policy-links .btn:is(:hover, :focus-visible, :active) {
        color: var(--bs-primary);
        background: rgba(var(--bs-primary-rgb), .08);
    }

    /* Signed-in menu: no tabs, so the card itself scrolls between header and policy links. */
    #authDropdown.auth-menu-fullscreen.authenticated .login-card {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-policy-links {
        margin-top: 1rem !important;
    }

    /* ---- Look: soft brand glow, underline tabs, filled fields, raised primary button ---- */
    #authDropdown.auth-menu-fullscreen .auth-sheet {
        background:
            radial-gradient(120% 40% at 100% 0%, rgba(var(--bs-primary-rgb), .16), transparent 70%),
            radial-gradient(90% 30% at 0% 0%, rgba(var(--bs-primary-rgb), .08), transparent 70%),
            var(--auth-sheet-bg);
    }

    #authDropdown.auth-menu-fullscreen .login-card {
        background: transparent;
    }

    #authDropdown.auth-menu-fullscreen .auth-fullscreen-close {
        border-color: transparent;
        background: rgba(255, 255, 255, .75);
        box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .08);
    }

    [data-bs-theme="dark"] #authDropdown.auth-menu-fullscreen .auth-fullscreen-close {
        background: var(--bs-tertiary-bg);
    }

    /* Tabs: two equal halves, no fill; thin rail with a primary bar under the active tab. */
    #authDropdown.auth-menu-fullscreen #authTabs {
        gap: 0;
        padding: 0;
        border: 0;
        border-bottom: 1px solid rgba(var(--bs-secondary-rgb, 108, 117, 125), .18) !important;
        border-radius: 0;
        background: transparent;
    }

    #authDropdown.auth-menu-fullscreen #authTabs .nav-item {
        flex: 1 1 0;
    }

    #authDropdown.auth-menu-fullscreen #authTabs .nav-link {
        border-radius: 0;
        background: transparent !important; /* theme .nav-tabs sets background: none !important */
        color: var(--bs-secondary-color, #6c757d);
        font-weight: 600;
        transition: color .2s ease;
    }

    #authDropdown.auth-menu-fullscreen #authTabs .nav-link::after {
        bottom: 0;
        height: 2px;
        border-radius: 2px;
        background-color: var(--bs-primary);
    }

    #authDropdown.auth-menu-fullscreen #authTabs .nav-link.active {
        color: var(--bs-primary) !important;
    }

    #authDropdown.auth-menu-fullscreen .auth-intro {
        display: block;
        margin-bottom: calc(var(--auth-sheet-gap) * 1.5);
    }

    #authDropdown.auth-menu-fullscreen .auth-intro__title {
        margin: 0 0 .25rem;
        color: var(--bs-emphasis-color, #101828);
        font-size: 1.5rem;
        font-weight: 700;
        letter-spacing: -.02em;
        line-height: 1.25;
    }

    #authDropdown.auth-menu-fullscreen .auth-intro__text {
        margin: 0;
        color: var(--bs-secondary-color, #667085);
        font-size: .9375rem;
    }

    /* Fields need a visible edge on phones: a mid-grey border and a slightly deeper fill. */
    #authDropdown.auth-menu-fullscreen .login-card :is(.form-control, .form-select):not([type="file"]) {
        border-color: #aeb9c6;
        background-color: #e9eef4;
        transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
    }

    #authDropdown.auth-menu-fullscreen .login-card :is(.form-control, .form-select):not([type="file"]):focus {
        border-color: var(--bs-primary);
        background-color: var(--auth-sheet-bg);
        box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), .14);
    }

    /* Role picker is a select2 widget: give it the same filled field look. */
    #authDropdown.auth-menu-fullscreen .login-card .select2-container .select2-selection--single {
        display: flex;
        align-items: center;
        min-height: 48px;
        border-color: #aeb9c6;
        border-radius: 12px;
        background-color: #e9eef4;
        font-size: 16px;
    }

    [data-bs-theme="dark"] #authDropdown.auth-menu-fullscreen .login-card :is(.form-control, .form-select):not([type="file"]),
    [data-bs-theme="dark"] #authDropdown.auth-menu-fullscreen .login-card .select2-container .select2-selection--single {
        border-color: var(--bs-border-color);
        background-color: var(--bs-tertiary-bg);
    }

    /* Keep validation visible on the filled fields. */
    #authDropdown.auth-menu-fullscreen .login-card .is-invalid {
        border-color: var(--bs-form-invalid-border-color, #dc3545);
    }

    #authDropdown.auth-menu-fullscreen .auth-input {
        position: relative;
    }

    #authDropdown.auth-menu-fullscreen .auth-input__icon {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 48px;
        padding-left: 4px;
        color: #6f7c8b; /* light grey; --bs-secondary-color is near-black */
        font-size: 1rem;
        line-height: 1;
        pointer-events: none;
        transition: color .15s ease;
    }

    #authDropdown.auth-menu-fullscreen .auth-input .form-control {
        padding-left: 44px;
    }

    #authDropdown.auth-menu-fullscreen .auth-input .form-control::placeholder {
        color: #6f7c8b;
    }

    #authDropdown.auth-menu-fullscreen .auth-input:focus-within .auth-input__icon {
        color: var(--bs-primary);
    }

    #authDropdown.auth-menu-fullscreen .auth-sheet-actions > .btn-primary {
        border: 0;
        border-radius: 12px;
        background-image: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0));
        box-shadow: 0 8px 18px -8px rgba(var(--bs-primary-rgb), .7);
        font-weight: 600;
        letter-spacing: .01em;
        transition: transform .1s ease, box-shadow .15s ease;
    }

    #authDropdown.auth-menu-fullscreen .auth-sheet-actions > .btn-primary:active {
        transform: translateY(1px);
        box-shadow: 0 4px 10px -6px rgba(var(--bs-primary-rgb), .7);
    }

    #authDropdown.auth-menu-fullscreen .auth-sheet-actions > .btn-secondary {
        border: 0;
        border-radius: 12px;
        background: rgba(var(--bs-secondary-rgb, 108, 117, 125), .12);
        color: var(--bs-body-color);
        font-weight: 600;
    }

    
    #authDropdown.auth-menu-fullscreen .auth-login-row .form-check-input {
        border-radius: 6px;
    }

    /* ---- Signed-in menu on phones: calm profile header, soft grouped menu, quiet log out.
       CSS only (no markup changes), scoped to .authenticated so the guest window is untouched. ---- */
    #authDropdown.auth-menu-fullscreen.authenticated {
        --auth-acc-group: rgba(var(--bs-secondary-rgb, 108, 117, 125), .06);
        --auth-acc-line: rgba(var(--bs-secondary-rgb, 108, 117, 125), .16);
        --auth-acc-icon: #98a2b3; /* light grey; --bs-secondary-color is near-black */
        --auth-acc-press: rgba(var(--bs-primary-rgb), .06);
        --auth-acc-tint: rgba(var(--bs-primary-rgb), .08);
    }

    /* The name is shown in the profile header; keep the bar for the close button only. */
    #authDropdown.auth-menu-fullscreen.authenticated .auth-fullscreen-title {
        visibility: hidden;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .login-card {
        padding-top: 0 !important;
        overflow-x: hidden; /* vertical scroll only */
    }

    #authDropdown.auth-menu-fullscreen.authenticated .login-card :is(.auth-action-list, form, .user-auth-card, #familyAccountPicker) {
        min-width: 0;
        max-width: 100%;
    }

    /* Profile header */
    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card {
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr);
        align-items: center;
        column-gap: 14px;
        row-gap: 2px;
        margin-bottom: 20px !important;
        padding: 4px 4px 0 !important;
        border: 0;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card::before {
        content: "\f007";
        grid-row: 1 / span 3;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--auth-acc-tint);
        color: var(--bs-primary);
        font-family: "Font Awesome 6 Free";
        font-size: 1.125rem;
        font-weight: 900;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card > * {
        grid-column: 2;
        margin: 0 !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card :is(h4, p) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card h4 {
        color: var(--bs-emphasis-color, #1d2939);
        font-size: 1.0625rem;
        font-weight: 600 !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card p {
        color: var(--bs-secondary-color, #667085) !important;
        font-size: .8125rem !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card p b {
        display: none; /* "E-mail:" / "Group:" labels */
    }

    /* Role as a small soft tag. */
    #authDropdown.auth-menu-fullscreen.authenticated .user-auth-card p:last-child {
        justify-self: start;
        margin-top: 4px !important;
        padding: 1px 8px;
        border-radius: 999px;
        background: var(--auth-acc-tint);
        color: var(--bs-primary) !important;
        font-size: .6875rem !important;
        font-weight: 600;
        letter-spacing: .02em;
    }

    /* Menu groups */
    /* Grouped list in the style of iOS Settings: white group, hairline dividers inset past the icon. */
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list {
        margin-bottom: 12px !important;
        padding: 0;
        overflow: hidden;
        border: 1px solid var(--auth-acc-line);
        border-radius: 14px;
        background: var(--auth-sheet-bg);
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list > li {
        position: relative;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list > li + li::before {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        left: 48px;
        height: 1px;
        background: var(--auth-acc-line);
        pointer-events: none;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list li:has(> .dropdown-divider) {
        display: none;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item {
        display: flex;
        align-items: center;
        gap: 12px !important;
        min-height: 50px;
        padding: 10px 14px !important;
        border-radius: 0 !important;
        color: var(--bs-body-color);
        font-size: .9375rem;
        font-weight: 400 !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item,
    #authDropdown.auth-menu-fullscreen.authenticated #openTicketModal,
    #authDropdown.auth-menu-fullscreen.authenticated [data-auth-logout],
    #authDropdown.auth-menu-fullscreen.authenticated form[action="/?addObject"] .btn {
        -webkit-tap-highlight-color: transparent; /* no grey flash on tap */
    }

    /* !important: the theme paints .dropdown-menu .dropdown-item:hover solid blue with white text (!important). */
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item:is(:hover, :focus, :focus-visible, :active) {
        background-color: var(--auth-acc-press) !important;
        color: var(--bs-body-color) !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item:is(:hover, :focus-visible, :active)::before,
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item:is(:hover, :focus-visible, :active)::after {
        color: var(--bs-primary);
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item:focus-visible {
        outline: 2px solid rgba(var(--bs-primary-rgb), .4);
        outline-offset: -2px;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item.active {
        background: transparent;
        color: var(--bs-primary);
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Thin icon before each entry, faint chevron after it. */
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item::before {
        content: "\f0c9";
        flex: 0 0 20px;
        transition: color .15s ease;
        color: var(--auth-acc-icon);
        font-family: "Font Awesome 6 Free";
        font-size: .9375rem;
        font-weight: 900;
        text-align: center;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item.active::before {
        color: var(--bs-primary);
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list .dropdown-item::after {
        content: "\f054";
        margin-left: auto;
        color: var(--auth-acc-icon);
        font-family: "Font Awesome 6 Free";
        font-size: .625rem;
        font-weight: 900;
        opacity: .45;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/admin"]::before { content: "\f3fd"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list #familySwitchOpen::before { content: "\f362"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/pm"]::before { content: "\f0e0"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/notifications"]::before { content: "\f0f3"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/profile"]::before { content: "\f007"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/?myFriends"]::before { content: "\f500"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/myCoupons"]::before { content: "\f145"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/myCourses"]::before { content: "\f19d"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/?myDeliveries"]::before { content: "\f0d1"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/?myWallet"]::before { content: "\f555"; }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/cart"]::before { content: "\f07a"; }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-cart-count {
        min-width: 22px;
        padding: 1px 7px;
        border-radius: 999px;
        background: var(--bs-primary);
        color: #fff;
        font-size: .75rem;
        font-weight: 600;
        text-align: center;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-cart-count[hidden] {
        display: none;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/cart"] .auth-cart-count {
        margin-left: auto;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/cart"]:has(.auth-cart-count:not([hidden]))::after {
        margin-left: 8px;
    }

    /* One list: the two groups of links read as a single block, the quick "add" row goes below it. */
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview {
        display: flex;
        flex-direction: column;
    }

    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .user-auth-card { order: 0; }
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .auth-action-list { order: 1; }
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > form[action="/?addObject"] { order: 2; margin-top: 12px; }
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > [data-auth-logout] { order: 3; }

    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .auth-action-list:not(:last-of-type) {
        margin-bottom: 0 !important;
        border-bottom: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .auth-action-list + form + .auth-action-list,
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .auth-action-list + .auth-action-list {
        border-top: 0;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    /* Hairline between the two halves, inset like the other row dividers. */
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .auth-action-list + form + .auth-action-list > li:first-child::before,
    #authDropdown.auth-menu-fullscreen.authenticated #authAccountOverview > .auth-action-list + .auth-action-list > li:first-child::before {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        left: 48px;
        height: 1px;
        background: var(--auth-acc-line);
        pointer-events: none;
    }
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href$="myTickets"]::before,
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list a[href="/admin?action=tickets"]::before { content: "\f590"; }

    /* Switch user already shows its own arrow icon; the chevron replaces it. */
    #authDropdown.auth-menu-fullscreen.authenticated #familySwitchOpen > i {
        display: none;
    }

    /* Tickets row (blocks/support.tpl): link + "new ticket" button side by side. */
    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list li.d-flex {
        gap: 0 !important;
        padding: 0 !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list li.d-flex > .dropdown-item {
        flex: 1 1 auto;
        width: auto;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .auth-action-list li.d-flex > .dropdown-item::after {
        content: none;
    }

    /* "+" matches the row height and padding of the other entries. */
    #authDropdown.auth-menu-fullscreen.authenticated #openTicketModal {
        align-self: stretch;
        min-height: 50px;
        padding: 10px 14px !important;
        border-radius: 0 !important;
        color: var(--auth-acc-icon);
        font-size: .9375rem;
        font-weight: 400 !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated #openTicketModal:is(:hover, :focus, :focus-visible, :active) {
        background-color: var(--auth-acc-press) !important;
        color: var(--bs-primary) !important;
    }

    /* Quick "add" row: soft group, regular buttons. */
    #authDropdown.auth-menu-fullscreen.authenticated form[action="/?addObject"] {
        margin-bottom: 12px !important;
        padding: 6px;
        border: 1px solid var(--auth-acc-line);
        border-radius: 14px;
        background: var(--auth-sheet-bg);
    }

    #authDropdown.auth-menu-fullscreen.authenticated form[action="/?addObject"] > div {
        gap: 6px !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .login-card form[action="/?addObject"] .form-select {
        min-width: 0;
        min-height: 44px;
        border: 1px solid rgba(var(--bs-secondary-rgb, 108, 117, 125), .16);
        border-radius: 12px !important;
        background-color: var(--auth-sheet-bg);
        font-size: 16px;
        text-overflow: ellipsis;
    }

    /* The theme swaps the select for a select2 widget. */
    #authDropdown.auth-menu-fullscreen.authenticated .login-card form[action="/?addObject"] .select2-container {
        flex: 1 1 auto;
        min-width: 0;
    }

    #authDropdown.auth-menu-fullscreen.authenticated .login-card form[action="/?addObject"] .select2-container .select2-selection--single {
        min-height: 44px;
        border: 1px solid rgba(var(--bs-secondary-rgb, 108, 117, 125), .16);
        border-radius: 12px;
        background-color: var(--auth-sheet-bg);
    }

    #authDropdown.auth-menu-fullscreen.authenticated form[action="/?addObject"] .btn {
        min-height: 44px;
        padding-inline: 1.25rem !important;
        border-radius: 12px !important;
        font-size: .9375rem !important;
        font-weight: 600;
    }

    /* Log out: full-width outline button */
    #authDropdown.auth-menu-fullscreen.authenticated [data-auth-logout] {
        min-height: 48px;
        margin-top: 8px !important;
        border: 1px solid rgba(var(--bs-danger-rgb, 220, 53, 69), .3);
        border-radius: 12px !important;
        background: var(--auth-sheet-bg);
        color: var(--bs-danger, #dc3545);
        font-size: .9375rem;
        font-weight: 600 !important;
    }

    #authDropdown.auth-menu-fullscreen.authenticated [data-auth-logout]:is(:hover, :focus-visible, :active) {
        border-color: rgba(var(--bs-danger-rgb, 220, 53, 69), .45);
        background: rgba(var(--bs-danger-rgb, 220, 53, 69), .06);
        color: var(--bs-danger, #dc3545);
    }

    #authDropdown.auth-menu-fullscreen.authenticated [data-auth-logout] img {
        display: none;
    }

    #authDropdown.auth-menu-fullscreen.authenticated [data-auth-logout]::before {
        content: "\f2f5";
        font-family: "Font Awesome 6 Free";
        font-size: .875rem;
        font-weight: 900;
    }

    /* Policy links: no divider line here, the menu ends softly. */
    #authDropdown.auth-menu-fullscreen.authenticated .auth-policy-links {
        border-top: 0;
    }

    /* Lock page scroll while the sheet is open. */
    html:has(#authDropdown.auth-menu-fullscreen.auth-menu-open),
    html:has(#authDropdown.auth-menu-fullscreen.auth-menu-open) body {
        overflow: hidden;
    }
}

@keyframes auth-sheet-in {
    from { transform: translateY(100%); }
}

@keyframes auth-backdrop-in {
    from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    #authDropdown .auth-sheet,
    #authDropdown .auth-sheet-backdrop,
    #authDropdown .auth-sheet-actions {
        animation: none;
        transition: none;
    }
}

/* Sign-in form (dropdown on desktop and full screen on phones). */
.auth-fullscreen-logo {
    display: none;
}
.auth-field {
    margin-bottom: 1rem;
}
.auth-field .form-label {
    margin-bottom: 0.375rem;
    color: var(--bs-body-color, #344054);
    font-size: 0.875rem;
    font-weight: 600;
}
.auth-login-form .form-control {
    min-height: 44px;
    border-color: #dfe5ec;
    border-radius: 12px;
    background: var(--bs-body-bg, #fff);
}
.auth-login-form .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .15);
}
.auth-password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color, #6b7a89);
}
.auth-password-toggle:hover {
    color: var(--bs-primary);
}
.auth-login-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin: 0.25rem 0 1.25rem;
    font-size: 0.875rem;
}
.auth-login-row .form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    cursor: pointer;
}
.auth-login-row .form-check-label {
    color: var(--bs-body-color, #344054);
    cursor: pointer;
}
.auth-forgot {
    color: var(--bs-primary);
    font-weight: 500;
    text-decoration: none;
}
.auth-forgot:hover {
    text-decoration: underline;
}
.auth-submit {
    min-height: 48px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
}
