/*
|--------------------------------------------------------------------------
| P-EMTS Phase 1M.1 â€” Cross-Browser + Multi-Screen Normalization
|--------------------------------------------------------------------------
| Goals:
| - same layout composition in Chrome / Brave / Edge-class Chromium browsers
| - deterministic login hero wrapping
| - fluid sizing from compact laptops to large desktop monitors
| - no dependency on browser-native form sizing for layout
| - keep existing P-EMTS app.css intact; this file only normalizes/overrides
|--------------------------------------------------------------------------
*/

:root {
    --pems-sidebar-width: 286px;
    --pems-shell-header-height: 70px;
    --pems-desktop-gutter: clamp(1rem, 2.1vw, 2.25rem);
    --pems-content-max: 1280px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-synthesis: none;
}

html,
body {
    margin: 0;
    min-width: 320px;
}

body,
button,
input,
select,
textarea {
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

img[src*="/images/pemts/"] {
    -webkit-user-drag: none;
    user-select: none;
}

input,
select,
textarea,
button {
    margin: 0;
}

/*
| Keep controls dimensionally stable across browsers.
| We intentionally do not remove native select semantics.
*/
.pems-field {
    min-height: 34px !important;
    line-height: 1.25rem;
}

input.pems-field,
select.pems-field {
    height: 34px;
}

textarea.pems-field {
    height: auto;
    min-height: 96px !important;
}

.pems-button-primary,
.pems-button-secondary,
.pems-button-danger,
.pems-button-gold,
.pems-button-light,
.pems-select-button {
    min-height: 36px !important;
    line-height: 1.05;
    padding-top: .42rem !important;
    padding-bottom: .42rem !important;
}

/*
|--------------------------------------------------------------------------
| Auth / Login shell
|--------------------------------------------------------------------------
*/

.pems-auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 72% 28%, rgba(245,196,0,.14), transparent 28rem),
        radial-gradient(circle at 12% 80%, rgba(150,0,0,.10), transparent 32rem),
        #f4efeb;
}

.pems-auth-shell {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
}

.pems-auth-brand-panel {
    display: none;
}

.pems-auth-form-panel {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding:
        clamp(1.25rem, 4vw, 2.5rem)
        clamp(1rem, 5vw, 3rem);
}

.pems-auth-mobile-logo {
    width: min(390px, 86vw);
    margin: 0 auto clamp(1.2rem, 3vh, 2rem);
}

.pems-auth-mobile-logo img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.pems-login-wrap {
    width: min(100%, 470px);
}

.pems-login-card {
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(69,0,0,.10);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 30px 80px -48px rgba(76,0,0,.58);
}

.pems-login-accent {
    height: 6px;
    background: linear-gradient(90deg, #8b0000, #d41414 55%, #f5c400);
}

.pems-login-card-body {
    padding: clamp(1.35rem, 3vw, 2rem);
}

.pems-login-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .75rem;
}

.pems-login-mark {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 999px;
    object-fit: contain;
}

.pems-login-kicker {
    margin: 0;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #a15e00;
}

.pems-login-title {
    margin: .25rem 0 0;
    font-family: Impact, "Arial Black", "Segoe UI", sans-serif;
    font-size: clamp(1.42rem, 2.3vw, 1.72rem);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #690000;
    white-space: nowrap;
}

.pems-login-copy {
    margin: 1rem 0 0;
    max-width: 35rem;
    font-size: .875rem;
    line-height: 1.65;
    color: #64748b;
}

.pems-login-form {
    margin-top: clamp(1.25rem, 3vh, 1.75rem);
    display: grid;
    gap: 1.1rem;
}

.pems-login-remember {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: .75rem;
    border: 1px solid rgba(69,0,0,.08);
    border-radius: 12px;
    background: #fbf8f6;
    padding: .7rem .85rem;
    font-size: .875rem;
    line-height: 1.25rem;
    color: #475569;
    cursor: pointer;
}

.pems-login-checkbox {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    accent-color: #9b0000;
}

.pems-login-submit {
    width: 100%;
    min-height: 48px !important;
}

.pems-login-restricted {
    margin: 1.15rem 0 0;
    text-align: center;
    font-size: .75rem;
    line-height: 1.4;
    font-weight: 650;
    color: #94a3b8;
}

/*
| Two-column authentication starts only when there is enough physical width.
| Tailwind's default lg=1024 was too early for the login composition.
*/
@media (min-width: 1180px) {
    .pems-auth-shell {
        grid-template-columns:
            minmax(500px, 48%)
            minmax(500px, 52%);
    }

    .pems-auth-brand-panel {
        position: relative;
        display: flex;
        min-width: 0;
        min-height: 100vh;
        min-height: 100dvh;
        flex-direction: column;
        overflow: hidden;
        background: linear-gradient(150deg, #4d0000 0%, #7e0000 50%, #ab0808 100%);
        padding:
            clamp(1.7rem, 3vh, 2.6rem)
            clamp(2.1rem, 3.4vw, 3.6rem);
        color: #fff;
    }

    .pems-auth-brand-pattern {
        position: absolute;
        inset: 0;
        opacity: .08;
        pointer-events: none;
    }

    .pems-auth-brand-glow {
        position: absolute;
        right: -150px;
        bottom: -150px;
        width: 560px;
        height: 560px;
        border-radius: 999px;
        background: rgba(252,211,77,.11);
        filter: blur(55px);
        pointer-events: none;
    }

    .pems-auth-brand-logo-wrap {
        position: relative;
        z-index: 1;
        flex: 0 0 auto;
    }

    .pems-auth-brand-logo {
        display: block;
        width: min(100%, 590px);
        height: auto;
        object-fit: contain;
        filter: drop-shadow(0 18px 38px rgba(0,0,0,.24));
    }

    .pems-auth-brand-copy {
        position: relative;
        z-index: 1;
        width: min(100%, 650px);
        margin: auto 0;
    }

    .pems-auth-brand-pill {
        display: inline-flex;
        align-items: center;
        min-height: 29px;
        border: 1px solid rgba(253,230,138,.28);
        border-radius: 999px;
        background: rgba(0,0,0,.10);
        padding: .35rem .8rem;
        font-size: .64rem;
        line-height: 1;
        font-weight: 900;
        letter-spacing: .15em;
        text-transform: uppercase;
        color: #fde68a;
    }

    /*
    | Explicit block lines make the hero composition browser-independent.
    | Impact is used here because variable/system condensed font metrics can
    | differ between Chromium versions and privacy-hardened browsers.
    */
    .pems-auth-hero-title {
        margin: clamp(1rem, 2.2vh, 1.4rem) 0 0;
        font-family: Impact, "Arial Black", "Segoe UI", sans-serif;
        font-size: clamp(2.25rem, 3.25vw, 4.15rem);
        line-height: .99;
        font-weight: 900;
        letter-spacing: .015em;
        text-transform: uppercase;
        color: #fff;
    }

    .pems-auth-hero-title > span {
        display: block;
        white-space: nowrap;
    }

    .pems-auth-hero-title strong {
        font: inherit;
        color: #facc15;
    }

    .pems-auth-hero-copy {
        width: min(100%, 590px);
        margin: clamp(1rem, 2.2vh, 1.4rem) 0 0;
        font-size: clamp(.78rem, .85vw, .92rem);
        line-height: 1.8;
        color: rgba(254,242,242,.75);
    }

    .pems-auth-brand-footer {
        position: relative;
        z-index: 1;
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: space-between;
        gap: 1.5rem;
        border-top: 1px solid rgba(255,255,255,.10);
        padding-top: 1.15rem;
        font-size: .7rem;
        line-height: 1.3;
        font-weight: 650;
        color: rgba(254,226,226,.58);
    }

    .pems-auth-form-panel {
        min-height: 100vh;
        min-height: 100dvh;
        padding:
            clamp(1.5rem, 4vh, 3.25rem)
            clamp(2rem, 5vw, 5.5rem);
    }

    .pems-auth-mobile-logo {
        display: none;
    }

    .pems-login-wrap {
        width: min(100%, 470px);
    }
}

/*
| Compact desktop/laptop heights (e.g. 1280Ã—720, 1366Ã—768).
*/
@media (min-width: 1180px) and (max-height: 800px) {
    .pems-auth-brand-panel {
        padding-top: 1.35rem;
        padding-bottom: 1.35rem;
    }

    .pems-auth-brand-logo {
        width: min(100%, 520px);
    }

    .pems-auth-hero-title {
        margin-top: .85rem;
        font-size: clamp(2rem, 3vw, 3.25rem);
        line-height: .98;
    }

    .pems-auth-hero-copy {
        margin-top: .85rem;
        line-height: 1.55;
    }

    .pems-auth-brand-footer {
        padding-top: .85rem;
    }

    .pems-auth-form-panel {
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }

    .pems-login-card-body {
        padding-top: 1.45rem;
        padding-bottom: 1.45rem;
    }

    .pems-login-form {
        margin-top: 1.15rem;
        gap: .9rem;
    }

    .pems-login-restricted {
        margin-top: .8rem;
    }
}

/*
| Very wide screens: stop content from stretching into empty space.
*/
@media (min-width: 2000px) {
    .pems-auth-shell {
        grid-template-columns: minmax(760px, 50%) minmax(760px, 50%);
    }

    .pems-auth-brand-panel {
        padding-left: max(4rem, calc((50vw - 840px) / 2 + 4rem));
        padding-right: 4rem;
    }

    .pems-auth-form-panel {
        padding-left: 5rem;
        padding-right: max(5rem, calc((50vw - 760px) / 2 + 5rem));
    }

    .pems-auth-brand-copy {
        width: 700px;
    }

    .pems-auth-brand-logo {
        width: 620px;
    }
}

/*
| Small/mobile viewport fallback.
*/
@media (max-width: 1179.98px) {
    .pems-auth-body {
        overflow-y: auto;
    }

    .pems-auth-form-panel {
        justify-content: center;
    }
}

@media (max-width: 540px) {
    .pems-auth-form-panel {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .pems-login-card {
        border-radius: 17px;
    }

    .pems-login-card-body {
        padding: 1.25rem;
    }

    .pems-login-title {
        font-size: 1.25rem;
    }

    .pems-login-mark {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }
}

/*
|--------------------------------------------------------------------------
| Auth landscape / short-screen overflow safety
|--------------------------------------------------------------------------
*/
@media (max-height: 620px) {
    .pems-auth-body {
        overflow-y: auto;
    }

    .pems-auth-form-panel {
        min-height: 620px;
        justify-content: flex-start;
    }
}

/*
|--------------------------------------------------------------------------
| Authenticated application shell: responsive desktop widths
|--------------------------------------------------------------------------
*/

.pems-shell-sidebar {
    width: var(--pems-sidebar-width);
}

.pems-shell-workspace {
    padding-left: 0;
}

.pems-shell-header-inner {
    width: 100%;
    max-width: var(--pems-content-max);
    height: var(--pems-shell-header-height);
    margin-inline: auto;
}

.pems-shell-main {
    width: 100%;
    max-width: var(--pems-content-max);
    margin-inline: auto;
}

/*
| Keep workspace padding proportional instead of jumping hard between a few
| Tailwind breakpoint values. Existing utility values remain fallback.
*/
@media (min-width: 1024px) {
    .pems-shell-workspace {
        padding-left: var(--pems-sidebar-width);
    }

    .pems-shell-main,
    .pems-shell-header-inner {
        padding-left: var(--pems-desktop-gutter) !important;
        padding-right: var(--pems-desktop-gutter) !important;
    }
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
    :root {
        --pems-sidebar-width: 254px;
        --pems-shell-header-height: 64px;
        --pems-desktop-gutter: 1.15rem;
    }

    .pems-nav-link {
        min-height: 39px;
        padding-top: .48rem;
        padding-bottom: .48rem;
        font-size: .81rem;
    }

    .pems-nav-group {
        font-size: .59rem;
    }

    .pems-shell-main {
        padding-top: 1.25rem !important;
        padding-bottom: 1.5rem !important;
    }

    .pems-page-banner {
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }
}

@media (min-width: 1280px) and (max-width: 1599.98px) {
    :root {
        --pems-sidebar-width: 276px;
        --pems-shell-header-height: 68px;
        --pems-desktop-gutter: 1.55rem;
    }
}

@media (min-width: 1600px) {
    :root {
        --pems-sidebar-width: 286px;
        --pems-shell-header-height: 70px;
        --pems-desktop-gutter: 2rem;
    }
}

@media (min-width: 2200px) {
    :root {
        --pems-sidebar-width: 300px;
        --pems-desktop-gutter: 2.4rem;
        --pems-content-max: 1760px;
    }
}

/*
| Low-height laptops get a denser sidebar/header so more content is visible.
*/
@media (min-width: 1024px) and (max-height: 760px) {
    :root {
        --pems-shell-header-height: 60px;
    }

    .pems-shell-sidebar > div:first-child {
        padding-top: .85rem !important;
        padding-bottom: .85rem !important;
    }

    #pems-sidebar-nav {
        padding-top: .7rem !important;
        padding-bottom: .7rem !important;
    }

    .pems-nav-link {
        min-height: 36px;
    }

    .pems-shell-main {
        padding-top: 1rem !important;
        padding-bottom: 1.25rem !important;
    }
}

/*
| The navigation overlay must always begin after the actual responsive sidebar.
*/
@media (min-width: 1024px) {
    .pems-navigation-overlay {
        left: var(--pems-sidebar-width) !important;
    }
}

/*
|--------------------------------------------------------------------------
| Cross-browser display font normalization
|--------------------------------------------------------------------------
| Keep the existing .font-pems-display identity for ordinary application
| headings, but remove browser-specific font-stretch behavior.
*/
.font-pems-display {
    font-stretch: normal !important;
    font-kerning: normal;
    text-rendering: geometricPrecision;
}

/*
| Keep title wrapping predictable in narrow authenticated headers.
*/
.pems-shell-header-inner .font-pems-display {
    line-height: 1.05;
}

/*
| Avoid layout shifts from browser-native autofill font/appearance changes.
*/
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: #181313;
    caret-color: #181313;
    transition: background-color 9999s ease-out 0s;
}

/*
| Focus appearance remains consistent across Chromium browsers.
*/
:focus-visible {
    outline: 2px solid rgba(183,15,15,.55);
    outline-offset: 2px;
}

/*
| Preserve motion preference.
*/
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}


/*
|--------------------------------------------------------------------------
| Phase 1M.3 â€” Authenticated Page Responsiveness
|--------------------------------------------------------------------------
| Tailwind breakpoints are viewport-based. In P-EMTS, the actual working
| area is smaller because the sidebar consumes part of the viewport.
| Container queries below make cards/forms respond to the MAIN CONTENT
| width instead of the browser width.
|--------------------------------------------------------------------------
*/

.pems-app-body {
    overflow: hidden;
}

#pems-main-content {
    container-name: pems-main;
    container-type: inline-size;
    min-width: 0;
}

#pems-main-content > * {
    width: 100%;
    min-width: 0;
}

/* Stable display metrics throughout authenticated screens. */
.font-pems-display,
.pems-panel-title {
    font-family: Impact, "Arial Black", "Segoe UI", Arial, sans-serif !important;
    font-stretch: normal !important;
    font-kerning: normal;
}

.pems-page-banner h1,
.pems-page-banner .font-pems-display {
    line-height: 1.02;
}

/* Shared authenticated component fluidity. */
.pems-page-banner {
    padding:
        clamp(1.05rem, 2.2cqi, 1.65rem)
        clamp(1rem, 2.2cqi, 1.55rem);
}

.pems-page-banner-compact {
    padding-top: clamp(1rem, 1.8cqi, 1.4rem);
    padding-bottom: clamp(1rem, 1.8cqi, 1.4rem);
}

.pems-panel {
    padding: clamp(.9rem, 1.55cqi, 1.2rem);
}

.pems-stat {
    min-width: 0;
    padding:
        clamp(.85rem, 1.4cqi, 1.05rem)
        clamp(.9rem, 1.55cqi, 1.15rem)
        clamp(.85rem, 1.4cqi, 1.05rem)
        clamp(1rem, 1.7cqi, 1.25rem);
}

.pems-stat-value {
    font-size: clamp(1.55rem, 2.5cqi, 1.9rem);
}

.pems-table {
    min-width: max-content;
}

.pems-table th,
.pems-table td {
    white-space: normal;
}

/*
| Shared grids generated by existing Blade/Tailwind markup.
| We target the literal responsive class tokens and override only when the
| actual main-content container becomes too narrow.
*/
@container pems-main (max-width: 1180px) {
    [class~="xl:grid-cols-4"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    [class*="xl:grid-cols-["] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@container pems-main (max-width: 940px) {
    [class~="lg:grid-cols-2"],
    [class~="lg:grid-cols-3"],
    [class*="lg:grid-cols-["] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .pems-page-banner h1,
    .pems-page-banner .font-pems-display {
        font-size: clamp(1.9rem, 5cqi, 2.65rem) !important;
    }
}

@container pems-main (max-width: 680px) {
    [class~="sm:grid-cols-2"],
    [class~="md:grid-cols-2"],
    [class~="md:grid-cols-3"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .pems-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pems-page-banner {
        border-radius: .9rem;
    }

    .pems-panel,
    .pems-stat {
        border-radius: .85rem;
    }
}

/*
|--------------------------------------------------------------------------
| Desktop/laptop shell sizes
|--------------------------------------------------------------------------
| Give compact computers more usable workspace while preserving the full
| branded sidebar on larger displays.
*/

@media (min-width: 1024px) and (max-width: 1199.98px) {
    :root {
        --pems-sidebar-width: 228px;
        --pems-shell-header-height: 60px;
        --pems-desktop-gutter: .9rem;
        --pems-content-max: none;
    }

    .pems-shell-sidebar .pems-nav-link {
        gap: .55rem;
        padding-left: .55rem;
        padding-right: .55rem;
        font-size: .76rem;
    }

    .pems-shell-sidebar .pems-nav-icon {
        width: 21px;
        height: 21px;
    }

    .pems-shell-sidebar .pems-nav-group {
        font-size: .56rem;
    }
}

@media (min-width: 1200px) and (max-width: 1439.98px) {
    :root {
        --pems-sidebar-width: 244px;
        --pems-shell-header-height: 64px;
        --pems-desktop-gutter: 1.1rem;
        --pems-content-max: none;
    }
}

@media (min-width: 1440px) and (max-width: 1799.98px) {
    :root {
        --pems-sidebar-width: 266px;
        --pems-shell-header-height: 68px;
        --pems-desktop-gutter: 1.45rem;
        --pems-content-max: 1280px;
    }
}

@media (min-width: 1800px) and (max-width: 2199.98px) {
    :root {
        --pems-sidebar-width: 286px;
        --pems-shell-header-height: 70px;
        --pems-desktop-gutter: 1.8rem;
        --pems-content-max: 1400px;
    }
}

@media (min-width: 2200px) {
    :root {
        --pems-sidebar-width: 300px;
        --pems-shell-header-height: 72px;
        --pems-desktop-gutter: 2.25rem;
        --pems-content-max: 1560px;
    }
}

/* Laptop-height density. */
@media (min-width: 1024px) and (max-height: 800px) {
    .pems-shell-sidebar > div:first-child {
        padding-top: .75rem !important;
        padding-bottom: .75rem !important;
    }

    .pems-shell-sidebar > div:first-child > div > div.mt-4 {
        margin-top: .65rem !important;
        padding-top: .5rem !important;
        padding-bottom: .5rem !important;
    }

    #pems-sidebar-nav {
        padding-top: .55rem !important;
        padding-bottom: .55rem !important;
    }

    .pems-nav-link {
        min-height: 34px !important;
        padding-top: .38rem !important;
        padding-bottom: .38rem !important;
    }

    .pems-shell-sidebar > div:last-child {
        padding: .65rem !important;
    }

    .pems-shell-main {
        padding-top: .9rem !important;
        padding-bottom: 1rem !important;
    }
}

/*
|--------------------------------------------------------------------------
| Top header responsiveness
|--------------------------------------------------------------------------
*/
.pems-shell-header-inner {
    min-width: 0;
}

@media (min-width: 1024px) and (max-width: 1240px) {
    .pems-shell-header-inner > div:last-child {
        gap: .35rem;
    }

    .pems-select-button {
        min-height: 34px;
        padding: .38rem .65rem;
        font-size: .7rem;
    }
}

/*
|--------------------------------------------------------------------------
| Table usability
|--------------------------------------------------------------------------
*/
#pems-main-content .overflow-x-auto {
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}

@container pems-main (max-width: 900px) {
    .pems-table {
        font-size: .77rem;
    }

    .pems-table th {
        padding: .58rem .62rem;
        font-size: .58rem;
    }

    .pems-table td {
        padding: .68rem .62rem;
    }
}

/*
|--------------------------------------------------------------------------
| Buttons and filters on constrained content widths
|--------------------------------------------------------------------------
*/
@container pems-main (max-width: 560px) {
    .pems-button-primary,
    .pems-button-secondary,
    .pems-button-danger,
    .pems-button-gold,
    .pems-button-light {
        min-height: 42px;
    }

    .pems-page-banner [class*="sm:flex-row"],
    .pems-panel [class*="sm:flex-row"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}


/*
|--------------------------------------------------------------------------
| Phase 1P.2.2 â€” Global UI Consistency Standards
|--------------------------------------------------------------------------
*/

.pems-empty-state {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.75rem 1.25rem;
    text-align: center;
}

.pems-empty-state--compact {
    min-height: 190px;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.pems-empty-state-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    opacity: .22;
    filter: grayscale(1);
}

.pems-empty-state-title {
    margin-top: 1rem;
    font-family: Impact, "Arial Black", "Segoe UI", Arial, sans-serif;
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: .035em;
    text-transform: uppercase;
    color: rgba(92, 0, 0, .20);
}

.pems-empty-state-message {
    max-width: 36rem;
    margin: .65rem auto 0;
    font-size: .82rem;
    line-height: 1.6;
    color: #64748b;
}

.pems-empty-state-actions {
    margin-top: 1rem;
}

.pems-medal-badge {
    position: relative;
    width: 72px;
    margin-inline: auto;
    text-align: center;
}

.pems-medal-badge-svg {
    width: 52px;
    height: 62px;
    margin-inline: auto;
    filter: drop-shadow(0 7px 9px rgba(65, 0, 0, .12));
}

.pems-medal-badge-count {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-family: Impact, "Arial Black", "Segoe UI", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

.pems-medal-badge-label {
    margin-top: -3px;
    font-size: .48rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.pems-table-gradient-shell {
    overflow: hidden;
    border: 1px solid #ded4cf;
    border-radius: .75rem;
    background: #fff;
}

.pems-table-gradient-scroll {
    overflow-x: auto;
}

.pems-table-gradient {
    width: 100%;
    border-collapse: collapse;
}

.pems-table-gradient thead {
    background: linear-gradient(90deg, #690000 0%, #7c0707 55%, #8d1414 100%);
}

.pems-table-gradient thead th {
    background: transparent !important;
    color: #fff !important;
}

@media (min-width: 1440px) {
    .pems-shell-main,
    .pems-shell-header-inner {
        max-width: var(--pems-content-max);
    }
}


/*
|--------------------------------------------------------------------------
| Phase 1P.2.3 â€” Compact authenticated controls
|--------------------------------------------------------------------------
*/
#pems-main-content select.pems-field,
#pems-main-content input.pems-field {
    height: 34px !important;
    min-height: 34px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: .76rem !important;
    line-height: 34px !important;
}

#pems-main-content select.pems-field {
    padding-left: .75rem !important;
    padding-right: 2rem !important;
}

#pems-main-content input.pems-field {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
}

#pems-main-content .pems-field-label {
    margin-bottom: .3rem !important;
    font-size: .7rem !important;
}

#pems-main-content .pems-filter-panel {
    padding: .85rem 1rem !important;
}

#pems-main-content .pems-button-primary,
#pems-main-content .pems-button-secondary,
#pems-main-content .pems-button-danger,
#pems-main-content .pems-button-gold,
#pems-main-content .pems-button-light,
#pems-main-content .pems-select-button {
    min-height: 34px !important;
    padding-top: .35rem !important;
    padding-bottom: .35rem !important;
}

/* Public medal table alignment. */
.pems-medals-table {
    width: 100% !important;
    table-layout: fixed;
}

.pems-medals-table th,
.pems-medals-table td {
    vertical-align: middle;
}

.pems-medals-table .pems-medal-team-cell {
    min-width: 0;
}

.pems-medals-table .pems-medal-team-cell > a {
    min-width: 0;
}

.pems-medals-table .pems-medal-team-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Make sure gradient reaches the full table width. */
.pems-table-gradient thead,
.pems-table-gradient thead tr {
    width: 100%;
    background: linear-gradient(90deg, #690000 0%, #7c0707 55%, #8d1414 100%) !important;
}

.pems-table-gradient thead th {
    background: transparent !important;
}

/* Slightly slower public-page arrival, used after wire:navigate. */
.pems-public-slow-fade-target {
    will-change: opacity, transform;
}


/*
|--------------------------------------------------------------------------
| Phase 1P.2.3.2 â€” Mobile-first public portal polish
|--------------------------------------------------------------------------
*/

.pems-mobile-only {
    display: none;
}

.pems-desktop-only {
    display: block;
}

/* Shared desktop medal grid: same definition for header + rows. */
.pems-medal-grid {
    display: grid;
    grid-template-columns: 64px minmax(250px, 1fr) 112px 112px 112px 84px;
    align-items: center;
}

.pems-medal-grid > * {
    min-width: 0;
}

.pems-medal-grid-team,
.pems-medal-grid-team > a {
    min-width: 0;
}

.pems-medal-grid-team-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pems-public-ranking-head,
.pems-public-ranking-row {
    grid-template-columns: 70px minmax(0, 1fr) 120px 160px;
}

.pems-event-result-head,
.pems-event-result-row {
    grid-template-columns: 80px minmax(0, 1fr) 110px 120px;
}

@media (max-width: 767.98px) {
    :root {
        --pems-public-header-offset: 96px;
    }

    .pems-mobile-only {
        display: block !important;
    }

    .pems-desktop-only {
        display: none !important;
    }

    .pems-public-header-inner {
        width: 100%;
        padding-inline: 10px;
    }

    .pems-public-nav {
        margin-inline: -10px;
        padding-inline: 8px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .pems-public-nav-track {
        justify-content: flex-start;
    }

    .pems-public-nav-link {
        min-width: 64px;
        scroll-snap-align: center;
        padding: 7px 8px 6px;
    }

    .pems-public-nav-label {
        font-size: 6.4px;
        letter-spacing: .12em;
    }

    .pems-public-actions .pems-public-button {
        min-height: 30px;
        padding-inline: 8px;
        font-size: 7px;
    }

    .pems-public-page > section:first-child h1.font-pems-display {
        font-size: 2.35rem !important;
        line-height: .94 !important;
        letter-spacing: .04em !important;
    }

    .pems-public-page > section:first-child p {
        font-size: .78rem;
        line-height: 1.55;
    }

    .pems-public-select,
    .pems-public-input {
        height: 34px;
        font-size: 11px;
    }

    .pems-public-filter-label {
        font-size: 7px;
        margin-bottom: 5px;
    }

    .pems-empty-state {
        min-height: 170px;
        padding: 1.75rem .9rem;
    }

    .pems-empty-state--compact {
        min-height: 145px;
        padding-top: 1.4rem;
        padding-bottom: 1.4rem;
    }

    .pems-empty-state-logo {
        width: 54px;
        height: 54px;
    }

    .pems-empty-state-title {
        margin-top: .75rem;
        font-size: 1.25rem;
    }

    .pems-empty-state-message {
        margin-top: .5rem;
        font-size: .76rem;
        line-height: 1.5;
    }

    /* Landing ranking rows fit phone widths without horizontal scrolling. */
    .pems-public-ranking-head,
    .pems-public-ranking-row {
        grid-template-columns: 44px minmax(0, 1fr) 68px !important;
        gap: 8px;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .pems-public-ranking-head .pems-public-ranking-source,
    .pems-public-ranking-row .pems-public-ranking-source {
        display: none !important;
    }

    .pems-public-ranking-row .pems-public-ranking-team {
        gap: 8px;
    }

    .pems-public-ranking-row .pems-public-ranking-team img {
        width: 30px !important;
        height: 30px !important;
    }

    .pems-public-ranking-row .pems-public-ranking-points {
        text-align: right;
    }

    /* Event-result rows collapse into readable mobile cards. */
    .pems-event-result-head {
        display: none !important;
    }

    .pems-event-result-row {
        grid-template-columns: 48px minmax(0, 1fr) !important;
        gap: 4px 10px !important;
        padding: .8rem .75rem !important;
    }

    .pems-event-result-row > :nth-child(3),
    .pems-event-result-row > :nth-child(4) {
        grid-column: 2;
        text-align: left !important;
    }

    .pems-medal-badge {
        width: 58px;
    }

    .pems-medal-badge-svg {
        width: 44px;
        height: 52px;
    }

    .pems-medal-badge-count {
        top: 27px;
        font-size: .9rem;
    }

    .pems-medal-badge-label {
        font-size: .42rem;
    }

    .pems-mobile-ranking-card,
    .pems-mobile-medal-card {
        border: 1px solid #ded4cf;
        border-radius: .85rem;
        background: #fff;
        overflow: hidden;
    }

    .pems-mobile-ranking-card + .pems-mobile-ranking-card,
    .pems-mobile-medal-card + .pems-mobile-medal-card {
        margin-top: .7rem;
    }

    .pems-mobile-ranking-card-header,
    .pems-mobile-medal-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .75rem .85rem;
        border-bottom: 1px solid #eee7e2;
        background: #fffdfb;
    }

    .pems-mobile-ranking-card-body,
    .pems-mobile-medal-card-body {
        padding: .8rem .85rem;
    }

    .pems-mobile-medal-counts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .35rem;
        align-items: start;
    }
}

@media (max-width: 420px) {
    .pems-public-nav-link {
        min-width: 60px;
        padding-inline: 6px;
    }

    .pems-public-page > section:first-child h1.font-pems-display {
        font-size: 2.05rem !important;
    }

    .pems-public-container {
        width: calc(100% - 20px);
    }
}


/*
|--------------------------------------------------------------------------
| Phase 1Q.1.6 â€” Locked borderless modal close control
|--------------------------------------------------------------------------
| The close action is visually only the X icon. The 42Ã—42 button remains an
| invisible hit target: no border, box, circle, background or shadow.
|--------------------------------------------------------------------------
*/
.pems-modal-close {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-flex !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    flex: 0 0 42px !important;
    align-items: center !important;
    justify-content: center !important;
    margin: -6px -7px -4px 0 !important;
    padding: 0 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 24px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(255,255,255,.88) !important;
    cursor: pointer !important;
    opacity: .92;
    transition:
        color 120ms ease,
        opacity 120ms ease,
        transform 120ms ease !important;
}

.pems-modal-close-icon {
    display: block !important;
    width: 25px !important;
    height: 25px !important;
    flex: 0 0 25px !important;
    overflow: visible !important;
    pointer-events: none !important;
    transition: transform 120ms ease !important;
}

.pems-modal-close:hover,
.pems-modal-close:active,
.pems-modal-close:focus,
.pems-modal-close:focus-visible {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.pems-modal-close:hover {
    color: #ffffff !important;
    opacity: 1;
}

.pems-modal-close:hover .pems-modal-close-icon {
    transform: scale(1.08);
}

.pems-modal-close:active .pems-modal-close-icon {
    transform: scale(.92);
}

.pems-modal-close:focus,
.pems-modal-close:focus-visible {
    outline: none !important;
}

@media (max-width: 640px) {
    .pems-modal-close {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        flex-basis: 40px !important;
        margin-right: -5px !important;
    }

    .pems-modal-close-icon {
        width: 24px !important;
        height: 24px !important;
        flex-basis: 24px !important;
    }
}

/* pems-user-role-checkbox-normalization - Phase 1T.5.22.1 */
[data-pems-required-group="role_ids"] input[type="checkbox"] {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex: 0 0 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
    vertical-align: middle;
    accent-color: #2563eb;
}

/* =====================================================================
   Phase 1T.5.66 - Desktop sidebar collapse
   ===================================================================== */
@media (min-width: 1024px) {
    [data-pems-shell-root] .pems-shell-sidebar,
    [data-pems-shell-root] .pems-shell-workspace {
        transition: width 220ms ease, padding-left 220ms ease;
    }

    [data-pems-shell-root].pems-shell-is-collapsed {
        --pems-sidebar-width: 78px;
    }

    .pems-sidebar-collapse-button {
        position: absolute;
        top: .8rem;
        right: .7rem;
        z-index: 30;
        display: inline-flex;
        width: 2.1rem;
        height: 2.1rem;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, .14);
        border-radius: .72rem;
        background: rgba(255, 255, 255, .08);
        color: rgba(255, 255, 255, .88);
        cursor: pointer;
        transition: background-color 150ms ease, transform 180ms ease, color 150ms ease;
    }

    .pems-sidebar-collapse-button:hover {
        background: rgba(255, 255, 255, .15);
        color: #fff;
    }

    .pems-sidebar-collapse-button:focus-visible {
        outline: 2px solid rgba(251, 191, 36, .75);
        outline-offset: 2px;
    }

    .pems-sidebar-collapse-button svg {
        width: 1.15rem;
        height: 1.15rem;
        transition: transform 180ms ease;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-sidebar-collapse-button {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-sidebar-collapse-button svg {
        transform: rotate(90deg);
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-shell-sidebar > div:first-child {
        min-height: 4rem;
        padding: 0 !important;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-shell-sidebar > div:first-child > .relative.z-10 {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    [data-pems-shell-root].pems-shell-is-collapsed #pems-sidebar-nav {
        padding-left: .55rem !important;
        padding-right: .55rem !important;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-nav-group {
        display: none !important;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-nav-link {
        justify-content: center;
        gap: 0 !important;
        min-height: 2.75rem;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow: hidden;
        white-space: nowrap;
        font-size: 0 !important;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-nav-icon {
        flex: 0 0 2.3rem;
        width: 2.3rem !important;
        height: 2.3rem !important;
        margin: 0 !important;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-nav-icon svg {
        width: 1.2rem;
        height: 1.2rem;
    }

    [data-pems-shell-root].pems-shell-is-collapsed .pems-shell-sidebar > div:last-child {
        display: none;
    }
}

@media (max-width: 1023.98px) {
    .pems-sidebar-collapse-button {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-pems-shell-root] .pems-shell-sidebar,
    [data-pems-shell-root] .pems-shell-workspace,
    .pems-sidebar-collapse-button,
    .pems-sidebar-collapse-button svg {
        transition: none !important;
    }
}
/* BEGIN P-EMTS Phase 1T.5.91.17 Season Theme Typography */
.pems-season-theme-type-card {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid rgba(116, 24, 24, .16);
    border-radius: .9rem;
    background: #fffdf8;
}
.pems-season-theme-type-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid rgba(116, 24, 24, .10);
}
.pems-season-theme-type-kicker,
.pems-season-theme-preview-kicker,
.pems-season-theme-stored-label {
    font-size: .62rem;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: .10em;
    text-transform: uppercase;
    color: #9a6a16;
}
.pems-season-theme-type-title {
    margin-top: .25rem;
    font-size: .95rem;
    line-height: 1.25;
    font-weight: 900;
    color: #741818;
}
.pems-season-theme-type-note {
    flex: 0 0 auto;
    padding: .35rem .6rem;
    border: 1px solid rgba(215, 170, 29, .45);
    border-radius: 999px;
    background: #fff8df;
    font-size: .65rem;
    line-height: 1.2;
    font-weight: 800;
    color: #7c5a13;
}
.pems-season-theme-type-grid,
.pems-season-theme-upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
.pems-season-theme-size-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
}
.pems-season-theme-size-row > span {
    font-size: .72rem;
    font-weight: 800;
    color: #64748b;
}
.pems-season-theme-help {
    margin-top: .35rem;
    font-size: .68rem;
    line-height: 1.5;
    color: #64748b;
}
.pems-season-theme-upload-main,
.pems-season-theme-stored-font {
    min-width: 0;
    padding: .85rem;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: .75rem;
    background: #fff;
}
.pems-season-theme-font-native {
    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;
}
.pems-season-theme-font-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .7rem;
    margin-top: .75rem;
}
.pems-season-theme-font-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.45rem;
    padding: .55rem .8rem;
    border: 1px solid #9f2020;
    border-radius: .7rem;
    background: #fff;
    color: #741818;
    font-size: .72rem;
    line-height: 1.2;
    font-weight: 850;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.pems-season-theme-font-picker-button:hover {
    background: #fff8f2;
    border-color: #741818;
}
.pems-season-theme-font-picker-button:focus-visible {
    outline: 2px solid rgba(215, 170, 29, .75);
    outline-offset: 2px;
}
.pems-season-theme-font-picker-button svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}
.pems-season-theme-font-filename {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: .58rem .72rem;
    border: 1px solid rgba(148, 163, 184, .30);
    border-radius: .7rem;
    background: #f8fafc;
    color: #475569;
    font-size: .72rem;
    line-height: 1.2;
}
.pems-season-theme-font-status {
    margin-top: .65rem;
    padding: .55rem .65rem;
    border-radius: .65rem;
    background: #fff8df;
    color: #755512;
    font-size: .68rem;
    line-height: 1.45;
    font-weight: 700;
}
.pems-season-theme-upload-explainer {
    margin-top: .45rem;
}
.pems-season-theme-stored-state {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .55rem;
    color: #334155;
    font-size: .74rem;
    line-height: 1.3;
    font-weight: 800;
}
.pems-season-theme-stored-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .22rem .4rem;
    border-radius: 999px;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: .58rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: .06em;
}
.pems-season-theme-stored-value {
    margin-top: .35rem;
    overflow-wrap: anywhere;
    font-size: .75rem;
    line-height: 1.45;
    font-weight: 800;
    color: #334155;
}
.pems-season-theme-remove-font {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: .7rem;
    font-size: .72rem;
    line-height: 1.3;
    font-weight: 750;
    color: #741818;
}
.pems-season-theme-remove-font input {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}
.pems-season-theme-preview {
    margin-top: 1rem;
    padding: .85rem 1rem;
    border: 1px solid rgba(215, 170, 29, .42);
    border-radius: .75rem;
    background: #fff8e8;
}
.pems-season-theme-preview-line {
    margin-top: .55rem;
    min-height: 2rem;
    text-align: center;
    line-height: 1.35;
    color: #673d18;
    overflow-wrap: anywhere;
    transition: font-size .14s ease;
}
.pems-season-theme-preview-line strong {
    color: #741818;
}
.pems-season-theme-preview > p {
    margin-top: .55rem;
    text-align: center;
    font-size: .66rem;
    line-height: 1.4;
    color: #64748b;
}
@media (max-width: 760px) {
    .pems-season-theme-type-grid,
    .pems-season-theme-upload-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .pems-season-theme-type-heading {
        flex-direction: column;
        align-items: stretch;
    }
    .pems-season-theme-type-note {
        align-self: flex-start;
    }
    .pems-season-theme-font-picker {
        grid-template-columns: minmax(0, 1fr);
    }
    .pems-season-theme-font-picker-button {
        width: 100%;
    }
}
/* END P-EMTS Phase 1T.5.91.17 Season Theme Typography */
