.ema-panel {
    color: #193b31;
    font-size: 15px;
}

.ema-panel-header {
    align-items: center;
    background: #173a2f;
    border-bottom: 3px solid #d8af57;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    padding: 18px clamp(14px, 3vw, 30px);
}

.ema-panel-header h1 {
    color: #fff9ec;
    font-size: clamp(22px, 3vw, 30px);
    margin: 0;
    padding: 0;
}

.ema-panel-logout {
    color: #fff9ec;
    padding: 8px;
}

.ema-panel-logout:hover {
    color: #f6d689;
}

.ema-panel-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.ema-panel-navigation a {
    background: #fff;
    border: 1px solid #cbd9ce;
    border-radius: 8px;
    color: #193b31;
    font-weight: 600;
    padding: 10px 16px;
    text-decoration: none;
}

.ema-panel-navigation a:hover {
    border-color: #225942;
}

.ema-panel-navigation a[aria-current="page"] {
    background: #225942;
    border-color: #225942;
    color: #fff;
}

.ema-panel-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 12px;
}

.ema-panel-layout section {
    background: #fff;
    border: 1px solid #dce6dd;
    border-radius: 12px;
    min-width: 0;
    padding: clamp(14px, 2.5vw, 24px);
}

.ema-panel-layout h2 {
    color: #193b31;
    font-size: 20px;
    margin: 0 0 16px;
}

.ema-panel-members li {
    border-bottom: 1px solid #ebefea;
    display: grid;
    gap: 4px 16px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
    overflow-wrap: anywhere;
    padding: 10px 0;
}

.ema-panel-members li span {
    color: #475a50;
    font-size: 13px;
}

.ema-panel-listing {
    align-items: stretch;
    background: #fafcf9;
    border: 1px solid #dce6dd;
    border-radius: 10px;
    display: grid;
    gap: 8px clamp(12px, 1.5vw, 22px);
    grid-template-columns: minmax(0, 1fr);
    margin: 8px 0 0;
    padding: 8px clamp(9px, 1.3vw, 16px);
}

.ema-panel-listing-with-photos {
    grid-template-columns: clamp(120px, 13vw, 174px) minmax(0, 1fr);
}

.ema-panel-listing-body {
    container-type: inline-size;
    display: grid;
    gap: 4px;
    grid-template-rows: 1fr auto 1fr;
    min-width: 0;
}

.ema-panel-listing-body > header {
    align-self: start;
}

.ema-panel-listing-toggle {
    display: none;
}

.ema-panel-listing:not(.ema-panel-listing-with-photos) .ema-panel-listing-body {
    grid-template-rows: auto auto;
}

.ema-panel-listing h3 {
    font-size: 17px;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
}

.ema-panel-photos {
    align-self: center;
    height: clamp(88px, 9vw, 116px);
    position: relative;
}

.ema-panel-cover {
    display: block;
    inset: 0;
    position: absolute;
}

.ema-panel-cover img {
    border-radius: 8px;
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.ema-panel-photo-count {
    background: #193b31;
    border-radius: 6px;
    bottom: 5px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 7px;
    position: absolute;
    right: 5px;
}

.ema-panel-gallery {
    background: #fff;
    border: 1px solid #cbd9ce;
    border-radius: 14px;
    box-sizing: border-box;
    color: #193b31;
    max-height: 90vh;
    padding: clamp(12px, 3vw, 22px);
    width: min(760px, calc(100vw - 24px));
}

.ema-panel-gallery::backdrop {
    background: rgb(19 42 34 / 72%);
}

.ema-panel-gallery-header,
.ema-panel-gallery-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.ema-panel-gallery-image {
    background: #f4f6f1;
    border-radius: 8px;
    display: block;
    margin: 12px auto;
    max-height: min(54vh, 530px);
    max-width: 100%;
}

.ema-panel-gallery-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.ema-panel-gallery-option {
    background: #fff;
    border: 2px solid #cbd9ce;
    border-radius: 7px;
    cursor: pointer;
    padding: 2px;
}

.ema-panel-gallery-option[aria-pressed="true"] {
    border-color: #225942;
}

.ema-panel-gallery-option img {
    border-radius: 4px;
    display: block;
    height: 48px;
    object-fit: cover;
    width: 64px;
}

.ema-panel-listing-summary {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
}

.ema-panel-details {
    display: grid;
    flex: 1 1 min(100%, 440px);
    gap: 5px 10px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 98px), 1fr));
    margin: 0;
}

.ema-panel-details dt,
.ema-panel-event dt {
    color: #385d4b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.ema-panel-details dd,
.ema-panel-event dd {
    color: #243a30;
    font-size: 13px;
    line-height: 1.35;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

.ema-panel-description {
    font-size: 13px;
    line-height: 1.4;
    margin: 3px 0;
    overflow-wrap: anywhere;
}

.ema-panel-listing-actions {
    align-items: end;
    background: #f0f5ee;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-inline-start: auto;
    max-width: 100%;
    padding: 5px 8px;
}

@container (min-width: 760px) {
    .ema-panel-details {
        flex-basis: 360px;
    }
}

.ema-panel-event {
    margin: 0;
}

.ema-panel-listing-actions form {
    display: flex;
    gap: 7px;
    margin: 0;
}

.ema-panel .ema-panel-listing-actions button {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    min-height: 30px;
    white-space: nowrap;
}

.ema-panel-queue-next {
    margin-top: 12px;
    text-align: center;
}

.ema-panel-pages {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.ema-panel-pages {
    justify-content: center;
    margin-top: 14px;
}

.ema-panel .button-primary,
.login .button-primary {
    background: #225942;
    border-color: #225942;
}

.ema-panel .button-primary:hover,
.login .button-primary:hover {
    background: #163c2d;
    border-color: #163c2d;
}

body.login {
    background: linear-gradient(145deg, #e9f1e8, #f8f3e8);
}

.login h1 a {
    background: none;
    color: #173a2f;
    font-size: 25px;
    font-weight: 700;
    height: auto;
    letter-spacing: -.025em;
    margin-bottom: 18px;
    text-indent: 0;
    width: auto;
}

.login form {
    border-color: #dce6dd;
    border-radius: 12px;
}

@media (max-width: 782px) {
    .ema-panel-listing-with-photos {
        grid-template-columns: minmax(0, 1fr);
    }

    .ema-panel-photos {
        max-width: 260px;
    }

    .ema-panel-listing-with-photos .ema-panel-listing-body {
        grid-template-rows: auto auto;
    }

    .ema-panel--compact .ema-panel-listing-with-photos {
        grid-template-columns: 54px minmax(0, 1fr);
    }

    .ema-panel--compact .ema-panel-listing {
        align-items: center;
        gap: 8px;
    }

    .ema-panel--compact .ema-panel-photos {
        height: 44px;
    }

    .ema-panel--compact .ema-panel-photo-count {
        bottom: 2px;
        font-size: 11px;
        line-height: 1.2;
        padding: 2px 4px;
        right: 2px;
    }

    .ema-panel--compact .ema-panel-photo-label {
        display: none;
    }

    .ema-panel--compact .ema-panel-listing-toggle {
        align-items: center;
        background: transparent;
        border: 0;
        border-radius: 6px;
        color: inherit;
        cursor: pointer;
        display: flex;
        font: inherit;
        font-size: 14px;
        gap: 6px;
        min-height: 44px;
        min-width: 0;
        padding: 0 2px;
        text-align: start;
    }

    .ema-panel-listing-toggle:focus-visible {
        outline: 2px solid #225942;
        outline-offset: 2px;
    }

    .ema-panel-toggle-title {
        flex: 1;
        font-weight: 700;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ema-panel-toggle-label {
        align-items: center;
        color: #285744;
        display: inline-flex;
        flex: none;
        font-size: 12px;
        gap: 6px;
    }

    .ema-panel-toggle-label::after {
        border-block-end: 1px solid currentColor;
        border-inline-end: 1px solid currentColor;
        content: "";
        height: 6px;
        margin-block-start: -3px;
        transform: rotate(45deg);
        width: 6px;
    }

    .ema-panel-listing-toggle[aria-expanded="true"] .ema-panel-toggle-label::after {
        margin-block-start: 3px;
        transform: rotate(225deg);
    }

    .ema-panel--compact .ema-panel-listing-body {
        border-top: 1px solid #dce6dd;
        grid-column: 1 / -1;
        padding-top: 8px;
    }

    .ema-panel--compact .ema-panel-listing-toggle[aria-expanded="false"] + .ema-panel-listing-body {
        display: none;
    }

    .ema-panel-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .ema-panel-details > div,
    .ema-panel-event {
        align-items: baseline;
        display: grid;
        gap: 7px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    }

    .ema-panel-details dd,
    .ema-panel-event dd {
        margin: 0;
    }

    .ema-panel-listing-actions {
        box-sizing: border-box;
        margin-inline-start: 0;
        width: 100%;
    }

    .ema-panel-event {
        width: 100%;
    }

    .ema-panel-listing-actions form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
        width: 100%;
    }

    .ema-panel .ema-panel-listing-actions button {
        min-height: 44px;
        padding: 4px;
        white-space: normal;
    }

    .ema-panel-navigation a {
        flex: 1 1 auto;
        text-align: center;
    }
}
