/*
 * GMOS Commercial managed-surface refinements
 * Step 5: service record, coordinator, scheduling console, and training.
 * Loaded only on GMOS-managed portal pages.
 */

/* Shared application widths for the remaining managed surfaces. */
body.gmos-surface-service_record .entry-content,
body.gmos-surface-reservations .entry-content,
body.gmos-surface-coordinator .entry-content,
body.gmos-surface-training .entry-content {
    margin-left: auto;
    margin-right: auto;
    max-width: none;
}

body.gmos-surface-service_record .entry-content {
    width: min(1280px, calc(100% - 32px));
}
body.gmos-surface-reservations .entry-content {
    width: min(1380px, calc(100% - 32px));
}
body.gmos-surface-coordinator .entry-content {
    width: min(1440px, calc(100% - 28px));
}
body.gmos-surface-training .entry-content {
    width: min(1120px, calc(100% - 32px));
}

/*
 * Several historical shortcodes render one top-level application wrapper with
 * an inline or legacy max-width. Break that ceiling only for the managed GMOS
 * page surface; nested cards keep their own intended sizing.
 */
body.gmos-surface-service_record .entry-content > div,
body.gmos-surface-reservations .entry-content > div,
body.gmos-surface-coordinator .entry-content > div,
body.gmos-surface-training .entry-content > div {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Remove inherited renderer width ceilings on known wrappers too. */
body.gmos-surface-service_record :where(.gmos-service-record,.gmos-service-wrap,.gmos-service-card,.geer-service-record),
body.gmos-surface-reservations :where(.gmos-reservations-console,.gmos-reservations-wrap,.gmos-scheduling-console,.gmos-native-reservations),
body.gmos-surface-coordinator :where(.gmos-coordinator-workspace,.geer-coordinator-dashboard,.gmos-operations-center,.geer-vsus-dashboard-card),
body.gmos-surface-training :where(.gmos-training-wrap,.gmos-training-card,.geer-docent-academy,.gmos-academy-wrap) {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
}

/* Service Record: turn the narrow legacy column into a modern dashboard. */
body.gmos-surface-service_record :where(.gmos-service-record,.gmos-service-wrap,.geer-service-record) {
    padding: clamp(18px, 2.5vw, 28px) !important;
}
body.gmos-surface-service_record :where(.gmos-service-summary,.gmos-service-stats,.gmos-service-metrics) {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px !important;
}
body.gmos-surface-service_record .gmos-service-record__milestones,
body.gmos-surface-service_record :where(.gmos-service-achievements,.gmos-recognition-grid,.gmos-milestone-grid) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
}
body.gmos-surface-service_record :where(.gmos-service-card,.gmos-milestone-card,.gmos-recognition-card) {
    min-width: 0;
}
body.gmos-surface-service_record :where(.gmos-service-note,.gmos-service-help,.gmos-service-info) {
    border-radius: 12px;
    padding: 16px 18px !important;
}

/* Shift Scheduling: use the horizontal space available to coordinators. */
body.gmos-surface-reservations :where(.gmos-reservations-console,.gmos-reservations-wrap,.gmos-scheduling-console,.gmos-native-reservations) {
    padding: clamp(18px, 2.5vw, 28px) !important;
}
body.gmos-surface-reservations :where(.gmos-reservation-filters,.gmos-scheduling-filters,.gmos-filter-row) {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px !important;
    align-items: end;
}
body.gmos-surface-reservations :where(.gmos-shift-summary-grid,.gmos-capacity-grid,.gmos-shift-cards) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px !important;
}
body.gmos-surface-reservations :where(.gmos-shift-card,.gmos-capacity-card,.gmos-reservation-card) {
    min-width: 0;
    height: 100%;
}
body.gmos-surface-reservations table {
    min-width: 760px;
}

/* Coordinator Workspace: preserve information density but make modules breathe. */
body.gmos-surface-coordinator :where(.gmos-coordinator-workspace,.geer-coordinator-dashboard,.gmos-operations-center) {
    padding: 0 !important;
}
body.gmos-surface-coordinator .entry-content > div > :where(section,div) {
    box-sizing: border-box;
}
body.gmos-surface-coordinator .entry-content > div > :where(section,div) + :where(section,div) {
    margin-top: 16px;
}
body.gmos-surface-coordinator :where(.gmos-workspace-grid,.gmos-coordinator-grid,.gmos-operations-grid,.geer-vsus-dashboard-grid) {
    gap: 16px !important;
}
body.gmos-surface-coordinator :where(.gmos-panel,.gmos-card,.geer-vsus-dashboard-card) {
    border-radius: 14px;
    border-color: #dfe6ee;
    box-shadow: 0 5px 16px rgba(24, 49, 82, .05);
}
body.gmos-surface-coordinator :where(.gmos-panel,.gmos-card) {
    padding: clamp(14px, 1.7vw, 20px);
}
body.gmos-surface-coordinator :where(.gmos-metric-grid,.gmos-status-grid,.gmos-readiness-grid) {
    gap: 10px !important;
}
body.gmos-surface-coordinator :where(.gmos-panel h2,.gmos-panel h3,.gmos-card h2,.gmos-card h3,.geer-vsus-dashboard-card h2,.geer-vsus-dashboard-card h3) {
    line-height: 1.2;
}
body.gmos-surface-coordinator :where(.gmos-panel p,.gmos-card p,.geer-vsus-dashboard-card p) {
    line-height: 1.5;
}
body.gmos-surface-coordinator :where(a.button,button,.gmos-button,.gmos-action) {
    min-height: 40px;
}
body.gmos-surface-coordinator :where(.gmos-workspace-grid,.gmos-coordinator-grid,.gmos-operations-grid,.geer-vsus-dashboard-grid) > * {
    min-width: 0;
}
body.gmos-surface-coordinator details {
    margin-top: 14px;
    border-top: 1px solid #e3e9ef;
    padding-top: 10px;
}
body.gmos-surface-coordinator details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    cursor: pointer;
    font-weight: 600;
    line-height: 1.35;
}
body.gmos-surface-coordinator details > summary::marker {
    color: #355f87;
}

/*
 * Coordinator accountability: the shared roster historically caps itself at
 * 1180px because it also appears inside narrower portal layouts. On the
 * dedicated Coordinator Workspace, use the full application rail so emergency
 * accountability aligns with Operations Center and the workspace panels.
 */
body.gmos-surface-coordinator .gmos-portal-aboard {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
body.gmos-surface-coordinator .gmos-portal-aboard__head {
    padding-left: clamp(18px, 2vw, 26px);
    padding-right: clamp(18px, 2vw, 26px);
}
body.gmos-surface-coordinator .gmos-portal-aboard__details > summary {
    padding-left: clamp(18px, 2vw, 26px);
    padding-right: clamp(18px, 2vw, 26px);
}
body.gmos-surface-coordinator .gmos-portal-aboard__body {
    padding-left: clamp(18px, 2vw, 26px);
    padding-right: clamp(18px, 2vw, 26px);
}
body.gmos-surface-coordinator .gmos-portal-aboard__empty {
    text-align: left;
}

@media (min-width: 1180px) {
    body.gmos-surface-coordinator .gmos-portal-aboard__head {
        grid-template-columns: 54px minmax(0, 1fr) 82px;
        min-height: 112px;
    }
    body.gmos-surface-coordinator .gmos-portal-aboard__head h2 {
        margin-bottom: 4px !important;
    }
    body.gmos-surface-coordinator .gmos-portal-aboard__total {
        min-width: 82px;
        min-height: 74px;
    }
    body.gmos-surface-coordinator .gmos-portal-aboard__details > summary {
        min-height: 48px;
    }
}

/* Training: make an empty fresh-install state feel intentional. */
body.gmos-surface-training :where(.gmos-training-wrap,.gmos-training-card,.geer-docent-academy,.gmos-academy-wrap) {
    padding: clamp(28px, 4vw, 46px) !important;
}
body.gmos-surface-training :where(.gmos-training-card,.gmos-training-wrap,.geer-docent-academy) {
    min-height: 220px;
}
body.gmos-surface-training :where(.gmos-training-card,.gmos-training-wrap,.geer-docent-academy) p {
    max-width: 760px;
    font-size: 1.05rem;
    line-height: 1.65;
}

@media (max-width: 900px) {
    body.gmos-surface-service_record :where(.gmos-service-summary,.gmos-service-stats,.gmos-service-metrics) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.gmos-surface-service_record .gmos-service-record__milestones,
    body.gmos-surface-service_record :where(.gmos-service-achievements,.gmos-recognition-grid,.gmos-milestone-grid),
    body.gmos-surface-reservations :where(.gmos-shift-summary-grid,.gmos-capacity-grid,.gmos-shift-cards) {
        grid-template-columns: 1fr 1fr !important;
    }
    body.gmos-surface-coordinator .entry-content {
        width: min(100% - 20px, 1100px);
    }
}

@media (max-width: 640px) {
    body.gmos-surface-service_record .entry-content,
    body.gmos-surface-reservations .entry-content,
    body.gmos-surface-coordinator .entry-content,
    body.gmos-surface-training .entry-content {
        width: calc(100% - 16px);
    }
    body.gmos-surface-service_record :where(.gmos-service-summary,.gmos-service-stats,.gmos-service-metrics),
    body.gmos-surface-service_record .gmos-service-record__milestones,
    body.gmos-surface-service_record :where(.gmos-service-achievements,.gmos-recognition-grid,.gmos-milestone-grid),
    body.gmos-surface-reservations :where(.gmos-shift-summary-grid,.gmos-capacity-grid,.gmos-shift-cards) {
        grid-template-columns: 1fr !important;
    }
    body.gmos-surface-coordinator .entry-content > div > :where(section,div) + :where(section,div) {
        margin-top: 12px;
    }
    body.gmos-surface-coordinator details > summary {
        align-items: flex-start;
        flex-direction: column;
    }
}


/*
 * Mobile application-shell hardening.
 *
 * These rules intentionally live in the final commercial managed-surface
 * stylesheet so they can normalize older GMOS mobile rules without changing
 * desktop behavior or customer-authored WordPress pages.
 */
@media (max-width: 782px) {
    body.gmos-managed-surface {
        overflow-x: hidden;
    }

    body.gmos-managed-surface main,
    body.gmos-managed-surface .site-main,
    body.gmos-managed-surface .wp-site-blocks main {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.gmos-managed-surface .entry-header {
        position: relative !important;
        left: auto !important;
        transform: none !important;
        width: calc(100% - 20px) !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding: 4px 0 2px !important;
        margin-bottom: 6px !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    body.gmos-managed-surface .entry-title,
    body.gmos-managed-surface .wp-block-post-title {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        text-align: center !important;
        font-size: clamp(1.9rem, 8vw, 2.25rem) !important;
        line-height: 1.04 !important;
        letter-spacing: -.03em !important;
        text-wrap: balance;
    }

    body.gmos-managed-surface .entry-content {
        min-width: 0;
    }

    body.gmos-managed-surface .entry-content > .geer-vsus-portal-toolbar:first-child,
    body.gmos-managed-surface nav.geer-vsus-portal-toolbar {
        position: relative !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        margin: 0 auto 10px !important;
        padding: 5px !important;
        grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)) !important;
        gap: 4px !important;
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
        box-sizing: border-box !important;
    }

    body.gmos-managed-surface nav.geer-vsus-portal-toolbar > a.geer-vsus-portal-toolbar-link {
        min-height: 50px !important;
        padding: 5px 3px !important;
        flex-direction: column !important;
        gap: 3px !important;
    }

    body.gmos-managed-surface nav.geer-vsus-portal-toolbar > a.geer-vsus-portal-toolbar-link::after {
        font-size: 10.5px !important;
        line-height: 1.05 !important;
    }

    /* Keep the accessibility launcher useful without covering the workspace. */
    body.gmos-managed-surface .gmos-text-size-control {
        right: max(10px, env(safe-area-inset-right)) !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }

    body.gmos-managed-surface .gmos-text-size-control > summary {
        width: 52px !important;
        min-width: 52px !important;
        height: 52px !important;
        min-height: 52px !important;
        padding: 0 !important;
        justify-content: center !important;
        gap: 0 !important;
        border-radius: 50% !important;
    }

    body.gmos-managed-surface .gmos-text-size-control > summary span:first-child {
        font-size: 21px !important;
    }

    body.gmos-managed-surface .gmos-text-size-control > summary span:nth-child(2) {
        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;
    }

    body.gmos-managed-surface .gmos-text-size-menu {
        right: 0 !important;
        bottom: 60px !important;
        width: min(300px, calc(100vw - 24px)) !important;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    /* Coordinator Workspace / Operations Center */
    body.gmos-surface-coordinator .entry-content {
        width: calc(100% - 12px) !important;
        max-width: 100% !important;
    }

    body.gmos-surface-profile .entry-content,
    body.gmos-surface-profile .geer-vp-profile-center {
        max-width: 100% !important;
        overflow-x: hidden;
        overscroll-behavior-x: none;
    }

    @supports (overflow: clip) {
        body.gmos-surface-profile .entry-content,
        body.gmos-surface-profile .geer-vp-profile-center {
            overflow-x: clip;
        }
    }

    body.gmos-surface-profile .geer-vp-profile-center > * {
        max-width: 100%;
        box-sizing: border-box;
    }

    body.gmos-surface-coordinator :where(.gmos-coordinator-workspace,.geer-coordinator-dashboard,.gmos-operations-center) {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.gmos-surface-coordinator .gmos-ops-hero {
        width: 100% !important;
        max-width: none !important;
        margin: 0 0 14px !important;
        padding: 20px 18px !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
    }

    body.gmos-surface-coordinator .gmos-ops-hero h1 {
        margin: 4px 0 8px !important;
        font-size: clamp(1.8rem, 8.5vw, 2.25rem) !important;
        line-height: 1.05 !important;
        text-wrap: balance;
    }

    body.gmos-surface-coordinator .gmos-ops-hero p {
        font-size: 15px !important;
        line-height: 1.5 !important;
    }

    body.gmos-surface-coordinator .gmos-ops-kicker {
        font-size: 10.5px !important;
        line-height: 1.35 !important;
        letter-spacing: .11em !important;
    }

    body.gmos-surface-coordinator .gmos-ops-date {
        min-width: 0 !important;
        margin-top: 14px !important;
        text-align: left !important;
    }

    body.gmos-surface-coordinator .gmos-workspace-launcher,
    body.gmos-surface-coordinator .gmos-morning-brief,
    body.gmos-surface-coordinator .gmos-operations-timeline {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    body.gmos-surface-coordinator .gmos-workspace-launcher {
        padding: 14px !important;
        margin: 12px 0 14px !important;
    }

    body.gmos-surface-coordinator .gmos-workspace-card {
        padding: 14px 12px !important;
    }

    body.gmos-surface-coordinator .gmos-morning-brief {
        padding: 15px 13px !important;
        gap: 12px !important;
    }

    body.gmos-surface-coordinator .gmos-morning-brief h2 {
        font-size: clamp(1.55rem, 7vw, 1.9rem) !important;
    }

    body.gmos-surface-coordinator .gmos-operations-timeline {
        padding: 16px 13px !important;
    }

    /* Remaining managed workspaces: use the available phone width. */
    body.gmos-surface-service_record .entry-content,
    body.gmos-surface-reservations .entry-content,
    body.gmos-surface-training .entry-content {
        width: calc(100% - 12px) !important;
    }

    body.gmos-surface-service_record :where(.gmos-service-record,.gmos-service-wrap,.geer-service-record),
    body.gmos-surface-reservations :where(.gmos-reservations-console,.gmos-reservations-wrap,.gmos-scheduling-console,.gmos-native-reservations),
    body.gmos-surface-training :where(.gmos-training-wrap,.gmos-training-card,.geer-docent-academy,.gmos-academy-wrap) {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    body.gmos-managed-surface :where(img,svg,video,canvas) {
        max-width: 100%;
    }
}

@media (max-width: 390px) {
    body.gmos-managed-surface .entry-header {
        width: calc(100% - 12px) !important;
    }

    body.gmos-managed-surface .entry-content > .geer-vsus-portal-toolbar:first-child,
    body.gmos-managed-surface nav.geer-vsus-portal-toolbar {
        width: 100% !important;
    }

    body.gmos-managed-surface .entry-title,
    body.gmos-managed-surface .wp-block-post-title {
        font-size: clamp(1.75rem, 8.5vw, 2rem) !important;
    }

    body.gmos-managed-surface nav.geer-vsus-portal-toolbar {
        grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)) !important;
    }

    body.gmos-surface-coordinator .gmos-ops-hero {
        padding: 18px 15px !important;
    }

    body.gmos-surface-coordinator .gmos-workspace-launcher,
    body.gmos-surface-coordinator .gmos-morning-brief,
    body.gmos-surface-coordinator .gmos-operations-timeline {
        border-radius: 11px !important;
    }
}
